svn commit: r342929 - in stable/12: lib/libc/sys sys/kern sys/netinet sys/ofed/drivers/infiniband/ulp/sdp
Mark Johnston
markj at FreeBSD.org
Fri Jan 11 03:50:53 UTC 2019
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;
More information about the svn-src-stable
mailing list