Salad  1.0.15
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Functions
Sld_daemon

Functions

void sld_daemon_daemonize (char *pid_file_name, char *runas_user, char *runas_group)
 Executes code contained in sld_daemon_start() as a background process using the specified options. More...
 
void sld_daemon_start ()
 Wrap code within this function to execute it as a background process. More...
 
pid_t sld_daemon_write_pid_file (char *pid_file_name)
 Writes the PID (process ID) to the specified file. More...
 

Detailed Description

This module contains functions related to daemons.

Function Documentation

void sld_daemon_daemonize ( char *  pid_file_name,
char *  runas_user,
char *  runas_group 
)

Executes code contained in sld_daemon_start() as a background process using the specified options.

Parameters
pid_file_namepath to PID (process ID) file
runas_useruser account to run process as – use NULL to run the process as the current user
runas_groupgroup to run process as – use NULL to run the process as the current primary group
sld_daemon_daemonize("salad.pid", "foo", "bar");
Examples:
daemon.c.
void sld_daemon_start ( )

Wrap code within this function to execute it as a background process.

{
for(;;)
{
do_something();
sleep(10);
}
}
Examples:
daemon.c.
pid_t sld_daemon_write_pid_file ( char *  pid_file_name)

Writes the PID (process ID) to the specified file.

Parameters
pid_file_namepath to PID (process ID) file
Returns
PID (process ID) of running process