From owner-svn-src-all@freebsd.org Fri Jan 11 03:50:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F7A414A3D6A; Fri, 11 Jan 2019 03:50:53 +0000 (UTC) (envelope-from markj@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 044E386890; Fri, 11 Jan 2019 03:50:53 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ED69AE20E; Fri, 11 Jan 2019 03:50:52 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x0B3oqdw064564; Fri, 11 Jan 2019 03:50:52 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0B3oqKF064561; Fri, 11 Jan 2019 03:50:52 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201901110350.x0B3oqKF064561@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 11 Jan 2019 03:50:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r342929 - in stable/12: lib/libc/sys sys/kern sys/netinet sys/ofed/drivers/infiniband/ulp/sdp X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/12: lib/libc/sys sys/kern sys/netinet sys/ofed/drivers/infiniband/ulp/sdp X-SVN-Commit-Revision: 342929 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 044E386890 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.973,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.998,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Jan 2019 03:50:53 -0000 Author: markj Date: Fri Jan 11 03:50:51 2019 New Revision: 342929 URL: https://svnweb.freebsd.org/changeset/base/342929 Log: MFC r342768: Support MSG_DONTWAIT in send*(2). Modified: stable/12/lib/libc/sys/send.2 stable/12/sys/kern/uipc_socket.c stable/12/sys/netinet/sctp_output.c stable/12/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/sys/send.2 ============================================================================== --- stable/12/lib/libc/sys/send.2 Fri Jan 11 02:53:46 2019 (r342928) +++ stable/12/lib/libc/sys/send.2 Fri Jan 11 03:50:51 2019 (r342929) @@ -28,7 +28,7 @@ .\" From: @(#)send.2 8.2 (Berkeley) 2/21/94 .\" $FreeBSD$ .\" -.Dd August 19, 2018 +.Dd January 4, 2019 .Dt SEND 2 .Os .Sh NAME @@ -121,7 +121,8 @@ argument may include one or more of the following: .Bd -literal #define MSG_OOB 0x00001 /* process out-of-band data */ #define MSG_DONTROUTE 0x00004 /* bypass routing, use direct interface */ -#define MSG_EOR 0x00008 /* data completes record */ +#define MSG_EOR 0x00008 /* data completes record */ +#define MSG_DONTWAIT 0x00080 /* do not block */ #define MSG_EOF 0x00100 /* data completes transaction */ #define MSG_NOSIGNAL 0x20000 /* do not generate SIGPIPE on EOF */ .Ed @@ -138,6 +139,9 @@ data. .Dv MSG_EOR is used to indicate a record mark for protocols which support the concept. +The +.Dv MSG_DONTWAIT +flag request the call to return when it would block otherwise. .Dv MSG_EOF requests that the sender side of a socket be shut down, and that an appropriate indication be sent at the end of the specified data; @@ -201,8 +205,9 @@ An invalid user space address was specified for an arg The socket requires that message be sent atomically, and the size of the message to be sent made this impossible. .It Bq Er EAGAIN -The socket is marked non-blocking and the requested operation -would block. +The socket is marked non-blocking, or +.Dv MSG_DONTWAIT +is specified, and the requested operation would block. .It Bq Er ENOBUFS The system was unable to allocate an internal buffer. The operation may succeed when buffers become available. Modified: stable/12/sys/kern/uipc_socket.c ============================================================================== --- stable/12/sys/kern/uipc_socket.c Fri Jan 11 02:53:46 2019 (r342928) +++ stable/12/sys/kern/uipc_socket.c Fri Jan 11 03:50:51 2019 (r342929) @@ -1522,7 +1522,8 @@ restart: } if (space < resid + clen && (atomic || space < so->so_snd.sb_lowat || space < clen)) { - if ((so->so_state & SS_NBIO) || (flags & MSG_NBIO)) { + if ((so->so_state & SS_NBIO) || + (flags & (MSG_NBIO | MSG_DONTWAIT)) != 0) { SOCKBUF_UNLOCK(&so->so_snd); error = EWOULDBLOCK; goto release; Modified: stable/12/sys/netinet/sctp_output.c ============================================================================== --- stable/12/sys/netinet/sctp_output.c Fri Jan 11 02:53:46 2019 (r342928) +++ stable/12/sys/netinet/sctp_output.c Fri Jan 11 03:50:51 2019 (r342929) @@ -12832,7 +12832,7 @@ sctp_lower_sosend(struct socket *so, } } if (SCTP_SO_IS_NBIO(so) - || (flags & MSG_NBIO) + || (flags & (MSG_NBIO | MSG_DONTWAIT)) != 0 ) { non_blocking = 1; } Modified: stable/12/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c ============================================================================== --- stable/12/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c Fri Jan 11 02:53:46 2019 (r342928) +++ stable/12/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c Fri Jan 11 03:50:51 2019 (r342929) @@ -1124,7 +1124,8 @@ restart: } if (space < resid && (atomic || space < so->so_snd.sb_lowat)) { - if ((so->so_state & SS_NBIO) || (flags & MSG_NBIO)) { + if ((so->so_state & SS_NBIO) || + (flags & (MSG_NBIO | MSG_DONTWAIT)) != 0) { SOCKBUF_UNLOCK(&so->so_snd); error = EWOULDBLOCK; goto release;