KLDNEXT(2)
π« KLDNEXT(2) π«
okay so this is kldnext(2), straight out of the System Calls Manual β we're doing kernel module list traversal today bestie, and honestly? it's giving tiny-but-mighty π
πΈ NAME πΈ
kldnext β return the fileid of the next kld file
π LIBRARY π
Standard C Library (libc, -lc) β the classic, the icon, the one you already linked β¨
π¦ SYNOPSIS π¦
#include <sys/linker.h>
int
kldnext(int fileid);
π DESCRIPTION π
so the kldnext() system call returns the fileid of the next kld file β like, the one right after fileid π β or 0 if fileid is the last file loaded. periodt.
and here's the cute part: to get the fileid of the first kld file, you pass a fileid of 0 to kldnext(). that's your entry point, your main character moment, your "start here" arrow π«Ά
π₯ RETURN VALUES π₯
The kldnext() system call returns the fileid of the next kld file, or 0 if it's successful π
Otherwise kldnext() returns the value -1 and sets the global variable errno to indicate the error. not the vibe, but at least it tells you why π
π ERRORS π
The only error set by kldnext() is ENOENT β and that one shows up when fileid refers to a kld file that does not exist (i.e. is not loaded). so, like, it's not there. that's the whole thing π
π SEE ALSO π
kldfind(2), kldfirstmod(2), kldload(2), kldstat(2), kldsym(2), kldunload(2), modfind(2), modfnext(2), modnext(2), modstat(2), kld(4), kldstat(8)
the whole kld friend group, all linked up π iykyk
β HISTORY β
The kld interface first appeared in FreeBSD 3.0. lowkey vintage, highkey iconic π§
ngl this whole page is short and that's a flex β every single thing here is load-bearing, no filler, no cap π―
okay that's the whole page!! go traverse some kernel modules bestie, you're gonna slay ππΈ
~ from the Debian edition of this manual page, dated February 22, 2006 β yes the date is that old and yes it ate β¨
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 1999 Chris Costello
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms