History log of /netbsd-current/sys/sys/module.h
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.48 24-Oct-2021 skrll

Trailing whitespace


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base phil-wifi-20191119
# 1.47 07-Aug-2019 pgoyette

Many years ago someone created a new __link_set_sysctl_funcs to hold
the list of routines that need to be called for setting up sysctl
variables. This worked great for all code included in the kernel
itself, but didn't deal with modules that want to create their own
sysctl data. So, we ended up with a lot of #ifdef _MODULE blocks
so modules could explicitly call their setup functions when loaded
as non-built-in modules.

So today, we complete the task that was started so many years ago.

When modules are loaded, after we've called xxx_modcmd(INIT...) we
check if the module contains its own __link_set_sysctl_funcs, and
if so we call the functions listed. We add a struct sysctllog member
to the struct module so we can call sysctl_teardown() when the module
gets unloaded. (The sequence of events ensures that the sysctl stuff
doesn't get created until the rest of the module's init code does any
required memory allocation.)

So, no more need to explicitly call the sysctl setup routines when
built as a loadable module.


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.46 08-Apr-2019 pgoyette

Improve kernel module validation. First, set a limit on how much of the
module name field to check when validation name's length. Second, check
the module's mi_class to ensure it is valid.

Update the commenet in sys/module.h to indicate that the module classes
are now being validated.


# 1.45 08-Apr-2019 pgoyette

Add a MODULE_CLASS_MAX value to the enum


# 1.44 27-Jan-2019 christos

- autoload the compat_80 for modstat
- move compat struct to a compat header


# 1.43 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.42 28-May-2018 chs

branches: 1.42.2;
add more accessor functions for various struct module fields.
add a mechanism for registering callbacks to be called upon module load/unload.


Revision tags: netbsd-8-2-RELEASE netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.41 16-Nov-2016 pgoyette

branches: 1.41.14;
Define a new module class for the bufq_strategy modules. These need to
be loaded and intialized before autoconfigure runs, since some devices
(like disks and floppy drives) want to call bufq_alloc().


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.40 18-Jan-2016 pooka

branches: 1.40.2;
Fix dlopen()/dlclose()+RUMP_USE_CTOR to not leave dangling pointers around.


Revision tags: nick-nhusb-base-20151226
# 1.39 04-Nov-2015 pgoyette

Export module flags to userland


Revision tags: nick-nhusb-base-20150921
# 1.38 22-Jun-2015 matt

Make module_machine const char *


# 1.37 19-Jun-2015 martin

Make handle_modctl_load() usable from compat/netbsd32.


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.36 07-Mar-2015 christos

use __COMPAT so that we get argument expansion.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.35 23-Apr-2014 pooka

branches: 1.35.4;
Add a RUMP_USE_CTOR compile-time switch. If defined, use
__attribute__((constructor)) to determine which rump kernel components
and kernel modules are linked into the rump kernel. If not defined
(default), use the regular approach with link sets.

This option is aimed to fix problems with toolchains where using link
sets is not possible because the linker does not generate the requisite
__start/__stop symbols for the link set sections (e.g. GNU gold, OS X, ...).


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.34 23-Oct-2013 mbalmer

branches: 1.34.2;
use MODULE_CLASS_MISC for Lua modules


# 1.33 21-Oct-2013 mbalmer

add MODULE_CLASS_LUA_BINDING


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.32 17-Oct-2012 dyoung

branches: 1.32.2;
Correct spelling: entrie -> entry.


# 1.31 07-Aug-2012 jnemeth

branches: 1.31.2;
Add -A, -a, and -e options to modstat(8) along with kernel
changes required to support these options. The -e option was
requested by martin@ in private chat in order to make writing tests
easier (i.e. don't bother testing MODULAR functionaility if it
doesn't exist). While there, I added -A and -a since those were
quite similar.

-A Tells you whether or not modules can be autoloaded at the moment.
This option does take into consideration the sysctl
kern.module.autoload.

-a Tells you whether or not modules can be autoloaded at the moment.
This option does not take into consideration the sysctl
kern.module.autoload.

-e Tells you whether or not you may load a module at the moment.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base
# 1.30 21-Nov-2011 christos

change printf gcc attribute to __printflike(), requested by joerg.


# 1.29 20-Nov-2011 christos

add more missing printf attributes.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.28 18-Oct-2011 jmcneill

branches: 1.28.2;
Don't try to auto-unload modules unless they were auto-loaded.


# 1.27 13-Aug-2011 christos

Always provide a meaningful short name for the kobj in the error message,
as well as the function name and the linenumber, without extra line feeds.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.26 17-Apr-2011 mrg

add a "module_machine", that defaults to machine.
allows MD code to override the default subdir for modules.


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11
# 1.25 21-Aug-2010 pgoyette

branches: 1.25.2;
Define a set of new kernel locking primitives to implement the recursive
kernconfig_mutex. Update module subsystem to use this mutex rather than
its own internal (non-recursive) mutex. Make module_autoload() do its
own locking to be consistent with the rest of the module_xxx() calls.
Update module(9) man page appropriately.

As discussed on tech-kern over the last few weeks.

Welcome to NetBSD 5.99.39 !


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.24 26-Jun-2010 pgoyette

1. Add an allocator for 'struct module *' and use it instead of local
allocations.

2. Add a new member mod_flags to the 'struct module *' and define
MODFLG_MUST_FORCE. If this flag is set and the entry is on the list
of builtins, it means that the module has been explicitly unloaded
and any re-loads will require the MODCTL_LOAD_FORCE flag. Provide a
module_require_force() method to set this flag; once set, it should
never be unset.

3. Rename original module_init2() to module_start_unload_thread() to be
more descriptive of what it does.

4. Add a new module_builtin_require_force() routine that sets the
MODFLG_MUST_FORCE flag for any module that has not yet successfully
been initialized. Call it after module_init_class(MODULE_CLASS_ANY)
to disable remaining built-in modules.

This makes built-in versions of the xxxVERBOSE modules work once more,
resolving breakage reported by jruoho@ and njoly@.

Discussed on tech-kern, and comments and suggestions implemented. No
additional discussion for last week. Tested only on amd64 systems, but
there's nothing here that should be port- or architecture-specific (no
more specific than existing module implementation) so others should not
break.


# 1.23 24-May-2010 pgoyette

Protect against attempting to load modules from the filesystem until we
have mounted the root file-system. This allows us to load built-in and
boot-loader-provided modules much earlier during startup.


Revision tags: uebayasi-xip-base1
# 1.22 26-Apr-2010 pooka

Allow everyone in the kernel to see module_base.


# 1.21 12-Mar-2010 darran

branches: 1.21.2;
DTrace: Add the Function Boundary Trace (FBT) provider moduile. This
module instruments every function in the kernel with entry and exit
probes. These probes are true zero-effect probes in that they don't
exist in the code until they are enabled. The probes are enabled by
directly patching the function entry and exit points to make jumps into
the dtrace framework.
This gives us over 29,000 trace points in the kernel.


Revision tags: yamt-nfs-mp-base9
# 1.20 05-Mar-2010 pooka

Make module_{lookup,enqueue}() static now that it's possible again
(effectively reverts my kern_module rev. 1.53 from some months ago)


# 1.19 05-Mar-2010 pooka

Move builtin modules to a list in init and load them from there
instead of using linksets directly. This has two implications:

1) It is now possible to "unload" a builtin module provided it is
not busy. This is useful e.g. to disable a kernel feature as
an immediate workaround to a security problem. To re-initialize
the module, modload -f <name> is required.
2) It is possible to use builtin modules which were linked at
runtime with an external linker (dlopen + rump).


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 1.18 18-Nov-2009 pooka

branches: 1.18.2;
* make it possible to include kern_module in a kernel without vfs
support, i.e. move vfs functionality to a separate module
(kern_module_vfs.c)
* make module proplist size an MI constant (now 8k) instead of PAGE_SIZE
* change some error values to something else than the karmic EINVAL


# 1.17 05-Nov-2009 pooka

expose module_{lookup,enqueue}()


Revision tags: jym-xensuspend-nbase
# 1.16 02-Oct-2009 elad

First part of secmodel cleanup and other misc. changes:

- Separate the suser part of the bsd44 secmodel into its own secmodel
and directory, pending even more cleanups. For revision history
purposes, the original location of the files was

src/sys/secmodel/bsd44/secmodel_bsd44_suser.c
src/sys/secmodel/bsd44/suser.h

- Add a man-page for secmodel_suser(9) and update the one for
secmodel_bsd44(9).

- Add a "secmodel" module class and use it. Userland program and
documentation updated.

- Manage secmodel count (nsecmodels) through the module framework.
This eliminates the need for secmodel_{,de}register() calls in
secmodel code.

- Prepare for secmodel modularization by adding relevant module bits.
The secmodels don't allow auto unload. The bsd44 secmodel depends
on the suser and securelevel secmodels. The overlay secmodel depends
on the bsd44 secmodel. As the module class is only cosmetic, and to
prevent ambiguity, the bsd44 and overlay secmodels are prefixed with
"secmodel_".

- Adapt the overlay secmodel to recent changes (mainly vnode scope).

- Stop using link-sets for the sysctl node(s) creation.

- Keep sysctl variables under nodes of their relevant secmodels. In
other words, don't create duplicates for the suser/securelevel
secmodels under the bsd44 secmodel, as the latter is merely used
for "grouping".

- For the suser and securelevel secmodels, "advertise presence" in
relevant sysctl nodes (sysctl.security.models.{suser,securelevel}).

- Get rid of the LKM preprocessor stuff.

- As secmodels are now modules, there's no need for an explicit call
to secmodel_start(); it's handled by the module framework. That
said, the module framework was adjusted to properly load secmodels
early during system startup.

- Adapt rump to changes: Instead of using empty stubs for securelevel,
simply use the suser secmodel. Also replace secmodel_start() with a
call to secmodel_suser_start().

- 5.99.20.

Testing was done on i386 ("release" build). Spearated module_init()
changes were tested on sparc and sparc64 as well by martin@ (thanks!).

Mailing list reference:

http://mail-index.netbsd.org/tech-kern/2009/09/25/msg006135.html


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 1.15 09-Jun-2009 jnemeth

Add the MODCTL_NO_PROP flag to tell the kernel to ignore <module>.prop.

Add the '-P' option to modload(8) to set this flag.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base haad-dm-base2 haad-nbase2 ad-audiomp2-base nick-hppapmap-base haad-dm-base mjf-devfs2-base
# 1.14 25-Nov-2008 ad

branches: 1.14.4;
Add some basic DDB stuff for modules.


# 1.13 19-Nov-2008 ad

Unused header.


# 1.12 18-Nov-2008 ad

Some modules may want to avoid autounload because their use is transient.
Their FINI routine may legitimately succeed even though the module is likely
to be used soon again, for example: exec_script. Add a MODULE_CMD_AUTOUNLOAD
to query whether a module wants to avoid autounload.


# 1.11 14-Nov-2008 ad

- If the system encounters a severe memory shortage, start unloading
unused kernel modules.
- Try to unload any autoloaded kernel modules 10 seconds after their
load was successful.
- Keep a counter to track module load/unload events.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2
# 1.10 22-Oct-2008 ad

branches: 1.10.2;
- Be clear about whether module load is explicit or system initiated (auto).
- Require that module_lock is held to autoload, so that any preconditions
can be safely checked.


Revision tags: haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.9 01-Aug-2008 pooka

expose module_compatible()


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.8 31-May-2008 ad

branches: 1.8.4;
- Put in place module compatibility check against __NetBSD_Version__,
as discussed on tech-kern.

- Remove unused module_jettison().


# 1.7 20-May-2008 ad

If autoloading a module, don't consider the current working directory.


# 1.6 20-May-2008 ad

Allow module class to be passed to module_load(), as a basic sanity check
that we are loading the right kind of module.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.5 01-May-2008 ad

branches: 1.5.2;
- Add module_find_section(), allows a module to look up data in its object.
- Work around build failure.


# 1.4 01-May-2008 ad

Get the pre-loaded module code working.


# 1.3 28-Apr-2008 martin

Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 matt-armv6-nbase keiichi-mipv6-nbase keiichi-mipv6-base
# 1.2 02-Mar-2008 jmmv

branches: 1.2.2; 1.2.4; 1.2.6;
Add support for load-time parameters for modules, which are passed through
a dictionary. As discussed in tech-kern@.


Revision tags: hpcarm-cleanup-base nick-net80211-sync-base mjf-devfs-base bouyer-xeni386-base bouyer-xeni386-nbase
# 1.1 16-Jan-2008 ad

branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.12;
Pull in my modules code for review/test/hacking.


# 1.47 07-Aug-2019 pgoyette

Many years ago someone created a new __link_set_sysctl_funcs to hold
the list of routines that need to be called for setting up sysctl
variables. This worked great for all code included in the kernel
itself, but didn't deal with modules that want to create their own
sysctl data. So, we ended up with a lot of #ifdef _MODULE blocks
so modules could explicitly call their setup functions when loaded
as non-built-in modules.

So today, we complete the task that was started so many years ago.

When modules are loaded, after we've called xxx_modcmd(INIT...) we
check if the module contains its own __link_set_sysctl_funcs, and
if so we call the functions listed. We add a struct sysctllog member
to the struct module so we can call sysctl_teardown() when the module
gets unloaded. (The sequence of events ensures that the sysctl stuff
doesn't get created until the rest of the module's init code does any
required memory allocation.)

So, no more need to explicitly call the sysctl setup routines when
built as a loadable module.


Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.46 08-Apr-2019 pgoyette

Improve kernel module validation. First, set a limit on how much of the
module name field to check when validation name's length. Second, check
the module's mi_class to ensure it is valid.

Update the commenet in sys/module.h to indicate that the module classes
are now being validated.


# 1.45 08-Apr-2019 pgoyette

Add a MODULE_CLASS_MAX value to the enum


# 1.44 27-Jan-2019 christos

- autoload the compat_80 for modstat
- move compat struct to a compat header


# 1.43 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.42 28-May-2018 chs

branches: 1.42.2;
add more accessor functions for various struct module fields.
add a mechanism for registering callbacks to be called upon module load/unload.


Revision tags: netbsd-8-1-RELEASE netbsd-8-1-RC1 netbsd-8-0-RELEASE netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.41 16-Nov-2016 pgoyette

branches: 1.41.14;
Define a new module class for the bufq_strategy modules. These need to
be loaded and intialized before autoconfigure runs, since some devices
(like disks and floppy drives) want to call bufq_alloc().


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.40 18-Jan-2016 pooka

branches: 1.40.2;
Fix dlopen()/dlclose()+RUMP_USE_CTOR to not leave dangling pointers around.


Revision tags: nick-nhusb-base-20151226
# 1.39 04-Nov-2015 pgoyette

Export module flags to userland


Revision tags: nick-nhusb-base-20150921
# 1.38 22-Jun-2015 matt

Make module_machine const char *


# 1.37 19-Jun-2015 martin

Make handle_modctl_load() usable from compat/netbsd32.


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.36 07-Mar-2015 christos

use __COMPAT so that we get argument expansion.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.35 23-Apr-2014 pooka

branches: 1.35.4;
Add a RUMP_USE_CTOR compile-time switch. If defined, use
__attribute__((constructor)) to determine which rump kernel components
and kernel modules are linked into the rump kernel. If not defined
(default), use the regular approach with link sets.

This option is aimed to fix problems with toolchains where using link
sets is not possible because the linker does not generate the requisite
__start/__stop symbols for the link set sections (e.g. GNU gold, OS X, ...).


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.34 23-Oct-2013 mbalmer

branches: 1.34.2;
use MODULE_CLASS_MISC for Lua modules


# 1.33 21-Oct-2013 mbalmer

add MODULE_CLASS_LUA_BINDING


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.32 17-Oct-2012 dyoung

branches: 1.32.2;
Correct spelling: entrie -> entry.


# 1.31 07-Aug-2012 jnemeth

branches: 1.31.2;
Add -A, -a, and -e options to modstat(8) along with kernel
changes required to support these options. The -e option was
requested by martin@ in private chat in order to make writing tests
easier (i.e. don't bother testing MODULAR functionaility if it
doesn't exist). While there, I added -A and -a since those were
quite similar.

-A Tells you whether or not modules can be autoloaded at the moment.
This option does take into consideration the sysctl
kern.module.autoload.

-a Tells you whether or not modules can be autoloaded at the moment.
This option does not take into consideration the sysctl
kern.module.autoload.

-e Tells you whether or not you may load a module at the moment.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base
# 1.30 21-Nov-2011 christos

change printf gcc attribute to __printflike(), requested by joerg.


# 1.29 20-Nov-2011 christos

add more missing printf attributes.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.28 18-Oct-2011 jmcneill

branches: 1.28.2;
Don't try to auto-unload modules unless they were auto-loaded.


# 1.27 13-Aug-2011 christos

Always provide a meaningful short name for the kobj in the error message,
as well as the function name and the linenumber, without extra line feeds.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.26 17-Apr-2011 mrg

add a "module_machine", that defaults to machine.
allows MD code to override the default subdir for modules.


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11
# 1.25 21-Aug-2010 pgoyette

branches: 1.25.2;
Define a set of new kernel locking primitives to implement the recursive
kernconfig_mutex. Update module subsystem to use this mutex rather than
its own internal (non-recursive) mutex. Make module_autoload() do its
own locking to be consistent with the rest of the module_xxx() calls.
Update module(9) man page appropriately.

As discussed on tech-kern over the last few weeks.

Welcome to NetBSD 5.99.39 !


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.24 26-Jun-2010 pgoyette

1. Add an allocator for 'struct module *' and use it instead of local
allocations.

2. Add a new member mod_flags to the 'struct module *' and define
MODFLG_MUST_FORCE. If this flag is set and the entry is on the list
of builtins, it means that the module has been explicitly unloaded
and any re-loads will require the MODCTL_LOAD_FORCE flag. Provide a
module_require_force() method to set this flag; once set, it should
never be unset.

3. Rename original module_init2() to module_start_unload_thread() to be
more descriptive of what it does.

4. Add a new module_builtin_require_force() routine that sets the
MODFLG_MUST_FORCE flag for any module that has not yet successfully
been initialized. Call it after module_init_class(MODULE_CLASS_ANY)
to disable remaining built-in modules.

This makes built-in versions of the xxxVERBOSE modules work once more,
resolving breakage reported by jruoho@ and njoly@.

Discussed on tech-kern, and comments and suggestions implemented. No
additional discussion for last week. Tested only on amd64 systems, but
there's nothing here that should be port- or architecture-specific (no
more specific than existing module implementation) so others should not
break.


# 1.23 24-May-2010 pgoyette

Protect against attempting to load modules from the filesystem until we
have mounted the root file-system. This allows us to load built-in and
boot-loader-provided modules much earlier during startup.


Revision tags: uebayasi-xip-base1
# 1.22 26-Apr-2010 pooka

Allow everyone in the kernel to see module_base.


# 1.21 12-Mar-2010 darran

branches: 1.21.2;
DTrace: Add the Function Boundary Trace (FBT) provider moduile. This
module instruments every function in the kernel with entry and exit
probes. These probes are true zero-effect probes in that they don't
exist in the code until they are enabled. The probes are enabled by
directly patching the function entry and exit points to make jumps into
the dtrace framework.
This gives us over 29,000 trace points in the kernel.


Revision tags: yamt-nfs-mp-base9
# 1.20 05-Mar-2010 pooka

Make module_{lookup,enqueue}() static now that it's possible again
(effectively reverts my kern_module rev. 1.53 from some months ago)


# 1.19 05-Mar-2010 pooka

Move builtin modules to a list in init and load them from there
instead of using linksets directly. This has two implications:

1) It is now possible to "unload" a builtin module provided it is
not busy. This is useful e.g. to disable a kernel feature as
an immediate workaround to a security problem. To re-initialize
the module, modload -f <name> is required.
2) It is possible to use builtin modules which were linked at
runtime with an external linker (dlopen + rump).


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 1.18 18-Nov-2009 pooka

branches: 1.18.2;
* make it possible to include kern_module in a kernel without vfs
support, i.e. move vfs functionality to a separate module
(kern_module_vfs.c)
* make module proplist size an MI constant (now 8k) instead of PAGE_SIZE
* change some error values to something else than the karmic EINVAL


# 1.17 05-Nov-2009 pooka

expose module_{lookup,enqueue}()


Revision tags: jym-xensuspend-nbase
# 1.16 02-Oct-2009 elad

First part of secmodel cleanup and other misc. changes:

- Separate the suser part of the bsd44 secmodel into its own secmodel
and directory, pending even more cleanups. For revision history
purposes, the original location of the files was

src/sys/secmodel/bsd44/secmodel_bsd44_suser.c
src/sys/secmodel/bsd44/suser.h

- Add a man-page for secmodel_suser(9) and update the one for
secmodel_bsd44(9).

- Add a "secmodel" module class and use it. Userland program and
documentation updated.

- Manage secmodel count (nsecmodels) through the module framework.
This eliminates the need for secmodel_{,de}register() calls in
secmodel code.

- Prepare for secmodel modularization by adding relevant module bits.
The secmodels don't allow auto unload. The bsd44 secmodel depends
on the suser and securelevel secmodels. The overlay secmodel depends
on the bsd44 secmodel. As the module class is only cosmetic, and to
prevent ambiguity, the bsd44 and overlay secmodels are prefixed with
"secmodel_".

- Adapt the overlay secmodel to recent changes (mainly vnode scope).

- Stop using link-sets for the sysctl node(s) creation.

- Keep sysctl variables under nodes of their relevant secmodels. In
other words, don't create duplicates for the suser/securelevel
secmodels under the bsd44 secmodel, as the latter is merely used
for "grouping".

- For the suser and securelevel secmodels, "advertise presence" in
relevant sysctl nodes (sysctl.security.models.{suser,securelevel}).

- Get rid of the LKM preprocessor stuff.

- As secmodels are now modules, there's no need for an explicit call
to secmodel_start(); it's handled by the module framework. That
said, the module framework was adjusted to properly load secmodels
early during system startup.

- Adapt rump to changes: Instead of using empty stubs for securelevel,
simply use the suser secmodel. Also replace secmodel_start() with a
call to secmodel_suser_start().

- 5.99.20.

Testing was done on i386 ("release" build). Spearated module_init()
changes were tested on sparc and sparc64 as well by martin@ (thanks!).

Mailing list reference:

http://mail-index.netbsd.org/tech-kern/2009/09/25/msg006135.html


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 1.15 09-Jun-2009 jnemeth

Add the MODCTL_NO_PROP flag to tell the kernel to ignore <module>.prop.

Add the '-P' option to modload(8) to set this flag.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base haad-dm-base2 haad-nbase2 ad-audiomp2-base nick-hppapmap-base haad-dm-base mjf-devfs2-base
# 1.14 25-Nov-2008 ad

branches: 1.14.4;
Add some basic DDB stuff for modules.


# 1.13 19-Nov-2008 ad

Unused header.


# 1.12 18-Nov-2008 ad

Some modules may want to avoid autounload because their use is transient.
Their FINI routine may legitimately succeed even though the module is likely
to be used soon again, for example: exec_script. Add a MODULE_CMD_AUTOUNLOAD
to query whether a module wants to avoid autounload.


# 1.11 14-Nov-2008 ad

- If the system encounters a severe memory shortage, start unloading
unused kernel modules.
- Try to unload any autoloaded kernel modules 10 seconds after their
load was successful.
- Keep a counter to track module load/unload events.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2
# 1.10 22-Oct-2008 ad

branches: 1.10.2;
- Be clear about whether module load is explicit or system initiated (auto).
- Require that module_lock is held to autoload, so that any preconditions
can be safely checked.


Revision tags: haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.9 01-Aug-2008 pooka

expose module_compatible()


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.8 31-May-2008 ad

branches: 1.8.4;
- Put in place module compatibility check against __NetBSD_Version__,
as discussed on tech-kern.

- Remove unused module_jettison().


# 1.7 20-May-2008 ad

If autoloading a module, don't consider the current working directory.


# 1.6 20-May-2008 ad

Allow module class to be passed to module_load(), as a basic sanity check
that we are loading the right kind of module.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.5 01-May-2008 ad

branches: 1.5.2;
- Add module_find_section(), allows a module to look up data in its object.
- Work around build failure.


# 1.4 01-May-2008 ad

Get the pre-loaded module code working.


# 1.3 28-Apr-2008 martin

Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 matt-armv6-nbase keiichi-mipv6-nbase keiichi-mipv6-base
# 1.2 02-Mar-2008 jmmv

branches: 1.2.2; 1.2.4; 1.2.6;
Add support for load-time parameters for modules, which are passed through
a dictionary. As discussed in tech-kern@.


Revision tags: hpcarm-cleanup-base nick-net80211-sync-base mjf-devfs-base bouyer-xeni386-base bouyer-xeni386-nbase
# 1.1 16-Jan-2008 ad

branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.12;
Pull in my modules code for review/test/hacking.


Revision tags: isaki-audio2-base
# 1.46 08-Apr-2019 pgoyette

Improve kernel module validation. First, set a limit on how much of the
module name field to check when validation name's length. Second, check
the module's mi_class to ensure it is valid.

Update the commenet in sys/module.h to indicate that the module classes
are now being validated.


# 1.45 08-Apr-2019 pgoyette

Add a MODULE_CLASS_MAX value to the enum


# 1.44 27-Jan-2019 christos

- autoload the compat_80 for modstat
- move compat struct to a compat header


# 1.43 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625
# 1.42 28-May-2018 chs

add more accessor functions for various struct module fields.
add a mechanism for registering callbacks to be called upon module load/unload.


Revision tags: netbsd-8-0-RELEASE netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.41 16-Nov-2016 pgoyette

branches: 1.41.14;
Define a new module class for the bufq_strategy modules. These need to
be loaded and intialized before autoconfigure runs, since some devices
(like disks and floppy drives) want to call bufq_alloc().


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.40 18-Jan-2016 pooka

branches: 1.40.2;
Fix dlopen()/dlclose()+RUMP_USE_CTOR to not leave dangling pointers around.


Revision tags: nick-nhusb-base-20151226
# 1.39 04-Nov-2015 pgoyette

Export module flags to userland


Revision tags: nick-nhusb-base-20150921
# 1.38 22-Jun-2015 matt

Make module_machine const char *


# 1.37 19-Jun-2015 martin

Make handle_modctl_load() usable from compat/netbsd32.


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.36 07-Mar-2015 christos

use __COMPAT so that we get argument expansion.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.35 23-Apr-2014 pooka

branches: 1.35.4;
Add a RUMP_USE_CTOR compile-time switch. If defined, use
__attribute__((constructor)) to determine which rump kernel components
and kernel modules are linked into the rump kernel. If not defined
(default), use the regular approach with link sets.

This option is aimed to fix problems with toolchains where using link
sets is not possible because the linker does not generate the requisite
__start/__stop symbols for the link set sections (e.g. GNU gold, OS X, ...).


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.34 23-Oct-2013 mbalmer

branches: 1.34.2;
use MODULE_CLASS_MISC for Lua modules


# 1.33 21-Oct-2013 mbalmer

add MODULE_CLASS_LUA_BINDING


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.32 17-Oct-2012 dyoung

branches: 1.32.2;
Correct spelling: entrie -> entry.


# 1.31 07-Aug-2012 jnemeth

branches: 1.31.2;
Add -A, -a, and -e options to modstat(8) along with kernel
changes required to support these options. The -e option was
requested by martin@ in private chat in order to make writing tests
easier (i.e. don't bother testing MODULAR functionaility if it
doesn't exist). While there, I added -A and -a since those were
quite similar.

-A Tells you whether or not modules can be autoloaded at the moment.
This option does take into consideration the sysctl
kern.module.autoload.

-a Tells you whether or not modules can be autoloaded at the moment.
This option does not take into consideration the sysctl
kern.module.autoload.

-e Tells you whether or not you may load a module at the moment.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base
# 1.30 21-Nov-2011 christos

change printf gcc attribute to __printflike(), requested by joerg.


# 1.29 20-Nov-2011 christos

add more missing printf attributes.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.28 18-Oct-2011 jmcneill

branches: 1.28.2;
Don't try to auto-unload modules unless they were auto-loaded.


# 1.27 13-Aug-2011 christos

Always provide a meaningful short name for the kobj in the error message,
as well as the function name and the linenumber, without extra line feeds.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.26 17-Apr-2011 mrg

add a "module_machine", that defaults to machine.
allows MD code to override the default subdir for modules.


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11
# 1.25 21-Aug-2010 pgoyette

branches: 1.25.2;
Define a set of new kernel locking primitives to implement the recursive
kernconfig_mutex. Update module subsystem to use this mutex rather than
its own internal (non-recursive) mutex. Make module_autoload() do its
own locking to be consistent with the rest of the module_xxx() calls.
Update module(9) man page appropriately.

As discussed on tech-kern over the last few weeks.

Welcome to NetBSD 5.99.39 !


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.24 26-Jun-2010 pgoyette

1. Add an allocator for 'struct module *' and use it instead of local
allocations.

2. Add a new member mod_flags to the 'struct module *' and define
MODFLG_MUST_FORCE. If this flag is set and the entry is on the list
of builtins, it means that the module has been explicitly unloaded
and any re-loads will require the MODCTL_LOAD_FORCE flag. Provide a
module_require_force() method to set this flag; once set, it should
never be unset.

3. Rename original module_init2() to module_start_unload_thread() to be
more descriptive of what it does.

4. Add a new module_builtin_require_force() routine that sets the
MODFLG_MUST_FORCE flag for any module that has not yet successfully
been initialized. Call it after module_init_class(MODULE_CLASS_ANY)
to disable remaining built-in modules.

This makes built-in versions of the xxxVERBOSE modules work once more,
resolving breakage reported by jruoho@ and njoly@.

Discussed on tech-kern, and comments and suggestions implemented. No
additional discussion for last week. Tested only on amd64 systems, but
there's nothing here that should be port- or architecture-specific (no
more specific than existing module implementation) so others should not
break.


# 1.23 24-May-2010 pgoyette

Protect against attempting to load modules from the filesystem until we
have mounted the root file-system. This allows us to load built-in and
boot-loader-provided modules much earlier during startup.


Revision tags: uebayasi-xip-base1
# 1.22 26-Apr-2010 pooka

Allow everyone in the kernel to see module_base.


# 1.21 12-Mar-2010 darran

branches: 1.21.2;
DTrace: Add the Function Boundary Trace (FBT) provider moduile. This
module instruments every function in the kernel with entry and exit
probes. These probes are true zero-effect probes in that they don't
exist in the code until they are enabled. The probes are enabled by
directly patching the function entry and exit points to make jumps into
the dtrace framework.
This gives us over 29,000 trace points in the kernel.


Revision tags: yamt-nfs-mp-base9
# 1.20 05-Mar-2010 pooka

Make module_{lookup,enqueue}() static now that it's possible again
(effectively reverts my kern_module rev. 1.53 from some months ago)


# 1.19 05-Mar-2010 pooka

Move builtin modules to a list in init and load them from there
instead of using linksets directly. This has two implications:

1) It is now possible to "unload" a builtin module provided it is
not busy. This is useful e.g. to disable a kernel feature as
an immediate workaround to a security problem. To re-initialize
the module, modload -f <name> is required.
2) It is possible to use builtin modules which were linked at
runtime with an external linker (dlopen + rump).


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 1.18 18-Nov-2009 pooka

branches: 1.18.2;
* make it possible to include kern_module in a kernel without vfs
support, i.e. move vfs functionality to a separate module
(kern_module_vfs.c)
* make module proplist size an MI constant (now 8k) instead of PAGE_SIZE
* change some error values to something else than the karmic EINVAL


# 1.17 05-Nov-2009 pooka

expose module_{lookup,enqueue}()


Revision tags: jym-xensuspend-nbase
# 1.16 02-Oct-2009 elad

First part of secmodel cleanup and other misc. changes:

- Separate the suser part of the bsd44 secmodel into its own secmodel
and directory, pending even more cleanups. For revision history
purposes, the original location of the files was

src/sys/secmodel/bsd44/secmodel_bsd44_suser.c
src/sys/secmodel/bsd44/suser.h

- Add a man-page for secmodel_suser(9) and update the one for
secmodel_bsd44(9).

- Add a "secmodel" module class and use it. Userland program and
documentation updated.

- Manage secmodel count (nsecmodels) through the module framework.
This eliminates the need for secmodel_{,de}register() calls in
secmodel code.

- Prepare for secmodel modularization by adding relevant module bits.
The secmodels don't allow auto unload. The bsd44 secmodel depends
on the suser and securelevel secmodels. The overlay secmodel depends
on the bsd44 secmodel. As the module class is only cosmetic, and to
prevent ambiguity, the bsd44 and overlay secmodels are prefixed with
"secmodel_".

- Adapt the overlay secmodel to recent changes (mainly vnode scope).

- Stop using link-sets for the sysctl node(s) creation.

- Keep sysctl variables under nodes of their relevant secmodels. In
other words, don't create duplicates for the suser/securelevel
secmodels under the bsd44 secmodel, as the latter is merely used
for "grouping".

- For the suser and securelevel secmodels, "advertise presence" in
relevant sysctl nodes (sysctl.security.models.{suser,securelevel}).

- Get rid of the LKM preprocessor stuff.

- As secmodels are now modules, there's no need for an explicit call
to secmodel_start(); it's handled by the module framework. That
said, the module framework was adjusted to properly load secmodels
early during system startup.

- Adapt rump to changes: Instead of using empty stubs for securelevel,
simply use the suser secmodel. Also replace secmodel_start() with a
call to secmodel_suser_start().

- 5.99.20.

Testing was done on i386 ("release" build). Spearated module_init()
changes were tested on sparc and sparc64 as well by martin@ (thanks!).

Mailing list reference:

http://mail-index.netbsd.org/tech-kern/2009/09/25/msg006135.html


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 1.15 09-Jun-2009 jnemeth

Add the MODCTL_NO_PROP flag to tell the kernel to ignore <module>.prop.

Add the '-P' option to modload(8) to set this flag.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base haad-dm-base2 haad-nbase2 ad-audiomp2-base nick-hppapmap-base haad-dm-base mjf-devfs2-base
# 1.14 25-Nov-2008 ad

branches: 1.14.4;
Add some basic DDB stuff for modules.


# 1.13 19-Nov-2008 ad

Unused header.


# 1.12 18-Nov-2008 ad

Some modules may want to avoid autounload because their use is transient.
Their FINI routine may legitimately succeed even though the module is likely
to be used soon again, for example: exec_script. Add a MODULE_CMD_AUTOUNLOAD
to query whether a module wants to avoid autounload.


# 1.11 14-Nov-2008 ad

- If the system encounters a severe memory shortage, start unloading
unused kernel modules.
- Try to unload any autoloaded kernel modules 10 seconds after their
load was successful.
- Keep a counter to track module load/unload events.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2
# 1.10 22-Oct-2008 ad

branches: 1.10.2;
- Be clear about whether module load is explicit or system initiated (auto).
- Require that module_lock is held to autoload, so that any preconditions
can be safely checked.


Revision tags: haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.9 01-Aug-2008 pooka

expose module_compatible()


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.8 31-May-2008 ad

branches: 1.8.4;
- Put in place module compatibility check against __NetBSD_Version__,
as discussed on tech-kern.

- Remove unused module_jettison().


# 1.7 20-May-2008 ad

If autoloading a module, don't consider the current working directory.


# 1.6 20-May-2008 ad

Allow module class to be passed to module_load(), as a basic sanity check
that we are loading the right kind of module.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.5 01-May-2008 ad

branches: 1.5.2;
- Add module_find_section(), allows a module to look up data in its object.
- Work around build failure.


# 1.4 01-May-2008 ad

Get the pre-loaded module code working.


# 1.3 28-Apr-2008 martin

Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 matt-armv6-nbase keiichi-mipv6-nbase keiichi-mipv6-base
# 1.2 02-Mar-2008 jmmv

branches: 1.2.2; 1.2.4; 1.2.6;
Add support for load-time parameters for modules, which are passed through
a dictionary. As discussed in tech-kern@.


Revision tags: hpcarm-cleanup-base nick-net80211-sync-base mjf-devfs-base bouyer-xeni386-base bouyer-xeni386-nbase
# 1.1 16-Jan-2008 ad

branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.12;
Pull in my modules code for review/test/hacking.


Revision tags: nick-nhusb-base-20161204
# 1.41 16-Nov-2016 pgoyette

Define a new module class for the bufq_strategy modules. These need to
be loaded and intialized before autoconfigure runs, since some devices
(like disks and floppy drives) want to call bufq_alloc().


Revision tags: pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.40 18-Jan-2016 pooka

Fix dlopen()/dlclose()+RUMP_USE_CTOR to not leave dangling pointers around.


Revision tags: nick-nhusb-base-20151226
# 1.39 04-Nov-2015 pgoyette

Export module flags to userland


Revision tags: nick-nhusb-base-20150921
# 1.38 22-Jun-2015 matt

Make module_machine const char *


# 1.37 19-Jun-2015 martin

Make handle_modctl_load() usable from compat/netbsd32.


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.36 07-Mar-2015 christos

use __COMPAT so that we get argument expansion.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base rmind-smpnet-nbase rmind-smpnet-base tls-maxphys-base
# 1.35 23-Apr-2014 pooka

branches: 1.35.4;
Add a RUMP_USE_CTOR compile-time switch. If defined, use
__attribute__((constructor)) to determine which rump kernel components
and kernel modules are linked into the rump kernel. If not defined
(default), use the regular approach with link sets.

This option is aimed to fix problems with toolchains where using link
sets is not possible because the linker does not generate the requisite
__start/__stop symbols for the link set sections (e.g. GNU gold, OS X, ...).


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.34 23-Oct-2013 mbalmer

branches: 1.34.2;
use MODULE_CLASS_MISC for Lua modules


# 1.33 21-Oct-2013 mbalmer

add MODULE_CLASS_LUA_BINDING


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.32 17-Oct-2012 dyoung

branches: 1.32.2;
Correct spelling: entrie -> entry.


# 1.31 07-Aug-2012 jnemeth

branches: 1.31.2;
Add -A, -a, and -e options to modstat(8) along with kernel
changes required to support these options. The -e option was
requested by martin@ in private chat in order to make writing tests
easier (i.e. don't bother testing MODULAR functionaility if it
doesn't exist). While there, I added -A and -a since those were
quite similar.

-A Tells you whether or not modules can be autoloaded at the moment.
This option does take into consideration the sysctl
kern.module.autoload.

-a Tells you whether or not modules can be autoloaded at the moment.
This option does not take into consideration the sysctl
kern.module.autoload.

-e Tells you whether or not you may load a module at the moment.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base
# 1.30 21-Nov-2011 christos

change printf gcc attribute to __printflike(), requested by joerg.


# 1.29 20-Nov-2011 christos

add more missing printf attributes.


Revision tags: jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.28 18-Oct-2011 jmcneill

branches: 1.28.2;
Don't try to auto-unload modules unless they were auto-loaded.


# 1.27 13-Aug-2011 christos

Always provide a meaningful short name for the kobj in the error message,
as well as the function name and the linenumber, without extra line feeds.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.26 17-Apr-2011 mrg

add a "module_machine", that defaults to machine.
allows MD code to override the default subdir for modules.


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11
# 1.25 21-Aug-2010 pgoyette

branches: 1.25.2;
Define a set of new kernel locking primitives to implement the recursive
kernconfig_mutex. Update module subsystem to use this mutex rather than
its own internal (non-recursive) mutex. Make module_autoload() do its
own locking to be consistent with the rest of the module_xxx() calls.
Update module(9) man page appropriately.

As discussed on tech-kern over the last few weeks.

Welcome to NetBSD 5.99.39 !


Revision tags: uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.24 26-Jun-2010 pgoyette

1. Add an allocator for 'struct module *' and use it instead of local
allocations.

2. Add a new member mod_flags to the 'struct module *' and define
MODFLG_MUST_FORCE. If this flag is set and the entry is on the list
of builtins, it means that the module has been explicitly unloaded
and any re-loads will require the MODCTL_LOAD_FORCE flag. Provide a
module_require_force() method to set this flag; once set, it should
never be unset.

3. Rename original module_init2() to module_start_unload_thread() to be
more descriptive of what it does.

4. Add a new module_builtin_require_force() routine that sets the
MODFLG_MUST_FORCE flag for any module that has not yet successfully
been initialized. Call it after module_init_class(MODULE_CLASS_ANY)
to disable remaining built-in modules.

This makes built-in versions of the xxxVERBOSE modules work once more,
resolving breakage reported by jruoho@ and njoly@.

Discussed on tech-kern, and comments and suggestions implemented. No
additional discussion for last week. Tested only on amd64 systems, but
there's nothing here that should be port- or architecture-specific (no
more specific than existing module implementation) so others should not
break.


# 1.23 24-May-2010 pgoyette

Protect against attempting to load modules from the filesystem until we
have mounted the root file-system. This allows us to load built-in and
boot-loader-provided modules much earlier during startup.


Revision tags: uebayasi-xip-base1
# 1.22 26-Apr-2010 pooka

Allow everyone in the kernel to see module_base.


# 1.21 12-Mar-2010 darran

branches: 1.21.2;
DTrace: Add the Function Boundary Trace (FBT) provider moduile. This
module instruments every function in the kernel with entry and exit
probes. These probes are true zero-effect probes in that they don't
exist in the code until they are enabled. The probes are enabled by
directly patching the function entry and exit points to make jumps into
the dtrace framework.
This gives us over 29,000 trace points in the kernel.


Revision tags: yamt-nfs-mp-base9
# 1.20 05-Mar-2010 pooka

Make module_{lookup,enqueue}() static now that it's possible again
(effectively reverts my kern_module rev. 1.53 from some months ago)


# 1.19 05-Mar-2010 pooka

Move builtin modules to a list in init and load them from there
instead of using linksets directly. This has two implications:

1) It is now possible to "unload" a builtin module provided it is
not busy. This is useful e.g. to disable a kernel feature as
an immediate workaround to a security problem. To re-initialize
the module, modload -f <name> is required.
2) It is possible to use builtin modules which were linked at
runtime with an external linker (dlopen + rump).


Revision tags: uebayasi-xip-base matt-premerge-20091211
# 1.18 18-Nov-2009 pooka

branches: 1.18.2;
* make it possible to include kern_module in a kernel without vfs
support, i.e. move vfs functionality to a separate module
(kern_module_vfs.c)
* make module proplist size an MI constant (now 8k) instead of PAGE_SIZE
* change some error values to something else than the karmic EINVAL


# 1.17 05-Nov-2009 pooka

expose module_{lookup,enqueue}()


Revision tags: jym-xensuspend-nbase
# 1.16 02-Oct-2009 elad

First part of secmodel cleanup and other misc. changes:

- Separate the suser part of the bsd44 secmodel into its own secmodel
and directory, pending even more cleanups. For revision history
purposes, the original location of the files was

src/sys/secmodel/bsd44/secmodel_bsd44_suser.c
src/sys/secmodel/bsd44/suser.h

- Add a man-page for secmodel_suser(9) and update the one for
secmodel_bsd44(9).

- Add a "secmodel" module class and use it. Userland program and
documentation updated.

- Manage secmodel count (nsecmodels) through the module framework.
This eliminates the need for secmodel_{,de}register() calls in
secmodel code.

- Prepare for secmodel modularization by adding relevant module bits.
The secmodels don't allow auto unload. The bsd44 secmodel depends
on the suser and securelevel secmodels. The overlay secmodel depends
on the bsd44 secmodel. As the module class is only cosmetic, and to
prevent ambiguity, the bsd44 and overlay secmodels are prefixed with
"secmodel_".

- Adapt the overlay secmodel to recent changes (mainly vnode scope).

- Stop using link-sets for the sysctl node(s) creation.

- Keep sysctl variables under nodes of their relevant secmodels. In
other words, don't create duplicates for the suser/securelevel
secmodels under the bsd44 secmodel, as the latter is merely used
for "grouping".

- For the suser and securelevel secmodels, "advertise presence" in
relevant sysctl nodes (sysctl.security.models.{suser,securelevel}).

- Get rid of the LKM preprocessor stuff.

- As secmodels are now modules, there's no need for an explicit call
to secmodel_start(); it's handled by the module framework. That
said, the module framework was adjusted to properly load secmodels
early during system startup.

- Adapt rump to changes: Instead of using empty stubs for securelevel,
simply use the suser secmodel. Also replace secmodel_start() with a
call to secmodel_suser_start().

- 5.99.20.

Testing was done on i386 ("release" build). Spearated module_init()
changes were tested on sparc and sparc64 as well by martin@ (thanks!).

Mailing list reference:

http://mail-index.netbsd.org/tech-kern/2009/09/25/msg006135.html


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 1.15 09-Jun-2009 jnemeth

Add the MODCTL_NO_PROP flag to tell the kernel to ignore <module>.prop.

Add the '-P' option to modload(8) to set this flag.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base2 jym-xensuspend-base haad-dm-base2 haad-nbase2 ad-audiomp2-base nick-hppapmap-base haad-dm-base mjf-devfs2-base
# 1.14 25-Nov-2008 ad

branches: 1.14.4;
Add some basic DDB stuff for modules.


# 1.13 19-Nov-2008 ad

Unused header.


# 1.12 18-Nov-2008 ad

Some modules may want to avoid autounload because their use is transient.
Their FINI routine may legitimately succeed even though the module is likely
to be used soon again, for example: exec_script. Add a MODULE_CMD_AUTOUNLOAD
to query whether a module wants to avoid autounload.


# 1.11 14-Nov-2008 ad

- If the system encounters a severe memory shortage, start unloading
unused kernel modules.
- Try to unload any autoloaded kernel modules 10 seconds after their
load was successful.
- Keep a counter to track module load/unload events.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 netbsd-5-base matt-mips64-base2
# 1.10 22-Oct-2008 ad

branches: 1.10.2;
- Be clear about whether module load is explicit or system initiated (auto).
- Require that module_lock is held to autoload, so that any preconditions
can be safely checked.


Revision tags: haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.9 01-Aug-2008 pooka

expose module_compatible()


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.8 31-May-2008 ad

branches: 1.8.4;
- Put in place module compatibility check against __NetBSD_Version__,
as discussed on tech-kern.

- Remove unused module_jettison().


# 1.7 20-May-2008 ad

If autoloading a module, don't consider the current working directory.


# 1.6 20-May-2008 ad

Allow module class to be passed to module_load(), as a basic sanity check
that we are loading the right kind of module.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2
# 1.5 01-May-2008 ad

branches: 1.5.2;
- Add module_find_section(), allows a module to look up data in its object.
- Work around build failure.


# 1.4 01-May-2008 ad

Get the pre-loaded module code working.


# 1.3 28-Apr-2008 martin

Remove clause 3 and 4 from TNF licenses


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 matt-armv6-nbase keiichi-mipv6-nbase keiichi-mipv6-base
# 1.2 02-Mar-2008 jmmv

branches: 1.2.2; 1.2.4; 1.2.6;
Add support for load-time parameters for modules, which are passed through
a dictionary. As discussed in tech-kern@.


Revision tags: hpcarm-cleanup-base nick-net80211-sync-base mjf-devfs-base bouyer-xeni386-base bouyer-xeni386-nbase
# 1.1 16-Jan-2008 ad

branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.12;
Pull in my modules code for review/test/hacking.