71 if (
cmd_.size () == 0) {
94 for (
int i = 0;
i < 1024;
i++) {
115 return f.getChildPID ();
118 return f.get_exit_status ();
169 EL((
ASSAERR,
"failed to fork() - out of swap space?\n"));
192 list<fnode_t* >::iterator
i;
199 if ((*i)->needKill()) {
200 ::kill((*i)->getPID(),
SIGTERM);
205 while ( !
m_list.empty() ) {
214 list<fnode_t* >::iterator
j;
217 if ((*j)->getPID() == pid) {
Class to handle processing command-line options.
An abstract interface for handling I/O events, timers, and such.
A simple wrapper around fork() library function call.
#define EL(X)
A macro for writing error message to the Logger.
#define DL(X)
A macro for writing debug message to the Logger.
#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.
#define ASSA_DECL_SINGLETON(K)
ASSA_DECL_SINGLETON macro inserts static member declarations mandated by the Singleton class.
A wrapper class to provide AutoPtr with reference semantics.
int handle_signal(int signum_)
Signal handler callback.
static void str_to_argv(const string &src_, int &argc_, char **&argv_)
Static function.
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.
@ LEAVE_ALONE
Ignore all running children on exit.
@ COLLECT_STATUS
Wait for child to complete and collect its exit status.
SigAction m_old_disp
Old signal disposition.
SigHandler m_local_sh
Local signal handler.
static int fork_exec(const string &cmd_, const string &args_, wait4status_t wait_for_completion_, bool ignore_output_=false)
Execute an external command.
Fork(state_t exit_action_=WAIT_ON_EXIT, wait4status_t catch_status_=COLLECT_STATUS)
Fork the current process in two immediately.
ChildStatusHandler m_chstath
Handler to catch Child's status.
virtual int remove(int signum_, EventHandler *eh_=0, SigAction *new_disp_=0, SigAction *old_disp_=0)
Remove EventHandler associated with signum_.
virtual int install(int signum_, EventHandler *new_hand_, SigAction *new_disp_=0, EventHandler **old_hand_=0, SigAction *old_disp_=0)
Add new signal handler and new disposition for the signal.
static ForkList * get_instance()
Return an instance of templated class T.
@ FORK
Class Fork messages
@ ASSAERR
ASSA and system errors