KINFO_GETPROC(3)

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

πŸ’… KINFO_GETPROC(3) β€” the libutil girlies' guide πŸ’…

okay so bestie, welcome to the Library Functions Manual for KINFO_GETPROC(3), iykyk ✨

🌸 NAME 🌸

kinfo_getproc β€” the function for getting process information from the kernel 🫢

πŸŽ€ LIBRARY πŸŽ€

System Utilities Library β€” that's libutil, and you link it with -lutil πŸ’–

✨ SYNOPSIS ✨

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

struct kinfo_proc *
kinfo_getproc(pid_t pid);

πŸ¦‹ DESCRIPTION πŸ¦‹

so this function is literally used for obtaining process information from the kernel, no cap πŸ‘‘

The pid field contains the process identifier. It should be a process that you have privilege to access β€” like, do not come for processes you don't have the range for, bestie πŸ™ˆ

This function is a wrapper around sysctl(3) with the KERN_PROC_PID mib. And here's the iconic part: while the kernel returns a packed structure, this function expands the data into a fixed record format. it's giving ✨glow-up✨

🌈 RETURN VALUES 🌈

On success, the kinfo_getproc() function returns a pointer to a struct kinfo_proc structure as defined by <sys/user.h>. That pointer was obtained by an internal call to malloc(3), so it's your problem now β€” it must be freed by the caller with a call to free(3). πŸ§šβ€β™€οΈ

not me handing you memory and expecting you to clean it up… yes bestie, free it. please. 😭

On failure, the kinfo_getproc() function returns NULL. πŸ’€

πŸ‘‘ SEE ALSO πŸ‘‘

⭐ HISTORY ⭐

The kinfo_getproc() function first appeared in FreeBSD 7.0 β€” a true main character origin story πŸŽ€


okay that's the whole page, you ate that πŸ’…βœ¨πŸ’– β€” sign-off time: this came from the Debian edition of the manpage, dated May 10, 2020, and honestly? iconic. periodt. πŸ“πŸ¦‹

πŸ“¦ where this page comes from