Bug 192250 - module(9) and its corresponding manpages don't document that evhand (the load/unload/etc handler) can be NULL
Summary: module(9) and its corresponding manpages don't document that evhand (the load...
Status: New
Alias: None
Product: Documentation
Classification: Unclassified
Component: Manual Pages (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-29 19:44 UTC by Enji Cooper
Modified: 2018-04-09 07:10 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Enji Cooper freebsd_committer 2014-07-29 19:44:49 UTC
The structure for a kernel module is like so:

 52 /*
 53  * Struct for registering modules statically via SYSINIT.
 54  */
 55 typedef struct moduledata {
 56         const char      *name;          /* module name */
 57         modeventhand_t  evhand;         /* event handler */
 58         void            *priv;          /* extra data */
 59 } moduledata_t;

The documentation doesn't note that evhand can be NULL though (and if it's NULL then modevent_nop will be used in lieu of evhand):

$ grep -r evhand /sys/kern/
/sys/kern/kern_module.c:                    " %d\n", data->name, (void *)data->evhand, data->priv,
/sys/kern/kern_module.c:        newmod->handler = data->evhand ? data->evhand : modevent_nop;
$

I looked at the examples in /usr/share/examples/kld and they didn't provide an example that did this either.