wait.h
Go to the documentation of this file.
/*
* Copyright © 2013 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Authored by: Thomas Voß <thomas.voss@canonical.com>
*/
#ifndef CORE_POSIX_WAIT_H_
#define CORE_POSIX_WAIT_H_
#include <core/posix/exit.h>
#include <core/posix/signal.h>
#include <core/posix/visibility.h>
#include <bitset>
#include <cstdint>
#include <sys/wait.h>
namespace core
{
namespace posix
{
namespace wait
{
enum class Flags : std::uint8_t
{
continued = WCONTINUED,
untraced = WUNTRACED,
no_hang = WNOHANG
};
CORE_POSIX_DLL_PUBLIC Flags operator|(Flags l, Flags r);
struct CORE_POSIX_DLL_PUBLIC Result
{
enum class Status
{
undefined,
no_state_change,
exited,
signaled,
stopped,
continued
} status = Status::undefined;
union
{
struct
{
exit::Status status;
} if_exited;
struct
{
Signal signal;
bool core_dumped;
} if_signaled;
struct
{
Signal signal;
} if_stopped;
} detail;
};
}
}
}
#endif // CORE_POSIX_WAIT_H_
exit.h
core::posix::exit::Status
Status
The Status enum wrap's the posix exit status.
Definition exit.h:34
core::posix::wait::operator|
CORE_POSIX_DLL_PUBLIC Flags operator|(Flags l, Flags r)
Definition wait.cpp:27
core::posix::wait::Flags
Flags
Flags enumerates different behavior when waiting for a child process to change state.
Definition wait.h:43
core::posix::wait::Flags::untraced
@ untraced
Also wait for state changes in untraced children.
core::posix::wait::Flags::no_hang
@ no_hang
Do not block if a child process hasn't changed state.
core::posix::wait::Flags::continued
@ continued
Also wait for a child to continue after having been stopped.
core::posix::Signal
Signal
The Signal enum collects the most common POSIX signals.
Definition signal.h:39
core
Definition child_process.h:32
signal.h
core::posix::wait::Result
The Result struct encapsulates the result of waiting for a process state change.
Definition wait.h:55
core::posix::wait::Result::status
exit::Status status
Exit status of the process.
Definition wait.h:79
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::wait::Result::Status
Status
The status of the process/wait operation.
Definition wait.h:60
core::posix::wait::Result::signal
Signal signal
Signal that caused the process to terminate.
Definition wait.h:87
visibility.h
CORE_POSIX_DLL_PUBLIC
#define CORE_POSIX_DLL_PUBLIC
Definition visibility.h:26