*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->IRIX man pages -> daemonize (3)              
Title
Content
Arch
Section
 

Contents


DAEMONIZE(3)							  DAEMONIZE(3)


NAME    [Toc]    [Back]

     _daemonize	- make a process into a	daemon

SYNOPSIS    [Toc]    [Back]

     #include <unistd.h>

     int _daemonize(int	flags, int fd1,	int fd2, int fd3);

DESCRIPTION    [Toc]    [Back]

     The _daemonize function does the common work needed ``to put a function
     into the background,'' or to make it into a ``daemon.''  That generally
     includes forking a	new process, closing most files, and releasing the
     controlling tty.

     If	flags &	_DF_NOFORK is 0, then a	new process in a new session is
     started.  Debugging is often easier with flags set	to contain _DF_NOFORK.

     If	flags &	_DF_NOCHDIR is 0, then the current working directory is
     changed to	/.  Otherwise, the current working directory is	unchanged.

     If	flags &	_DF_NOCLOSE is 0, then all file	descriptors except fd1,	fd2,
     and fd3 are closed.  Because _daemonize closes all	file descriptors,
     closelog()	is called to stop logging cleanly.  The	fd# arguments should
     be	-1 if they are not file	descriptors to be left open.

SEE ALSO    [Toc]    [Back]

      
      
     close(2), chdir(2), fork(2), getdtablesize(2), syslog(3B),	setsid(2),
     tty(1), tty(7)

DIAGNOSTICS    [Toc]    [Back]

     The returned value	-1 indicates that one of the necessary system calls
     failed.


									PPPPaaaaggggeeee 1111
[ Back ]
 Similar pages
Name OS Title
idle Linux make process 0 idle
vxiod HP-UX VERITAS Volume Manager I/O daemon process control device
getpgid HP-UX get process, process group and parent process ID.
getpgrp HP-UX get process, process group and parent process ID.
getpid IRIX get process, process group, and parent process IDs
getpgrp2 HP-UX get process, process group and parent process ID.
getpid Tru64 Get the process ID, process group ID, or parent process ID
getpgrp Tru64 Get the process ID, process group ID, or parent process ID
getppid Tru64 Get the process ID, process group ID, or parent process ID
getpid HP-UX get process, process group and parent process ID.
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service