dpid.h - Contains an API for manipulating PID files.
Contents
Detailed Description
Contains an API for manipulating PID files.
Definition in file dpid.h.
Function Documentation
intdaemon_pid_file_create(void)
Creates PID pid file for the current process.
Returns
zero on success, nonzero on failure
Examplestestd.c.
pid_tdaemon_pid_file_is_running(void)
Returns the PID file of a running daemon, if available.
Returns
The PID or negative on failure
Examplestestd.c.
intdaemon_pid_file_kill(ints)
Kills a running daemon, if available.
Parameterss The signal to send
Returns
zero on success, nonzero on failure
intdaemon_pid_file_kill_wait(ints,intm)
Similar to daemon_pid_file_kill() but waits until the process died. This functions is new in libdaemon
0.3. The macro DAEMON_PID_FILE_KILL_WAIT_AVAILABLE is defined iff libdaemon supports this function.
Parameterss The signal to send
m Seconds to wait at maximum
Returns
zero on success, nonzero on failure (timeout condition is considered a failure)
Since
0.3
SeealsoDAEMON_PID_FILE_KILL_WAIT_AVAILABLEExamplestestd.c.
constchar*daemon_pid_file_proc_default(void)
A function for creating a pid file name from daemon_pid_file_ident.
Returns
The PID file path
intdaemon_pid_file_remove(void)
Removes the PID file of the current process.
Returns
zero on success, nonzero on failure
Examplestestd.c.
Macro Definition Documentation
#defineDAEMON_PID_FILE_KILL_WAIT_AVAILABLE1
This variable is defined to 1 iff daemon_pid_file_kill_wait() is supported.
Since
0.3
Seealsodaemon_pid_file_kill_wait()
Definition at line 82 of file dpid.h.
Name
dpid.h - Contains an API for manipulating PID files.
Synopsis
#include <sys/types.h>
Macros
#define DAEMON_PID_FILE_KILL_WAIT_AVAILABLE 1
This variable is defined to 1 iff daemon_pid_file_kill_wait() is supported.
Typedefs
typedef const char *(* daemon_pid_file_proc_t) (void)
Prototype of a function for generating the name of a PID file.
Functions
const char * daemon_pid_file_proc_default (void)
A function for creating a pid file name from daemon_pid_file_ident.
int daemon_pid_file_create (void)
Creates PID pid file for the current process.
int daemon_pid_file_remove (void)
Removes the PID file of the current process.
pid_t daemon_pid_file_is_running (void)
Returns the PID file of a running daemon, if available.
int daemon_pid_file_kill (int s)
Kills a running daemon, if available.
int daemon_pid_file_kill_wait (int s, int m)
Similar to daemon_pid_file_kill() but waits until the process died.
Variables
const char * daemon_pid_file_ident
Identification string for the PID file name, only used when daemon_pid_file_proc is set to
daemon_pid_file_proc_default().
daemon_pid_file_proc_tdaemon_pid_file_proc
A function pointer which is used to generate the name of the PID file to manipulate.
Typedef Documentation
typedefconstchar*(*daemon_pid_file_proc_t)(void)
Prototype of a function for generating the name of a PID file.
Definition at line 37 of file dpid.h.
Variable Documentation
constchar*daemon_pid_file_ident[extern]
Identification string for the PID file name, only used when daemon_pid_file_proc is set to
daemon_pid_file_proc_default(). Use daemon_ident_from_argv0() to generate an identification string from
argv[0]
Examplestestd.c.
daemon_pid_file_proc_tdaemon_pid_file_proc[extern]
A function pointer which is used to generate the name of the PID file to manipulate. Points to
daemon_pid_file_proc_default() by default.
