MODULE_DEPEND(9)
π MODULE_DEPEND(9) β kernel module dependency vibes
okay bestie, welcome to the Kernel Developer's Manual β¨ this one's a 9 section page, i.e. kernel-land, and it's all about MODULE_DEPEND β the macro that lets your kernel module say "hey, I need that other module, no cap." π
πΈ NAME
MODULE_DEPEND β set kernel module dependencies π«Ά
β¨ SYNOPSIS
#include <sys/param.h>
#include <sys/module.h>
MODULE_DEPEND(name, moddepend, int minversion, int prefversion,
int maxversion);
Like, yes, prefversion comes before maxversion in the actual call β that's the order, don't come for me π
π DESCRIPTION
So the MODULE_DEPEND() macro sets a dependency on another kernel module with name moddepend, and that module must have registered its version with MODULE_VERSION(). That's the whole vibe check: no version registered, no dependency, periodt.
What MODULE_DEPEND() actually does is give hints to the kernel loader(8) and to the kernel linker so the named dependency gets loaded prior to the existing module, fr fr. It's giving main character energy for load order.
but like, important: it does not change or dictate the order in which modules are initialized at runtime. Loading order β init order, bestie, they're different things π
Three versions must be specified for moddepend, and honestly you need all three:
minversionβ the minimum version on which the current module can depend.maxversionβ the maximum version on which the current module can depend.prefversionβ the preferred version on which the current module can depend.
(the original page lists them in that order, so that's the order I'm giving you π)
π¦ EXAMPLES
MODULE_DEPEND(foo, bar, 1, 3, 4);
that's it, that's the example β foo depends on bar, min 1, pref 3, max 4. slay π₯
π SEE ALSO
go read those next, iykyk π
π AUTHORS
This manual page was written by Alexander Langer <alex@FreeBSD.org>. iconic behavior, ty for your service π«‘
mwah, that's the page π
from the Debian crew, dated January 11, 2005 β yes she's vintage, and she still says MODULE_DEPEND(9) at the bottom, as she should πβ¨
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 2001 Alexander Langer
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms