Lines Matching refs:unp2

296 static void	unp_disconnect(struct unpcb *unp, struct unpcb *unp2);
347 unp_pcb_lock_pair(struct unpcb *unp, struct unpcb *unp2) in unp_pcb_lock_pair() argument
350 UNP_PCB_UNLOCK_ASSERT(unp2); in unp_pcb_lock_pair()
352 if (unp == unp2) { in unp_pcb_lock_pair()
354 } else if ((uintptr_t)unp2 > (uintptr_t)unp) { in unp_pcb_lock_pair()
356 UNP_PCB_LOCK(unp2); in unp_pcb_lock_pair()
358 UNP_PCB_LOCK(unp2); in unp_pcb_lock_pair()
364 unp_pcb_unlock_pair(struct unpcb *unp, struct unpcb *unp2) in unp_pcb_unlock_pair() argument
367 if (unp != unp2) in unp_pcb_unlock_pair()
368 UNP_PCB_UNLOCK(unp2); in unp_pcb_unlock_pair()
380 struct unpcb *unp2; in unp_pcb_lock_peer() local
383 unp2 = unp->unp_conn; in unp_pcb_lock_peer()
384 if (unp2 == NULL) in unp_pcb_lock_peer()
386 if (__predict_false(unp == unp2)) in unp_pcb_lock_peer()
389 UNP_PCB_UNLOCK_ASSERT(unp2); in unp_pcb_lock_peer()
391 if (__predict_true(UNP_PCB_TRYLOCK(unp2))) in unp_pcb_lock_peer()
392 return (unp2); in unp_pcb_lock_peer()
393 if ((uintptr_t)unp2 > (uintptr_t)unp) { in unp_pcb_lock_peer()
394 UNP_PCB_LOCK(unp2); in unp_pcb_lock_peer()
395 return (unp2); in unp_pcb_lock_peer()
398 unp_pcb_hold(unp2); in unp_pcb_lock_peer()
401 UNP_PCB_LOCK(unp2); in unp_pcb_lock_peer()
403 KASSERT(unp->unp_conn == unp2 || unp->unp_conn == NULL, in unp_pcb_lock_peer()
409 if (unp_pcb_rele(unp2)) { in unp_pcb_lock_peer()
414 UNP_PCB_UNLOCK(unp2); in unp_pcb_lock_peer()
417 return (unp2); in unp_pcb_lock_peer()
423 struct unpcb *unp, *unp2; in uipc_abort() local
430 unp2 = unp->unp_conn; in uipc_abort()
431 if (unp2 != NULL) { in uipc_abort()
432 unp_pcb_hold(unp2); in uipc_abort()
434 unp_drop(unp2); in uipc_abort()
675 struct unpcb *unp, *unp2; in uipc_close() local
696 if ((unp2 = unp_pcb_lock_peer(unp)) != NULL) in uipc_close()
697 unp_disconnect(unp, unp2); in uipc_close()
730 struct unpcb *unp, *unp2; in uipc_connect2() local
737 unp2 = so2->so_pcb; in uipc_connect2()
738 KASSERT(unp2 != NULL, ("uipc_connect2: unp2 == NULL")); in uipc_connect2()
739 unp_pcb_lock_pair(unp, unp2); in uipc_connect2()
741 unp_pcb_unlock_pair(unp, unp2); in uipc_connect2()
749 struct unpcb *unp, *unp2; in uipc_detach() local
788 if ((unp2 = unp_pcb_lock_peer(unp)) != NULL) in uipc_detach()
789 unp_disconnect(unp, unp2); in uipc_detach()
838 struct unpcb *unp, *unp2; in uipc_disconnect() local
844 if ((unp2 = unp_pcb_lock_peer(unp)) != NULL) in uipc_disconnect()
845 unp_disconnect(unp, unp2); in uipc_disconnect()
888 struct unpcb *unp, *unp2; in uipc_peeraddr() local
895 unp2 = unp_pcb_lock_peer(unp); in uipc_peeraddr()
896 if (unp2 != NULL) { in uipc_peeraddr()
897 if (unp2->unp_addr != NULL) in uipc_peeraddr()
898 sa = (struct sockaddr *)unp2->unp_addr; in uipc_peeraddr()
902 unp_pcb_unlock_pair(unp, unp2); in uipc_peeraddr()
914 struct unpcb *unp, *unp2; in uipc_rcvd() local
947 unp2 = unp->unp_conn; in uipc_rcvd()
948 if (unp2 == NULL) { in uipc_rcvd()
952 so2 = unp2->unp_socket; in uipc_rcvd()
965 struct unpcb *unp, *unp2; in uipc_send() local
984 unp2 = NULL; in uipc_send()
996 if ((unp2 = unp_pcb_lock_peer(unp)) == NULL) { in uipc_send()
1001 unp_pcb_unlock_pair(unp, unp2); in uipc_send()
1006 if ((so2 = unp2->unp_socket) == NULL) { in uipc_send()
1007 UNP_PCB_UNLOCK(unp2); in uipc_send()
1012 if (unp2->unp_flags & UNP_WANTCRED_MASK) { in uipc_send()
1018 control = unp_addsockcred(td, control, unp2->unp_flags, NULL, in uipc_send()
1020 unp2->unp_flags &= ~UNP_WANTCRED_ONESHOT; in uipc_send()
1067 UNP_PCB_UNLOCK(unp2); in uipc_send()
1133 struct unpcb *unp, *unp2; in uipc_sosend_dgram() local
1237 unp2 = unp->unp_conn; in uipc_sosend_dgram()
1238 UNP_PCB_LOCK_ASSERT(unp2); in uipc_sosend_dgram()
1241 unp2 = unp_pcb_lock_peer(unp); in uipc_sosend_dgram()
1242 if (unp2 == NULL) { in uipc_sosend_dgram()
1249 if (unp2->unp_flags & UNP_WANTCRED_MASK) in uipc_sosend_dgram()
1250 c = unp_addsockcred(td, c, unp2->unp_flags, &clast, &ctl, in uipc_sosend_dgram()
1322 so2 = unp2->unp_socket; in uipc_sosend_dgram()
1349 unp_disconnect(unp, unp2); in uipc_sosend_dgram()
1351 unp_pcb_unlock_pair(unp, unp2); in uipc_sosend_dgram()
1641 struct unpcb *unp, *unp2; in uipc_ready() local
1651 if ((unp2 = unp_pcb_lock_peer(unp)) != NULL) { in uipc_ready()
1653 so2 = unp2->unp_socket; in uipc_ready()
1659 UNP_PCB_UNLOCK(unp2); in uipc_ready()
1890 struct unpcb *unp, *unp2, *unp3; in unp_connectat() local
1983 VOP_UNP_CONNECT(vp, &unp2); in unp_connectat()
1984 if (unp2 == NULL) { in unp_connectat()
1988 so2 = unp2->unp_socket; in unp_connectat()
2003 unp_pcb_lock_pair(unp2, unp3); in unp_connectat()
2004 if (unp2->unp_addr != NULL) { in unp_connectat()
2005 bcopy(unp2->unp_addr, sa, unp2->unp_addr->sun_len); in unp_connectat()
2010 unp_copy_peercred(td, unp3, unp, unp2); in unp_connectat()
2012 UNP_PCB_UNLOCK(unp2); in unp_connectat()
2013 unp2 = unp3; in unp_connectat()
2025 unp_pcb_lock_pair(unp, unp2); in unp_connectat()
2027 KASSERT(unp2 != NULL && so2 != NULL && unp2->unp_socket == so2 && in unp_connectat()
2028 sotounpcb(so2) == unp2, in unp_connectat()
2029 ("%s: unp2 %p so2 %p", __func__, unp2, so2)); in unp_connectat()
2035 unp_pcb_unlock_pair(unp, unp2); in unp_connectat()
2084 struct unpcb *unp2; in unp_connect2() local
2089 unp2 = sotounpcb(so2); in unp_connect2()
2090 KASSERT(unp2 != NULL, ("unp_connect2: unp2 == NULL")); in unp_connect2()
2093 UNP_PCB_LOCK_ASSERT(unp2); in unp_connect2()
2097 unp->unp_conn = unp2; in unp_connect2()
2098 unp_pcb_hold(unp2); in unp_connect2()
2103 LIST_INSERT_HEAD(&unp2->unp_refs, unp, unp_reflink); in unp_connect2()
2110 KASSERT(unp2->unp_conn == NULL, in unp_connect2()
2111 ("%s: socket %p is already connected", __func__, unp2)); in unp_connect2()
2112 unp2->unp_conn = unp; in unp_connect2()
2123 unp_disconnect(struct unpcb *unp, struct unpcb *unp2) in unp_disconnect() argument
2132 UNP_PCB_LOCK_ASSERT(unp2); in unp_disconnect()
2133 KASSERT(unp->unp_conn == unp2, in unp_disconnect()
2134 ("%s: unpcb %p is not connected to %p", __func__, unp, unp2)); in unp_disconnect()
2138 so2 = unp2->unp_socket; in unp_disconnect()
2176 LIST_FOREACH(unptmp, &unp2->unp_refs, unp_reflink) { in unp_disconnect()
2181 ("%s: %p not found in reflist of %p", __func__, unp, unp2)); in unp_disconnect()
2196 MPASS(unp2->unp_conn == unp); in unp_disconnect()
2197 unp2->unp_conn = NULL; in unp_disconnect()
2203 if (unp == unp2) { in unp_disconnect()
2210 if (!unp_pcb_rele(unp2)) in unp_disconnect()
2211 UNP_PCB_UNLOCK(unp2); in unp_disconnect()
2381 struct unpcb *unp2; in unp_shutdown() local
2386 unp2 = unp->unp_conn; in unp_shutdown()
2388 (unp->unp_socket->so_type == SOCK_SEQPACKET)) && unp2 != NULL) { in unp_shutdown()
2389 so = unp2->unp_socket; in unp_shutdown()
2399 struct unpcb *unp2; in unp_drop() local
2411 if ((unp2 = unp_pcb_lock_peer(unp)) != NULL) { in unp_drop()
2414 unp_disconnect(unp, unp2); in unp_drop()