.\"
.\" 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 2020 OmniOS Community Edition (OmniOSce) Association.
.\"
.Dd January 6, 2020
.Dt PROC_FDINFOWALK 3PROC
.Os
.Sh NAME
.Nm proc_fdinfowalk
.Nd walk the additional miscellaneous information in a prfdinfo_t structure
.Sh SYNOPSIS
.Lb libproc
.In libproc.h
.Ft int
.Fo proc_fdinfowalk
.Fa "const prfdinfo_t *info"
.Fa "proc_fdinfowalk_f *func"
.Fa "void *arg"
.Fc
.Sh DESCRIPTION
The
.Fn proc_fdinfowalk
function walks a
.Vt prfdinfo_t
structure and calls the callback function
.Fa func
once for each miscellaneous item of information present,
along with the user-specified
.Fa arg .
The definition of
.Sy proc_fdinfowalk_f
is available in
.Xr libproc 3LIB .
The miscellaneous data types and structures are found in the
.Sx fdinfo
section of
.Xr proc 5 .
.Pp
.Fa func
will be called once for each miscellaneous item, providing the item's
.Fa type ,
.Fa size
and
.Fa address.
The
.Fa size
may include trailing padding bytes which will be set to zero.
.Pp
The return value of the caller's
.Fa func
function determines whether or not iteration will continue.
If
.Fa func
returns a non-zero value, then iteration will terminate and that
return value will be returned to the caller.
To distinguish between system errors and caller errors, it is recommended that
the function only return positive integers in the event of an error.
.Sh RETURN VALUES
Upon successful completion, the
.Fn proc_fdinfowalk
function returns
.Sy 0 .
Otherwise,
.Sy -1
is returned and
.Sy errno
is updated to reflect the error that occurred.
.Sh ERRORS
In addition to the errors listed below, the
.Fn proc_fdinfowalk
function may fail for the same reasons as the
.Xr opendir 3C ,
.Xr readdir 3C ,
and
.Xr malloc 3C
functions.
.Sh INTERFACE STABILITY
.Sy Uncommitted
.Sh MT-LEVEL
.Sy MT-Safe
.Sh SEE ALSO
.Xr malloc 3C ,
.Xr opendir 3C ,
.Xr readdir 3C ,
.Xr libproc 3LIB ,
.Xr proc 5