Kea 2.5.8
process_spawn.h
Go to the documentation of this file.
1// Copyright (C) 2015-2024 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
73 const std::string& executable,
74 const ProcessArgs& args = ProcessArgs(),
75 const ProcessEnvVars& vars = ProcessEnvVars(),
76 const bool inherit_env = false);
77
88 ProcessSpawn(const std::string& executable,
89 const ProcessArgs& args = ProcessArgs(),
90 const ProcessEnvVars& vars = ProcessEnvVars(),
91 const bool inherit_env = false);
92
94 ~ProcessSpawn() = default;
95
97 std::string getCommandLine() const;
98
112 pid_t spawn(bool dismiss = false);
113
123 bool isRunning(const pid_t pid) const;
124
128 bool isAnyRunning() const;
129
142 int getExitStatus(const pid_t pid) const;
143
156 void clearState(const pid_t pid);
157
158private:
159
162};
163
164} // namespace asiolink
165} // namespace isc
166
167#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.