diff options
| author | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2026-04-25 19:55:43 -0400 |
|---|---|---|
| committer | Jacob McDonnell <jacob@jacobmcdonnell.com> | 2026-04-25 19:55:43 -0400 |
| commit | ac5e55f5f2af5b92794c2aded46c6bae85b5f5ed (patch) | |
| tree | 9367490586c84cba28652e443e3166d66c33b0d9 /static/freebsd/man9/DECLARE_MODULE.9 3.html | |
| parent | 253e67c8b3a72b3a4757fdbc5845297628db0a4a (diff) | |
docs: Added All FreeBSD Manuals
Diffstat (limited to 'static/freebsd/man9/DECLARE_MODULE.9 3.html')
| -rw-r--r-- | static/freebsd/man9/DECLARE_MODULE.9 3.html | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/static/freebsd/man9/DECLARE_MODULE.9 3.html b/static/freebsd/man9/DECLARE_MODULE.9 3.html new file mode 100644 index 00000000..f0cd620a --- /dev/null +++ b/static/freebsd/man9/DECLARE_MODULE.9 3.html @@ -0,0 +1,105 @@ +<table class="head"> + <tr> + <td class="head-ltitle">DECLARE_MODULE(9)</td> + <td class="head-vol">Kernel Developer's Manual</td> + <td class="head-rtitle">DECLARE_MODULE(9)</td> + </tr> +</table> +<div class="manual-text"> +<section class="Sh"> +<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1> +<p class="Pp"><code class="Nm">DECLARE_MODULE</code> — + <span class="Nd">kernel module declaration macro</span></p> +</section> +<section class="Sh"> +<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1> +<p class="Pp"><code class="In">#include + <<a class="In">sys/param.h</a>></code> + <br/> + <code class="In">#include <<a class="In">sys/kernel.h</a>></code> + <br/> + <code class="In">#include <<a class="In">sys/module.h</a>></code></p> +<p class="Pp"><code class="Fn">DECLARE_MODULE</code>(<var class="Fa" style="white-space: nowrap;">name</var>, + <var class="Fa" style="white-space: nowrap;">moduledata_t data</var>, + <var class="Fa" style="white-space: nowrap;">sub</var>, + <var class="Fa" style="white-space: nowrap;">order</var>);</p> +<p class="Pp"><code class="Fn">DECLARE_MODULE_TIED</code>(<var class="Fa" style="white-space: nowrap;">name</var>, + <var class="Fa" style="white-space: nowrap;">moduledata_t data</var>, + <var class="Fa" style="white-space: nowrap;">sub</var>, + <var class="Fa" style="white-space: nowrap;">order</var>);</p> +</section> +<section class="Sh"> +<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1> +<p class="Pp">The + <a class="permalink" href="#DECLARE_MODULE"><code class="Fn" id="DECLARE_MODULE">DECLARE_MODULE</code></a>() + macro declares a generic kernel module. It is used to register the module + with the system, using the <code class="Fn">SYSINIT</code>() macro. + <code class="Fn">DECLARE_MODULE</code>() is usually used within other + macros, such as <a class="Xr">DRIVER_MODULE(9)</a>, + <a class="Xr">DEV_MODULE(9)</a> and <a class="Xr">SYSCALL_MODULE(9)</a>. Of + course, it can also be called directly, for example in order to implement + dynamic sysctls.</p> +<p class="Pp" id="DECLARE_MODULE_TIED">A module declared with + <a class="permalink" href="#DECLARE_MODULE_TIED"><code class="Fn">DECLARE_MODULE_TIED</code></a>() + will load only if the running kernel version (as specified by + <code class="Dv">__FreeBSD_version</code>) is identical to that on which it + was built. This declaration should be used by modules which depend on + interfaces beyond the stable kernel KBI (such as ABI emulators or + hypervisors that rely on internal kernel structures). + <code class="Fn">DECLARE_MODULE</code>() will behave like + <code class="Fn">DECLARE_MODULE_TIED</code>() when compiled with modules + built with the kernel. This allows locks and other synchronization + primitives to be inlined safely.</p> +<p class="Pp">The arguments are:</p> +<dl class="Bl-tag"> + <dt id="SYSINIT"><var class="Fa">name</var></dt> + <dd>The module name, which will be used in the + <a class="permalink" href="#SYSINIT"><code class="Fn">SYSINIT</code></a>() + call to identify the module.</dd> + <dt><var class="Fa">data</var></dt> + <dd>A <var class="Vt">moduledata_t</var> structure, which contains two main + items, the official name of the module name, which will be used in the + <var class="Vt">module_t</var> structure and a pointer to the event + handler function of type <var class="Vt">modeventhand_t</var>.</dd> + <dt><var class="Fa">sub</var></dt> + <dd>An argument directed to the <code class="Fn">SYSINIT</code>() macro. Valid + values for this are contained in the <var class="Vt">sysinit_sub_id</var> + enumeration (see + <code class="In"><<a class="In">sys/kernel.h</a>></code>) and + specify the type of system startup interfaces. The + <a class="Xr">DRIVER_MODULE(9)</a> macro uses a value of + <code class="Dv">SI_SUB_DRIVERS</code> here for example, since these + modules contain a driver for a device. For kernel modules that are loaded + at runtime, a value of <code class="Dv">SI_SUB_EXEC</code> is common.</dd> + <dt><var class="Fa">order</var></dt> + <dd>An argument for <code class="Fn">SYSINIT</code>(). It represents the KLDs + order of initialization within the subsystem. Valid values are defined in + the <var class="Vt">sysinit_elem_order</var> enumeration + (<code class="In"><<a class="In">sys/kernel.h</a>></code>).</dd> +</dl> +</section> +<section class="Sh"> +<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE + ALSO</a></h1> +<p class="Pp"><a class="Xr">DEV_MODULE(9)</a>, + <a class="Xr">DRIVER_MODULE(9)</a>, <a class="Xr">module(9)</a>, + <a class="Xr">SYSCALL_MODULE(9)</a></p> +<p class="Pp"><span class="Pa">/usr/include/sys/kernel.h</span>, + <span class="Pa">/usr/share/examples/kld</span></p> +</section> +<section class="Sh"> +<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1> +<p class="Pp">This manual page was written by <span class="An">Alexander + Langer</span> + <<a class="Mt" href="mailto:alex@FreeBSD.org">alex@FreeBSD.org</a>>, + inspired by the KLD Facility Programming Tutorial by <span class="An">Andrew + Reiter</span> + <<a class="Mt" href="mailto:arr@watson.org">arr@watson.org</a>>.</p> +</section> +</div> +<table class="foot"> + <tr> + <td class="foot-date">February 13, 2018</td> + <td class="foot-os">FreeBSD 15.0</td> + </tr> +</table> |
