Print this page
XXXX adding PID information to netstat output

*** 28,37 **** --- 28,38 ---- #include <sys/param.h> #include <sys/systm.h> #include <sys/buf.h> #include <sys/vfs.h> #include <sys/vnode.h> + #include <sys/fcntl.h> #include <sys/debug.h> #include <sys/errno.h> #include <sys/stropts.h> #include <sys/cmn_err.h> #include <sys/sysmacros.h>
*** 104,113 **** --- 105,116 ---- static ssize_t sctp_assoc_recv(sock_upper_handle_t, mblk_t *, size_t, int, int *, boolean_t *); static void sctp_assoc_xmitted(sock_upper_handle_t, boolean_t); static void sctp_assoc_properties(sock_upper_handle_t, struct sock_proto_props *); + static conn_pid_node_list_hdr_t * + sctp_get_sock_pid_list(sock_upper_handle_t); sonodeops_t sosctp_sonodeops = { sosctp_init, /* sop_init */ sosctp_accept, /* sop_accept */ sosctp_bind, /* sop_bind */
*** 166,175 **** --- 169,181 ---- sctp_assoc_recv, sctp_assoc_properties, sctp_assoc_xmitted, NULL, /* su_recv_space */ NULL, /* su_signal_oob */ + NULL, /* su_set_error */ + NULL, /* su_closed */ + sctp_get_sock_pid_list }; /* ARGSUSED */ static int sosctp_init(struct sonode *so, struct sonode *pso, struct cred *cr, int flags)
*** 1771,1780 **** --- 1777,1791 ---- */ nfp->f_vnode = nvp; mutex_exit(&nfp->f_tlock); setf(nfd, nfp); + /* add curproc to the pid list associated with that file */ + if (nfp->f_vnode != NULL) + (void) VOP_IOCTL(nfp->f_vnode, F_FORKED, + (intptr_t)curproc, FKIOCTL, kcred, NULL, NULL); + mutex_enter(&so->so_lock); sosctp_assoc_move(ss, SOTOSSO(nso), ssa); mutex_exit(&nso->so_lock);
*** 2228,2232 **** --- 2239,2257 ---- } } } mutex_exit(&so->so_lock); } + + static conn_pid_node_list_hdr_t * + sctp_get_sock_pid_list(sock_upper_handle_t handle) + { + struct sctp_soassoc *ssa = (struct sctp_soassoc *)handle; + struct sonode *so; + + if (ssa->ssa_type == SOSCTP_ASSOC) + so = &ssa->ssa_sonode->ss_so; + else + so = &((struct sctp_sonode *)handle)->ss_so; + + return (so_get_sock_pid_list((sock_upper_handle_t)so)); + }