<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>unbound: daemon/daemon.h File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.5.9 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="annotated.html"><span>Data Structures</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> <li><a href="dirs.html"><span>Directories</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>Globals</span></a></li> </ul> </div> <div class="navpath"><a class="el" href="dir_25e37f0a75013b615a5ba63405adf018.html">daemon</a> </div> </div> <div class="contents"> <h1>daemon.h File Reference</h1>The <a class="el" href="structdaemon.html" title="Structure holding worker list.">daemon</a> consists of global settings and a number of workers. <a href="#_details">More...</a> <p> <code>#include "util/locks.h"</code><br> <code>#include "<a class="el" href="alloc_8h.html">util/alloc.h</a>"</code><br> <code>#include "<a class="el" href="modstack_8h.html">services/modstack.h</a>"</code><br> <table border="0" cellpadding="0" cellspacing="0"> <tr><td></td></tr> <tr><td colspan="2"><br><h2>Data Structures</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">struct </td><td class="memItemRight" valign="bottom"><a class="el" href="structdaemon.html">daemon</a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Structure holding <a class="el" href="structworker.html" title="Structure holding working information for unbound.">worker</a> list. <a href="structdaemon.html#_details">More...</a><br></td></tr> <tr><td colspan="2"><br><h2>Functions</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">struct <a class="el" href="structdaemon.html">daemon</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="daemon_8h.html#b7230f7239e9666f8c3f98641673c5a7">daemon_init</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Initialize <a class="el" href="structdaemon.html" title="Structure holding worker list.">daemon</a> structure. <a href="#b7230f7239e9666f8c3f98641673c5a7"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="daemon_8h.html#d202086f374d499dc8b00e45dc7807c8">daemon_open_shared_ports</a> (struct <a class="el" href="structdaemon.html">daemon</a> *<a class="el" href="structdaemon.html">daemon</a>)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Open shared listening ports (if needed). <a href="#d202086f374d499dc8b00e45dc7807c8"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="daemon_8h.html#c526c25162040c3ff71131089fef9094">daemon_fork</a> (struct <a class="el" href="structdaemon.html">daemon</a> *<a class="el" href="structdaemon.html">daemon</a>)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Fork workers and start service. <a href="#c526c25162040c3ff71131089fef9094"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="daemon_8h.html#14888a119757eb59368fd04ecbad702e">daemon_cleanup</a> (struct <a class="el" href="structdaemon.html">daemon</a> *<a class="el" href="structdaemon.html">daemon</a>)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Close off the <a class="el" href="structworker.html" title="Structure holding working information for unbound.">worker</a> thread information. <a href="#14888a119757eb59368fd04ecbad702e"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="daemon_8h.html#92161d93862d15fb9c0370409d4703c2">daemon_delete</a> (struct <a class="el" href="structdaemon.html">daemon</a> *<a class="el" href="structdaemon.html">daemon</a>)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Delete workers, close listening ports. <a href="#92161d93862d15fb9c0370409d4703c2"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="daemon_8h.html#ff26682792c2bcd0f38fbfb1054717ed">daemon_apply_cfg</a> (struct <a class="el" href="structdaemon.html">daemon</a> *<a class="el" href="structdaemon.html">daemon</a>, struct <a class="el" href="structconfig__file.html">config_file</a> *cfg)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Apply config settings. <a href="#ff26682792c2bcd0f38fbfb1054717ed"></a><br></td></tr> </table> <hr><h2>Detailed Description</h2> The <a class="el" href="structdaemon.html" title="Structure holding worker list.">daemon</a> consists of global settings and a number of workers. <p> <hr><h2>Function Documentation</h2> <a class="anchor" name="b7230f7239e9666f8c3f98641673c5a7"></a><!-- doxytag: member="daemon.h::daemon_init" ref="b7230f7239e9666f8c3f98641673c5a7" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">struct <a class="el" href="structdaemon.html">daemon</a>* daemon_init </td> <td>(</td> <td class="paramname"> </td> <td> ) </td> <td><code> [read]</code></td> </tr> </table> </div> <div class="memdoc"> <p> Initialize <a class="el" href="structdaemon.html" title="Structure holding worker list.">daemon</a> structure. <p> <dl class="return" compact><dt><b>Returns:</b></dt><dd>: The <a class="el" href="structdaemon.html" title="Structure holding worker list.">daemon</a> structure, or NULL on error. </dd></dl> <p>References <a class="el" href="daemon_8h_source.html#l00098">daemon::acl</a>, <a class="el" href="acl__list_8c_source.html#l00050">acl_list_create()</a>, <a class="el" href="alloc_8c_source.html#l00097">alloc_init()</a>, <a class="el" href="daemon_8h_source.html#l00094">daemon::env</a>, <a class="el" href="log_8c_source.html#l00267">fatal_exit()</a>, <a class="el" href="log_8c_source.html#l00241">log_err()</a>, <a class="el" href="daemon_8h_source.html#l00096">daemon::mods</a>, <a class="el" href="modstack_8c_source.html#l00074">modstack_init()</a>, <a class="el" href="daemon_8h_source.html#l00088">daemon::need_to_exit</a>, <a class="el" href="daemon_8c_source.html#l00109">signal_handling_record()</a>, <a class="el" href="daemon_8h_source.html#l00092">daemon::superalloc</a>, <a class="el" href="daemon_8h_source.html#l00104">daemon::time_boot</a>, <a class="el" href="daemon_8h_source.html#l00102">daemon::time_last_stat</a>, and <a class="el" href="random_8c_source.html#l00092">ub_systemseed()</a>.</p> <p>Referenced by <a class="el" href="unbound_8c_source.html#l00525">run_daemon()</a>, and <a class="el" href="win__svc_8c_source.html#l00243">service_init()</a>.</p> </div> </div><p> <a class="anchor" name="d202086f374d499dc8b00e45dc7807c8"></a><!-- doxytag: member="daemon.h::daemon_open_shared_ports" ref="d202086f374d499dc8b00e45dc7807c8" args="(struct daemon *daemon)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int daemon_open_shared_ports </td> <td>(</td> <td class="paramtype">struct <a class="el" href="structdaemon.html">daemon</a> * </td> <td class="paramname"> <em>daemon</em> </td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p> Open shared listening ports (if needed). <p> The cfg member pointer must have been set for the <a class="el" href="structdaemon.html" title="Structure holding worker list.">daemon</a>. <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em><a class="el" href="structdaemon.html" title="Structure holding worker list.">daemon</a>,:</em> </td><td>the <a class="el" href="structdaemon.html" title="Structure holding worker list.">daemon</a>. </td></tr> </table> </dl> <dl class="return" compact><dt><b>Returns:</b></dt><dd>: false on error. </dd></dl> <p>References <a class="el" href="daemon_8h_source.html#l00068">daemon::cfg</a>, <a class="el" href="config__file_8h_source.html#l00242">config_file::control_port</a>, <a class="el" href="remote_8c_source.html#l00309">daemon_remote_open_ports()</a>, <a class="el" href="daemon_8h_source.html#l00074">daemon::listening_port</a>, <a class="el" href="listen__dnsport_8c_source.html#l00709">listening_ports_free()</a>, <a class="el" href="listen__dnsport_8c_source.html#l00633">listening_ports_open()</a>, <a class="el" href="log_8h_source.html#l00185">log_assert</a>, <a class="el" href="config__file_8h_source.html#l00067">config_file::port</a>, <a class="el" href="daemon_8h_source.html#l00076">daemon::ports</a>, <a class="el" href="daemon_8h_source.html#l00078">daemon::rc_port</a>, <a class="el" href="daemon_8h_source.html#l00080">daemon::rc_ports</a>, and <a class="el" href="config__file_8h_source.html#l00238">config_file::remote_control_enable</a>.</p> <p>Referenced by <a class="el" href="unbound_8c_source.html#l00525">run_daemon()</a>, and <a class="el" href="win__svc_8c_source.html#l00243">service_init()</a>.</p> </div> </div><p> <a class="anchor" name="c526c25162040c3ff71131089fef9094"></a><!-- doxytag: member="daemon.h::daemon_fork" ref="c526c25162040c3ff71131089fef9094" args="(struct daemon *daemon)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void daemon_fork </td> <td>(</td> <td class="paramtype">struct <a class="el" href="structdaemon.html">daemon</a> * </td> <td class="paramname"> <em>daemon</em> </td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p> Fork workers and start service. <p> When the routine exits, it is no longer forked. <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em><a class="el" href="structdaemon.html" title="Structure holding worker list.">daemon</a>,:</em> </td><td>the <a class="el" href="structdaemon.html" title="Structure holding worker list.">daemon</a>. </td></tr> </table> </dl> <p>References <a class="el" href="daemon_8h_source.html#l00098">daemon::acl</a>, <a class="el" href="acl__list_8c_source.html#l00138">acl_list_apply_cfg()</a>, <a class="el" href="daemon_8h_source.html#l00068">daemon::cfg</a>, <a class="el" href="daemon_8c_source.html#l00276">daemon_create_workers()</a>, <a class="el" href="daemon_8c_source.html#l00225">daemon_setup_modules()</a>, <a class="el" href="daemon_8c_source.html#l00356">daemon_start_others()</a>, <a class="el" href="daemon_8c_source.html#l00377">daemon_stop_others()</a>, <a class="el" href="log_8c_source.html#l00267">fatal_exit()</a>, <a class="el" href="daemon_8h_source.html#l00100">daemon::local_zones</a>, <a class="el" href="localzone_8c_source.html#l00846">local_zones_apply_cfg()</a>, <a class="el" href="localzone_8c_source.html#l00053">local_zones_create()</a>, <a class="el" href="log_8h_source.html#l00185">log_assert</a>, <a class="el" href="log_8c_source.html#l00228">log_info()</a>, <a class="el" href="worker_8h_source.html#l00111">worker::need_to_exit</a>, <a class="el" href="daemon_8h_source.html#l00088">daemon::need_to_exit</a>, <a class="el" href="daemon_8h_source.html#l00076">daemon::ports</a>, <a class="el" href="daemon_8c_source.html#l00134">signal_handling_playback()</a>, <a class="el" href="worker_8c_source.html#l00967">worker_init()</a>, <a class="el" href="worker_8c_source.html#l01109">worker_work()</a>, and <a class="el" href="daemon_8h_source.html#l00086">daemon::workers</a>.</p> <p>Referenced by <a class="el" href="unbound_8c_source.html#l00525">run_daemon()</a>, and <a class="el" href="win__svc_8c_source.html#l00331">service_main()</a>.</p> </div> </div><p> <a class="anchor" name="14888a119757eb59368fd04ecbad702e"></a><!-- doxytag: member="daemon.h::daemon_cleanup" ref="14888a119757eb59368fd04ecbad702e" args="(struct daemon *daemon)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void daemon_cleanup </td> <td>(</td> <td class="paramtype">struct <a class="el" href="structdaemon.html">daemon</a> * </td> <td class="paramname"> <em>daemon</em> </td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p> Close off the <a class="el" href="structworker.html" title="Structure holding working information for unbound.">worker</a> thread information. <p> Bring the <a class="el" href="structdaemon.html" title="Structure holding worker list.">daemon</a> back into state ready for daemon_fork again. <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em><a class="el" href="structdaemon.html" title="Structure holding worker list.">daemon</a>,:</em> </td><td>the <a class="el" href="structdaemon.html" title="Structure holding worker list.">daemon</a>. </td></tr> </table> </dl> <p>References <a class="el" href="daemon_8h_source.html#l00068">daemon::cfg</a>, <a class="el" href="remote_8c_source.html#l00205">daemon_remote_clear()</a>, <a class="el" href="daemon_8h_source.html#l00094">daemon::env</a>, <a class="el" href="daemon_8h_source.html#l00100">daemon::local_zones</a>, <a class="el" href="localzone_8c_source.html#l00075">local_zones_delete()</a>, <a class="el" href="log_8h_source.html#l00185">log_assert</a>, <a class="el" href="log_8c_source.html#l00140">log_thread_set()</a>, <a class="el" href="module_8h_source.html#l00075">module_env::msg_cache</a>, <a class="el" href="daemon_8h_source.html#l00084">daemon::num</a>, <a class="el" href="daemon_8h_source.html#l00082">daemon::rc</a>, <a class="el" href="module_8h_source.html#l00077">module_env::rrset_cache</a>, <a class="el" href="daemon_8c_source.html#l00109">signal_handling_record()</a>, <a class="el" href="slabhash_8c_source.html#l00100">slabhash_clear()</a>, <a class="el" href="rrset_8h_source.html#l00058">rrset_cache::table</a>, <a class="el" href="worker_8c_source.html#l01115">worker_delete()</a>, and <a class="el" href="daemon_8h_source.html#l00086">daemon::workers</a>.</p> <p>Referenced by <a class="el" href="unbound_8c_source.html#l00525">run_daemon()</a>, <a class="el" href="win__svc_8c_source.html#l00316">service_deinit()</a>, and <a class="el" href="win__svc_8c_source.html#l00331">service_main()</a>.</p> </div> </div><p> <a class="anchor" name="92161d93862d15fb9c0370409d4703c2"></a><!-- doxytag: member="daemon.h::daemon_delete" ref="92161d93862d15fb9c0370409d4703c2" args="(struct daemon *daemon)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void daemon_delete </td> <td>(</td> <td class="paramtype">struct <a class="el" href="structdaemon.html">daemon</a> * </td> <td class="paramname"> <em>daemon</em> </td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p> Delete workers, close listening ports. <p> <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em><a class="el" href="structdaemon.html" title="Structure holding worker list.">daemon</a>,:</em> </td><td>the <a class="el" href="structdaemon.html" title="Structure holding worker list.">daemon</a>. </td></tr> </table> </dl> <p>References <a class="el" href="daemon_8h_source.html#l00098">daemon::acl</a>, <a class="el" href="acl__list_8c_source.html#l00065">acl_list_delete()</a>, <a class="el" href="alloc_8c_source.html#l00124">alloc_clear()</a>, <a class="el" href="daemon_8h_source.html#l00070">daemon::chroot</a>, <a class="el" href="remote_8c_source.html#l00227">daemon_remote_delete()</a>, <a class="el" href="daemon_8h_source.html#l00094">daemon::env</a>, <a class="el" href="module_8h_source.html#l00079">module_env::infra_cache</a>, <a class="el" href="infra_8c_source.html#l00107">infra_delete()</a>, <a class="el" href="listen__dnsport_8c_source.html#l00709">listening_ports_free()</a>, <a class="el" href="log_8c_source.html#l00241">log_err()</a>, <a class="el" href="daemon_8h_source.html#l00096">daemon::mods</a>, <a class="el" href="modstack_8c_source.html#l00190">modstack_desetup()</a>, <a class="el" href="module_8h_source.html#l00075">module_env::msg_cache</a>, <a class="el" href="daemon_8h_source.html#l00072">daemon::pidfile</a>, <a class="el" href="daemon_8h_source.html#l00076">daemon::ports</a>, <a class="el" href="daemon_8h_source.html#l00090">daemon::rand</a>, <a class="el" href="daemon_8h_source.html#l00082">daemon::rc</a>, <a class="el" href="daemon_8h_source.html#l00080">daemon::rc_ports</a>, <a class="el" href="module_8h_source.html#l00077">module_env::rrset_cache</a>, <a class="el" href="rrset_8c_source.html#l00071">rrset_cache_delete()</a>, <a class="el" href="slabhash_8c_source.html#l00087">slabhash_delete()</a>, <a class="el" href="daemon_8h_source.html#l00092">daemon::superalloc</a>, and <a class="el" href="random_8c_source.html#l00181">ub_randfree()</a>.</p> <p>Referenced by <a class="el" href="unbound_8c_source.html#l00525">run_daemon()</a>, <a class="el" href="win__svc_8c_source.html#l00316">service_deinit()</a>, and <a class="el" href="win__svc_8c_source.html#l00243">service_init()</a>.</p> </div> </div><p> <a class="anchor" name="ff26682792c2bcd0f38fbfb1054717ed"></a><!-- doxytag: member="daemon.h::daemon_apply_cfg" ref="ff26682792c2bcd0f38fbfb1054717ed" args="(struct daemon *daemon, struct config_file *cfg)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void daemon_apply_cfg </td> <td>(</td> <td class="paramtype">struct <a class="el" href="structdaemon.html">daemon</a> * </td> <td class="paramname"> <em>daemon</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">struct <a class="el" href="structconfig__file.html">config_file</a> * </td> <td class="paramname"> <em>cfg</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p> Apply config settings. <p> <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em><a class="el" href="structdaemon.html" title="Structure holding worker list.">daemon</a>,:</em> </td><td>the <a class="el" href="structdaemon.html" title="Structure holding worker list.">daemon</a>. </td></tr> <tr><td valign="top"></td><td valign="top"><em>cfg,:</em> </td><td>new config settings. </td></tr> </table> </dl> <p>References <a class="el" href="daemon_8h_source.html#l00068">daemon::cfg</a>, <a class="el" href="config__file_8c_source.html#l00822">config_apply()</a>, <a class="el" href="daemon_8h_source.html#l00094">daemon::env</a>, <a class="el" href="log_8c_source.html#l00267">fatal_exit()</a>, <a class="el" href="lruhash_8h_source.html#l00114">HASH_DEFAULT_STARTARRAY</a>, <a class="el" href="infra_8c_source.html#l00116">infra_adjust()</a>, <a class="el" href="module_8h_source.html#l00079">module_env::infra_cache</a>, <a class="el" href="module_8h_source.html#l00075">module_env::msg_cache</a>, <a class="el" href="config__file_8h_source.html#l00089">config_file::msg_cache_size</a>, <a class="el" href="config__file_8h_source.html#l00091">config_file::msg_cache_slabs</a>, <a class="el" href="msgreply_8c_source.html#l00557">msgreply_sizefunc()</a>, <a class="el" href="msgreply_8c_source.html#l00570">query_entry_delete()</a>, <a class="el" href="msgreply_8c_source.html#l00534">query_info_compare()</a>, <a class="el" href="msgreply_8c_source.html#l00579">reply_info_delete()</a>, <a class="el" href="module_8h_source.html#l00077">module_env::rrset_cache</a>, <a class="el" href="rrset_8c_source.html#l00079">rrset_cache_adjust()</a>, <a class="el" href="slabhash_8h_source.html#l00059">slabhash::size</a>, <a class="el" href="slabhash_8c_source.html#l00048">slabhash_create()</a>, <a class="el" href="slabhash_8c_source.html#l00087">slabhash_delete()</a>, <a class="el" href="slabhash_8c_source.html#l00145">slabhash_get_size()</a>, and <a class="el" href="daemon_8h_source.html#l00092">daemon::superalloc</a>.</p> <p>Referenced by <a class="el" href="unbound_8c_source.html#l00202">apply_settings()</a>, and <a class="el" href="win__svc_8c_source.html#l00243">service_init()</a>.</p> </div> </div><p> </div> <hr size="1"><address style="text-align: right;"><small>Generated on Tue Oct 13 06:46:30 2009 for unbound by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.9 </small></address> </body> </html>