xref: /csrg-svn/lib/libc/gen/daemon.3 (revision 62881)
1*62881Sbostic.\" Copyright (c) 1993
2*62881Sbostic.\"	The Regents of the University of California.  All rights reserved.
359429Sbostic.\"
459429Sbostic.\" %sccs.include.redist.man%
559429Sbostic.\"
6*62881Sbostic.\"	@(#)daemon.3	8.1 (Berkeley) 06/09/93
759429Sbostic.Dd
859429Sbostic.Dt DAEMON 3
959429Sbostic.Os
1059429Sbostic.Sh NAME
1159429Sbostic.Nm daemon
1259429Sbostic.Nd run in the background
1359429Sbostic.Sh SYNOPSIS
1459429Sbostic.Fn daemon "int nochdir" "int noclose"
1559429Sbostic.Sh DESCRIPTION
1659429Sbostic.Pp
1759429SbosticThe
1859429Sbostic.Fn daemon
1959429Sbosticfunction is for programs wishing to detach themselves from the
2059429Sbosticcontrolling terminal and run in the background as system daemons.
2159429Sbostic.Pp
2259429SbosticUnless the argument
2359429Sbostic.Fa nochdir
2459429Sbosticis non-zero,
2559429Sbostic.Fn daemon
2659429Sbosticchanges the current working directory to the root (``/'').
2759429Sbostic.Pp
2859429SbosticUnless the argument
2959429Sbostic.Fa noclose
3059429Sbosticis non-zero,
3159429Sbostic.Fn daemon
3259429Sbosticwill redirect standard input, standard output and standard error
3359429Sbosticto ``/dev/null''.
3459429Sbostic.Sh ERRORS
3559429SbosticThe function
3659429Sbostic.Fn daemon
3759429Sbosticmay fail and set
3859429Sbostic.Va errno
3959429Sbosticfor any of the errors specified for the library functions
4059429Sbostic.Xr fork 2
4159429Sbosticand
4259429Sbostic.Xr setsid 2 .
4359429Sbostic.Sh SEE ALSO
4459429Sbostic.Xr setsid 2
4559429Sbostic.Sh HISTORY
4659429SbosticThe
4759429Sbostic.Fn daemon
4862880Sbosticfunction first appeared in 4.4BSD.
49