Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/uipc_usrreq.c
Show First 20 Lines • Show All 1,634 Lines • ▼ Show 20 Lines | unp_pcblist(SYSCTL_HANDLER_ARGS) | ||||
error = 0; | error = 0; | ||||
xu = malloc(sizeof(*xu), M_TEMP, M_WAITOK | M_ZERO); | xu = malloc(sizeof(*xu), M_TEMP, M_WAITOK | M_ZERO); | ||||
for (i = 0; i < n; i++) { | for (i = 0; i < n; i++) { | ||||
unp = unp_list[i]; | unp = unp_list[i]; | ||||
UNP_PCB_LOCK(unp); | UNP_PCB_LOCK(unp); | ||||
unp->unp_refcount--; | unp->unp_refcount--; | ||||
if (unp->unp_refcount != 0 && unp->unp_gencnt <= gencnt) { | if (unp->unp_refcount != 0 && unp->unp_gencnt <= gencnt) { | ||||
xu->xu_len = sizeof *xu; | xu->xu_len = sizeof *xu; | ||||
xu->xu_unpp = unp; | xu->xu_unpp = (int64_t)unp; | ||||
/* | /* | ||||
* XXX - need more locking here to protect against | * XXX - need more locking here to protect against | ||||
* connect/disconnect races for SMP. | * connect/disconnect races for SMP. | ||||
*/ | */ | ||||
if (unp->unp_addr != NULL) | if (unp->unp_addr != NULL) | ||||
bcopy(unp->unp_addr, &xu->xu_addr, | bcopy(unp->unp_addr, &xu->xu_addr, | ||||
unp->unp_addr->sun_len); | unp->unp_addr->sun_len); | ||||
else | else | ||||
bzero(&xu->xu_addr, sizeof(xu->xu_addr)); | bzero(&xu->xu_addr, sizeof(xu->xu_addr)); | ||||
if (unp->unp_conn != NULL && | if (unp->unp_conn != NULL && | ||||
unp->unp_conn->unp_addr != NULL) | unp->unp_conn->unp_addr != NULL) | ||||
bcopy(unp->unp_conn->unp_addr, | bcopy(unp->unp_conn->unp_addr, | ||||
&xu->xu_caddr, | &xu->xu_caddr, | ||||
unp->unp_conn->unp_addr->sun_len); | unp->unp_conn->unp_addr->sun_len); | ||||
else | else | ||||
bzero(&xu->xu_caddr, sizeof(xu->xu_caddr)); | bzero(&xu->xu_caddr, sizeof(xu->xu_caddr)); | ||||
xu->unp_vnode = unp->unp_vnode; | xu->unp_vnode = (int64_t)unp->unp_vnode; | ||||
xu->unp_conn = unp->unp_conn; | xu->unp_conn = (int64_t)unp->unp_conn; | ||||
xu->xu_firstref = LIST_FIRST(&unp->unp_refs); | xu->xu_firstref = (int64_t)LIST_FIRST(&unp->unp_refs); | ||||
xu->xu_nextref = LIST_NEXT(unp, unp_reflink); | xu->xu_nextref = (int64_t)LIST_NEXT(unp, unp_reflink); | ||||
xu->unp_gencnt = unp->unp_gencnt; | xu->unp_gencnt = unp->unp_gencnt; | ||||
sotoxsocket(unp->unp_socket, &xu->xu_socket); | sotoxsocket(unp->unp_socket, &xu->xu_socket); | ||||
UNP_PCB_UNLOCK(unp); | UNP_PCB_UNLOCK(unp); | ||||
error = SYSCTL_OUT(req, xu, sizeof *xu); | error = SYSCTL_OUT(req, xu, sizeof *xu); | ||||
} else { | } else { | ||||
freeunp = (unp->unp_refcount == 0); | freeunp = (unp->unp_refcount == 0); | ||||
UNP_PCB_UNLOCK(unp); | UNP_PCB_UNLOCK(unp); | ||||
if (freeunp) { | if (freeunp) { | ||||
▲ Show 20 Lines • Show All 928 Lines • Show Last 20 Lines |