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


 849 
 850    root
 851      A symbolic link to the process's root directory.  /proc/pid/root can
 852      differ from the system root directory if the process or one of its
 853      ancestors executed chroot(2) as super user.  It has the same semantics as
 854      /proc/pid/cwd.
 855 
 856    fd
 857      A directory containing references to the open files of the process.  Each
 858      entry is a decimal number corresponding to an open file descriptor in the
 859      process.
 860 
 861      If an entry refers to a regular file, it can be opened with normal file
 862      system semantics but, to ensure that the controlling process cannot gain
 863      greater access than the controlled process, with no file access modes
 864      other than its read/write open modes in the controlled process.  If an
 865      entry refers to a directory, it can be accessed with the same semantics
 866      as /proc/pid/cwd.  An attempt to open any other type of entry fails with
 867      EACCES.
 868 





































































































































 869    object
 870      A directory containing read-only files with names corresponding to the
 871      pr_mapname entries in the map and pagedata files.  Opening such a file
 872      yields a file descriptor for the underlying mapped file associated with
 873      an address-space mapping in the process.  The file name a.out appears in
 874      the directory as an alias for the process's executable file.
 875 
 876      The object directory makes it possible for a controlling process to gain
 877      access to the object file and any shared libraries (and consequently the
 878      symbol tables) without having to know the actual path names of the
 879      executable files.
 880 
 881    path
 882      A directory containing symbolic links to files opened by the process.
 883      The directory includes one entry for cwd and root.  The directory also
 884      contains a numerical entry for each file descriptor in the fd directory,
 885      and entries matching those in the object directory.  If this information
 886      is not available, any attempt to read the contents of the symbolic link
 887      will fail.  This is most common for files that do not exist in the
 888      filesystem namespace (such as FIFOs and sockets), but can also happen for


1879 NOTES
1880      Descriptions of structures in this document include only interesting
1881      structure elements, not filler and padding fields, and may show elements
1882      out of order for descriptive clarity.  The actual structure definitions
1883      are contained in <procfs.h>.
1884 
1885 BUGS
1886      Because the old ioctl(2)-based version of /proc is currently supported
1887      for binary compatibility with old applications, the top-level directory
1888      for a process, /proc/pid, is not world-readable, but it is world-
1889      searchable.  Thus, anyone can open /proc/pid/psinfo even though ls(1)
1890      applied to /proc/pid will fail for anyone but the owner or an
1891      appropriately privileged process.  Support for the old ioctl(2)-based
1892      version of /proc will be dropped in a future release, at which time the
1893      top-level directory for a process will be made world-readable.
1894 
1895      On SPARC based machines, the types gregset_t and fpregset_t defined in
1896      <sys/regset.h> are   similar to but not the same as the types prgregset_t
1897      and prfpregset_t defined in <procfs.h>.
1898 
1899 illumos                        January 11, 2019                        illumos


 849 
 850    root
 851      A symbolic link to the process's root directory.  /proc/pid/root can
 852      differ from the system root directory if the process or one of its
 853      ancestors executed chroot(2) as super user.  It has the same semantics as
 854      /proc/pid/cwd.
 855 
 856    fd
 857      A directory containing references to the open files of the process.  Each
 858      entry is a decimal number corresponding to an open file descriptor in the
 859      process.
 860 
 861      If an entry refers to a regular file, it can be opened with normal file
 862      system semantics but, to ensure that the controlling process cannot gain
 863      greater access than the controlled process, with no file access modes
 864      other than its read/write open modes in the controlled process.  If an
 865      entry refers to a directory, it can be accessed with the same semantics
 866      as /proc/pid/cwd.  An attempt to open any other type of entry fails with
 867      EACCES.
 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 
1002    object
1003      A directory containing read-only files with names corresponding to the
1004      pr_mapname entries in the map and pagedata files.  Opening such a file
1005      yields a file descriptor for the underlying mapped file associated with
1006      an address-space mapping in the process.  The file name a.out appears in
1007      the directory as an alias for the process's executable file.
1008 
1009      The object directory makes it possible for a controlling process to gain
1010      access to the object file and any shared libraries (and consequently the
1011      symbol tables) without having to know the actual path names of the
1012      executable files.
1013 
1014    path
1015      A directory containing symbolic links to files opened by the process.
1016      The directory includes one entry for cwd and root.  The directory also
1017      contains a numerical entry for each file descriptor in the fd directory,
1018      and entries matching those in the object directory.  If this information
1019      is not available, any attempt to read the contents of the symbolic link
1020      will fail.  This is most common for files that do not exist in the
1021      filesystem namespace (such as FIFOs and sockets), but can also happen for


2012 NOTES
2013      Descriptions of structures in this document include only interesting
2014      structure elements, not filler and padding fields, and may show elements
2015      out of order for descriptive clarity.  The actual structure definitions
2016      are contained in <procfs.h>.
2017 
2018 BUGS
2019      Because the old ioctl(2)-based version of /proc is currently supported
2020      for binary compatibility with old applications, the top-level directory
2021      for a process, /proc/pid, is not world-readable, but it is world-
2022      searchable.  Thus, anyone can open /proc/pid/psinfo even though ls(1)
2023      applied to /proc/pid will fail for anyone but the owner or an
2024      appropriately privileged process.  Support for the old ioctl(2)-based
2025      version of /proc will be dropped in a future release, at which time the
2026      top-level directory for a process will be made world-readable.
2027 
2028      On SPARC based machines, the types gregset_t and fpregset_t defined in
2029      <sys/regset.h> are   similar to but not the same as the types prgregset_t
2030      and prfpregset_t defined in <procfs.h>.
2031 
2032 illumos                        December 3, 2019                        illumos