35#include <sys/resource.h>
37wait4(pid_t pid,
int *statusp,
int options,
struct rusage *rusage);
A collection of assert function wrappers.
An abstract interface for handling I/O events, timers, and such.
#define trace_with_mask(s, m)
trace_with_mask() is used to trace function call chain in C++ program.
SigAction is a C++ wrapper around sigaction structure.
Class SigHandler is a UNIX signal handlers manager/dispatcher class.
Singleton template class allows to turn any new or existing class T into Singleton Pattern.
A wrapper class to provide AutoPtr with reference semantics.
int handle_signal(int signum_)
Signal handler callback.
ForkList is a singleton class that keeps a list of all forked children.
list< fnode_t * > m_list
List of children's data structures.
~ForkList()
Destructor. Wipe out childer based on their state.
Fork class is a simple wrapper around C library function fork().
state_t
Child completion states.
@ KILL_ON_EXIT
Kill all childer on exit.
@ WAIT_ON_EXIT
Wait for all children to exit.
@ LEAVE_ALONE
Ignore all running children on exit.
bool isChild() const
Test whether we are in child section of the code.
@ COLLECT_STATUS
Wait for child to complete and collect its exit status.
@ IGNORE_STATUS
Don't wait for child to complete.
SigAction m_old_disp
Old signal disposition.
SigHandler m_local_sh
Local signal handler.
bool isParent() const
Test whether we are in parent section of the code.
static int fork_exec(const string &cmd_, const string &args_, wait4status_t wait_for_completion_, bool ignore_output_=false)
Execute an external command.
int get_exit_status() const
Retrieve exit status of a child process if the constructor's parameter catch_status_ was set to TRUE.
pid_t getChildPID() const
Retrieve child process id.
ChildStatusHandler m_chstath
Handler to catch Child's status.
pid_t getPID() const
Retrieve child pid.
fnode_t(pid_t pid_, Fork::state_t state_)
Constructor.
bool needKill() const
Retrieve kill flag.
Fork::state_t m_state
Child state {kill, wait}.
@ FORK
Class Fork messages