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 perform_setup(struct daemon* daemon, struct config_file* cfg, int debug_mode,
478 if(!daemon_privileged(daemon))
493 if(!(daemon->rc = daemon_remote_create(cfg)))
496 if(!(daemon->listen_sslctx = listen_sslctx_create(
500 if (!SSL_CTX_set_cipher_list(daemon->listen_sslctx, cfg->tls_ciphers)) {
506 if (!SSL_CTX_set_ciphersuites(daemon->listen_sslctx, cfg->tls_ciphersuites)) {
513 if(!listen_sslctx_setup_ticket_keys(daemon->listen_sslctx, cfg->tls_session_ticket_keys.first)) {
518 if(!(daemon->connect_sslctx = connect_sslctx_create(NULL, NULL,
545 daemon->pidfile = strdup(cfg->pidfile);
546 else daemon->pidfile = fname_after_chroot(cfg->pidfile,
548 if(!daemon->pidfile)
558 checkoldpid(daemon->pidfile, pidinchroot);
570 writepid(daemon->pidfile, getpid());
573 (void)daemon;
614 if(daemon->pidfile && daemon->pidfile[0] &&
615 strncmp(daemon->pidfile, cfg->chrootdir,
617 char* old = daemon->pidfile;
618 daemon->pidfile = strdup(old+strlen(cfg->chrootdir));
620 if(!daemon->pidfile)
623 daemon->chroot = strdup(cfg->chrootdir);
624 if(!daemon->chroot)
625 log_err("out of memory in daemon chroot dir storage");
687 * Run the daemon.
698 struct daemon* daemon = NULL;
701 if(!(daemon = daemon_init()))
703 while(!daemon->need_to_exit) {
711 if(!config_read(cfg, cfgfile, daemon->chroot)) {
719 apply_settings(daemon, cfg, cmdline_verbose, debug_mode);
724 if(!daemon_open_shared_ports(daemon))
727 perform_setup(daemon, cfg, debug_mode, &cfgfile, need_pidfile);
735 daemon_fork(daemon);
739 daemon_cleanup(daemon);
745 if(daemon->pidfile) {
748 fd = open(daemon->pidfile, O_WRONLY | O_TRUNC
756 unlink(daemon->pidfile);
758 daemon_delete(daemon);