KLD(3)
π KLD(3) β the kld girlies' manual page
ok so this is the KLD(3) page from the library functions manual, and it's basically the two little helper functions that let your userland app poke at kernel modules. no cap, it's short but it slaps. bestie, let's go β¨
π NAME π
kld_isloaded, kld_load β kld utility functions π§
π LIBRARY π
System Utilities Library (libutil, -lutil) π
like, that's the whole vibe. you're linking against <pink>libutil</pink> with <pink>-lutil</pink> and that's where these live.
β SYNOPSIS β
#include <libutil.h>
int
kld_isloaded(const char *name);
int
kld_load(const char *name);
yes bestie, that's #include <libutil.h> up top, then two functions that both hand you back an int. iconic. π«Ά
πΈ DESCRIPTION πΈ
so these functions are literally here to facilitate loading kernel modules from userland applications. that's the whole job! π they exist so your normal-people program doesn't have to do the scary kernel dance itself.
The kld_isloaded() function takes a name and returns a non-zero value if a module of that name is currently loaded. non-zero = yes bestie, it's there. and the name you pass is flexible in three ways:
- the name of a module file β like
cpufreq.koπΎ - the same name without the
.koextension β likecpufreq - the name of a module contained within that file β like
cpu/ichssπ¦
β οΈ ok this part matters, don't skip it: only the latter will return correct results if the module is compiled into the kernel. so if it's baked into the kernel itself (not a loadable file situation), you need the cpu/ichss style name or you're gonna get lied to. iykyk π
The kld_load() function is a simple wrapper around the kldload(2) function. like, that's it, it's a little guy holding a sign for kldload(2) π. and here's the exact deal: it returns zero if and only if the corresponding kldload() call succeeded or returned EEXIST (which is the signifying-that-the-requested-module-was-already-loaded situation). so <mint>already loaded counts as a win</mint>. slay. π
π₯ SEE ALSO π₯
go read those too, they're the extended universe π
π¦ HISTORY π¦
The kld_isloaded() and kld_load() functions first appeared in FreeBSD 6.3. vintage! β¨
π AUTHORS π
The kld_isloaded() and kld_load() functions and this manual page were written by Dag-Erling SmΓΈrgrav <des@FreeBSD.org>. give them their flowers πΈπ
and that's the whole page, bestie π«Ά this one came from Debian, dated February 18, 2006 β yeah, it's giving vintage but it still ate. go load some modules responsibly πβ¨
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 2006 Dag-Erling SmΓΈrgrav
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms