KLDSTAT(2)
๐ NAME ๐
kldstatโ get status of kld file
okay so bestie, this is the KLDSTAT(2) page from the System Calls Manual, and we're here to get the status of a kld file. no cap, it's giving kernel-loader realness. โจ
๐ฆ LIBRARY ๐ฆ
Standard C Library (libc, -lc). yes bestie, she lives in libc. ๐ซถ
๐ SYNOPSIS ๐
#include <sys/linker.h>
int
kldstat(int fileid, struct kld_file_stat *stat);
๐ธ DESCRIPTION ๐ธ
The kldstat() system call writes the info for the file referred to by fileid into stat. simple as that, icon behavior. ๐
here's the struct, looking exactly like this:
struct kld_file_stat {
int version; /* set to sizeof(struct kld_file_stat) */
char name[MAXPATHLEN];
int refs;
int id;
caddr_t address;
size_t size;
char pathname[MAXPATHLEN];
};
and the fields mean:
versionโ this field is set to the size of the structure mentioned above by the code callingkldstat(), and notkldstat()itself. yes, read that again. ๐nameโ the name of the file referred to byfileid.refsโ the number of modules referenced byfileid.idโ the id of the file specified infileid.addressโ the load address of the kld file.sizeโ the amount of memory in bytes allocated by the file.pathnameโ the full name of the file referred to byfileid, including the path.
โญ RETURN VALUES โญ
The kldstat() function returns the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indicate the error. slay when it works, errno when it doesn't. ๐ญ
๐ ERRORS ๐
The information for the file referred to by fileid is filled into the structure pointed to by stat unless:
[ENOENT]โ the file was not found (probably not loaded).[EINVAL]โ the version specified in theversionfield ofstatis not the proper version. You would need to rebuild world, the kernel, or your application, if this error occurs, given that you did properly fill in theversionfield.[EFAULT]โ there was a problem copying one, some, or all of the fields intostatin thecopyout(9)function.
๐ฎ SEE ALSO ๐ฎ
kldfind(2), kldfirstmod(2), kldload(2), kldnext(2), kldsym(2), kldunload(2), modfind(2), modfnext(2), modnext(2), modstat(2), kld(4), kldstat(8).
go off, related pages. ๐
๐ง HISTORY ๐ง
The kld interface first appeared in FreeBSD 3.0. vintage but still iconic. ๐
๐ BUGS ๐
The pathname may not be accurate if the file system mounts have changed since the module was loaded, or if this function is called within a chrooted environment. so like, keep that in mind bestie. ๐ญ
source/version: Debian ยท date: March 28, 2012 โ mwah, love u, bye! ๐โจ
๐ฆ where this page comes from
- freebsd 14.5: base 14.5
- 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