Print this page
XXXX adding PID information to netstat output


2705 }
2706 
2707 int
2708 conn_untrace_ref(conn_t *connp)
2709 {
2710         int     last;
2711         conn_trace_t    *ctb;
2712 
2713         ASSERT(MUTEX_HELD(&connp->conn_lock));
2714         last = connp->conn_trace_last;
2715         last++;
2716         if (last == CONN_TRACE_MAX)
2717                 last = 0;
2718 
2719         ctb = &connp->conn_trace_buf[last];
2720         ctb->ctb_depth = getpcstack(ctb->ctb_stack, CONN_STACK_DEPTH);
2721         connp->conn_trace_last = last;
2722         return (1);
2723 }
2724 #endif





























2705 }
2706 
2707 int
2708 conn_untrace_ref(conn_t *connp)
2709 {
2710         int     last;
2711         conn_trace_t    *ctb;
2712 
2713         ASSERT(MUTEX_HELD(&connp->conn_lock));
2714         last = connp->conn_trace_last;
2715         last++;
2716         if (last == CONN_TRACE_MAX)
2717                 last = 0;
2718 
2719         ctb = &connp->conn_trace_buf[last];
2720         ctb->ctb_depth = getpcstack(ctb->ctb_stack, CONN_STACK_DEPTH);
2721         connp->conn_trace_last = last;
2722         return (1);
2723 }
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         if (connp->conn_upper_handle != NULL) {
2733                 return (*connp->conn_upcalls->su_get_sock_pid_mblk)
2734                     (connp->conn_upper_handle);
2735         } else if (!IPCL_IS_NONSTR(connp) && connp->conn_rq != NULL &&
2736             connp->conn_rq->q_stream != NULL) {
2737                 return (sh_get_pid_mblk(connp->conn_rq->q_stream));
2738         }
2739 
2740         /* return an empty mblk */
2741         if ((mblk = allocb(sizeof (conn_pid_info_t), BPRI_HI)) == NULL)
2742                 return (NULL);
2743         mblk->b_wptr += sizeof (conn_pid_info_t);
2744         cpi = (conn_pid_info_t *)mblk->b_datap->db_base;
2745         cpi->cpi_magic = CONN_PID_INFO_MGC;
2746         cpi->cpi_contents = CONN_PID_INFO_NON;
2747         cpi->cpi_pids_cnt = 0;
2748         cpi->cpi_tot_size = sizeof (conn_pid_info_t);
2749         cpi->cpi_pids[0] = 0;
2750         return (mblk);
2751 }