PROC_GET_FDINFO(3PROC) Process Control Library Functions
proc_get_fdinfo, proc_fdinfo_free - get process file descriptor
information
Process Control Library (libproc, -lproc)
#include <libproc.h>
prfdinfo_t *
proc_get_fdinfo(pid_t pid, int fd);
void
proc_fdinfo_free(prfdinfo_t *info);
The proc_get_fdinfo() function is a convenient way to read the
/proc/pid/fdinfo/fd file for the process pid and file descriptor fd.
On success, the return value of the function is a pointer to a properly
terminated prfdinfo_t structure.
The definition of the prfdinfo_t structure may be found in proc(5).
The caller must free the returned memory by calling the
proc_fdinfo_free() function.
The proc_fdinfo_free() frees all memory associated with the prfdinfo_t
structure passed as info.
Upon successful completion, the proc_get_fdinfo() function returns a
pointer to an allocated prfdinfo_t structure. Otherwise, NULL is
returned to indicate an error occurred and errno is set to indicate the
error.
In addition to the errors listed below, the proc_get_fdinfo() function
may fail for the same reasons as the fstat(2), lseek(2), malloc(3C),
open(2), and read(2) functions. The proc_get_fdinfo() function will
fail if:
EIO The data read from the file under /proc is not
properly terminated.
Uncommitted
MT-LEVEL
MT-Safe
libproc(3LIB), proc(5)
illumos January 29, 2020 illumos
NAME
proc_get_fdinfo, proc_fdinfo_free - get process file descriptor
information
LIBRARY
Process Control Library (libproc, -lproc)
SYNOPSIS
#include <libproc.h>
prfdinfo_t *
proc_get_fdinfo(pid_t pid, int fd);
void
proc_fdinfo_free(prfdinfo_t *info);
DESCRIPTION
The proc_get_fdinfo() function is a convenient way to read the
/proc/pid/fdinfo/fd file for the process pid and file descriptor fd.
On success, the return value of the function is a pointer to a properly
terminated prfdinfo_t structure.
The definition of the prfdinfo_t structure may be found in proc(5).
The caller must free the returned memory by calling the
proc_fdinfo_free() function.
The proc_fdinfo_free() frees all memory associated with the prfdinfo_t
structure passed as info.
RETURN VALUES
Upon successful completion, the proc_get_fdinfo() function returns a
pointer to an allocated prfdinfo_t structure. Otherwise, NULL is
returned to indicate an error occurred and errno is set to indicate the
error.
ERRORS
In addition to the errors listed below, the proc_get_fdinfo() function
may fail for the same reasons as the fstat(2), lseek(2), malloc(3C),
open(2), and read(2) functions. The proc_get_fdinfo() function will
fail if:
EIO The data read from the file under /proc is not
properly terminated.
INTERFACE STABILITY
Uncommitted
MT-LEVEL
MT-Safe
SEE ALSO
libproc(3LIB), proc(5)
illumos January 29, 2020 illumos