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 (int sig)
 Send signal to 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.12 2003/02/11 21:27:39 martinp 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(), and STRERROR.

int exist_daemon  
 

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

Definition at line 170 of file daemonize.c.

References get_pid(), getpgid(), myrun::pidfile, and Run.

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

int kill_daemon int    sig
 

Send signal to a daemon process.

Parameters:
sig  Signal to send daemon to
Returns:
TRUE if signal was send, otherwise FALSE

Definition at line 134 of file daemonize.c.

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

Referenced by start_httpd().