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.

int kill_daemon ()
 Kill a daemon process.

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.9 2002/12/21 11:19:13 hauk 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(), redirect_stdfd(), signal(), and STRERROR.

int exist_daemon  
 

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

Definition at line 177 of file daemonize.c.

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

Referenced by control(), control_group(), and kill_daemon().

int kill_daemon  
 

Kill a daemon process.

Returns:
TRUE if the daemon was killed, otherwise FALSE

Definition at line 145 of file daemonize.c.

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