MODULE_DEPEND(9)
β¨ MODULE_DEPEND π
okay bestie, so this one is literally called MODULE_DEPEND and it's from the Kernel Developer's Manual, section 9 (iykyk, that's the kernel interface girlies π). it does exactly one thing and it does it iconically: it sets up kernel module dependencies. let's get into it π¦
π SYNOPSIS
first you gotta pull in the vibes:
#include <sys/param.h>
#include <sys/module.h>
then you hit 'em with:
MODULE_DEPEND(name, moddepend, int minversion, int prefversion,
int maxversion);
πΈ DESCRIPTION
so the MODULE_DEPEND() macro sets a dependency on another kernel module, and that other module is called moddepend, and it has to have registered its version already with MODULE_VERSION(). no version registration, no dependency, that's the deal π
what MODULE_DEPEND() actually does is give hints to the kernel loader(8) and to the kernel linker β it's basically sliding into their DMs like "hey bestie, pls make sure this named dependency gets loaded before the existing module, mwah π". and that's it. it does not change or dictate the order in which modules are initialized at runtime. like, loading order β init order, don't get it twisted π
you have to specify three versions for moddepend, and here's the breakdown:
minversionβ the minimum version the current module can depend on. the floor. the bare minimum. periodt.maxversionβ the maximum version the current module can depend on. the ceiling, no cap fr.prefversionβ the preferred version the current module can depend on. the one you'd pick if you could pick π
π EXAMPLES
look at this little cutie go:
MODULE_DEPEND(foo, bar, 1, 3, 4);
so foo is depending on bar, and it'll accept versions 1 through 4, but it'd prefer 3. main character energy tbh π
π SEE ALSO
go read those too, they're all in the same friend group π«Ά
π AUTHORS
this manual page was written by Alexander Langer <alex@FreeBSD.org> β absolute icon, we stan π
π reminder bestie: this macro is a hint, not a runtime scheduling command. don't go telling people it orders your init, because it literally does not. fr fr.
and that's the whole page, we ate and left no crumbs π this was Debian's version, dated January 11, 2005 β vintage but still slaying β¨ bye bestie, go write some kernel modules ππ¦
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 2001 Alexander Langer
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms