public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/vineet/upstream-work] hurd: Make send* cancellation points
@ 2020-06-19  2:46 Vineet Gupta
  0 siblings, 0 replies; only message in thread
From: Vineet Gupta @ 2020-06-19  2:46 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=0c46891442c0b4ca593691f62ad1213e022ff00b

commit 0c46891442c0b4ca593691f62ad1213e022ff00b
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date:   Sun Jun 14 17:09:59 2020 +0000

    hurd: Make send* cancellation points
    
    * sysdeps/mach/hurd/send.c (__send): Make the __socket_send call
    a cancellation point.
    * sysdeps/mach/hurd/sendto.c (__sendto): Likewise.
    * sysdeps/mach/hurd/sendmsg.c (__libc_sendmsg): Likewise.

Diff:
---
 sysdeps/mach/hurd/send.c    | 4 ++++
 sysdeps/mach/hurd/sendmsg.c | 3 +++
 sysdeps/mach/hurd/sendto.c  | 3 +++
 3 files changed, 10 insertions(+)

diff --git a/sysdeps/mach/hurd/send.c b/sysdeps/mach/hurd/send.c
index af002765d2..78edbc2ff3 100644
--- a/sysdeps/mach/hurd/send.c
+++ b/sysdeps/mach/hurd/send.c
@@ -20,6 +20,7 @@
 #include <hurd.h>
 #include <hurd/socket.h>
 #include <hurd/fd.h>
+#include <sysdep-cancel.h>
 
 /* Send N bytes of BUF to socket FD.  Returns the number sent or -1.  */
 ssize_t
@@ -27,11 +28,14 @@ __send (int fd, const void *buf, size_t n, int flags)
 {
   error_t err;
   size_t wrote;
+  int cancel_oldtype;
 
+  cancel_oldtype = LIBC_CANCEL_ASYNC();
   err = HURD_DPORT_USE (fd, __socket_send (port, MACH_PORT_NULL,
 					   flags, buf, n,
 					   NULL, MACH_MSG_TYPE_COPY_SEND, 0,
 					   NULL, 0, &wrote));
+  LIBC_CANCEL_RESET (cancel_oldtype);
 
   if (err == MIG_BAD_ID || err == EOPNOTSUPP)
     /* The file did not grok the socket protocol.  */
diff --git a/sysdeps/mach/hurd/sendmsg.c b/sysdeps/mach/hurd/sendmsg.c
index dfc5afd4c6..37ab7f3ce0 100644
--- a/sysdeps/mach/hurd/sendmsg.c
+++ b/sysdeps/mach/hurd/sendmsg.c
@@ -24,6 +24,7 @@
 #include <hurd/fd.h>
 #include <hurd/ifsock.h>
 #include <hurd/socket.h>
+#include <sysdep-cancel.h>
 #include "hurd/hurdsocket.h"
 
 /* Send a message described MESSAGE on socket FD.
@@ -184,6 +185,7 @@ __libc_sendmsg (int fd, const struct msghdr *message, int flags)
 			  if (! err)
 			    {
 			      /* Send the data.  */
+			      int cancel_oldtype = LIBC_CANCEL_ASYNC();
 			      err = __socket_send (port, aport,
 						   flags, data.ptr, len,
 						   ports,
@@ -192,6 +194,7 @@ __libc_sendmsg (int fd, const struct msghdr *message, int flags)
 						   message->msg_control,
 						   message->msg_controllen,
 						   &amount);
+			      LIBC_CANCEL_RESET (cancel_oldtype);
 			      __mach_port_deallocate (__mach_task_self (),
 						      aport);
 			    }
diff --git a/sysdeps/mach/hurd/sendto.c b/sysdeps/mach/hurd/sendto.c
index 2f26b36b9e..a5faf8ea2e 100644
--- a/sysdeps/mach/hurd/sendto.c
+++ b/sysdeps/mach/hurd/sendto.c
@@ -22,6 +22,7 @@
 #include <hurd/fd.h>
 #include <hurd/ifsock.h>
 #include <hurd/socket.h>
+#include <sysdep-cancel.h>
 #include "hurd/hurdsocket.h"
 
 /* Send N bytes of BUF on socket FD to peer at address ADDR (which is
@@ -82,11 +83,13 @@ __sendto (int fd,
 			  if (! err)
 			    {
 			      /* Send the data.  */
+			      int cancel_oldtype = LIBC_CANCEL_ASYNC();
 			      err = __socket_send (port, aport,
 						   flags, buf, n,
 						   NULL,
 						   MACH_MSG_TYPE_COPY_SEND, 0,
 						   NULL, 0, &wrote);
+			      LIBC_CANCEL_RESET (cancel_oldtype);
 			    }
 			  err;
 			}));


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-06-19  2:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-19  2:46 [glibc/vineet/upstream-work] hurd: Make send* cancellation points Vineet Gupta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).