unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [hurd,commited 0/3] hurd: More cancelation point work
@ 2020-06-29  0:32 Samuel Thibault
  2020-06-29  0:32 ` [hurd,commited 1/3] hurd: fix usleep(ULONG_MAX) Samuel Thibault
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Samuel Thibault @ 2020-06-29  0:32 UTC (permalink / raw
  To: libc-alpha; +Cc: commit-hurd

*** BLURB HERE ***

Samuel Thibault (3):
  hurd: fix usleep(ULONG_MAX)
  hurd: Add remaining cancelation points
  htl: Enable cancel*16 an cancel*20 tests

 hurd/hurdselect.c                         |  5 +++++
 nptl/Makefile                             |  9 ++-------
 sysdeps/mach/hurd/accept4.c               |  7 ++++++-
 sysdeps/mach/hurd/connect.c               | 11 +++++++++--
 sysdeps/mach/hurd/fdatasync.c             |  8 +++++++-
 sysdeps/mach/hurd/fsync.c                 |  8 +++++++-
 sysdeps/mach/hurd/i386/Makefile           |  2 ++
 sysdeps/mach/hurd/ioctl.c                 | 11 ++++++++++-
 sysdeps/mach/hurd/msync.c                 |  4 ++++
 sysdeps/mach/hurd/sigsuspend.c            |  5 +++++
 sysdeps/mach/hurd/sigwait.c               |  4 ++++
 sysdeps/mach/msync.c                      |  9 +++++++--
 sysdeps/mach/sleep.c                      |  4 ++++
 sysdeps/mach/usleep.c                     | 10 +++++++++-
 sysdeps/pthread/Makefile                  | 11 +++++++----
 {nptl => sysdeps/pthread}/tst-cancel16.c  |  0
 {nptl => sysdeps/pthread}/tst-cancel20.c  |  0
 {nptl => sysdeps/pthread}/tst-cancelx16.c |  0
 {nptl => sysdeps/pthread}/tst-cancelx20.c |  0
 19 files changed, 88 insertions(+), 20 deletions(-)
 rename {nptl => sysdeps/pthread}/tst-cancel16.c (100%)
 rename {nptl => sysdeps/pthread}/tst-cancel20.c (100%)
 rename {nptl => sysdeps/pthread}/tst-cancelx16.c (100%)
 rename {nptl => sysdeps/pthread}/tst-cancelx20.c (100%)

-- 
2.27.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [hurd,commited 1/3] hurd: fix usleep(ULONG_MAX)
  2020-06-29  0:32 [hurd,commited 0/3] hurd: More cancelation point work Samuel Thibault
@ 2020-06-29  0:32 ` Samuel Thibault
  2020-06-29  7:58   ` Andreas Schwab
  2020-06-29  0:32 ` [hurd,commited 2/3] hurd: Add remaining cancelation points Samuel Thibault
  2020-06-29  0:32 ` [hurd,commited 3/3] htl: Enable cancel*16 an cancel*20 tests Samuel Thibault
  2 siblings, 1 reply; 6+ messages in thread
From: Samuel Thibault @ 2020-06-29  0:32 UTC (permalink / raw
  To: libc-alpha; +Cc: commit-hurd

* sysdeps/mach/usleep.c (usleep): Clamp timeout when rouding up.
---
 sysdeps/mach/usleep.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sysdeps/mach/usleep.c b/sysdeps/mach/usleep.c
index 530336ba0b..d53eb04a51 100644
--- a/sysdeps/mach/usleep.c
+++ b/sysdeps/mach/usleep.c
@@ -25,11 +25,15 @@ int
 usleep (useconds_t useconds)
 {
   mach_port_t recv;
+  useconds_t useconds_up = useconds + 999;
+
+  if (useconds_up < useconds)
+    useconds_up = UINT32_MAX;
 
   recv = __mach_reply_port ();
 
   (void) __mach_msg (NULL, MACH_RCV_MSG|MACH_RCV_TIMEOUT|MACH_RCV_INTERRUPT,
-		     0, 0, recv, (useconds + 999) / 1000, MACH_PORT_NULL);
+		     0, 0, recv, useconds_up / 1000, MACH_PORT_NULL);
   __mach_port_destroy (mach_task_self (), recv);
 
   return 0;
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [hurd,commited 2/3] hurd: Add remaining cancelation points
  2020-06-29  0:32 [hurd,commited 0/3] hurd: More cancelation point work Samuel Thibault
  2020-06-29  0:32 ` [hurd,commited 1/3] hurd: fix usleep(ULONG_MAX) Samuel Thibault
@ 2020-06-29  0:32 ` Samuel Thibault
  2020-06-29  0:32 ` [hurd,commited 3/3] htl: Enable cancel*16 an cancel*20 tests Samuel Thibault
  2 siblings, 0 replies; 6+ messages in thread
From: Samuel Thibault @ 2020-06-29  0:32 UTC (permalink / raw
  To: libc-alpha; +Cc: commit-hurd

* hurd/hurdselect.c: Include <sysdep-cancel.h>.
(_hurd_select): Surround call to __mach_msg with enabling async cancel.
* sysdeps/mach/hurd/accept4.c: Include <sysdep-cancel.h>.
(__libc_accept4): Surround call to __socket_accept with enabling async cancel,
and use HURD_DPORT_USE_CANCEL instead of HURD_DPORT_USE.
* sysdeps/mach/hurd/connect.c: Include <sysdep-cancel.h>.
(__connect): Surround call to __file_name_lookup and __socket_connect
with enabling async cancel, and use HURD_DPORT_USE_CANCEL instead of
HURD_DPORT_USE.
* sysdeps/mach/hurd/fdatasync.c: Include <sysdep-cancel.h>.
(fdatasync): Surround call to __file_sync with enabling async cancel, and use
HURD_DPORT_USE_CANCEL instead of HURD_DPORT_USE.
* sysdeps/mach/hurd/fsync.c: Include <sysdep-cancel.h>.
(fsync): Surround call to __file_sync with enabling async cancel, and use
HURD_DPORT_USE_CANCEL instead of HURD_DPORT_USE.
* sysdeps/mach/hurd/ioctl.c: Include <sysdep-cancel.h>.
(__ioctl): When request is TIOCDRAIN, surround call to send_rpc with enabling
async cancel, and use HURD_DPORT_USE_CANCEL instead of HURD_DPORT_USE.
* sysdeps/mach/hurd/msync.c: Include <sysdep-cancel.h>.
(msync): Surround call to __vm_object_sync with enabling async cancel.
* sysdeps/mach/hurd/sigsuspend.c: Include <sysdep-cancel.h>.
(__sigsuspend): Surround call to __mach_msg with enabling async cancel.
* sysdeps/mach/hurd/sigwait.c: Include <sysdep-cancel.h>.
(__sigwait): Surround wait code with enabling async cancel.
* sysdeps/mach/msync.c: Include <sysdep-cancel.h>.
(msync): Surround call to __vm_msync with enabling async cancel.
* sysdeps/mach/sleep.c: Include <sysdep-cancel.h>.
(__sleep): Surround call to __mach_msg with enabling async cancel.
* sysdeps/mach/usleep.c: Include <sysdep-cancel.h>.
(usleep): Surround call to __vm_msync with enabling async cancel.
---
 hurd/hurdselect.c              |  5 +++++
 sysdeps/mach/hurd/accept4.c    |  7 ++++++-
 sysdeps/mach/hurd/connect.c    | 11 +++++++++--
 sysdeps/mach/hurd/fdatasync.c  |  8 +++++++-
 sysdeps/mach/hurd/fsync.c      |  8 +++++++-
 sysdeps/mach/hurd/ioctl.c      | 11 ++++++++++-
 sysdeps/mach/hurd/msync.c      |  4 ++++
 sysdeps/mach/hurd/sigsuspend.c |  5 +++++
 sysdeps/mach/hurd/sigwait.c    |  4 ++++
 sysdeps/mach/msync.c           |  9 +++++++--
 sysdeps/mach/sleep.c           |  4 ++++
 sysdeps/mach/usleep.c          |  4 ++++
 12 files changed, 72 insertions(+), 8 deletions(-)

diff --git a/hurd/hurdselect.c b/hurd/hurdselect.c
index 69a415c02c..8da0ccf282 100644
--- a/hurd/hurdselect.c
+++ b/hurd/hurdselect.c
@@ -28,6 +28,7 @@
 #include <stdint.h>
 #include <limits.h>
 #include <time.h>
+#include <sysdep-cancel.h>
 
 /* All user select types.  */
 #define SELECT_ALL (SELECT_READ | SELECT_WRITE | SELECT_URG)
@@ -432,11 +433,14 @@ _hurd_select (int nfds,
 	  to = MACH_MSG_TIMEOUT_NONE;
 	}
 
+      int cancel_oldtype = LIBC_CANCEL_ASYNC();
       while ((msgerr = __mach_msg (&msg.head,
 				   MACH_RCV_MSG | MACH_RCV_INTERRUPT | options,
 				   0, sizeof msg, portset, to,
 				   MACH_PORT_NULL)) == MACH_MSG_SUCCESS)
 	{
+	  LIBC_CANCEL_RESET (cancel_oldtype);
+
 	  /* We got a message.  Decode it.  */
 #ifdef MACH_MSG_TYPE_BIT
 	  const union typeword inttype =
@@ -527,6 +531,7 @@ _hurd_select (int nfds,
 	      options |= MACH_RCV_TIMEOUT;
 	    }
 	}
+      LIBC_CANCEL_RESET (cancel_oldtype);
 
       if (msgerr == MACH_RCV_INTERRUPTED)
 	/* Interruption on our side (e.g. signal reception).  */
diff --git a/sysdeps/mach/hurd/accept4.c b/sysdeps/mach/hurd/accept4.c
index 639f159951..2da7a8b032 100644
--- a/sysdeps/mach/hurd/accept4.c
+++ b/sysdeps/mach/hurd/accept4.c
@@ -24,6 +24,7 @@
 #include <hurd.h>
 #include <hurd/fd.h>
 #include <hurd/socket.h>
+#include <sysdep-cancel.h>
 
 /* Await a connection on socket FD.
    When a connection arrives, open a new socket to communicate with it,
@@ -41,13 +42,17 @@ __libc_accept4 (int fd, __SOCKADDR_ARG addrarg, socklen_t *addr_len, int flags)
   char *buf = (char *) addr;
   mach_msg_type_number_t buflen;
   int type;
+  int cancel_oldtype;
 
   flags = sock_to_o_flags (flags);
 
   if (flags & ~(O_CLOEXEC | O_NONBLOCK))
     return __hurd_fail (EINVAL);
 
-  if (err = HURD_DPORT_USE (fd, __socket_accept (port, &new, &aport)))
+  cancel_oldtype = LIBC_CANCEL_ASYNC();
+  err = HURD_DPORT_USE_CANCEL (fd, __socket_accept (port, &new, &aport));
+  LIBC_CANCEL_RESET (cancel_oldtype);
+  if (err)
     return __hurd_dfail (fd, err);
 
   if (addr != NULL)
diff --git a/sysdeps/mach/hurd/connect.c b/sysdeps/mach/hurd/connect.c
index b9b9fddf8b..2b03b879aa 100644
--- a/sysdeps/mach/hurd/connect.c
+++ b/sysdeps/mach/hurd/connect.c
@@ -22,6 +22,7 @@
 #include <hurd/socket.h>
 #include <sys/un.h>
 #include <hurd/ifsock.h>
+#include <sysdep-cancel.h>
 #include "hurd/hurdsocket.h"
 
 /* Open a connection on socket FD to peer at ADDR (which LEN bytes long).
@@ -34,13 +35,17 @@ __connect (int fd, __CONST_SOCKADDR_ARG addrarg, socklen_t len)
   error_t err;
   addr_port_t aport;
   const struct sockaddr_un *addr = addrarg.__sockaddr_un__;
+  int cancel_oldtype;
 
   if (addr->sun_family == AF_LOCAL)
     {
       char *name = _hurd_sun_path_dupa (addr, len);
       /* For the local domain, we must look up the name as a file and talk
 	 to it with the ifsock protocol.  */
-      file_t file = __file_name_lookup (name, 0, 0);
+      file_t file;
+      cancel_oldtype = LIBC_CANCEL_ASYNC();
+      file = __file_name_lookup (name, 0, 0);
+      LIBC_CANCEL_RESET (cancel_oldtype);
       if (file == MACH_PORT_NULL)
 	return -1;
       err = __ifsock_getsockaddr (file, &aport);
@@ -54,7 +59,7 @@ __connect (int fd, __CONST_SOCKADDR_ARG addrarg, socklen_t len)
   else
     err = EIEIO;
 
-  err = HURD_DPORT_USE (fd,
+  err = HURD_DPORT_USE_CANCEL (fd,
 			({
 			  if (err)
 			    err = __socket_create_address (port,
@@ -63,7 +68,9 @@ __connect (int fd, __CONST_SOCKADDR_ARG addrarg, socklen_t len)
 							   &aport);
 			  if (! err)
 			    {
+			      cancel_oldtype = LIBC_CANCEL_ASYNC();
 			      err = __socket_connect (port, aport);
+			      LIBC_CANCEL_RESET (cancel_oldtype);
 			      __mach_port_deallocate (__mach_task_self (),
 						      aport);
 			    }
diff --git a/sysdeps/mach/hurd/fdatasync.c b/sysdeps/mach/hurd/fdatasync.c
index 797fcf6a88..8ccda0a0b3 100644
--- a/sysdeps/mach/hurd/fdatasync.c
+++ b/sysdeps/mach/hurd/fdatasync.c
@@ -19,12 +19,18 @@
 #include <unistd.h>
 #include <hurd.h>
 #include <hurd/fd.h>
+#include <sysdep-cancel.h>
 
 /* Make all changes done to FD's file data actually appear on disk.  */
 int
 fdatasync (int fd)
 {
-  error_t err = HURD_DPORT_USE (fd, __file_sync (port, 1, 1));
+  error_t err;
+  int cancel_oldtype;
+
+  cancel_oldtype = LIBC_CANCEL_ASYNC();
+  err = HURD_DPORT_USE_CANCEL (fd, __file_sync (port, 1, 1));
+  LIBC_CANCEL_RESET (cancel_oldtype);
   if (err)
     {
       if (err == EOPNOTSUPP)
diff --git a/sysdeps/mach/hurd/fsync.c b/sysdeps/mach/hurd/fsync.c
index 85aa992db2..0b2a09dcf8 100644
--- a/sysdeps/mach/hurd/fsync.c
+++ b/sysdeps/mach/hurd/fsync.c
@@ -19,12 +19,18 @@
 #include <unistd.h>
 #include <hurd.h>
 #include <hurd/fd.h>
+#include <sysdep-cancel.h>
 
 /* Make all changes done to FD actually appear on disk.  */
 int
 fsync (int fd)
 {
-  error_t err = HURD_DPORT_USE (fd, __file_sync (port, 1, 0));
+  error_t err;
+  int cancel_oldtype;
+
+  cancel_oldtype = LIBC_CANCEL_ASYNC();
+  err = HURD_DPORT_USE_CANCEL (fd, __file_sync (port, 1, 0));
+  LIBC_CANCEL_RESET (cancel_oldtype);
   if (err)
     {
       if (err == EOPNOTSUPP)
diff --git a/sysdeps/mach/hurd/ioctl.c b/sysdeps/mach/hurd/ioctl.c
index a9a148f1e3..4c0e54b038 100644
--- a/sysdeps/mach/hurd/ioctl.c
+++ b/sysdeps/mach/hurd/ioctl.c
@@ -27,6 +27,7 @@
 #include <stdint.h>
 #include <hurd/ioctl.h>
 #include <mach/mig_support.h>
+#include <sysdep-cancel.h>
 
 #include <hurd/ioctls.defs>
 
@@ -269,7 +270,15 @@ __ioctl (int fd, unsigned long int request, ...)
   /* Marshal the arguments into the request message and make the RPC.
      This wrapper function handles EBACKGROUND returns, turning them
      into either SIGTTOU or EIO.  */
-  err = HURD_DPORT_USE (fd, _hurd_ctty_output (port, ctty, send_rpc));
+  if (request == TIOCDRAIN)
+    {
+      /* This is a cancellation point.  */
+      int cancel_oldtype = LIBC_CANCEL_ASYNC();
+      err = HURD_DPORT_USE_CANCEL (fd, _hurd_ctty_output (port, ctty, send_rpc));
+      LIBC_CANCEL_RESET (cancel_oldtype);
+    }
+  else
+    err = HURD_DPORT_USE (fd, _hurd_ctty_output (port, ctty, send_rpc));
 
 #ifdef MACH_MSG_TYPE_BIT
   t = (mach_msg_type_t *) msg.data;
diff --git a/sysdeps/mach/hurd/msync.c b/sysdeps/mach/hurd/msync.c
index cec467eb7f..1820190dbe 100644
--- a/sysdeps/mach/hurd/msync.c
+++ b/sysdeps/mach/hurd/msync.c
@@ -19,6 +19,7 @@
 #include <sys/types.h>
 #include <sys/mman.h>
 #include <errno.h>
+#include <sysdep-cancel.h>
 
 #include <hurd/hurd.h>
 
@@ -44,6 +45,7 @@ msync (void *addr, size_t length, int flags)
   vm_offset_t offset;
 
   kern_return_t err;
+  int cancel_oldtype;
 
   if (flags & (MS_SYNC | MS_ASYNC) == (MS_SYNC | MS_ASYNC))
     return __hurd_fail (EINVAL);
@@ -77,8 +79,10 @@ msync (void *addr, size_t length, int flags)
 	  else
 	    sync_len = len;
 
+	  cancel_oldtype = LIBC_CANCEL_ASYNC();
 	  err = __vm_object_sync (obj, cur - begin + offset, sync_len,
 				  should_flush, 1, should_iosync);
+	  LIBC_CANCEL_RESET (cancel_oldtype);
 	  __mach_port_deallocate (__mach_task_self (), obj);
 
 	  if (err)
diff --git a/sysdeps/mach/hurd/sigsuspend.c b/sysdeps/mach/hurd/sigsuspend.c
index 38f095ef09..ed98104dce 100644
--- a/sysdeps/mach/hurd/sigsuspend.c
+++ b/sysdeps/mach/hurd/sigsuspend.c
@@ -20,6 +20,7 @@
 #include <hurd.h>
 #include <hurd/signal.h>
 #include <hurd/msg.h>
+#include <sysdep-cancel.h>
 
 /* Change the set of blocked signals to SET,
    wait until a signal arrives, and restore the set of blocked signals.  */
@@ -30,6 +31,7 @@ __sigsuspend (const sigset_t *set)
   sigset_t newmask, oldmask, pending;
   mach_port_t wait;
   mach_msg_header_t msg;
+  int cancel_oldtype;
 
   if (set != NULL)
     /* Crash before locking.  */
@@ -59,8 +61,11 @@ __sigsuspend (const sigset_t *set)
     __msg_sig_post (_hurd_msgport, 0, 0, __mach_task_self ());
 
   /* Wait for the signal thread's message.  */
+
+  cancel_oldtype = LIBC_CANCEL_ASYNC();
   __mach_msg (&msg, MACH_RCV_MSG, 0, sizeof (msg), wait,
 	      MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL);
+  LIBC_CANCEL_RESET (cancel_oldtype);
   __mach_port_destroy (__mach_task_self (), wait);
 
   /* Restore the old mask and check for pending signals again.  */
diff --git a/sysdeps/mach/hurd/sigwait.c b/sysdeps/mach/hurd/sigwait.c
index 53d2110983..48ccaf05fe 100644
--- a/sysdeps/mach/hurd/sigwait.c
+++ b/sysdeps/mach/hurd/sigwait.c
@@ -21,6 +21,7 @@
 #include <hurd/msg.h>
 #include <hurd/sigpreempt.h>
 #include <assert.h>
+#include <sysdep-cancel.h>
 
 /* Select any of pending signals from SET or wait for any to arrive.  */
 int
@@ -33,6 +34,7 @@ __sigwait (const sigset_t *set, int *sig)
   jmp_buf buf;
   mach_port_t wait;
   mach_msg_header_t msg;
+  int cancel_oldtype;
 
   sighandler_t
     preempt_fun (struct hurd_signal_preemptor *pe,
@@ -71,6 +73,7 @@ __sigwait (const sigset_t *set, int *sig)
     __sigemptyset (&mask);
 
   ss = _hurd_self_sigstate ();
+  cancel_oldtype = LIBC_CANCEL_ASYNC();
   _hurd_sigstate_lock (ss);
 
   /* See if one of these signals is currently pending.  */
@@ -128,6 +131,7 @@ __sigwait (const sigset_t *set, int *sig)
 
 all_done:
   _hurd_sigstate_unlock (ss);
+  LIBC_CANCEL_RESET (cancel_oldtype);
 
   __mach_port_destroy (__mach_task_self (), wait);
   *sig = signo;
diff --git a/sysdeps/mach/msync.c b/sysdeps/mach/msync.c
index e36a564ef4..f72222b57b 100644
--- a/sysdeps/mach/msync.c
+++ b/sysdeps/mach/msync.c
@@ -20,6 +20,7 @@
 #include <sys/mman.h>
 #include <errno.h>
 #include <mach.h>
+#include <sysdep-cancel.h>
 
 /* Some Mach variants have vm_msync and some don't.  Those that have it
    define the VM_SYNC_* bits when we include <mach/mach_types.h>.  */
@@ -37,6 +38,7 @@ msync (void *addr, size_t len, int flags)
 {
   vm_sync_t sync_flags = 0;
   kern_return_t err;
+  int cancel_oldtype;
 
   if (flags & MS_SYNC)
     sync_flags |= VM_SYNC_SYNCHRONOUS;
@@ -45,8 +47,11 @@ msync (void *addr, size_t len, int flags)
   if (flags & MS_INVALIDATE)
     sync_flags |= VM_SYNC_INVALIDATE;
 
-  if (err = __vm_msync (__mach_task_self (),
-			(vm_address_t) addr, (vm_size_t) len, sync_flags))
+  cancel_oldtype = LIBC_CANCEL_ASYNC();
+  err = __vm_msync (__mach_task_self (),
+		    (vm_address_t) addr, (vm_size_t) len, sync_flags);
+  LIBC_CANCEL_RESET (cancel_oldtype);
+  if (err)
     {
       errno = err;
       return -1;
diff --git a/sysdeps/mach/sleep.c b/sysdeps/mach/sleep.c
index de58bd18c4..9de9de1ae9 100644
--- a/sysdeps/mach/sleep.c
+++ b/sysdeps/mach/sleep.c
@@ -19,6 +19,7 @@
 #include <time.h>
 #include <unistd.h>
 #include <mach.h>
+#include <sysdep-cancel.h>
 
 /* Make the process sleep for SECONDS seconds, or until a signal arrives
    and is not ignored.  The function returns the number of seconds less
@@ -30,12 +31,15 @@ __sleep (unsigned int seconds)
 {
   time_t before, after;
   mach_port_t recv;
+  int cancel_oldtype;
 
   recv = __mach_reply_port ();
 
   before = time_now ();
+  cancel_oldtype = LIBC_CANCEL_ASYNC();
   (void) __mach_msg (NULL, MACH_RCV_MSG|MACH_RCV_TIMEOUT|MACH_RCV_INTERRUPT,
 		     0, 0, recv, seconds * 1000, MACH_PORT_NULL);
+  LIBC_CANCEL_RESET (cancel_oldtype);
   after = time_now ();
   __mach_port_destroy (__mach_task_self (), recv);
 
diff --git a/sysdeps/mach/usleep.c b/sysdeps/mach/usleep.c
index d53eb04a51..75514b2e35 100644
--- a/sysdeps/mach/usleep.c
+++ b/sysdeps/mach/usleep.c
@@ -19,12 +19,14 @@
 #include <mach.h>
 #include <sys/time.h>
 #include <unistd.h>
+#include <sysdep-cancel.h>
 
 /* Sleep USECONDS microseconds, or until a previously set timer goes off.  */
 int
 usleep (useconds_t useconds)
 {
   mach_port_t recv;
+  int cancel_oldtype;
   useconds_t useconds_up = useconds + 999;
 
   if (useconds_up < useconds)
@@ -32,8 +34,10 @@ usleep (useconds_t useconds)
 
   recv = __mach_reply_port ();
 
+  cancel_oldtype = LIBC_CANCEL_ASYNC();
   (void) __mach_msg (NULL, MACH_RCV_MSG|MACH_RCV_TIMEOUT|MACH_RCV_INTERRUPT,
 		     0, 0, recv, useconds_up / 1000, MACH_PORT_NULL);
+  LIBC_CANCEL_RESET (cancel_oldtype);
   __mach_port_destroy (mach_task_self (), recv);
 
   return 0;
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [hurd,commited 3/3] htl: Enable cancel*16 an cancel*20 tests
  2020-06-29  0:32 [hurd,commited 0/3] hurd: More cancelation point work Samuel Thibault
  2020-06-29  0:32 ` [hurd,commited 1/3] hurd: fix usleep(ULONG_MAX) Samuel Thibault
  2020-06-29  0:32 ` [hurd,commited 2/3] hurd: Add remaining cancelation points Samuel Thibault
@ 2020-06-29  0:32 ` Samuel Thibault
  2 siblings, 0 replies; 6+ messages in thread
From: Samuel Thibault @ 2020-06-29  0:32 UTC (permalink / raw
  To: libc-alpha; +Cc: commit-hurd

* nptl/tst-cancel16.c, tst-cancel20.c, tst-cancelx16.c, tst-cancelx20.c:
Move to...
* sysdeps/pthread: ... here.
* nptl/Makefile: Move corresponding references and rules to...
* sysdeps/pthread/Makefile: ... here.
* sysdeps/mach/hurd/i386/Makefile: Xfail tst-cancel*16 for now: missing
barrier pshared support, but test should be working otherwise.
---
 nptl/Makefile                             |  9 ++-------
 sysdeps/mach/hurd/i386/Makefile           |  2 ++
 sysdeps/pthread/Makefile                  | 11 +++++++----
 {nptl => sysdeps/pthread}/tst-cancel16.c  |  0
 {nptl => sysdeps/pthread}/tst-cancel20.c  |  0
 {nptl => sysdeps/pthread}/tst-cancelx16.c |  0
 {nptl => sysdeps/pthread}/tst-cancelx20.c |  0
 7 files changed, 11 insertions(+), 11 deletions(-)
 rename {nptl => sysdeps/pthread}/tst-cancel16.c (100%)
 rename {nptl => sysdeps/pthread}/tst-cancel20.c (100%)
 rename {nptl => sysdeps/pthread}/tst-cancelx16.c (100%)
 rename {nptl => sysdeps/pthread}/tst-cancelx20.c (100%)

diff --git a/nptl/Makefile b/nptl/Makefile
index 4602824bf1..5e62c77853 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -278,8 +278,7 @@ tests = tst-attr2 tst-attr3 tst-default-attr \
 	tst-sem17 \
 	tst-tsd3 tst-tsd4 \
 	tst-cancel4 tst-cancel4_1 tst-cancel4_2 tst-cancel5 \
-	tst-cancel7 \
-	tst-cancel16 tst-cancel17 tst-cancel20 tst-cancel24 \
+	tst-cancel7 tst-cancel17 tst-cancel24 \
 	tst-cleanup4 \
 	tst-signal3 \
 	tst-exec4 tst-exec5 \
@@ -357,9 +356,7 @@ endif
 
 LDFLAGS-pthread.so = -Wl,--enable-new-dtags,-z,nodelete,-z,initfirst
 
-tests += tst-cancelx4 tst-cancelx5 tst-cancelx7 \
-	 tst-cancelx16 tst-cancelx17 tst-cancelx20 \
-	 tst-cleanupx4
+tests += tst-cancelx4 tst-cancelx5 tst-cancelx7 tst-cancelx17 tst-cleanupx4
 
 ifeq ($(build-shared),yes)
 tests += tst-compat-forwarder tst-audit-threads
@@ -476,9 +473,7 @@ CFLAGS-tst-cancelx5.c += -Wno-error
 CFLAGS-tst-cancelx4.c += -fexceptions
 CFLAGS-tst-cancelx5.c += -fexceptions
 CFLAGS-tst-cancelx7.c += -fexceptions
-CFLAGS-tst-cancelx16.c += -fexceptions
 CFLAGS-tst-cancelx17.c += -fexceptions
-CFLAGS-tst-cancelx20.c += -fexceptions -fasynchronous-unwind-tables
 CFLAGS-tst-cleanupx4.c += -fexceptions
 CFLAGS-tst-cleanupx4aux.c += -fexceptions
 CFLAGS-tst-initializers1.c += -W -Wall -Werror
diff --git a/sysdeps/mach/hurd/i386/Makefile b/sysdeps/mach/hurd/i386/Makefile
index a67fe5d393..daeb85ba4f 100644
--- a/sysdeps/mach/hurd/i386/Makefile
+++ b/sysdeps/mach/hurd/i386/Makefile
@@ -107,6 +107,8 @@ ifeq ($(subdir),htl)
 # For bug 25521
 # (setpshared support)
 test-xfail-tst-mutex4 = yes
+test-xfail-tst-cancel16 = yes
+test-xfail-tst-cancelx16 = yes
 test-xfail-tst-cond4 = yes
 test-xfail-tst-cond6 = yes
 test-xfail-tst-cond12 = yes
diff --git a/sysdeps/pthread/Makefile b/sysdeps/pthread/Makefile
index ed31ae8f4f..920d875420 100644
--- a/sysdeps/pthread/Makefile
+++ b/sysdeps/pthread/Makefile
@@ -55,8 +55,8 @@ tests += tst-cnd-basic tst-mtx-trylock tst-cnd-broadcast \
 	 tst-cancel-self-canceltype tst-cancel-self-testcancel \
 	 tst-cancel1 tst-cancel2 tst-cancel3 \
 	 tst-cancel6 tst-cancel8 tst-cancel9 tst-cancel10 tst-cancel11 \
-	 tst-cancel12 tst-cancel13 tst-cancel14 tst-cancel15 tst-cancel18 \
-	 tst-cancel19 tst-cancel21 \
+	 tst-cancel12 tst-cancel13 tst-cancel14 tst-cancel15 tst-cancel16 \
+	 tst-cancel18 tst-cancel19 tst-cancel20 tst-cancel21 \
 	 tst-cancel22 tst-cancel23 tst-cancel26 tst-cancel27 tst-cancel28 \
 	 tst-cleanup0 tst-cleanup1 tst-cleanup2 tst-cleanup3 \
 	 tst-clock1 \
@@ -118,7 +118,7 @@ CFLAGS-tst-cleanupx2.c += -fno-builtin
 
 tests += tst-cancelx2 tst-cancelx3 tst-cancelx6 tst-cancelx8 tst-cancelx9 \
 	 tst-cancelx10 tst-cancelx11 tst-cancelx12 tst-cancelx13 tst-cancelx14 \
-	 tst-cancelx15 tst-cancelx18 tst-cancelx21 \
+	 tst-cancelx15 tst-cancelx16 tst-cancelx18 tst-cancelx20 tst-cancelx21 \
 	 tst-cleanupx0 tst-cleanupx1 tst-cleanupx2 tst-cleanupx3
 
 ifeq ($(build-shared),yes)
@@ -137,7 +137,8 @@ ifeq ($(build-shared),yes)
 tests: $(test-modules)
 endif
 
-tests-static += tst-locale1 tst-locale2 tst-cancel21-static \
+
+tests-static += tst-locale1 tst-locale2 tst-cancel21-static
 
 tests += tst-cancel21-static tst-cond11-static
 
@@ -163,7 +164,9 @@ CFLAGS-tst-cancelx12.c += -fexceptions
 CFLAGS-tst-cancelx13.c += -fexceptions
 CFLAGS-tst-cancelx14.c += -fexceptions
 CFLAGS-tst-cancelx15.c += -fexceptions
+CFLAGS-tst-cancelx16.c += -fexceptions
 CFLAGS-tst-cancelx18.c += -fexceptions
+CFLAGS-tst-cancelx20.c += -fexceptions -fasynchronous-unwind-tables
 CFLAGS-tst-cancelx21.c += -fexceptions -fasynchronous-unwind-tables
 CFLAGS-tst-cleanupx0.c += -fexceptions -fasynchronous-unwind-tables
 CFLAGS-tst-cleanupx1.c += -fexceptions -fasynchronous-unwind-tables
diff --git a/nptl/tst-cancel16.c b/sysdeps/pthread/tst-cancel16.c
similarity index 100%
rename from nptl/tst-cancel16.c
rename to sysdeps/pthread/tst-cancel16.c
diff --git a/nptl/tst-cancel20.c b/sysdeps/pthread/tst-cancel20.c
similarity index 100%
rename from nptl/tst-cancel20.c
rename to sysdeps/pthread/tst-cancel20.c
diff --git a/nptl/tst-cancelx16.c b/sysdeps/pthread/tst-cancelx16.c
similarity index 100%
rename from nptl/tst-cancelx16.c
rename to sysdeps/pthread/tst-cancelx16.c
diff --git a/nptl/tst-cancelx20.c b/sysdeps/pthread/tst-cancelx20.c
similarity index 100%
rename from nptl/tst-cancelx20.c
rename to sysdeps/pthread/tst-cancelx20.c
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [hurd,commited 1/3] hurd: fix usleep(ULONG_MAX)
  2020-06-29  0:32 ` [hurd,commited 1/3] hurd: fix usleep(ULONG_MAX) Samuel Thibault
@ 2020-06-29  7:58   ` Andreas Schwab
  2020-06-29  8:12     ` Samuel Thibault
  0 siblings, 1 reply; 6+ messages in thread
From: Andreas Schwab @ 2020-06-29  7:58 UTC (permalink / raw
  To: Samuel Thibault; +Cc: commit-hurd, libc-alpha

On Jun 29 2020, Samuel Thibault wrote:

>    (void) __mach_msg (NULL, MACH_RCV_MSG|MACH_RCV_TIMEOUT|MACH_RCV_INTERRUPT,
> -		     0, 0, recv, (useconds + 999) / 1000, MACH_PORT_NULL);
> +		     0, 0, recv, useconds_up / 1000, MACH_PORT_NULL);

Perhaps it should be written as useconds / 1000 + (useconds % 1000 !=
0).

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [hurd,commited 1/3] hurd: fix usleep(ULONG_MAX)
  2020-06-29  7:58   ` Andreas Schwab
@ 2020-06-29  8:12     ` Samuel Thibault
  0 siblings, 0 replies; 6+ messages in thread
From: Samuel Thibault @ 2020-06-29  8:12 UTC (permalink / raw
  To: Andreas Schwab; +Cc: commit-hurd, libc-alpha

Andreas Schwab, le lun. 29 juin 2020 09:58:12 +0200, a ecrit:
> On Jun 29 2020, Samuel Thibault wrote:
> 
> >    (void) __mach_msg (NULL, MACH_RCV_MSG|MACH_RCV_TIMEOUT|MACH_RCV_INTERRUPT,
> > -		     0, 0, recv, (useconds + 999) / 1000, MACH_PORT_NULL);
> > +		     0, 0, recv, useconds_up / 1000, MACH_PORT_NULL);
> 
> Perhaps it should be written as useconds / 1000 + (useconds % 1000 !=
> 0).

Right, that's less hardcoding indeed :)

Samuel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-06-29 11:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-29  0:32 [hurd,commited 0/3] hurd: More cancelation point work Samuel Thibault
2020-06-29  0:32 ` [hurd,commited 1/3] hurd: fix usleep(ULONG_MAX) Samuel Thibault
2020-06-29  7:58   ` Andreas Schwab
2020-06-29  8:12     ` Samuel Thibault
2020-06-29  0:32 ` [hurd,commited 2/3] hurd: Add remaining cancelation points Samuel Thibault
2020-06-29  0:32 ` [hurd,commited 3/3] htl: Enable cancel*16 an cancel*20 tests Samuel Thibault

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).