1*59429Sbostic.\" Copyright (c) 1993 The Regents of the University of California. 2*59429Sbostic.\" All rights reserved. 3*59429Sbostic.\" 4*59429Sbostic.\" %sccs.include.redist.man% 5*59429Sbostic.\" 6*59429Sbostic.\" @(#)daemon.3 5.1 (Berkeley) 04/27/93 7*59429Sbostic.Dd 8*59429Sbostic.Dt DAEMON 3 9*59429Sbostic.Os 10*59429Sbostic.Sh NAME 11*59429Sbostic.Nm daemon 12*59429Sbostic.Nd run in the background 13*59429Sbostic.Sh SYNOPSIS 14*59429Sbostic.Fn daemon "int nochdir" "int noclose" 15*59429Sbostic.Sh DESCRIPTION 16*59429Sbostic.Pp 17*59429SbosticThe 18*59429Sbostic.Fn daemon 19*59429Sbosticfunction is for programs wishing to detach themselves from the 20*59429Sbosticcontrolling terminal and run in the background as system daemons. 21*59429Sbostic.Pp 22*59429SbosticUnless the argument 23*59429Sbostic.Fa nochdir 24*59429Sbosticis non-zero, 25*59429Sbostic.Fn daemon 26*59429Sbosticchanges the current working directory to the root (``/''). 27*59429Sbostic.Pp 28*59429SbosticUnless the argument 29*59429SbosticUnless the argument 30*59429Sbostic.Fa noclose 31*59429Sbosticis non-zero, 32*59429Sbostic.Fn daemon 33*59429Sbosticwill redirect standard input, standard output and standard error 34*59429Sbosticto ``/dev/null''. 35*59429Sbostic.Sh ERRORS 36*59429SbosticThe function 37*59429Sbostic.Fn daemon 38*59429Sbosticmay fail and set 39*59429Sbostic.Va errno 40*59429Sbosticfor any of the errors specified for the library functions 41*59429Sbostic.Xr fork 2 42*59429Sbosticand 43*59429Sbostic.Xr setsid 2 . 44*59429Sbostic.Sh SEE ALSO 45*59429Sbostic.Xr setsid 2 46*59429Sbostic.Sh HISTORY 47*59429SbosticThe 48*59429Sbostic.Fn daemon 49*59429Sbosticfunction is 50*59429Sbostic.Ud . 51