From nobody Mon Aug 19 14:37:42 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WnZvC0519z5T85G; Mon, 19 Aug 2024 14:37:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WnZvB4m17z4v3L; Mon, 19 Aug 2024 14:37:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1724078262; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IH3XQbp6U5J8gENbk5XuWG475Jo8FwIh1LhDyCIufss=; b=BA2fbsFSXLSPksotqOG2G7deyNnXslXdlIDX3eh/DgET6B9jhTegTiZG8DmYzYt+kkWoDN kzrx5G2MyLgXHAlmEnoEfEWdnbbqMslCo/S6Z3HPYHJWeCZTRxPIGyFlLY2SMKu8CUluBh drXQK8KBq0bl6T05WcGoVGw46yM133r2xN6tgC4XGmY5vh9CQDh0tZa5KKXrIGD5Xe/OYk BPit+eXcv2BpiKImU49p+SEpvNWwanxeY8ueijeGfdH53aMOhhWzE7SoD30J2QG0PRAOJO gUgSJNKfdQVRRCECRe2Vi/uiHf8wMVWKGFRf7lND8mE82K8sSmXXOZeV4x4MlA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1724078262; a=rsa-sha256; cv=none; b=pJxR9vPwYdpFCVYE2se7EXKlRNOEZOxrJJmLPrj1Kvy/xJnOYR1A0vVjX7UeZnuJX+6ODW 58GToAs2bRZ6khZTJlYmULB+XYRHC6wlz3n4lFYVPdJZyd/3U+9PlyXeQQsIBEFKqluVHx oVUDIaBvb5OHrT4bpWS4lhjYTxeLuwvdwAfv9fwo2A0uZ+IliwBIwtA9vvFvOfN4AJgNOo NhlsWfrNJi9VKCzEK4rWC4adn1SGLlP2IwTWGnK9sOAGBkB5GonvzLCHmRmuenbDxp6EAz fzKVaxRU5yJhQwprylfdPYu4EOvDc37vHLKt9sldF2xRzKcE2km0Obe03iQefg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1724078262; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IH3XQbp6U5J8gENbk5XuWG475Jo8FwIh1LhDyCIufss=; b=v5g+cKuiz97gw67tcmh9n6CepFJkhCVSn6STXQDTZOP+IQwgqDbBVNqcUZfp+ZVxpGA2LL wijgBIEhRVVCwZxmkGCth6TaB1HV1mTChPHIy44UCBlBBuCczwSRgae5zZfILAosj5V7i8 QyURNd7zgCMBE2Quu4SnAj1p0b4SU7a0+HJ8SudJA480OcQV2Uq8jctruHzuxG/8QZmLiL ubg3aSujZmSLVsuPHhmY4lTwI9PEJjZHZhhBlSIY/q8WBqV91L9MY0lo0eiliDImO6BcZk jAX33KUhoMaXcZJ/0dqj8A4Y/Bwm4j1PE6fuknHHcjq8mT2k9iCgFfakbkNN5g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WnZvB3hD4zLRW; Mon, 19 Aug 2024 14:37:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 47JEbgdN094219; Mon, 19 Aug 2024 14:37:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47JEbgAv094216; Mon, 19 Aug 2024 14:37:42 GMT (envelope-from git) Date: Mon, 19 Aug 2024 14:37:42 GMT Message-Id: <202408191437.47JEbgAv094216@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 0a68f644dca1 - main - socket: Split up soreceive_generic() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0a68f644dca19670686007071479f919a56ea37f Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=0a68f644dca19670686007071479f919a56ea37f commit 0a68f644dca19670686007071479f919a56ea37f Author: Mark Johnston AuthorDate: 2024-08-19 14:20:19 +0000 Commit: Mark Johnston CommitDate: 2024-08-19 14:37:27 +0000 socket: Split up soreceive_generic() Factor out the bits that run with the sock I/O lock held into a separate function. No functional change intended. Reviewed by: gallatin, glebius MFC after: 2 weeks Sponsored by: Klara, Inc. Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D46304 --- sys/kern/uipc_socket.c | 51 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 5886c7ac84f4..e7c4a85d5970 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -2070,11 +2070,11 @@ sockbuf_pushsync(struct sockbuf *sb, struct mbuf *nextrecord) * mbuf **mp0 for use in returning the chain. The uio is then used only for * the count in uio_resid. */ -int -soreceive_generic(struct socket *so, struct sockaddr **psa, struct uio *uio, - struct mbuf **mp0, struct mbuf **controlp, int *flagsp) +static int +soreceive_generic_locked(struct socket *so, struct sockaddr **psa, + struct uio *uio, struct mbuf **mp, struct mbuf **controlp, int *flagsp) { - struct mbuf *m, **mp; + struct mbuf *m; int flags, error, offset; ssize_t len; struct protosw *pr = so->so_proto; @@ -2083,25 +2083,15 @@ soreceive_generic(struct socket *so, struct sockaddr **psa, struct uio *uio, ssize_t orig_resid = uio->uio_resid; bool report_real_len = false; - mp = mp0; - if (psa != NULL) - *psa = NULL; - if (controlp != NULL) - *controlp = NULL; + SOCK_IO_RECV_ASSERT_LOCKED(so); + + error = 0; if (flagsp != NULL) { report_real_len = *flagsp & MSG_TRUNC; *flagsp &= ~MSG_TRUNC; flags = *flagsp &~ MSG_EOR; } else flags = 0; - if (flags & MSG_OOB) - return (soreceive_rcvoob(so, uio, flags)); - if (mp != NULL) - *mp = NULL; - - error = SOCK_IO_RECV_LOCK(so, SBLOCKWAIT(flags)); - if (error) - return (error); restart: SOCKBUF_LOCK(&so->so_rcv); @@ -2559,6 +2549,33 @@ dontblock: if (flagsp != NULL) *flagsp |= flags; release: + return (error); +} + +int +soreceive_generic(struct socket *so, struct sockaddr **psa, struct uio *uio, + struct mbuf **mp, struct mbuf **controlp, int *flagsp) +{ + int error, flags; + + if (psa != NULL) + *psa = NULL; + if (controlp != NULL) + *controlp = NULL; + if (flagsp != NULL) { + flags = *flagsp; + if ((flags & MSG_OOB) != 0) + return (soreceive_rcvoob(so, uio, flags)); + } else { + flags = 0; + } + if (mp != NULL) + *mp = NULL; + + error = SOCK_IO_RECV_LOCK(so, SBLOCKWAIT(flags)); + if (error) + return (error); + error = soreceive_generic_locked(so, psa, uio, mp, controlp, flagsp); SOCK_IO_RECV_UNLOCK(so); return (error); }