1.\" 2.\" This file and its contents are supplied under the terms of the 3.\" Common Development and Distribution License ("CDDL"), version 1.0. 4.\" You may only use this file in accordance with the terms of version 5.\" 1.0 of the CDDL. 6.\" 7.\" A full copy of the text of the CDDL should have accompanied this 8.\" source. A copy of the CDDL is also available via the Internet at 9.\" http://www.illumos.org/license/CDDL. 10.\" 11.\" 12.\" Copyright 2020 OmniOS Community Edition (OmniOSce) Association. 13.\" 14.Dd January 29, 2020 15.Dt PROC_GET_FDINFO 3PROC 16.Os 17.Sh NAME 18.Nm proc_get_fdinfo , 19.Nm proc_fdinfo_free 20.Nd get process file descriptor information 21.Sh LIBRARY 22.Lb libproc 23.Sh SYNOPSIS 24.In libproc.h 25.Ft prfdinfo_t * 26.Fo proc_get_fdinfo 27.Fa "pid_t pid" 28.Fa "int fd" 29.Fc 30.Ft "void" 31.Fo proc_fdinfo_free 32.Fa "prfdinfo_t *info" 33.Fc 34.Sh DESCRIPTION 35The 36.Fn proc_get_fdinfo 37function is a convenient way to read the 38.Pa /proc/pid/fdinfo/fd 39file for the process 40.Fa pid 41and file descriptor 42.Fa fd . 43On success, the return value of the function is a pointer to a properly 44terminated 45.Sy prfdinfo_t 46structure. 47.Pp 48The definition of the 49.Vt prfdinfo_t 50structure may be found in 51.Xr proc 4 . 52.Pp 53The caller must free the returned memory by calling the 54.Fn proc_fdinfo_free 55function. 56.Pp 57The 58.Fn proc_fdinfo_free 59frees all memory associated with the 60.Vt prfdinfo_t 61structure passed as 62.Fa info . 63.Sh RETURN VALUES 64Upon successful completion, the 65.Fn proc_get_fdinfo 66function returns a pointer to an allocated 67.Vt prfdinfo_t 68structure. 69Otherwise, 70.Dv NULL 71is returned to indicate an error occurred and 72.Vt errno 73is set to indicate the error. 74.Sh ERRORS 75In addition to the errors listed below, the 76.Fn proc_get_fdinfo 77function may fail for the same reasons as the 78.Xr fstat 2 , 79.Xr lseek 2 , 80.Xr malloc 3C , 81.Xr open 2 , 82and 83.Xr read 2 84functions. 85The 86.Fn proc_get_fdinfo 87function will fail if: 88.Bl -tag -width Er 89.It Er EIO 90The data read from the file under 91.Pa /proc 92is not properly terminated. 93.El 94.Sh INTERFACE STABILITY 95.Sy Uncommitted 96.Sh MT-LEVEL 97.Sy MT-Safe 98.Sh SEE ALSO 99.Xr libproc 3LIB , 100.Xr proc 4 101