summaryrefslogtreecommitdiff
path: root/usr/src/man/man3proc/Pfdinfo_iter.3proc
blob: cb03a77f482216bc94bca3d15e5d6de965a78385 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
.\"
.\" This file and its contents are supplied under the terms of the
.\" Common Development and Distribution License ("CDDL"), version 1.0.
.\" You may only use this file in accordance with the terms of version
.\" 1.0 of the CDDL.
.\"
.\" A full copy of the text of the CDDL should have accompanied this
.\" source.  A copy of the CDDL is also available via the Internet at
.\" http://www.illumos.org/license/CDDL.
.\"
.\"
.\" Copyright 2015 Joyent, Inc.
.\"
.Dd May 11, 2016
.Dt PFDINFO_ITER 3PROC
.Os
.Sh NAME
.Nm Pfdinfo_iter
.Nd iterate open files in a process
.Sh LIBRARY
.Lb libproc
.Sh SYNOPSIS
.In libproc.h
.Ft int
.Fo Pfdinfo_iter
.Fa "struct ps_prochandle *P"
.Fa "proc_fdinfo_f *func"
.Fa "void *data"
.Fc
.Sh DESCRIPTION
The
.Fn Pfdinfo_iter
function iterates over the open files in the process represented by
.Fa P .
.Pp
For each open file, the callback function
.Fa func
will be invoked and it will be passed the
.Fa data
argument as well as a pointer to a
.Sy prfdinfo_t
structure defined in
.Xr libproc 3LIB .
For the full signature of the
.Vt proc_fdinfo_f
see
.Xr libproc 3LIB .
.Pp
The return value of
.Fa func
controls whether or not iteration continues.
If
.Fa func
returns
.Sy 0 ,
then iteration will continue.
However, if
.Fa func
instead returns a non-zero value, then iteration will halt and that
value will be used as the return value of the
.Fn Pfdinfo_iter
function.
Because the
.Fn Pfdinfo_iter
function returns
.Sy -1
to an indicate its own errors, it is recommended that the callback
function does not return
.Sy -1
to indicate an error so that the caller may distinguish between the
failure of the callback function and the failure of the
.Fn Pfdinfo_iter
function.
.Sh RETURN VALUES
Upon successful completion, the
.Fn Pfdinfo_iter
returns
.Sy 0 .
Otherwise, if there was an internal error then
.Sy -1
is returned.
Otherwise, if the callback function
.Fa func
returns non-zero, then its return value will be returned instead.
.Sh INTERFACE STABILITY
.Sy Uncommitted
.Sh MT-LEVEL
See
.Sy LOCKING
in
.Xr libproc 3LIB .
.Sh SEE ALSO
.Xr libproc 3LIB