[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH] [hurd] pflocal/socket.c: Support MSG_DONTWAIT in pflocal send/recv



On 08/01/2016 12:08 PM, Christian Seiler wrote:
> Problem 2:
> 
> MSG_DONTWAIT is ignored for recvmsg, it always blocks (at least
> when using AF_LOCK sockets). I've even tried to pre-fill the
> msg_flags member with it (which you shouldn't need to do
> according to POSIX, the flags argument should be enough), but
> that also doesn't help.

I've attached a patch that fixes this specific issue for me. I
probably won't have time to look at the other issue I reported
here, but with that I'd at least be able to have open-isns
working on Hurd. (And the patch will likely also fix problems
in other software.)

It would be great if you could apply that patch in git.

Thanks!

Regards,
Christian

PS: Is there any way to sanely restart /hurd/pflocal without
rebooting? I was really lucky here that my first try at a
patch worked, especially since Hurd takes quite a bit longer
to reboot than Linux in a VM.
Description: Support MSG_DONTWAIT in pflocal send/recv
Author: Christian Seiler <christian@iwakd.de>
Bug: https://lists.gnu.org/archive/html/bug-hurd/2016-08/msg00000.html
Last-Update: 2016-08-05
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/pflocal/socket.c
+++ b/pflocal/socket.c
@@ -282,6 +282,7 @@ S_socket_send (struct sock_user *user, s
 	       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, s
 	
       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);
     }
 

Reply to: