Home | History | Annotate | Download | only in daemon

Lines Matching defs:daemon

2  * daemon/unbound.c - main program for unbound DNS resolver daemon.
40 * Main program to start the DNS resolver daemon.
49 #include "daemon/daemon.h"
50 #include "daemon/remote.h"
146 printf(" start unbound daemon DNS resolver.\n");
301 apply_settings(struct daemon* daemon, struct config_file* cfg,
311 daemon_apply_cfg(daemon, cfg);
434 /* use POSIX daemon(3) function */
435 if(daemon(1, 0) != 0)
436 fatal_exit("daemon failed: %s", strerror(errno));
468 setup_sslctx_remote(struct daemon* daemon, struct config_file* cfg)
471 if(!(daemon->rc = daemon_remote_create(cfg)))
474 (void)daemon;(void)cfg;
480 perform_setup(struct daemon* daemon, struct config_file* cfg, int debug_mode,
490 if(!daemon_privileged(daemon))
504 setup_sslctx_remote(daemon, cfg);
505 daemon_setup_sslctxs(daemon, cfg);
529 daemon->pidfile = strdup(cfg->pidfile);
530 else daemon->pidfile = fname_after_chroot(cfg->pidfile,
532 if(!daemon->pidfile)
542 checkoldpid(daemon->pidfile, pidinchroot);
554 writepid(daemon->pidfile, getpid());
557 (void)daemon;
598 if(daemon->pidfile && daemon->pidfile[0] &&
599 strncmp(daemon->pidfile, cfg->chrootdir,
601 char* old = daemon->pidfile;
602 daemon->pidfile = strdup(old+strlen(cfg->chrootdir));
604 if(!daemon->pidfile)
607 daemon->chroot = strdup(cfg->chrootdir);
608 if(!daemon->chroot)
609 log_err("out of memory in daemon chroot dir storage");
668 daemon->cfgfile = strdup(*cfgfile);
669 if(!daemon->cfgfile)
670 fatal_exit("out of memory in daemon cfgfile strdup");
674 * Run the daemon.
685 struct daemon* daemon = NULL;
688 if(!(daemon = daemon_init()))
690 while(!daemon->need_to_exit) {
698 if(!config_read(cfg, cfgfile, daemon->chroot)) {
707 apply_settings(daemon, cfg, cmdline_verbose, debug_mode);
712 if(!daemon_open_shared_ports(daemon))
715 perform_setup(daemon, cfg, debug_mode, &cfgfile, need_pidfile);
723 daemon_fork(daemon);
727 daemon_cleanup(daemon);
733 if(daemon->pidfile) {
736 fd = open(daemon->pidfile, O_WRONLY | O_TRUNC
744 unlink(daemon->pidfile);
746 daemon_delete(daemon);