KINFO_GETVMOBJECT(3)

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

hii bestie πŸ’– welcome to the KINFO_GETVMOBJECT(3) page β€” yep, the Library Functions Manual one. we're talking system-wide memory info, and it's lowkey iconic. no cap. 🫢

🌸 NAME 🌸

kinfo_getvmobject β€” the function for getting system-wide memory information, bestie. it's giving "show me the memory objects" energy. ✨

πŸ“š LIBRARY πŸ“š

System Utilities Library (libutil, -lutil). yes, that's the one. πŸŽ€

✨ SYNOPSIS ✨

include these headers, then call it like this:

#include <sys/types.h>
#include <sys/user.h>
#include <libutil.h>

struct kinfo_vmobject *
kinfo_getvmobject(int *cntp);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so this function is how you obtain information about the objects that are using memory in the system. literally its whole job. πŸ’…

The cntp argument is the little counter receipt β€” it lets the caller know how many records are returned. 🧾

It's a wrapper around the vm.objects sysctl(3) MIB. the kernel returns a packed structure, but this function expands the data into a fixed record format. so you get the fixed record vibe instead of the packed chaos. πŸ”₯

πŸ’€ RETURN VALUES πŸ’€

On success, kinfo_getvmobject() returns a pointer to an array of struct kinfo_vmobject structures as defined by <sys/user.h>. πŸ’–

That array is allocated by an internal call to malloc(3), and you β€” yes, the caller β€” must free it with a call to free(3). do not forget, bestie β€” it's your job to free it. 😭

On failure, kinfo_getvmobject() returns NULL. πŸ’€

🌈 SEE ALSO 🌈

go read these too, bestie:

πŸ‘‘ HISTORY πŸ‘‘

kinfo_getvmobject() first appeared in FreeBSD 10.2. periodt. πŸ’…


and that's the page, bestie πŸŽ€ source/version: Debian, dated May 20, 2020. slay. ✨

πŸ“¦ where this page comes from