Print this page
12046 Provide /proc/<PID>/fdinfo/

@@ -864,10 +864,143 @@
      other than its read/write open modes in the controlled process.  If an
      entry refers to a directory, it can be accessed with the same semantics
      as /proc/pid/cwd.  An attempt to open any other type of entry fails with
      EACCES.
 
+   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 prfdinfov2_t structure
+     as follows:
+
+      typedef struct prfdinfov2 {
+          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
+      } prfdinfov2_t;
+
+     The pr_misc element points to a list of additional miscellaneous data
+     items, each of which has a header of type pr_misc_header_t specifying the
+     size and type, and some data which immediately follow the header.
+
+      typedef struct pr_misc_header {
+          uint_t          pr_misc_size;
+          uint_t          pr_misc_type;
+      } pr_misc_header_t;
+
+     The pr_misc_size field is the sum of the sizes of the header and the
+     associated data.  The end of the list is indicated by a header with a
+     zero size.
+
+     The following miscellaneous data types can be present:
+
+         PR_PATHNAME                The file descriptor's path in the
+                                    filesystem.  This is a sequence of
+                                    characters of the length indicated by
+                                    pr_misc_size and it not guaranteed to be
+                                    null-terminated.
+
+         PR_SOCKETNAME              A sockaddr structure representing the
+                                    local socket name for this file
+                                    descriptor, as would be returned by
+                                    calling getsockname() within the process.
+
+         PR_PEERSOCKNAME            A sockaddr structure representing the peer
+                                    socket name for this file desciptor, as
+                                    would be returned by calling getpeername()
+                                    within the process.
+
+         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:
+
+                                    PR_SO_DEBUG
+
+                                    PR_SO_REUSEADDR
+
+                                    PR_SO_REUSEPORT
+
+                                    PR_SO_KEEPALIVE
+
+                                    PR_SO_DONTROUTE
+
+                                    PR_SO_BROADCAST
+
+                                    PR_SO_OOBINLINE
+
+                                    PR_SO_DGRAM_ERRIND
+
+                                    PR_SO_ALLZONES
+
+                                    PR_SO_MAC_EXEMPT
+
+                                    PR_SO_EXCLBIND
+
+                                    PR_SO_PASSIVE_CONNECT
+
+                                    PR_SO_ACCEPTCONN
+
+                                    PR_UDP_NAT_T_ENDPOINT
+
+                                    PR_SO_VRRP
+
+                                    PR_SO_MAC_IMPLICIT
+
+         PR_SOCKOPT_LINGER          A struct linger as would be returned by
+                                    calling getsockopt(SO_LINGER) within the
+                                    process.
+
+         PR_SOCKOPT_SNDBUF          The data that would be returned by calling
+                                    getsockopt(SO_SNDBUF) within the process.
+
+         PR_SOCKOPT_RCVBUF          The data that would be returned by calling
+                                    getsockopt(SO_RCVBUF) within the process.
+
+         PR_SOCKOPT_IP_NEXTHOP      The data that would be returned by calling
+                                    getsockopt(IPPROTO_IP, IP_NEXTHOP) within
+                                    the process.
+
+         PR_SOCKOPT_IPV6_NEXTHOP    The data that would be returned by calling
+                                    getsockopt(IPPROTO_IPV6, IPV6_NEXTHOP)
+                                    within the process.
+
+         PR_SOCKOPT_TYPE            The data that would be returned by calling
+                                    getsockopt(SO_TYPE) within the process.
+
+         PR_SOCKOPT_TCP_CONGESTION  For TCP sockets, the data that would be
+                                    returned by calling
+                                    getsockopt(IPPROTO_TCP, TCP_CONGESTION)
+                                    within the process.  This is a character
+                                    array containing the name of the
+                                    congestion algorithm in use for the
+                                    socket.
+
+         PR_SOCKFILTERS_PRIV        Private data relating to any socket
+                                    filters pushed on this descriptor.
+
    object
      A directory containing read-only files with names corresponding to the
      pr_mapname entries in the map and pagedata files.  Opening such a file
      yields a file descriptor for the underlying mapped file associated with
      an address-space mapping in the process.  The file name a.out appears in

@@ -1894,6 +2027,6 @@
 
      On SPARC based machines, the types gregset_t and fpregset_t defined in
      <sys/regset.h> are similar to but not the same as the types prgregset_t
      and prfpregset_t defined in <procfs.h>.
 
-illumos                        January 11, 2019                        illumos
+illumos                        December 3, 2019                        illumos