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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/sys/procfs.h
          +++ new/usr/src/uts/common/sys/procfs.h
↓ open down ↓ 18 lines elided ↑ open up ↑
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   */
  26   26  /*
  27   27   * Copyright 2012 DEY Storage Systems, Inc.  All rights reserved.
  28   28   * Copyright 2018 Joyent, Inc.
       29 + * Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
  29   30   */
  30   31  
  31   32  #ifndef _SYS_PROCFS_H
  32   33  #define _SYS_PROCFS_H
  33   34  
  34   35  #ifdef  __cplusplus
  35   36  extern "C" {
  36   37  #endif
  37   38  
  38   39  /*
↓ open down ↓ 467 lines elided ↑ open up ↑
 506  507  
 507  508  /*
 508  509   * Open files.  Only in core files (for now).  Note that we'd like to use
 509  510   * the stat or stat64 structure, but both of these structures are unfortunately
 510  511   * not consistent between 32 and 64 bit modes.  To keep our lives simpler, we
 511  512   * just define our own structure with types that are not sensitive to this
 512  513   * difference.  Also, it turns out that pfiles omits a lot of info from the
 513  514   * struct stat (e.g. times, device sizes, etc.) so we don't bother adding those
 514  515   * here.
 515  516   */
 516      -typedef struct prfdinfo {
      517 +typedef struct prfdinfov1 {
 517  518          int             pr_fd;
 518  519          mode_t          pr_mode;
 519  520  
 520  521          uid_t           pr_uid;
 521  522          gid_t           pr_gid;
 522  523  
 523  524          major_t         pr_major;       /* think stat.st_dev */
 524  525          minor_t         pr_minor;
 525  526  
 526  527          major_t         pr_rmajor;      /* think stat.st_rdev */
 527  528          minor_t         pr_rminor;
 528  529  
 529  530          ino64_t         pr_ino;
 530  531          off64_t         pr_offset;
 531  532          off64_t         pr_size;
 532  533  
 533  534          int             pr_fileflags;   /* fcntl(F_GETXFL), etc */
 534  535          int             pr_fdflags;     /* fcntl(F_GETFD), etc. */
 535  536  
 536  537          char            pr_path[MAXPATHLEN];
 537      -} prfdinfo_t;
      538 +} prfdinfov1_t;
 538  539  
      540 +typedef prfdinfov1_t prfdinfo_t;
      541 +
      542 +typedef struct prfdinfov2 {
      543 +        int             pr_fd;          /* file descriptor number */
      544 +        mode_t          pr_mode;        /* (see st_mode in stat(2)) */
      545 +        ino64_t         pr_ino;         /* inode number */
      546 +        off64_t         pr_size;        /* file size */
      547 +        off64_t         pr_offset;      /* current offset of file descriptor */
      548 +        uid_t           pr_uid;         /* owner's user id */
      549 +        gid_t           pr_gid;         /* owner's group id */
      550 +        major_t         pr_major;       /* major number of device */
      551 +        minor_t         pr_minor;       /* minor number of device */
      552 +        major_t         pr_rmajor;      /* major number (if special file) */
      553 +        minor_t         pr_rminor;      /* minor number (if special file) */
      554 +        int             pr_fileflags;   /* (see F_GETXFL in fcntl(2)) */
      555 +        int             pr_fdflags;     /* (see F_GETFD in fcntl(2)) */
      556 +        short           pr_locktype;    /* (see F_GETLK in fcntl(2)) */
      557 +        pid_t           pr_lockpid;     /* process holding file lock */
      558 +                                        /* (see F_GETLK) */
      559 +        int             pr_locksysid;   /* sysid of locking process */
      560 +                                        /* (see F_GETLK) */
      561 +        pid_t           pr_peerpid;     /* peer process (socket, door) */
      562 +        int             pr_filler[25];  /* reserved for future use */
      563 +        char            pr_peername[PRFNSZ];    /* peer process name */
      564 +#if     __STDC_VERSION__ >= 199901L
      565 +        char    pr_misc[];      /* self describing structures */
      566 +#else
      567 +        char    pr_misc[1];
      568 +#endif
      569 +} prfdinfov2_t;
      570 +
      571 +typedef struct pr_misc_header {
      572 +        uint_t          pr_misc_size;
      573 +        uint_t          pr_misc_type;
      574 +} pr_misc_header_t;
      575 +
      576 +enum PR_MISC_TYPES
      577 +{
      578 +        PR_PATHNAME,
      579 +        PR_SOCKETNAME,
      580 +        PR_PEERSOCKNAME,
      581 +        PR_SOCKOPTS_BOOL_OPTS,
      582 +        PR_SOCKOPT_LINGER,
      583 +        PR_SOCKOPT_SNDBUF,
      584 +        PR_SOCKOPT_RCVBUF,
      585 +        PR_SOCKOPT_IP_NEXTHOP,
      586 +        PR_SOCKOPT_IPV6_NEXTHOP,
      587 +        PR_SOCKOPT_TYPE,
      588 +        __UNIMPL_PR_SOCKOPT_LISTENQLIMIT,
      589 +        PR_SOCKOPT_TCP_CONGESTION,
      590 +        __UNIMPL_PR_SOCKOPT_FLOW_NAME,
      591 +        __UNIMPL_PR_SOCKOPTS_PRIV,
      592 +        PR_SOCKFILTERS_PRIV,
      593 +        PR_MISC_TYPES_MAX
      594 +};
      595 +
      596 +typedef struct prsockopts_bool_opts {
      597 +        unsigned int prsock_bool_opts;
      598 +} prsockopts_bool_opts_t;
      599 +
      600 +#define PR_SO_DEBUG             (1 << 0)
      601 +#define PR_SO_REUSEADDR         (1 << 1)
      602 +#define PR_SO_REUSEPORT         (1 << 2)
      603 +#define PR_SO_KEEPALIVE         (1 << 3)
      604 +#define PR_SO_DONTROUTE         (1 << 4)
      605 +#define PR_SO_BROADCAST         (1 << 5)
      606 +#define PR_SO_OOBINLINE         (1 << 7)
      607 +#define PR_SO_DGRAM_ERRIND      (1 << 8)
      608 +#define PR_SO_ALLZONES          (1 << 9)
      609 +#define PR_SO_MAC_EXEMPT        (1 << 10)
      610 +#define PR_SO_EXCLBIND          (1 << 11)
      611 +#define PR_SO_PASSIVE_CONNECT   (1 << 12)
      612 +#define PR_SO_ACCEPTCONN        (1 << 13)
      613 +#define PR_UDP_NAT_T_ENDPOINT   (1 << 14)
      614 +#define PR_SO_VRRP              (1 << 15)
      615 +#define PR_SO_MAC_IMPLICIT      (1 << 16)
      616 +
 539  617  /*
 540  618   * Representation of LWP name in core files.  In /proc, we use a simple char
 541  619   * array, but in core files we need to make it easy to correlate the note back
 542  620   * to the right LWP.  For simplicity, we'll use 32/64 consistent types.
 543  621   */
 544  622  typedef struct prlwpname {
 545  623          uint64_t pr_lwpid;
 546  624          char pr_lwpname[THREAD_NAME_MAX];
 547  625  } prlwpname_t;
 548  626  
↓ open down ↓ 337 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX