KLDSYM(2)
π KLDSYM π
okay bestie, section 2 of the manual, kldsym β say it with me, it's a system call, we're in the syscall girlies now π
β¨ NAME β¨
kldsym β look up address by symbol name in a KLD
π«Ά LIBRARY π«Ά
Standard C Library (libc, -lc)
no cap, it's right there in libc, you don't need anything extra
πΈ SYNOPSIS πΈ
#include <sys/param.h>
#include <sys/linker.h>
int
kldsym(int fileid, int cmd, void *data);
π DESCRIPTION π
so the kldsym() system call is the one you call when you're like "hey, what's the address of this symbol?" β it returns the address of the symbol specified in data, inside the module specified by fileid. β¨
and here's the cute part: if fileid is 0, all the loaded modules get searched. every single one. she's thorough like that π
right now, the only cmd that's actually implemented is KLDSYM_LOOKUP. that's it. that's the whole menu. periodt.
π the data argument π
data is a pointer to this structure, exactly this one:
struct kld_sym_lookup {
int version; /* sizeof(struct kld_sym_lookup) */
char *symname; /* Symbol name we are looking up */
u_long symvalue;
size_t symsize;
};
okay so here's the vibe of each member π¦
versionβ you set this one, bestie. and you set it tosizeof(struct kld_sym_lookup). don't get creative with it.- the next two members,
versionandsymname, are specified by the user. (yes, the page saysversionagain β I'm just telling you what she said π) symvalueandsymsizeβ these two get filled in for you bykldsym().symvalueholds the address associated withsymname, andsymsizeholds the size of the data it points to. respectively. iconic. π
so you bring the name, she brings the address and the size. it's giving collaborative. it's giving teamwork. π
π₯ RETURN VALUES π₯
- returns the value
0if successful β slay π - otherwise the value
-1is returned and the global variableerrnois set to indicate the error. (she'll tell you what went wrong, just read the vibe check) π
π ERRORS π
the kldsym() system call will fail if:
[EINVAL]β Invalid value indata->versionorcmd. π©[ENOENT]β Thefileidargument is invalid, or the specified symbol could not be found. she looked. she really looked. it's not there. π«
π SEE ALSO π
kldfind(2), kldfirstmod(2), kldload(2), kldnext(2), kldunload(2), modfind(2), modnext(2), modstat(2), kld(4)
the whole friend group fr fr, go read them all π«Ά
π HISTORY π
The kldsym() system call first appeared in FreeBSD 3.0. she's been around a minute, she's a legend, she's an icon, and she is the moment π
kdl moment: setversiontosizeof(struct kld_sym_lookup)before you call, or you're gonna have a bad time. no cap. π
and that's the whole page, bestie!! π this one came from the Debian crew, dated October 17, 2016, and yeah it lives at KLDSYM(2) β section 2, system calls, exactly where she belongs. go forth and look up some symbols, i'm obsessed with you πβ¨π¦
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 2001 Chris Costello <chris@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms