KLDNEXT(2)
β¨ KLDNEXT(2) β¨
okay bestie, so this is kldnext from the System Calls Manual β it lives in the Standard C Library (libc, -lc) and it is genuinely so much simpler than it sounds, i promise π
π NAME π
kldnext β return the fileid of the next kld file
like. that's it. that's the whole job. she's a one-trick pony and she ATE π
π LIBRARY π
Standard C Library (libc, -lc)
πΈ SYNOPSIS πΈ
#include <sys/param.h>
#include <sys/linker.h>
int
kldnext(int fileid);
yes you need BOTH headers, no you cannot skip one, i don't make the rules π«Ά
π« DESCRIPTION π«
so here's the tea π β the kldnext() system call returns the fileid of the next kld file, meaning the one that comes right after fileid.
and if fileid is literally the last file loaded? she returns 0. that's the vibe check telling you you've hit the end of the line, no cap.
now the iconic part π β to get the fileid of the first kld file, you pass a fileid of 0 to kldnext(). so 0 is both "start me at the beginning" AND "you've reached the end", which is lowkey a little cursed but it's fine, it's fine, we deal π
think of it like a group chat scroll: hand her a message id, she gives you the next one. hand her nothing, she gives you the first one. main character energy tbh π
π₯ RETURN VALUES π₯
- on success,
kldnext()returns thefileidof the next kld file, or0π - otherwise,
kldnext()returns the value-1and sets the global variableerrnoto indicate the error π
so like β check your return value. always. fr fr.
π ERRORS π
the only error set by kldnext() is ENOENT.
ENOENT gets set when fileid refers to a kld file that does not exist (like, it's not loaded). ghosted you entirely. no trace. nothing to see here π
just ENOENT. that's the whole list. don't go looking for more, there are no more, i checked π
π 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 friend group honestly, go say hi to all of them π¦
β HISTORY β
the kld interface first appeared in FreeBSD 3.0. a legend from day one, we stan an OG π
and that's a wrap, bestie!! this page is from Debian, dated February 22, 2006, and it's filed under KLDNEXT(2) β go forth and iterate your fileids responsibly, mwah πβ¨
π¦ 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) 1999 Chris Costello
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms