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