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

Split Close
Expand all
Collapse all
          --- old/usr/src/man/man4/proc.4.man.txt
          +++ new/usr/src/man/man4/proc.4.man.txt
↓ open down ↓ 858 lines elided ↑ open up ↑
 859  859       process.
 860  860  
 861  861       If an entry refers to a regular file, it can be opened with normal file
 862  862       system semantics but, to ensure that the controlling process cannot gain
 863  863       greater access than the controlled process, with no file access modes
 864  864       other than its read/write open modes in the controlled process.  If an
 865  865       entry refers to a directory, it can be accessed with the same semantics
 866  866       as /proc/pid/cwd.  An attempt to open any other type of entry fails with
 867  867       EACCES.
 868  868  
      869 +   fdinfo
      870 +     A directory containing information about each of the process's open
      871 +     files.  Each entry is a decimal number corresponding to an open file
      872 +     descriptor in the process.  Each file contains a prfdinfov2_t structure
      873 +     as follows:
      874 +
      875 +      typedef struct prfdinfov2 {
      876 +          int     pr_fd;          /* file descriptor number */
      877 +          mode_t  pr_mode;        /* (see st_mode in stat(2)) */
      878 +          uint64_t pr_ino;        /* inode number */
      879 +          uint64_t pr_size;       /* file size */
      880 +          int64_t pr_offset;      /* current offset of file descriptor */
      881 +          uid_t   pr_uid;         /* owner's user id */
      882 +          gid_t   pr_gid;         /* owner's group id */
      883 +          major_t pr_major;       /* major number of device containing file */
      884 +          minor_t pr_minor;       /* minor number of device containing file */
      885 +          major_t pr_rmajor;      /* major number (if special file) */
      886 +          minor_t pr_rminor;      /* minor number (if special file) */
      887 +          int     pr_fileflags;   /* (see F_GETXFL in fcntl(2)) */
      888 +          int     pr_fdflags;     /* (see F_GETFD in fcntl(2)) */
      889 +          short   pr_locktype;    /* (see F_GETLK in fcntl(2)) */
      890 +          pid_t   pr_lockpid;     /* process holding file lock (see F_GETLK) */
      891 +          int     pr_locksysid;   /* sysid of locking process (see F_GETLK) */
      892 +          pid_t   pr_peerpid;     /* peer process (socket, door) */
      893 +          int     pr_filler[25];  /* reserved for future use */
      894 +          char    pr_peername[PRFNSZ]; /* peer process name */
      895 +      #if __STDC_VERSION__ >= 199901L
      896 +          char    pr_misc[];      /* self describing structures */
      897 +      #else
      898 +          char    pr_misc[1];
      899 +      #endif
      900 +      } prfdinfov2_t;
      901 +
      902 +     The pr_misc element points to a list of additional miscellaneous data
      903 +     items, each of which has a header of type pr_misc_header_t specifying the
      904 +     size and type, and some data which immediately follow the header.
      905 +
      906 +      typedef struct pr_misc_header {
      907 +          uint_t          pr_misc_size;
      908 +          uint_t          pr_misc_type;
      909 +      } pr_misc_header_t;
      910 +
      911 +     The pr_misc_size field is the sum of the sizes of the header and the
      912 +     associated data.  The end of the list is indicated by a header with a
      913 +     zero size.
      914 +
      915 +     The following miscellaneous data types can be present:
      916 +
      917 +         PR_PATHNAME                The file descriptor's path in the
      918 +                                    filesystem.  This is a sequence of
      919 +                                    characters of the length indicated by
      920 +                                    pr_misc_size and it not guaranteed to be
      921 +                                    null-terminated.
      922 +
      923 +         PR_SOCKETNAME              A sockaddr structure representing the
      924 +                                    local socket name for this file
      925 +                                    descriptor, as would be returned by
      926 +                                    calling getsockname() within the process.
      927 +
      928 +         PR_PEERSOCKNAME            A sockaddr structure representing the peer
      929 +                                    socket name for this file desciptor, as
      930 +                                    would be returned by calling getpeername()
      931 +                                    within the process.
      932 +
      933 +         PR_SOCKOPTS_BOOL_OPTS      An unsigned integer which has bits set
      934 +                                    corresponding to options which are set on
      935 +                                    the underlying socket.  The following bits
      936 +                                    may be set:
      937 +
      938 +                                    PR_SO_DEBUG
      939 +
      940 +                                    PR_SO_REUSEADDR
      941 +
      942 +                                    PR_SO_REUSEPORT
      943 +
      944 +                                    PR_SO_KEEPALIVE
      945 +
      946 +                                    PR_SO_DONTROUTE
      947 +
      948 +                                    PR_SO_BROADCAST
      949 +
      950 +                                    PR_SO_OOBINLINE
      951 +
      952 +                                    PR_SO_DGRAM_ERRIND
      953 +
      954 +                                    PR_SO_ALLZONES
      955 +
      956 +                                    PR_SO_MAC_EXEMPT
      957 +
      958 +                                    PR_SO_EXCLBIND
      959 +
      960 +                                    PR_SO_PASSIVE_CONNECT
      961 +
      962 +                                    PR_SO_ACCEPTCONN
      963 +
      964 +                                    PR_UDP_NAT_T_ENDPOINT
      965 +
      966 +                                    PR_SO_VRRP
      967 +
      968 +                                    PR_SO_MAC_IMPLICIT
      969 +
      970 +         PR_SOCKOPT_LINGER          A struct linger as would be returned by
      971 +                                    calling getsockopt(SO_LINGER) within the
      972 +                                    process.
      973 +
      974 +         PR_SOCKOPT_SNDBUF          The data that would be returned by calling
      975 +                                    getsockopt(SO_SNDBUF) within the process.
      976 +
      977 +         PR_SOCKOPT_RCVBUF          The data that would be returned by calling
      978 +                                    getsockopt(SO_RCVBUF) within the process.
      979 +
      980 +         PR_SOCKOPT_IP_NEXTHOP      The data that would be returned by calling
      981 +                                    getsockopt(IPPROTO_IP, IP_NEXTHOP) within
      982 +                                    the process.
      983 +
      984 +         PR_SOCKOPT_IPV6_NEXTHOP    The data that would be returned by calling
      985 +                                    getsockopt(IPPROTO_IPV6, IPV6_NEXTHOP)
      986 +                                    within the process.
      987 +
      988 +         PR_SOCKOPT_TYPE            The data that would be returned by calling
      989 +                                    getsockopt(SO_TYPE) within the process.
      990 +
      991 +         PR_SOCKOPT_TCP_CONGESTION  For TCP sockets, the data that would be
      992 +                                    returned by calling
      993 +                                    getsockopt(IPPROTO_TCP, TCP_CONGESTION)
      994 +                                    within the process.  This is a character
      995 +                                    array containing the name of the
      996 +                                    congestion algorithm in use for the
      997 +                                    socket.
      998 +
      999 +         PR_SOCKFILTERS_PRIV        Private data relating to any socket
     1000 +                                    filters pushed on this descriptor.
     1001 +
 869 1002     object
 870 1003       A directory containing read-only files with names corresponding to the
 871 1004       pr_mapname entries in the map and pagedata files.  Opening such a file
 872 1005       yields a file descriptor for the underlying mapped file associated with
 873 1006       an address-space mapping in the process.  The file name a.out appears in
 874 1007       the directory as an alias for the process's executable file.
 875 1008  
 876 1009       The object directory makes it possible for a controlling process to gain
 877 1010       access to the object file and any shared libraries (and consequently the
 878 1011       symbol tables) without having to know the actual path names of the
↓ open down ↓ 1010 lines elided ↑ open up ↑
1889 2022       searchable.  Thus, anyone can open /proc/pid/psinfo even though ls(1)
1890 2023       applied to /proc/pid will fail for anyone but the owner or an
1891 2024       appropriately privileged process.  Support for the old ioctl(2)-based
1892 2025       version of /proc will be dropped in a future release, at which time the
1893 2026       top-level directory for a process will be made world-readable.
1894 2027  
1895 2028       On SPARC based machines, the types gregset_t and fpregset_t defined in
1896 2029       <sys/regset.h> are similar to but not the same as the types prgregset_t
1897 2030       and prfpregset_t defined in <procfs.h>.
1898 2031  
1899      -illumos                        January 11, 2019                        illumos
     2032 +illumos                        December 3, 2019                        illumos
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX