KINFO_GETPROC(3)
π 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
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 2009 Ulf Lilleengen
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms