diff options
author | Christian Seiler <christian@iwakd.de> | 2016-08-09 01:49:49 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2016-08-09 01:49:49 +0200 |
commit | c8c973750b949f8c4fcac020c61a3b99e5d5c3a2 (patch) | |
tree | b32d4ef63766f48d39cf551a530912c63aeffb0f | |
parent | cf040539342d513ca9ae534efd0e21116440cc86 (diff) |
Support MSG_DONTWAIT in pflocal send/recv
* pflocal/socket.c (S_socket_send): Also test for MSG_DONTWAIT in `flags'
for the `noblock' parameter of pipe_send call.
(S_socket_recv): Likewise for pipe_recv call.
-rw-r--r-- | pflocal/socket.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/pflocal/socket.c b/pflocal/socket.c index f2b75a70..0fcf4843 100644 --- a/pflocal/socket.c +++ b/pflocal/socket.c @@ -282,6 +282,7 @@ S_socket_send (struct sock_user *user, struct addr *dest_addr, int flags, size_t *amount) { error_t err = 0; + int noblock; struct pipe *pipe; struct sock *sock, *dest_sock; struct addr *source_addr; @@ -333,8 +334,9 @@ S_socket_send (struct sock_user *user, struct addr *dest_addr, int flags, if (!err) { - err = pipe_send (pipe, sock->flags & PFLOCAL_SOCK_NONBLOCK, - source_addr, data, data_len, + noblock = (user->sock->flags & PFLOCAL_SOCK_NONBLOCK) + || (flags & MSG_DONTWAIT); + err = pipe_send (pipe, noblock, source_addr, data, data_len, control, control_len, ports, num_ports, amount); if (dest_sock) @@ -373,6 +375,7 @@ S_socket_recv (struct sock_user *user, { error_t err; unsigned flags; + int noblock; struct pipe *pipe; void *source_addr = NULL; @@ -398,10 +401,11 @@ S_socket_recv (struct sock_user *user, } else if (!err) { + noblock = (user->sock->flags & PFLOCAL_SOCK_NONBLOCK) + || (in_flags & MSG_DONTWAIT); err = - pipe_recv (pipe, user->sock->flags & PFLOCAL_SOCK_NONBLOCK, &flags, - &source_addr, data, data_len, amount, - control, control_len, ports, num_ports); + pipe_recv (pipe, noblock, &flags, &source_addr, data, data_len, + amount, control, control_len, ports, num_ports); pipe_release_reader (pipe); } |