daemonize.c File Reference

Transform this program into a daemon and provide methods for managing the daemon. More...

Go to the source code of this file.

Functions

void daemonize ()
 Transform a program into a daemon. More...

int kill_daemon ()
 Kill a daemon process. More...

int exist_daemon ()


Detailed Description

Transform this program into a daemon and provide methods for managing the daemon.

Author:
Jan-Henrik Haukeland, <hauk@tildeslash.com>
Version:
$Id: daemonize.c,v 1.7 2002/08/26 16:28:39 chopp Exp $

Definition in file daemonize.c.


Function Documentation

void daemonize  
 

Transform a program into a daemon.

Inspired by code from Stephen A. Rago's book, Unix System V Network Programming.

Definition at line 70 of file daemonize.c.

References log(), signal(), and STRERROR.

int exist_daemon  
 

Returns:
TRUE (i.e. the daemons pid) if a daemon process is running, otherwise FALSE

Definition at line 180 of file daemonize.c.

References is_process_running(), myprocess::pidfile, myrun::pidfile, and Run.

Referenced by dstart_process(), dstop_process(), and kill_daemon().

int kill_daemon  
 

Kill a daemon process.

Returns:
TRUE if the daemon was killed, otherwise FALSE

Definition at line 148 of file daemonize.c.

References error(), exist_daemon(), prog, and STRERROR.