git: 7e5b6b391e77 - main - unix/dgram: cleanup uipc_send of PF_UNIX/SOCK_DGRAM, step 1

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Fri, 24 Jun 2022 16:10:29 UTC
The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=7e5b6b391e77e5a78da40af64dec171a92a00b60

commit 7e5b6b391e77e5a78da40af64dec171a92a00b60
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2022-06-24 16:09:10 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2022-06-24 16:09:10 +0000

    unix/dgram: cleanup uipc_send of PF_UNIX/SOCK_DGRAM, step 1
    
    Remove the dead code.  The new uipc_sosend_dgram() handles send()
    on PF_UNIX/SOCK_DGRAM in full.
    
    Reviewed by:            markj
    Differential revision:  https://reviews.freebsd.org/D35294
---
 sys/kern/uipc_usrreq.c | 50 --------------------------------------------------
 1 file changed, 50 deletions(-)

diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index 2e54ee827b8e..5141ca6a2ad3 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -1009,56 +1009,6 @@ uipc_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam,
 
 	unp2 = NULL;
 	switch (so->so_type) {
-	case SOCK_DGRAM:
-	{
-		const struct sockaddr *from;
-
-		if (nam != NULL) {
-			error = unp_connect(so, nam, td);
-			if (error != 0)
-				break;
-		}
-		UNP_PCB_LOCK(unp);
-
-		/*
-		 * Because connect() and send() are non-atomic in a sendto()
-		 * with a target address, it's possible that the socket will
-		 * have disconnected before the send() can run.  In that case
-		 * return the slightly counter-intuitive but otherwise
-		 * correct error that the socket is not connected.
-		 */
-		unp2 = unp_pcb_lock_peer(unp);
-		if (unp2 == NULL) {
-			UNP_PCB_UNLOCK(unp);
-			error = ENOTCONN;
-			break;
-		}
-
-		if (unp2->unp_flags & UNP_WANTCRED_MASK)
-			control = unp_addsockcred(td, control,
-			    unp2->unp_flags);
-		if (unp->unp_addr != NULL)
-			from = (struct sockaddr *)unp->unp_addr;
-		else
-			from = &sun_noname;
-		so2 = unp2->unp_socket;
-		SOCKBUF_LOCK(&so2->so_rcv);
-		if (sbappendaddr_locked(&so2->so_rcv, from, m,
-		    control)) {
-			sorwakeup_locked(so2);
-			m = NULL;
-			control = NULL;
-		} else {
-			soroverflow_locked(so2);
-			error = (so->so_state & SS_NBIO) ? EAGAIN : ENOBUFS;
-		}
-		if (nam != NULL)
-			unp_disconnect(unp, unp2);
-		else
-			unp_pcb_unlock_pair(unp, unp2);
-		break;
-	}
-
 	case SOCK_SEQPACKET:
 	case SOCK_STREAM:
 		if ((so->so_state & SS_ISCONNECTED) == 0) {