The "cm" Package

These routines are meant to provide a generic and simple to use child process management facility.

Library: karma
Link With: -lkarma

Functions

cm_manageRegister a function to manage a child process.
cm_unmanageTerminate the management of a child process for state changes.
cm_pollPoll for child process state changes.
cm_poll_silentPoll for child process state changes.

Prototype Functions

cm_PROTO_stop_funcThis routine is called when a child process is stopped.
cm_PROTO_term_funcThis routine is called when a child process is killed.
cm_PROTO_exit_funcThis routine is called when a child process exits.


Functions


flag cm_manage ( int pid, void (*stop_func) (), void (*term_func) (), void (*exit_func) () )

This routine will manage a child process for state changes by registering callback routines.

Parameters:

Returns: TRUE on success, else FALSE.
Multithreading Level: Unsafe
Note:


void cm_unmanage (int pid)

Terminate the management of a child process for state changes.

Parameters:

Returns: Nothing.
Multithreading Level: Unsafe


void cm_poll (flag block)

This routine will poll for any change in status of child processes. If the operating system does not support forking, the routine displays an error message. Those processes which have been registered using cm_manage will have any callback routines called. If a child has not been registered using cm_manage then the routine will print a warning message stating that the child was not managed.

Parameters:

Returns: Nothing.
Multithreading Level: Unsafe
Note:


void cm_poll_silent (flag block)

This routine will poll for any change in status of child processes. If the operating system does not support forking, the routine does not display an error message (unlike cm_poll. Those processes which have been registered using cm_manage will have any callback routines called. If a child has not been registered using cm_manage then the routine will print a warning message stating that the child was not managed.

Parameters:

Returns: Nothing.
Multithreading Level: Unsafe
Note:


Prototype Functions


void cm_PROTO_stop_func (int pid, int sig)

This routine is called when a child process is stopped.

Parameters:

Returns: Nothing.
Multithreading Level: Unsafe


void cm_PROTO_term_func (int pid, int sig, struct rusage *rusage)

This routine is called when a child process is killed.

Parameters:

Returns: Nothing.
Multithreading Level: Unsafe


void cm_PROTO_exit_func (int pid, int value, struct rusage *rusage)

This routine is called when a child process exits.

Parameters:

Returns: Nothing.
Multithreading Level: Unsafe


Back to Karma Home Page
Contact: Richard Gooch
Web Development: Ariel Internet Services