39
39
#include <stdlib.h>
40
#include <sys/types.h>
40
43
#include <unistd.h>
42
int daemonize(int nochdir, int noclose);
44
int daemonize(int nochdir, int noclose)
44
#include <sys/select.h>
46
int daemonize(int nochdir, int noclose, int wait_sigusr1);
47
int daemon_is_ready(void);
48
void sigusr1_handler(int sig);
52
void sigusr1_handler(int sig)
60
kill(parent_pid, SIGUSR1);
64
int daemonize(int nochdir, int noclose, int wait_sigusr1)
70
signal(SIGUSR1, sigusr1_handler);
86
while (waitpid(child, &status, 0) != child);
87
if (WIFEXITED(status))
89
exit_code= WEXITSTATUS(status);
91
if (WIFSIGNALED(status))
54
99
_exit(EXIT_SUCCESS);
57
104
if (setsid() == -1)