Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ daemonize(3) — IRIX 6.5.3f

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

close(2)

chdir(2)

fork(2)

getdtablesize(2)

syslog(3B)

setsid(2)

tty(1)

tty(7)



DAEMONIZE(3)                                                      DAEMONIZE(3)



NAME
     _daemonize - make a process into a daemon

SYNOPSIS
     #include <unistd.h>

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

DESCRIPTION
     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 & DFNOFORK is 0, then a new process in a new session is
     started.  Debugging is often easier with flags set to contain DFNOFORK.

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

     If flags & DFNOCLOSE 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
     close(2), chdir(2), fork(2), getdtablesize(2), syslog(3B), setsid(2),
     tty(1), tty(7)

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























                                                                        Page 1



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026