Home | History | Annotate | Download | only in daemon

Lines Matching refs: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));
484 setup_sslctxs(struct daemon* daemon, struct config_file* cfg)
487 if(!(daemon->rc = daemon_remote_create(cfg)))
499 (void)setup_listen_sslctx(&daemon->listen_dot_sslctx, 1, 0, cfg);
502 (void)setup_listen_sslctx(&daemon->listen_doh_sslctx, 0, 1, cfg);
507 if(!(daemon->listen_quic_sslctx = quic_sslctx_create(
514 if(!(daemon->connect_dot_sslctx = connect_sslctx_create(NULL, NULL,
518 (void)daemon;(void)cfg;
524 perform_setup(struct daemon* daemon, struct config_file* cfg, int debug_mode,
534 if(!daemon_privileged(daemon))
548 (void)setup_sslctxs(daemon, cfg);
572 daemon->pidfile = strdup(cfg->pidfile);
573 else daemon->pidfile = fname_after_chroot(cfg->pidfile,
575 if(!daemon->pidfile)
585 checkoldpid(daemon->pidfile, pidinchroot);
597 writepid(daemon->pidfile, getpid());
600 (void)daemon;
641 if(daemon->pidfile && daemon->pidfile[0] &&
642 strncmp(daemon->pidfile, cfg->chrootdir,
644 char* old = daemon->pidfile;
645 daemon->pidfile = strdup(old+strlen(cfg->chrootdir));
647 if(!daemon->pidfile)
650 daemon->chroot = strdup(cfg->chrootdir);
651 if(!daemon->chroot)
652 log_err("out of memory in daemon chroot dir storage");
711 daemon->cfgfile = strdup(*cfgfile);
712 if(!daemon->cfgfile)
713 fatal_exit("out of memory in daemon cfgfile strdup");
717 * Run the daemon.
728 struct daemon* daemon = NULL;
731 if(!(daemon = daemon_init()))
733 while(!daemon->need_to_exit) {
741 if(!config_read(cfg, cfgfile, daemon->chroot)) {
750 apply_settings(daemon, cfg, cmdline_verbose, debug_mode);
755 if(!daemon_open_shared_ports(daemon))
758 perform_setup(daemon, cfg, debug_mode, &cfgfile, need_pidfile);
766 daemon_fork(daemon);
770 daemon_cleanup(daemon);
776 if(daemon->pidfile) {
779 fd = open(daemon->pidfile, O_WRONLY | O_TRUNC
787 unlink(daemon->pidfile);
789 daemon_delete(daemon);