MODNEXT(2)

✨ MODNEXT(2) ✨ β€” return the modid of the next kernel module, bestie πŸ’–

okay so welcome to the manual page for modnext, aka the "who's next in the kernel module lineup?" system call. manual name is MODNEXT(2), and we're about to vibe check it together. no cap. 🫢


πŸŽ€ NAME πŸŽ€

modnext β€” return the modid of the next kernel module. that's it, that's the whole name. iconic.

πŸ“š LIBRARY πŸ“š

you'll find this in the Standard C Library (libc, -lc). yes queen, link it with -lc. πŸ’…

🧚 SYNOPSIS 🧚

#include <sys/param.h>
#include <sys/module.h>

int
modnext(int modid);

int
modfnext(int modid);

πŸ’… DESCRIPTION πŸ’…

so the modnext() system call returns the modid of the next kernel module β€” literally the one after modid β€” or 0 if modid is the last module in the list. it's giving "end of the line, bestie." 😭

if the modid value is 0, then modnext() will return the modid of the first module. so 0 is your "start from the top" button. ✨

and modfnext()? that one must always be given a valid modid. no exceptions, no shortcuts, no "oops I passed 0." it's not that kind of function. 🚫

🌈 RETURN VALUES 🌈

the modnext() system call returns the modid of the next module (peep DESCRIPTION above, bestie) or 0. if an error occurs, errno is set to indicate the error. so check that errno, okay? πŸ‘‘

πŸ’€ ERRORS πŸ’€

the only error set by modnext() is ENOENT. it gets set when modid refers to a kernel module that does not exist (aka it's not loaded). so if you're getting ENOENT, the module is simply not there. not loaded, not invited, not on the list. periodt. πŸ’€

πŸ‘€ SEE ALSO πŸ‘€

πŸ•°οΈ HISTORY πŸ•°οΈ

the kld interface first appeared in FreeBSD 3.0. vintage, but still serving looks. πŸ’œ


and that's the whole page, bestie. this manual page is from Debian, dated September 28, 2000, and it's literally MODNEXT(2). slay, bye. πŸ’–βœ¨

πŸ“¦ where this page comes from