xref: /illumos-gate/usr/src/man/man3proc/proc_fdinfowalk.3proc (revision e3ae4b35c024af1196582063ecee3ab79367227d)
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 November 27, 2023
15.Dt PROC_FDINFOWALK 3PROC
16.Os
17.Sh NAME
18.Nm proc_fdinfowalk
19.Nd walk the additional miscellaneous information in a prfdinfo_t structure
20.Sh LIBRARY
21.Lb libproc
22.Sh SYNOPSIS
23.In libproc.h
24.Ft int
25.Fo proc_fdinfowalk
26.Fa "const prfdinfo_t *info"
27.Fa "proc_fdinfowalk_f *func"
28.Fa "void *arg"
29.Fc
30.Sh DESCRIPTION
31The
32.Fn proc_fdinfowalk
33function walks a
34.Vt prfdinfo_t
35structure and calls the callback function
36.Fa func
37once for each miscellaneous item of information present,
38along with the user-specified
39.Fa arg .
40The definition of
41.Sy proc_fdinfowalk_f
42is available in
43.Xr libproc 3LIB .
44The miscellaneous data types and structures are found in the
45.Sx fdinfo
46section of
47.Xr proc 5 .
48.Pp
49.Fa func
50will be called once for each miscellaneous item, providing the item's
51.Fa type ,
52.Fa size
53and
54.Fa address.
55The
56.Fa size
57may include trailing padding bytes which will be set to zero.
58.Pp
59The return value of the caller's
60.Fa func
61function determines whether or not iteration will continue.
62If
63.Fa func
64returns a non-zero value, then iteration will terminate and that
65return value will be returned to the caller.
66To distinguish between system errors and caller errors, it is recommended that
67the function only return positive integers in the event of an error.
68.Sh RETURN VALUES
69Upon successful completion, the
70.Fn proc_fdinfowalk
71function returns
72.Sy 0 .
73Otherwise,
74.Sy -1
75is returned and
76.Sy errno
77is updated to reflect the error that occurred.
78.Sh ERRORS
79In addition to the errors listed below, the
80.Fn proc_fdinfowalk
81function may fail for the same reasons as the
82.Xr opendir 3C ,
83.Xr readdir 3C ,
84and
85.Xr malloc 3C
86functions.
87.Sh INTERFACE STABILITY
88.Sy Uncommitted
89.Sh MT-LEVEL
90.Sy MT-Safe
91.Sh SEE ALSO
92.Xr malloc 3C ,
93.Xr opendir 3C ,
94.Xr readdir 3C ,
95.Xr libproc 3LIB ,
96.Xr proc 5
97