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

Split Close
Expand all
Collapse all
          --- old/usr/src/man/man4/proc.4
          +++ new/usr/src/man/man4/proc.4
   1    1  .\" Copyright 1989 AT&T
   2    2  .\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved.
   3    3  .\" Copyright 2019, Joyent, Inc.
        4 +.\" Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
   4    5  .\"
   5    6  .\" The contents of this file are subject to the terms of the
   6    7  .\" Common Development and Distribution License (the "License").
   7    8  .\" You may not use this file except in compliance with the License.
   8    9  .\"
   9   10  .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  10   11  .\" or http://www.opensolaris.org/os/licensing.
  11   12  .\" See the License for the specific language governing permissions
  12   13  .\" and limitations under the License.
  13   14  .\"
  14   15  .\" When distributing Covered Code, include this CDDL HEADER in each
  15   16  .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16   17  .\" If applicable, add the following below this CDDL HEADER, with the
  17   18  .\" fields enclosed by brackets "[]" replaced with your own identifying
  18   19  .\" information: Portions Copyright [yyyy] [name of copyright owner]
  19   20  .\"
  20      -.Dd January 11, 2019
       21 +.Dd December 3, 2019
  21   22  .Dt PROC 4
  22   23  .Os
  23   24  .Sh NAME
  24   25  .Nm proc
  25   26  .Nd /proc, the process file system
  26   27  .Sh DESCRIPTION
  27   28  .Pa /proc
  28   29  is a file system that provides access to the state of each process
  29   30  and light-weight process (lwp) in the system.
  30   31  The name of each entry in the
↓ open down ↓ 1344 lines elided ↑ open up ↑
1375 1376  .Pp
1376 1377  If an entry refers to a regular file, it can be opened with normal file system
1377 1378  semantics but, to ensure that the controlling process cannot gain greater
1378 1379  access than the controlled process, with no file access modes other than its
1379 1380  read/write open modes in the controlled process.
1380 1381  If an entry refers to a directory, it can be accessed with the same semantics
1381 1382  as
1382 1383  .Pa /proc/ Ns Em pid Ns Pa /cwd .
1383 1384  An attempt to open any other type of entry fails with
1384 1385  .Er EACCES .
     1386 +.Ss fdinfo
     1387 +A directory containing information about each of the process's open files.
     1388 +Each entry is a decimal number corresponding to an open file descriptor in the
     1389 +process.
     1390 +Each file contains a
     1391 +.Sy prfdinfov2_t
     1392 +structure as follows:
     1393 +.Bd -literal -offset 2
     1394 +typedef struct prfdinfov2 {
     1395 +    int     pr_fd;          /* file descriptor number */
     1396 +    mode_t  pr_mode;        /* (see st_mode in stat(2)) */
     1397 +    uint64_t pr_ino;        /* inode number */
     1398 +    uint64_t pr_size;       /* file size */
     1399 +    int64_t pr_offset;      /* current offset of file descriptor */
     1400 +    uid_t   pr_uid;         /* owner's user id */
     1401 +    gid_t   pr_gid;         /* owner's group id */
     1402 +    major_t pr_major;       /* major number of device containing file */
     1403 +    minor_t pr_minor;       /* minor number of device containing file */
     1404 +    major_t pr_rmajor;      /* major number (if special file) */
     1405 +    minor_t pr_rminor;      /* minor number (if special file) */
     1406 +    int     pr_fileflags;   /* (see F_GETXFL in fcntl(2)) */
     1407 +    int     pr_fdflags;     /* (see F_GETFD in fcntl(2)) */
     1408 +    short   pr_locktype;    /* (see F_GETLK in fcntl(2)) */
     1409 +    pid_t   pr_lockpid;     /* process holding file lock (see F_GETLK) */
     1410 +    int     pr_locksysid;   /* sysid of locking process (see F_GETLK) */
     1411 +    pid_t   pr_peerpid;     /* peer process (socket, door) */
     1412 +    int     pr_filler[25];  /* reserved for future use */
     1413 +    char    pr_peername[PRFNSZ]; /* peer process name */
     1414 +#if __STDC_VERSION__ >= 199901L
     1415 +    char    pr_misc[];      /* self describing structures */
     1416 +#else
     1417 +    char    pr_misc[1];
     1418 +#endif
     1419 +} prfdinfov2_t;
     1420 +.Ed
     1421 +.Pp
     1422 +The
     1423 +.Sy pr_misc
     1424 +element points to a list of additional miscellaneous data items, each of which
     1425 +has a header of type
     1426 +.Sy pr_misc_header_t
     1427 +specifying the size and type, and some data which immediately follow
     1428 +the header.
     1429 +.Bd -literal -offset 2
     1430 +typedef struct pr_misc_header {
     1431 +    uint_t          pr_misc_size;
     1432 +    uint_t          pr_misc_type;
     1433 +} pr_misc_header_t;
     1434 +.Ed
     1435 +.Pp
     1436 +The
     1437 +.Sy pr_misc_size
     1438 +field is the sum of the sizes of the header and the associated data.
     1439 +The end of the list is indicated by a header with a zero size.
     1440 +.Pp
     1441 +The following miscellaneous data types can be present:
     1442 +.Bl -tag -width "PR_SOCKOPT_TCP_CONGESTION" -offset left
     1443 +.It Sy PR_PATHNAME
     1444 +The file descriptor's path in the filesystem.
     1445 +This is a sequence of characters of the length indicated by
     1446 +.Sy pr_misc_size
     1447 +and it not guaranteed to be null-terminated.
     1448 +.It Sy PR_SOCKETNAME
     1449 +A
     1450 +.Sy sockaddr
     1451 +structure representing the local socket name for this file descriptor, as
     1452 +would be returned by calling
     1453 +.Fn getsockname
     1454 +within the process.
     1455 +.It Sy PR_PEERSOCKNAME
     1456 +A
     1457 +.Sy sockaddr
     1458 +structure representing the peer socket name for this file desciptor, as
     1459 +would be returned by calling
     1460 +.Fn getpeername
     1461 +within the process.
     1462 +.It Sy PR_SOCKOPTS_BOOL_OPTS
     1463 +An unsigned integer which has bits set corresponding to options which are
     1464 +set on the underlying socket.
     1465 +The following bits may be set:
     1466 +.Bl -tag -width "PR_SO_PASSIVE_CONNECT"
     1467 +.It Sy PR_SO_DEBUG
     1468 +.It Sy PR_SO_REUSEADDR
     1469 +.It Sy PR_SO_REUSEPORT
     1470 +.It Sy PR_SO_KEEPALIVE
     1471 +.It Sy PR_SO_DONTROUTE
     1472 +.It Sy PR_SO_BROADCAST
     1473 +.It Sy PR_SO_OOBINLINE
     1474 +.It Sy PR_SO_DGRAM_ERRIND
     1475 +.It Sy PR_SO_ALLZONES
     1476 +.It Sy PR_SO_MAC_EXEMPT
     1477 +.It Sy PR_SO_EXCLBIND
     1478 +.It Sy PR_SO_PASSIVE_CONNECT
     1479 +.It Sy PR_SO_ACCEPTCONN
     1480 +.It Sy PR_UDP_NAT_T_ENDPOINT
     1481 +.It Sy PR_SO_VRRP
     1482 +.It Sy PR_SO_MAC_IMPLICIT
     1483 +.El
     1484 +.It Sy PR_SOCKOPT_LINGER
     1485 +A
     1486 +.Sy struct linger
     1487 +as would be returned by calling
     1488 +.Fn getsockopt SO_LINGER
     1489 +within the process.
     1490 +.It Sy PR_SOCKOPT_SNDBUF
     1491 +The data that would be returned by calling
     1492 +.Fn getsockopt SO_SNDBUF
     1493 +within the process.
     1494 +.It Sy PR_SOCKOPT_RCVBUF
     1495 +The data that would be returned by calling
     1496 +.Fn getsockopt SO_RCVBUF
     1497 +within the process.
     1498 +.It Sy PR_SOCKOPT_IP_NEXTHOP
     1499 +The data that would be returned by calling
     1500 +.Fn getsockopt IPPROTO_IP IP_NEXTHOP
     1501 +within the process.
     1502 +.It Sy PR_SOCKOPT_IPV6_NEXTHOP
     1503 +The data that would be returned by calling
     1504 +.Fn getsockopt IPPROTO_IPV6 IPV6_NEXTHOP
     1505 +within the process.
     1506 +.It Sy PR_SOCKOPT_TYPE
     1507 +The data that would be returned by calling
     1508 +.Fn getsockopt SO_TYPE
     1509 +within the process.
     1510 +.It Sy PR_SOCKOPT_TCP_CONGESTION
     1511 +For TCP sockets, the data that would be returned by calling
     1512 +.Fn getsockopt IPPROTO_TCP TCP_CONGESTION
     1513 +within the process.
     1514 +This is a character array containing the name of the congestion algorithm
     1515 +in use for the socket.
     1516 +.It Sy PR_SOCKFILTERS_PRIV
     1517 +Private data relating to any socket filters pushed on this descriptor.
     1518 +.El
1385 1519  .Ss object
1386 1520  A directory containing read-only files with names corresponding to the
1387 1521  .Sy pr_mapname
1388 1522  entries in the
1389 1523  .Sy map
1390 1524  and
1391 1525  .Sy pagedata
1392 1526  files.
1393 1527  Opening such a file yields a file descriptor for the underlying mapped file
1394 1528  associated with an address-space mapping in the process.
↓ open down ↓ 1683 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX