summaryrefslogtreecommitdiff
path: root/usr/src/man
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/man')
-rw-r--r--usr/src/man/man3lib/libproc.3lib127
-rw-r--r--usr/src/man/man3proc/Makefile9
-rw-r--r--usr/src/man/man3proc/proc_fdinfo_misc.3proc71
-rw-r--r--usr/src/man/man3proc/proc_fdinfowalk.3proc95
-rw-r--r--usr/src/man/man3proc/proc_fdwalk.3proc87
-rw-r--r--usr/src/man/man3proc/proc_get_fdinfo.3proc99
-rw-r--r--usr/src/man/man4/core.49
-rw-r--r--usr/src/man/man4/proc.4137
8 files changed, 609 insertions, 25 deletions
diff --git a/usr/src/man/man3lib/libproc.3lib b/usr/src/man/man3lib/libproc.3lib
index 94ddc8b558..3b38bda64f 100644
--- a/usr/src/man/man3lib/libproc.3lib
+++ b/usr/src/man/man3lib/libproc.3lib
@@ -11,7 +11,7 @@
.\"
.\" Copyright 2018 Joyent, Inc.
.\" Copyright (c) 2019 Carlos Neira <cneirabustos@gmail.com>
-.\" Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
+.\" Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
.\"
.Dd February 22, 2019
.Dt LIBPROC 3LIB
@@ -311,7 +311,8 @@ library.
.It Sy proc_dmodelname Ta Sy proc_finistdio
.It Sy proc_fltname Ta Sy proc_fltset2str
.It Sy proc_flushstdio Ta Sy proc_proc_get_auxv
-.It Sy proc_get_cred Ta Sy proc_get_priv
+.It Sy proc_fdinfo_misc Ta Sy proc_get_cred
+.It Sy proc_get_fdinfo Ta Sy proc_get_priv
.It Sy proc_get_psinfo Ta Sy proc_get_status
.It Sy proc_get_initstdio Ta Sy proc_lwp_in_set
.It Sy proc_lwp_range_valid Ta Sy proc_signame
@@ -562,25 +563,39 @@ This indicates that the contents are invalid.
The
.Vt prfdinfo_t
structure is used with the
-.Fn Pfdinfo_iter
-function which describes information about a file descriptor.
+.Fn Pfdinfo_iter ,
+.Fn proc_fdwalk ,
+.Fn proc_fdinfowalk
+and
+.Fn proc_get_fdinfo
+functions and describes information about a file descriptor.
The structure is defined as follows:
.Bd -literal
typedef struct prfdinfo {
- int pr_fd;
- mode_t pr_mode;
- uid_t pr_uid;
- gid_t pr_gid;
- major_t pr_major; /* think stat.st_dev */
- minor_t pr_minor;
- major_t pr_rmajor; /* think stat.st_rdev */
- minor_t pr_rminor;
- ino64_t pr_ino;
- off64_t pr_offset;
- off64_t pr_size;
- int pr_fileflags; /* fcntl(F_GETXFL), etc */
- int pr_fdflags; /* fcntl(F_GETFD), etc. */
- char pr_path[MAXPATHLEN];
+ int pr_fd; /* file descriptor number */
+ mode_t pr_mode; /* (see st_mode in stat(2)) */
+ ino64_t pr_ino; /* inode number */
+ off64_t pr_size; /* file size */
+ off64_t pr_offset; /* current offset */
+ uid_t pr_uid; /* owner's user id */
+ gid_t pr_gid; /* owner's group id */
+ major_t pr_major; /* major number of device */
+ minor_t pr_minor; /* minor number of device */
+ major_t pr_rmajor; /* major number (if special file) */
+ minor_t pr_rminor; /* minor number (if special file) */
+ int pr_fileflags; /* (see F_GETXFL in fcntl(2)) */
+ int pr_fdflags; /* (see F_GETFD in fcntl(2)) */
+ short pr_locktype; /* (see F_GETLK in fcntl(2)) */
+ pid_t pr_lockpid; /* process holding file lock */
+ int pr_locksysid; /* sysid of locking process */
+ pid_t pr_peerpid; /* peer process (socket, door) */
+ int pr_filler[25]; /* reserved for future use */
+ char pr_peername[PRFNSZ]; /* peer process name */
+#if __STDC_VERSION__ >= 199901L
+ uint8_t pr_misc[]; /* self describing structures */
+else
+ uint8_t pr_misc[1]; /* self describing structures */
+#endif
} prfdinfo_t;
.Ed
.Pp
@@ -650,6 +665,31 @@ and
.Dv F_GETFD
respectively.
.Pp
+The
+.Fa pr_locktype ,
+.Fa pr_lockpid ,
+and
+.Fa pr_locksysid
+contain the information that would have been returned by a call to
+.Xr fcntl 2
+with an argument of
+.Dv F_GETLK .
+.Pp
+The
+.Fa pr_peerpid
+and
+.Fa pr_peername
+members contain the process ID and name of any peer endpoint of a
+connection-oriented socket or stream fd.
+This information is the same as that which would be returned by a call to
+.Xr getpeerucred 3C
+.Pp
+The
+.Fa pr_misc
+member contains miscellaneous additional data relating to the file descriptor.
+The format of these data is described in
+.Xr proc 4 .
+.Pp
.Vt prsyminfo_t
.Pp
The
@@ -747,6 +787,54 @@ Both structures are defined in
For additional information on using this type, see
.Xr Plwp_iter_all 3PROC .
.Pp
+.Vt proc_fdinfowalk_f
+.Pp
+The
+.Vt proc_fdinfowalk_f
+is a function pointer type that is used with the
+.Fn proc_fdinfowalk
+function to walk the miscellaneous data items contained within a
+.Vt prfdinfo_t
+structure.
+It is defined as
+.Sy typedef
+.Ft int
+.Fo proc_fdinfowalk_f
+.Fa "uint_t"
+.Fa "const void *"
+.Fa "size_t"
+.Fa "void *"
+.Fc .
+The first argument contains the type of the miscellaneous information being
+presented, the second and third provide a pointer to the associated data and
+the length of that data.
+The final argument is a pointer to an argument that the user specifies.
+For more information on using this, see
+.Xr proc_fdinfowalk 3PROC .
+.Pp
+.Vt proc_fdwalk_f
+.Pp
+The
+.Vt proc_fdwalk_f
+is a function pointer type that is used with the
+.Fn proc_fdwalk
+function.
+It is defined as
+.Sy typedef
+.Ft int
+.Fo proc_fdwalk_f
+.Fa "const prfdinfo_t *"
+.Fa "void *"
+.Fc .
+The first argument contains the file descriptor information.
+The
+.Sy prfdinfo_t
+structure is defined in
+.Xr proc 4 .
+The final argument is a pointer to an argument that the user specifies.
+For more information on using this, see
+.Xr proc_fdwalk 3PROC .
+.Pp
.Vt proc_walk_f
.Pp
The
@@ -1227,6 +1315,7 @@ changes may occur which break both source and binary compatibility.
.Xr proc_flushstdio 3PROC ,
.Xr proc_get_auxv 3PROC ,
.Xr proc_get_cred 3PROC ,
+.Xr proc_get_fdinfo 3PROC ,
.Xr proc_get_priv 3PROC ,
.Xr proc_get_psinfo 3PROC ,
.Xr proc_get_status 3PROC ,
@@ -1245,6 +1334,8 @@ changes may occur which break both source and binary compatibility.
.Xr proc_sysname 3PROC ,
.Xr proc_sysset2str 3PROC ,
.Xr proc_unctrl_psinfo 3PROC ,
+.Xr proc_fdinfowalk 3PROC ,
+.Xr proc_fdwalk 3PROC ,
.Xr proc_walk 3PROC
.Pp
.Xr Pldt 3PROC ,
diff --git a/usr/src/man/man3proc/Makefile b/usr/src/man/man3proc/Makefile
index 00403a19fa..1986a27ead 100644
--- a/usr/src/man/man3proc/Makefile
+++ b/usr/src/man/man3proc/Makefile
@@ -14,7 +14,7 @@
# Copyright 2013 Nexenta Systems, Inc. All rights reserved.
# Copyright 2018 Joyent, Inc.
# Copyright 2019, Carlos Neira <cneirabustos@gmail.com>
-# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
+# Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
include $(SRC)/Makefile.master
@@ -123,10 +123,14 @@ MANFILES= \
proc_arg_grab.3proc \
proc_arg_psinfo.3proc \
proc_content2str.3proc \
+ proc_fdinfo_misc.3proc \
+ proc_fdinfowalk.3proc \
+ proc_fdwalk.3proc \
proc_fltname.3proc \
proc_fltset2str.3proc \
proc_get_auxv.3proc \
proc_get_cred.3proc \
+ proc_get_fdinfo.3proc \
proc_get_priv.3proc \
proc_get_psinfo.3proc \
proc_get_status.3proc \
@@ -222,6 +226,7 @@ MANLINKS= \
proc_arg_xgrab.3proc \
proc_arg_xpsinfo.3proc \
proc_dmodelname.3proc \
+ proc_fdinfo_free.3proc \
proc_finistdio.3proc \
proc_flushstdio.3proc \
proc_free_priv.3proc \
@@ -394,6 +399,8 @@ proc_arg_xpsinfo.3proc := LINKSRC = proc_arg_psinfo.3proc
proc_str2content.3proc := LINKSRC = proc_content2str.3proc
+proc_fdinfo_free.3proc := LINKSRC = proc_get_fdinfo.3proc
+
proc_flushstdio.3proc := LINKSRC = proc_initstdio.3proc
proc_finistdio.3proc := LINKSRC = proc_initstdio.3proc
diff --git a/usr/src/man/man3proc/proc_fdinfo_misc.3proc b/usr/src/man/man3proc/proc_fdinfo_misc.3proc
new file mode 100644
index 0000000000..c7cdd4e338
--- /dev/null
+++ b/usr/src/man/man3proc/proc_fdinfo_misc.3proc
@@ -0,0 +1,71 @@
+.\"
+.\" 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_FDINFO_MISC 3PROC
+.Os
+.Sh NAME
+.Nm proc_fdinfo_misc
+.Nd retrieve a miscellaneous information item from a prfdinfo_t structure
+.Sh SYNOPSIS
+.Lb libproc
+.In libproc.h
+.Ft const void *
+.Fo proc_fdinfo_misc
+.Fa "const prfdinfo_t *info"
+.Fa "uint_t type"
+.Fa "size_t *len"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn proc_fdinfo_misc
+function is a convenient way to retrieve a miscellaneous information item from
+a
+.Vt prfdinfo_t
+structure.
+.Pp
+If a miscellaneous item of type
+.Fa type
+is found, then this function returns a pointer to the data for that item and
+updates
+.Fa len
+with the item's size.
+.Pp
+In the case that there are multiple instances of the requested type in the
+structure, only the first is returned.
+To see all instances, use the
+.Xr proc_fdinfowalk 3PROC
+function.
+.Pp
+The definition of the
+.Vt prfdinfo_t
+structure may be found in the
+.Sx fdinfo
+section of
+.Xr proc 4 .
+.Sh RETURN VALUES
+Upon successful completion, the
+.Fn proc_fdinfo_misc
+function returns a pointer to the first instance of data with the requested
+type.
+Otherwise,
+.Sy NULL
+is returned to indicate that the item was not found.
+.Sh INTERFACE STABILITY
+.Sy Uncommitted
+.Sh MT-LEVEL
+.Sy MT-Safe
+.Sh SEE ALSO
+.Xr libproc 3LIB ,
+.Xr proc_fdinfowalk 3PROC ,
+.Xr proc 4
diff --git a/usr/src/man/man3proc/proc_fdinfowalk.3proc b/usr/src/man/man3proc/proc_fdinfowalk.3proc
new file mode 100644
index 0000000000..1a35e9d209
--- /dev/null
+++ b/usr/src/man/man3proc/proc_fdinfowalk.3proc
@@ -0,0 +1,95 @@
+.\"
+.\" 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 4 .
+.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 4
diff --git a/usr/src/man/man3proc/proc_fdwalk.3proc b/usr/src/man/man3proc/proc_fdwalk.3proc
new file mode 100644
index 0000000000..52bf29ed60
--- /dev/null
+++ b/usr/src/man/man3proc/proc_fdwalk.3proc
@@ -0,0 +1,87 @@
+.\"
+.\" 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_FDWALK 3PROC
+.Os
+.Sh NAME
+.Nm proc_fdwalk
+.Nd walk the open file descriptors for a process
+.Sh SYNOPSIS
+.Lb libproc
+.In libproc.h
+.Ft int
+.Fo proc_fdwalk
+.Fa "pid_t pid"
+.Fa "proc_fdwalk_f *func"
+.Fa "void *arg"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn proc_fdwalk
+function walks all file descriptors currently open in the process with ID
+.Fa pid
+and calls the callback function
+.Fa func
+once for each file descriptor with the user-specified
+.Fa arg .
+The definition of
+.Vt proc_fdwalk_f
+is available in
+.Xr libproc 3LIB .
+.Pp
+.Fa func
+will be called once for each file descriptor and will have its first
+argument filled in with the contents of the corresponding
+.Pa /proc
+.Sy fdinfo
+file for the file descriptor.
+.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_fdwalk
+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_fdwalk
+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 4
diff --git a/usr/src/man/man3proc/proc_get_fdinfo.3proc b/usr/src/man/man3proc/proc_get_fdinfo.3proc
new file mode 100644
index 0000000000..b85eef16f9
--- /dev/null
+++ b/usr/src/man/man3proc/proc_get_fdinfo.3proc
@@ -0,0 +1,99 @@
+.\"
+.\" 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_GET_FDINFO 3PROC
+.Os
+.Sh NAME
+.Nm proc_get_fdinfo ,
+.Nm proc_fdinfo_free
+.Nd get process file descriptor information
+.Sh LIBRARY
+.Lb libproc
+.Sh SYNOPSIS
+.In libproc.h
+.Ft prfdinfo_t *
+.Fo proc_get_fdinfo
+.Fa "pid_t pid"
+.Fa "int fd"
+.Fc
+.Ft "void"
+.Fo proc_fdinfo_free
+.Fa "prfdinfo_t *info"
+.Fc
+.Sh DESCRIPTION
+The
+.Fn proc_get_fdinfo
+function is a convenient way to read the
+.Pa /proc/pid/fdinfo/fd
+file for the process
+.Fa pid
+and file descriptor
+.Fa fd .
+On success, the return value of the function is a pointer to a properly
+terminated
+.Sy prfdinfo_t
+structure.
+.Pp
+The definition of the
+.Vt prfdinfo_t
+structure may be found in
+.Xr proc 4 .
+.Pp
+The caller must free the returned memory by calling the
+.Fn proc_fdinfo_free
+function.
+.Pp
+The
+.Fn proc_fdinfo_free
+frees all memory associated with the
+.Vt prfdinfo_t
+structure passed as
+.Fa info .
+.Sh RETURN VALUES
+Upon successful completion, the
+.Fn proc_get_fdinfo
+function returns a pointer to an allocated
+.Vt prfdinfo_t
+structure.
+Otherwise,
+.Dv NULL
+is returned to indicate an error occurred and
+.Vt errno
+is set to indicate the error.
+.Sh ERRORS
+In addition to the errors listed below, the
+.Fn proc_get_fdinfo
+function may fail for the same reasons as the
+.Xr fstat 2 ,
+.Xr malloc 3C ,
+.Xr open 2 ,
+and
+.Xr read 2
+functions.
+The
+.Fn proc_get_fdinfo
+function will fail if:
+.Bl -tag -width Er
+.It Er EIO
+The data read from the file under
+.Pa /proc
+is not properly terminated.
+.El
+.Sh INTERFACE STABILITY
+.Sy Uncommitted
+.Sh MT-LEVEL
+.Sy MT-Safe
+.Sh SEE ALSO
+.Xr libproc 3LIB ,
+.Xr proc 4
diff --git a/usr/src/man/man4/core.4 b/usr/src/man/man4/core.4
index 9c06bcc42e..a718f93159 100644
--- a/usr/src/man/man4/core.4
+++ b/usr/src/man/man4/core.4
@@ -2,15 +2,15 @@
.\" Copyright (C) 2008, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 2012 DEY Storage Systems, Inc. All rights reserved.
.\" Copyright (c) 2013, Joyent, Inc. All rights reserved.
+.\" Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
.\" Copyright 1989 AT&T
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH CORE 4 "Jun 6, 2016"
+.TH CORE 4 "Jan 6, 2020"
.SH NAME
core \- process core file
.SH DESCRIPTION
-.LP
The operating system writes out a core file for a process when the process is
terminated due to receiving certain signals. A core file is a disk copy of the
contents of the process address space at the time the process received the
@@ -335,12 +335,12 @@ with the numerical ID returned by \fBgetzoneid\fR(3C).
.sp
.ne 2
.na
-\fB\fBprfdinfo_t\fR\fR
+\fB\fBprfdinfo_core_t\fR\fR
.ad
.RS 20n
\fBn_type\fR: \fBNT_FDINFO\fR. This structure contains information about
any open file descriptors, including the path, flags, and
-\fBstat\fR(2) information. The \fBprfdinfo_t\fR structure is defined in
+\fBstat\fR(2) information. The \fBprfdinfo_core_t\fR structure is defined in
<\fBsys/procfs.h\fR>.
.RE
@@ -472,7 +472,6 @@ with the corresponding load object.
The size of the core file created by a process can be controlled by the user
(see \fBgetrlimit\fR(2)).
.SH SEE ALSO
-.LP
\fBelfdump\fR(1), \fBgcore\fR(1), \fBmdb\fR(1), \fBproc\fR(1), \fBps\fR(1),
\fBcoreadm\fR(1M), \fBgetrlimit\fR(2), \fBsetrlimit\fR(2), \fBsetuid\fR(2),
\fBsysinfo\fR(2), \fBuname\fR(2), \fBgetzonenamebyid\fR(3C),
diff --git a/usr/src/man/man4/proc.4 b/usr/src/man/man4/proc.4
index 81b3e76c67..b53db24537 100644
--- a/usr/src/man/man4/proc.4
+++ b/usr/src/man/man4/proc.4
@@ -1,6 +1,7 @@
.\" Copyright 1989 AT&T
.\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 2019, Joyent, Inc.
+.\" Copyright 2020 OmniOS Community Edition (OmniOSce) Association.
.\"
.\" The contents of this file are subject to the terms of the
.\" Common Development and Distribution License (the "License").
@@ -17,7 +18,7 @@
.\" fields enclosed by brackets "[]" replaced with your own identifying
.\" information: Portions Copyright [yyyy] [name of copyright owner]
.\"
-.Dd January 11, 2019
+.Dd January 6, 2020
.Dt PROC 4
.Os
.Sh NAME
@@ -1382,6 +1383,140 @@ as
.Pa /proc/ Ns Em pid Ns Pa /cwd .
An attempt to open any other type of entry fails with
.Er EACCES .
+.Ss fdinfo
+A directory containing information about each of the process's open files.
+Each entry is a decimal number corresponding to an open file descriptor in the
+process.
+Each file contains a
+.Sy prfdinfo_t
+structure defined as follows:
+.Bd -literal -offset 2
+typedef struct prfdinfo {
+ int pr_fd; /* file descriptor number */
+ mode_t pr_mode; /* (see st_mode in stat(2)) */
+ uint64_t pr_ino; /* inode number */
+ uint64_t pr_size; /* file size */
+ int64_t pr_offset; /* current offset of file descriptor */
+ uid_t pr_uid; /* owner's user id */
+ gid_t pr_gid; /* owner's group id */
+ major_t pr_major; /* major number of device containing file */
+ minor_t pr_minor; /* minor number of device containing file */
+ major_t pr_rmajor; /* major number (if special file) */
+ minor_t pr_rminor; /* minor number (if special file) */
+ int pr_fileflags; /* (see F_GETXFL in fcntl(2)) */
+ int pr_fdflags; /* (see F_GETFD in fcntl(2)) */
+ short pr_locktype; /* (see F_GETLK in fcntl(2)) */
+ pid_t pr_lockpid; /* process holding file lock (see F_GETLK) */
+ int pr_locksysid; /* sysid of locking process (see F_GETLK) */
+ pid_t pr_peerpid; /* peer process (socket, door) */
+ int pr_filler[25]; /* reserved for future use */
+ char pr_peername[PRFNSZ]; /* peer process name */
+#if __STDC_VERSION__ >= 199901L
+ char pr_misc[]; /* self describing structures */
+#else
+ char pr_misc[1];
+#endif
+} prfdinfo_t;
+.Ed
+.Pp
+The
+.Sy pr_misc
+element points to a list of additional miscellaneous data items, each of which
+has a header of type
+.Sy pr_misc_header_t
+specifying the size and type, and some data which immediately follow
+the header.
+.Bd -literal -offset 2
+typedef struct pr_misc_header {
+ uint_t pr_misc_size;
+ uint_t pr_misc_type;
+} pr_misc_header_t;
+.Ed
+.Pp
+The
+.Sy pr_misc_size
+field is the sum of the sizes of the header and the associated data and any
+trailing padding bytes which will be set to zero.
+The end of the list is indicated by a header with a zero size and a type with
+all bits set.
+.Pp
+The following miscellaneous data types can be present:
+.Bl -tag -width "PR_SOCKOPT_TCP_CONGESTION" -offset left
+.It Sy PR_PATHNAME
+The file descriptor's path in the filesystem.
+This is a NUL-terminated sequence of characters.
+.It Sy PR_SOCKETNAME
+A
+.Sy sockaddr
+structure representing the local socket name for this file descriptor, as
+would be returned by calling
+.Fn getsockname
+within the process.
+.It Sy PR_PEERSOCKNAME
+A
+.Sy sockaddr
+structure representing the peer socket name for this file descriptor, as
+would be returned by calling
+.Fn getpeername
+within the process.
+.It Sy PR_SOCKOPTS_BOOL_OPTS
+An unsigned integer which has bits set corresponding to options which are
+set on the underlying socket.
+The following bits may be set:
+.Bl -tag -width "PR_SO_PASSIVE_CONNECT"
+.It Sy PR_SO_DEBUG
+.It Sy PR_SO_REUSEADDR
+.It Sy PR_SO_REUSEPORT
+.It Sy PR_SO_KEEPALIVE
+.It Sy PR_SO_DONTROUTE
+.It Sy PR_SO_BROADCAST
+.It Sy PR_SO_OOBINLINE
+.It Sy PR_SO_DGRAM_ERRIND
+.It Sy PR_SO_ALLZONES
+.It Sy PR_SO_MAC_EXEMPT
+.It Sy PR_SO_EXCLBIND
+.It Sy PR_SO_PASSIVE_CONNECT
+.It Sy PR_SO_ACCEPTCONN
+.It Sy PR_UDP_NAT_T_ENDPOINT
+.It Sy PR_SO_VRRP
+.It Sy PR_SO_MAC_IMPLICIT
+.El
+.It Sy PR_SOCKOPT_LINGER
+A
+.Sy struct linger
+as would be returned by calling
+.Fn getsockopt SO_LINGER
+within the process.
+.It Sy PR_SOCKOPT_SNDBUF
+The data that would be returned by calling
+.Fn getsockopt SO_SNDBUF
+within the process.
+.It Sy PR_SOCKOPT_RCVBUF
+The data that would be returned by calling
+.Fn getsockopt SO_RCVBUF
+within the process.
+.It Sy PR_SOCKOPT_IP_NEXTHOP
+The data that would be returned by calling
+.Fn getsockopt IPPROTO_IP IP_NEXTHOP
+within the process.
+.It Sy PR_SOCKOPT_IPV6_NEXTHOP
+The data that would be returned by calling
+.Fn getsockopt IPPROTO_IPV6 IPV6_NEXTHOP
+within the process.
+.It Sy PR_SOCKOPT_TYPE
+The data that would be returned by calling
+.Fn getsockopt SO_TYPE
+within the process.
+.It Sy PR_SOCKOPT_TCP_CONGESTION
+For TCP sockets, the data that would be returned by calling
+.Fn getsockopt IPPROTO_TCP TCP_CONGESTION
+within the process.
+This is a NUL-terminated character array containing the name of the congestion
+algorithm in use for the socket.
+.It Sy PR_SOCKFILTERS_PRIV
+Private data relating to up to the first 32 socket filters pushed on this
+descriptor.
+.El
.Ss object
A directory containing read-only files with names corresponding to the
.Sy pr_mapname