![]() | :: | Software | :: | ucspi-ipc |
The ipchandle.c program provides a framework for compiling preforking ipcserver-like servers.
Each ipchandle server accepts all ipcserver options, and in addition:
-f lockfile: Lock lockfile around calls to accept.
The concurrency option (-c) sets the number of children that a ipchandle server forks upon startup. The default setting is 40. Each child process listens for requests on the socket inherited from the parent process.
If any of its child processes exits, a ipchandle server forks a new child process to replace the original. When it receives SIGTERM, a ipchandle server sends SIGTERM to each of its children, waits for them to exit, and then itself exits.
Before handling an accepted request, a ipchandle server sets certain environment variables, a la ipcserver.
void server(int argc,char * const *argv)The arguments to server are the command line arguments to the ipchandle server that remain after option parsing.
The server subroutine is called within a loop, with one iteration per request. It must release any resources allocated to handle a particular request before returning to its caller. This includes changes to the environment.
build myserver
The ucspi-ipc package includes two example servers: ipcprint, and ipcperl.