chiark / gitweb /
Manpages: Move manpages (back?) into the top-level directory.
[mLib] / daemonize.3
CommitLineData
0683223a
MW
1.\" -*-nroff-*-
2.TH daemonize 3 "6 January 2007" "Straylight/Edgeware" "mLib utilities library"
3.SH NAME
4daemonize \- become a background process
5.\" @detachtty
6.\" @daemonize
7.SH SYNOPSIS
8.nf
9.B "#include <mLib/daemonize.h>"
10
11.B "void detachtty(void);"
12.B "int daemonize(void);"
13.fi
14.SH DESCRIPTION
15The
16.B daemonize
17function causes the current process to become a background process. It
18detaches from its controlling terminal and arranges never to acquire
19another controlling terminal. If it fails for some reason (probably
20because
21.BR fork (2)
22failed),
23.B daemonize
24returns \-1 and sets
25.BR errno ;
26on success, it returns 0.
27.PP
28The
29.B detachtty
30does half of the job of
31.BR daemonize :
32it detaches from its controlling terminal, and calls
33.BR setsid (2)
34and
35.BR fork (2)
36so that it can't acquire a new controlling terminal in future. Errors
37are ignored.
38.SH SEE ALSO
39.BR mLib (3).
40.SH AUTHOR
41Mark Wooding, <mdw@distorted.org.uk>