Print this page
XXXX adding PID information to netstat output

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/inet/ip/ipclassifier.c
          +++ new/usr/src/uts/common/inet/ip/ipclassifier.c
↓ open down ↓ 2714 lines elided ↑ open up ↑
2715 2715          last++;
2716 2716          if (last == CONN_TRACE_MAX)
2717 2717                  last = 0;
2718 2718  
2719 2719          ctb = &connp->conn_trace_buf[last];
2720 2720          ctb->ctb_depth = getpcstack(ctb->ctb_stack, CONN_STACK_DEPTH);
2721 2721          connp->conn_trace_last = last;
2722 2722          return (1);
2723 2723  }
2724 2724  #endif
     2725 +
     2726 +mblk_t *
     2727 +conn_get_pid_mblk(conn_t *connp)
     2728 +{
     2729 +        mblk_t *mblk;
     2730 +        conn_pid_info_t *cpi;
     2731 +
     2732 +        /*
     2733 +         * If the connection is closing, it is not safe to make an upcall or
     2734 +         * access the stream associated with the connection.
     2735 +         */
     2736 +        if (!(connp->conn_state_flags & CONN_CLOSING)) {
     2737 +                if (connp->conn_upper_handle != NULL) {
     2738 +                        return (*connp->conn_upcalls->su_get_sock_pid_mblk)
     2739 +                            (connp->conn_upper_handle);
     2740 +                } else if (!IPCL_IS_NONSTR(connp) && connp->conn_rq != NULL &&
     2741 +                    connp->conn_rq->q_stream != NULL) {
     2742 +                        return (sh_get_pid_mblk(connp->conn_rq->q_stream));
     2743 +                }
     2744 +        }
     2745 +
     2746 +        /* return an empty mblk */
     2747 +        if ((mblk = allocb(sizeof (conn_pid_info_t), BPRI_HI)) == NULL)
     2748 +                return (NULL);
     2749 +        mblk->b_wptr += sizeof (conn_pid_info_t);
     2750 +        cpi = (conn_pid_info_t *)mblk->b_datap->db_base;
     2751 +        cpi->cpi_contents = CONN_PID_INFO_NON;
     2752 +        cpi->cpi_pids_cnt = 0;
     2753 +        cpi->cpi_tot_size = sizeof (conn_pid_info_t);
     2754 +        cpi->cpi_pids[0] = 0;
     2755 +        return (mblk);
     2756 +}
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX