Print this page
XXXX adding PID information to netstat output

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/inet/snmpcom.c
          +++ new/usr/src/uts/common/inet/snmpcom.c
↓ open down ↓ 99 lines elided ↑ open up ↑
 100  100                  mpdata->b_cont = allocb(DATA_MBLK_SIZE, BPRI_HI);
 101  101                  mpdata = mpdata->b_cont;
 102  102                  if (!mpdata)
 103  103                          return (0);
 104  104          }
 105  105          bcopy(blob, (char *)mpdata->b_wptr, len);
 106  106          mpdata->b_wptr += len;
 107  107          return (1);
 108  108  }
 109  109  
      110 +int
      111 +snmp_append_mblk(mblk_t *mpdata, mblk_t *mblk)
      112 +{
      113 +        if (!mpdata || !mblk)
      114 +                return (0);
      115 +        while (mpdata->b_cont)
      116 +                mpdata = mpdata->b_cont;
      117 +        mpdata->b_cont = mblk;
      118 +        return (1);
      119 +}
      120 +
 110  121  /*
 111  122   * Need a form which avoids O(n^2) behavior locating the end of the
 112  123   * chain every time.  This is it.
 113  124   */
 114  125  int
 115  126  snmp_append_data2(mblk_t *mpdata, mblk_t **last_mpp, char *blob, int len)
 116  127  {
 117  128  
 118  129          if (!mpdata)
 119  130                  return (0);
↓ open down ↓ 3 lines elided ↑ open up ↑
 123  134                  *last_mpp = mpdata;
 124  135          }
 125  136          if ((*last_mpp)->b_wptr + len >= (*last_mpp)->b_datap->db_lim) {
 126  137                  (*last_mpp)->b_cont = allocb(DATA_MBLK_SIZE, BPRI_HI);
 127  138                  *last_mpp = (*last_mpp)->b_cont;
 128  139                  if (!*last_mpp)
 129  140                          return (0);
 130  141          }
 131  142          bcopy(blob, (char *)(*last_mpp)->b_wptr, len);
 132  143          (*last_mpp)->b_wptr += len;
      144 +        return (1);
      145 +}
      146 +
      147 +int
      148 +snmp_append_mblk2(mblk_t *mpdata, mblk_t **last_mpp, mblk_t *mblk)
      149 +{
      150 +        if (!mpdata || !mblk)
      151 +                return (0);
      152 +        if (*last_mpp == NULL) {
      153 +                while (mpdata->b_cont)
      154 +                        mpdata = mpdata->b_cont;
      155 +                *last_mpp = mpdata;
      156 +        }
      157 +        (*last_mpp)->b_cont = mblk;
      158 +        *last_mpp = (*last_mpp)->b_cont;
 133  159          return (1);
 134  160  }
 135  161  
 136  162  /*
 137  163   * SNMP requests are issued using putmsg() on a stream containing all
 138  164   * relevant modules.  The ctl part contains a O_T_OPTMGMT_REQ message,
 139  165   * and the data part is NULL
 140  166   * to process this msg. If snmpcom_req() returns FALSE, then the module
 141  167   * will try optcom_req to see if its some sort of SOCKET or IP option.
 142  168   * snmpcom_req returns TRUE whenever the first option is recognized as
↓ open down ↓ 180 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX