about summary refs log tree commit diff
path: root/sysdeps/unix
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/sysdep.h25
-rw-r--r--sysdeps/unix/sysv/linux/accept4.c12
-rw-r--r--sysdeps/unix/sysv/linux/alpha/fdatasync.c26
-rw-r--r--sysdeps/unix/sysv/linux/arm/pread.c22
-rw-r--r--sysdeps/unix/sysv/linux/arm/pread64.c25
-rw-r--r--sysdeps/unix/sysv/linux/arm/pwrite.c22
-rw-r--r--sysdeps/unix/sysv/linux/arm/pwrite64.c25
-rw-r--r--sysdeps/unix/sysv/linux/epoll_pwait.c14
-rw-r--r--sysdeps/unix/sysv/linux/fallocate.c18
-rw-r--r--sysdeps/unix/sysv/linux/fallocate64.c24
-rw-r--r--sysdeps/unix/sysv/linux/generic/open.c11
-rw-r--r--sysdeps/unix/sysv/linux/generic/open64.c13
-rw-r--r--sysdeps/unix/sysv/linux/generic/pause.c32
-rw-r--r--sysdeps/unix/sysv/linux/generic/poll.c11
-rw-r--r--sysdeps/unix/sysv/linux/generic/recv.c18
-rw-r--r--sysdeps/unix/sysv/linux/generic/select.c16
-rw-r--r--sysdeps/unix/sysv/linux/generic/send.c15
-rw-r--r--sysdeps/unix/sysv/linux/generic/sysdep.h1
-rw-r--r--sysdeps/unix/sysv/linux/generic/wordsize-32/pread.c21
-rw-r--r--sysdeps/unix/sysv/linux/generic/wordsize-32/pread64.c24
-rw-r--r--sysdeps/unix/sysv/linux/generic/wordsize-32/preadv.c21
-rw-r--r--sysdeps/unix/sysv/linux/generic/wordsize-32/preadv64.c22
-rw-r--r--sysdeps/unix/sysv/linux/generic/wordsize-32/pwrite.c23
-rw-r--r--sysdeps/unix/sysv/linux/generic/wordsize-32/pwrite64.c24
-rw-r--r--sysdeps/unix/sysv/linux/generic/wordsize-32/pwritev.c23
-rw-r--r--sysdeps/unix/sysv/linux/generic/wordsize-32/pwritev64.c25
-rw-r--r--sysdeps/unix/sysv/linux/i386/fcntl.c10
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips32/sync_file_range.c21
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/n32/fallocate.c12
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/n32/fallocate64.c12
-rw-r--r--sysdeps/unix/sysv/linux/mips/pread.c25
-rw-r--r--sysdeps/unix/sysv/linux/mips/pread64.c29
-rw-r--r--sysdeps/unix/sysv/linux/mips/pwrite.c25
-rw-r--r--sysdeps/unix/sysv/linux/mips/pwrite64.c29
-rw-r--r--sysdeps/unix/sysv/linux/msgrcv.c12
-rw-r--r--sysdeps/unix/sysv/linux/msgsnd.c14
-rw-r--r--sysdeps/unix/sysv/linux/open64.c11
-rw-r--r--sysdeps/unix/sysv/linux/openat.c11
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/pread.c20
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/pread64.c23
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite.c20
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite64.c23
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/fcntl.c10
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/sync_file_range.c12
-rw-r--r--sysdeps/unix/sysv/linux/ppoll.c12
-rw-r--r--sysdeps/unix/sysv/linux/pread.c25
-rw-r--r--sysdeps/unix/sysv/linux/pread64.c26
-rw-r--r--sysdeps/unix/sysv/linux/preadv.c14
-rw-r--r--sysdeps/unix/sysv/linux/pselect.c17
-rw-r--r--sysdeps/unix/sysv/linux/pwrite.c25
-rw-r--r--sysdeps/unix/sysv/linux/pwrite64.c27
-rw-r--r--sysdeps/unix/sysv/linux/pwritev.c14
-rw-r--r--sysdeps/unix/sysv/linux/recvmmsg.c11
-rw-r--r--sysdeps/unix/sysv/linux/sendmmsg.c11
-rw-r--r--sysdeps/unix/sysv/linux/sh/pread.c19
-rw-r--r--sysdeps/unix/sysv/linux/sh/pread64.c22
-rw-r--r--sysdeps/unix/sysv/linux/sh/pwrite.c19
-rw-r--r--sysdeps/unix/sysv/linux/sh/pwrite64.c23
-rw-r--r--sysdeps/unix/sysv/linux/sigsuspend.c27
-rw-r--r--sysdeps/unix/sysv/linux/sigtimedwait.c29
-rw-r--r--sysdeps/unix/sysv/linux/sigwaitinfo.c26
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c14
-rw-r--r--sysdeps/unix/sysv/linux/sync_file_range.c39
-rw-r--r--sysdeps/unix/sysv/linux/tcdrain.c12
-rw-r--r--sysdeps/unix/sysv/linux/timer_routines.c9
-rw-r--r--sysdeps/unix/sysv/linux/wait.c11
-rw-r--r--sysdeps/unix/sysv/linux/waitid.c13
-rw-r--r--sysdeps/unix/sysv/linux/waitpid.c19
-rw-r--r--sysdeps/unix/sysv/linux/wordsize-64/fallocate.c12
-rw-r--r--sysdeps/unix/sysv/linux/wordsize-64/preadv.c11
-rw-r--r--sysdeps/unix/sysv/linux/wordsize-64/pwritev.c11
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/recv.c11
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/send.c12
73 files changed, 192 insertions, 1161 deletions
diff --git a/sysdeps/unix/sysdep.h b/sysdeps/unix/sysdep.h
index 5fa658078e..52dad582ce 100644
--- a/sysdeps/unix/sysdep.h
+++ b/sysdeps/unix/sysdep.h
@@ -24,6 +24,27 @@
 #define	SYSCALL__(name, args)	PSEUDO (__##name, name, args)
 #define	SYSCALL(name, args)	PSEUDO (name, name, args)
 
+/* Cancellation macros.  */
+#define __SYSCALL_NARGS_X(a,b,c,d,e,f,g,n,...) n
+#define __SYSCALL_NARGS(...) \
+  __SYSCALL_NARGS_X (__VA_ARGS__, 7, 6, 5, 4, 3, 2, 1, 0,)
+
+#define SYSCALL_CANCEL(name, ...) \
+  ({									     \
+    long int sc_ret;							     \
+    if (SINGLE_THREAD_P) 						     \
+      sc_ret = INLINE_SYSCALL (name, __SYSCALL_NARGS(__VA_ARGS__),	     \
+			       __VA_ARGS__);				     \
+    else								     \
+      {									     \
+	int sc_cancel_oldtype = LIBC_CANCEL_ASYNC ();			     \
+	sc_ret = INLINE_SYSCALL (name, __SYSCALL_NARGS (__VA_ARGS__),	     \
+				 __VA_ARGS__);				     \
+        LIBC_CANCEL_RESET (sc_cancel_oldtype);				     \
+      }									     \
+    sc_ret;								     \
+  })
+
 /* Machine-dependent sysdep.h files are expected to define the macro
    PSEUDO (function_name, syscall_name) to emit assembly code to define the
    C-callable function FUNCTION_NAME to do system call SYSCALL_NAME.
@@ -31,7 +52,9 @@
    an instruction such that "MOVE(r1, r0)" works.  ret should be defined
    as the return instruction.  */
 
+#ifndef SYS_ify
 #define SYS_ify(syscall_name) SYS_##syscall_name
+#endif
 
 /* Terminate a system call named SYM.  This is used on some platforms
    to generate correct debugging information.  */
@@ -47,4 +70,6 @@
 
 /* Wrappers around system calls should normally inline the system call code.
    But sometimes it is not possible or implemented and we use this code.  */
+#ifndef INLINE_SYSCALL
 #define INLINE_SYSCALL(name, nr, args...) __syscall_##name (args)
+#endif
diff --git a/sysdeps/unix/sysv/linux/accept4.c b/sysdeps/unix/sysv/linux/accept4.c
index ec6b4c236d..6f59bfabc8 100644
--- a/sysdeps/unix/sysv/linux/accept4.c
+++ b/sysdeps/unix/sysv/linux/accept4.c
@@ -37,17 +37,7 @@
 int
 accept4 (int fd, __SOCKADDR_ARG addr, socklen_t *addr_len, int flags)
 {
-  if (SINGLE_THREAD_P)
-    return INLINE_SYSCALL (accept4, 4, fd, addr.__sockaddr__, addr_len, flags);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  int result = INLINE_SYSCALL (accept4, 4, fd, addr.__sockaddr__, addr_len,
-			       flags);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (accept4, fd, addr.__sockaddr__, addr_len, flags);
 }
 #elif defined __NR_socketcall
 # include <socketcall.h>
diff --git a/sysdeps/unix/sysv/linux/alpha/fdatasync.c b/sysdeps/unix/sysv/linux/alpha/fdatasync.c
index c9424e267f..c8b711ebe9 100644
--- a/sysdeps/unix/sysv/linux/alpha/fdatasync.c
+++ b/sysdeps/unix/sysv/linux/alpha/fdatasync.c
@@ -26,39 +26,23 @@
 
 #include <kernel-features.h>
 
-static int
-do_fdatasync (int fd)
+int
+__fdatasync (int fd)
 {
 #ifdef __ASSUME_FDATASYNC
-  return INLINE_SYSCALL (fdatasync, 1, fd);
+  return SYSCALL_CANCEL (fdatasync, fd);
 #elif defined __NR_fdatasync
   static int __have_no_fdatasync;
 
   if (!__builtin_expect (__have_no_fdatasync, 0))
     {
-      int result = INLINE_SYSCALL (fdatasync, 1, fd);
+      int result = SYSCALL_CANCEL (fdatasync, fd);
       if (__builtin_expect (result, 0) != -1 || errno != ENOSYS)
 	return result;
 
       __have_no_fdatasync = 1;
     }
 #endif
-  return INLINE_SYSCALL (fsync, 1, fd);
-}
-
-int
-__fdatasync (int fd)
-{
-  if (SINGLE_THREAD_P)
-    return do_fdatasync (fd);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  int result = do_fdatasync (fd);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (fsync, fd);
 }
-
 weak_alias (__fdatasync, fdatasync)
diff --git a/sysdeps/unix/sysv/linux/arm/pread.c b/sysdeps/unix/sysv/linux/arm/pread.c
index 64bc0a1015..91b3c66739 100644
--- a/sysdeps/unix/sysv/linux/arm/pread.c
+++ b/sysdeps/unix/sysv/linux/arm/pread.c
@@ -26,28 +26,10 @@
 ssize_t
 __libc_pread (int fd, void *buf, size_t count, off_t offset)
 {
-  ssize_t result;
-
-  if (SINGLE_THREAD_P)
-    {
-      /* In the ARM EABI, 64-bit values are aligned to even/odd register
-	 pairs for syscalls.  */
-      result = INLINE_SYSCALL (pread64, 6, fd, buf, count, 0,
-			       __LONG_LONG_PAIR (offset >> 31, offset));
-
-      return result;
-    }
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
   /* In the ARM EABI, 64-bit values are aligned to even/odd register
      pairs for syscalls.  */
-  result = INLINE_SYSCALL (pread64, 6, fd, buf, count, 0,
-			   __LONG_LONG_PAIR (offset >> 31, offset));
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (pread64, fd, buf, count, 0,
+			 __LONG_LONG_PAIR (offset >> 31, offset));
 }
 
 strong_alias (__libc_pread, __pread)
diff --git a/sysdeps/unix/sysv/linux/arm/pread64.c b/sysdeps/unix/sysv/linux/arm/pread64.c
index 78606997f9..ca71feb17b 100644
--- a/sysdeps/unix/sysv/linux/arm/pread64.c
+++ b/sysdeps/unix/sysv/linux/arm/pread64.c
@@ -26,30 +26,11 @@
 ssize_t
 __libc_pread64 (int fd, void *buf, size_t count, off64_t offset)
 {
-  ssize_t result;
-
-  if (SINGLE_THREAD_P)
-    {
-      /* In the ARM EABI, 64-bit values are aligned to even/odd register
-	 pairs for syscalls.  */
-      result = INLINE_SYSCALL (pread64, 6, fd, buf, count, 0,
-			       __LONG_LONG_PAIR ((off_t) (offset >> 32),
-						 (off_t) (offset & 0xffffffff)));
-
-      return result;
-    }
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
   /* In the ARM EABI, 64-bit values are aligned to even/odd register
      pairs for syscalls.  */
-  result = INLINE_SYSCALL (pread64, 6, fd, buf, count, 0,
-			   __LONG_LONG_PAIR ((off_t) (offset >> 32),
-					     (off_t) (offset & 0xffffffff)));
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (pread64, fd, buf, count, 0,
+			 __LONG_LONG_PAIR ((off_t) (offset >> 32),
+					   (off_t) (offset & 0xffffffff)));
 }
 
 weak_alias (__libc_pread64, __pread64)
diff --git a/sysdeps/unix/sysv/linux/arm/pwrite.c b/sysdeps/unix/sysv/linux/arm/pwrite.c
index 11a963ca6c..e22e112356 100644
--- a/sysdeps/unix/sysv/linux/arm/pwrite.c
+++ b/sysdeps/unix/sysv/linux/arm/pwrite.c
@@ -26,28 +26,10 @@
 ssize_t
 __libc_pwrite (int fd, const void *buf, size_t count, off_t offset)
 {
-  ssize_t result;
-
-  if (SINGLE_THREAD_P)
-    {
-      /* In the ARM EABI, 64-bit values are aligned to even/odd register
-	 pairs for syscalls.  */
-      result = INLINE_SYSCALL (pwrite64, 6, fd, buf, count, 0,
-			       __LONG_LONG_PAIR (offset >> 31, offset));
-
-      return result;
-    }
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
   /* In the ARM EABI, 64-bit values are aligned to even/odd register
      pairs for syscalls.  */
-  result = INLINE_SYSCALL (pwrite64, 6, fd, buf, count, 0,
-			   __LONG_LONG_PAIR (offset >> 31, offset));
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (pwrite64, fd, buf, count, 0,
+			 __LONG_LONG_PAIR (offset >> 31, offset));
 }
 
 strong_alias (__libc_pwrite, __pwrite)
diff --git a/sysdeps/unix/sysv/linux/arm/pwrite64.c b/sysdeps/unix/sysv/linux/arm/pwrite64.c
index 9cb67ff006..b63fbc8621 100644
--- a/sysdeps/unix/sysv/linux/arm/pwrite64.c
+++ b/sysdeps/unix/sysv/linux/arm/pwrite64.c
@@ -26,30 +26,11 @@
 ssize_t
 __libc_pwrite64 (int fd, const void *buf, size_t count, off64_t offset)
 {
-  ssize_t result;
-
-  if (SINGLE_THREAD_P)
-    {
-      /* In the ARM EABI, 64-bit values are aligned to even/odd register
-	 pairs for syscalls.  */
-      result = INLINE_SYSCALL (pwrite64, 6, fd, buf, count, 0,
-			       __LONG_LONG_PAIR ((off_t) (offset >> 32),
-						 (off_t) (offset & 0xffffffff)));
-
-      return result;
-    }
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
   /* In the ARM EABI, 64-bit values are aligned to even/odd register
      pairs for syscalls.  */
-  result = INLINE_SYSCALL (pwrite64, 6, fd, buf, count, 0,
-			   __LONG_LONG_PAIR ((off_t) (offset >> 32),
-					     (off_t) (offset & 0xffffffff)));
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (pwrite64, fd, buf, count, 0,
+			 __LONG_LONG_PAIR ((off_t) (offset >> 32),
+					   (off_t) (offset & 0xffffffff)));
 }
 
 weak_alias (__libc_pwrite64, __pwrite64)
diff --git a/sysdeps/unix/sysv/linux/epoll_pwait.c b/sysdeps/unix/sysv/linux/epoll_pwait.c
index 65fefec0bc..0e39013079 100644
--- a/sysdeps/unix/sysv/linux/epoll_pwait.c
+++ b/sysdeps/unix/sysv/linux/epoll_pwait.c
@@ -39,18 +39,8 @@ int epoll_pwait (int epfd, struct epoll_event *events,
 		 int maxevents, int timeout,
 		 const sigset_t *set)
 {
-  if (SINGLE_THREAD_P)
-    return INLINE_SYSCALL (epoll_pwait, 6, epfd, events, maxevents, timeout,
-			   set, _NSIG / 8);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  int result = INLINE_SYSCALL (epoll_pwait, 6, epfd, events, maxevents,
-			       timeout, set, _NSIG / 8);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (epoll_pwait, epfd, events, maxevents,
+			 timeout, set, _NSIG / 8);
 }
 
 #else
diff --git a/sysdeps/unix/sysv/linux/fallocate.c b/sysdeps/unix/sysv/linux/fallocate.c
index e9668bfb67..f3de90c347 100644
--- a/sysdeps/unix/sysv/linux/fallocate.c
+++ b/sysdeps/unix/sysv/linux/fallocate.c
@@ -25,21 +25,9 @@ int
 fallocate (int fd, int mode, __off_t offset, __off_t len)
 {
 #ifdef __NR_fallocate
-  if (SINGLE_THREAD_P)
-    return INLINE_SYSCALL (fallocate, 6, fd, mode,
-			   __LONG_LONG_PAIR (offset >> 31, offset),
-			   __LONG_LONG_PAIR (len >> 31, len));
-
-  int result;
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  result = INLINE_SYSCALL (fallocate, 6, fd, mode,
-			   __LONG_LONG_PAIR (offset >> 31, offset),
-			   __LONG_LONG_PAIR (len >> 31, len));
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (fallocate, fd, mode,
+			 __LONG_LONG_PAIR (offset >> 31, offset),
+			 __LONG_LONG_PAIR (len >> 31, len));
 #else
   __set_errno (ENOSYS);
   return -1;
diff --git a/sysdeps/unix/sysv/linux/fallocate64.c b/sysdeps/unix/sysv/linux/fallocate64.c
index 96acb2801e..191fa575be 100644
--- a/sysdeps/unix/sysv/linux/fallocate64.c
+++ b/sysdeps/unix/sysv/linux/fallocate64.c
@@ -25,25 +25,11 @@ int
 fallocate64 (int fd, int mode, __off64_t offset, __off64_t len)
 {
 #ifdef __NR_fallocate
-  if (SINGLE_THREAD_P)
-    return INLINE_SYSCALL (fallocate, 6, fd, mode,
-			   __LONG_LONG_PAIR ((long int) (offset >> 32),
-					     (long int) offset),
-			   __LONG_LONG_PAIR ((long int) (len >> 32),
-					     (long int) len));
-
-  int result;
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  result = INLINE_SYSCALL (fallocate, 6, fd, mode,
-			   __LONG_LONG_PAIR ((long int) (offset >> 32),
-					     (long int) offset),
-			   __LONG_LONG_PAIR ((long int) (len >> 32),
-					     (long int) len));
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (fallocate, fd, mode,
+			 __LONG_LONG_PAIR ((long int) (offset >> 32),
+					   (long int) offset),
+			 __LONG_LONG_PAIR ((long int) (len >> 32),
+					   (long int) len));
 #else
   __set_errno (ENOSYS);
   return -1;
diff --git a/sysdeps/unix/sysv/linux/generic/open.c b/sysdeps/unix/sysv/linux/generic/open.c
index 289f57aada..66cc2edf4b 100644
--- a/sysdeps/unix/sysv/linux/generic/open.c
+++ b/sysdeps/unix/sysv/linux/generic/open.c
@@ -37,16 +37,7 @@ __libc_open (const char *file, int oflag, ...)
       va_end (arg);
     }
 
-  if (SINGLE_THREAD_P)
-    return INLINE_SYSCALL (openat, 4, AT_FDCWD, file, oflag, mode);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  int result = INLINE_SYSCALL (openat, 4, AT_FDCWD, file, oflag, mode);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (openat, AT_FDCWD, file, oflag, mode);
 }
 libc_hidden_def (__libc_open)
 
diff --git a/sysdeps/unix/sysv/linux/generic/open64.c b/sysdeps/unix/sysv/linux/generic/open64.c
index 374e41cf3a..402bc7cd7f 100644
--- a/sysdeps/unix/sysv/linux/generic/open64.c
+++ b/sysdeps/unix/sysv/linux/generic/open64.c
@@ -37,18 +37,7 @@ __libc_open64 (const char *file, int oflag, ...)
       va_end (arg);
     }
 
-  if (SINGLE_THREAD_P)
-    return INLINE_SYSCALL (openat, 4, AT_FDCWD, file,
-                           oflag | O_LARGEFILE, mode);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  int result = INLINE_SYSCALL (openat, 4, AT_FDCWD, file,
-                               oflag | O_LARGEFILE, mode);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (openat, AT_FDCWD, file, oflag | O_LARGEFILE, mode);
 }
 weak_alias (__libc_open64, __open64)
 libc_hidden_weak (__open64)
diff --git a/sysdeps/unix/sysv/linux/generic/pause.c b/sysdeps/unix/sysv/linux/generic/pause.c
index 7966df2499..45d3a0eb21 100644
--- a/sysdeps/unix/sysv/linux/generic/pause.c
+++ b/sysdeps/unix/sysv/linux/generic/pause.c
@@ -23,41 +23,17 @@
 /* Suspend the process until a signal arrives.
    This always returns -1 and sets errno to EINTR.  */
 
-static int
-__syscall_pause (void)
+int
+__libc_pause (void)
 {
   sigset_t set;
 
   int rc =
-    INLINE_SYSCALL (rt_sigprocmask, 4, SIG_BLOCK, NULL, &set, _NSIG / 8);
+    SYSCALL_CANCEL (rt_sigprocmask, SIG_BLOCK, NULL, &set, _NSIG / 8);
   if (rc == 0)
-    rc = INLINE_SYSCALL (rt_sigsuspend, 2, &set, _NSIG / 8);
+    rc = SYSCALL_CANCEL (rt_sigsuspend, &set, _NSIG / 8);
 
   return rc;
 }
 
-int
-__libc_pause (void)
-{
-  if (SINGLE_THREAD_P)
-    return __syscall_pause ();
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  int result = __syscall_pause ();
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
-}
 weak_alias (__libc_pause, pause)
-
-#ifndef NO_CANCELLATION
-# include <not-cancel.h>
-
-int
-__pause_nocancel (void)
-{
-  return __syscall_pause ();
-}
-#endif
diff --git a/sysdeps/unix/sysv/linux/generic/poll.c b/sysdeps/unix/sysv/linux/generic/poll.c
index 7ef42f37ea..2a95796d68 100644
--- a/sysdeps/unix/sysv/linux/generic/poll.c
+++ b/sysdeps/unix/sysv/linux/generic/poll.c
@@ -35,16 +35,7 @@ __poll (struct pollfd *fds, nfds_t nfds, int timeout)
       timeout_ts_p = &timeout_ts;
     }
 
-  if (SINGLE_THREAD_P)
-    return INLINE_SYSCALL (ppoll, 5, fds, nfds, timeout_ts_p, NULL, 0);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  int result = INLINE_SYSCALL (ppoll, 5, fds, nfds, timeout_ts_p, NULL, 0);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (ppoll, fds, nfds, timeout_ts_p, NULL, 0);
 }
 libc_hidden_def (__poll)
 weak_alias (__poll, poll)
diff --git a/sysdeps/unix/sysv/linux/generic/recv.c b/sysdeps/unix/sysv/linux/generic/recv.c
index d827b3ea21..37861721e7 100644
--- a/sysdeps/unix/sysv/linux/generic/recv.c
+++ b/sysdeps/unix/sysv/linux/generic/recv.c
@@ -24,22 +24,8 @@
 ssize_t
 __libc_recv (int sockfd, void *buffer, size_t len, int flags)
 {
-  ssize_t result;
-
-  if (SINGLE_THREAD_P)
-    result = INLINE_SYSCALL (recvfrom, 6, sockfd, buffer, len, flags,
-                             NULL, NULL);
-  else
-    {
-      int oldtype = LIBC_CANCEL_ASYNC ();
-
-      result = INLINE_SYSCALL (recvfrom, 6, sockfd, buffer, len, flags,
-                               NULL, NULL);
-
-      LIBC_CANCEL_RESET (oldtype);
-    }
-
-  return result;
+  return SYSCALL_CANCEL (recvfrom, sockfd, buffer, len, flags,
+			 NULL, NULL);
 }
 strong_alias (__libc_recv, __recv)
 weak_alias (__libc_recv, recv)
diff --git a/sysdeps/unix/sysv/linux/generic/select.c b/sysdeps/unix/sysv/linux/generic/select.c
index 455c308f13..f7f1e18d4d 100644
--- a/sysdeps/unix/sysv/linux/generic/select.c
+++ b/sysdeps/unix/sysv/linux/generic/select.c
@@ -42,20 +42,8 @@ __select(int nfds, fd_set *readfds,
       tsp = &ts;
     }
 
-  if (SINGLE_THREAD_P)
-    {
-      result = INLINE_SYSCALL (pselect6, 6, nfds, readfds, writefds, exceptfds,
-                               tsp, NULL);
-    }
-  else
-    {
-      int oldtype = LIBC_CANCEL_ASYNC ();
-
-      result = INLINE_SYSCALL (pselect6, 6, nfds, readfds, writefds, exceptfds,
-                               tsp, NULL);
-
-      LIBC_CANCEL_RESET (oldtype);
-    }
+  result = SYSCALL_CANCEL (pselect6, nfds, readfds, writefds, exceptfds, tsp,
+			   NULL);
 
   if (timeout)
     {
diff --git a/sysdeps/unix/sysv/linux/generic/send.c b/sysdeps/unix/sysv/linux/generic/send.c
index dfbdc091ff..fed69613e1 100644
--- a/sysdeps/unix/sysv/linux/generic/send.c
+++ b/sysdeps/unix/sysv/linux/generic/send.c
@@ -24,20 +24,7 @@
 ssize_t
 __libc_send (int sockfd, const void *buffer, size_t len, int flags)
 {
-  ssize_t result;
-
-  if (SINGLE_THREAD_P)
-    result = INLINE_SYSCALL (sendto, 6, sockfd, buffer, len, flags, NULL, 0);
-  else
-    {
-      int oldtype = LIBC_CANCEL_ASYNC ();
-
-      result = INLINE_SYSCALL (sendto, 6, sockfd, buffer, len, flags, NULL, 0);
-
-      LIBC_CANCEL_RESET (oldtype);
-    }
-
-  return result;
+  return SYSCALL_CANCEL (sendto, sockfd, buffer, len, flags, NULL, 0);
 }
 strong_alias (__libc_send, __send)
 weak_alias (__libc_send, send)
diff --git a/sysdeps/unix/sysv/linux/generic/sysdep.h b/sysdeps/unix/sysv/linux/generic/sysdep.h
index 160804cd9e..11da9d21df 100644
--- a/sysdeps/unix/sysv/linux/generic/sysdep.h
+++ b/sysdeps/unix/sysv/linux/generic/sysdep.h
@@ -18,6 +18,7 @@
 
 #include <bits/wordsize.h>
 #include <kernel-features.h>
+#include <sysdeps/unix/sysdep.h>
 
 /* Provide the common name to allow more code reuse.  */
 #define __NR__llseek __NR_llseek
diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/pread.c b/sysdeps/unix/sysv/linux/generic/wordsize-32/pread.c
index ad97e97135..6f9703cc21 100644
--- a/sysdeps/unix/sysv/linux/generic/wordsize-32/pread.c
+++ b/sysdeps/unix/sysv/linux/generic/wordsize-32/pread.c
@@ -25,28 +25,13 @@
 #include <sysdep-cancel.h>
 #include <sys/syscall.h>
 
-static ssize_t
-do_pread (int fd, void *buf, size_t count, off_t offset)
+ssize_t
+__libc_pread (int fd, void *buf, size_t count, off_t offset)
 {
   assert (sizeof (offset) == 4);
-  return INLINE_SYSCALL (pread64, __ALIGNMENT_COUNT (5, 6), fd,
+  return SYSCALL_CANCEL (pread64, fd,
                          buf, count, __ALIGNMENT_ARG
                          __LONG_LONG_PAIR (offset >> 31, offset));
 }
-
-ssize_t
-__libc_pread (int fd, void *buf, size_t count, off_t offset)
-{
-  if (SINGLE_THREAD_P)
-    return do_pread (fd, buf, count, offset);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  ssize_t result = do_pread (fd, buf, count, offset);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
-}
 strong_alias (__libc_pread, __pread)
 weak_alias (__libc_pread, pread)
diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/pread64.c b/sysdeps/unix/sysv/linux/generic/wordsize-32/pread64.c
index 7250893297..a3f8ec1caa 100644
--- a/sysdeps/unix/sysv/linux/generic/wordsize-32/pread64.c
+++ b/sysdeps/unix/sysv/linux/generic/wordsize-32/pread64.c
@@ -24,29 +24,11 @@
 #include <sysdep-cancel.h>
 #include <sys/syscall.h>
 
-static ssize_t
-do_pread64 (int fd, void *buf, size_t count, off64_t offset)
-{
-  return INLINE_SYSCALL (pread64, __ALIGNMENT_COUNT (5, 6), fd,
-                         buf, count, __ALIGNMENT_ARG
-                         __LONG_LONG_PAIR ((off_t) (offset >> 32),
-                                           (off_t) (offset & 0xffffffff)));
-}
-
-
 ssize_t
 __libc_pread64 (int fd, void *buf, size_t count, off64_t offset)
 {
-  if (SINGLE_THREAD_P)
-    return do_pread64 (fd, buf, count, offset);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  ssize_t result = do_pread64 (fd, buf, count, offset);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (pread64, fd, buf, count, __ALIGNMENT_ARG
+                         __LONG_LONG_PAIR ((off_t) (offset >> 32),
+                                           (off_t) (offset & 0xffffffff)));
 }
-
 weak_alias (__libc_pread64, __pread64) weak_alias (__libc_pread64, pread64)
diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/preadv.c b/sysdeps/unix/sysv/linux/generic/wordsize-32/preadv.c
index 9a1832a854..d127fee927 100644
--- a/sysdeps/unix/sysv/linux/generic/wordsize-32/preadv.c
+++ b/sysdeps/unix/sysv/linux/generic/wordsize-32/preadv.c
@@ -26,28 +26,13 @@
 #include <sysdep-cancel.h>
 #include <sys/syscall.h>
 
-static ssize_t
-do_preadv (int fd, const struct iovec *vector, int count, off_t offset)
+ssize_t
+__libc_preadv (int fd, const struct iovec *vector, int count, off_t offset)
 {
   assert (sizeof (offset) == 4);
-  return INLINE_SYSCALL (preadv, __ALIGNMENT_COUNT (5, 6), fd,
+  return SYSCALL_CANCEL (preadv, fd,
                          vector, count, __ALIGNMENT_ARG
                          __LONG_LONG_PAIR (offset >> 31, offset));
 }
-
-ssize_t
-__libc_preadv (int fd, const struct iovec *vector, int count, off_t offset)
-{
-  if (SINGLE_THREAD_P)
-    return do_preadv (fd, vector, count, offset);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  ssize_t result = do_preadv (fd, vector, count, offset);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
-}
 strong_alias (__libc_preadv, __preadv)
 weak_alias (__libc_preadv, preadv)
diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/preadv64.c b/sysdeps/unix/sysv/linux/generic/wordsize-32/preadv64.c
index df1c010a70..7e7ebf740f 100644
--- a/sysdeps/unix/sysv/linux/generic/wordsize-32/preadv64.c
+++ b/sysdeps/unix/sysv/linux/generic/wordsize-32/preadv64.c
@@ -25,30 +25,14 @@
 #include <sysdep-cancel.h>
 #include <sys/syscall.h>
 
-static ssize_t
-do_preadv64 (int fd, const struct iovec *vector, int count, off64_t offset)
+ssize_t
+__libc_preadv64 (int fd, const struct iovec *vector, int count, off64_t offset)
 {
-  return INLINE_SYSCALL (preadv, __ALIGNMENT_COUNT (5, 6), fd,
+  return SYSCALL_CANCEL (preadv, fd,
                          vector, count, __ALIGNMENT_ARG
                          __LONG_LONG_PAIR ((off_t) (offset >> 32),
                                            (off_t) (offset & 0xffffffff)));
 }
 
-
-ssize_t
-__libc_preadv64 (int fd, const struct iovec *vector, int count, off64_t offset)
-{
-  if (SINGLE_THREAD_P)
-    return do_preadv64 (fd, vector, count, offset);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  ssize_t result = do_preadv64 (fd, vector, count, offset);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
-}
-
 strong_alias (__libc_preadv64, __preadv64)
 weak_alias (__libc_preadv64, preadv64)
diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/pwrite.c b/sysdeps/unix/sysv/linux/generic/wordsize-32/pwrite.c
index e897c7d6ad..2f0f7a1747 100644
--- a/sysdeps/unix/sysv/linux/generic/wordsize-32/pwrite.c
+++ b/sysdeps/unix/sysv/linux/generic/wordsize-32/pwrite.c
@@ -25,29 +25,12 @@
 #include <sysdep-cancel.h>
 #include <sys/syscall.h>
 
-static ssize_t
-do_pwrite (int fd, const void *buf, size_t count, off_t offset)
-{
-  assert (sizeof (offset) == 4);
-  return INLINE_SYSCALL (pwrite64, __ALIGNMENT_COUNT (5, 6), fd,
-                         buf, count, __ALIGNMENT_ARG
-                         __LONG_LONG_PAIR (offset >> 31, offset));
-}
-
-
 ssize_t
 __libc_pwrite (int fd, const void *buf, size_t count, off_t offset)
 {
-  if (SINGLE_THREAD_P)
-    return do_pwrite (fd, buf, count, offset);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  ssize_t result = do_pwrite (fd, buf, count, offset);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  assert (sizeof (offset) == 4);
+  return SYSCALL_CANCEL (pwrite64, fd, buf, count, __ALIGNMENT_ARG
+                         __LONG_LONG_PAIR (offset >> 31, offset));
 }
 strong_alias (__libc_pwrite, __pwrite)
 weak_alias (__libc_pwrite, pwrite)
diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/pwrite64.c b/sysdeps/unix/sysv/linux/generic/wordsize-32/pwrite64.c
index 3ac1339b9a..f222016e0f 100644
--- a/sysdeps/unix/sysv/linux/generic/wordsize-32/pwrite64.c
+++ b/sysdeps/unix/sysv/linux/generic/wordsize-32/pwrite64.c
@@ -24,30 +24,12 @@
 #include <sysdep-cancel.h>
 #include <sys/syscall.h>
 
-static ssize_t
-do_pwrite64 (int fd, const void *buf, size_t count, off64_t offset)
-{
-  return INLINE_SYSCALL (pwrite64, __ALIGNMENT_COUNT (5, 6), fd,
-                         buf, count, __ALIGNMENT_ARG
-                         __LONG_LONG_PAIR ((off_t) (offset >> 32),
-                                           (off_t) (offset & 0xffffffff)));
-}
-
-
 ssize_t
 __libc_pwrite64 (int fd, const void *buf, size_t count, off64_t offset)
 {
-  if (SINGLE_THREAD_P)
-    return do_pwrite64 (fd, buf, count, offset);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  ssize_t result = do_pwrite64 (fd, buf, count, offset);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (pwrite64, fd, buf, count, __ALIGNMENT_ARG
+                         __LONG_LONG_PAIR ((off_t) (offset >> 32),
+                                           (off_t) (offset & 0xffffffff)));
 }
-
 weak_alias (__libc_pwrite64, __pwrite64)
 libc_hidden_weak (__pwrite64) weak_alias (__libc_pwrite64, pwrite64)
diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/pwritev.c b/sysdeps/unix/sysv/linux/generic/wordsize-32/pwritev.c
index db1e4cb5d2..273b0ffb47 100644
--- a/sysdeps/unix/sysv/linux/generic/wordsize-32/pwritev.c
+++ b/sysdeps/unix/sysv/linux/generic/wordsize-32/pwritev.c
@@ -26,29 +26,12 @@
 #include <sysdep-cancel.h>
 #include <sys/syscall.h>
 
-static ssize_t
-do_pwritev (int fd, const struct iovec *vector, int count, off_t offset)
-{
-  assert (sizeof (offset) == 4);
-  return INLINE_SYSCALL (pwritev, __ALIGNMENT_COUNT (5, 6), fd,
-                         vector, count, __ALIGNMENT_ARG
-                         __LONG_LONG_PAIR (offset >> 31, offset));
-}
-
-
 ssize_t
 __libc_pwritev (int fd, const struct iovec *vector, int count, off_t offset)
 {
-  if (SINGLE_THREAD_P)
-    return do_pwritev (fd, vector, count, offset);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  ssize_t result = do_pwritev (fd, vector, count, offset);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  assert (sizeof (offset) == 4);
+  return SYSCALL_CANCEL (pwritev, fd, vector, count, __ALIGNMENT_ARG
+                         __LONG_LONG_PAIR (offset >> 31, offset));
 }
 strong_alias (__libc_pwritev, __pwritev)
 weak_alias (__libc_pwritev, pwritev)
diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/pwritev64.c b/sysdeps/unix/sysv/linux/generic/wordsize-32/pwritev64.c
index eb85e079d7..9d3fa75c7a 100644
--- a/sysdeps/unix/sysv/linux/generic/wordsize-32/pwritev64.c
+++ b/sysdeps/unix/sysv/linux/generic/wordsize-32/pwritev64.c
@@ -25,31 +25,14 @@
 #include <sysdep-cancel.h>
 #include <sys/syscall.h>
 
-static ssize_t
-do_pwritev64 (int fd, const struct iovec *vector, int count, off64_t offset)
-{
-  return INLINE_SYSCALL (pwritev, __ALIGNMENT_COUNT (5, 6), fd,
-                         vector, count, __ALIGNMENT_ARG
-                         __LONG_LONG_PAIR ((off_t) (offset >> 32),
-                                           (off_t) (offset & 0xffffffff)));
-}
-
-
 ssize_t
 __libc_pwritev64 (int fd, const struct iovec *vector, int count,
                   off64_t offset)
 {
-  if (SINGLE_THREAD_P)
-    return do_pwritev64 (fd, vector, count, offset);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  ssize_t result = do_pwritev64 (fd, vector, count, offset);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (pwritev, fd,
+                         vector, count, __ALIGNMENT_ARG
+                         __LONG_LONG_PAIR ((off_t) (offset >> 32),
+                                           (off_t) (offset & 0xffffffff)));
 }
-
 strong_alias (__libc_pwritev64, pwritev64)
 weak_alias (__libc_pwritev64, __pwritev64)
diff --git a/sysdeps/unix/sysv/linux/i386/fcntl.c b/sysdeps/unix/sysv/linux/i386/fcntl.c
index 9132c5a9d7..56f4bd1778 100644
--- a/sysdeps/unix/sysv/linux/i386/fcntl.c
+++ b/sysdeps/unix/sysv/linux/i386/fcntl.c
@@ -49,16 +49,10 @@ __libc_fcntl (int fd, int cmd, ...)
   arg = va_arg (ap, void *);
   va_end (ap);
 
-  if (SINGLE_THREAD_P || (cmd != F_SETLKW && cmd != F_SETLKW64))
+  if ((cmd != F_SETLKW) && (cmd != F_SETLKW64))
     return INLINE_SYSCALL (fcntl64, 3, fd, cmd, arg);
 
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  int result = INLINE_SYSCALL (fcntl64, 3, fd, cmd, arg);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (fcntl64, fd, cmd, arg);
 }
 libc_hidden_def (__libc_fcntl)
 
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/sync_file_range.c b/sysdeps/unix/sysv/linux/mips/mips32/sync_file_range.c
index 3c91d15e67..b79e44d0eb 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/sync_file_range.c
+++ b/sysdeps/unix/sysv/linux/mips/mips32/sync_file_range.c
@@ -28,23 +28,10 @@
 int
 sync_file_range (int fd, __off64_t from, __off64_t to, unsigned int flags)
 {
-  if (SINGLE_THREAD_P)
-    return INLINE_SYSCALL (sync_file_range, 7, fd, 0,
-			   __LONG_LONG_PAIR ((long) (from >> 32), (long) from),
-			   __LONG_LONG_PAIR ((long) (to >> 32), (long) to),
-			   flags);
-
-  int result;
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  result = INLINE_SYSCALL (sync_file_range, 7, fd, 0,
-			   __LONG_LONG_PAIR ((long) (from >> 32), (long) from),
-			   __LONG_LONG_PAIR ((long) (to >> 32), (long) to),
-			   flags);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (sync_file_range, fd, 0,
+			 __LONG_LONG_PAIR ((long) (from >> 32), (long) from),
+			 __LONG_LONG_PAIR ((long) (to >> 32), (long) to),
+			 flags);
 }
 #else
 int
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/fallocate.c b/sysdeps/unix/sysv/linux/mips/mips64/n32/fallocate.c
index 2331cec93b..ce29a0ec71 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/fallocate.c
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/fallocate.c
@@ -25,17 +25,7 @@ int
 fallocate (int fd, int mode, __off_t offset, __off_t len)
 {
 #ifdef __NR_fallocate
-  if (SINGLE_THREAD_P)
-    return INLINE_SYSCALL (fallocate, 4, fd, mode, offset, len);
-
-  int result;
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  result = INLINE_SYSCALL (fallocate, 4, fd, mode, offset, len);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (fallocate, fd, mode, offset, len);
 #else
   __set_errno (ENOSYS);
   return -1;
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n32/fallocate64.c b/sysdeps/unix/sysv/linux/mips/mips64/n32/fallocate64.c
index d3ed5d19ff..077127eee8 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/n32/fallocate64.c
+++ b/sysdeps/unix/sysv/linux/mips/mips64/n32/fallocate64.c
@@ -25,17 +25,7 @@ int
 fallocate64 (int fd, int mode, __off64_t offset, __off64_t len)
 {
 #ifdef __NR_fallocate
-  if (SINGLE_THREAD_P)
-    return INLINE_SYSCALL (fallocate, 4, fd, mode, offset, len);
-
-  int result;
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  result = INLINE_SYSCALL (fallocate, 4, fd, mode, offset, len);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (fallocate, fd, mode, offset, len);
 #else
   __set_errno (ENOSYS);
   return -1;
diff --git a/sysdeps/unix/sysv/linux/mips/pread.c b/sysdeps/unix/sysv/linux/mips/pread.c
index a7b1618968..0bd712dcd5 100644
--- a/sysdeps/unix/sysv/linux/mips/pread.c
+++ b/sysdeps/unix/sysv/linux/mips/pread.c
@@ -38,35 +38,16 @@
 ssize_t
 __libc_pread (int fd, void *buf, size_t count, off_t offset)
 {
-  ssize_t result;
-
 #if _MIPS_SIM != _ABI64
   assert (sizeof (offset) == 4);
 #endif
 
-  if (SINGLE_THREAD_P)
-    {
-#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
-      result = INLINE_SYSCALL (pread, 4, fd, buf, count, offset);
-#else
-      result = INLINE_SYSCALL (pread, 6, fd, buf, count, 0,
-			       __LONG_LONG_PAIR (offset >> 31, offset));
-#endif
-      return result;
-    }
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
 #if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
-  result = INLINE_SYSCALL (pread, 4, fd, buf, count, offset);
+  return SYSCALL_CANCEL (pread, fd, buf, count, offset);
 #else
-  result = INLINE_SYSCALL (pread, 6, fd, buf, count, 0,
-			   __LONG_LONG_PAIR (offset >> 31, offset));
+  return SYSCALL_CANCEL (pread, fd, buf, count, 0,
+			 __LONG_LONG_PAIR (offset >> 31, offset));
 #endif
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
 }
 
 strong_alias (__libc_pread, __pread)
diff --git a/sysdeps/unix/sysv/linux/mips/pread64.c b/sysdeps/unix/sysv/linux/mips/pread64.c
index ad948aada7..3ed100be02 100644
--- a/sysdeps/unix/sysv/linux/mips/pread64.c
+++ b/sysdeps/unix/sysv/linux/mips/pread64.c
@@ -37,34 +37,13 @@
 ssize_t
 __libc_pread64 (int fd, void *buf, size_t count, off64_t offset)
 {
-  ssize_t result;
-
-
-  if (SINGLE_THREAD_P)
-    {
 #if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
-      result = INLINE_SYSCALL (pread, 4, fd, buf, count, offset);
+  return SYSCALL_CANCEL (pread, fd, buf, count, offset);
 #else
-     result = INLINE_SYSCALL (pread, 6, fd, buf, count, 0,
-			      __LONG_LONG_PAIR ((off_t) (offset >> 32),
-			      (off_t) (offset & 0xffffffff)));
+  return SYSCALL_CANCEL (pread, fd, buf, count, 0,
+			 __LONG_LONG_PAIR ((off_t) (offset >> 32),
+					   (off_t) (offset & 0xffffffff)));
 #endif
-     return result;
-    }
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
-  result = INLINE_SYSCALL (pread, 4, fd, buf, count, offset);
-#else
-  result = INLINE_SYSCALL (pread, 6, fd, buf, count, 0,
-			   __LONG_LONG_PAIR ((off_t) (offset >> 32),
-					     (off_t) (offset & 0xffffffff)));
-#endif
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
 }
 
 weak_alias (__libc_pread64, __pread64)
diff --git a/sysdeps/unix/sysv/linux/mips/pwrite.c b/sysdeps/unix/sysv/linux/mips/pwrite.c
index 2c38e04060..f4d71d4ae8 100644
--- a/sysdeps/unix/sysv/linux/mips/pwrite.c
+++ b/sysdeps/unix/sysv/linux/mips/pwrite.c
@@ -38,35 +38,16 @@
 ssize_t
 __libc_pwrite (int fd, const void *buf, size_t count, off_t offset)
 {
-  ssize_t result;
-
 #if _MIPS_SIM != _ABI64
   assert (sizeof (offset) == 4);
 #endif
 
-  if (SINGLE_THREAD_P)
-    {
-#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
-      result = INLINE_SYSCALL (pwrite, 4, fd, buf, count, offset);
-#else
-      result = INLINE_SYSCALL (pwrite, 6, fd, buf, count, 0,
-			       __LONG_LONG_PAIR (offset >> 31, offset));
-#endif
-      return result;
-    }
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
 #if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
-  result = INLINE_SYSCALL (pwrite, 4, fd, buf, count, offset);
+  return SYSCALL_CANCEL (pwrite, fd, buf, count, offset);
 #else
-  result = INLINE_SYSCALL (pwrite, 6, fd, buf, count, 0,
-			   __LONG_LONG_PAIR (offset >> 31, offset));
+  return SYSCALL_CANCEL (pwrite, fd, buf, count, 0,
+			 __LONG_LONG_PAIR (offset >> 31, offset));
 #endif
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
 }
 
 strong_alias (__libc_pwrite, __pwrite)
diff --git a/sysdeps/unix/sysv/linux/mips/pwrite64.c b/sysdeps/unix/sysv/linux/mips/pwrite64.c
index 504c88aa10..ac0dc408fe 100644
--- a/sysdeps/unix/sysv/linux/mips/pwrite64.c
+++ b/sysdeps/unix/sysv/linux/mips/pwrite64.c
@@ -37,34 +37,13 @@
 ssize_t
 __libc_pwrite64 (int fd, const void *buf, size_t count, off64_t offset)
 {
-  ssize_t result;
-
-  if (SINGLE_THREAD_P)
-    {
 #if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
-      result = INLINE_SYSCALL (pwrite, 4, fd, buf, count, offset);
+  return SYSCALL_CANCEL (pwrite, fd, buf, count, offset);
 #else
-     result = INLINE_SYSCALL (pwrite, 6, fd, buf, count, 0,
-			      __LONG_LONG_PAIR ((off_t) (offset >> 32),
-			     (off_t) (offset & 0xffffffff)));
+  return SYSCALL_CANCEL (pwrite, fd, buf, count, 0,
+			 __LONG_LONG_PAIR ((off_t) (offset >> 32),
+					   (off_t) (offset & 0xffffffff)));
 #endif
-
-     return result;
-    }
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-#if _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64
-  result = INLINE_SYSCALL (pwrite, 4, fd, buf, count, offset);
-#else
-  result = INLINE_SYSCALL (pwrite, 6, fd, buf, count, 0,
-			   __LONG_LONG_PAIR ((off_t) (offset >> 32),
-					     (off_t) (offset & 0xffffffff)));
-#endif
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
 }
 
 weak_alias (__libc_pwrite64, __pwrite64)
diff --git a/sysdeps/unix/sysv/linux/msgrcv.c b/sysdeps/unix/sysv/linux/msgrcv.c
index 1c3698c2f5..660ff29e2b 100644
--- a/sysdeps/unix/sysv/linux/msgrcv.c
+++ b/sysdeps/unix/sysv/linux/msgrcv.c
@@ -43,16 +43,6 @@ __libc_msgrcv (int msqid, void *msgp, size_t msgsz, long int msgtyp,
   tmp.msgp = msgp;
   tmp.msgtyp = msgtyp;
 
-  if (SINGLE_THREAD_P)
-    return INLINE_SYSCALL (ipc, 5, IPCOP_msgrcv, msqid, msgsz, msgflg, &tmp);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  ssize_t result = INLINE_SYSCALL (ipc, 5, IPCOP_msgrcv, msqid, msgsz, msgflg,
-				   &tmp);
-
-   LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (ipc, IPCOP_msgrcv, msqid, msgsz, msgflg, &tmp);
 }
 weak_alias (__libc_msgrcv, msgrcv)
diff --git a/sysdeps/unix/sysv/linux/msgsnd.c b/sysdeps/unix/sysv/linux/msgsnd.c
index d548aab104..dfed53906c 100644
--- a/sysdeps/unix/sysv/linux/msgsnd.c
+++ b/sysdeps/unix/sysv/linux/msgsnd.c
@@ -26,17 +26,7 @@
 int
 __libc_msgsnd (int msqid, const void *msgp, size_t msgsz, int msgflg)
 {
-  if (SINGLE_THREAD_P)
-    return INLINE_SYSCALL (ipc, 5, IPCOP_msgsnd, msqid, msgsz,
-			   msgflg, (void *) msgp);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  int result = INLINE_SYSCALL (ipc, 5, IPCOP_msgsnd, msqid, msgsz,
-			       msgflg, (void *) msgp);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (ipc, IPCOP_msgsnd, msqid, msgsz, msgflg,
+			 (void *) msgp);
 }
 weak_alias (__libc_msgsnd, msgsnd)
diff --git a/sysdeps/unix/sysv/linux/open64.c b/sysdeps/unix/sysv/linux/open64.c
index d3ab813ab6..b90294a582 100644
--- a/sysdeps/unix/sysv/linux/open64.c
+++ b/sysdeps/unix/sysv/linux/open64.c
@@ -36,16 +36,7 @@ __libc_open64 (const char *file, int oflag, ...)
       va_end (arg);
     }
 
-  if (SINGLE_THREAD_P)
-    return INLINE_SYSCALL (open, 3, file, oflag | O_LARGEFILE, mode);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  int result = INLINE_SYSCALL (open, 3, file, oflag | O_LARGEFILE, mode);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (open, file, oflag | O_LARGEFILE, mode);
 }
 weak_alias (__libc_open64, __open64)
 libc_hidden_weak (__open64)
diff --git a/sysdeps/unix/sysv/linux/openat.c b/sysdeps/unix/sysv/linux/openat.c
index 30d8e6e1ac..677712330e 100644
--- a/sysdeps/unix/sysv/linux/openat.c
+++ b/sysdeps/unix/sysv/linux/openat.c
@@ -68,16 +68,7 @@ __OPENAT (int fd, const char *file, int oflag, ...)
       va_end (arg);
     }
 
-  if (SINGLE_THREAD_P)
-    return OPENAT_NOT_CANCEL (fd, file, oflag, mode);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  int res = OPENAT_NOT_CANCEL (fd, file, oflag, mode);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return res;
+  return SYSCALL_CANCEL (openat, fd, file, oflag, mode);
 }
 libc_hidden_def (__OPENAT)
 weak_alias (__OPENAT, OPENAT)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread.c
index 10763f563d..f6b7f43f3f 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread.c
@@ -26,26 +26,8 @@
 ssize_t
 __libc_pread (int fd, void *buf, size_t count, off_t offset)
 {
-  ssize_t result;
-
-  if (SINGLE_THREAD_P)
-    {
-      /* On PPC32 64bit values are aligned in odd/even register pairs.  */
-      result = INLINE_SYSCALL (pread, 6, fd, buf, count,
-			       0, offset >> 31, offset);
-
-      return result;
-    }
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
   /* On PPC32 64bit values are aligned in odd/even register pairs.  */
-  result = INLINE_SYSCALL (pread, 6, fd, buf, count,
-			       0, offset >> 31, offset);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (pread, fd, buf, count, 0, offset >> 31, offset);
 }
 
 strong_alias (__libc_pread, __pread)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread64.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread64.c
index f3dc7e5618..75ee34bcce 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread64.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/pread64.c
@@ -26,28 +26,9 @@
 ssize_t
 __libc_pread64 (int fd, void *buf, size_t count, off64_t offset)
 {
-  ssize_t result;
-
-  if (SINGLE_THREAD_P)
-    {
-      /* On PPC32 64bit values are aligned in odd/even register pairs.  */
-      result = INLINE_SYSCALL (pread, 6, fd, buf, count,
-			       0, (long) (offset >> 32),
-			       (long) offset);
-
-      return result;
-    }
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
   /* On PPC32 64bit values are aligned in odd/even register pairs.  */
-  result = INLINE_SYSCALL (pread, 6, fd, buf, count,
-			   0, (long) (offset >> 32),
-			   (long) offset);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (pread, fd, buf, count, 0, (long) (offset >> 32),
+			 (long) offset);
 }
 
 weak_alias (__libc_pread64, __pread64)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite.c
index 65109ed54c..fc822d7c8d 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite.c
@@ -27,26 +27,8 @@
 ssize_t
 __libc_pwrite (int fd, const void *buf, size_t count, off_t offset)
 {
-  ssize_t result;
-
-  if (SINGLE_THREAD_P)
-    {
-      /* On PPC32 64bit values are aligned in odd/even register pairs.  */
-      result = INLINE_SYSCALL (pwrite, 6, fd, buf, count,
-			       0, offset >> 31, offset);
-
-      return result;
-    }
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
   /* On PPC32 64bit values are aligned in odd/even register pairs.  */
-  result = INLINE_SYSCALL (pwrite, 6, fd, buf, count,
-			   0, offset >> 31, offset);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (pwrite, fd, buf, count, 0, offset >> 31, offset);
 }
 
 strong_alias (__libc_pwrite, __pwrite)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite64.c b/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite64.c
index 77749c98b0..dbeaed8775 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite64.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite64.c
@@ -26,28 +26,9 @@
 ssize_t
 __libc_pwrite64 (int fd, const void *buf, size_t count, off64_t offset)
 {
-  ssize_t result;
-
-  if (SINGLE_THREAD_P)
-    {
   /* On PPC32 64bit values are aligned in odd/even register pairs.  */
-      result = INLINE_SYSCALL (pwrite, 6, fd, buf, count,
-			       0, (long) (offset >> 32),
-			       (long) offset);
-
-      return result;
-    }
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  /* On PPC32 64bit values are aligned in odd/even register pairs.  */
-  result = INLINE_SYSCALL (pwrite, 6, fd, buf, count,
-			   0, (long) (offset >> 32),
-			   (long) offset);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (pwrite, fd, buf, count, 0, (long) (offset >> 32),
+			 (long) offset);
 }
 
 weak_alias (__libc_pwrite64, __pwrite64)
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/fcntl.c b/sysdeps/unix/sysv/linux/powerpc/powerpc64/fcntl.c
index a4f90b6695..69031bad94 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/fcntl.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/fcntl.c
@@ -53,16 +53,10 @@ __libc_fcntl (int fd, int cmd, ...)
   if (cmd >= F_GETLK64 && cmd <= F_SETLKW64)
     cmd -= F_GETLK64 - F_GETLK;
 
-  if (SINGLE_THREAD_P || cmd != F_SETLKW)
+  if (cmd != F_SETLKW)
     return INLINE_SYSCALL (fcntl, 3, fd, cmd, arg);
 
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  int result = INLINE_SYSCALL (fcntl, 3, fd, cmd, arg);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (fcntl, fd, cmd, arg);
 }
 libc_hidden_def (__libc_fcntl)
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sync_file_range.c b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sync_file_range.c
index 18bb0dd478..9f46458581 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/sync_file_range.c
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/sync_file_range.c
@@ -28,17 +28,7 @@
 int
 sync_file_range (int fd, __off64_t from, __off64_t to, unsigned int flags)
 {
-  if (SINGLE_THREAD_P)
-    return INLINE_SYSCALL (sync_file_range2, 4, fd, flags, from, to);
-
-  int result;
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  result = INLINE_SYSCALL (sync_file_range2, 4, fd, flags, from, to);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (sync_file_range2, fd, flags, from, to);
 }
 #else
 int
diff --git a/sysdeps/unix/sysv/linux/ppoll.c b/sysdeps/unix/sysv/linux/ppoll.c
index 6e83424318..77a2e7e17c 100644
--- a/sysdeps/unix/sysv/linux/ppoll.c
+++ b/sysdeps/unix/sysv/linux/ppoll.c
@@ -47,17 +47,7 @@ ppoll (struct pollfd *fds, nfds_t nfds, const struct timespec *timeout,
 
   int result;
 
-  if (SINGLE_THREAD_P)
-    result = INLINE_SYSCALL (ppoll, 5, fds, nfds, timeout, sigmask, _NSIG / 8);
-  else
-    {
-      int oldtype = LIBC_CANCEL_ASYNC ();
-
-      result = INLINE_SYSCALL (ppoll, 5, fds, nfds, timeout, sigmask,
-			       _NSIG / 8);
-
-      LIBC_CANCEL_RESET (oldtype);
-    }
+  result = SYSCALL_CANCEL (ppoll, fds, nfds, timeout, sigmask, _NSIG / 8);
 
 # ifndef __ASSUME_PPOLL
   if (result == -1 && errno == ENOSYS)
diff --git a/sysdeps/unix/sysv/linux/pread.c b/sysdeps/unix/sysv/linux/pread.c
index 5c1b174382..09389e477a 100644
--- a/sysdeps/unix/sysv/linux/pread.c
+++ b/sysdeps/unix/sysv/linux/pread.c
@@ -32,36 +32,17 @@
 #endif
 
 
-static ssize_t
-#ifdef NO_CANCELLATION
-inline __attribute ((always_inline))
-#endif
-do_pread (int fd, void *buf, size_t count, off_t offset)
+ssize_t
+__libc_pread (int fd, void *buf, size_t count, off_t offset)
 {
   ssize_t result;
 
   assert (sizeof (offset) == 4);
-  result = INLINE_SYSCALL (pread, 5, fd, buf, count,
+  result = SYSCALL_CANCEL (pread, fd, buf, count,
 			   __LONG_LONG_PAIR (offset >> 31, offset));
 
   return result;
 }
 
-
-ssize_t
-__libc_pread (int fd, void *buf, size_t count, off_t offset)
-{
-  if (SINGLE_THREAD_P)
-    return do_pread (fd, buf, count, offset);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  ssize_t result = do_pread (fd, buf, count, offset);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
-}
-
 strong_alias (__libc_pread, __pread)
 weak_alias (__libc_pread, pread)
diff --git a/sysdeps/unix/sysv/linux/pread64.c b/sysdeps/unix/sysv/linux/pread64.c
index a8cfb5ddf9..baf23555f0 100644
--- a/sysdeps/unix/sysv/linux/pread64.c
+++ b/sysdeps/unix/sysv/linux/pread64.c
@@ -31,32 +31,12 @@
 #endif
 
 
-static ssize_t
-do_pread64 (int fd, void *buf, size_t count, off64_t offset)
-{
-  ssize_t result;
-
-  result = INLINE_SYSCALL (pread, 5, fd, buf, count,
-			   __LONG_LONG_PAIR ((off_t) (offset >> 32),
-					     (off_t) (offset & 0xffffffff)));
-
-  return result;
-}
-
-
 ssize_t
 __libc_pread64 (int fd, void *buf, size_t count, off64_t offset)
 {
-  if (SINGLE_THREAD_P)
-    return do_pread64 (fd, buf, count, offset);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  ssize_t result = do_pread64 (fd, buf, count, offset);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (pread, fd, buf, count,
+			 __LONG_LONG_PAIR ((off_t) (offset >> 32),
+					   (off_t) (offset & 0xffffffff)));
 }
 
 weak_alias (__libc_pread64, __pread64)
diff --git a/sysdeps/unix/sysv/linux/preadv.c b/sysdeps/unix/sysv/linux/preadv.c
index 091f9a7dc9..2d08be4035 100644
--- a/sysdeps/unix/sysv/linux/preadv.c
+++ b/sysdeps/unix/sysv/linux/preadv.c
@@ -53,18 +53,8 @@ PREADV (int fd, const struct iovec *vector, int count, OFF_T offset)
 #ifdef __NR_preadv
   ssize_t result;
 
-  if (SINGLE_THREAD_P)
-    result = INLINE_SYSCALL (preadv, 5, fd, vector, count,
-			     LO_HI_LONG (offset));
-  else
-    {
-      int oldtype = LIBC_CANCEL_ASYNC ();
-
-      result = INLINE_SYSCALL (preadv, 5, fd, vector, count,
-			       LO_HI_LONG (offset));
-
-      LIBC_CANCEL_RESET (oldtype);
-    }
+  result = SYSCALL_CANCEL (preadv, fd, vector, count, LO_HI_LONG (offset));
+
 # ifdef __ASSUME_PREADV
   return result;
 # endif
diff --git a/sysdeps/unix/sysv/linux/pselect.c b/sysdeps/unix/sysv/linux/pselect.c
index f342a137da..30d51d7902 100644
--- a/sysdeps/unix/sysv/linux/pselect.c
+++ b/sysdeps/unix/sysv/linux/pselect.c
@@ -63,22 +63,11 @@ __pselect (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
 
 #ifndef CALL_PSELECT6
 # define CALL_PSELECT6(nfds, readfds, writefds, exceptfds, timeout, data) \
-  INLINE_SYSCALL (pselect6, 6, nfds, readfds, writefds, exceptfds,	      \
-		  timeout, data)
+  SYSCALL_CANCEL (pselect6, nfds, readfds, writefds, exceptfds,	timeout, data)
 #endif
 
-  if (SINGLE_THREAD_P)
-    result = CALL_PSELECT6 (nfds, readfds, writefds, exceptfds, timeout,
-			    &data);
-  else
-    {
-      int oldtype = LIBC_CANCEL_ASYNC ();
-
-      result = CALL_PSELECT6 (nfds, readfds, writefds, exceptfds, timeout,
-			      &data);
-
-      LIBC_CANCEL_RESET (oldtype);
-    }
+  result = CALL_PSELECT6 (nfds, readfds, writefds, exceptfds, timeout,
+			  &data);
 
 # ifndef __ASSUME_PSELECT
   if (result == -1 && errno == ENOSYS)
diff --git a/sysdeps/unix/sysv/linux/pwrite.c b/sysdeps/unix/sysv/linux/pwrite.c
index 80c2e22ebf..b77985d2d1 100644
--- a/sysdeps/unix/sysv/linux/pwrite.c
+++ b/sysdeps/unix/sysv/linux/pwrite.c
@@ -32,36 +32,17 @@
 #endif
 
 
-static ssize_t
-#ifdef NO_CANCELLATION
-inline __attribute ((always_inline))
-#endif
-do_pwrite (int fd, const void *buf, size_t count, off_t offset)
+ssize_t
+__libc_pwrite (int fd, const void *buf, size_t count, off_t offset)
 {
   ssize_t result;
 
   assert (sizeof (offset) == 4);
-  result = INLINE_SYSCALL (pwrite, 5, fd, buf, count,
+  result = SYSCALL_CANCEL (pwrite, fd, buf, count,
 			   __LONG_LONG_PAIR (offset >> 31, offset));
 
   return result;
 }
 
-
-ssize_t
-__libc_pwrite (int fd, const void *buf, size_t count, off_t offset)
-{
-  if (SINGLE_THREAD_P)
-    return do_pwrite (fd, buf, count, offset);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  ssize_t result = do_pwrite (fd, buf, count, offset);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
-}
-
 strong_alias (__libc_pwrite, __pwrite)
 weak_alias (__libc_pwrite, pwrite)
diff --git a/sysdeps/unix/sysv/linux/pwrite64.c b/sysdeps/unix/sysv/linux/pwrite64.c
index 7fce75a432..a5d0fb7a02 100644
--- a/sysdeps/unix/sysv/linux/pwrite64.c
+++ b/sysdeps/unix/sysv/linux/pwrite64.c
@@ -31,34 +31,13 @@
 #endif
 
 
-static ssize_t
-do_pwrite64 (int fd, const void *buf, size_t count, off64_t offset)
-{
-  ssize_t result;
-
-  result = INLINE_SYSCALL (pwrite, 5, fd, buf, count,
-			   __LONG_LONG_PAIR ((off_t) (offset >> 32),
-					     (off_t) (offset & 0xffffffff)));
-
-  return result;
-}
-
-
 ssize_t
 __libc_pwrite64 (int fd, const void *buf, size_t count, off64_t offset)
 {
-  if (SINGLE_THREAD_P)
-    return do_pwrite64 (fd, buf, count, offset);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  ssize_t result = do_pwrite64 (fd, buf, count, offset);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (pwrite, fd, buf, count,
+			 __LONG_LONG_PAIR ((off_t) (offset >> 32),
+					   (off_t) (offset & 0xffffffff)));
 }
-
 weak_alias (__libc_pwrite64, __pwrite64)
 libc_hidden_weak (__pwrite64)
 weak_alias (__libc_pwrite64, pwrite64)
diff --git a/sysdeps/unix/sysv/linux/pwritev.c b/sysdeps/unix/sysv/linux/pwritev.c
index 91e58b54ba..7aa92387ec 100644
--- a/sysdeps/unix/sysv/linux/pwritev.c
+++ b/sysdeps/unix/sysv/linux/pwritev.c
@@ -53,18 +53,8 @@ PWRITEV (int fd, const struct iovec *vector, int count, OFF_T offset)
 #ifdef __NR_pwritev
   ssize_t result;
 
-  if (SINGLE_THREAD_P)
-    result = INLINE_SYSCALL (pwritev, 5, fd, vector, count,
-			     LO_HI_LONG (offset));
-  else
-    {
-      int oldtype = LIBC_CANCEL_ASYNC ();
-
-      result = INLINE_SYSCALL (pwritev, 5, fd, vector, count,
-			     LO_HI_LONG (offset));
-
-      LIBC_CANCEL_RESET (oldtype);
-    }
+  result = SYSCALL_CANCEL (pwritev, fd, vector, count, LO_HI_LONG (offset));
+
 # ifdef __ASSUME_PWRITEV
   return result;
 # endif
diff --git a/sysdeps/unix/sysv/linux/recvmmsg.c b/sysdeps/unix/sysv/linux/recvmmsg.c
index 1f9f04d360..8c6cf2c700 100644
--- a/sysdeps/unix/sysv/linux/recvmmsg.c
+++ b/sysdeps/unix/sysv/linux/recvmmsg.c
@@ -37,16 +37,7 @@ int
 recvmmsg (int fd, struct mmsghdr *vmessages, unsigned int vlen, int flags,
 	  struct timespec *tmo)
 {
-  if (SINGLE_THREAD_P)
-    return INLINE_SYSCALL (recvmmsg, 5, fd, vmessages, vlen, flags, tmo);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  int result = INLINE_SYSCALL (recvmmsg, 5, fd, vmessages, vlen, flags, tmo);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (recvmmsg, fd, vmessages, vlen, flags, tmo);
 }
 #elif defined __NR_socketcall
 # include <socketcall.h>
diff --git a/sysdeps/unix/sysv/linux/sendmmsg.c b/sysdeps/unix/sysv/linux/sendmmsg.c
index e535cc0207..67b7ca9bfc 100644
--- a/sysdeps/unix/sysv/linux/sendmmsg.c
+++ b/sysdeps/unix/sysv/linux/sendmmsg.c
@@ -36,16 +36,7 @@
 int
 __sendmmsg (int fd, struct mmsghdr *vmessages, unsigned int vlen, int flags)
 {
-  if (SINGLE_THREAD_P)
-    return INLINE_SYSCALL (sendmmsg, 4, fd, vmessages, vlen, flags);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  int result = INLINE_SYSCALL (sendmmsg, 4, fd, vmessages, vlen, flags);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (sendmmsg, fd, vmessages, vlen, flags);
 }
 libc_hidden_def (__sendmmsg)
 weak_alias (__sendmmsg, sendmmsg)
diff --git a/sysdeps/unix/sysv/linux/sh/pread.c b/sysdeps/unix/sysv/linux/sh/pread.c
index 9d4b5de751..2f926b3305 100644
--- a/sysdeps/unix/sysv/linux/sh/pread.c
+++ b/sysdeps/unix/sysv/linux/sh/pread.c
@@ -35,23 +35,8 @@
 ssize_t
 __libc_pread (int fd, void *buf, size_t count, off_t offset)
 {
-  ssize_t result;
-
-  if (SINGLE_THREAD_P)
-    {
-      result = INLINE_SYSCALL (pread, 6, fd, buf, count, 0,
-			       __LONG_LONG_PAIR (offset >> 31, offset));
-      return result;
-    }
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  result = INLINE_SYSCALL (pread, 6, fd, buf, count, 0,
-			   __LONG_LONG_PAIR (offset >> 31, offset));
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (pread, fd, buf, count, 0,
+			 __LONG_LONG_PAIR (offset >> 31, offset));
 }
 
 strong_alias (__libc_pread, __pread)
diff --git a/sysdeps/unix/sysv/linux/sh/pread64.c b/sysdeps/unix/sysv/linux/sh/pread64.c
index 195eacc29a..697718d41b 100644
--- a/sysdeps/unix/sysv/linux/sh/pread64.c
+++ b/sysdeps/unix/sysv/linux/sh/pread64.c
@@ -34,25 +34,9 @@
 ssize_t
 __libc_pread64 (int fd, void *buf, size_t count, off64_t offset)
 {
-  ssize_t result;
-
-  if (SINGLE_THREAD_P)
-    {
-     result = INLINE_SYSCALL (pread, 6, fd, buf, count, 0,
-			      __LONG_LONG_PAIR ((off_t) (offset >> 32),
-			      (off_t) (offset & 0xffffffff)));
-     return result;
-    }
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  result = INLINE_SYSCALL (pread, 6, fd, buf, count, 0,
-			   __LONG_LONG_PAIR ((off_t) (offset >> 32),
-					     (off_t) (offset & 0xffffffff)));
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (pread, fd, buf, count, 0,
+			 __LONG_LONG_PAIR ((off_t) (offset >> 32),
+					   (off_t) (offset & 0xffffffff)));
 }
 
 weak_alias (__libc_pread64, __pread64)
diff --git a/sysdeps/unix/sysv/linux/sh/pwrite.c b/sysdeps/unix/sysv/linux/sh/pwrite.c
index c187d0a732..fcbb7fc94f 100644
--- a/sysdeps/unix/sysv/linux/sh/pwrite.c
+++ b/sysdeps/unix/sysv/linux/sh/pwrite.c
@@ -35,23 +35,8 @@
 ssize_t
 __libc_pwrite (int fd, const void *buf, size_t count, off_t offset)
 {
-  ssize_t result;
-
-  if (SINGLE_THREAD_P)
-    {
-      result = INLINE_SYSCALL (pwrite, 6, fd, buf, count, 0,
-			       __LONG_LONG_PAIR (offset >> 31, offset));
-      return result;
-    }
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  result = INLINE_SYSCALL (pwrite, 6, fd, buf, count, 0,
-			   __LONG_LONG_PAIR (offset >> 31, offset));
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (pwrite, fd, buf, count, 0,
+			 __LONG_LONG_PAIR (offset >> 31, offset));
 }
 
 strong_alias (__libc_pwrite, __pwrite)
diff --git a/sysdeps/unix/sysv/linux/sh/pwrite64.c b/sysdeps/unix/sysv/linux/sh/pwrite64.c
index 0d15ca21e8..0c189feb0b 100644
--- a/sysdeps/unix/sysv/linux/sh/pwrite64.c
+++ b/sysdeps/unix/sysv/linux/sh/pwrite64.c
@@ -34,26 +34,9 @@
 ssize_t
 __libc_pwrite64 (int fd, const void *buf, size_t count, off64_t offset)
 {
-  ssize_t result;
-
-  if (SINGLE_THREAD_P)
-    {
-     result = INLINE_SYSCALL (pwrite, 6, fd, buf, count, 0,
-			      __LONG_LONG_PAIR ((off_t) (offset >> 32),
-			     (off_t) (offset & 0xffffffff)));
-
-     return result;
-    }
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  result = INLINE_SYSCALL (pwrite, 6, fd, buf, count, 0,
-			   __LONG_LONG_PAIR ((off_t) (offset >> 32),
-					     (off_t) (offset & 0xffffffff)));
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (pwrite, fd, buf, count, 0,
+			 __LONG_LONG_PAIR ((off_t) (offset >> 32),
+					   (off_t) (offset & 0xffffffff)));
 }
 
 weak_alias (__libc_pwrite64, __pwrite64)
diff --git a/sysdeps/unix/sysv/linux/sigsuspend.c b/sysdeps/unix/sysv/linux/sigsuspend.c
index 89c5d65d22..9047623972 100644
--- a/sysdeps/unix/sysv/linux/sigsuspend.c
+++ b/sysdeps/unix/sysv/linux/sigsuspend.c
@@ -22,38 +22,13 @@
 #include <sysdep-cancel.h>
 #include <sys/syscall.h>
 
-
-static inline int __attribute__ ((always_inline))
-do_sigsuspend (const sigset_t *set)
-{
-  return INLINE_SYSCALL (rt_sigsuspend, 2, set, _NSIG / 8);
-}
-
 /* Change the set of blocked signals to SET,
    wait until a signal arrives, and restore the set of blocked signals.  */
 int
 __sigsuspend (const sigset_t *set)
 {
-  if (SINGLE_THREAD_P)
-    return do_sigsuspend (set);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  int result = do_sigsuspend (set);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (rt_sigsuspend, set, _NSIG / 8);
 }
 libc_hidden_def (__sigsuspend)
 weak_alias (__sigsuspend, sigsuspend)
 strong_alias (__sigsuspend, __libc_sigsuspend)
-
-#ifndef NO_CANCELLATION
-int
-__sigsuspend_nocancel (set)
-     const sigset_t *set;
-{
-  return do_sigsuspend (set);
-}
-#endif
diff --git a/sysdeps/unix/sysv/linux/sigtimedwait.c b/sysdeps/unix/sysv/linux/sigtimedwait.c
index 209198ea14..a2e5b4129b 100644
--- a/sysdeps/unix/sysv/linux/sigtimedwait.c
+++ b/sysdeps/unix/sysv/linux/sigtimedwait.c
@@ -25,9 +25,9 @@
 
 #ifdef __NR_rt_sigtimedwait
 
-static int
-do_sigtimedwait (const sigset_t *set, siginfo_t *info,
-		 const struct timespec *timeout)
+int
+__sigtimedwait (const sigset_t *set, siginfo_t *info,
+		const struct timespec *timeout)
 {
 #ifdef SIGCANCEL
   sigset_t tmpset;
@@ -51,8 +51,7 @@ do_sigtimedwait (const sigset_t *set, siginfo_t *info,
 
     /* XXX The size argument hopefully will have to be changed to the
        real size of the user-level sigset_t.  */
-  int result = INLINE_SYSCALL (rt_sigtimedwait, 4, set,
-			       info, timeout, _NSIG / 8);
+  int result = SYSCALL_CANCEL (rt_sigtimedwait, set, info, timeout, _NSIG / 8);
 
   /* The kernel generates a SI_TKILL code in si_code in case tkill is
      used.  tkill is transparently used in raise().  Since having
@@ -63,26 +62,6 @@ do_sigtimedwait (const sigset_t *set, siginfo_t *info,
 
   return result;
 }
-
-
-/* Return any pending signal or wait for one for the given time.  */
-int
-__sigtimedwait (const sigset_t *set, siginfo_t *info,
-		const struct timespec *timeout)
-{
-  if (SINGLE_THREAD_P)
-    return do_sigtimedwait (set, info, timeout);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  /* XXX The size argument hopefully will have to be changed to the
-     real size of the user-level sigset_t.  */
-  int result = do_sigtimedwait (set, info, timeout);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
-}
 libc_hidden_def (__sigtimedwait)
 weak_alias (__sigtimedwait, sigtimedwait)
 #else
diff --git a/sysdeps/unix/sysv/linux/sigwaitinfo.c b/sysdeps/unix/sysv/linux/sigwaitinfo.c
index fe23c9fe06..47e6dd6bdd 100644
--- a/sysdeps/unix/sysv/linux/sigwaitinfo.c
+++ b/sysdeps/unix/sysv/linux/sigwaitinfo.c
@@ -27,8 +27,9 @@
 
 #ifdef __NR_rt_sigtimedwait
 
-static int
-do_sigwaitinfo (const sigset_t *set, siginfo_t *info)
+/* Return any pending signal or wait for one for the given time.  */
+int
+__sigwaitinfo (const sigset_t *set, siginfo_t *info)
 {
 #ifdef SIGCANCEL
   sigset_t tmpset;
@@ -52,8 +53,7 @@ do_sigwaitinfo (const sigset_t *set, siginfo_t *info)
 
   /* XXX The size argument hopefully will have to be changed to the
      real size of the user-level sigset_t.  */
-  int result = INLINE_SYSCALL (rt_sigtimedwait, 4, set,
-			       info, NULL, _NSIG / 8);
+  int result = SYSCALL_CANCEL (rt_sigtimedwait, set, info, NULL, _NSIG / 8);
 
   /* The kernel generates a SI_TKILL code in si_code in case tkill is
      used.  tkill is transparently used in raise().  Since having
@@ -65,24 +65,6 @@ do_sigwaitinfo (const sigset_t *set, siginfo_t *info)
   return result;
 }
 
-
-/* Return any pending signal or wait for one for the given time.  */
-int
-__sigwaitinfo (const sigset_t *set, siginfo_t *info)
-{
-  if (SINGLE_THREAD_P)
-    return do_sigwaitinfo (set, info);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  /* XXX The size argument hopefully will have to be changed to the
-     real size of the user-level sigset_t.  */
-  int result = do_sigwaitinfo (set, info);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
-}
 libc_hidden_def (__sigwaitinfo)
 weak_alias (__sigwaitinfo, sigwaitinfo)
 #else
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c b/sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c
index 892806046f..169ac532b3 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/msgrcv.c
@@ -26,17 +26,7 @@ ssize_t
 __libc_msgrcv (int msqid, void *msgp, size_t msgsz, long int msgtyp,
 	       int msgflg)
 {
-  if (SINGLE_THREAD_P)
-    return INLINE_SYSCALL (ipc, 6, IPCOP_msgrcv, msqid, msgsz, msgflg,
-			   msgp, msgtyp);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  ssize_t result = INLINE_SYSCALL (ipc, 6, IPCOP_msgrcv, msqid, msgsz, msgflg,
-				   msgp, msgtyp);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (ipc, IPCOP_msgrcv, msqid, msgsz, msgflg,
+			 msgp, msgtyp);
 }
 weak_alias (__libc_msgrcv, msgrcv)
diff --git a/sysdeps/unix/sysv/linux/sync_file_range.c b/sysdeps/unix/sysv/linux/sync_file_range.c
index c07ece0f70..2ea6dcfbe6 100644
--- a/sysdeps/unix/sysv/linux/sync_file_range.c
+++ b/sysdeps/unix/sysv/linux/sync_file_range.c
@@ -28,43 +28,18 @@
 int
 sync_file_range (int fd, __off64_t from, __off64_t to, unsigned int flags)
 {
-  if (SINGLE_THREAD_P)
-    return INLINE_SYSCALL (sync_file_range, 6, fd,
-			   __LONG_LONG_PAIR ((long) (from >> 32), (long) from),
-			   __LONG_LONG_PAIR ((long) (to >> 32), (long) to),
-			   flags);
-
-  int result;
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  result = INLINE_SYSCALL (sync_file_range, 6, fd,
-			   __LONG_LONG_PAIR ((long) (from >> 32), (long) from),
-			   __LONG_LONG_PAIR ((long) (to >> 32), (long) to),
-			   flags);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (sync_file_range, fd,
+			 __LONG_LONG_PAIR ((long) (from >> 32), (long) from),
+			 __LONG_LONG_PAIR ((long) (to >> 32), (long) to),
+			 flags);
 }
 #elif defined __NR_sync_file_range2
 int
 sync_file_range (int fd, __off64_t from, __off64_t to, unsigned int flags)
 {
-  if (SINGLE_THREAD_P)
-    return INLINE_SYSCALL (sync_file_range2, 6, fd, flags,
-			   __LONG_LONG_PAIR ((long) (from >> 32), (long) from),
-			   __LONG_LONG_PAIR ((long) (to >> 32), (long) to));
-
-  int result;
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  result = INLINE_SYSCALL (sync_file_range2, 6, fd, flags,
-			   __LONG_LONG_PAIR ((long) (from >> 32), (long) from),
-			   __LONG_LONG_PAIR ((long) (to >> 32), (long) to));
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (sync_file_range2, fd, flags,
+			 __LONG_LONG_PAIR ((long) (from >> 32), (long) from),
+			 __LONG_LONG_PAIR ((long) (to >> 32), (long) to));
 }
 #else
 int
diff --git a/sysdeps/unix/sysv/linux/tcdrain.c b/sysdeps/unix/sysv/linux/tcdrain.c
index c0f2e1d83f..f60dd4ddb4 100644
--- a/sysdeps/unix/sysv/linux/tcdrain.c
+++ b/sysdeps/unix/sysv/linux/tcdrain.c
@@ -24,17 +24,7 @@
 int
 __libc_tcdrain (int fd)
 {
-  if (SINGLE_THREAD_P)
-    /* With an argument of 1, TCSBRK for output to be drain.  */
-    return INLINE_SYSCALL (ioctl, 3, fd, TCSBRK, 1);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
   /* With an argument of 1, TCSBRK for output to be drain.  */
-  int result = INLINE_SYSCALL (ioctl, 3, fd, TCSBRK, 1);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (ioctl, fd, TCSBRK, 1);
 }
 weak_alias (__libc_tcdrain, tcdrain)
diff --git a/sysdeps/unix/sysv/linux/timer_routines.c b/sysdeps/unix/sysv/linux/timer_routines.c
index 4401a8b3d0..4cf6ecae70 100644
--- a/sysdeps/unix/sysv/linux/timer_routines.c
+++ b/sysdeps/unix/sysv/linux/timer_routines.c
@@ -20,7 +20,7 @@
 #include <setjmp.h>
 #include <signal.h>
 #include <stdbool.h>
-#include <sysdep.h>
+#include <sysdep-cancel.h>
 #include <nptl/pthreadP.h>
 #include "kernel-posix-timers.h"
 
@@ -84,14 +84,9 @@ timer_helper_thread (void *arg)
       /* sigwaitinfo cannot be used here, since it deletes
 	 SIGCANCEL == SIGTIMER from the set.  */
 
-      int oldtype = LIBC_CANCEL_ASYNC ();
-
       /* XXX The size argument hopefully will have to be changed to the
 	 real size of the user-level sigset_t.  */
-      int result = INLINE_SYSCALL (rt_sigtimedwait, 4, &ss, &si, NULL,
-				   _NSIG / 8);
-
-      LIBC_CANCEL_RESET (oldtype);
+      int result = SYSCALL_CANCEL (rt_sigtimedwait, &ss, &si, NULL, _NSIG / 8);
 
       if (result > 0)
 	{
diff --git a/sysdeps/unix/sysv/linux/wait.c b/sysdeps/unix/sysv/linux/wait.c
index 029d97516e..5b76c7c8ed 100644
--- a/sysdeps/unix/sysv/linux/wait.c
+++ b/sysdeps/unix/sysv/linux/wait.c
@@ -26,17 +26,8 @@
 pid_t
 __libc_wait (__WAIT_STATUS_DEFN stat_loc)
 {
-  if (SINGLE_THREAD_P)
-    return INLINE_SYSCALL (wait4, 4, WAIT_ANY, stat_loc, 0,
-			   (struct rusage *) NULL);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  pid_t result = INLINE_SYSCALL (wait4, 4, WAIT_ANY, stat_loc, 0,
+  pid_t result = SYSCALL_CANCEL (wait4, WAIT_ANY, stat_loc, 0,
 				 (struct rusage *) NULL);
-
-  LIBC_CANCEL_RESET (oldtype);
-
   return result;
 }
 
diff --git a/sysdeps/unix/sysv/linux/waitid.c b/sysdeps/unix/sysv/linux/waitid.c
index 12d5702b5a..71d3a5a357 100644
--- a/sysdeps/unix/sysv/linux/waitid.c
+++ b/sysdeps/unix/sysv/linux/waitid.c
@@ -19,15 +19,14 @@
 #include <stddef.h>
 #include <errno.h>
 #include <sys/wait.h>
-#include <sysdep.h>
+#include <sysdep-cancel.h>
 
-static inline int
-do_waitid (idtype_t idtype, id_t id, siginfo_t *infop, int options)
+int
+__waitid (idtype_t idtype, id_t id, siginfo_t *infop, int options)
 {
   /* The unused fifth argument is a `struct rusage *' that we could
      pass if we were using waitid to simulate wait3/wait4.  */
-  return INLINE_SYSCALL (waitid, 5, idtype, id, infop, options, NULL);
+  return SYSCALL_CANCEL (waitid, idtype, id, infop, options, NULL);
 }
-#define NO_DO_WAITID
-
-#include "sysdeps/posix/waitid.c"
+weak_alias (__waitid, waitid)
+strong_alias (__waitid, __libc_waitid)
diff --git a/sysdeps/unix/sysv/linux/waitpid.c b/sysdeps/unix/sysv/linux/waitpid.c
index 0d780da528..59d0c9e0bb 100644
--- a/sysdeps/unix/sysv/linux/waitpid.c
+++ b/sysdeps/unix/sysv/linux/waitpid.c
@@ -23,26 +23,11 @@
 __pid_t
 __waitpid (__pid_t pid, int *stat_loc, int options)
 {
-  if (SINGLE_THREAD_P)
-    {
 #ifdef __NR_waitpid
-      return INLINE_SYSCALL (waitpid, 3, pid, stat_loc, options);
+  return SYSCALL_CANCEL (waitpid, pid, stat_loc, options);
 #else
-      return INLINE_SYSCALL (wait4, 4, pid, stat_loc, options, NULL);
+  return SYSCALL_CANCEL (wait4, pid, stat_loc, options, NULL);
 #endif
-    }
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-#ifdef __NR_waitpid
-  int result = INLINE_SYSCALL (waitpid, 3, pid, stat_loc, options);
-#else
-  int result = INLINE_SYSCALL (wait4, 4, pid, stat_loc, options, NULL);
-#endif
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
 }
 libc_hidden_def (__waitpid)
 weak_alias (__waitpid, waitpid)
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/fallocate.c b/sysdeps/unix/sysv/linux/wordsize-64/fallocate.c
index c723fef165..627ac2aa3c 100644
--- a/sysdeps/unix/sysv/linux/wordsize-64/fallocate.c
+++ b/sysdeps/unix/sysv/linux/wordsize-64/fallocate.c
@@ -25,17 +25,7 @@ int
 fallocate (int fd, int mode, __off_t offset, __off_t len)
 {
 #ifdef __NR_fallocate
-  if (SINGLE_THREAD_P)
-    return INLINE_SYSCALL (fallocate, 4, fd, mode, offset, len);
-
-  int result;
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  result = INLINE_SYSCALL (fallocate, 4, fd, mode, offset, len);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (fallocate, fd, mode, offset, len);
 #else
   __set_errno (ENOSYS);
   return -1;
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/preadv.c b/sysdeps/unix/sysv/linux/wordsize-64/preadv.c
index 9b3ae700ad..5e22c4b5c9 100644
--- a/sysdeps/unix/sysv/linux/wordsize-64/preadv.c
+++ b/sysdeps/unix/sysv/linux/wordsize-64/preadv.c
@@ -38,16 +38,7 @@ preadv (int fd, const struct iovec *vector, int count, off_t offset)
 #ifdef __NR_preadv
   ssize_t result;
 
-  if (SINGLE_THREAD_P)
-    result = INLINE_SYSCALL (preadv, 4, fd, vector, count, offset);
-  else
-    {
-      int oldtype = LIBC_CANCEL_ASYNC ();
-
-      result = INLINE_SYSCALL (preadv, 4, fd, vector, count, offset);
-
-      LIBC_CANCEL_RESET (oldtype);
-    }
+  result = SYSCALL_CANCEL (preadv, fd, vector, count, offset);
 # ifdef __ASSUME_PREADV
   return result;
 # endif
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/pwritev.c b/sysdeps/unix/sysv/linux/wordsize-64/pwritev.c
index 960c8c0f5d..ccf96dd65e 100644
--- a/sysdeps/unix/sysv/linux/wordsize-64/pwritev.c
+++ b/sysdeps/unix/sysv/linux/wordsize-64/pwritev.c
@@ -38,16 +38,7 @@ pwritev (int fd, const struct iovec *vector, int count, off_t offset)
 #ifdef __NR_pwritev
   ssize_t result;
 
-  if (SINGLE_THREAD_P)
-    result = INLINE_SYSCALL (pwritev, 4, fd, vector, count, offset);
-  else
-    {
-      int oldtype = LIBC_CANCEL_ASYNC ();
-
-      result = INLINE_SYSCALL (pwritev, 4, fd, vector, count, offset);
-
-      LIBC_CANCEL_RESET (oldtype);
-    }
+  result = SYSCALL_CANCEL (pwritev, fd, vector, count, offset);
 # ifdef __ASSUME_PWRITEV
   return result;
 # endif
diff --git a/sysdeps/unix/sysv/linux/x86_64/recv.c b/sysdeps/unix/sysv/linux/x86_64/recv.c
index 7b956a5fe3..995d11d3f0 100644
--- a/sysdeps/unix/sysv/linux/x86_64/recv.c
+++ b/sysdeps/unix/sysv/linux/x86_64/recv.c
@@ -25,16 +25,7 @@
 ssize_t
 __libc_recv (int fd, void *buf, size_t n, int flags)
 {
-  if (SINGLE_THREAD_P)
-    return INLINE_SYSCALL (recvfrom, 6, fd, buf, n, flags, NULL, NULL);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  ssize_t result = INLINE_SYSCALL (recvfrom, 6, fd, buf, n, flags, NULL, NULL);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (recvfrom, fd, buf, n, flags, NULL, NULL);
 }
 
 weak_alias (__libc_recv, __recv)
diff --git a/sysdeps/unix/sysv/linux/x86_64/send.c b/sysdeps/unix/sysv/linux/x86_64/send.c
index c8dadfa89f..864a8d50a6 100644
--- a/sysdeps/unix/sysv/linux/x86_64/send.c
+++ b/sysdeps/unix/sysv/linux/x86_64/send.c
@@ -23,17 +23,7 @@
 ssize_t
 __libc_send (int fd, const void *buf, size_t n, int flags)
 {
-  if (SINGLE_THREAD_P)
-    return INLINE_SYSCALL (sendto, 6, fd, buf, n, flags, NULL, (size_t) 0);
-
-  int oldtype = LIBC_CANCEL_ASYNC ();
-
-  ssize_t result = INLINE_SYSCALL (sendto, 6, fd, buf, n, flags, NULL,
-				   (size_t) 0);
-
-  LIBC_CANCEL_RESET (oldtype);
-
-  return result;
+  return SYSCALL_CANCEL (sendto, fd, buf, n, flags, NULL, (size_t) 0);
 }
 
 weak_alias (__libc_send, __send)