public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 02/26] Linux: renameat2 syscall number is always available
  2020-02-09 20:19 [PATCH 00/26] Linux cleanups enabled by built-in system call tables Florian Weimer
@ 2020-02-09 20:19 ` Florian Weimer
  2020-02-27 23:06   ` Adhemerval Zanella
  2020-02-09 20:19 ` [PATCH 03/26] Linux: copy_file_range " Florian Weimer
                   ` (25 subsequent siblings)
  26 siblings, 1 reply; 58+ messages in thread
From: Florian Weimer @ 2020-02-09 20:19 UTC (permalink / raw)
  To: libc-alpha

Due to the built-in tables, __NR_renameat2 is always defined.
---
 sysdeps/unix/sysv/linux/renameat2.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/renameat2.c b/sysdeps/unix/sysv/linux/renameat2.c
index 05304c6445..22b4178a08 100644
--- a/sysdeps/unix/sysv/linux/renameat2.c
+++ b/sysdeps/unix/sysv/linux/renameat2.c
@@ -29,15 +29,14 @@ __renameat2 (int oldfd, const char *old, int newfd, const char *new,
 #else
   if (flags == 0)
     return __renameat (oldfd, old, newfd, new);
-# ifdef __NR_renameat2
+
   /* For non-zero flags, try the renameat2 system call.  */
   int ret = INLINE_SYSCALL_CALL (renameat2, oldfd, old, newfd, new, flags);
   if (ret != -1 || errno != ENOSYS)
     /* Preserve non-error/non-ENOSYS return values.  */
     return ret;
-# endif
-  /* No kernel (header) support for renameat2.  All flags are
-     unknown.  */
+
+  /* No kernel support for renameat2.  All flags are unknown.  */
   __set_errno (EINVAL);
   return -1;
 #endif
-- 
2.24.1


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

* [PATCH 04/26] Linux: mlock2 syscall number is always available
  2020-02-09 20:19 [PATCH 00/26] Linux cleanups enabled by built-in system call tables Florian Weimer
                   ` (2 preceding siblings ...)
  2020-02-09 20:19 ` [PATCH 01/26] Linux: Enhance glibcsyscalls.h to support listing system calls Florian Weimer
@ 2020-02-09 20:19 ` Florian Weimer
  2020-02-27 23:06   ` Adhemerval Zanella
  2020-02-09 20:20 ` [PATCH 14/26] Linux: rt_sigqueueinfo " Florian Weimer
                   ` (22 subsequent siblings)
  26 siblings, 1 reply; 58+ messages in thread
From: Florian Weimer @ 2020-02-09 20:19 UTC (permalink / raw)
  To: libc-alpha

Due to the built-in tables, __NR_mlock2 is always defined.
---
 sysdeps/unix/sysv/linux/mlock2.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/mlock2.c b/sysdeps/unix/sysv/linux/mlock2.c
index 7cea23d47c..e52f43f35c 100644
--- a/sysdeps/unix/sysv/linux/mlock2.c
+++ b/sysdeps/unix/sysv/linux/mlock2.c
@@ -27,11 +27,9 @@ mlock2 (const void *addr, size_t length, unsigned int flags)
 #else
   if (flags == 0)
     return INLINE_SYSCALL_CALL (mlock, addr, length);
-# ifdef __NR_mlock2
   int ret = INLINE_SYSCALL_CALL (mlock2, addr, length, flags);
   if (ret == 0 || errno != ENOSYS)
     return ret;
-# endif /* __NR_mlock2 */
   /* Treat the missing system call as an invalid (non-zero) flag
      argument.  */
   __set_errno (EINVAL);
-- 
2.24.1


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

* [PATCH 03/26] Linux: copy_file_range syscall number is always available
  2020-02-09 20:19 [PATCH 00/26] Linux cleanups enabled by built-in system call tables Florian Weimer
  2020-02-09 20:19 ` [PATCH 02/26] Linux: renameat2 syscall number is always available Florian Weimer
@ 2020-02-09 20:19 ` Florian Weimer
  2020-02-27 23:06   ` Adhemerval Zanella
  2020-02-09 20:19 ` [PATCH 01/26] Linux: Enhance glibcsyscalls.h to support listing system calls Florian Weimer
                   ` (24 subsequent siblings)
  26 siblings, 1 reply; 58+ messages in thread
From: Florian Weimer @ 2020-02-09 20:19 UTC (permalink / raw)
  To: libc-alpha

Due to the built-in tables, __NR_copy_file_range is always defined.
---
 sysdeps/unix/sysv/linux/copy_file_range.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/copy_file_range.c b/sysdeps/unix/sysv/linux/copy_file_range.c
index 65597ca025..a73c89f079 100644
--- a/sysdeps/unix/sysv/linux/copy_file_range.c
+++ b/sysdeps/unix/sysv/linux/copy_file_range.c
@@ -25,11 +25,6 @@ copy_file_range (int infd, __off64_t *pinoff,
                  int outfd, __off64_t *poutoff,
                  size_t length, unsigned int flags)
 {
-#ifdef __NR_copy_file_range
   return SYSCALL_CANCEL (copy_file_range, infd, pinoff, outfd, poutoff,
                          length, flags);
-#else
-  __set_errno (ENOSYS);
-  return -1;
-#endif
 }
-- 
2.24.1


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

* [PATCH 00/26] Linux cleanups enabled by built-in system call tables
@ 2020-02-09 20:19 Florian Weimer
  2020-02-09 20:19 ` [PATCH 02/26] Linux: renameat2 syscall number is always available Florian Weimer
                   ` (26 more replies)
  0 siblings, 27 replies; 58+ messages in thread
From: Florian Weimer @ 2020-02-09 20:19 UTC (permalink / raw)
  To: libc-alpha

This series cleans up various quirks in the Linux implementation related
to historic lack of system call numbers in several places.

It has been tested on aarch64-linux-gnu, i686-linux-gnu,
powerpc64le-linux-gnu, s390x-linux-gnu, x86_64-linux-gnu, and also built
with build-many-glibcs-py.

I did not touch the futex #ifdefs because they are going to change soon
enough.

Thanks,
Florian

Florian Weimer (26):
  Linux: Enhance glibcsyscalls.h to support listing system calls
  Linux: renameat2 syscall number is always available
  Linux: copy_file_range syscall number is always available
  Linux: mlock2 syscall number is always available
  Linux: mq_* syscall numbers are always available
  Linux: statx syscall number is always available
  Linux: sched_setaffinity syscall number is always available
  Linux: sched_getaffinity syscall number is always available
  Linux: sigaltstack syscall number is always available
  Linux: Clean up pread64/pwrite64 system call names
  Linux: Clean up preadv2, pwritev2 system call names
  Linux: Clean up preadv, pwritev system call names
  Linux: getrandom syscall number is always available
  Linux: rt_sigqueueinfo syscall number is always available
  Linux: pkey_mprotect syscall number is always available
  Linux: set_tid_address syscall number is always available
  Linux: exit_group syscall number is always available
  Linux: getdents64 syscall number is always available on MIPS
  Linux: pciconfig_iobase syscall number is always available on alpha
  Linux: set_robust_list syscall number is always available
  Linux: open_by_handle_at syscall number is always available
  ia64: Do not define __NR_semtimedop in <sysdep.h>
  x86_64: Do not define __NR_semtimedop in <sysdep.h>
  Linux: epoll_pwait syscall number is always available
  m68k: getpagesize syscall number is always available
  microblaze: vfork is always available

 nptl/nptl-init.c                              |  4 -
 nptl/pthread_create.c                         |  6 +-
 sysdeps/nptl/fork.c                           | 10 +--
 sysdeps/unix/sysv/linux/_exit.c               |  2 -
 sysdeps/unix/sysv/linux/aio_sigqueue.c        |  5 --
 sysdeps/unix/sysv/linux/alpha/ioperm.c        |  2 -
 sysdeps/unix/sysv/linux/copy_file_range.c     |  5 --
 sysdeps/unix/sysv/linux/epoll_pwait.c         | 16 ----
 sysdeps/unix/sysv/linux/gai_sigqueue.c        |  5 --
 sysdeps/unix/sysv/linux/generic/sysdep.h      |  8 --
 sysdeps/unix/sysv/linux/getentropy.c          |  9 --
 sysdeps/unix/sysv/linux/getrandom.c           | 13 ---
 sysdeps/unix/sysv/linux/glibcsyscalls.py      | 86 ++++++++++++++++++-
 sysdeps/unix/sysv/linux/ia64/sysdep.h         |  6 --
 sysdeps/unix/sysv/linux/m68k/getpagesize.c    |  4 -
 sysdeps/unix/sysv/linux/microblaze/vfork.S    |  4 -
 .../unix/sysv/linux/mips/mips64/getdents64.c  |  2 -
 sysdeps/unix/sysv/linux/mlock2.c              |  2 -
 sysdeps/unix/sysv/linux/mq_close.c            |  6 --
 sysdeps/unix/sysv/linux/mq_getattr.c          |  6 --
 sysdeps/unix/sysv/linux/mq_notify.c           |  6 --
 sysdeps/unix/sysv/linux/mq_open.c             |  5 --
 sysdeps/unix/sysv/linux/mq_receive.c          |  6 --
 sysdeps/unix/sysv/linux/mq_send.c             |  6 --
 sysdeps/unix/sysv/linux/mq_unlink.c           |  6 --
 sysdeps/unix/sysv/linux/nscd_setup_thread.c   |  2 -
 sysdeps/unix/sysv/linux/open_by_handle_at.c   |  9 --
 sysdeps/unix/sysv/linux/pkey_mprotect.c       |  5 --
 sysdeps/unix/sysv/linux/pread.c               |  6 +-
 sysdeps/unix/sysv/linux/pread64.c             |  4 -
 sysdeps/unix/sysv/linux/pread64_nocancel.c    |  4 -
 sysdeps/unix/sysv/linux/preadv.c              |  6 --
 sysdeps/unix/sysv/linux/preadv2.c             |  7 +-
 sysdeps/unix/sysv/linux/preadv64.c            | 10 +--
 sysdeps/unix/sysv/linux/preadv64v2.c          |  9 +-
 sysdeps/unix/sysv/linux/pwrite.c              |  6 +-
 sysdeps/unix/sysv/linux/pwrite64.c            |  4 -
 sysdeps/unix/sysv/linux/pwritev.c             |  6 --
 sysdeps/unix/sysv/linux/pwritev2.c            |  4 +-
 sysdeps/unix/sysv/linux/pwritev64.c           | 10 +--
 sysdeps/unix/sysv/linux/pwritev64v2.c         |  9 +-
 sysdeps/unix/sysv/linux/renameat2.c           |  7 +-
 sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h | 11 ---
 sysdeps/unix/sysv/linux/sched_getaffinity.c   | 10 +--
 sysdeps/unix/sysv/linux/sched_setaffinity.c   |  7 +-
 sysdeps/unix/sysv/linux/sigstack.c            |  4 -
 sysdeps/unix/sysv/linux/statx.c               | 11 +--
 sysdeps/unix/sysv/linux/x86_64/sysdep.h       |  7 --
 48 files changed, 115 insertions(+), 273 deletions(-)

-- 
2.24.1

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

* [PATCH 01/26] Linux: Enhance glibcsyscalls.h to support listing system calls
  2020-02-09 20:19 [PATCH 00/26] Linux cleanups enabled by built-in system call tables Florian Weimer
  2020-02-09 20:19 ` [PATCH 02/26] Linux: renameat2 syscall number is always available Florian Weimer
  2020-02-09 20:19 ` [PATCH 03/26] Linux: copy_file_range " Florian Weimer
@ 2020-02-09 20:19 ` Florian Weimer
  2020-02-27 22:14   ` Adhemerval Zanella
  2020-02-09 20:19 ` [PATCH 04/26] Linux: mlock2 syscall number is always available Florian Weimer
                   ` (23 subsequent siblings)
  26 siblings, 1 reply; 58+ messages in thread
From: Florian Weimer @ 2020-02-09 20:19 UTC (permalink / raw)
  To: libc-alpha

The script can now be called to query the definition status of
system call numbers across all architectures, like this:

$ python3 sysdeps/unix/sysv/linux/glibcsyscalls.py query-syscall sync_file_range sync_file_range2
sync_file_range:
  defined: aarch64 alpha csky hppa i386 ia64 m68k microblaze mips/mips32 mips/mips64/n32 mips/mips64/n64 nios2 riscv/rv64 s390/s390-32 s390/s390-64 sh sparc/sparc32 sparc/sparc64 x86_64/64 x86_64/x32
  undefined: arm powerpc/powerpc32 powerpc/powerpc64
sync_file_range2:
  defined: arm powerpc/powerpc32 powerpc/powerpc64
  undefined: aarch64 alpha csky hppa i386 ia64 m68k microblaze mips/mips32 mips/mips64/n32 mips/mips64/n64 nios2 riscv/rv64 s390/s390-32 s390/s390-64 sh sparc/sparc32 sparc/sparc64 x86_64/64 x86_64/x32
---
 sysdeps/unix/sysv/linux/glibcsyscalls.py | 86 +++++++++++++++++++++++-
 1 file changed, 85 insertions(+), 1 deletion(-)

diff --git a/sysdeps/unix/sysv/linux/glibcsyscalls.py b/sysdeps/unix/sysv/linux/glibcsyscalls.py
index de4d707e48..5beac42cb4 100644
--- a/sysdeps/unix/sysv/linux/glibcsyscalls.py
+++ b/sysdeps/unix/sysv/linux/glibcsyscalls.py
@@ -17,9 +17,12 @@
 # License along with the GNU C Library; if not, see
 # <http://www.gnu.org/licenses/>.
 
+import os
 import re
 
-import glibcextract
+if __name__ != '__main__':
+    # When called as a main program, this is not needed.
+    import glibcextract
 
 def extract_system_call_name(macro):
     """Convert the macro name (with __NR_) to a system call name."""
@@ -168,3 +171,84 @@ def linux_kernel_version(cc):
     val = glibcextract.compute_c_consts(sym_data, cc)['LINUX_VERSION_CODE']
     val = int(val)
     return ((val & 0xff0000) >> 16, (val & 0xff00) >> 8)
+
+class ArchSyscall:
+    """Canonical name and location of a syscall header."""
+
+    def __init__(self, name, path):
+        self.name = name
+        self.path = path
+
+    def __repr__(self):
+        return 'ArchSyscall(name={!r}, patch={!r})'.format(
+            self.name, self.path)
+
+def list_arch_syscall_headers(topdir):
+    """A generator which returns all the ArchSyscall objects in a tree."""
+
+    sysdeps = os.path.join(topdir, 'sysdeps', 'unix', 'sysv', 'linux')
+    for root, dirs, files in os.walk(sysdeps):
+        if root != sysdeps:
+            for filename in files:
+                if filename == 'arch-syscall.h':
+                    yield ArchSyscall(
+                        name=os.path.relpath(root, sysdeps),
+                        path=os.path.join(root, filename))
+
+def __main():
+    """Entry point when called as the main program."""
+
+    import sys
+
+    # Top-level directory of the source tree.
+    topdir = os.path.realpath(os.path.join(
+        os.path.dirname(os.path.realpath(__file__)), *('..',) * 4))
+
+    def usage(status):
+        print('usage: glibcsyscalls list-headers')
+        print('       glibcsyscalls query-syscall SYSCALL...')
+        sys.exit(status)
+
+    if len(sys.argv) <= 1:
+        usage(0)
+
+    command = sys.argv[1]
+    if command == 'list-headers':
+        # Print the absolute paths of all arch-syscall.h header files.
+        if len(sys.argv) != 2:
+            usage(1)
+        for header in sorted([syscall.path for syscall
+                              in list_arch_syscall_headers(topdir)]):
+            print(header)
+
+    elif command == 'query-syscall':
+        # Summarize the implementation status of the specified system calls.
+        if len(sys.argv) < 3:
+            usage(1)
+
+        # List of system call tables.
+        tables = sorted(list_arch_syscall_headers(topdir),
+                          key=lambda syscall: syscall.name)
+        for table in tables:
+            table.numbers = load_arch_syscall_header(table.path)
+
+        for nr in sys.argv[2:]:
+            defined = [table.name for table in tables
+                           if nr in table.numbers]
+            undefined = [table.name for table in tables
+                             if nr not in table.numbers]
+            if not defined:
+                print('{}: not defined on any architecture'.format(nr))
+            elif not undefined:
+                print('{}: defined on all architectures'.format(nr))
+            else:
+                print('{}:'.format(nr))
+                print('  defined: {}'.format(' '.join(defined)))
+                print('  undefined: {}'.format(' '.join(undefined)))
+
+    else:
+        # Unrecognized command.
+        usage(1)
+
+if __name__ == '__main__':
+    __main()
-- 
2.24.1


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

* [PATCH 15/26] Linux: pkey_mprotect syscall number is always available
  2020-02-09 20:19 [PATCH 00/26] Linux cleanups enabled by built-in system call tables Florian Weimer
                   ` (5 preceding siblings ...)
  2020-02-09 20:20 ` [PATCH 08/26] Linux: sched_getaffinity " Florian Weimer
@ 2020-02-09 20:20 ` Florian Weimer
  2020-02-27 23:31   ` Adhemerval Zanella
  2020-02-09 20:20 ` [PATCH 07/26] Linux: sched_setaffinity " Florian Weimer
                   ` (19 subsequent siblings)
  26 siblings, 1 reply; 58+ messages in thread
From: Florian Weimer @ 2020-02-09 20:20 UTC (permalink / raw)
  To: libc-alpha

Due to the built-in tables, __NR_pkey_mprotect is always defined.
---
 sysdeps/unix/sysv/linux/pkey_mprotect.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/pkey_mprotect.c b/sysdeps/unix/sysv/linux/pkey_mprotect.c
index 5d372edfd5..4ec1feba2e 100644
--- a/sysdeps/unix/sysv/linux/pkey_mprotect.c
+++ b/sysdeps/unix/sysv/linux/pkey_mprotect.c
@@ -28,10 +28,5 @@ pkey_mprotect (void *addr, size_t len, int prot, int pkey)
     /* If the key is -1, the system call is precisely equivalent to
        mprotect.  */
     return __mprotect (addr, len, prot);
-#ifdef __NR_pkey_mprotect
   return INLINE_SYSCALL_CALL (pkey_mprotect, addr, len, prot, pkey);
-#else
-  __set_errno (ENOSYS);
-  return -1;
-#endif
 }
-- 
2.24.1


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

* [PATCH 09/26] Linux: sigaltstack syscall number is always available
  2020-02-09 20:19 [PATCH 00/26] Linux cleanups enabled by built-in system call tables Florian Weimer
                   ` (7 preceding siblings ...)
  2020-02-09 20:20 ` [PATCH 07/26] Linux: sched_setaffinity " Florian Weimer
@ 2020-02-09 20:20 ` Florian Weimer
  2020-02-27 23:06   ` Adhemerval Zanella
  2020-02-09 20:20 ` [PATCH 06/26] Linux: statx " Florian Weimer
                   ` (17 subsequent siblings)
  26 siblings, 1 reply; 58+ messages in thread
From: Florian Weimer @ 2020-02-09 20:20 UTC (permalink / raw)
  To: libc-alpha

Due to the built-in tables, __NR_sigaltstack is always defined.
---
 sysdeps/unix/sysv/linux/sigstack.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/sigstack.c b/sysdeps/unix/sysv/linux/sigstack.c
index 2f75e2643a..32a378bd26 100644
--- a/sysdeps/unix/sysv/linux/sigstack.c
+++ b/sysdeps/unix/sysv/linux/sigstack.c
@@ -22,7 +22,6 @@
 #include <sys/syscall.h>
 
 
-#ifdef __NR_sigaltstack
 int
 sigstack (struct sigstack *ss, struct sigstack *oss)
 {
@@ -61,6 +60,3 @@ sigstack (struct sigstack *ss, struct sigstack *oss)
 }
 
 link_warning (sigstack, "the `sigstack' function is dangerous.  `sigaltstack' should be used instead.")
-#else
-# include <signal/sigstack.c>
-#endif
-- 
2.24.1


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

* [PATCH 06/26] Linux: statx syscall number is always available
  2020-02-09 20:19 [PATCH 00/26] Linux cleanups enabled by built-in system call tables Florian Weimer
                   ` (8 preceding siblings ...)
  2020-02-09 20:20 ` [PATCH 09/26] Linux: sigaltstack " Florian Weimer
@ 2020-02-09 20:20 ` Florian Weimer
  2020-02-27 23:06   ` Adhemerval Zanella
  2020-02-09 20:20 ` [PATCH 10/26] Linux: Clean up pread64/pwrite64 system call names Florian Weimer
                   ` (16 subsequent siblings)
  26 siblings, 1 reply; 58+ messages in thread
From: Florian Weimer @ 2020-02-09 20:20 UTC (permalink / raw)
  To: libc-alpha

Due to the built-in tables, __NR_statx is always defined.
---
 sysdeps/unix/sysv/linux/statx.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/statx.c b/sysdeps/unix/sysv/linux/statx.c
index a119b7a29e..9721fc12a5 100644
--- a/sysdeps/unix/sysv/linux/statx.c
+++ b/sysdeps/unix/sysv/linux/statx.c
@@ -25,17 +25,14 @@ int
 statx (int fd, const char *path, int flags,
        unsigned int mask, struct statx *buf)
 {
-#ifdef __NR_statx
   int ret = INLINE_SYSCALL_CALL (statx, fd, path, flags, mask, buf);
-# ifdef __ASSUME_STATX
+#ifdef __ASSUME_STATX
   return ret;
-# else
+#else
   if (ret == 0 || errno != ENOSYS)
     /* Preserve non-error/non-ENOSYS return values.  */
     return ret;
-# endif
-#endif
-#ifndef __ASSUME_STATX
-  return statx_generic (fd, path, flags, mask, buf);
+  else
+    return statx_generic (fd, path, flags, mask, buf);
 #endif
 }
-- 
2.24.1


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

* [PATCH 05/26] Linux: mq_* syscall numbers are always available
  2020-02-09 20:19 [PATCH 00/26] Linux cleanups enabled by built-in system call tables Florian Weimer
                   ` (11 preceding siblings ...)
  2020-02-09 20:20 ` [PATCH 13/26] Linux: getrandom syscall number is always available Florian Weimer
@ 2020-02-09 20:20 ` Florian Weimer
  2020-02-27 23:06   ` Adhemerval Zanella
  2020-02-09 20:20 ` [PATCH 12/26] Linux: Clean up preadv, pwritev system call names Florian Weimer
                   ` (13 subsequent siblings)
  26 siblings, 1 reply; 58+ messages in thread
From: Florian Weimer @ 2020-02-09 20:20 UTC (permalink / raw)
  To: libc-alpha

Due to the built-in tables, __NR_mq_getsetattr, __NR_mq_notify,
__NR_mq_open, __NR_mq_timedreceive, __NR_mq_timedsend, __NR_mq_unlink
are always defined.
---
 sysdeps/unix/sysv/linux/mq_close.c   | 6 ------
 sysdeps/unix/sysv/linux/mq_getattr.c | 6 ------
 sysdeps/unix/sysv/linux/mq_notify.c  | 6 ------
 sysdeps/unix/sysv/linux/mq_open.c    | 5 -----
 sysdeps/unix/sysv/linux/mq_receive.c | 6 ------
 sysdeps/unix/sysv/linux/mq_send.c    | 6 ------
 sysdeps/unix/sysv/linux/mq_unlink.c  | 6 ------
 7 files changed, 41 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/mq_close.c b/sysdeps/unix/sysv/linux/mq_close.c
index 6990182e68..e1b4898170 100644
--- a/sysdeps/unix/sysv/linux/mq_close.c
+++ b/sysdeps/unix/sysv/linux/mq_close.c
@@ -19,8 +19,6 @@
 #include <mqueue.h>
 #include <sysdep.h>
 
-#ifdef __NR_mq_open
-
 /* Removes the association between message queue descriptor MQDES and its
    message queue.  */
 int
@@ -28,7 +26,3 @@ mq_close (mqd_t mqdes)
 {
   return INLINE_SYSCALL (close, 1, mqdes);
 }
-
-#else
-# include <rt/mq_close.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/mq_getattr.c b/sysdeps/unix/sysv/linux/mq_getattr.c
index a8a17fd7bb..dc8acc5dcc 100644
--- a/sysdeps/unix/sysv/linux/mq_getattr.c
+++ b/sysdeps/unix/sysv/linux/mq_getattr.c
@@ -20,15 +20,9 @@
 #include <stddef.h>
 #include <sysdep.h>
 
-#ifdef __NR_mq_getsetattr
-
 /* Query status and attributes of message queue MQDES.  */
 int
 mq_getattr (mqd_t mqdes, struct mq_attr *mqstat)
 {
   return mq_setattr (mqdes, NULL, mqstat);
 }
-
-#else
-# include <rt/mq_getattr.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/mq_notify.c b/sysdeps/unix/sysv/linux/mq_notify.c
index f288bac477..61bbb03b64 100644
--- a/sysdeps/unix/sysv/linux/mq_notify.c
+++ b/sysdeps/unix/sysv/linux/mq_notify.c
@@ -31,8 +31,6 @@
 #include <nptl/pthreadP.h>
 
 
-#ifdef __NR_mq_notify
-
 /* Defined in the kernel headers: */
 #define NOTIFY_COOKIE_LEN	32	/* Length of the cookie used.  */
 #define NOTIFY_WOKENUP		1	/* Code for notifcation.  */
@@ -276,7 +274,3 @@ mq_notify (mqd_t mqdes, const struct sigevent *notification)
 
   return retval;
 }
-
-#else
-# include <rt/mq_notify.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/mq_open.c b/sysdeps/unix/sysv/linux/mq_open.c
index ebb1bfc8b6..c88dc580e4 100644
--- a/sysdeps/unix/sysv/linux/mq_open.c
+++ b/sysdeps/unix/sysv/linux/mq_open.c
@@ -22,8 +22,6 @@
 #include <stdio.h>
 #include <sysdep.h>
 
-#ifdef __NR_mq_open
-
 /* Establish connection between a process and a message queue NAME and
    return message queue descriptor or (mqd_t) -1 on error.  OFLAG determines
    the type of access used.  If O_CREAT is on OFLAG, the third argument is
@@ -61,6 +59,3 @@ __mq_open_2 (const char *name, int oflag)
 
   return __mq_open (name, oflag);
 }
-#else
-# include <rt/mq_open.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/mq_receive.c b/sysdeps/unix/sysv/linux/mq_receive.c
index 5292c98b8b..282f486911 100644
--- a/sysdeps/unix/sysv/linux/mq_receive.c
+++ b/sysdeps/unix/sysv/linux/mq_receive.c
@@ -20,8 +20,6 @@
 #include <stddef.h>
 #include <sysdep.h>
 
-#ifdef __NR_mq_timedreceive
-
 /* Receive the oldest from highest priority messages in message queue
    MQDES.  */
 ssize_t
@@ -30,7 +28,3 @@ mq_receive (mqd_t mqdes, char *msg_ptr, size_t msg_len,
 {
   return __mq_timedreceive (mqdes, msg_ptr, msg_len, msg_prio, NULL);
 }
-
-#else
-# include <rt/mq_receive.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/mq_send.c b/sysdeps/unix/sysv/linux/mq_send.c
index 8e297e6d99..38f320d3ab 100644
--- a/sysdeps/unix/sysv/linux/mq_send.c
+++ b/sysdeps/unix/sysv/linux/mq_send.c
@@ -20,8 +20,6 @@
 #include <stddef.h>
 #include <sysdep.h>
 
-#ifdef __NR_mq_timedsend
-
 /* Add message pointed by MSG_PTR to message queue MQDES.  */
 int
 mq_send (mqd_t mqdes, const char *msg_ptr, size_t msg_len,
@@ -29,7 +27,3 @@ mq_send (mqd_t mqdes, const char *msg_ptr, size_t msg_len,
 {
   return __mq_timedsend (mqdes, msg_ptr, msg_len, msg_prio, NULL);
 }
-
-#else
-# include <rt/mq_send.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/mq_unlink.c b/sysdeps/unix/sysv/linux/mq_unlink.c
index a0c3348744..feadaa29ec 100644
--- a/sysdeps/unix/sysv/linux/mq_unlink.c
+++ b/sysdeps/unix/sysv/linux/mq_unlink.c
@@ -19,8 +19,6 @@
 #include <mqueue.h>
 #include <sysdep.h>
 
-#ifdef __NR_mq_unlink
-
 /* Remove message queue named NAME.  */
 int
 mq_unlink (const char *name)
@@ -43,7 +41,3 @@ mq_unlink (const char *name)
 
   return ret;
 }
-
-#else
-# include <rt/mq_unlink.c>
-#endif
-- 
2.24.1


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

* [PATCH 11/26] Linux: Clean up preadv2, pwritev2 system call names
  2020-02-09 20:19 [PATCH 00/26] Linux cleanups enabled by built-in system call tables Florian Weimer
                   ` (13 preceding siblings ...)
  2020-02-09 20:20 ` [PATCH 12/26] Linux: Clean up preadv, pwritev system call names Florian Weimer
@ 2020-02-09 20:20 ` Florian Weimer
  2020-02-27 23:19   ` Adhemerval Zanella
  2020-02-09 20:21 ` [PATCH 25/26] m68k: getpagesize syscall number is always available Florian Weimer
                   ` (11 subsequent siblings)
  26 siblings, 1 reply; 58+ messages in thread
From: Florian Weimer @ 2020-02-09 20:20 UTC (permalink / raw)
  To: libc-alpha

With the built-in tables __NR_preadv2 and __NR_pwritev2 are always
defined.

The kernel has never defined __NR_preadv64v2 and __NR_pwritev64v2
and is unlikely to do so, given that the preadv2 and pwritev2 system
calls themselves are 64-bit.
---
 sysdeps/unix/sysv/linux/preadv2.c     | 7 +------
 sysdeps/unix/sysv/linux/preadv64v2.c  | 9 ++-------
 sysdeps/unix/sysv/linux/pwritev2.c    | 4 ++--
 sysdeps/unix/sysv/linux/pwritev64v2.c | 9 ++-------
 4 files changed, 7 insertions(+), 22 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/preadv2.c b/sysdeps/unix/sysv/linux/preadv2.c
index 5f1a83589e..4e3aa923da 100644
--- a/sysdeps/unix/sysv/linux/preadv2.c
+++ b/sysdeps/unix/sysv/linux/preadv2.c
@@ -21,20 +21,15 @@
 
 #ifndef __OFF_T_MATCHES_OFF64_T
 
-# if !defined (__NR_preadv2) && defined (__NR_pread64v2)
-#  define __NR_preadv2 __NR_pread64v2
-# endif
-
 ssize_t
 preadv2 (int fd, const struct iovec *vector, int count, off_t offset,
 	 int flags)
 {
-# ifdef __NR_preadv2
   ssize_t result = SYSCALL_CANCEL (preadv2, fd, vector, count,
 				   LO_HI_LONG (offset), flags);
   if (result >= 0 || errno != ENOSYS)
     return result;
-# endif
+
   /* Trying to emulate the preadv2 syscall flags is troublesome:
 
      * We can not temporary change the file state of the O_DSYNC and O_SYNC
diff --git a/sysdeps/unix/sysv/linux/preadv64v2.c b/sysdeps/unix/sysv/linux/preadv64v2.c
index f1e52711cb..1bf1a4c696 100644
--- a/sysdeps/unix/sysv/linux/preadv64v2.c
+++ b/sysdeps/unix/sysv/linux/preadv64v2.c
@@ -19,20 +19,15 @@
 #include <sys/uio.h>
 #include <sysdep-cancel.h>
 
-#if !defined(__NR_preadv64v2) && defined(__NR_preadv2)
-# define __NR_preadv64v2 __NR_preadv2
-#endif
-
 ssize_t
 preadv64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
 	    int flags)
 {
-#ifdef __NR_preadv64v2
-  ssize_t result = SYSCALL_CANCEL (preadv64v2, fd, vector, count,
+  ssize_t result = SYSCALL_CANCEL (preadv2, fd, vector, count,
 				   LO_HI_LONG (offset), flags);
   if (result >= 0 || errno != ENOSYS)
     return result;
-#endif
+
   /* Trying to emulate the preadv2 syscall flags is troublesome:
 
      * We can not temporary change the file state of the O_DSYNC and O_SYNC
diff --git a/sysdeps/unix/sysv/linux/pwritev2.c b/sysdeps/unix/sysv/linux/pwritev2.c
index 53ab5e7613..a179654970 100644
--- a/sysdeps/unix/sysv/linux/pwritev2.c
+++ b/sysdeps/unix/sysv/linux/pwritev2.c
@@ -25,12 +25,12 @@ ssize_t
 pwritev2 (int fd, const struct iovec *vector, int count, off_t offset,
 	  int flags)
 {
-# ifdef __NR_pwritev2
+
   ssize_t result = SYSCALL_CANCEL (pwritev2, fd, vector, count,
 				   LO_HI_LONG (offset), flags);
   if (result >= 0 || errno != ENOSYS)
     return result;
-# endif
+
   /* Trying to emulate the pwritev2 syscall flags is troublesome:
 
      * We can not temporary change the file state of the O_DSYNC and O_SYNC
diff --git a/sysdeps/unix/sysv/linux/pwritev64v2.c b/sysdeps/unix/sysv/linux/pwritev64v2.c
index ba95eefcd9..8df32528b7 100644
--- a/sysdeps/unix/sysv/linux/pwritev64v2.c
+++ b/sysdeps/unix/sysv/linux/pwritev64v2.c
@@ -19,20 +19,15 @@
 #include <sys/uio.h>
 #include <sysdep-cancel.h>
 
-#if !defined(__NR_pwritev64v2) && defined(__NR_pwritev2)
-# define __NR_pwritev64v2 __NR_pwritev2
-#endif
-
 ssize_t
 pwritev64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
 	     int flags)
 {
-#ifdef __NR_pwritev64v2
-  ssize_t result = SYSCALL_CANCEL (pwritev64v2, fd, vector, count,
+  ssize_t result = SYSCALL_CANCEL (pwritev2, fd, vector, count,
 				   LO_HI_LONG (offset), flags);
   if (result >= 0 || errno != ENOSYS)
     return result;
-#endif
+
   /* Trying to emulate the pwritev2 syscall flags is troublesome:
 
      * We can not temporary change the file state of the O_DSYNC and O_SYNC
-- 
2.24.1


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

* [PATCH 13/26] Linux: getrandom syscall number is always available
  2020-02-09 20:19 [PATCH 00/26] Linux cleanups enabled by built-in system call tables Florian Weimer
                   ` (10 preceding siblings ...)
  2020-02-09 20:20 ` [PATCH 10/26] Linux: Clean up pread64/pwrite64 system call names Florian Weimer
@ 2020-02-09 20:20 ` Florian Weimer
  2020-02-27 23:20   ` Adhemerval Zanella
  2020-02-09 20:20 ` [PATCH 05/26] Linux: mq_* syscall numbers are " Florian Weimer
                   ` (14 subsequent siblings)
  26 siblings, 1 reply; 58+ messages in thread
From: Florian Weimer @ 2020-02-09 20:20 UTC (permalink / raw)
  To: libc-alpha

Due to the built-in tables, __NR_getrandom is always defined.
---
 sysdeps/unix/sysv/linux/getentropy.c |  9 ---------
 sysdeps/unix/sysv/linux/getrandom.c  | 13 -------------
 2 files changed, 22 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/getentropy.c b/sysdeps/unix/sysv/linux/getentropy.c
index 5d0b8d10c1..2f3a4e4692 100644
--- a/sysdeps/unix/sysv/linux/getentropy.c
+++ b/sysdeps/unix/sysv/linux/getentropy.c
@@ -21,7 +21,6 @@
 #include <errno.h>
 #include <unistd.h>
 
-#ifdef __NR_getrandom
 /* Write LENGTH bytes of randomness starting at BUFFER.  Return 0 on
    success and -1 on failure.  */
 int
@@ -63,11 +62,3 @@ getentropy (void *buffer, size_t length)
     }
   return 0;
 }
-#else
-int
-getentropy (void *buffer, size_t length)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-#endif
diff --git a/sysdeps/unix/sysv/linux/getrandom.c b/sysdeps/unix/sysv/linux/getrandom.c
index 309beadf72..63b8d36bf4 100644
--- a/sysdeps/unix/sysv/linux/getrandom.c
+++ b/sysdeps/unix/sysv/linux/getrandom.c
@@ -21,7 +21,6 @@
 #include <unistd.h>
 #include <sysdep-cancel.h>
 
-#ifdef __NR_getrandom
 /* Write up to LENGTH bytes of randomness starting at BUFFER.
    Return the number of bytes written, or -1 on error.  */
 ssize_t
@@ -29,17 +28,5 @@ __getrandom (void *buffer, size_t length, unsigned int flags)
 {
   return SYSCALL_CANCEL (getrandom, buffer, length, flags);
 }
-#else
-/* Always provide a definition, even if the kernel headers lack the
-   system call number. */
-ssize_t
-__getrandom (void *buffer, size_t length, unsigned int flags)
-{
-  /* Ideally, we would add a cancellation point here, but we currently
-     cannot do so inside libc.  */
-  __set_errno (ENOSYS);
-  return -1;
-}
-#endif
 libc_hidden_def (__getrandom)
 weak_alias (__getrandom, getrandom)
-- 
2.24.1


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

* [PATCH 07/26] Linux: sched_setaffinity syscall number is always available
  2020-02-09 20:19 [PATCH 00/26] Linux cleanups enabled by built-in system call tables Florian Weimer
                   ` (6 preceding siblings ...)
  2020-02-09 20:20 ` [PATCH 15/26] Linux: pkey_mprotect " Florian Weimer
@ 2020-02-09 20:20 ` Florian Weimer
  2020-02-27 23:06   ` Adhemerval Zanella
  2020-02-09 20:20 ` [PATCH 09/26] Linux: sigaltstack " Florian Weimer
                   ` (18 subsequent siblings)
  26 siblings, 1 reply; 58+ messages in thread
From: Florian Weimer @ 2020-02-09 20:20 UTC (permalink / raw)
  To: libc-alpha

Due to the built-in tables, __NR_sched_setaffinity is always defined.
---
 sysdeps/unix/sysv/linux/sched_setaffinity.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/sched_setaffinity.c b/sysdeps/unix/sysv/linux/sched_setaffinity.c
index bc0c42ce52..fc2c692783 100644
--- a/sysdeps/unix/sysv/linux/sched_setaffinity.c
+++ b/sysdeps/unix/sysv/linux/sched_setaffinity.c
@@ -24,8 +24,6 @@
 #include <shlib-compat.h>
 
 
-#ifdef __NR_sched_setaffinity
-
 extern int __sched_setaffinity_new (pid_t, size_t, const cpu_set_t *);
 libc_hidden_proto (__sched_setaffinity_new)
 
@@ -46,7 +44,7 @@ versioned_symbol (libc, __sched_setaffinity_new, sched_setaffinity,
 		  GLIBC_2_3_4);
 
 
-# if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
+#if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
 int
 attribute_compat_text_section
 __sched_setaffinity_old (pid_t pid, const cpu_set_t *cpuset)
@@ -55,7 +53,4 @@ __sched_setaffinity_old (pid_t pid, const cpu_set_t *cpuset)
   return __sched_setaffinity_new (pid, 128, cpuset);
 }
 compat_symbol (libc, __sched_setaffinity_old, sched_setaffinity, GLIBC_2_3_3);
-# endif
-#else
-# include <posix/sched_setaffinity.c>
 #endif
-- 
2.24.1


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

* [PATCH 12/26] Linux: Clean up preadv, pwritev system call names
  2020-02-09 20:19 [PATCH 00/26] Linux cleanups enabled by built-in system call tables Florian Weimer
                   ` (12 preceding siblings ...)
  2020-02-09 20:20 ` [PATCH 05/26] Linux: mq_* syscall numbers are " Florian Weimer
@ 2020-02-09 20:20 ` Florian Weimer
  2020-02-27 23:19   ` Adhemerval Zanella
  2020-02-09 20:20 ` [PATCH 11/26] Linux: Clean up preadv2, pwritev2 " Florian Weimer
                   ` (12 subsequent siblings)
  26 siblings, 1 reply; 58+ messages in thread
From: Florian Weimer @ 2020-02-09 20:20 UTC (permalink / raw)
  To: libc-alpha

The names __NR_preadv64, __NR_pwritev64 appear to be a glibc invention.
With the built-in tables, __NR_preadv and __NR_pwritev are always defined.
---
 sysdeps/unix/sysv/linux/preadv.c    |  6 ------
 sysdeps/unix/sysv/linux/preadv64.c  | 10 ++--------
 sysdeps/unix/sysv/linux/pwritev.c   |  6 ------
 sysdeps/unix/sysv/linux/pwritev64.c | 10 ++--------
 4 files changed, 4 insertions(+), 28 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/preadv.c b/sysdeps/unix/sysv/linux/preadv.c
index 2a55d8c142..9fccb917a1 100644
--- a/sysdeps/unix/sysv/linux/preadv.c
+++ b/sysdeps/unix/sysv/linux/preadv.c
@@ -22,10 +22,6 @@
 
 # ifdef __ASSUME_PREADV
 
-#  ifndef __NR_preadv
-#   define __NR_preadv __NR_preadv64
-#  endif
-
 ssize_t
 preadv (int fd, const struct iovec *vector, int count, off_t offset)
 {
@@ -37,12 +33,10 @@ static ssize_t __atomic_preadv_replacement (int, const struct iovec *,
 ssize_t
 preadv (int fd, const struct iovec *vector, int count, off_t offset)
 {
-#  ifdef __NR_preadv
   ssize_t result = SYSCALL_CANCEL (preadv, fd, vector, count,
 				   LO_HI_LONG (offset));
   if (result >= 0 || errno != ENOSYS)
     return result;
-#  endif
   return __atomic_preadv_replacement (fd, vector, count, offset);
 }
 #  define PREADV static __atomic_preadv_replacement
diff --git a/sysdeps/unix/sysv/linux/preadv64.c b/sysdeps/unix/sysv/linux/preadv64.c
index fb471f0d9d..9fe43522a5 100644
--- a/sysdeps/unix/sysv/linux/preadv64.c
+++ b/sysdeps/unix/sysv/linux/preadv64.c
@@ -20,14 +20,10 @@
 
 #ifdef __ASSUME_PREADV
 
-# ifndef __NR_preadv64
-#  define __NR_preadv64 __NR_preadv
-# endif
-
 ssize_t
 preadv64 (int fd, const struct iovec *vector, int count, off64_t offset)
 {
-  return SYSCALL_CANCEL (preadv64, fd, vector, count, LO_HI_LONG (offset));
+  return SYSCALL_CANCEL (preadv, fd, vector, count, LO_HI_LONG (offset));
 }
 #else
 static ssize_t __atomic_preadv64_replacement (int, const struct iovec *,
@@ -35,12 +31,10 @@ static ssize_t __atomic_preadv64_replacement (int, const struct iovec *,
 ssize_t
 preadv64 (int fd, const struct iovec *vector, int count, off64_t offset)
 {
-#ifdef __NR_preadv64
-  ssize_t result = SYSCALL_CANCEL (preadv64, fd, vector, count,
+  ssize_t result = SYSCALL_CANCEL (preadv, fd, vector, count,
 				   LO_HI_LONG (offset));
   if (result >= 0 || errno != ENOSYS)
     return result;
-#endif
   return __atomic_preadv64_replacement (fd, vector, count, offset);
 }
 # define PREADV static __atomic_preadv64_replacement
diff --git a/sysdeps/unix/sysv/linux/pwritev.c b/sysdeps/unix/sysv/linux/pwritev.c
index 7abe47be06..d6cb3c8d5c 100644
--- a/sysdeps/unix/sysv/linux/pwritev.c
+++ b/sysdeps/unix/sysv/linux/pwritev.c
@@ -22,10 +22,6 @@
 
 # ifdef __ASSUME_PREADV
 
-#  ifndef __NR_pwritev
-#   define __NR_pwritev __NR_pwritev64
-#  endif
-
 ssize_t
 pwritev (int fd, const struct iovec *vector, int count, off_t offset)
 {
@@ -37,12 +33,10 @@ static ssize_t __atomic_pwritev_replacement (int, const struct iovec *,
 ssize_t
 pwritev (int fd, const struct iovec *vector, int count, off_t offset)
 {
-#  ifdef __NR_pwritev
   ssize_t result = SYSCALL_CANCEL (pwritev, fd, vector, count,
 				   LO_HI_LONG (offset));
   if (result >= 0 || errno != ENOSYS)
     return result;
-#  endif
   return __atomic_pwritev_replacement (fd, vector, count, offset);
 }
 #  define PWRITEV static __atomic_pwritev_replacement
diff --git a/sysdeps/unix/sysv/linux/pwritev64.c b/sysdeps/unix/sysv/linux/pwritev64.c
index 9bb0399c44..08bda27d4f 100644
--- a/sysdeps/unix/sysv/linux/pwritev64.c
+++ b/sysdeps/unix/sysv/linux/pwritev64.c
@@ -20,14 +20,10 @@
 
 #ifdef __ASSUME_PWRITEV
 
-# ifndef __NR_pwritev64
-#  define __NR_pwritev64 __NR_pwritev
-# endif
-
 ssize_t
 pwritev64 (int fd, const struct iovec *vector, int count, off64_t offset)
 {
-  return SYSCALL_CANCEL (pwritev64, fd, vector, count, LO_HI_LONG (offset));
+  return SYSCALL_CANCEL (pwritev, fd, vector, count, LO_HI_LONG (offset));
 }
 #else
 static ssize_t __atomic_pwritev64_replacement (int, const struct iovec *,
@@ -35,12 +31,10 @@ static ssize_t __atomic_pwritev64_replacement (int, const struct iovec *,
 ssize_t
 pwritev64 (int fd, const struct iovec *vector, int count, off64_t offset)
 {
-#ifdef __NR_pwritev64
-  ssize_t result = SYSCALL_CANCEL (pwritev64, fd, vector, count,
+  ssize_t result = SYSCALL_CANCEL (pwritev, fd, vector, count,
 				   LO_HI_LONG (offset));
   if (result >= 0 || errno != ENOSYS)
     return result;
-#endif
   return __atomic_pwritev64_replacement (fd, vector, count, offset);
 }
 # define PWRITEV static __atomic_pwritev64_replacement
-- 
2.24.1


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

* [PATCH 14/26] Linux: rt_sigqueueinfo syscall number is always available
  2020-02-09 20:19 [PATCH 00/26] Linux cleanups enabled by built-in system call tables Florian Weimer
                   ` (3 preceding siblings ...)
  2020-02-09 20:19 ` [PATCH 04/26] Linux: mlock2 syscall number is always available Florian Weimer
@ 2020-02-09 20:20 ` Florian Weimer
  2020-02-27 23:31   ` Adhemerval Zanella
  2020-02-09 20:20 ` [PATCH 08/26] Linux: sched_getaffinity " Florian Weimer
                   ` (21 subsequent siblings)
  26 siblings, 1 reply; 58+ messages in thread
From: Florian Weimer @ 2020-02-09 20:20 UTC (permalink / raw)
  To: libc-alpha

Due to the built-in tables, __NR_rt_sigqueueinfo is always defined.

sysdeps/pthread/time_routines.c is not updated because it is shared with
Hurd.
---
 sysdeps/unix/sysv/linux/aio_sigqueue.c | 5 -----
 sysdeps/unix/sysv/linux/gai_sigqueue.c | 5 -----
 2 files changed, 10 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/aio_sigqueue.c b/sysdeps/unix/sysv/linux/aio_sigqueue.c
index 5f00582578..2c5a79bef6 100644
--- a/sysdeps/unix/sysv/linux/aio_sigqueue.c
+++ b/sysdeps/unix/sysv/linux/aio_sigqueue.c
@@ -26,8 +26,6 @@
 
 #include <aio_misc.h>
 
-#ifdef __NR_rt_sigqueueinfo
-
 /* Return any pending signal or wait for one for the given time.  */
 int
 __aio_sigqueue (int sig, const union sigval val, pid_t caller_pid)
@@ -46,6 +44,3 @@ __aio_sigqueue (int sig, const union sigval val, pid_t caller_pid)
 
   return INLINE_SYSCALL (rt_sigqueueinfo, 3, info.si_pid, sig, &info);
 }
-#else
-# include <rt/aio_sigqueue.c>
-#endif
diff --git a/sysdeps/unix/sysv/linux/gai_sigqueue.c b/sysdeps/unix/sysv/linux/gai_sigqueue.c
index e8b65a7d67..e4d7260743 100644
--- a/sysdeps/unix/sysv/linux/gai_sigqueue.c
+++ b/sysdeps/unix/sysv/linux/gai_sigqueue.c
@@ -26,8 +26,6 @@
 
 #include "gai_misc.h"
 
-#ifdef __NR_rt_sigqueueinfo
-
 /* Return any pending signal or wait for one for the given time.  */
 int
 __gai_sigqueue (int sig, const union sigval val, pid_t caller_pid)
@@ -46,6 +44,3 @@ __gai_sigqueue (int sig, const union sigval val, pid_t caller_pid)
 
   return INLINE_SYSCALL (rt_sigqueueinfo, 3, info.si_pid, sig, &info);
 }
-#else
-# include <resolv/gai_sigqueue.c>
-#endif
-- 
2.24.1


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

* [PATCH 10/26] Linux: Clean up pread64/pwrite64 system call names
  2020-02-09 20:19 [PATCH 00/26] Linux cleanups enabled by built-in system call tables Florian Weimer
                   ` (9 preceding siblings ...)
  2020-02-09 20:20 ` [PATCH 06/26] Linux: statx " Florian Weimer
@ 2020-02-09 20:20 ` Florian Weimer
  2020-02-27 23:08   ` Adhemerval Zanella
  2020-02-09 20:20 ` [PATCH 13/26] Linux: getrandom syscall number is always available Florian Weimer
                   ` (15 subsequent siblings)
  26 siblings, 1 reply; 58+ messages in thread
From: Florian Weimer @ 2020-02-09 20:20 UTC (permalink / raw)
  To: libc-alpha

Linux removed the last definitions of __NR_pread and __NR_pwrite
in commit 4ba66a9760722ccbb691b8f7116cad2f791cca7b, the removal
of the blackfin port.  All architectures now define __NR_pread64 and
__NR_pwrite64 only.
---
 sysdeps/unix/sysv/linux/generic/sysdep.h      |  8 --------
 sysdeps/unix/sysv/linux/pread.c               |  6 +-----
 sysdeps/unix/sysv/linux/pread64.c             |  4 ----
 sysdeps/unix/sysv/linux/pread64_nocancel.c    |  4 ----
 sysdeps/unix/sysv/linux/pwrite.c              |  6 +-----
 sysdeps/unix/sysv/linux/pwrite64.c            |  4 ----
 sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h | 11 -----------
 7 files changed, 2 insertions(+), 41 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/generic/sysdep.h b/sysdeps/unix/sysv/linux/generic/sysdep.h
index 23defce7c3..40b4b955ca 100644
--- a/sysdeps/unix/sysv/linux/generic/sysdep.h
+++ b/sysdeps/unix/sysv/linux/generic/sysdep.h
@@ -25,11 +25,3 @@
 #ifdef __NR_llseek
 # define __NR__llseek __NR_llseek
 #endif
-
-#if __WORDSIZE == 64
-/* By defining the older names, glibc will build syscall wrappers for
-   both pread and pread64; sysdeps/unix/sysv/linux/wordsize-64/pread64.c
-   will suppress generating any separate code for pread64.c.  */
-#define __NR_pread __NR_pread64
-#define __NR_pwrite __NR_pwrite64
-#endif
diff --git a/sysdeps/unix/sysv/linux/pread.c b/sysdeps/unix/sysv/linux/pread.c
index 7a09affd34..8dd87b3976 100644
--- a/sysdeps/unix/sysv/linux/pread.c
+++ b/sysdeps/unix/sysv/linux/pread.c
@@ -21,14 +21,10 @@
 
 #ifndef __OFF_T_MATCHES_OFF64_T
 
-# ifndef __NR_pread
-#  define __NR_pread __NR_pread64
-# endif
-
 ssize_t
 __libc_pread (int fd, void *buf, size_t count, off_t offset)
 {
-  return SYSCALL_CANCEL (pread, fd, buf, count, SYSCALL_LL_PRW (offset));
+  return SYSCALL_CANCEL (pread64, fd, buf, count, SYSCALL_LL_PRW (offset));
 }
 
 strong_alias (__libc_pread, __pread)
diff --git a/sysdeps/unix/sysv/linux/pread64.c b/sysdeps/unix/sysv/linux/pread64.c
index a7f907186b..3d4ffbafc1 100644
--- a/sysdeps/unix/sysv/linux/pread64.c
+++ b/sysdeps/unix/sysv/linux/pread64.c
@@ -19,10 +19,6 @@
 #include <unistd.h>
 #include <sysdep-cancel.h>
 
-#ifndef __NR_pread64
-# define __NR_pread64 __NR_pread
-#endif
-
 ssize_t
 __libc_pread64 (int fd, void *buf, size_t count, off64_t offset)
 {
diff --git a/sysdeps/unix/sysv/linux/pread64_nocancel.c b/sysdeps/unix/sysv/linux/pread64_nocancel.c
index 2eb6873e66..af33985959 100644
--- a/sysdeps/unix/sysv/linux/pread64_nocancel.c
+++ b/sysdeps/unix/sysv/linux/pread64_nocancel.c
@@ -20,10 +20,6 @@
 #include <sysdep-cancel.h>
 #include <not-cancel.h>
 
-#ifndef __NR_pread64
-# define __NR_pread64 __NR_pread
-#endif
-
 ssize_t
 __pread64_nocancel (int fd, void *buf, size_t count, off64_t offset)
 {
diff --git a/sysdeps/unix/sysv/linux/pwrite.c b/sysdeps/unix/sysv/linux/pwrite.c
index 5ef208e885..17964686e5 100644
--- a/sysdeps/unix/sysv/linux/pwrite.c
+++ b/sysdeps/unix/sysv/linux/pwrite.c
@@ -21,14 +21,10 @@
 
 #ifndef __OFF_T_MATCHES_OFF64_T
 
-# ifndef __NR_pwrite
-#  define __NR_pwrite __NR_pwrite64
-# endif
-
 ssize_t
 __libc_pwrite (int fd, const void *buf, size_t count, off_t offset)
 {
-  return SYSCALL_CANCEL (pwrite, fd, buf, count, SYSCALL_LL_PRW (offset));
+  return SYSCALL_CANCEL (pwrite64, fd, buf, count, SYSCALL_LL_PRW (offset));
 }
 
 strong_alias (__libc_pwrite, __pwrite)
diff --git a/sysdeps/unix/sysv/linux/pwrite64.c b/sysdeps/unix/sysv/linux/pwrite64.c
index 632f001f5b..709775c207 100644
--- a/sysdeps/unix/sysv/linux/pwrite64.c
+++ b/sysdeps/unix/sysv/linux/pwrite64.c
@@ -19,10 +19,6 @@
 #include <unistd.h>
 #include <sysdep-cancel.h>
 
-#ifndef __NR_pwrite64
-# define __NR_pwrite64 __NR_pwrite
-#endif
-
 ssize_t
 __libc_pwrite64 (int fd, const void *buf, size_t count, off64_t offset)
 {
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
index 9ff4479dc3..cec1326662 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
@@ -39,17 +39,6 @@
 /* In newer 2.1 kernels __NR_syscall is missing so we define it here.  */
 #define __NR_syscall 0
 
-/*
- * Newer kernel versions redefined __NR_pread and __NR_pwrite to
- * __NR_pread64 and __NR_pwrite64.
- */
-#ifndef __NR_pread
-# define __NR_pread __NR_pread64
-#endif
-#ifndef __NR_pwrite
-# define __NR_pwrite __NR_pwrite64
-#endif
-
 #undef SYS_ify
 #define SYS_ify(syscall_name)	__NR_##syscall_name
 
-- 
2.24.1


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

* [PATCH 08/26] Linux: sched_getaffinity syscall number is always available
  2020-02-09 20:19 [PATCH 00/26] Linux cleanups enabled by built-in system call tables Florian Weimer
                   ` (4 preceding siblings ...)
  2020-02-09 20:20 ` [PATCH 14/26] Linux: rt_sigqueueinfo " Florian Weimer
@ 2020-02-09 20:20 ` Florian Weimer
  2020-02-27 23:06   ` Adhemerval Zanella
  2020-02-09 20:20 ` [PATCH 15/26] Linux: pkey_mprotect " Florian Weimer
                   ` (20 subsequent siblings)
  26 siblings, 1 reply; 58+ messages in thread
From: Florian Weimer @ 2020-02-09 20:20 UTC (permalink / raw)
  To: libc-alpha

Due to the built-in tables, __NR_sched_getaffinity is always defined.
---
 sysdeps/unix/sysv/linux/sched_getaffinity.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/sched_getaffinity.c b/sysdeps/unix/sysv/linux/sched_getaffinity.c
index 6d79a41c34..325bfb29c1 100644
--- a/sysdeps/unix/sysv/linux/sched_getaffinity.c
+++ b/sysdeps/unix/sysv/linux/sched_getaffinity.c
@@ -24,11 +24,10 @@
 #include <shlib-compat.h>
 
 
-#ifdef __NR_sched_getaffinity
-# if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
+#if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
 extern int __sched_getaffinity_new (pid_t, size_t, cpu_set_t *);
 libc_hidden_proto (__sched_getaffinity_new)
-# endif
+#endif
 
 int
 __sched_getaffinity_new (pid_t pid, size_t cpusetsize, cpu_set_t *cpuset)
@@ -48,7 +47,7 @@ versioned_symbol (libc, __sched_getaffinity_new, sched_getaffinity,
 		  GLIBC_2_3_4);
 
 
-# if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
+#if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
 libc_hidden_def (__sched_getaffinity_new)
 
 int
@@ -59,7 +58,4 @@ __sched_getaffinity_old (pid_t pid, cpu_set_t *cpuset)
   return __sched_getaffinity_new (pid, 128, cpuset);
 }
 compat_symbol (libc, __sched_getaffinity_old, sched_getaffinity, GLIBC_2_3_3);
-# endif
-#else
-# include <posix/sched_getaffinity.c>
 #endif
-- 
2.24.1


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

* [PATCH 22/26] ia64: Do not define __NR_semtimedop in <sysdep.h>
  2020-02-09 20:19 [PATCH 00/26] Linux cleanups enabled by built-in system call tables Florian Weimer
                   ` (18 preceding siblings ...)
  2020-02-09 20:21 ` [PATCH 18/26] Linux: getdents64 syscall number is always available on MIPS Florian Weimer
@ 2020-02-09 20:21 ` Florian Weimer
  2020-02-27 23:46   ` Adhemerval Zanella
  2020-02-09 20:21 ` [PATCH 17/26] Linux: exit_group syscall number is always available Florian Weimer
                   ` (6 subsequent siblings)
  26 siblings, 1 reply; 58+ messages in thread
From: Florian Weimer @ 2020-02-09 20:21 UTC (permalink / raw)
  To: libc-alpha

The definition is always available from the built-in system call table.
---
 sysdeps/unix/sysv/linux/ia64/sysdep.h | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/ia64/sysdep.h b/sysdeps/unix/sysv/linux/ia64/sysdep.h
index 59442c50e9..fec8ea9d4b 100644
--- a/sysdeps/unix/sysv/linux/ia64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/ia64/sysdep.h
@@ -46,12 +46,6 @@
 #undef SYS_ify
 #define SYS_ify(syscall_name)	__NR_##syscall_name
 
-/* This is to help the old kernel headers where __NR_semtimedop is not
-   available.  */
-#ifndef __NR_semtimedop
-# define __NR_semtimedop 1247
-#endif
-
 #if defined USE_DL_SYSINFO \
 	&& (IS_IN (libc) \
 	    || IS_IN (libpthread) || IS_IN (librt))
-- 
2.24.1


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

* [PATCH 26/26] microblaze: vfork is always available
  2020-02-09 20:19 [PATCH 00/26] Linux cleanups enabled by built-in system call tables Florian Weimer
                   ` (15 preceding siblings ...)
  2020-02-09 20:21 ` [PATCH 25/26] m68k: getpagesize syscall number is always available Florian Weimer
@ 2020-02-09 20:21 ` Florian Weimer
  2020-02-27 23:47   ` Adhemerval Zanella
  2020-02-09 20:21 ` [PATCH 16/26] Linux: set_tid_address syscall number " Florian Weimer
                   ` (9 subsequent siblings)
  26 siblings, 1 reply; 58+ messages in thread
From: Florian Weimer @ 2020-02-09 20:21 UTC (permalink / raw)
  To: libc-alpha

Due to the built-in tables, __NR_vfork is always defined, so the
fork-based fallback code is never used.

(It appears that the vfork system call was wired up when the port was
contributed to the kernel.)
---
 sysdeps/unix/sysv/linux/microblaze/vfork.S | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/microblaze/vfork.S b/sysdeps/unix/sysv/linux/microblaze/vfork.S
index 7bff659ff3..913aa06e2e 100644
--- a/sysdeps/unix/sysv/linux/microblaze/vfork.S
+++ b/sysdeps/unix/sysv/linux/microblaze/vfork.S
@@ -28,11 +28,7 @@
 
 ENTRY (__vfork)
 
-#ifdef __NR_vfork
 	DO_CALL (vfork, 0)
-#else
-	DO_CALL (fork, 0)
-#endif
 	addik	r12,r0,-4095
 	cmpu	r12,r12,r3
 	bgei	r12,SYSCALL_ERROR_LABEL
-- 
2.24.1

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

* [PATCH 21/26] Linux: open_by_handle_at syscall number is always available
  2020-02-09 20:19 [PATCH 00/26] Linux cleanups enabled by built-in system call tables Florian Weimer
                   ` (22 preceding siblings ...)
  2020-02-09 20:21 ` [PATCH 23/26] x86_64: Do not define __NR_semtimedop in <sysdep.h> Florian Weimer
@ 2020-02-09 20:21 ` Florian Weimer
  2020-02-27 23:46   ` Adhemerval Zanella
  2020-02-09 20:21 ` [PATCH 20/26] Linux: set_robust_list " Florian Weimer
                   ` (2 subsequent siblings)
  26 siblings, 1 reply; 58+ messages in thread
From: Florian Weimer @ 2020-02-09 20:21 UTC (permalink / raw)
  To: libc-alpha

Due to the built-in tables, __NR_open_by_handle_at is always defined.
---
 sysdeps/unix/sysv/linux/open_by_handle_at.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/open_by_handle_at.c b/sysdeps/unix/sysv/linux/open_by_handle_at.c
index f682d8cfe4..6c9c53291a 100644
--- a/sysdeps/unix/sysv/linux/open_by_handle_at.c
+++ b/sysdeps/unix/sysv/linux/open_by_handle_at.c
@@ -24,14 +24,5 @@
 int
 open_by_handle_at (int mount_fd, struct file_handle *handle, int flags)
 {
-#ifdef __NR_open_by_handle_at
   return SYSCALL_CANCEL (open_by_handle_at, mount_fd, handle, flags);
-#else
-  __set_errno (ENOSYS);
-  return -1;
-#endif
 }
-
-#ifndef __NR_open_by_handle_at
-stub_warning (open_by_handle_at)
-#endif
-- 
2.24.1


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

* [PATCH 18/26] Linux: getdents64 syscall number is always available on MIPS
  2020-02-09 20:19 [PATCH 00/26] Linux cleanups enabled by built-in system call tables Florian Weimer
                   ` (17 preceding siblings ...)
  2020-02-09 20:21 ` [PATCH 16/26] Linux: set_tid_address syscall number " Florian Weimer
@ 2020-02-09 20:21 ` Florian Weimer
  2020-02-27 23:31   ` Adhemerval Zanella
  2020-02-09 20:21 ` [PATCH 22/26] ia64: Do not define __NR_semtimedop in <sysdep.h> Florian Weimer
                   ` (7 subsequent siblings)
  26 siblings, 1 reply; 58+ messages in thread
From: Florian Weimer @ 2020-02-09 20:21 UTC (permalink / raw)
  To: libc-alpha

Due to the built-in tables, __NR_getdents64 is always defined,
although it may not be supported at run time.
---
 sysdeps/unix/sysv/linux/mips/mips64/getdents64.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/mips/mips64/getdents64.c b/sysdeps/unix/sysv/linux/mips/mips64/getdents64.c
index 4edf968b09..d18a5297dc 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/getdents64.c
+++ b/sysdeps/unix/sysv/linux/mips/mips64/getdents64.c
@@ -34,7 +34,6 @@ __getdents64 (int fd, void *buf, size_t nbytes)
   if (nbytes > INT_MAX)
     nbytes = INT_MAX;
 
-#ifdef __NR_getdents64
   static int getdents64_supported = true;
   if (atomic_load_relaxed (&getdents64_supported))
     {
@@ -44,7 +43,6 @@ __getdents64 (int fd, void *buf, size_t nbytes)
 
       atomic_store_relaxed (&getdents64_supported, false);
     }
-#endif
 
   /* Unfortunately getdents64 was only wire-up for MIPS n64 on Linux 3.10.
      If the syscall is not available it need to fallback to the non-LFS one.
-- 
2.24.1


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

* [PATCH 20/26] Linux: set_robust_list syscall number is always available
  2020-02-09 20:19 [PATCH 00/26] Linux cleanups enabled by built-in system call tables Florian Weimer
                   ` (23 preceding siblings ...)
  2020-02-09 20:21 ` [PATCH 21/26] Linux: open_by_handle_at syscall number is always available Florian Weimer
@ 2020-02-09 20:21 ` Florian Weimer
  2020-02-27 23:46   ` Adhemerval Zanella
  2020-02-09 20:21 ` [PATCH 24/26] Linux: epoll_pwait " Florian Weimer
  2020-02-10 23:25 ` [PATCH 00/26] Linux cleanups enabled by built-in system call tables Lukasz Majewski
  26 siblings, 1 reply; 58+ messages in thread
From: Florian Weimer @ 2020-02-09 20:21 UTC (permalink / raw)
  To: libc-alpha

Due to the built-in tables, __NR_set_robust_list is always defined
(although it may not be available at run time).
---
 nptl/nptl-init.c      |  4 ----
 nptl/pthread_create.c |  6 ++----
 sysdeps/nptl/fork.c   | 10 ++++------
 3 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c
index 1877248014..373be89c95 100644
--- a/nptl/nptl-init.c
+++ b/nptl/nptl-init.c
@@ -129,11 +129,9 @@ static
 void
 __nptl_set_robust (struct pthread *self)
 {
-#ifdef __NR_set_robust_list
   INTERNAL_SYSCALL_DECL (err);
   INTERNAL_SYSCALL (set_robust_list, err, 2, &self->robust_head,
 		    sizeof (struct robust_list_head));
-#endif
 }
 
 
@@ -254,7 +252,6 @@ __pthread_initialize_minimal_internal (void)
     pd->robust_prev = &pd->robust_head;
 #endif
     pd->robust_head.list = &pd->robust_head;
-#ifdef __NR_set_robust_list
     pd->robust_head.futex_offset = (offsetof (pthread_mutex_t, __data.__lock)
 				    - offsetof (pthread_mutex_t,
 						__data.__list.__next));
@@ -262,7 +259,6 @@ __pthread_initialize_minimal_internal (void)
     int res = INTERNAL_SYSCALL (set_robust_list, err, 2, &pd->robust_head,
 				sizeof (struct robust_list_head));
     if (INTERNAL_SYSCALL_ERROR_P (res, err))
-#endif
       set_robust_list_not_avail ();
   }
 
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
index d3fd58730c..58706b4160 100644
--- a/nptl/pthread_create.c
+++ b/nptl/pthread_create.c
@@ -389,10 +389,9 @@ START_THREAD_DEFN
   if (__glibc_unlikely (atomic_exchange_acq (&pd->setxid_futex, 0) == -2))
     futex_wake (&pd->setxid_futex, 1, FUTEX_PRIVATE);
 
-#ifdef __NR_set_robust_list
-# ifndef __ASSUME_SET_ROBUST_LIST
+#ifndef __ASSUME_SET_ROBUST_LIST
   if (__set_robust_list_avail >= 0)
-# endif
+#endif
     {
       INTERNAL_SYSCALL_DECL (err);
       /* This call should never fail because the initial call in init.c
@@ -400,7 +399,6 @@ START_THREAD_DEFN
       INTERNAL_SYSCALL (set_robust_list, err, 2, &pd->robust_head,
 			sizeof (struct robust_list_head));
     }
-#endif
 
   /* If the parent was running cancellation handlers while creating
      the thread the new thread inherited the signal mask.  Reset the
diff --git a/sysdeps/nptl/fork.c b/sysdeps/nptl/fork.c
index f5cf88d68c..5091a000e3 100644
--- a/sysdeps/nptl/fork.c
+++ b/sysdeps/nptl/fork.c
@@ -83,7 +83,6 @@ __libc_fork (void)
       if (__fork_generation_pointer != NULL)
 	*__fork_generation_pointer += __PTHREAD_ONCE_FORK_GEN_INCR;
 
-#ifdef __NR_set_robust_list
       /* Initialize the robust mutex list setting in the kernel which has
 	 been reset during the fork.  We do not check for errors because if
 	 it fails here, it must have failed at process startup as well and
@@ -94,19 +93,18 @@ __libc_fork (void)
 	 inherit the correct value from the parent.  We do not need to clear
 	 the pending operation because it must have been zero when fork was
 	 called.  */
-# if __PTHREAD_MUTEX_HAVE_PREV
+#if __PTHREAD_MUTEX_HAVE_PREV
       self->robust_prev = &self->robust_head;
-# endif
+#endif
       self->robust_head.list = &self->robust_head;
-# ifdef SHARED
+#ifdef SHARED
       if (__builtin_expect (__libc_pthread_functions_init, 0))
 	PTHFCT_CALL (ptr_set_robust, (self));
-# else
+#else
       extern __typeof (__nptl_set_robust) __nptl_set_robust
 	__attribute__((weak));
       if (__builtin_expect (__nptl_set_robust != NULL, 0))
 	__nptl_set_robust (self);
-# endif
 #endif
 
       /* Reset the lock state in the multi-threaded case.  */
-- 
2.24.1


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

* [PATCH 16/26] Linux: set_tid_address syscall number is always available
  2020-02-09 20:19 [PATCH 00/26] Linux cleanups enabled by built-in system call tables Florian Weimer
                   ` (16 preceding siblings ...)
  2020-02-09 20:21 ` [PATCH 26/26] microblaze: vfork " Florian Weimer
@ 2020-02-09 20:21 ` Florian Weimer
  2020-02-27 23:31   ` Adhemerval Zanella
  2020-02-09 20:21 ` [PATCH 18/26] Linux: getdents64 syscall number is always available on MIPS Florian Weimer
                   ` (8 subsequent siblings)
  26 siblings, 1 reply; 58+ messages in thread
From: Florian Weimer @ 2020-02-09 20:21 UTC (permalink / raw)
  To: libc-alpha

Due to the built-in tables, __NR_set_tid_address is always defined.
---
 sysdeps/unix/sysv/linux/nscd_setup_thread.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/nscd_setup_thread.c b/sysdeps/unix/sysv/linux/nscd_setup_thread.c
index 6e14918be0..a49676f4b4 100644
--- a/sysdeps/unix/sysv/linux/nscd_setup_thread.c
+++ b/sysdeps/unix/sysv/linux/nscd_setup_thread.c
@@ -25,7 +25,6 @@
 int
 setup_thread (struct database_dyn *db)
 {
-#ifdef __NR_set_tid_address
   /* Only supported when NPTL is used.  */
   char buf[100];
   if (confstr (_CS_GNU_LIBPTHREAD_VERSION, buf, sizeof (buf)) >= sizeof (buf)
@@ -43,7 +42,6 @@ setup_thread (struct database_dyn *db)
        So, set the field to a nonzero value which indicates that nscd
        is certainly running and clients can skip the test.  */
     return db->head->nscd_certainly_running = 1;
-#endif
 
   return 0;
 }
-- 
2.24.1


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

* [PATCH 19/26] Linux: pciconfig_iobase syscall number is always available on alpha
  2020-02-09 20:19 [PATCH 00/26] Linux cleanups enabled by built-in system call tables Florian Weimer
                   ` (20 preceding siblings ...)
  2020-02-09 20:21 ` [PATCH 17/26] Linux: exit_group syscall number is always available Florian Weimer
@ 2020-02-09 20:21 ` Florian Weimer
  2020-02-27 23:31   ` Adhemerval Zanella
  2020-02-09 20:21 ` [PATCH 23/26] x86_64: Do not define __NR_semtimedop in <sysdep.h> Florian Weimer
                   ` (4 subsequent siblings)
  26 siblings, 1 reply; 58+ messages in thread
From: Florian Weimer @ 2020-02-09 20:21 UTC (permalink / raw)
  To: libc-alpha

Due to the built-in tables, __NR_pciconfig_iobase is always defined.
---
 sysdeps/unix/sysv/linux/alpha/ioperm.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/alpha/ioperm.c b/sysdeps/unix/sysv/linux/alpha/ioperm.c
index 086c782b9f..1f9c38db98 100644
--- a/sysdeps/unix/sysv/linux/alpha/ioperm.c
+++ b/sysdeps/unix/sysv/linux/alpha/ioperm.c
@@ -542,7 +542,6 @@ init_iosys (void)
 
   /* First try the pciconfig_iobase syscall added to 2.2.15 and 2.3.99.  */
 
-#ifdef __NR_pciconfig_iobase
   addr = __pciconfig_iobase (IOBASE_DENSE_MEM, 0, 0);
   if (addr != -1)
     {
@@ -584,7 +583,6 @@ init_iosys (void)
 
       return 0;
     }
-#endif
 
   /* Second, collect the contents of /etc/alpha_systype or /proc/cpuinfo.  */
 
-- 
2.24.1


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

* [PATCH 23/26] x86_64: Do not define __NR_semtimedop in <sysdep.h>
  2020-02-09 20:19 [PATCH 00/26] Linux cleanups enabled by built-in system call tables Florian Weimer
                   ` (21 preceding siblings ...)
  2020-02-09 20:21 ` [PATCH 19/26] Linux: pciconfig_iobase syscall number is always available on alpha Florian Weimer
@ 2020-02-09 20:21 ` Florian Weimer
  2020-02-27 23:46   ` Adhemerval Zanella
  2020-02-09 20:21 ` [PATCH 21/26] Linux: open_by_handle_at syscall number is always available Florian Weimer
                   ` (3 subsequent siblings)
  26 siblings, 1 reply; 58+ messages in thread
From: Florian Weimer @ 2020-02-09 20:21 UTC (permalink / raw)
  To: libc-alpha

The definition is always available from the built-in system call table.
---
 sysdeps/unix/sysv/linux/x86_64/sysdep.h | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
index c2eb37e575..b8aa1a2b2f 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
@@ -33,13 +33,6 @@
 #undef SYS_ify
 #define SYS_ify(syscall_name)	__NR_##syscall_name
 
-/* This is to help the old kernel headers where __NR_semtimedop is not
-   available.  */
-#ifndef __NR_semtimedop
-# define __NR_semtimedop 220
-#endif
-
-
 #ifdef __ASSEMBLER__
 
 /* Linux uses a negative return value to indicate syscall errors,
-- 
2.24.1


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

* [PATCH 25/26] m68k: getpagesize syscall number is always available
  2020-02-09 20:19 [PATCH 00/26] Linux cleanups enabled by built-in system call tables Florian Weimer
                   ` (14 preceding siblings ...)
  2020-02-09 20:20 ` [PATCH 11/26] Linux: Clean up preadv2, pwritev2 " Florian Weimer
@ 2020-02-09 20:21 ` Florian Weimer
  2020-02-27 23:47   ` Adhemerval Zanella
  2020-02-09 20:21 ` [PATCH 26/26] microblaze: vfork " Florian Weimer
                   ` (10 subsequent siblings)
  26 siblings, 1 reply; 58+ messages in thread
From: Florian Weimer @ 2020-02-09 20:21 UTC (permalink / raw)
  To: libc-alpha

Due to the built-in tables, __NR_getpagesize is always defined.
---
 sysdeps/unix/sysv/linux/m68k/getpagesize.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/m68k/getpagesize.c b/sysdeps/unix/sysv/linux/m68k/getpagesize.c
index ad6559320e..2e419af0e5 100644
--- a/sysdeps/unix/sysv/linux/m68k/getpagesize.c
+++ b/sysdeps/unix/sysv/linux/m68k/getpagesize.c
@@ -28,20 +28,16 @@
 int
 __getpagesize (void)
 {
-#ifdef __NR_getpagesize
   int result;
-#endif
 
   if (GLRO(dl_pagesize) != 0)
     return GLRO(dl_pagesize);
 
-#ifdef __NR_getpagesize
   INTERNAL_SYSCALL_DECL (err);
   result = INTERNAL_SYSCALL (getpagesize, err, 0);
   /* The only possible error is ENOSYS.  */
   if (!INTERNAL_SYSCALL_ERROR_P (result, err))
     return result;
-#endif
 
   return 4096;
 }
-- 
2.24.1


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

* [PATCH 24/26] Linux: epoll_pwait syscall number is always available
  2020-02-09 20:19 [PATCH 00/26] Linux cleanups enabled by built-in system call tables Florian Weimer
                   ` (24 preceding siblings ...)
  2020-02-09 20:21 ` [PATCH 20/26] Linux: set_robust_list " Florian Weimer
@ 2020-02-09 20:21 ` Florian Weimer
  2020-02-27 23:47   ` Adhemerval Zanella
  2020-02-10 23:25 ` [PATCH 00/26] Linux cleanups enabled by built-in system call tables Lukasz Majewski
  26 siblings, 1 reply; 58+ messages in thread
From: Florian Weimer @ 2020-02-09 20:21 UTC (permalink / raw)
  To: libc-alpha

Due to the built-in tables, __NR_epoll_pwait is always defined.
---
 sysdeps/unix/sysv/linux/epoll_pwait.c | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/epoll_pwait.c b/sysdeps/unix/sysv/linux/epoll_pwait.c
index fcd2a47d85..66f04482c7 100644
--- a/sysdeps/unix/sysv/linux/epoll_pwait.c
+++ b/sysdeps/unix/sysv/linux/epoll_pwait.c
@@ -23,8 +23,6 @@
 #include <sysdep-cancel.h>
 #include <sys/syscall.h>
 
-#ifdef __NR_epoll_pwait
-
 /* Wait for events on an epoll instance "epfd". Returns the number of
    triggered events returned in "events" buffer. Or -1 in case of
    error with the "errno" variable set to the specific error code. The
@@ -42,18 +40,4 @@ int epoll_pwait (int epfd, struct epoll_event *events,
   return SYSCALL_CANCEL (epoll_pwait, epfd, events, maxevents,
 			 timeout, set, _NSIG / 8);
 }
-
-#else
-
-int epoll_pwait (int epfd, struct epoll_event *events,
-		 int maxevents, int timeout,
-		 const sigset_t *set)
-{
-  __set_errno (ENOSYS);
-  return -1;
-}
-stub_warning (epoll_pwait)
-
-#endif
-
 libc_hidden_def (epoll_pwait)
-- 
2.24.1


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

* [PATCH 17/26] Linux: exit_group syscall number is always available
  2020-02-09 20:19 [PATCH 00/26] Linux cleanups enabled by built-in system call tables Florian Weimer
                   ` (19 preceding siblings ...)
  2020-02-09 20:21 ` [PATCH 22/26] ia64: Do not define __NR_semtimedop in <sysdep.h> Florian Weimer
@ 2020-02-09 20:21 ` Florian Weimer
  2020-02-27 23:31   ` Adhemerval Zanella
  2020-02-09 20:21 ` [PATCH 19/26] Linux: pciconfig_iobase syscall number is always available on alpha Florian Weimer
                   ` (5 subsequent siblings)
  26 siblings, 1 reply; 58+ messages in thread
From: Florian Weimer @ 2020-02-09 20:21 UTC (permalink / raw)
  To: libc-alpha

Due to the built-in tables, __NR_exit_group is always defined.
---
 sysdeps/unix/sysv/linux/_exit.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/_exit.c b/sysdeps/unix/sysv/linux/_exit.c
index 5896c15da6..a8521101b3 100644
--- a/sysdeps/unix/sysv/linux/_exit.c
+++ b/sysdeps/unix/sysv/linux/_exit.c
@@ -27,9 +27,7 @@ _exit (int status)
 {
   while (1)
     {
-#ifdef __NR_exit_group
       INLINE_SYSCALL (exit_group, 1, status);
-#endif
       INLINE_SYSCALL (exit, 1, status);
 
 #ifdef ABORT_INSTRUCTION
-- 
2.24.1


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

* Re: [PATCH 00/26] Linux cleanups enabled by built-in system call tables
  2020-02-09 20:19 [PATCH 00/26] Linux cleanups enabled by built-in system call tables Florian Weimer
                   ` (25 preceding siblings ...)
  2020-02-09 20:21 ` [PATCH 24/26] Linux: epoll_pwait " Florian Weimer
@ 2020-02-10 23:25 ` Lukasz Majewski
  2020-02-10 23:56   ` Joseph Myers
  2020-02-11  7:47   ` Florian Weimer
  26 siblings, 2 replies; 58+ messages in thread
From: Lukasz Majewski @ 2020-02-10 23:25 UTC (permalink / raw)
  To: Florian Weimer; +Cc: libc-alpha

[-- Attachment #1: Type: text/plain, Size: 5668 bytes --]

Hi Florian,

> This series cleans up various quirks in the Linux implementation
> related to historic lack of system call numbers in several places.

I'm wondering if those "system call tables" are generated from headers
from contemporary Linux (e.g. 5.5) or the oldest supported by glibc
(3.2)?

Moreover, I thought that the

#ifdef __NR_foo_syscall__ define was to prevent from mismatch between
newest glibc build with old linux kernel headers and running under yet
another kernel.

Is there any documentation regarding this new "approach"/"feature" with
those "system call tables"?

(I'm asking as I'm a bit puzzled).

Thanks in advance for explanation.

> 
> It has been tested on aarch64-linux-gnu, i686-linux-gnu,
> powerpc64le-linux-gnu, s390x-linux-gnu, x86_64-linux-gnu, and also
> built with build-many-glibcs-py.
> 
> I did not touch the futex #ifdefs because they are going to change
> soon enough.
> 
> Thanks,
> Florian
> 
> Florian Weimer (26):
>   Linux: Enhance glibcsyscalls.h to support listing system calls
>   Linux: renameat2 syscall number is always available
>   Linux: copy_file_range syscall number is always available
>   Linux: mlock2 syscall number is always available
>   Linux: mq_* syscall numbers are always available
>   Linux: statx syscall number is always available
>   Linux: sched_setaffinity syscall number is always available
>   Linux: sched_getaffinity syscall number is always available
>   Linux: sigaltstack syscall number is always available
>   Linux: Clean up pread64/pwrite64 system call names
>   Linux: Clean up preadv2, pwritev2 system call names
>   Linux: Clean up preadv, pwritev system call names
>   Linux: getrandom syscall number is always available
>   Linux: rt_sigqueueinfo syscall number is always available
>   Linux: pkey_mprotect syscall number is always available
>   Linux: set_tid_address syscall number is always available
>   Linux: exit_group syscall number is always available
>   Linux: getdents64 syscall number is always available on MIPS
>   Linux: pciconfig_iobase syscall number is always available on alpha
>   Linux: set_robust_list syscall number is always available
>   Linux: open_by_handle_at syscall number is always available
>   ia64: Do not define __NR_semtimedop in <sysdep.h>
>   x86_64: Do not define __NR_semtimedop in <sysdep.h>
>   Linux: epoll_pwait syscall number is always available
>   m68k: getpagesize syscall number is always available
>   microblaze: vfork is always available
> 
>  nptl/nptl-init.c                              |  4 -
>  nptl/pthread_create.c                         |  6 +-
>  sysdeps/nptl/fork.c                           | 10 +--
>  sysdeps/unix/sysv/linux/_exit.c               |  2 -
>  sysdeps/unix/sysv/linux/aio_sigqueue.c        |  5 --
>  sysdeps/unix/sysv/linux/alpha/ioperm.c        |  2 -
>  sysdeps/unix/sysv/linux/copy_file_range.c     |  5 --
>  sysdeps/unix/sysv/linux/epoll_pwait.c         | 16 ----
>  sysdeps/unix/sysv/linux/gai_sigqueue.c        |  5 --
>  sysdeps/unix/sysv/linux/generic/sysdep.h      |  8 --
>  sysdeps/unix/sysv/linux/getentropy.c          |  9 --
>  sysdeps/unix/sysv/linux/getrandom.c           | 13 ---
>  sysdeps/unix/sysv/linux/glibcsyscalls.py      | 86
> ++++++++++++++++++- sysdeps/unix/sysv/linux/ia64/sysdep.h         |
> 6 -- sysdeps/unix/sysv/linux/m68k/getpagesize.c    |  4 -
>  sysdeps/unix/sysv/linux/microblaze/vfork.S    |  4 -
>  .../unix/sysv/linux/mips/mips64/getdents64.c  |  2 -
>  sysdeps/unix/sysv/linux/mlock2.c              |  2 -
>  sysdeps/unix/sysv/linux/mq_close.c            |  6 --
>  sysdeps/unix/sysv/linux/mq_getattr.c          |  6 --
>  sysdeps/unix/sysv/linux/mq_notify.c           |  6 --
>  sysdeps/unix/sysv/linux/mq_open.c             |  5 --
>  sysdeps/unix/sysv/linux/mq_receive.c          |  6 --
>  sysdeps/unix/sysv/linux/mq_send.c             |  6 --
>  sysdeps/unix/sysv/linux/mq_unlink.c           |  6 --
>  sysdeps/unix/sysv/linux/nscd_setup_thread.c   |  2 -
>  sysdeps/unix/sysv/linux/open_by_handle_at.c   |  9 --
>  sysdeps/unix/sysv/linux/pkey_mprotect.c       |  5 --
>  sysdeps/unix/sysv/linux/pread.c               |  6 +-
>  sysdeps/unix/sysv/linux/pread64.c             |  4 -
>  sysdeps/unix/sysv/linux/pread64_nocancel.c    |  4 -
>  sysdeps/unix/sysv/linux/preadv.c              |  6 --
>  sysdeps/unix/sysv/linux/preadv2.c             |  7 +-
>  sysdeps/unix/sysv/linux/preadv64.c            | 10 +--
>  sysdeps/unix/sysv/linux/preadv64v2.c          |  9 +-
>  sysdeps/unix/sysv/linux/pwrite.c              |  6 +-
>  sysdeps/unix/sysv/linux/pwrite64.c            |  4 -
>  sysdeps/unix/sysv/linux/pwritev.c             |  6 --
>  sysdeps/unix/sysv/linux/pwritev2.c            |  4 +-
>  sysdeps/unix/sysv/linux/pwritev64.c           | 10 +--
>  sysdeps/unix/sysv/linux/pwritev64v2.c         |  9 +-
>  sysdeps/unix/sysv/linux/renameat2.c           |  7 +-
>  sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h | 11 ---
>  sysdeps/unix/sysv/linux/sched_getaffinity.c   | 10 +--
>  sysdeps/unix/sysv/linux/sched_setaffinity.c   |  7 +-
>  sysdeps/unix/sysv/linux/sigstack.c            |  4 -
>  sysdeps/unix/sysv/linux/statx.c               | 11 +--
>  sysdeps/unix/sysv/linux/x86_64/sysdep.h       |  7 --
>  48 files changed, 115 insertions(+), 273 deletions(-)
> 




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 00/26] Linux cleanups enabled by built-in system call tables
  2020-02-10 23:25 ` [PATCH 00/26] Linux cleanups enabled by built-in system call tables Lukasz Majewski
@ 2020-02-10 23:56   ` Joseph Myers
  2020-02-11  7:47   ` Florian Weimer
  1 sibling, 0 replies; 58+ messages in thread
From: Joseph Myers @ 2020-02-10 23:56 UTC (permalink / raw)
  To: Lukasz Majewski; +Cc: Florian Weimer, libc-alpha

On Tue, 11 Feb 2020, Lukasz Majewski wrote:

> Hi Florian,
> 
> > This series cleans up various quirks in the Linux implementation
> > related to historic lack of system call numbers in several places.
> 
> I'm wondering if those "system call tables" are generated from headers
> from contemporary Linux (e.g. 5.5) or the oldest supported by glibc
> (3.2)?

See commit 4cf0d223052dabb9caed29e1e91e1d61933e14fb and the next few 
commits.

-- 
Joseph S. Myers
joseph@codesourcery.com

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

* Re: [PATCH 00/26] Linux cleanups enabled by built-in system call tables
  2020-02-10 23:25 ` [PATCH 00/26] Linux cleanups enabled by built-in system call tables Lukasz Majewski
  2020-02-10 23:56   ` Joseph Myers
@ 2020-02-11  7:47   ` Florian Weimer
  2020-02-11 11:07     ` Florian Weimer
  1 sibling, 1 reply; 58+ messages in thread
From: Florian Weimer @ 2020-02-11  7:47 UTC (permalink / raw)
  To: Lukasz Majewski; +Cc: libc-alpha

* Lukasz Majewski:

>> This series cleans up various quirks in the Linux implementation
>> related to historic lack of system call numbers in several places.
>
> I'm wondering if those "system call tables" are generated from headers
> from contemporary Linux (e.g. 5.5) or the oldest supported by glibc
> (3.2)?

We are keeping them up-to-date with the latest released kernel headers.

> Moreover, I thought that the
>
> #ifdef __NR_foo_syscall__ define was to prevent from mismatch between
> newest glibc build with old linux kernel headers and running under yet
> another kernel.

It is very common that new system call numbers are backported.  This
happens even in upstream stable kernel series.  We expect that the glibc
sources are written in such a way that the __NR_* #ifdefs only cover the
availability of the number itself.  They are not treated as a proxy for
anything else (such as availability of types in headers or individual
header files).

I've posted a patch series that should clarify this: it removes historic
#ifdefs which are no longer needed under the new model:

  <https://www.sourceware.org/ml/libc-alpha/2020-02/msg00214.html>

> Is there any documentation regarding this new "approach"/"feature" with
> those "system call tables"?

I'm not sure what needs to be documented.  Only two things should have
changed:

* It is no longer necessary to write these #ifdefs.

* If one compiles glibc with older UAPI headers, you still get a full
  glibc with all features, as far is that possible.  Previously, some
  parts could be stubbed out (e.g., return ENOSYS unconditionally even
  if the kernel supports the feature).  Now, this only happens if Linux
  has not published required system call numbers.

Thanks,
Florian

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

* Re: [PATCH 00/26] Linux cleanups enabled by built-in system call tables
  2020-02-11  7:47   ` Florian Weimer
@ 2020-02-11 11:07     ` Florian Weimer
  0 siblings, 0 replies; 58+ messages in thread
From: Florian Weimer @ 2020-02-11 11:07 UTC (permalink / raw)
  To: Lukasz Majewski; +Cc: libc-alpha

* Florian Weimer:

> I've posted a patch series that should clarify this: it removes historic
> #ifdefs which are no longer needed under the new model:
>
>   <https://www.sourceware.org/ml/libc-alpha/2020-02/msg00214.html>

Sorry, please disregard this part.  I was confused.

Florian

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

* Re: [PATCH 01/26] Linux: Enhance glibcsyscalls.h to support listing system calls
  2020-02-09 20:19 ` [PATCH 01/26] Linux: Enhance glibcsyscalls.h to support listing system calls Florian Weimer
@ 2020-02-27 22:14   ` Adhemerval Zanella
  2020-05-11 10:10     ` Florian Weimer
  0 siblings, 1 reply; 58+ messages in thread
From: Adhemerval Zanella @ 2020-02-27 22:14 UTC (permalink / raw)
  To: libc-alpha



On 09/02/2020 17:19, Florian Weimer wrote:
> The script can now be called to query the definition status of
> system call numbers across all architectures, like this:
> 
> $ python3 sysdeps/unix/sysv/linux/glibcsyscalls.py query-syscall sync_file_range sync_file_range2
> sync_file_range:
>   defined: aarch64 alpha csky hppa i386 ia64 m68k microblaze mips/mips32 mips/mips64/n32 mips/mips64/n64 nios2 riscv/rv64 s390/s390-32 s390/s390-64 sh sparc/sparc32 sparc/sparc64 x86_64/64 x86_64/x32
>   undefined: arm powerpc/powerpc32 powerpc/powerpc64
> sync_file_range2:
>   defined: arm powerpc/powerpc32 powerpc/powerpc64
>   undefined: aarch64 alpha csky hppa i386 ia64 m68k microblaze mips/mips32 mips/mips64/n32 mips/mips64/n64 nios2 riscv/rv64 s390/s390-32 s390/s390-64 sh sparc/sparc32 sparc/sparc64 x86_64/64 x86_64/x32
> ---
>  sysdeps/unix/sysv/linux/glibcsyscalls.py | 86 +++++++++++++++++++++++-
>  1 file changed, 85 insertions(+), 1 deletion(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/glibcsyscalls.py b/sysdeps/unix/sysv/linux/glibcsyscalls.py
> index de4d707e48..5beac42cb4 100644
> --- a/sysdeps/unix/sysv/linux/glibcsyscalls.py
> +++ b/sysdeps/unix/sysv/linux/glibcsyscalls.py
> @@ -17,9 +17,12 @@
>  # License along with the GNU C Library; if not, see
>  # <http://www.gnu.org/licenses/>.
>  
> +import os
>  import re

Now that this would be used as a script issued directly by the
user, I think it is worth to add a more comprehensible description
(one that can be used as __doc__). 

>  
> -import glibcextract
> +if __name__ != '__main__':
> +    # When called as a main program, this is not needed.
> +    import glibcextract
>  
>  def extract_system_call_name(macro):
>      """Convert the macro name (with __NR_) to a system call name."""
> @@ -168,3 +171,84 @@ def linux_kernel_version(cc):
>      val = glibcextract.compute_c_consts(sym_data, cc)['LINUX_VERSION_CODE']
>      val = int(val)
>      return ((val & 0xff0000) >> 16, (val & 0xff00) >> 8)
> +
> +class ArchSyscall:
> +    """Canonical name and location of a syscall header."""
> +
> +    def __init__(self, name, path):
> +        self.name = name
> +        self.path = path
> +
> +    def __repr__(self):
> +        return 'ArchSyscall(name={!r}, patch={!r})'.format(
> +            self.name, self.path)
> +
> +def list_arch_syscall_headers(topdir):
> +    """A generator which returns all the ArchSyscall objects in a tree."""
> +
> +    sysdeps = os.path.join(topdir, 'sysdeps', 'unix', 'sysv', 'linux')
> +    for root, dirs, files in os.walk(sysdeps):
> +        if root != sysdeps:
> +            for filename in files:
> +                if filename == 'arch-syscall.h':
> +                    yield ArchSyscall(
> +                        name=os.path.relpath(root, sysdeps),
> +                        path=os.path.join(root, filename))
> +
> +def __main():
> +    """Entry point when called as the main program."""
> +
> +    import sys
> +
> +    # Top-level directory of the source tree.
> +    topdir = os.path.realpath(os.path.join(
> +        os.path.dirname(os.path.realpath(__file__)), *('..',) * 4))
> +
> +    def usage(status):
> +        print('usage: glibcsyscalls list-headers')
> +        print('       glibcsyscalls query-syscall SYSCALL...')
> +        sys.exit(status)
> +
> +    if len(sys.argv) <= 1:
> +        usage(0)
> +
> +    command = sys.argv[1]
> +    if command == 'list-headers':
> +        # Print the absolute paths of all arch-syscall.h header files.
> +        if len(sys.argv) != 2:
> +            usage(1)
> +        for header in sorted([syscall.path for syscall
> +                              in list_arch_syscall_headers(topdir)]):
> +            print(header)
> +
> +    elif command == 'query-syscall':
> +        # Summarize the implementation status of the specified system calls.
> +        if len(sys.argv) < 3:
> +            usage(1)

Why not follow other scripts and use argparser as well? Something like:

--
def main(argv):
    """Entry point when called as the main program."""

    import argparse

    # Top-level directory of the source tree.
    topdir = os.path.realpath(os.path.join(
        os.path.dirname(os.path.realpath(__file__)), *('..',) * 4))

    def get_parser():
        parser = argparse.ArgumentParser(description=__doc__)
        subparsers = parser.add_subparsers(dest='command', required=True)
        parser_a = subparsers.add_parser('list-headers');
        parser_b = subparsers.add_parser('query-syscall');
        parser_b.add_argument('syscalls',
                              help='Which syscalls to check',
                              nargs='+')
        return parser
    parser = get_parser();
    opts = parser.parse_args(argv)

    if opts.command == 'list-headers':
    [...]
--

> +
> +        # List of system call tables.
> +        tables = sorted(list_arch_syscall_headers(topdir),
> +                          key=lambda syscall: syscall.name)
> +        for table in tables:
> +            table.numbers = load_arch_syscall_header(table.path)
> +
> +        for nr in sys.argv[2:]:
> +            defined = [table.name for table in tables
> +                           if nr in table.numbers]
> +            undefined = [table.name for table in tables
> +                             if nr not in table.numbers]
> +            if not defined:
> +                print('{}: not defined on any architecture'.format(nr))
> +            elif not undefined:
> +                print('{}: defined on all architectures'.format(nr))
> +            else:
> +                print('{}:'.format(nr))
> +                print('  defined: {}'.format(' '.join(defined)))
> +                print('  undefined: {}'.format(' '.join(undefined)))
> +
> +    else:
> +        # Unrecognized command.
> +        usage(1)
> +
> +if __name__ == '__main__':
> +    __main()
> 

I don't think double underscore is required here.

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

* Re: [PATCH 06/26] Linux: statx syscall number is always available
  2020-02-09 20:20 ` [PATCH 06/26] Linux: statx " Florian Weimer
@ 2020-02-27 23:06   ` Adhemerval Zanella
  0 siblings, 0 replies; 58+ messages in thread
From: Adhemerval Zanella @ 2020-02-27 23:06 UTC (permalink / raw)
  To: libc-alpha



On 09/02/2020 17:20, Florian Weimer wrote:
> Due to the built-in tables, __NR_statx is always defined.

LGTM, thanks. 

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/unix/sysv/linux/statx.c | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/statx.c b/sysdeps/unix/sysv/linux/statx.c
> index a119b7a29e..9721fc12a5 100644
> --- a/sysdeps/unix/sysv/linux/statx.c
> +++ b/sysdeps/unix/sysv/linux/statx.c
> @@ -25,17 +25,14 @@ int
>  statx (int fd, const char *path, int flags,
>         unsigned int mask, struct statx *buf)
>  {
> -#ifdef __NR_statx
>    int ret = INLINE_SYSCALL_CALL (statx, fd, path, flags, mask, buf);
> -# ifdef __ASSUME_STATX
> +#ifdef __ASSUME_STATX
>    return ret;
> -# else
> +#else
>    if (ret == 0 || errno != ENOSYS)
>      /* Preserve non-error/non-ENOSYS return values.  */
>      return ret;
> -# endif
> -#endif
> -#ifndef __ASSUME_STATX
> -  return statx_generic (fd, path, flags, mask, buf);
> +  else
> +    return statx_generic (fd, path, flags, mask, buf);
>  #endif
>  }
> 

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

* Re: [PATCH 04/26] Linux: mlock2 syscall number is always available
  2020-02-09 20:19 ` [PATCH 04/26] Linux: mlock2 syscall number is always available Florian Weimer
@ 2020-02-27 23:06   ` Adhemerval Zanella
  0 siblings, 0 replies; 58+ messages in thread
From: Adhemerval Zanella @ 2020-02-27 23:06 UTC (permalink / raw)
  To: libc-alpha



On 09/02/2020 17:19, Florian Weimer wrote:
> Due to the built-in tables, __NR_mlock2 is always defined.

LGTM, thanks. 

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/unix/sysv/linux/mlock2.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/mlock2.c b/sysdeps/unix/sysv/linux/mlock2.c
> index 7cea23d47c..e52f43f35c 100644
> --- a/sysdeps/unix/sysv/linux/mlock2.c
> +++ b/sysdeps/unix/sysv/linux/mlock2.c
> @@ -27,11 +27,9 @@ mlock2 (const void *addr, size_t length, unsigned int flags)
>  #else
>    if (flags == 0)
>      return INLINE_SYSCALL_CALL (mlock, addr, length);
> -# ifdef __NR_mlock2
>    int ret = INLINE_SYSCALL_CALL (mlock2, addr, length, flags);
>    if (ret == 0 || errno != ENOSYS)
>      return ret;
> -# endif /* __NR_mlock2 */
>    /* Treat the missing system call as an invalid (non-zero) flag
>       argument.  */
>    __set_errno (EINVAL);
> 

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

* Re: [PATCH 03/26] Linux: copy_file_range syscall number is always available
  2020-02-09 20:19 ` [PATCH 03/26] Linux: copy_file_range " Florian Weimer
@ 2020-02-27 23:06   ` Adhemerval Zanella
  0 siblings, 0 replies; 58+ messages in thread
From: Adhemerval Zanella @ 2020-02-27 23:06 UTC (permalink / raw)
  To: libc-alpha



On 09/02/2020 17:19, Florian Weimer wrote:
> Due to the built-in tables, __NR_copy_file_range is always defined.

LGTM, thanks. 

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/unix/sysv/linux/copy_file_range.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/copy_file_range.c b/sysdeps/unix/sysv/linux/copy_file_range.c
> index 65597ca025..a73c89f079 100644
> --- a/sysdeps/unix/sysv/linux/copy_file_range.c
> +++ b/sysdeps/unix/sysv/linux/copy_file_range.c
> @@ -25,11 +25,6 @@ copy_file_range (int infd, __off64_t *pinoff,
>                   int outfd, __off64_t *poutoff,
>                   size_t length, unsigned int flags)
>  {
> -#ifdef __NR_copy_file_range
>    return SYSCALL_CANCEL (copy_file_range, infd, pinoff, outfd, poutoff,
>                           length, flags);
> -#else
> -  __set_errno (ENOSYS);
> -  return -1;
> -#endif
>  }
> 

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

* Re: [PATCH 07/26] Linux: sched_setaffinity syscall number is always available
  2020-02-09 20:20 ` [PATCH 07/26] Linux: sched_setaffinity " Florian Weimer
@ 2020-02-27 23:06   ` Adhemerval Zanella
  0 siblings, 0 replies; 58+ messages in thread
From: Adhemerval Zanella @ 2020-02-27 23:06 UTC (permalink / raw)
  To: libc-alpha



On 09/02/2020 17:20, Florian Weimer wrote:
> Due to the built-in tables, __NR_sched_setaffinity is always defined.

LGTM, thanks. 

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/unix/sysv/linux/sched_setaffinity.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/sched_setaffinity.c b/sysdeps/unix/sysv/linux/sched_setaffinity.c
> index bc0c42ce52..fc2c692783 100644
> --- a/sysdeps/unix/sysv/linux/sched_setaffinity.c
> +++ b/sysdeps/unix/sysv/linux/sched_setaffinity.c
> @@ -24,8 +24,6 @@
>  #include <shlib-compat.h>
>  
>  
> -#ifdef __NR_sched_setaffinity
> -
>  extern int __sched_setaffinity_new (pid_t, size_t, const cpu_set_t *);
>  libc_hidden_proto (__sched_setaffinity_new)
>  
> @@ -46,7 +44,7 @@ versioned_symbol (libc, __sched_setaffinity_new, sched_setaffinity,
>  		  GLIBC_2_3_4);
>  
>  
> -# if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
> +#if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
>  int
>  attribute_compat_text_section
>  __sched_setaffinity_old (pid_t pid, const cpu_set_t *cpuset)
> @@ -55,7 +53,4 @@ __sched_setaffinity_old (pid_t pid, const cpu_set_t *cpuset)
>    return __sched_setaffinity_new (pid, 128, cpuset);
>  }
>  compat_symbol (libc, __sched_setaffinity_old, sched_setaffinity, GLIBC_2_3_3);
> -# endif
> -#else
> -# include <posix/sched_setaffinity.c>
>  #endif
> 

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

* Re: [PATCH 08/26] Linux: sched_getaffinity syscall number is always available
  2020-02-09 20:20 ` [PATCH 08/26] Linux: sched_getaffinity " Florian Weimer
@ 2020-02-27 23:06   ` Adhemerval Zanella
  0 siblings, 0 replies; 58+ messages in thread
From: Adhemerval Zanella @ 2020-02-27 23:06 UTC (permalink / raw)
  To: libc-alpha



On 09/02/2020 17:20, Florian Weimer wrote:
> Due to the built-in tables, __NR_sched_getaffinity is always defined.

LGTM, thanks. 

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/unix/sysv/linux/sched_getaffinity.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/sched_getaffinity.c b/sysdeps/unix/sysv/linux/sched_getaffinity.c
> index 6d79a41c34..325bfb29c1 100644
> --- a/sysdeps/unix/sysv/linux/sched_getaffinity.c
> +++ b/sysdeps/unix/sysv/linux/sched_getaffinity.c
> @@ -24,11 +24,10 @@
>  #include <shlib-compat.h>
>  
>  
> -#ifdef __NR_sched_getaffinity
> -# if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
> +#if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
>  extern int __sched_getaffinity_new (pid_t, size_t, cpu_set_t *);
>  libc_hidden_proto (__sched_getaffinity_new)
> -# endif
> +#endif
>  
>  int
>  __sched_getaffinity_new (pid_t pid, size_t cpusetsize, cpu_set_t *cpuset)
> @@ -48,7 +47,7 @@ versioned_symbol (libc, __sched_getaffinity_new, sched_getaffinity,
>  		  GLIBC_2_3_4);
>  
>  
> -# if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
> +#if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
>  libc_hidden_def (__sched_getaffinity_new)
>  
>  int
> @@ -59,7 +58,4 @@ __sched_getaffinity_old (pid_t pid, cpu_set_t *cpuset)
>    return __sched_getaffinity_new (pid, 128, cpuset);
>  }
>  compat_symbol (libc, __sched_getaffinity_old, sched_getaffinity, GLIBC_2_3_3);
> -# endif
> -#else
> -# include <posix/sched_getaffinity.c>
>  #endif
> 

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

* Re: [PATCH 09/26] Linux: sigaltstack syscall number is always available
  2020-02-09 20:20 ` [PATCH 09/26] Linux: sigaltstack " Florian Weimer
@ 2020-02-27 23:06   ` Adhemerval Zanella
  0 siblings, 0 replies; 58+ messages in thread
From: Adhemerval Zanella @ 2020-02-27 23:06 UTC (permalink / raw)
  To: libc-alpha



On 09/02/2020 17:20, Florian Weimer wrote:
> Due to the built-in tables, __NR_sigaltstack is always defined.

LGTM, thanks. 

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/unix/sysv/linux/sigstack.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/sigstack.c b/sysdeps/unix/sysv/linux/sigstack.c
> index 2f75e2643a..32a378bd26 100644
> --- a/sysdeps/unix/sysv/linux/sigstack.c
> +++ b/sysdeps/unix/sysv/linux/sigstack.c
> @@ -22,7 +22,6 @@
>  #include <sys/syscall.h>
>  
>  
> -#ifdef __NR_sigaltstack
>  int
>  sigstack (struct sigstack *ss, struct sigstack *oss)
>  {
> @@ -61,6 +60,3 @@ sigstack (struct sigstack *ss, struct sigstack *oss)
>  }
>  
>  link_warning (sigstack, "the `sigstack' function is dangerous.  `sigaltstack' should be used instead.")
> -#else
> -# include <signal/sigstack.c>
> -#endif
> 

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

* Re: [PATCH 05/26] Linux: mq_* syscall numbers are always available
  2020-02-09 20:20 ` [PATCH 05/26] Linux: mq_* syscall numbers are " Florian Weimer
@ 2020-02-27 23:06   ` Adhemerval Zanella
  0 siblings, 0 replies; 58+ messages in thread
From: Adhemerval Zanella @ 2020-02-27 23:06 UTC (permalink / raw)
  To: libc-alpha



On 09/02/2020 17:19, Florian Weimer wrote:
> Due to the built-in tables, __NR_mq_getsetattr, __NR_mq_notify,
> __NR_mq_open, __NR_mq_timedreceive, __NR_mq_timedsend, __NR_mq_unlink
> are always defined.

LGTM, thanks. 

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/unix/sysv/linux/mq_close.c   | 6 ------
>  sysdeps/unix/sysv/linux/mq_getattr.c | 6 ------
>  sysdeps/unix/sysv/linux/mq_notify.c  | 6 ------
>  sysdeps/unix/sysv/linux/mq_open.c    | 5 -----
>  sysdeps/unix/sysv/linux/mq_receive.c | 6 ------
>  sysdeps/unix/sysv/linux/mq_send.c    | 6 ------
>  sysdeps/unix/sysv/linux/mq_unlink.c  | 6 ------
>  7 files changed, 41 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/mq_close.c b/sysdeps/unix/sysv/linux/mq_close.c
> index 6990182e68..e1b4898170 100644
> --- a/sysdeps/unix/sysv/linux/mq_close.c
> +++ b/sysdeps/unix/sysv/linux/mq_close.c
> @@ -19,8 +19,6 @@
>  #include <mqueue.h>
>  #include <sysdep.h>
>  
> -#ifdef __NR_mq_open
> -
>  /* Removes the association between message queue descriptor MQDES and its
>     message queue.  */
>  int
> @@ -28,7 +26,3 @@ mq_close (mqd_t mqdes)
>  {
>    return INLINE_SYSCALL (close, 1, mqdes);
>  }
> -
> -#else
> -# include <rt/mq_close.c>
> -#endif

Ok.

> diff --git a/sysdeps/unix/sysv/linux/mq_getattr.c b/sysdeps/unix/sysv/linux/mq_getattr.c
> index a8a17fd7bb..dc8acc5dcc 100644
> --- a/sysdeps/unix/sysv/linux/mq_getattr.c
> +++ b/sysdeps/unix/sysv/linux/mq_getattr.c
> @@ -20,15 +20,9 @@
>  #include <stddef.h>
>  #include <sysdep.h>
>  
> -#ifdef __NR_mq_getsetattr
> -
>  /* Query status and attributes of message queue MQDES.  */
>  int
>  mq_getattr (mqd_t mqdes, struct mq_attr *mqstat)
>  {
>    return mq_setattr (mqdes, NULL, mqstat);
>  }
> -
> -#else
> -# include <rt/mq_getattr.c>
> -#endif

Ok.

> diff --git a/sysdeps/unix/sysv/linux/mq_notify.c b/sysdeps/unix/sysv/linux/mq_notify.c
> index f288bac477..61bbb03b64 100644
> --- a/sysdeps/unix/sysv/linux/mq_notify.c
> +++ b/sysdeps/unix/sysv/linux/mq_notify.c
> @@ -31,8 +31,6 @@
>  #include <nptl/pthreadP.h>
>  
>  
> -#ifdef __NR_mq_notify
> -
>  /* Defined in the kernel headers: */
>  #define NOTIFY_COOKIE_LEN	32	/* Length of the cookie used.  */
>  #define NOTIFY_WOKENUP		1	/* Code for notifcation.  */
> @@ -276,7 +274,3 @@ mq_notify (mqd_t mqdes, const struct sigevent *notification)
>  
>    return retval;
>  }
> -
> -#else
> -# include <rt/mq_notify.c>
> -#endif

Ok.

> diff --git a/sysdeps/unix/sysv/linux/mq_open.c b/sysdeps/unix/sysv/linux/mq_open.c
> index ebb1bfc8b6..c88dc580e4 100644
> --- a/sysdeps/unix/sysv/linux/mq_open.c
> +++ b/sysdeps/unix/sysv/linux/mq_open.c
> @@ -22,8 +22,6 @@
>  #include <stdio.h>
>  #include <sysdep.h>
>  
> -#ifdef __NR_mq_open
> -
>  /* Establish connection between a process and a message queue NAME and
>     return message queue descriptor or (mqd_t) -1 on error.  OFLAG determines
>     the type of access used.  If O_CREAT is on OFLAG, the third argument is
> @@ -61,6 +59,3 @@ __mq_open_2 (const char *name, int oflag)
>  
>    return __mq_open (name, oflag);
>  }
> -#else
> -# include <rt/mq_open.c>
> -#endif

Ok.

> diff --git a/sysdeps/unix/sysv/linux/mq_receive.c b/sysdeps/unix/sysv/linux/mq_receive.c
> index 5292c98b8b..282f486911 100644
> --- a/sysdeps/unix/sysv/linux/mq_receive.c
> +++ b/sysdeps/unix/sysv/linux/mq_receive.c
> @@ -20,8 +20,6 @@
>  #include <stddef.h>
>  #include <sysdep.h>
>  
> -#ifdef __NR_mq_timedreceive
> -
>  /* Receive the oldest from highest priority messages in message queue
>     MQDES.  */
>  ssize_t
> @@ -30,7 +28,3 @@ mq_receive (mqd_t mqdes, char *msg_ptr, size_t msg_len,
>  {
>    return __mq_timedreceive (mqdes, msg_ptr, msg_len, msg_prio, NULL);
>  }
> -
> -#else
> -# include <rt/mq_receive.c>
> -#endif

Ok.

> diff --git a/sysdeps/unix/sysv/linux/mq_send.c b/sysdeps/unix/sysv/linux/mq_send.c
> index 8e297e6d99..38f320d3ab 100644
> --- a/sysdeps/unix/sysv/linux/mq_send.c
> +++ b/sysdeps/unix/sysv/linux/mq_send.c
> @@ -20,8 +20,6 @@
>  #include <stddef.h>
>  #include <sysdep.h>
>  
> -#ifdef __NR_mq_timedsend
> -
>  /* Add message pointed by MSG_PTR to message queue MQDES.  */
>  int
>  mq_send (mqd_t mqdes, const char *msg_ptr, size_t msg_len,
> @@ -29,7 +27,3 @@ mq_send (mqd_t mqdes, const char *msg_ptr, size_t msg_len,
>  {
>    return __mq_timedsend (mqdes, msg_ptr, msg_len, msg_prio, NULL);
>  }
> -
> -#else
> -# include <rt/mq_send.c>
> -#endif

Ok.

> diff --git a/sysdeps/unix/sysv/linux/mq_unlink.c b/sysdeps/unix/sysv/linux/mq_unlink.c
> index a0c3348744..feadaa29ec 100644
> --- a/sysdeps/unix/sysv/linux/mq_unlink.c
> +++ b/sysdeps/unix/sysv/linux/mq_unlink.c
> @@ -19,8 +19,6 @@
>  #include <mqueue.h>
>  #include <sysdep.h>
>  
> -#ifdef __NR_mq_unlink
> -
>  /* Remove message queue named NAME.  */
>  int
>  mq_unlink (const char *name)
> @@ -43,7 +41,3 @@ mq_unlink (const char *name)
>  
>    return ret;
>  }
> -
> -#else
> -# include <rt/mq_unlink.c>
> -#endif
> 

Ok.

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

* Re: [PATCH 02/26] Linux: renameat2 syscall number is always available
  2020-02-09 20:19 ` [PATCH 02/26] Linux: renameat2 syscall number is always available Florian Weimer
@ 2020-02-27 23:06   ` Adhemerval Zanella
  0 siblings, 0 replies; 58+ messages in thread
From: Adhemerval Zanella @ 2020-02-27 23:06 UTC (permalink / raw)
  To: libc-alpha



On 09/02/2020 17:19, Florian Weimer wrote:
> Due to the built-in tables, __NR_renameat2 is always defined.

LGTM, thanks. 

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/unix/sysv/linux/renameat2.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/renameat2.c b/sysdeps/unix/sysv/linux/renameat2.c
> index 05304c6445..22b4178a08 100644
> --- a/sysdeps/unix/sysv/linux/renameat2.c
> +++ b/sysdeps/unix/sysv/linux/renameat2.c
> @@ -29,15 +29,14 @@ __renameat2 (int oldfd, const char *old, int newfd, const char *new,
>  #else
>    if (flags == 0)
>      return __renameat (oldfd, old, newfd, new);
> -# ifdef __NR_renameat2
> +
>    /* For non-zero flags, try the renameat2 system call.  */
>    int ret = INLINE_SYSCALL_CALL (renameat2, oldfd, old, newfd, new, flags);
>    if (ret != -1 || errno != ENOSYS)
>      /* Preserve non-error/non-ENOSYS return values.  */
>      return ret;
> -# endif
> -  /* No kernel (header) support for renameat2.  All flags are
> -     unknown.  */
> +
> +  /* No kernel support for renameat2.  All flags are unknown.  */
>    __set_errno (EINVAL);
>    return -1;
>  #endif
> 

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

* Re: [PATCH 10/26] Linux: Clean up pread64/pwrite64 system call names
  2020-02-09 20:20 ` [PATCH 10/26] Linux: Clean up pread64/pwrite64 system call names Florian Weimer
@ 2020-02-27 23:08   ` Adhemerval Zanella
  0 siblings, 0 replies; 58+ messages in thread
From: Adhemerval Zanella @ 2020-02-27 23:08 UTC (permalink / raw)
  To: libc-alpha



On 09/02/2020 17:20, Florian Weimer wrote:
> Linux removed the last definitions of __NR_pread and __NR_pwrite
> in commit 4ba66a9760722ccbb691b8f7116cad2f791cca7b, the removal
> of the blackfin port.  All architectures now define __NR_pread64 and
> __NR_pwrite64 only.

LGTM, thanks. 

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/unix/sysv/linux/generic/sysdep.h      |  8 --------
>  sysdeps/unix/sysv/linux/pread.c               |  6 +-----
>  sysdeps/unix/sysv/linux/pread64.c             |  4 ----
>  sysdeps/unix/sysv/linux/pread64_nocancel.c    |  4 ----
>  sysdeps/unix/sysv/linux/pwrite.c              |  6 +-----
>  sysdeps/unix/sysv/linux/pwrite64.c            |  4 ----
>  sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h | 11 -----------
>  7 files changed, 2 insertions(+), 41 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/generic/sysdep.h b/sysdeps/unix/sysv/linux/generic/sysdep.h
> index 23defce7c3..40b4b955ca 100644
> --- a/sysdeps/unix/sysv/linux/generic/sysdep.h
> +++ b/sysdeps/unix/sysv/linux/generic/sysdep.h
> @@ -25,11 +25,3 @@
>  #ifdef __NR_llseek
>  # define __NR__llseek __NR_llseek
>  #endif
> -
> -#if __WORDSIZE == 64
> -/* By defining the older names, glibc will build syscall wrappers for
> -   both pread and pread64; sysdeps/unix/sysv/linux/wordsize-64/pread64.c
> -   will suppress generating any separate code for pread64.c.  */
> -#define __NR_pread __NR_pread64
> -#define __NR_pwrite __NR_pwrite64
> -#endif

Ok.

> diff --git a/sysdeps/unix/sysv/linux/pread.c b/sysdeps/unix/sysv/linux/pread.c
> index 7a09affd34..8dd87b3976 100644
> --- a/sysdeps/unix/sysv/linux/pread.c
> +++ b/sysdeps/unix/sysv/linux/pread.c
> @@ -21,14 +21,10 @@
>  
>  #ifndef __OFF_T_MATCHES_OFF64_T
>  
> -# ifndef __NR_pread
> -#  define __NR_pread __NR_pread64
> -# endif
> -
>  ssize_t
>  __libc_pread (int fd, void *buf, size_t count, off_t offset)
>  {
> -  return SYSCALL_CANCEL (pread, fd, buf, count, SYSCALL_LL_PRW (offset));
> +  return SYSCALL_CANCEL (pread64, fd, buf, count, SYSCALL_LL_PRW (offset));
>  }
>  
>  strong_alias (__libc_pread, __pread)

Ok.

> diff --git a/sysdeps/unix/sysv/linux/pread64.c b/sysdeps/unix/sysv/linux/pread64.c
> index a7f907186b..3d4ffbafc1 100644
> --- a/sysdeps/unix/sysv/linux/pread64.c
> +++ b/sysdeps/unix/sysv/linux/pread64.c
> @@ -19,10 +19,6 @@
>  #include <unistd.h>
>  #include <sysdep-cancel.h>
>  
> -#ifndef __NR_pread64
> -# define __NR_pread64 __NR_pread
> -#endif
> -
>  ssize_t
>  __libc_pread64 (int fd, void *buf, size_t count, off64_t offset)
>  {

Ok.

> diff --git a/sysdeps/unix/sysv/linux/pread64_nocancel.c b/sysdeps/unix/sysv/linux/pread64_nocancel.c
> index 2eb6873e66..af33985959 100644
> --- a/sysdeps/unix/sysv/linux/pread64_nocancel.c
> +++ b/sysdeps/unix/sysv/linux/pread64_nocancel.c
> @@ -20,10 +20,6 @@
>  #include <sysdep-cancel.h>
>  #include <not-cancel.h>
>  
> -#ifndef __NR_pread64
> -# define __NR_pread64 __NR_pread
> -#endif
> -
>  ssize_t
>  __pread64_nocancel (int fd, void *buf, size_t count, off64_t offset)
>  {

Ok.

> diff --git a/sysdeps/unix/sysv/linux/pwrite.c b/sysdeps/unix/sysv/linux/pwrite.c
> index 5ef208e885..17964686e5 100644
> --- a/sysdeps/unix/sysv/linux/pwrite.c
> +++ b/sysdeps/unix/sysv/linux/pwrite.c
> @@ -21,14 +21,10 @@
>  
>  #ifndef __OFF_T_MATCHES_OFF64_T
>  
> -# ifndef __NR_pwrite
> -#  define __NR_pwrite __NR_pwrite64
> -# endif
> -
>  ssize_t
>  __libc_pwrite (int fd, const void *buf, size_t count, off_t offset)
>  {
> -  return SYSCALL_CANCEL (pwrite, fd, buf, count, SYSCALL_LL_PRW (offset));
> +  return SYSCALL_CANCEL (pwrite64, fd, buf, count, SYSCALL_LL_PRW (offset));
>  }
>  
>  strong_alias (__libc_pwrite, __pwrite)

Ok.

> diff --git a/sysdeps/unix/sysv/linux/pwrite64.c b/sysdeps/unix/sysv/linux/pwrite64.c
> index 632f001f5b..709775c207 100644
> --- a/sysdeps/unix/sysv/linux/pwrite64.c
> +++ b/sysdeps/unix/sysv/linux/pwrite64.c
> @@ -19,10 +19,6 @@
>  #include <unistd.h>
>  #include <sysdep-cancel.h>
>  
> -#ifndef __NR_pwrite64
> -# define __NR_pwrite64 __NR_pwrite
> -#endif
> -
>  ssize_t
>  __libc_pwrite64 (int fd, const void *buf, size_t count, off64_t offset)
>  {

Ok.

> diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
> index 9ff4479dc3..cec1326662 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
> +++ b/sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
> @@ -39,17 +39,6 @@
>  /* In newer 2.1 kernels __NR_syscall is missing so we define it here.  */
>  #define __NR_syscall 0
>  
> -/*
> - * Newer kernel versions redefined __NR_pread and __NR_pwrite to
> - * __NR_pread64 and __NR_pwrite64.
> - */
> -#ifndef __NR_pread
> -# define __NR_pread __NR_pread64
> -#endif
> -#ifndef __NR_pwrite
> -# define __NR_pwrite __NR_pwrite64
> -#endif
> -
>  #undef SYS_ify
>  #define SYS_ify(syscall_name)	__NR_##syscall_name
>  
> 

Ok (although patch does not apply cleanly with recent s390-64 sysdep.h
changes).

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

* Re: [PATCH 12/26] Linux: Clean up preadv, pwritev system call names
  2020-02-09 20:20 ` [PATCH 12/26] Linux: Clean up preadv, pwritev system call names Florian Weimer
@ 2020-02-27 23:19   ` Adhemerval Zanella
  0 siblings, 0 replies; 58+ messages in thread
From: Adhemerval Zanella @ 2020-02-27 23:19 UTC (permalink / raw)
  To: libc-alpha



On 09/02/2020 17:20, Florian Weimer wrote:
> The names __NR_preadv64, __NR_pwritev64 appear to be a glibc invention.
> With the built-in tables, __NR_preadv and __NR_pwritev are always defined.

LGTM, thanks. 

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/unix/sysv/linux/preadv.c    |  6 ------
>  sysdeps/unix/sysv/linux/preadv64.c  | 10 ++--------
>  sysdeps/unix/sysv/linux/pwritev.c   |  6 ------
>  sysdeps/unix/sysv/linux/pwritev64.c | 10 ++--------
>  4 files changed, 4 insertions(+), 28 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/preadv.c b/sysdeps/unix/sysv/linux/preadv.c
> index 2a55d8c142..9fccb917a1 100644
> --- a/sysdeps/unix/sysv/linux/preadv.c
> +++ b/sysdeps/unix/sysv/linux/preadv.c
> @@ -22,10 +22,6 @@
>  
>  # ifdef __ASSUME_PREADV
>  
> -#  ifndef __NR_preadv
> -#   define __NR_preadv __NR_preadv64
> -#  endif
> -
>  ssize_t
>  preadv (int fd, const struct iovec *vector, int count, off_t offset)
>  {

Ok.

> @@ -37,12 +33,10 @@ static ssize_t __atomic_preadv_replacement (int, const struct iovec *,
>  ssize_t
>  preadv (int fd, const struct iovec *vector, int count, off_t offset)
>  {
> -#  ifdef __NR_preadv
>    ssize_t result = SYSCALL_CANCEL (preadv, fd, vector, count,
>  				   LO_HI_LONG (offset));
>    if (result >= 0 || errno != ENOSYS)
>      return result;
> -#  endif
>    return __atomic_preadv_replacement (fd, vector, count, offset);
>  }
>  #  define PREADV static __atomic_preadv_replacement

Ok.

> diff --git a/sysdeps/unix/sysv/linux/preadv64.c b/sysdeps/unix/sysv/linux/preadv64.c
> index fb471f0d9d..9fe43522a5 100644
> --- a/sysdeps/unix/sysv/linux/preadv64.c
> +++ b/sysdeps/unix/sysv/linux/preadv64.c
> @@ -20,14 +20,10 @@
>  
>  #ifdef __ASSUME_PREADV
>  
> -# ifndef __NR_preadv64
> -#  define __NR_preadv64 __NR_preadv
> -# endif
> -
>  ssize_t
>  preadv64 (int fd, const struct iovec *vector, int count, off64_t offset)
>  {
> -  return SYSCALL_CANCEL (preadv64, fd, vector, count, LO_HI_LONG (offset));
> +  return SYSCALL_CANCEL (preadv, fd, vector, count, LO_HI_LONG (offset));
>  }
>  #else
>  static ssize_t __atomic_preadv64_replacement (int, const struct iovec *,

Ok.

> @@ -35,12 +31,10 @@ static ssize_t __atomic_preadv64_replacement (int, const struct iovec *,
>  ssize_t
>  preadv64 (int fd, const struct iovec *vector, int count, off64_t offset)
>  {
> -#ifdef __NR_preadv64
> -  ssize_t result = SYSCALL_CANCEL (preadv64, fd, vector, count,
> +  ssize_t result = SYSCALL_CANCEL (preadv, fd, vector, count,
>  				   LO_HI_LONG (offset));
>    if (result >= 0 || errno != ENOSYS)
>      return result;
> -#endif
>    return __atomic_preadv64_replacement (fd, vector, count, offset);
>  }
>  # define PREADV static __atomic_preadv64_replacement

Ok.

> diff --git a/sysdeps/unix/sysv/linux/pwritev.c b/sysdeps/unix/sysv/linux/pwritev.c
> index 7abe47be06..d6cb3c8d5c 100644
> --- a/sysdeps/unix/sysv/linux/pwritev.c
> +++ b/sysdeps/unix/sysv/linux/pwritev.c
> @@ -22,10 +22,6 @@
>  
>  # ifdef __ASSUME_PREADV
>  
> -#  ifndef __NR_pwritev
> -#   define __NR_pwritev __NR_pwritev64
> -#  endif
> -
>  ssize_t
>  pwritev (int fd, const struct iovec *vector, int count, off_t offset)
>  {

Ok.

> @@ -37,12 +33,10 @@ static ssize_t __atomic_pwritev_replacement (int, const struct iovec *,
>  ssize_t
>  pwritev (int fd, const struct iovec *vector, int count, off_t offset)
>  {
> -#  ifdef __NR_pwritev
>    ssize_t result = SYSCALL_CANCEL (pwritev, fd, vector, count,
>  				   LO_HI_LONG (offset));
>    if (result >= 0 || errno != ENOSYS)
>      return result;
> -#  endif
>    return __atomic_pwritev_replacement (fd, vector, count, offset);
>  }
>  #  define PWRITEV static __atomic_pwritev_replacement

Ok.

> diff --git a/sysdeps/unix/sysv/linux/pwritev64.c b/sysdeps/unix/sysv/linux/pwritev64.c
> index 9bb0399c44..08bda27d4f 100644
> --- a/sysdeps/unix/sysv/linux/pwritev64.c
> +++ b/sysdeps/unix/sysv/linux/pwritev64.c
> @@ -20,14 +20,10 @@
>  
>  #ifdef __ASSUME_PWRITEV
>  
> -# ifndef __NR_pwritev64
> -#  define __NR_pwritev64 __NR_pwritev
> -# endif
> -
>  ssize_t
>  pwritev64 (int fd, const struct iovec *vector, int count, off64_t offset)
>  {
> -  return SYSCALL_CANCEL (pwritev64, fd, vector, count, LO_HI_LONG (offset));
> +  return SYSCALL_CANCEL (pwritev, fd, vector, count, LO_HI_LONG (offset));
>  }
>  #else
>  static ssize_t __atomic_pwritev64_replacement (int, const struct iovec *,

Ok.

> @@ -35,12 +31,10 @@ static ssize_t __atomic_pwritev64_replacement (int, const struct iovec *,
>  ssize_t
>  pwritev64 (int fd, const struct iovec *vector, int count, off64_t offset)
>  {
> -#ifdef __NR_pwritev64
> -  ssize_t result = SYSCALL_CANCEL (pwritev64, fd, vector, count,
> +  ssize_t result = SYSCALL_CANCEL (pwritev, fd, vector, count,
>  				   LO_HI_LONG (offset));
>    if (result >= 0 || errno != ENOSYS)
>      return result;
> -#endif
>    return __atomic_pwritev64_replacement (fd, vector, count, offset);
>  }
>  # define PWRITEV static __atomic_pwritev64_replacement
> 

Ok.

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

* Re: [PATCH 11/26] Linux: Clean up preadv2, pwritev2 system call names
  2020-02-09 20:20 ` [PATCH 11/26] Linux: Clean up preadv2, pwritev2 " Florian Weimer
@ 2020-02-27 23:19   ` Adhemerval Zanella
  0 siblings, 0 replies; 58+ messages in thread
From: Adhemerval Zanella @ 2020-02-27 23:19 UTC (permalink / raw)
  To: libc-alpha



On 09/02/2020 17:20, Florian Weimer wrote:
> With the built-in tables __NR_preadv2 and __NR_pwritev2 are always
> defined.
> 
> The kernel has never defined __NR_preadv64v2 and __NR_pwritev64v2
> and is unlikely to do so, given that the preadv2 and pwritev2 system
> calls themselves are 64-bit.

LGTM, thanks. 

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/unix/sysv/linux/preadv2.c     | 7 +------
>  sysdeps/unix/sysv/linux/preadv64v2.c  | 9 ++-------
>  sysdeps/unix/sysv/linux/pwritev2.c    | 4 ++--
>  sysdeps/unix/sysv/linux/pwritev64v2.c | 9 ++-------
>  4 files changed, 7 insertions(+), 22 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/preadv2.c b/sysdeps/unix/sysv/linux/preadv2.c
> index 5f1a83589e..4e3aa923da 100644
> --- a/sysdeps/unix/sysv/linux/preadv2.c
> +++ b/sysdeps/unix/sysv/linux/preadv2.c
> @@ -21,20 +21,15 @@
>  
>  #ifndef __OFF_T_MATCHES_OFF64_T
>  
> -# if !defined (__NR_preadv2) && defined (__NR_pread64v2)
> -#  define __NR_preadv2 __NR_pread64v2
> -# endif
> -
>  ssize_t
>  preadv2 (int fd, const struct iovec *vector, int count, off_t offset,
>  	 int flags)
>  {
> -# ifdef __NR_preadv2
>    ssize_t result = SYSCALL_CANCEL (preadv2, fd, vector, count,
>  				   LO_HI_LONG (offset), flags);
>    if (result >= 0 || errno != ENOSYS)
>      return result;
> -# endif
> +
>    /* Trying to emulate the preadv2 syscall flags is troublesome:
>  
>       * We can not temporary change the file state of the O_DSYNC and O_SYNC

Ok.

> diff --git a/sysdeps/unix/sysv/linux/preadv64v2.c b/sysdeps/unix/sysv/linux/preadv64v2.c
> index f1e52711cb..1bf1a4c696 100644
> --- a/sysdeps/unix/sysv/linux/preadv64v2.c
> +++ b/sysdeps/unix/sysv/linux/preadv64v2.c
> @@ -19,20 +19,15 @@
>  #include <sys/uio.h>
>  #include <sysdep-cancel.h>
>  
> -#if !defined(__NR_preadv64v2) && defined(__NR_preadv2)
> -# define __NR_preadv64v2 __NR_preadv2
> -#endif
> -
>  ssize_t
>  preadv64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
>  	    int flags)
>  {
> -#ifdef __NR_preadv64v2
> -  ssize_t result = SYSCALL_CANCEL (preadv64v2, fd, vector, count,
> +  ssize_t result = SYSCALL_CANCEL (preadv2, fd, vector, count,
>  				   LO_HI_LONG (offset), flags);
>    if (result >= 0 || errno != ENOSYS)
>      return result;
> -#endif
> +
>    /* Trying to emulate the preadv2 syscall flags is troublesome:
>  
>       * We can not temporary change the file state of the O_DSYNC and O_SYNC

Ok.

> diff --git a/sysdeps/unix/sysv/linux/pwritev2.c b/sysdeps/unix/sysv/linux/pwritev2.c
> index 53ab5e7613..a179654970 100644
> --- a/sysdeps/unix/sysv/linux/pwritev2.c
> +++ b/sysdeps/unix/sysv/linux/pwritev2.c
> @@ -25,12 +25,12 @@ ssize_t
>  pwritev2 (int fd, const struct iovec *vector, int count, off_t offset,
>  	  int flags)
>  {
> -# ifdef __NR_pwritev2
> +
>    ssize_t result = SYSCALL_CANCEL (pwritev2, fd, vector, count,
>  				   LO_HI_LONG (offset), flags);
>    if (result >= 0 || errno != ENOSYS)
>      return result;
> -# endif
> +
>    /* Trying to emulate the pwritev2 syscall flags is troublesome:
>  
>       * We can not temporary change the file state of the O_DSYNC and O_SYNC

Ok.

> diff --git a/sysdeps/unix/sysv/linux/pwritev64v2.c b/sysdeps/unix/sysv/linux/pwritev64v2.c
> index ba95eefcd9..8df32528b7 100644
> --- a/sysdeps/unix/sysv/linux/pwritev64v2.c
> +++ b/sysdeps/unix/sysv/linux/pwritev64v2.c
> @@ -19,20 +19,15 @@
>  #include <sys/uio.h>
>  #include <sysdep-cancel.h>
>  
> -#if !defined(__NR_pwritev64v2) && defined(__NR_pwritev2)
> -# define __NR_pwritev64v2 __NR_pwritev2
> -#endif
> -
>  ssize_t
>  pwritev64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
>  	     int flags)
>  {
> -#ifdef __NR_pwritev64v2
> -  ssize_t result = SYSCALL_CANCEL (pwritev64v2, fd, vector, count,
> +  ssize_t result = SYSCALL_CANCEL (pwritev2, fd, vector, count,
>  				   LO_HI_LONG (offset), flags);
>    if (result >= 0 || errno != ENOSYS)
>      return result;
> -#endif
> +
>    /* Trying to emulate the pwritev2 syscall flags is troublesome:
>  
>       * We can not temporary change the file state of the O_DSYNC and O_SYNC
> 


Ok.

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

* Re: [PATCH 13/26] Linux: getrandom syscall number is always available
  2020-02-09 20:20 ` [PATCH 13/26] Linux: getrandom syscall number is always available Florian Weimer
@ 2020-02-27 23:20   ` Adhemerval Zanella
  0 siblings, 0 replies; 58+ messages in thread
From: Adhemerval Zanella @ 2020-02-27 23:20 UTC (permalink / raw)
  To: libc-alpha



On 09/02/2020 17:20, Florian Weimer wrote:
> Due to the built-in tables, __NR_getrandom is always defined.

LGTM, thanks. 

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/unix/sysv/linux/getentropy.c |  9 ---------
>  sysdeps/unix/sysv/linux/getrandom.c  | 13 -------------
>  2 files changed, 22 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/getentropy.c b/sysdeps/unix/sysv/linux/getentropy.c
> index 5d0b8d10c1..2f3a4e4692 100644
> --- a/sysdeps/unix/sysv/linux/getentropy.c
> +++ b/sysdeps/unix/sysv/linux/getentropy.c
> @@ -21,7 +21,6 @@
>  #include <errno.h>
>  #include <unistd.h>
>  
> -#ifdef __NR_getrandom
>  /* Write LENGTH bytes of randomness starting at BUFFER.  Return 0 on
>     success and -1 on failure.  */
>  int
> @@ -63,11 +62,3 @@ getentropy (void *buffer, size_t length)
>      }
>    return 0;
>  }
> -#else
> -int
> -getentropy (void *buffer, size_t length)
> -{
> -  __set_errno (ENOSYS);
> -  return -1;
> -}
> -#endif

Ok..

> diff --git a/sysdeps/unix/sysv/linux/getrandom.c b/sysdeps/unix/sysv/linux/getrandom.c
> index 309beadf72..63b8d36bf4 100644
> --- a/sysdeps/unix/sysv/linux/getrandom.c
> +++ b/sysdeps/unix/sysv/linux/getrandom.c
> @@ -21,7 +21,6 @@
>  #include <unistd.h>
>  #include <sysdep-cancel.h>
>  
> -#ifdef __NR_getrandom
>  /* Write up to LENGTH bytes of randomness starting at BUFFER.
>     Return the number of bytes written, or -1 on error.  */
>  ssize_t
> @@ -29,17 +28,5 @@ __getrandom (void *buffer, size_t length, unsigned int flags)
>  {
>    return SYSCALL_CANCEL (getrandom, buffer, length, flags);
>  }
> -#else
> -/* Always provide a definition, even if the kernel headers lack the
> -   system call number. */
> -ssize_t
> -__getrandom (void *buffer, size_t length, unsigned int flags)
> -{
> -  /* Ideally, we would add a cancellation point here, but we currently
> -     cannot do so inside libc.  */
> -  __set_errno (ENOSYS);
> -  return -1;
> -}
> -#endif
>  libc_hidden_def (__getrandom)
>  weak_alias (__getrandom, getrandom)
> 

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

* Re: [PATCH 17/26] Linux: exit_group syscall number is always available
  2020-02-09 20:21 ` [PATCH 17/26] Linux: exit_group syscall number is always available Florian Weimer
@ 2020-02-27 23:31   ` Adhemerval Zanella
  0 siblings, 0 replies; 58+ messages in thread
From: Adhemerval Zanella @ 2020-02-27 23:31 UTC (permalink / raw)
  To: libc-alpha



On 09/02/2020 17:20, Florian Weimer wrote:
> Due to the built-in tables, __NR_exit_group is always defined.

LGTM, thanks. 

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/unix/sysv/linux/_exit.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/_exit.c b/sysdeps/unix/sysv/linux/_exit.c
> index 5896c15da6..a8521101b3 100644
> --- a/sysdeps/unix/sysv/linux/_exit.c
> +++ b/sysdeps/unix/sysv/linux/_exit.c
> @@ -27,9 +27,7 @@ _exit (int status)
>  {
>    while (1)
>      {
> -#ifdef __NR_exit_group
>        INLINE_SYSCALL (exit_group, 1, status);
> -#endif
>        INLINE_SYSCALL (exit, 1, status);
>  
>  #ifdef ABORT_INSTRUCTION
> 

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

* Re: [PATCH 19/26] Linux: pciconfig_iobase syscall number is always available on alpha
  2020-02-09 20:21 ` [PATCH 19/26] Linux: pciconfig_iobase syscall number is always available on alpha Florian Weimer
@ 2020-02-27 23:31   ` Adhemerval Zanella
  0 siblings, 0 replies; 58+ messages in thread
From: Adhemerval Zanella @ 2020-02-27 23:31 UTC (permalink / raw)
  To: libc-alpha



On 09/02/2020 17:21, Florian Weimer wrote:
> Due to the built-in tables, __NR_pciconfig_iobase is always defined.

LGTM, thanks. 

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/unix/sysv/linux/alpha/ioperm.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/alpha/ioperm.c b/sysdeps/unix/sysv/linux/alpha/ioperm.c
> index 086c782b9f..1f9c38db98 100644
> --- a/sysdeps/unix/sysv/linux/alpha/ioperm.c
> +++ b/sysdeps/unix/sysv/linux/alpha/ioperm.c
> @@ -542,7 +542,6 @@ init_iosys (void)
>  
>    /* First try the pciconfig_iobase syscall added to 2.2.15 and 2.3.99.  */
>  
> -#ifdef __NR_pciconfig_iobase
>    addr = __pciconfig_iobase (IOBASE_DENSE_MEM, 0, 0);
>    if (addr != -1)
>      {
> @@ -584,7 +583,6 @@ init_iosys (void)
>  
>        return 0;
>      }
> -#endif
>  
>    /* Second, collect the contents of /etc/alpha_systype or /proc/cpuinfo.  */
>  
> 

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

* Re: [PATCH 15/26] Linux: pkey_mprotect syscall number is always available
  2020-02-09 20:20 ` [PATCH 15/26] Linux: pkey_mprotect " Florian Weimer
@ 2020-02-27 23:31   ` Adhemerval Zanella
  0 siblings, 0 replies; 58+ messages in thread
From: Adhemerval Zanella @ 2020-02-27 23:31 UTC (permalink / raw)
  To: libc-alpha



On 09/02/2020 17:20, Florian Weimer wrote:
> Due to the built-in tables, __NR_pkey_mprotect is always defined.

LGTM, thanks. 

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/unix/sysv/linux/pkey_mprotect.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/pkey_mprotect.c b/sysdeps/unix/sysv/linux/pkey_mprotect.c
> index 5d372edfd5..4ec1feba2e 100644
> --- a/sysdeps/unix/sysv/linux/pkey_mprotect.c
> +++ b/sysdeps/unix/sysv/linux/pkey_mprotect.c
> @@ -28,10 +28,5 @@ pkey_mprotect (void *addr, size_t len, int prot, int pkey)
>      /* If the key is -1, the system call is precisely equivalent to
>         mprotect.  */
>      return __mprotect (addr, len, prot);
> -#ifdef __NR_pkey_mprotect
>    return INLINE_SYSCALL_CALL (pkey_mprotect, addr, len, prot, pkey);
> -#else
> -  __set_errno (ENOSYS);
> -  return -1;
> -#endif
>  }
> 

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

* Re: [PATCH 16/26] Linux: set_tid_address syscall number is always available
  2020-02-09 20:21 ` [PATCH 16/26] Linux: set_tid_address syscall number " Florian Weimer
@ 2020-02-27 23:31   ` Adhemerval Zanella
  0 siblings, 0 replies; 58+ messages in thread
From: Adhemerval Zanella @ 2020-02-27 23:31 UTC (permalink / raw)
  To: libc-alpha



On 09/02/2020 17:20, Florian Weimer wrote:
> Due to the built-in tables, __NR_set_tid_address is always defined.

LGTM, thanks. 

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/unix/sysv/linux/nscd_setup_thread.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/nscd_setup_thread.c b/sysdeps/unix/sysv/linux/nscd_setup_thread.c
> index 6e14918be0..a49676f4b4 100644
> --- a/sysdeps/unix/sysv/linux/nscd_setup_thread.c
> +++ b/sysdeps/unix/sysv/linux/nscd_setup_thread.c
> @@ -25,7 +25,6 @@
>  int
>  setup_thread (struct database_dyn *db)
>  {
> -#ifdef __NR_set_tid_address
>    /* Only supported when NPTL is used.  */
>    char buf[100];
>    if (confstr (_CS_GNU_LIBPTHREAD_VERSION, buf, sizeof (buf)) >= sizeof (buf)
> @@ -43,7 +42,6 @@ setup_thread (struct database_dyn *db)
>         So, set the field to a nonzero value which indicates that nscd
>         is certainly running and clients can skip the test.  */
>      return db->head->nscd_certainly_running = 1;
> -#endif
>  
>    return 0;
>  }
> 

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

* Re: [PATCH 18/26] Linux: getdents64 syscall number is always available on MIPS
  2020-02-09 20:21 ` [PATCH 18/26] Linux: getdents64 syscall number is always available on MIPS Florian Weimer
@ 2020-02-27 23:31   ` Adhemerval Zanella
  0 siblings, 0 replies; 58+ messages in thread
From: Adhemerval Zanella @ 2020-02-27 23:31 UTC (permalink / raw)
  To: libc-alpha



On 09/02/2020 17:20, Florian Weimer wrote:
> Due to the built-in tables, __NR_getdents64 is always defined,
> although it may not be supported at run time.

LGTM, thanks. 

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/unix/sysv/linux/mips/mips64/getdents64.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/getdents64.c b/sysdeps/unix/sysv/linux/mips/mips64/getdents64.c
> index 4edf968b09..d18a5297dc 100644
> --- a/sysdeps/unix/sysv/linux/mips/mips64/getdents64.c
> +++ b/sysdeps/unix/sysv/linux/mips/mips64/getdents64.c
> @@ -34,7 +34,6 @@ __getdents64 (int fd, void *buf, size_t nbytes)
>    if (nbytes > INT_MAX)
>      nbytes = INT_MAX;
>  
> -#ifdef __NR_getdents64
>    static int getdents64_supported = true;
>    if (atomic_load_relaxed (&getdents64_supported))
>      {
> @@ -44,7 +43,6 @@ __getdents64 (int fd, void *buf, size_t nbytes)
>  
>        atomic_store_relaxed (&getdents64_supported, false);
>      }
> -#endif
>  
>    /* Unfortunately getdents64 was only wire-up for MIPS n64 on Linux 3.10.
>       If the syscall is not available it need to fallback to the non-LFS one.
> 

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

* Re: [PATCH 14/26] Linux: rt_sigqueueinfo syscall number is always available
  2020-02-09 20:20 ` [PATCH 14/26] Linux: rt_sigqueueinfo " Florian Weimer
@ 2020-02-27 23:31   ` Adhemerval Zanella
  0 siblings, 0 replies; 58+ messages in thread
From: Adhemerval Zanella @ 2020-02-27 23:31 UTC (permalink / raw)
  To: libc-alpha



On 09/02/2020 17:20, Florian Weimer wrote:
> Due to the built-in tables, __NR_rt_sigqueueinfo is always defined.
> 
> sysdeps/pthread/time_routines.c is not updated because it is shared with
> Hurd.

Linux reimplements the file and Hurd internally does not use the __NR_*
concept, so it should be safe to just remove it.

In fact, __NR_ direct usage should not used outside Linux folder.  If
it were the case that Linux did use it, a better strategy would to
move the __NR_* code to a specific Linux implementation similar to
how the *_nocancel calls are done.

LGTM, thanks. 

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/unix/sysv/linux/aio_sigqueue.c | 5 -----
>  sysdeps/unix/sysv/linux/gai_sigqueue.c | 5 -----
>  2 files changed, 10 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/aio_sigqueue.c b/sysdeps/unix/sysv/linux/aio_sigqueue.c
> index 5f00582578..2c5a79bef6 100644
> --- a/sysdeps/unix/sysv/linux/aio_sigqueue.c
> +++ b/sysdeps/unix/sysv/linux/aio_sigqueue.c
> @@ -26,8 +26,6 @@
>  
>  #include <aio_misc.h>
>  
> -#ifdef __NR_rt_sigqueueinfo
> -
>  /* Return any pending signal or wait for one for the given time.  */
>  int
>  __aio_sigqueue (int sig, const union sigval val, pid_t caller_pid)
> @@ -46,6 +44,3 @@ __aio_sigqueue (int sig, const union sigval val, pid_t caller_pid)
>  
>    return INLINE_SYSCALL (rt_sigqueueinfo, 3, info.si_pid, sig, &info);
>  }
> -#else
> -# include <rt/aio_sigqueue.c>
> -#endif

Ok.

> diff --git a/sysdeps/unix/sysv/linux/gai_sigqueue.c b/sysdeps/unix/sysv/linux/gai_sigqueue.c
> index e8b65a7d67..e4d7260743 100644
> --- a/sysdeps/unix/sysv/linux/gai_sigqueue.c
> +++ b/sysdeps/unix/sysv/linux/gai_sigqueue.c
> @@ -26,8 +26,6 @@
>  
>  #include "gai_misc.h"
>  
> -#ifdef __NR_rt_sigqueueinfo
> -
>  /* Return any pending signal or wait for one for the given time.  */
>  int
>  __gai_sigqueue (int sig, const union sigval val, pid_t caller_pid)
> @@ -46,6 +44,3 @@ __gai_sigqueue (int sig, const union sigval val, pid_t caller_pid)
>  
>    return INLINE_SYSCALL (rt_sigqueueinfo, 3, info.si_pid, sig, &info);
>  }
> -#else
> -# include <resolv/gai_sigqueue.c>
> -#endif
> 

Ok.

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

* Re: [PATCH 20/26] Linux: set_robust_list syscall number is always available
  2020-02-09 20:21 ` [PATCH 20/26] Linux: set_robust_list " Florian Weimer
@ 2020-02-27 23:46   ` Adhemerval Zanella
  0 siblings, 0 replies; 58+ messages in thread
From: Adhemerval Zanella @ 2020-02-27 23:46 UTC (permalink / raw)
  To: libc-alpha



On 09/02/2020 17:21, Florian Weimer wrote:
> Due to the built-in tables, __NR_set_robust_list is always defined
> (although it may not be available at run time).

LGTM, thanks. 

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  nptl/nptl-init.c      |  4 ----
>  nptl/pthread_create.c |  6 ++----
>  sysdeps/nptl/fork.c   | 10 ++++------
>  3 files changed, 6 insertions(+), 14 deletions(-)
> 
> diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c
> index 1877248014..373be89c95 100644
> --- a/nptl/nptl-init.c
> +++ b/nptl/nptl-init.c
> @@ -129,11 +129,9 @@ static
>  void
>  __nptl_set_robust (struct pthread *self)
>  {
> -#ifdef __NR_set_robust_list
>    INTERNAL_SYSCALL_DECL (err);
>    INTERNAL_SYSCALL (set_robust_list, err, 2, &self->robust_head,
>  		    sizeof (struct robust_list_head));
> -#endif
>  }
>  
>  
> @@ -254,7 +252,6 @@ __pthread_initialize_minimal_internal (void)
>      pd->robust_prev = &pd->robust_head;
>  #endif
>      pd->robust_head.list = &pd->robust_head;
> -#ifdef __NR_set_robust_list
>      pd->robust_head.futex_offset = (offsetof (pthread_mutex_t, __data.__lock)
>  				    - offsetof (pthread_mutex_t,
>  						__data.__list.__next));
> @@ -262,7 +259,6 @@ __pthread_initialize_minimal_internal (void)
>      int res = INTERNAL_SYSCALL (set_robust_list, err, 2, &pd->robust_head,
>  				sizeof (struct robust_list_head));
>      if (INTERNAL_SYSCALL_ERROR_P (res, err))
> -#endif
>        set_robust_list_not_avail ();
>    }
>  

I wonder if it would be better to refactor the __nptl_set_robust to
simplify the '__set_robust_list_avail' handling. Something like:

--
void
__nptl_set_robust (struct pthread *pd)
{
#ifdef __ASSUME_SET_ROBUST_LIST
  static int set_robust_supported = true;
  if (atomic_load_relaxed (&getdents64_supported))
    {
      int res = INTERNAL_SYSCALL_CALL (set_robust_list, &pd->robust_head,
				       sizeof (struct robust_list_head));
      if (INTERNAL_SYSCALL_ERROR_P (res))
	atomic_store_relaxed (&getdents64_supported, false);
    }
#endif
}
--

> diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
> index d3fd58730c..58706b4160 100644
> --- a/nptl/pthread_create.c
> +++ b/nptl/pthread_create.c
> @@ -389,10 +389,9 @@ START_THREAD_DEFN
>    if (__glibc_unlikely (atomic_exchange_acq (&pd->setxid_futex, 0) == -2))
>      futex_wake (&pd->setxid_futex, 1, FUTEX_PRIVATE);
>  
> -#ifdef __NR_set_robust_list
> -# ifndef __ASSUME_SET_ROBUST_LIST
> +#ifndef __ASSUME_SET_ROBUST_LIST
>    if (__set_robust_list_avail >= 0)
> -# endif
> +#endif
>      {
>        INTERNAL_SYSCALL_DECL (err);
>        /* This call should never fail because the initial call in init.c
> @@ -400,7 +399,6 @@ START_THREAD_DEFN
>        INTERNAL_SYSCALL (set_robust_list, err, 2, &pd->robust_head,
>  			sizeof (struct robust_list_head));
>      }
> -#endif
>  
>    /* If the parent was running cancellation handlers while creating
>       the thread the new thread inherited the signal mask.  Reset the

Ok.

> diff --git a/sysdeps/nptl/fork.c b/sysdeps/nptl/fork.c
> index f5cf88d68c..5091a000e3 100644
> --- a/sysdeps/nptl/fork.c
> +++ b/sysdeps/nptl/fork.c
> @@ -83,7 +83,6 @@ __libc_fork (void)
>        if (__fork_generation_pointer != NULL)
>  	*__fork_generation_pointer += __PTHREAD_ONCE_FORK_GEN_INCR;
>  
> -#ifdef __NR_set_robust_list
>        /* Initialize the robust mutex list setting in the kernel which has
>  	 been reset during the fork.  We do not check for errors because if
>  	 it fails here, it must have failed at process startup as well and
> @@ -94,19 +93,18 @@ __libc_fork (void)
>  	 inherit the correct value from the parent.  We do not need to clear
>  	 the pending operation because it must have been zero when fork was
>  	 called.  */
> -# if __PTHREAD_MUTEX_HAVE_PREV
> +#if __PTHREAD_MUTEX_HAVE_PREV
>        self->robust_prev = &self->robust_head;
> -# endif
> +#endif
>        self->robust_head.list = &self->robust_head;
> -# ifdef SHARED
> +#ifdef SHARED
>        if (__builtin_expect (__libc_pthread_functions_init, 0))
>  	PTHFCT_CALL (ptr_set_robust, (self));
> -# else
> +#else
>        extern __typeof (__nptl_set_robust) __nptl_set_robust
>  	__attribute__((weak));
>        if (__builtin_expect (__nptl_set_robust != NULL, 0))
>  	__nptl_set_robust (self);
> -# endif
>  #endif
>  
>        /* Reset the lock state in the multi-threaded case.  */
> 

Ok.

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

* Re: [PATCH 22/26] ia64: Do not define __NR_semtimedop in <sysdep.h>
  2020-02-09 20:21 ` [PATCH 22/26] ia64: Do not define __NR_semtimedop in <sysdep.h> Florian Weimer
@ 2020-02-27 23:46   ` Adhemerval Zanella
  0 siblings, 0 replies; 58+ messages in thread
From: Adhemerval Zanella @ 2020-02-27 23:46 UTC (permalink / raw)
  To: libc-alpha



On 09/02/2020 17:21, Florian Weimer wrote:
> The definition is always available from the built-in system call table.

LGTM, thanks. 

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/unix/sysv/linux/ia64/sysdep.h | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/ia64/sysdep.h b/sysdeps/unix/sysv/linux/ia64/sysdep.h
> index 59442c50e9..fec8ea9d4b 100644
> --- a/sysdeps/unix/sysv/linux/ia64/sysdep.h
> +++ b/sysdeps/unix/sysv/linux/ia64/sysdep.h
> @@ -46,12 +46,6 @@
>  #undef SYS_ify
>  #define SYS_ify(syscall_name)	__NR_##syscall_name
>  
> -/* This is to help the old kernel headers where __NR_semtimedop is not
> -   available.  */
> -#ifndef __NR_semtimedop
> -# define __NR_semtimedop 1247
> -#endif
> -
>  #if defined USE_DL_SYSINFO \
>  	&& (IS_IN (libc) \
>  	    || IS_IN (libpthread) || IS_IN (librt))
> 

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

* Re: [PATCH 23/26] x86_64: Do not define __NR_semtimedop in <sysdep.h>
  2020-02-09 20:21 ` [PATCH 23/26] x86_64: Do not define __NR_semtimedop in <sysdep.h> Florian Weimer
@ 2020-02-27 23:46   ` Adhemerval Zanella
  0 siblings, 0 replies; 58+ messages in thread
From: Adhemerval Zanella @ 2020-02-27 23:46 UTC (permalink / raw)
  To: libc-alpha



On 09/02/2020 17:21, Florian Weimer wrote:
> The definition is always available from the built-in system call table.

LGTM, thanks. 

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/unix/sysv/linux/x86_64/sysdep.h | 7 -------
>  1 file changed, 7 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
> index c2eb37e575..b8aa1a2b2f 100644
> --- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
> +++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
> @@ -33,13 +33,6 @@
>  #undef SYS_ify
>  #define SYS_ify(syscall_name)	__NR_##syscall_name
>  
> -/* This is to help the old kernel headers where __NR_semtimedop is not
> -   available.  */
> -#ifndef __NR_semtimedop
> -# define __NR_semtimedop 220
> -#endif
> -
> -
>  #ifdef __ASSEMBLER__
>  
>  /* Linux uses a negative return value to indicate syscall errors,
> 

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

* Re: [PATCH 21/26] Linux: open_by_handle_at syscall number is always available
  2020-02-09 20:21 ` [PATCH 21/26] Linux: open_by_handle_at syscall number is always available Florian Weimer
@ 2020-02-27 23:46   ` Adhemerval Zanella
  0 siblings, 0 replies; 58+ messages in thread
From: Adhemerval Zanella @ 2020-02-27 23:46 UTC (permalink / raw)
  To: libc-alpha



On 09/02/2020 17:21, Florian Weimer wrote:
> Due to the built-in tables, __NR_open_by_handle_at is always defined.

LGTM, thanks. 

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/unix/sysv/linux/open_by_handle_at.c | 9 ---------
>  1 file changed, 9 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/open_by_handle_at.c b/sysdeps/unix/sysv/linux/open_by_handle_at.c
> index f682d8cfe4..6c9c53291a 100644
> --- a/sysdeps/unix/sysv/linux/open_by_handle_at.c
> +++ b/sysdeps/unix/sysv/linux/open_by_handle_at.c
> @@ -24,14 +24,5 @@
>  int
>  open_by_handle_at (int mount_fd, struct file_handle *handle, int flags)
>  {
> -#ifdef __NR_open_by_handle_at
>    return SYSCALL_CANCEL (open_by_handle_at, mount_fd, handle, flags);
> -#else
> -  __set_errno (ENOSYS);
> -  return -1;
> -#endif
>  }
> -
> -#ifndef __NR_open_by_handle_at
> -stub_warning (open_by_handle_at)
> -#endif
> 

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

* Re: [PATCH 25/26] m68k: getpagesize syscall number is always available
  2020-02-09 20:21 ` [PATCH 25/26] m68k: getpagesize syscall number is always available Florian Weimer
@ 2020-02-27 23:47   ` Adhemerval Zanella
  0 siblings, 0 replies; 58+ messages in thread
From: Adhemerval Zanella @ 2020-02-27 23:47 UTC (permalink / raw)
  To: libc-alpha



On 09/02/2020 17:21, Florian Weimer wrote:
> Due to the built-in tables, __NR_getpagesize is always defined.

LGTM, thanks. 

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/unix/sysv/linux/m68k/getpagesize.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/m68k/getpagesize.c b/sysdeps/unix/sysv/linux/m68k/getpagesize.c
> index ad6559320e..2e419af0e5 100644
> --- a/sysdeps/unix/sysv/linux/m68k/getpagesize.c
> +++ b/sysdeps/unix/sysv/linux/m68k/getpagesize.c
> @@ -28,20 +28,16 @@
>  int
>  __getpagesize (void)
>  {
> -#ifdef __NR_getpagesize
>    int result;
> -#endif
>  
>    if (GLRO(dl_pagesize) != 0)
>      return GLRO(dl_pagesize);
>  
> -#ifdef __NR_getpagesize
>    INTERNAL_SYSCALL_DECL (err);
>    result = INTERNAL_SYSCALL (getpagesize, err, 0);
>    /* The only possible error is ENOSYS.  */
>    if (!INTERNAL_SYSCALL_ERROR_P (result, err))
>      return result;
> -#endif
>  
>    return 4096;
>  }
> 

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

* Re: [PATCH 24/26] Linux: epoll_pwait syscall number is always available
  2020-02-09 20:21 ` [PATCH 24/26] Linux: epoll_pwait " Florian Weimer
@ 2020-02-27 23:47   ` Adhemerval Zanella
  0 siblings, 0 replies; 58+ messages in thread
From: Adhemerval Zanella @ 2020-02-27 23:47 UTC (permalink / raw)
  To: libc-alpha



On 09/02/2020 17:21, Florian Weimer wrote:
> Due to the built-in tables, __NR_epoll_pwait is always defined.

LGTM, thanks. 

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/unix/sysv/linux/epoll_pwait.c | 16 ----------------
>  1 file changed, 16 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/epoll_pwait.c b/sysdeps/unix/sysv/linux/epoll_pwait.c
> index fcd2a47d85..66f04482c7 100644
> --- a/sysdeps/unix/sysv/linux/epoll_pwait.c
> +++ b/sysdeps/unix/sysv/linux/epoll_pwait.c
> @@ -23,8 +23,6 @@
>  #include <sysdep-cancel.h>
>  #include <sys/syscall.h>
>  
> -#ifdef __NR_epoll_pwait
> -
>  /* Wait for events on an epoll instance "epfd". Returns the number of
>     triggered events returned in "events" buffer. Or -1 in case of
>     error with the "errno" variable set to the specific error code. The
> @@ -42,18 +40,4 @@ int epoll_pwait (int epfd, struct epoll_event *events,
>    return SYSCALL_CANCEL (epoll_pwait, epfd, events, maxevents,
>  			 timeout, set, _NSIG / 8);
>  }
> -
> -#else
> -
> -int epoll_pwait (int epfd, struct epoll_event *events,
> -		 int maxevents, int timeout,
> -		 const sigset_t *set)
> -{
> -  __set_errno (ENOSYS);
> -  return -1;
> -}
> -stub_warning (epoll_pwait)
> -
> -#endif
> -
>  libc_hidden_def (epoll_pwait)
> 

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

* Re: [PATCH 26/26] microblaze: vfork is always available
  2020-02-09 20:21 ` [PATCH 26/26] microblaze: vfork " Florian Weimer
@ 2020-02-27 23:47   ` Adhemerval Zanella
  0 siblings, 0 replies; 58+ messages in thread
From: Adhemerval Zanella @ 2020-02-27 23:47 UTC (permalink / raw)
  To: libc-alpha



On 09/02/2020 17:21, Florian Weimer wrote:
> Due to the built-in tables, __NR_vfork is always defined, so the
> fork-based fallback code is never used.
> 
> (It appears that the vfork system call was wired up when the port was
> contributed to the kernel.)

LGTM, thanks. 

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/unix/sysv/linux/microblaze/vfork.S | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/microblaze/vfork.S b/sysdeps/unix/sysv/linux/microblaze/vfork.S
> index 7bff659ff3..913aa06e2e 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/vfork.S
> +++ b/sysdeps/unix/sysv/linux/microblaze/vfork.S
> @@ -28,11 +28,7 @@
>  
>  ENTRY (__vfork)
>  
> -#ifdef __NR_vfork
>  	DO_CALL (vfork, 0)
> -#else
> -	DO_CALL (fork, 0)
> -#endif
>  	addik	r12,r0,-4095
>  	cmpu	r12,r12,r3
>  	bgei	r12,SYSCALL_ERROR_LABEL
> 

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

* Re: [PATCH 01/26] Linux: Enhance glibcsyscalls.h to support listing system calls
  2020-02-27 22:14   ` Adhemerval Zanella
@ 2020-05-11 10:10     ` Florian Weimer
  0 siblings, 0 replies; 58+ messages in thread
From: Florian Weimer @ 2020-05-11 10:10 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha

* Adhemerval Zanella:

> Now that this would be used as a script issued directly by the
> user, I think it is worth to add a more comprehensible description
> (one that can be used as __doc__). 

Sorry, I mised that before posting the new version:

  <https://sourceware.org/pipermail/libc-alpha/2020-May/113777.html>

> Why not follow other scripts and use argparser as well? Something like:
>
> --
> def main(argv):
>     """Entry point when called as the main program."""
>
>     import argparse
>
>     # Top-level directory of the source tree.
>     topdir = os.path.realpath(os.path.join(
>         os.path.dirname(os.path.realpath(__file__)), *('..',) * 4))
>
>     def get_parser():
>         parser = argparse.ArgumentParser(description=__doc__)
>         subparsers = parser.add_subparsers(dest='command', required=True)
>         parser_a = subparsers.add_parser('list-headers');
>         parser_b = subparsers.add_parser('query-syscall');
>         parser_b.add_argument('syscalls',
>                               help='Which syscalls to check',
>                               nargs='+')
>         return parser
>     parser = get_parser();
>     opts = parser.parse_args(argv)
>
>     if opts.command == 'list-headers':
>     [...]

I just didn't know enough about the argparse module to come up with this.

> I don't think double underscore is required here.

I like it because it prevents exporting.

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

end of thread, other threads:[~2020-05-11 10:10 UTC | newest]

Thread overview: 58+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-09 20:19 [PATCH 00/26] Linux cleanups enabled by built-in system call tables Florian Weimer
2020-02-09 20:19 ` [PATCH 02/26] Linux: renameat2 syscall number is always available Florian Weimer
2020-02-27 23:06   ` Adhemerval Zanella
2020-02-09 20:19 ` [PATCH 03/26] Linux: copy_file_range " Florian Weimer
2020-02-27 23:06   ` Adhemerval Zanella
2020-02-09 20:19 ` [PATCH 01/26] Linux: Enhance glibcsyscalls.h to support listing system calls Florian Weimer
2020-02-27 22:14   ` Adhemerval Zanella
2020-05-11 10:10     ` Florian Weimer
2020-02-09 20:19 ` [PATCH 04/26] Linux: mlock2 syscall number is always available Florian Weimer
2020-02-27 23:06   ` Adhemerval Zanella
2020-02-09 20:20 ` [PATCH 14/26] Linux: rt_sigqueueinfo " Florian Weimer
2020-02-27 23:31   ` Adhemerval Zanella
2020-02-09 20:20 ` [PATCH 08/26] Linux: sched_getaffinity " Florian Weimer
2020-02-27 23:06   ` Adhemerval Zanella
2020-02-09 20:20 ` [PATCH 15/26] Linux: pkey_mprotect " Florian Weimer
2020-02-27 23:31   ` Adhemerval Zanella
2020-02-09 20:20 ` [PATCH 07/26] Linux: sched_setaffinity " Florian Weimer
2020-02-27 23:06   ` Adhemerval Zanella
2020-02-09 20:20 ` [PATCH 09/26] Linux: sigaltstack " Florian Weimer
2020-02-27 23:06   ` Adhemerval Zanella
2020-02-09 20:20 ` [PATCH 06/26] Linux: statx " Florian Weimer
2020-02-27 23:06   ` Adhemerval Zanella
2020-02-09 20:20 ` [PATCH 10/26] Linux: Clean up pread64/pwrite64 system call names Florian Weimer
2020-02-27 23:08   ` Adhemerval Zanella
2020-02-09 20:20 ` [PATCH 13/26] Linux: getrandom syscall number is always available Florian Weimer
2020-02-27 23:20   ` Adhemerval Zanella
2020-02-09 20:20 ` [PATCH 05/26] Linux: mq_* syscall numbers are " Florian Weimer
2020-02-27 23:06   ` Adhemerval Zanella
2020-02-09 20:20 ` [PATCH 12/26] Linux: Clean up preadv, pwritev system call names Florian Weimer
2020-02-27 23:19   ` Adhemerval Zanella
2020-02-09 20:20 ` [PATCH 11/26] Linux: Clean up preadv2, pwritev2 " Florian Weimer
2020-02-27 23:19   ` Adhemerval Zanella
2020-02-09 20:21 ` [PATCH 25/26] m68k: getpagesize syscall number is always available Florian Weimer
2020-02-27 23:47   ` Adhemerval Zanella
2020-02-09 20:21 ` [PATCH 26/26] microblaze: vfork " Florian Weimer
2020-02-27 23:47   ` Adhemerval Zanella
2020-02-09 20:21 ` [PATCH 16/26] Linux: set_tid_address syscall number " Florian Weimer
2020-02-27 23:31   ` Adhemerval Zanella
2020-02-09 20:21 ` [PATCH 18/26] Linux: getdents64 syscall number is always available on MIPS Florian Weimer
2020-02-27 23:31   ` Adhemerval Zanella
2020-02-09 20:21 ` [PATCH 22/26] ia64: Do not define __NR_semtimedop in <sysdep.h> Florian Weimer
2020-02-27 23:46   ` Adhemerval Zanella
2020-02-09 20:21 ` [PATCH 17/26] Linux: exit_group syscall number is always available Florian Weimer
2020-02-27 23:31   ` Adhemerval Zanella
2020-02-09 20:21 ` [PATCH 19/26] Linux: pciconfig_iobase syscall number is always available on alpha Florian Weimer
2020-02-27 23:31   ` Adhemerval Zanella
2020-02-09 20:21 ` [PATCH 23/26] x86_64: Do not define __NR_semtimedop in <sysdep.h> Florian Weimer
2020-02-27 23:46   ` Adhemerval Zanella
2020-02-09 20:21 ` [PATCH 21/26] Linux: open_by_handle_at syscall number is always available Florian Weimer
2020-02-27 23:46   ` Adhemerval Zanella
2020-02-09 20:21 ` [PATCH 20/26] Linux: set_robust_list " Florian Weimer
2020-02-27 23:46   ` Adhemerval Zanella
2020-02-09 20:21 ` [PATCH 24/26] Linux: epoll_pwait " Florian Weimer
2020-02-27 23:47   ` Adhemerval Zanella
2020-02-10 23:25 ` [PATCH 00/26] Linux cleanups enabled by built-in system call tables Lukasz Majewski
2020-02-10 23:56   ` Joseph Myers
2020-02-11  7:47   ` Florian Weimer
2020-02-11 11:07     ` Florian Weimer

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