DAEMON(3) BSD Programmer's Manual DAEMON(3) NNAAMMEE ddaaeemmoonn - run in the background SSYYNNOOPPSSIISS ddaaeemmoonn(_i_n_t _n_o_c_h_d_i_r, _i_n_t _n_o_c_l_o_s_e); DDEESSCCRRIIPPTTIIOONN The ddaaeemmoonn() function is for programs wishing to detach themselves from the controlling terminal and run in the background as system daemons. Unless the argument _n_o_c_h_d_i_r is non-zero, ddaaeemmoonn() changes the current working directory to the root (``/''). Unless the argument _n_o_c_l_o_s_e is non-zero, ddaaeemmoonn() will redirect standard input, standard output and standard error to ``/dev/null''. EERRRROORRSS The function ddaaeemmoonn() may fail and set _e_r_r_n_o for any of the errors speci- fied for the library functions fork(2) and setsid(2). SSEEEE AALLSSOO setsid(2) HHIISSTTOORRYY The ddaaeemmoonn() function first appeared in 4.4BSD. 4.4BSD June 9, 1993 1