KLDLOAD(2)
π NAME π
okay so bestie, listen up β kldload is literally the call that loads KLD files into the kernel. that's it, that's the whole vibe. π¦
this one's from the System Calls Manual, section 2, so you already know it's gonna be a little spicy (kernel-adjacent = main character energy, no cap).
π LIBRARY π
it lives in the Standard C Library β that's libc, and you link it with -lc. slay. β¨
π SYNOPSIS π
#include <sys/linker.h>
int
kldload(const char *file);
that's the whole incantation. no notes. π
πΈ DESCRIPTION πΈ
okay so the way that kldload() works is β it takes the kld file you point at with file and loads it into the kernel using the kernel linker (peep kld(4) for the lore, iykyk).
now, about file: you can hand it a full path or a relative path, or honestly you can just ~not~ and it'll go searching for it within the module path instead. and where's the module path defined? by the loader tunable and the sysctl variable kern.module_path. iconic behavior honestly.
and bestie, the best part? the .ko extension for file is not mandatory. you don't gotta spell it all out. she's flexible like that. π§
β RETURN VALUES β
on success, kldload() returns the fileid of the kld file that got loaded into the kernel β that's your little receipt, keep it. π
but if something goes wrong? it returns -1 and sets errno to tell you exactly what the drama was. classic. π
π ERRORS π
the named file gets loaded unless one of these pops off:
[EPERM]β you don't have access to read the file or to link it with the kernel. and bestie, real talk: you should be the root user to be able to use the kld system calls. no shortcuts. π[EFAULT]β bad address encountered when adding kld info into the kernel space. oops. π[ENOMEM]β there is no memory to load the file into the kernel. she's full. try again later. π[ENOENT]β the file was not found. it's giving "ghosted." πΈ[ENOEXEC]β the file format of file was unrecognized. we don't know her. π[EEXIST]β the supplied file has already been loaded. girl, she's already here. β¨
π«Ά SEE ALSO π«Ά
your reading list, bestie β go off:
kldfind(2), kldfirstmod(2), kldnext(2), kldstat(2), kldsym(2), kldunload(2), modfind(2), modfnext(2), modnext(2), modstat(2), kld(4), kldload(8)
π HISTORY π
the kld interface first appeared in FreeBSD 3.0. vintage. retro. we love a legacy icon. π
mwah π β this page was brought to you by Debian, dated March 26, 2026, and it's the KLDLOAD(2) page, so you know exactly where to find it again. go load something iconic, bestie. π¦β¨
π¦ where this page comes from
- 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