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);
436 /* use POSIX daemon(3) function */
437 if(daemon(1, 0) != 0)
438 fatal_exit("daemon failed: %s", strerror(errno));
470 perform_setup(struct daemon* daemon, struct config_file* cfg, int debug_mode,
491 if(!(daemon->rc = daemon_remote_create(cfg)))
494 if(!(daemon->listen_sslctx = listen_sslctx_create(
498 if (!SSL_CTX_set_cipher_list(daemon->listen_sslctx, cfg->tls_ciphers)) {
504 if (!SSL_CTX_set_ciphersuites(daemon->listen_sslctx, cfg->tls_ciphersuites)) {
511 if(!listen_sslctx_setup_ticket_keys(daemon->listen_sslctx, cfg->tls_session_ticket_keys.first)) {
516 if(!(daemon->connect_sslctx = connect_sslctx_create(NULL, NULL,
543 daemon->pidfile = strdup(cfg->pidfile);
544 else daemon->pidfile = fname_after_chroot(cfg->pidfile,
546 if(!daemon->pidfile)
548 checkoldpid(daemon->pidfile, pidinchroot);
560 if(writepid(daemon->pidfile, getpid())) {
564 if(chown(daemon->pidfile, cfg_uid, cfg_gid) == -1) {
567 daemon->pidfile, strerror(errno));
574 (void)daemon;
615 if(daemon->pidfile && daemon->pidfile[0] &&
616 strncmp(daemon->pidfile, cfg->chrootdir,
618 char* old = daemon->pidfile;
619 daemon->pidfile = strdup(old+strlen(cfg->chrootdir));
621 if(!daemon->pidfile)
624 daemon->chroot = strdup(cfg->chrootdir);
625 if(!daemon->chroot)
626 log_err("out of memory in daemon chroot dir storage");
688 * Run the daemon.
699 struct daemon* daemon = NULL;
702 if(!(daemon = daemon_init()))
704 while(!daemon->need_to_exit) {
712 if(!config_read(cfg, cfgfile, daemon->chroot)) {
720 apply_settings(daemon, cfg, cmdline_verbose, debug_mode);
725 if(!daemon_open_shared_ports(daemon))
728 perform_setup(daemon, cfg, debug_mode, &cfgfile, need_pidfile);
736 daemon_fork(daemon);
740 daemon_cleanup(daemon);
746 if(daemon->pidfile) {
749 fd = open(daemon->pidfile, O_WRONLY | O_TRUNC, 0644);
753 unlink(daemon->pidfile);
755 daemon_delete(daemon);