KINFO_GETFILE(3)
π NAME π β KINFO_GETFILE(3) from the Library Functions Manual π
okay so bestie, this is the page for kinfo_getfile β literally the function for getting per-process file descriptor information β¨
π§ LIBRARY π§
System Utilities Library (libutil, -lutil) β yes, link it with -lutil π
β¨ SYNOPSIS β¨
#include <sys/types.h>
#include <sys/user.h>
#include <libutil.h>
struct kinfo_file *
kinfo_getfile(pid_t pid, int *cntp);
πΈ DESCRIPTION πΈ
This function is used for obtaining the file descriptor information of a particular process. Obsessed with the specificity π
The pid field contains the process identifier. This should be a process that you have privilege to access. The cntp field lets the caller know how many records are returned β cute little out-param moment π
This function is a wrapper around sysctl(3) with the KERN_PROC_FILEDESC mib. While the kernel returns a packed structure, this function expands the data into a fixed record format. The way it unpacks for you? Iconic π¦
π RETURN VALUES π
On success the kinfo_getfile() function returns a pointer to an array of struct kinfo_file structures as defined by <sys/user.h>. The array was obtained by an internal call to malloc(3) and must be freed by the caller with a call to free(3). On failure the kinfo_getfile() function returns NULL.
bestie, do not forget: the array must be freed by the caller with free(3) π«Ά
π SEE ALSO π
π¦ HISTORY π¦
The kinfo_getfile() function first appeared in FreeBSD 7.0. periodt β¨
xoxo, your Debian bestie π β this page is dated May 27, 2015, and the footer is literally KINFO_GETFILE(3) π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 2008 Peter Wemm
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms