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 /*
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 }
|