Hello, I have added send(2) MSG_DONTWAIT support, which enables us to choose nonblocking or blocking for each send(2) call.
This feature is also found in Linux. ------------------------------------------------------------------------ UMEZAWA Takeshi (FAMILY Given) <umez...@iij.ad.jp> Internet Initiative Japan Inc. diff --git a/lib/libc/sys/send.2 b/lib/libc/sys/send.2 index d58588f..b3b8d93 100644 --- a/lib/libc/sys/send.2 +++ b/lib/libc/sys/send.2 @@ -103,6 +103,8 @@ bypass routing, use direct interface .It Dv MSG_NOSIGNAL don't send .Dv SIGPIPE +.It Dv MSG_DONTWAIT +don't block .El .Pp The flag diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 653de7d..10ef153 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -451,7 +451,7 @@ restart: snderr(EMSGSIZE); if (space < resid + clen && (atomic || space < so->so_snd.sb_lowat || space < clen)) { - if (so->so_state & SS_NBIO) + if ((so->so_state & SS_NBIO) || (flags & MSG_DONTWAIT)) snderr(EWOULDBLOCK); sbunlock(&so->so_snd); error = sbwait(&so->so_snd);