summaryrefslogtreecommitdiff
path: root/static/freebsd/man9/module.9 3.html
diff options
context:
space:
mode:
Diffstat (limited to 'static/freebsd/man9/module.9 3.html')
-rw-r--r--static/freebsd/man9/module.9 3.html88
1 files changed, 88 insertions, 0 deletions
diff --git a/static/freebsd/man9/module.9 3.html b/static/freebsd/man9/module.9 3.html
new file mode 100644
index 00000000..ad8230b9
--- /dev/null
+++ b/static/freebsd/man9/module.9 3.html
@@ -0,0 +1,88 @@
+<table class="head">
+ <tr>
+ <td class="head-ltitle">MODULE(9)</td>
+ <td class="head-vol">Kernel Developer's Manual</td>
+ <td class="head-rtitle">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">module</code> &#x2014; <span class="Nd">structure
+ describing a kernel module</span></p>
+</section>
+<section class="Sh">
+<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
+<p class="Pp">Each module in the kernel is described by a
+ <var class="Vt">module_t</var> structure. The structure contains the name of
+ the device, a unique ID number, a pointer to an event handler function and
+ to an argument, which is given to the event handler, as well as some kernel
+ internal data. If the event handler function is
+ <code class="Dv">NULL</code>, the module will use a no-operation function
+ handler instead.</p>
+<p class="Pp">The <a class="Xr">DECLARE_MODULE(9)</a> macro registers the module
+ with the system.</p>
+<p class="Pp">When the module is loaded, the event handler function is called
+ with the <var class="Fa">what</var> argument set to
+ <code class="Dv">MOD_LOAD</code>.</p>
+<p class="Pp">On unload it is first called with <var class="Fa">what</var> set
+ to <code class="Dv">MOD_QUIESCE</code>. If the unload was not forced, a
+ non-zero return will prevent the unload from happening.</p>
+<p class="Pp">If the unload continues <var class="Fa">what</var> is set to
+ <code class="Dv">MOD_UNLOAD</code>. If the module returns non-zero to this,
+ the unload will not happen.</p>
+<p class="Pp">The difference between <code class="Dv">MOD_QUIESCE</code> and
+ <code class="Dv">MOD_UNLOAD</code> is that the module should fail
+ <code class="Dv">MOD_QUIESCE</code> if it is currently in use, whereas
+ <code class="Dv">MOD_UNLOAD</code> should only fail if it is impossible to
+ unload the module, for instance because there are memory references to the
+ module which cannot be revoked.</p>
+<p class="Pp">When the system is shutting down, <var class="Fa">what</var>
+ contains the value of <code class="Dv">MOD_SHUTDOWN</code>.</p>
+<p class="Pp">The module should return <code class="Er">EOPNOTSUPP</code> for
+ unsupported and unrecognized values of <var class="Fa">what</var>.</p>
+</section>
+<section class="Sh">
+<h1 class="Sh" id="EXAMPLES"><a class="permalink" href="#EXAMPLES">EXAMPLES</a></h1>
+<div class="Bd Li">
+<pre>#include &lt;sys/param.h&gt;
+#include &lt;sys/kernel.h&gt;
+#include &lt;sys/module.h&gt;
+
+static int foo_handler(module_t mod, int /*modeventtype_t*/ what,
+ void *arg);
+
+static moduledata_t mod_data= {
+ &quot;foo&quot;,
+ foo_handler,
+ NULL
+};
+
+MODULE_VERSION(foo, 1);
+MODULE_DEPEND(foo, bar, 1, 3, 4);
+
+DECLARE_MODULE(foo, mod_data, SI_SUB_EXEC, SI_ORDER_ANY);</pre>
+</div>
+</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">DECLARE_MODULE(9)</a>,
+ <a class="Xr">DEV_MODULE(9)</a>, <a class="Xr">DRIVER_MODULE(9)</a>,
+ <a class="Xr">MODULE_DEPEND(9)</a>, <a class="Xr">MODULE_PNP_INFO(9)</a>,
+ <a class="Xr">MODULE_VERSION(9)</a>, <a class="Xr">SYSCALL_MODULE(9)</a></p>
+<p class="Pp"><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>
+ &lt;<a class="Mt" href="mailto:alex@FreeBSD.org">alex@FreeBSD.org</a>&gt;.</p>
+</section>
+</div>
+<table class="foot">
+ <tr>
+ <td class="foot-date">November 11, 2021</td>
+ <td class="foot-os">FreeBSD 15.0</td>
+ </tr>
+</table>