Print this page
XXXX adding PID information to netstat output

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/sys/socketvar.h
          +++ new/usr/src/uts/common/sys/socketvar.h
↓ open down ↓ 38 lines elided ↑ open up ↑
  39   39   * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
  40   40   */
  41   41  
  42   42  #ifndef _SYS_SOCKETVAR_H
  43   43  #define _SYS_SOCKETVAR_H
  44   44  
  45   45  #include <sys/types.h>
  46   46  #include <sys/stream.h>
  47   47  #include <sys/t_lock.h>
  48   48  #include <sys/cred.h>
       49 +#include <sys/pidnode.h>
  49   50  #include <sys/vnode.h>
  50   51  #include <sys/file.h>
  51   52  #include <sys/param.h>
  52   53  #include <sys/zone.h>
  53   54  #include <sys/sdt.h>
  54   55  #include <sys/modctl.h>
  55   56  #include <sys/atomic.h>
  56   57  #include <sys/socket.h>
  57   58  #include <sys/ksocket.h>
  58   59  #include <sys/kstat.h>
↓ open down ↓ 178 lines elided ↑ open up ↑
 237  238  
 238  239          /* != NULL for sodirect enabled socket */
 239  240          struct sodirect_s       *so_direct;
 240  241  
 241  242          /* socket filters */
 242  243          uint_t                  so_filter_active;       /* # of active fil */
 243  244          uint_t                  so_filter_tx;           /* pending tx ops */
 244  245          struct sof_instance     *so_filter_top;         /* top of stack */
 245  246          struct sof_instance     *so_filter_bottom;      /* bottom of stack */
 246  247          clock_t                 so_filter_defertime;    /* time when deferred */
      248 +
      249 +        /* pid tree */
      250 +        avl_tree_t              so_pid_tree;
      251 +        kmutex_t                so_pid_tree_lock;
 247  252  };
 248  253  
 249  254  #define SO_HAVE_DATA(so)                                                \
 250  255          /*                                                              \
 251  256           * For the (tid == 0) case we must check so_rcv_{q_,}head       \
 252  257           * rather than (so_rcv_queued > 0), since the latter does not   \
 253  258           * take into account mblks with only control/name information.  \
 254  259           */                                                             \
 255  260          ((so)->so_rcv_timer_tid == 0 && ((so)->so_rcv_head != NULL ||   \
 256  261          (so)->so_rcv_q_head != NULL)) ||                                \
↓ open down ↓ 687 lines elided ↑ open up ↑
 944  949                              int *);
 945  950  
 946  951  extern int      so_copyin(const void *, void *, size_t, int);
 947  952  extern int      so_copyout(const void *, void *, size_t, int);
 948  953  
 949  954  #endif
 950  955  
 951  956  /*
 952  957   * Internal structure for obtaining sonode information from the socklist.
 953  958   * These types match those corresponding in the sonode structure.
 954      - * This is not a published interface, and may change at any time.
      959 + * This is not a published interface, and may change at any time. It is
      960 + * used for passing information back up to the kstat consumers. By converting
      961 + * kernel addresses to strings, we should be able to pass information from
      962 + * the kernel to userland regardless of n-bit kernel we are using.
 955  963   */
      964 +
      965 +#define ADRSTRLEN (2 * sizeof (uint64_t) + 1)
      966 +
 956  967  struct sockinfo {
 957  968          uint_t          si_size;                /* real length of this struct */
 958  969          short           si_family;
 959  970          short           si_type;
 960  971          ushort_t        si_flag;
 961  972          uint_t          si_state;
 962  973          uint_t          si_ux_laddr_sou_magic;
 963  974          uint_t          si_ux_faddr_sou_magic;
 964  975          t_scalar_t      si_serv_type;
 965  976          t_uscalar_t     si_laddr_soa_len;
 966  977          t_uscalar_t     si_faddr_soa_len;
 967  978          uint16_t        si_laddr_family;
 968  979          uint16_t        si_faddr_family;
 969  980          char            si_laddr_sun_path[MAXPATHLEN + 1]; /* NULL terminated */
 970  981          char            si_faddr_sun_path[MAXPATHLEN + 1];
 971  982          boolean_t       si_faddr_noxlate;
 972  983          zoneid_t        si_szoneid;
      984 +        char            si_son_straddr[ADRSTRLEN];
      985 +        char            si_lvn_straddr[ADRSTRLEN];
      986 +        char            si_fvn_straddr[ADRSTRLEN];
      987 +        uint_t          si_pn_cnt;
      988 +        pid_t           si_pids[1];
 973  989  };
 974  990  
 975  991  /*
 976  992   * Subcodes for sockconf() system call
 977  993   */
 978  994  #define SOCKCONFIG_ADD_SOCK             0
 979  995  #define SOCKCONFIG_REMOVE_SOCK          1
 980  996  #define SOCKCONFIG_ADD_FILTER           2
 981  997  #define SOCKCONFIG_REMOVE_FILTER        3
 982  998  #define SOCKCONFIG_GET_SOCKTABLE        4
↓ open down ↓ 87 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX