MODFIND(2)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1

πŸ’… MODFIND(2) β€” System Calls Manual πŸ’…

hey bestie, welcome to modfind(2) β€” the tiny system call with main character energy. no cap, it's here to fetch a kernel module's modid and dip. πŸ¦‹

🌸 NAME 🌸

modfind β€” returns the modid of a kernel module. literally that's it, and it ate. πŸ‘‘

🫢 LIBRARY 🫢

Standard C Library (libc, -lc). link it like you mean it, bestie. πŸ’–

✨ SYNOPSIS ✨

okay so here's the summoning code, exactly as the manpage gods wrote it:

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

int
modfind(const char *modname);

πŸ¦‹ DESCRIPTION πŸ¦‹

The modfind() system call returns the modid of the kernel module referenced by modname. so you hand it a module name, it hands you back the ID. no extra lore, just vibes and kernel module matching. πŸ’…

πŸ”₯ RETURN VALUES πŸ”₯

The modfind() system call returns the modid of the kernel module referenced by modname. iconic behavior.

Upon error, modfind() returns -1 and sets errno to indicate the error. so if you see -1, check errno β€” it's giving "something went wrong, here's the receipt." 😭

πŸ’€ ERRORS πŸ’€

errno is set to the following if modfind() fails:

  • EFAULT β€” The data required for this operation could not be read from the kernel space. ngl, kernel space wasn't giving what needed to be gave. πŸ’€
  • ENOENT β€” The file specified is not loaded in the kernel. bestie, that thing is not loaded in the kernel, periodt. πŸ™ˆ

πŸ‘€ SEE ALSO πŸ‘€

go read these next, iykyk: kldfind(2), kldfirstmod(2), kldload(2), kldnext(2), kldstat(2), kldsym(2), kldunload(2), modfnext(2), modnext(2), modstat(2), kld(4), kldstat(8). πŸ’œ

πŸŽ€ HISTORY πŸŽ€

The kld interface first appeared in FreeBSD 3.0. vintage but still slaying. ⭐


πŸ’– cute sign-off: this page is from Debian, dated September 28, 2000 β€” mwah, bye bestie! πŸŽ€

πŸ“¦ where this page comes from