Commit | Line | Data |
---|---|---|
0683223a MW |
1 | .\" -*-nroff-*- |
2 | .TH daemonize 3 "6 January 2007" "Straylight/Edgeware" "mLib utilities library" | |
3 | .SH NAME | |
4 | daemonize \- 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 | |
15 | The | |
16 | .B daemonize | |
17 | function causes the current process to become a background process. It | |
18 | detaches from its controlling terminal and arranges never to acquire | |
19 | another controlling terminal. If it fails for some reason (probably | |
20 | because | |
21 | .BR fork (2) | |
22 | failed), | |
23 | .B daemonize | |
24 | returns \-1 and sets | |
25 | .BR errno ; | |
26 | on success, it returns 0. | |
27 | .PP | |
28 | The | |
29 | .B detachtty | |
30 | does half of the job of | |
31 | .BR daemonize : | |
32 | it detaches from its controlling terminal, and calls | |
33 | .BR setsid (2) | |
34 | and | |
35 | .BR fork (2) | |
36 | so that it can't acquire a new controlling terminal in future. Errors | |
37 | are ignored. | |
38 | .SH SEE ALSO | |
39 | .BR mLib (3). | |
40 | .SH AUTHOR | |
41 | Mark Wooding, <mdw@distorted.org.uk> |