process-cpp: /build/process-cpp/src/process-cpp-3.0.1/include/core/posix/wait.h Source File

process-cpp 3.0.0 A simple convenience library for handling processes in C++11.

wait.h
Go to the documentation of this file.
1 /*
2 * Copyright © 2013 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Thomas Voß <thomas.voss@canonical.com>
17 */
18
19 #ifndef CORE_POSIX_WAIT_H_
20 #define CORE_POSIX_WAIT_H_
21
22 #include <core/posix/exit.h>
23 #include <core/posix/signal.h>
24 #include <core/posix/visibility.h>
25
26 #include <bitset>
27
28 #include <cstdint>
29
30 #include <sys/wait.h>
31
32 namespace core
33 {
34 namespace posix
35 {
36 namespace wait
37 {
38
42 enum class Flags : std::uint8_t
43 {
44 continued = WCONTINUED,
45 untraced = WUNTRACED,
46 no_hang = WNOHANG
47 };
48
49 CORE_POSIX_DLL_PUBLIC Flags operator|(Flags l, Flags r);
50
54 struct CORE_POSIX_DLL_PUBLIC Result
55 {
59 enum class Status
60 {
61 undefined,
62 no_state_change,
63 exited,
64 signaled,
65 stopped,
66 continued
67 } status = Status::undefined;
68
72 union
73 {
77 struct
78 {
79 exit::Status status;
80 } if_exited;
81
85 struct
86 {
87 Signal signal;
88 bool core_dumped;
89 } if_signaled;
90
94 struct
95 {
96 Signal signal;
97 } if_stopped;
98 } detail;
99 };
100 }
101 }
102 }
103
104 #endif // CORE_POSIX_WAIT_H_
visibility.h
core::posix::wait::Flags::continued
@ continued
Also wait for a child to continue after having been stopped.
exit.h
CORE_POSIX_DLL_PUBLIC
#define CORE_POSIX_DLL_PUBLIC
Definition: visibility.h:26
core::posix::wait::Result::core_dumped
bool core_dumped
true if the process termination resulted in a core dump.
Definition: wait.h:88
core::posix::exit::Status
Status
The Status enum wrap's the posix exit status.
Definition: exit.h:34
core::posix::wait::Result
The Result struct encapsulates the result of waiting for a process state change.
Definition: wait.h:55
core::posix::Signal
Signal
The Signal enum collects the most common POSIX signals.
Definition: signal.h:39
core
Definition: child_process.h:32
core::posix::wait::Result::status
exit::Status status
Exit status of the process.
Definition: wait.h:79
signal.h
core::posix::wait::operator|
CORE_POSIX_DLL_PUBLIC Flags operator|(Flags l, Flags r)
Definition: wait.cpp:27
core::posix::wait::Result::signal
Signal signal
Signal that caused the process to terminate.
Definition: wait.h:87
core::posix::wait::Result::Status
Status
The status of the process/wait operation.
Definition: wait.h:60
core::posix::wait::Flags
Flags
Flags enumerates different behavior when waiting for a child process to change state.
Definition: wait.h:43