daemonize.c File Reference

Setup the Kamailio daemon prozess. More...

#include <sys/types.h>
#include <signal.h>
#include <errno.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <unistd.h>
#include "daemonize.h"
#include "globals.h"
#include "dprint.h"

Include dependency graph for daemonize.c:

Go to the source code of this file.

Defines

#define __EXTENSIONS__
#define __USE_XOPEN_EXTENDED
#define _XOPEN_SOURCE
#define _XOPEN_SOURCE_EXTENDED

Functions

int daemonize (int *own_pgid)
 daemon init
int do_suid (const int uid, const int gid)
 set daemon user and group id
int increase_open_fds (unsigned int target)
 try to increase the open file limit
int set_core_dump (int enable, unsigned int size)
 enable or disable core dumps


Detailed Description

Setup the Kamailio daemon prozess.

Definition in file daemonize.c.


Define Documentation

#define __EXTENSIONS__

Definition at line 43 of file daemonize.c.

#define __USE_XOPEN_EXTENDED

Definition at line 42 of file daemonize.c.

#define _XOPEN_SOURCE

Definition at line 38 of file daemonize.c.

#define _XOPEN_SOURCE_EXTENDED

Definition at line 41 of file daemonize.c.


Function Documentation

int daemonize ( int *  own_pgid  ) 

daemon init

Parameters:
own_pgid daemon process group
Returns:
return 0 on success, -1 on error

Definition at line 63 of file daemonize.c.

References chroot_dir, disable_core_dump, LM_CRIT, LM_ERR, LM_WARN, log_stderr, NULL, pgid_file, pid, pid_file, and working_dir.

Referenced by main().

int do_suid ( const int  uid,
const int  gid 
)

set daemon user and group id

Parameters:
uid user id
gid group id
Returns:
return 0 on success, -1 on error

Definition at line 223 of file daemonize.c.

References disable_core_dump, LM_CRIT, and LM_ERR.

Referenced by main_loop().

int increase_open_fds ( unsigned int  target  ) 

try to increase the open file limit

Parameters:
target target that should be reached
Returns:
return 0 on success, -1 on error

Definition at line 258 of file daemonize.c.

References LM_CRIT, LM_DBG, and LM_INFO.

Referenced by main().

int set_core_dump ( int  enable,
unsigned int  size 
)

enable or disable core dumps

Parameters:
enable set to 1 to enable, to 0 to disable
size core dump size
Returns:
return 0 on success, -1 on error

Definition at line 316 of file daemonize.c.

References LM_CRIT, and LM_DBG.

Referenced by main().


Generated on Mon May 21 18:00:38 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6