MODFIND(2)

πŸ’– MODFIND(2) β€” the system call manual, bestie edition πŸ’–

okay so real talk, this one is from the System Calls Manual and it's giving "tiny function, huge responsibilities". let's get into it 🫢


✨ NAME ✨

modfind β€” returns the modid of a kernel module

like, that's the whole job. it finds the modid. iconic behaviour honestly πŸ‘‘


πŸ“š LIBRARY πŸ“š

Standard C Library (libc, -lc)

so yeah she lives in libc, link her like you'd link anything else in there πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

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

int
modfind(const char *modname);

look at her. one function. one const char *. no drama. no cap. ✨


🌸 DESCRIPTION 🌸

so basically, the modfind() system call returns the modid of the kernel module referenced by modname.

that's it. that's the whole vibe. you hand her a module name, she hands you back the modid. main character energy, minimal dialogue πŸ’–


πŸ¦‹ RETURN VALUES πŸ¦‹

modfind() returns the modid of the kernel module referenced by modname. that's the good ending, we love that for you 🌈

but if things go sideways? modfind() returns -1 and sets errno to indicate the error. not the vibe, but at least she tells you why 😭


πŸ’€ ERRORS πŸ’€

errno gets set to one of these when modfind() fails, and bestie you're gonna wanna read them:

  • [EFAULT] β€” the data required for this operation could not be read from the kernel space. like the kernel just. couldn't hand it over. awkward. πŸ™ˆ
  • [ENOENT] β€” the file specified is not loaded in the kernel. she looked. it's not there. it's giving empty shelf at the library πŸ“­

πŸ”₯ SEE ALSO πŸ”₯

the whole friend group, fr fr:

go read them. iykyk πŸ“–βœ¨


⭐ HISTORY ⭐

the kld interface first appeared in FreeBSD 3.0. a legend from day one, lowkey πŸ‘‘


okay that's the whole page, you absolutely ate this one bestie πŸ’…βœ¨ this was the Debian build of the manual, dated September 28, 2000, and the page itself is MODFIND(2) β€” go forth and find those modids, you've got this πŸ«ΆπŸ’–

πŸ“¦ where this page comes from