18 #include <sys/types.h> 22 # include <sys/wait.h> 35 #include <sys/resource.h> 37 wait4(pid_t pid,
int *statusp,
int options,
struct rusage *rusage);
130 bool isParent()
const {
return m_pid ? true :
false; }
136 bool isChild()
const {
return !m_pid ? true :
false; }
153 #endif // !defined(WIN32) 170 static int fork_exec (
const string& cmd_,
173 bool ignore_output_ =
false);
189 #endif // !defined(WIN32) 199 : m_pid(pid_), m_state(state_)
state_t
Child completion states.
Fork class is a simple wrapper around C library function fork().
Wait for all children to exit.
bool isParent() const
Test whether we are in parent section of the code.
ForkList is a singleton class that keeps a list of all forked children.
int handle_signal(int signum_)
Signal handler callback.
Kill all childer on exit.
ChildStatusHandler m_chstath
Handler to catch Child's status.
SigAction is a C++ wrapper around sigaction structure.
list< fnode_t *> m_list
List of children's data structures.
#define trace_with_mask(s, m)
trace_with_mask() is used to trace function call chain in C++ program.
A collection of assert function wrappers.
bool isChild() const
Test whether we are in child section of the code.
Singleton template class allows to turn any new or existing class T into Singleton Pattern...
Don't wait for child to complete.
pid_t getChildPID() const
Retrieve child process id.
Fork::state_t m_state
Child state {kill, wait}.
pid_t getPID() const
Retrieve child pid.
bool needKill() const
Retrieve kill flag.
An abstract interface for handling I/O events, timers, and such.
SigHandler m_local_sh
Local signal handler.
fnode_t(pid_t pid_, Fork::state_t state_)
Constructor.
Class SigHandler is a UNIX signal handlers manager/dispatcher class.
int get_exit_status() const
Retrieve exit status of a child process if the constructor's parameter catch_status_ was set to TRUE...
SigAction m_old_disp
Old signal disposition.