The daemon consists of global settings and a number of workers. More...
#include "util/locks.h"
#include "util/alloc.h"
#include "services/modstack.h"
#include "dnstap/dnstap_config.h"
#include "dnscrypt/dnscrypt_config.h"
Data Structures | |
struct | daemon |
Structure holding worker list. More... | |
Functions | |
struct daemon * | daemon_init (void) |
Initialize daemon structure. More... | |
int | daemon_open_shared_ports (struct daemon *daemon) |
Open shared listening ports (if needed). More... | |
int | daemon_privileged (struct daemon *daemon) |
Do daemon setup that needs privileges like opening privileged ports or opening device files. More... | |
void | daemon_fork (struct daemon *daemon) |
Fork workers and start service. More... | |
void | daemon_cleanup (struct daemon *daemon) |
Close off the worker thread information. More... | |
void | daemon_delete (struct daemon *daemon) |
Delete workers, close listening ports. More... | |
void | daemon_apply_cfg (struct daemon *daemon, struct config_file *cfg) |
Apply config settings. More... | |
The daemon consists of global settings and a number of workers.
struct daemon* daemon_init | ( | void | ) |
Initialize daemon structure.
Referenced by run_daemon().
int daemon_open_shared_ports | ( | struct daemon * | daemon | ) |
Open shared listening ports (if needed).
The cfg member pointer must have been set for the daemon.
daemon | the daemon. |
References daemon::acl_interface, acl_interface_init(), daemon::cfg, config_del_strarray(), config_file::ifs, daemon::listening_port, listening_ports_free(), listening_ports_open(), log_assert, config_file::num_ifs, daemon::num_ports, config_file::num_threads, config_file::port, daemon::ports, resolve_interface_names(), daemon::reuseport, and config_file::so_reuseport.
int daemon_privileged | ( | struct daemon * | daemon | ) |
Do daemon setup that needs privileges like opening privileged ports or opening device files.
The cfg member pointer must have been set for the daemon.
daemon | the daemon. |
References module_env::alloc, daemon::cfg, module_env::cfg, daemon::env, daemon::mods, modstack_call_startup(), config_file::module_conf, daemon::superalloc, and module_env::worker.
Referenced by perform_setup().
void daemon_fork | ( | struct daemon * | daemon | ) |
Fork workers and start service.
When the routine exits, it is no longer forked.
daemon | the daemon. |
References log_assert, daemon::views, and views_create().
void daemon_cleanup | ( | struct daemon * | daemon | ) |
Close off the worker thread information.
Bring the daemon back into state ready for daemon_fork again.
daemon | the daemon. |
References module_env::auth_zones, auth_zones_cleanup(), daemon_clear_allocs(), daemon_remote_clear(), daemon::env, forwards_delete(), module_env::fwds, module_env::hints, hints_delete(), daemon::local_zones, local_zones_delete(), log_assert, log_thread_set(), module_env::msg_cache, daemon::need_to_exit, daemon::num, daemon::old_num, daemon::rc, daemon::respip_set, respip_set_delete(), daemon::reuse_cache, module_env::rrset_cache, signal_handling_record(), slabhash_clear(), rrset_cache::table, daemon::views, views_delete(), worker_delete(), and daemon::workers.
Referenced by service_deinit().
void daemon_delete | ( | struct daemon * | daemon | ) |
Delete workers, close listening ports.
daemon | the daemon. |
References daemon::acl, daemon::acl_interface, acl_list_delete(), alloc_clear(), module_env::auth_zones, auth_zones_delete(), daemon::chroot, daemon::cookie_secrets, cookie_secrets_delete(), daemon_remote_delete(), edns_known_options_delete(), module_env::edns_strings, edns_strings_delete(), daemon::env, module_env::infra_cache, infra_delete(), listen_desetup_locks(), daemon::listen_sslctx, listen_sslctx_delete_ticket_keys(), listening_ports_free(), log_err(), daemon::mods, modstack_call_deinit(), modstack_call_destartup(), modstack_free(), module_env::msg_cache, daemon::num_ports, daemon::pidfile, daemon::ports, daemon::rand, daemon::rc, daemon::rc_ports, module_env::rrset_cache, rrset_cache_delete(), slabhash_delete(), daemon::superalloc, daemon::tcl, tcl_list_delete(), ub_c_lex_destroy(), ub_openssl_lock_delete(), and ub_randfree().
Referenced by service_deinit().
void daemon_apply_cfg | ( | struct daemon * | daemon, |
struct config_file * | cfg | ||
) |
Apply config settings.
daemon | the daemon. |
cfg | new config settings. |
References daemon::cfg, config_apply(), daemon_clear_allocs(), daemon::env, HASH_DEFAULT_STARTARRAY, log_warn(), module_env::msg_cache, config_file::msg_cache_size, config_file::msg_cache_slabs, msgreply_sizefunc(), config_file::num_threads, daemon::old_num, query_entry_delete(), query_info_compare(), reply_info_delete(), module_env::rrset_cache, config_file::rrset_cache_size, config_file::rrset_cache_slabs, slabhash_clear(), slabhash_create(), slabhash_delete(), slabhash_is_size(), rrset_cache::table, and daemon::worker_allocs.
Referenced by apply_settings().