.\" -*-nroff-*- .TH daemonize 3 "6 January 2007" "Straylight/Edgeware" "mLib utilities library" .SH NAME daemonize \- become a background process .\" @detachtty .\" @daemonize .SH SYNOPSIS .nf .B "#include " .B "void detachtty(void);" .B "int daemonize(void);" .fi .SH DESCRIPTION The .B daemonize function causes the current process to become a background process. It detaches from its controlling terminal and arranges never to acquire another controlling terminal. If it fails for some reason (probably because .BR fork (2) failed), .B daemonize returns \-1 and sets .BR errno ; on success, it returns 0. .PP The .B detachtty does half of the job of .BR daemonize : it detaches from its controlling terminal, and calls .BR setsid (2) and .BR fork (2) so that it can't acquire a new controlling terminal in future. Errors are ignored. .SH SEE ALSO .BR mLib (3). .SH AUTHOR Mark Wooding,