Kea 2.2.0
process_spawn.h
Go to the documentation of this file.
1// Copyright (C) 2015-2021 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#ifndef PROCESS_SPAWN_H
8#define PROCESS_SPAWN_H
9
10#include <asiolink/io_service.h>
12#include <boost/noncopyable.hpp>
13#include <string>
14#include <sys/types.h>
15#include <vector>
16#include <boost/shared_ptr.hpp>
17
18namespace isc {
19namespace asiolink {
20
23public:
24 ProcessSpawnError(const char* file, size_t line, const char* what) :
25 isc::Exception(file, line, what) { };
26};
27
30class ProcessSpawnImpl;
31
33typedef boost::shared_ptr<ProcessSpawnImpl> ProcessSpawnImplPtr;
34
37typedef std::vector<std::string> ProcessArgs;
38
41typedef std::vector<std::string> ProcessEnvVars;
42
61class ProcessSpawn : boost::noncopyable {
62public:
63
71 const std::string& executable,
72 const ProcessArgs& args = ProcessArgs(),
73 const ProcessEnvVars& vars = ProcessEnvVars());
74
76 ~ProcessSpawn() = default;
77
79 std::string getCommandLine() const;
80
94 pid_t spawn(bool dismiss = false);
95
105 bool isRunning(const pid_t pid) const;
106
110 bool isAnyRunning() const;
111
124 int getExitStatus(const pid_t pid) const;
125
138 void clearState(const pid_t pid);
139
140private:
141
144};
145
146} // namespace asiolink
147} // namespace isc
148
149#endif // PROCESS_SPAWN_H
This is a base class for exceptions thrown from the DNS library module.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Defines the logger used by the top-level component of kea-lfc.