unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 00/30] Remove Linux generic sysdep
@ 2022-10-19 22:14 Adhemerval Zanella via Libc-alpha
  2022-10-19 22:14 ` [PATCH 01/30] linux: Fix generic struct_stat for 64 bit time (BZ# 29657) Adhemerval Zanella via Libc-alpha
                   ` (29 more replies)
  0 siblings, 30 replies; 68+ messages in thread
From: Adhemerval Zanella via Libc-alpha @ 2022-10-19 22:14 UTC (permalink / raw)
  To: libc-alpha

With recent BZ#29657, where struct stat were not adapted for 64 time
because I forgot that generic folder is not always usedfor ports with
default 64 bit time_t; it seems better to finish the generic
integration and make the Linux default implementation the de-facto
"generic" implementation.

The patchset is mostly mechanic, the first part only moves syscall
support from generic to default.

The second part change the socket interface assumption to assume
wire-up syscall (and adjust the architecture that still requires
sockecall).

The last part moves the generic headers to the default and finally
remove the generic folder and Implies.

Adhemerval Zanella (30):
  linux: Fix generic struct_stat for 64 bit time (BZ# 29657)
  linux: Consolidate dl-origin.c
  Linux: consolidate chmod implementation
  Linux: consolidate chown implementation
  Linux: consolidate dup2 implementation
  Lninux: consolidate epoll_create implementation
  Linux: consolidate inotify_init implementation
  Linux: consolidate lchown implementation
  Linux: consolidate link implementation
  Linux: consolidate mkdir implementation
  Linux: consolidate readlink implementation
  Linux: consolidate rmdir implementation
  Linux: consolidate symlink implementation
  Linux: consolidate unlink implementation
  Linux: consolidate sendfile implementation
  Linux: Move wordsize-32 Version to default
  Linux: consolidate ____longjmp_chk
  Linux: Assume and consolidate bind wire-up syscall
  Linux: Assume iand consolidate socket wire-up syscall
  Linux: Assume and consolidate socketpair wire-up syscall
  Linux: Assume and consolidate listen wire-up syscall
  Linux: Assume and consolidate getsockname wire-up syscall
  Linux: Assume and consolidate getpeername wire-up syscall
  Linux: Assume and consolidate shutdown wire-up syscall
  Linux: Remove unused generic Makefile
  Linux: Remove generic sysdep
  Linux: make generic xstatver.h the default one
  Linux: Make generic fcntl.h the default one
  Linux: Consolidate typesizes.h
  Linux: Remove generic Implies

 sysdeps/unix/sysv/linux/Versions              |   3 +
 .../linux/{generic => }/____longjmp_chk.c     |   6 +-
 sysdeps/unix/sysv/linux/aarch64/Implies       |   1 -
 sysdeps/unix/sysv/linux/aarch64/sysdep.h      |   3 +-
 sysdeps/unix/sysv/linux/arc/Implies           |   2 -
 sysdeps/unix/sysv/linux/arc/sysdep.h          |   4 +-
 sysdeps/unix/sysv/linux/arm/Versions          |   3 -
 .../unix/sysv/linux/arm/bits/struct_stat.h    | 139 ++++++++++++++++++
 sysdeps/unix/sysv/linux/arm/bits/typesizes.h  |  74 ++++++++++
 .../sysv/linux/{generic => arm}/xstatver.h    |  11 +-
 sysdeps/unix/sysv/linux/bind.c                |   7 +-
 sysdeps/unix/sysv/linux/bits/fcntl.h          |  56 ++++++-
 sysdeps/unix/sysv/linux/bits/struct_stat.h    | 116 +++++++--------
 .../sysv/linux/{generic => }/bits/typesizes.h |   0
 sysdeps/unix/sysv/linux/{generic => }/chmod.c |  10 +-
 sysdeps/unix/sysv/linux/{generic => }/chown.c |   9 +-
 sysdeps/unix/sysv/linux/csky/Implies          |   2 -
 .../{generic => csky}/bits/struct_stat.h      |  28 ++--
 sysdeps/unix/sysv/linux/csky/sysdep.h         |   2 +-
 sysdeps/unix/sysv/linux/dl-origin.c           |  14 +-
 sysdeps/unix/sysv/linux/{generic => }/dup2.c  |   9 +-
 .../sysv/linux/{generic => }/epoll_create.c   |   9 +-
 sysdeps/unix/sysv/linux/generic/Makefile      |   3 -
 sysdeps/unix/sysv/linux/generic/README        |  11 --
 sysdeps/unix/sysv/linux/generic/bits/fcntl.h  |  55 -------
 sysdeps/unix/sysv/linux/generic/dl-origin.c   |  79 ----------
 sysdeps/unix/sysv/linux/generic/syscalls.list |  10 --
 .../sysv/linux/generic/wordsize-32/Versions   |   5 -
 sysdeps/unix/sysv/linux/getpeername.c         |   7 +-
 sysdeps/unix/sysv/linux/getsockname.c         |   7 +-
 sysdeps/unix/sysv/linux/hppa/Versions         |   3 -
 .../unix/sysv/linux/hppa/bits/struct_stat.h   | 139 ++++++++++++++++++
 sysdeps/unix/sysv/linux/hppa/bits/typesizes.h |  74 ++++++++++
 sysdeps/unix/sysv/linux/hppa/xstatver.h       |  13 ++
 sysdeps/unix/sysv/linux/i386/Versions         |   4 -
 .../unix/sysv/linux/i386/kernel-features.h    |  19 +--
 sysdeps/unix/sysv/linux/ia64/bits/typesizes.h |  86 +++++++++++
 .../sysv/linux/{generic => }/inotify_init.c   |   9 +-
 sysdeps/unix/sysv/linux/kernel-features.h     |   7 +
 .../unix/sysv/linux/{generic => }/lchown.c    |  11 +-
 sysdeps/unix/sysv/linux/{generic => }/link.c  |   9 +-
 sysdeps/unix/sysv/linux/listen.c              |   7 +-
 .../unix/sysv/linux/loongarch/lp64/Implies    |   1 -
 sysdeps/unix/sysv/linux/loongarch/sysdep.h    |   3 +-
 sysdeps/unix/sysv/linux/lseek.c               |   4 +
 sysdeps/unix/sysv/linux/lseek64.c             |   4 +
 sysdeps/unix/sysv/linux/m68k/Versions         |   3 -
 sysdeps/unix/sysv/linux/m68k/bits/typesizes.h |  74 ++++++++++
 .../unix/sysv/linux/m68k/kernel-features.h    |  19 +--
 sysdeps/unix/sysv/linux/microblaze/Versions   |   5 -
 .../sysv/linux/microblaze/bits/typesizes.h    |  74 ++++++++++
 .../sysv/linux/microblaze/kernel-features.h   |   7 -
 sysdeps/unix/sysv/linux/mips/Versions         |   3 -
 sysdeps/unix/sysv/linux/mips/bits/typesizes.h |  95 ++++++++++++
 .../sysv/linux/mips/mips64/n64/sendfile64.c   |   1 -
 .../sysv/linux/mips/mips64/n64/syscalls.list  |   3 -
 sysdeps/unix/sysv/linux/{generic => }/mkdir.c |  15 +-
 sysdeps/unix/sysv/linux/nios2/Implies         |   2 -
 .../unix/sysv/linux/nios2/bits/struct_stat.h  | 135 +++++++++++++++++
 sysdeps/unix/sysv/linux/nios2/sysdep.h        |   2 +-
 sysdeps/unix/sysv/linux/or1k/Implies          |   2 -
 sysdeps/unix/sysv/linux/or1k/sysdep.h         |   3 +-
 .../unix/sysv/linux/powerpc/bits/typesizes.h  |  95 ++++++++++++
 .../unix/sysv/linux/powerpc/kernel-features.h |   7 -
 .../sysv/linux/powerpc/powerpc32/Versions     |   3 -
 .../unix/sysv/linux/{generic => }/readlink.c  |   9 +-
 sysdeps/unix/sysv/linux/riscv/rv32/Implies    |   2 -
 sysdeps/unix/sysv/linux/riscv/rv64/Implies    |   1 -
 sysdeps/unix/sysv/linux/riscv/sysdep.h        |   3 +-
 sysdeps/unix/sysv/linux/{generic => }/rmdir.c |   9 +-
 .../unix/sysv/linux/s390/kernel-features.h    |  19 +--
 sysdeps/unix/sysv/linux/s390/s390-32/Versions |   3 -
 .../{generic/wordsize-32 => }/sendfile.c      |  15 +-
 .../linux/{generic/sysdep.h => sendfile64.c}  |  27 +++-
 sysdeps/unix/sysv/linux/sh/Versions           |   3 -
 sysdeps/unix/sysv/linux/sh/bits/struct_stat.h | 139 ++++++++++++++++++
 sysdeps/unix/sysv/linux/sh/bits/typesizes.h   |  74 ++++++++++
 sysdeps/unix/sysv/linux/sh/kernel-features.h  |   7 -
 sysdeps/unix/sysv/linux/sh/xstatver.h         |  13 ++
 sysdeps/unix/sysv/linux/shutdown.c            |   7 +-
 sysdeps/unix/sysv/linux/socket.c              |   7 +-
 sysdeps/unix/sysv/linux/socketpair.c          |   7 +-
 .../unix/sysv/linux/sparc/kernel-features.h   |  10 +-
 .../unix/sysv/linux/sparc/sparc32/Versions    |   3 -
 .../unix/sysv/linux/{generic => }/symlink.c   |   9 +-
 sysdeps/unix/sysv/linux/syscalls.list         |   2 -
 .../unix/sysv/linux/{generic => }/unlink.c    |   9 +-
 .../unix/sysv/linux/wordsize-64/sendfile64.c  |   1 -
 .../unix/sysv/linux/wordsize-64/syscalls.list |   1 -
 sysdeps/unix/sysv/linux/xstatver.h            |  11 +-
 90 files changed, 1549 insertions(+), 468 deletions(-)
 rename sysdeps/unix/sysv/linux/{generic => }/____longjmp_chk.c (90%)
 create mode 100644 sysdeps/unix/sysv/linux/arm/bits/struct_stat.h
 create mode 100644 sysdeps/unix/sysv/linux/arm/bits/typesizes.h
 rename sysdeps/unix/sysv/linux/{generic => arm}/xstatver.h (52%)
 rename sysdeps/unix/sysv/linux/{generic => }/bits/typesizes.h (100%)
 rename sysdeps/unix/sysv/linux/{generic => }/chmod.c (78%)
 rename sysdeps/unix/sysv/linux/{generic => }/chown.c (77%)
 rename sysdeps/unix/sysv/linux/{generic => csky}/bits/struct_stat.h (92%)
 rename sysdeps/unix/sysv/linux/{generic => }/dup2.c (83%)
 rename sysdeps/unix/sysv/linux/{generic => }/epoll_create.c (79%)
 delete mode 100644 sysdeps/unix/sysv/linux/generic/Makefile
 delete mode 100644 sysdeps/unix/sysv/linux/generic/README
 delete mode 100644 sysdeps/unix/sysv/linux/generic/bits/fcntl.h
 delete mode 100644 sysdeps/unix/sysv/linux/generic/dl-origin.c
 delete mode 100644 sysdeps/unix/sysv/linux/generic/syscalls.list
 delete mode 100644 sysdeps/unix/sysv/linux/generic/wordsize-32/Versions
 create mode 100644 sysdeps/unix/sysv/linux/hppa/bits/struct_stat.h
 create mode 100644 sysdeps/unix/sysv/linux/hppa/bits/typesizes.h
 create mode 100644 sysdeps/unix/sysv/linux/hppa/xstatver.h
 create mode 100644 sysdeps/unix/sysv/linux/ia64/bits/typesizes.h
 rename sysdeps/unix/sysv/linux/{generic => }/inotify_init.c (78%)
 rename sysdeps/unix/sysv/linux/{generic => }/lchown.c (75%)
 rename sysdeps/unix/sysv/linux/{generic => }/link.c (78%)
 create mode 100644 sysdeps/unix/sysv/linux/m68k/bits/typesizes.h
 delete mode 100644 sysdeps/unix/sysv/linux/microblaze/Versions
 create mode 100644 sysdeps/unix/sysv/linux/microblaze/bits/typesizes.h
 create mode 100644 sysdeps/unix/sysv/linux/mips/bits/typesizes.h
 delete mode 100644 sysdeps/unix/sysv/linux/mips/mips64/n64/sendfile64.c
 delete mode 100644 sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list
 rename sysdeps/unix/sysv/linux/{generic => }/mkdir.c (79%)
 create mode 100644 sysdeps/unix/sysv/linux/nios2/bits/struct_stat.h
 create mode 100644 sysdeps/unix/sysv/linux/powerpc/bits/typesizes.h
 rename sysdeps/unix/sysv/linux/{generic => }/readlink.c (80%)
 rename sysdeps/unix/sysv/linux/{generic => }/rmdir.c (78%)
 rename sysdeps/unix/sysv/linux/{generic/wordsize-32 => }/sendfile.c (77%)
 rename sysdeps/unix/sysv/linux/{generic/sysdep.h => sendfile64.c} (55%)
 create mode 100644 sysdeps/unix/sysv/linux/sh/bits/struct_stat.h
 create mode 100644 sysdeps/unix/sysv/linux/sh/bits/typesizes.h
 create mode 100644 sysdeps/unix/sysv/linux/sh/xstatver.h
 rename sysdeps/unix/sysv/linux/{generic => }/symlink.c (78%)
 rename sysdeps/unix/sysv/linux/{generic => }/unlink.c (77%)
 delete mode 100644 sysdeps/unix/sysv/linux/wordsize-64/sendfile64.c

-- 
2.34.1


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

* [PATCH 01/30] linux: Fix generic struct_stat for 64 bit time (BZ# 29657)
  2022-10-19 22:14 [PATCH 00/30] Remove Linux generic sysdep Adhemerval Zanella via Libc-alpha
@ 2022-10-19 22:14 ` Adhemerval Zanella via Libc-alpha
  2022-10-25 17:50   ` Joseph Myers
  2022-12-05 16:39   ` Carlos O'Donell via Libc-alpha
  2022-10-19 22:14 ` [PATCH 02/30] linux: Consolidate dl-origin.c Adhemerval Zanella via Libc-alpha
                   ` (28 subsequent siblings)
  29 siblings, 2 replies; 68+ messages in thread
From: Adhemerval Zanella via Libc-alpha @ 2022-10-19 22:14 UTC (permalink / raw)
  To: libc-alpha

The generic Linux struct_stat misses the conditionals to use
bits/struct_stat_time64_helper.h in the __USE_TIME_BITS64 for
architecture that uses __TIMESIZE == 32 (currently csky and nios2).

Since newer ports should not support 32 bit time_t, the generic
implementation should be used as default.

For arm, hppa, and sh a copy of default struct_stat is added,
while for cky and nios a new one based on generic is used, along
with conditionals to use bits/struct_stat_time64_helper.h.

The default struct_stat is also replaced with the generic one.

Checked on aarch64-linux-gnu and arm-linux-gnueabihf.
---
 .../unix/sysv/linux/arm/bits/struct_stat.h    | 139 ++++++++++++++++++
 sysdeps/unix/sysv/linux/bits/struct_stat.h    | 116 +++++++--------
 .../{generic => csky}/bits/struct_stat.h      |  28 ++--
 .../unix/sysv/linux/hppa/bits/struct_stat.h   | 139 ++++++++++++++++++
 .../unix/sysv/linux/nios2/bits/struct_stat.h  | 135 +++++++++++++++++
 sysdeps/unix/sysv/linux/sh/bits/struct_stat.h | 139 ++++++++++++++++++
 6 files changed, 622 insertions(+), 74 deletions(-)
 create mode 100644 sysdeps/unix/sysv/linux/arm/bits/struct_stat.h
 rename sysdeps/unix/sysv/linux/{generic => csky}/bits/struct_stat.h (92%)
 create mode 100644 sysdeps/unix/sysv/linux/hppa/bits/struct_stat.h
 create mode 100644 sysdeps/unix/sysv/linux/nios2/bits/struct_stat.h
 create mode 100644 sysdeps/unix/sysv/linux/sh/bits/struct_stat.h

diff --git a/sysdeps/unix/sysv/linux/arm/bits/struct_stat.h b/sysdeps/unix/sysv/linux/arm/bits/struct_stat.h
new file mode 100644
index 0000000000..30ee6279d2
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/arm/bits/struct_stat.h
@@ -0,0 +1,139 @@
+/* Definition for struct stat.  Linux/arm version.
+   Copyright (C) 2020-2022 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#if !defined _SYS_STAT_H && !defined _FCNTL_H
+# error "Never include <bits/struct_stat.h> directly; use <sys/stat.h> instead."
+#endif
+
+#ifndef _BITS_STRUCT_STAT_H
+#define _BITS_STRUCT_STAT_H	1
+
+#include <bits/endian.h>
+#include <bits/wordsize.h>
+
+struct stat
+  {
+#ifdef __USE_TIME_BITS64
+# include <bits/struct_stat_time64_helper.h>
+#else
+    __dev_t st_dev;			/* Device.  */
+    unsigned short int __pad1;
+# ifndef __USE_FILE_OFFSET64
+    __ino_t st_ino;			/* File serial number.	*/
+# else
+    __ino_t __st_ino;			/* 32bit file serial number.	*/
+# endif
+    __mode_t st_mode;			/* File mode.  */
+    __nlink_t st_nlink;			/* Link count.  */
+    __uid_t st_uid;			/* User ID of the file's owner.	*/
+    __gid_t st_gid;			/* Group ID of the file's group.*/
+    __dev_t st_rdev;			/* Device number, if device.  */
+    unsigned short int __pad2;
+# ifndef __USE_FILE_OFFSET64
+    __off_t st_size;			/* Size of file, in bytes.  */
+# else
+    __off64_t st_size;			/* Size of file, in bytes.  */
+# endif
+    __blksize_t st_blksize;		/* Optimal block size for I/O.  */
+
+# ifndef __USE_FILE_OFFSET64
+    __blkcnt_t st_blocks;		/* Number 512-byte blocks allocated. */
+# else
+    __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
+# endif
+# ifdef __USE_XOPEN2K8
+    /* Nanosecond resolution timestamps are stored in a format
+       equivalent to 'struct timespec'.  This is the type used
+       whenever possible but the Unix namespace rules do not allow the
+       identifier 'timespec' to appear in the <sys/stat.h> header.
+       Therefore we have to handle the use of this header in strictly
+       standard-compliant sources special.  */
+    struct timespec st_atim;		/* Time of last access.  */
+    struct timespec st_mtim;		/* Time of last modification.  */
+    struct timespec st_ctim;		/* Time of last status change.  */
+#  define st_atime st_atim.tv_sec	/* Backward compatibility.  */
+#  define st_mtime st_mtim.tv_sec
+#  define st_ctime st_ctim.tv_sec
+# else
+    __time_t st_atime;			/* Time of last access.  */
+    unsigned long int st_atimensec;	/* Nscecs of last access.  */
+    __time_t st_mtime;			/* Time of last modification.  */
+    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
+    __time_t st_ctime;			/* Time of last status change.  */
+    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
+# endif
+# ifndef __USE_FILE_OFFSET64
+    unsigned long int __glibc_reserved4;
+    unsigned long int __glibc_reserved5;
+# else
+    __ino64_t st_ino;			/* File serial number.	*/
+# endif
+#endif /* __USE_TIME_BITS64  */
+  };
+
+#ifdef __USE_LARGEFILE64
+struct stat64
+  {
+# ifdef __USE_TIME_BITS64
+#  include <bits/struct_stat_time64_helper.h>
+# else
+    __dev_t st_dev;			/* Device.  */
+    unsigned int __pad1;
+
+    __ino_t __st_ino;			/* 32bit file serial number.	*/
+    __mode_t st_mode;			/* File mode.  */
+    __nlink_t st_nlink;			/* Link count.  */
+    __uid_t st_uid;			/* User ID of the file's owner.	*/
+    __gid_t st_gid;			/* Group ID of the file's group.*/
+    __dev_t st_rdev;			/* Device number, if device.  */
+    unsigned int __pad2;
+    __off64_t st_size;			/* Size of file, in bytes.  */
+    __blksize_t st_blksize;		/* Optimal block size for I/O.  */
+
+    __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
+#  ifdef __USE_XOPEN2K8
+    /* Nanosecond resolution timestamps are stored in a format
+       equivalent to 'struct timespec'.  This is the type used
+       whenever possible but the Unix namespace rules do not allow the
+       identifier 'timespec' to appear in the <sys/stat.h> header.
+       Therefore we have to handle the use of this header in strictly
+       standard-compliant sources special.  */
+    struct timespec st_atim;		/* Time of last access.  */
+    struct timespec st_mtim;		/* Time of last modification.  */
+    struct timespec st_ctim;		/* Time of last status change.  */
+#  else
+    __time_t st_atime;			/* Time of last access.  */
+    unsigned long int st_atimensec;	/* Nscecs of last access.  */
+    __time_t st_mtime;			/* Time of last modification.  */
+    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
+    __time_t st_ctime;			/* Time of last status change.  */
+    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
+#  endif
+    __ino64_t st_ino;			/* File serial number.		*/
+# endif /* __USE_TIME_BITS64  */
+  };
+#endif
+
+/* Tell code we have these members.  */
+#define	_STATBUF_ST_BLKSIZE
+#define _STATBUF_ST_RDEV
+/* Nanosecond resolution time values are supported.  */
+#define _STATBUF_ST_NSEC
+
+
+#endif /* _BITS_STRUCT_STAT_H  */
diff --git a/sysdeps/unix/sysv/linux/bits/struct_stat.h b/sysdeps/unix/sysv/linux/bits/struct_stat.h
index 25bd6cb638..fb11a3fba4 100644
--- a/sysdeps/unix/sysv/linux/bits/struct_stat.h
+++ b/sysdeps/unix/sysv/linux/bits/struct_stat.h
@@ -26,37 +26,36 @@
 #include <bits/endian.h>
 #include <bits/wordsize.h>
 
-struct stat
-  {
-#ifdef __USE_TIME_BITS64
-# include <bits/struct_stat_time64_helper.h>
-#else
-    __dev_t st_dev;			/* Device.  */
-    unsigned short int __pad1;
-# ifndef __USE_FILE_OFFSET64
-    __ino_t st_ino;			/* File serial number.	*/
-# else
-    __ino_t __st_ino;			/* 32bit file serial number.	*/
+#if defined __USE_FILE_OFFSET64
+# define __field64(type, type64, name) type64 name
+#elif __WORDSIZE == 64 || defined __INO_T_MATCHES_INO64_T
+# if defined __INO_T_MATCHES_INO64_T && !defined __OFF_T_MATCHES_OFF64_T
+#  error "ino_t and off_t must both be the same type"
 # endif
-    __mode_t st_mode;			/* File mode.  */
-    __nlink_t st_nlink;			/* Link count.  */
-    __uid_t st_uid;			/* User ID of the file's owner.	*/
-    __gid_t st_gid;			/* Group ID of the file's group.*/
-    __dev_t st_rdev;			/* Device number, if device.  */
-    unsigned short int __pad2;
-# ifndef __USE_FILE_OFFSET64
-    __off_t st_size;			/* Size of file, in bytes.  */
-# else
-    __off64_t st_size;			/* Size of file, in bytes.  */
-# endif
-    __blksize_t st_blksize;		/* Optimal block size for I/O.  */
+# define __field64(type, type64, name) type name
+#elif __BYTE_ORDER == __LITTLE_ENDIAN
+# define __field64(type, type64, name) \
+  type name __attribute__((__aligned__ (__alignof__ (type64)))); int __##name##_pad
+#else
+# define __field64(type, type64, name) \
+  int __##name##_pad __attribute__((__aligned__ (__alignof__ (type64)))); type name
+#endif
 
-# ifndef __USE_FILE_OFFSET64
-    __blkcnt_t st_blocks;		/* Number 512-byte blocks allocated. */
-# else
-    __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
-# endif
-# ifdef __USE_XOPEN2K8
+struct stat
+  {
+    __dev_t st_dev;		/* Device.  */
+    __field64(__ino_t, __ino64_t, st_ino);  /* File serial number. */
+    __mode_t st_mode;		/* File mode.  */
+    __nlink_t st_nlink;		/* Link count.  */
+    __uid_t st_uid;		/* User ID of the file's owner.	*/
+    __gid_t st_gid;		/* Group ID of the file's group.*/
+    __dev_t st_rdev;		/* Device number, if device.  */
+    __dev_t __pad1;
+    __field64(__off_t, __off64_t, st_size);  /* Size of file, in bytes. */
+    __blksize_t st_blksize;	/* Optimal block size for I/O.  */
+    int __pad2;
+    __field64(__blkcnt_t, __blkcnt64_t, st_blocks);  /* 512-byte blocks */
+#ifdef __USE_XOPEN2K8
     /* Nanosecond resolution timestamps are stored in a format
        equivalent to 'struct timespec'.  This is the type used
        whenever possible but the Unix namespace rules do not allow the
@@ -66,47 +65,38 @@ struct stat
     struct timespec st_atim;		/* Time of last access.  */
     struct timespec st_mtim;		/* Time of last modification.  */
     struct timespec st_ctim;		/* Time of last status change.  */
-#  define st_atime st_atim.tv_sec	/* Backward compatibility.  */
-#  define st_mtime st_mtim.tv_sec
-#  define st_ctime st_ctim.tv_sec
-# else
+# define st_atime st_atim.tv_sec	/* Backward compatibility.  */
+# define st_mtime st_mtim.tv_sec
+# define st_ctime st_ctim.tv_sec
+#else
     __time_t st_atime;			/* Time of last access.  */
     unsigned long int st_atimensec;	/* Nscecs of last access.  */
     __time_t st_mtime;			/* Time of last modification.  */
     unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
     __time_t st_ctime;			/* Time of last status change.  */
     unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
-# endif
-# ifndef __USE_FILE_OFFSET64
-    unsigned long int __glibc_reserved4;
-    unsigned long int __glibc_reserved5;
-# else
-    __ino64_t st_ino;			/* File serial number.	*/
-# endif
-#endif /* __USE_TIME_BITS64  */
+#endif
+    int __glibc_reserved[2];
   };
 
+#undef __field64
+
 #ifdef __USE_LARGEFILE64
 struct stat64
   {
-# ifdef __USE_TIME_BITS64
-#  include <bits/struct_stat_time64_helper.h>
-# else
-    __dev_t st_dev;			/* Device.  */
-    unsigned int __pad1;
-
-    __ino_t __st_ino;			/* 32bit file serial number.	*/
-    __mode_t st_mode;			/* File mode.  */
-    __nlink_t st_nlink;			/* Link count.  */
-    __uid_t st_uid;			/* User ID of the file's owner.	*/
-    __gid_t st_gid;			/* Group ID of the file's group.*/
-    __dev_t st_rdev;			/* Device number, if device.  */
-    unsigned int __pad2;
-    __off64_t st_size;			/* Size of file, in bytes.  */
-    __blksize_t st_blksize;		/* Optimal block size for I/O.  */
-
-    __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
-#  ifdef __USE_XOPEN2K8
+    __dev_t st_dev;		/* Device.  */
+    __ino64_t st_ino;		/* File serial number.	*/
+    __mode_t st_mode;		/* File mode.  */
+    __nlink_t st_nlink;		/* Link count.  */
+    __uid_t st_uid;		/* User ID of the file's owner.	*/
+    __gid_t st_gid;		/* Group ID of the file's group.*/
+    __dev_t st_rdev;		/* Device number, if device.  */
+    __dev_t __pad1;
+    __off64_t st_size;		/* Size of file, in bytes.  */
+    __blksize_t st_blksize;	/* Optimal block size for I/O.  */
+    int __pad2;
+    __blkcnt64_t st_blocks;	/* Nr. 512-byte blocks allocated.  */
+#ifdef __USE_XOPEN2K8
     /* Nanosecond resolution timestamps are stored in a format
        equivalent to 'struct timespec'.  This is the type used
        whenever possible but the Unix namespace rules do not allow the
@@ -116,16 +106,15 @@ struct stat64
     struct timespec st_atim;		/* Time of last access.  */
     struct timespec st_mtim;		/* Time of last modification.  */
     struct timespec st_ctim;		/* Time of last status change.  */
-#  else
+#else
     __time_t st_atime;			/* Time of last access.  */
     unsigned long int st_atimensec;	/* Nscecs of last access.  */
     __time_t st_mtime;			/* Time of last modification.  */
     unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
     __time_t st_ctime;			/* Time of last status change.  */
     unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
-#  endif
-    __ino64_t st_ino;			/* File serial number.		*/
-# endif /* __USE_TIME_BITS64  */
+#endif
+    int __glibc_reserved[2];
   };
 #endif
 
@@ -135,5 +124,4 @@ struct stat64
 /* Nanosecond resolution time values are supported.  */
 #define _STATBUF_ST_NSEC
 
-
 #endif /* _BITS_STRUCT_STAT_H  */
diff --git a/sysdeps/unix/sysv/linux/generic/bits/struct_stat.h b/sysdeps/unix/sysv/linux/csky/bits/struct_stat.h
similarity index 92%
rename from sysdeps/unix/sysv/linux/generic/bits/struct_stat.h
rename to sysdeps/unix/sysv/linux/csky/bits/struct_stat.h
index fb11a3fba4..f0ee455748 100644
--- a/sysdeps/unix/sysv/linux/generic/bits/struct_stat.h
+++ b/sysdeps/unix/sysv/linux/csky/bits/struct_stat.h
@@ -1,4 +1,4 @@
-/* Definition for struct stat.
+/* Definition for struct stat.  Linux/csky version.
    Copyright (C) 2020-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -43,6 +43,9 @@
 
 struct stat
   {
+#ifdef __USE_TIME_BITS64
+# include <bits/struct_stat_time64_helper.h>
+#else
     __dev_t st_dev;		/* Device.  */
     __field64(__ino_t, __ino64_t, st_ino);  /* File serial number. */
     __mode_t st_mode;		/* File mode.  */
@@ -55,7 +58,7 @@ struct stat
     __blksize_t st_blksize;	/* Optimal block size for I/O.  */
     int __pad2;
     __field64(__blkcnt_t, __blkcnt64_t, st_blocks);  /* 512-byte blocks */
-#ifdef __USE_XOPEN2K8
+# ifdef __USE_XOPEN2K8
     /* Nanosecond resolution timestamps are stored in a format
        equivalent to 'struct timespec'.  This is the type used
        whenever possible but the Unix namespace rules do not allow the
@@ -65,18 +68,19 @@ struct stat
     struct timespec st_atim;		/* Time of last access.  */
     struct timespec st_mtim;		/* Time of last modification.  */
     struct timespec st_ctim;		/* Time of last status change.  */
-# define st_atime st_atim.tv_sec	/* Backward compatibility.  */
-# define st_mtime st_mtim.tv_sec
-# define st_ctime st_ctim.tv_sec
-#else
+#  define st_atime st_atim.tv_sec	/* Backward compatibility.  */
+#  define st_mtime st_mtim.tv_sec
+#  define st_ctime st_ctim.tv_sec
+# else
     __time_t st_atime;			/* Time of last access.  */
     unsigned long int st_atimensec;	/* Nscecs of last access.  */
     __time_t st_mtime;			/* Time of last modification.  */
     unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
     __time_t st_ctime;			/* Time of last status change.  */
     unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
-#endif
+# endif
     int __glibc_reserved[2];
+#endif
   };
 
 #undef __field64
@@ -84,6 +88,9 @@ struct stat
 #ifdef __USE_LARGEFILE64
 struct stat64
   {
+# ifdef __USE_TIME_BITS64
+#  include <bits/struct_stat_time64_helper.h>
+# else
     __dev_t st_dev;		/* Device.  */
     __ino64_t st_ino;		/* File serial number.	*/
     __mode_t st_mode;		/* File mode.  */
@@ -96,7 +103,7 @@ struct stat64
     __blksize_t st_blksize;	/* Optimal block size for I/O.  */
     int __pad2;
     __blkcnt64_t st_blocks;	/* Nr. 512-byte blocks allocated.  */
-#ifdef __USE_XOPEN2K8
+#  ifdef __USE_XOPEN2K8
     /* Nanosecond resolution timestamps are stored in a format
        equivalent to 'struct timespec'.  This is the type used
        whenever possible but the Unix namespace rules do not allow the
@@ -106,15 +113,16 @@ struct stat64
     struct timespec st_atim;		/* Time of last access.  */
     struct timespec st_mtim;		/* Time of last modification.  */
     struct timespec st_ctim;		/* Time of last status change.  */
-#else
+#  else
     __time_t st_atime;			/* Time of last access.  */
     unsigned long int st_atimensec;	/* Nscecs of last access.  */
     __time_t st_mtime;			/* Time of last modification.  */
     unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
     __time_t st_ctime;			/* Time of last status change.  */
     unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
-#endif
+#  endif
     int __glibc_reserved[2];
+# endif
   };
 #endif
 
diff --git a/sysdeps/unix/sysv/linux/hppa/bits/struct_stat.h b/sysdeps/unix/sysv/linux/hppa/bits/struct_stat.h
new file mode 100644
index 0000000000..38b6e13e68
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/hppa/bits/struct_stat.h
@@ -0,0 +1,139 @@
+/* Definition for struct stat.  Linux/hppa version.
+   Copyright (C) 2020-2022 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#if !defined _SYS_STAT_H && !defined _FCNTL_H
+# error "Never include <bits/struct_stat.h> directly; use <sys/stat.h> instead."
+#endif
+
+#ifndef _BITS_STRUCT_STAT_H
+#define _BITS_STRUCT_STAT_H	1
+
+#include <bits/endian.h>
+#include <bits/wordsize.h>
+
+struct stat
+  {
+#ifdef __USE_TIME_BITS64
+# include <bits/struct_stat_time64_helper.h>
+#else
+    __dev_t st_dev;			/* Device.  */
+    unsigned short int __pad1;
+# ifndef __USE_FILE_OFFSET64
+    __ino_t st_ino;			/* File serial number.	*/
+# else
+    __ino_t __st_ino;			/* 32bit file serial number.	*/
+# endif
+    __mode_t st_mode;			/* File mode.  */
+    __nlink_t st_nlink;			/* Link count.  */
+    __uid_t st_uid;			/* User ID of the file's owner.	*/
+    __gid_t st_gid;			/* Group ID of the file's group.*/
+    __dev_t st_rdev;			/* Device number, if device.  */
+    unsigned short int __pad2;
+# ifndef __USE_FILE_OFFSET64
+    __off_t st_size;			/* Size of file, in bytes.  */
+# else
+    __off64_t st_size;			/* Size of file, in bytes.  */
+# endif
+    __blksize_t st_blksize;		/* Optimal block size for I/O.  */
+
+# ifndef __USE_FILE_OFFSET64
+    __blkcnt_t st_blocks;		/* Number 512-byte blocks allocated. */
+# else
+    __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
+# endif
+# ifdef __USE_XOPEN2K8
+    /* Nanosecond resolution timestamps are stored in a format
+       equivalent to 'struct timespec'.  This is the type used
+       whenever possible but the Unix namespace rules do not allow the
+       identifier 'timespec' to appear in the <sys/stat.h> header.
+       Therefore we have to handle the use of this header in strictly
+       standard-compliant sources special.  */
+    struct timespec st_atim;		/* Time of last access.  */
+    struct timespec st_mtim;		/* Time of last modification.  */
+    struct timespec st_ctim;		/* Time of last status change.  */
+#  define st_atime st_atim.tv_sec	/* Backward compatibility.  */
+#  define st_mtime st_mtim.tv_sec
+#  define st_ctime st_ctim.tv_sec
+# else
+    __time_t st_atime;			/* Time of last access.  */
+    unsigned long int st_atimensec;	/* Nscecs of last access.  */
+    __time_t st_mtime;			/* Time of last modification.  */
+    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
+    __time_t st_ctime;			/* Time of last status change.  */
+    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
+# endif
+# ifndef __USE_FILE_OFFSET64
+    unsigned long int __glibc_reserved4;
+    unsigned long int __glibc_reserved5;
+# else
+    __ino64_t st_ino;			/* File serial number.	*/
+# endif
+#endif /* __USE_TIME_BITS64  */
+  };
+
+#ifdef __USE_LARGEFILE64
+struct stat64
+  {
+# ifdef __USE_TIME_BITS64
+#  include <bits/struct_stat_time64_helper.h>
+# else
+    __dev_t st_dev;			/* Device.  */
+    unsigned int __pad1;
+
+    __ino_t __st_ino;			/* 32bit file serial number.	*/
+    __mode_t st_mode;			/* File mode.  */
+    __nlink_t st_nlink;			/* Link count.  */
+    __uid_t st_uid;			/* User ID of the file's owner.	*/
+    __gid_t st_gid;			/* Group ID of the file's group.*/
+    __dev_t st_rdev;			/* Device number, if device.  */
+    unsigned int __pad2;
+    __off64_t st_size;			/* Size of file, in bytes.  */
+    __blksize_t st_blksize;		/* Optimal block size for I/O.  */
+
+    __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
+#  ifdef __USE_XOPEN2K8
+    /* Nanosecond resolution timestamps are stored in a format
+       equivalent to 'struct timespec'.  This is the type used
+       whenever possible but the Unix namespace rules do not allow the
+       identifier 'timespec' to appear in the <sys/stat.h> header.
+       Therefore we have to handle the use of this header in strictly
+       standard-compliant sources special.  */
+    struct timespec st_atim;		/* Time of last access.  */
+    struct timespec st_mtim;		/* Time of last modification.  */
+    struct timespec st_ctim;		/* Time of last status change.  */
+#  else
+    __time_t st_atime;			/* Time of last access.  */
+    unsigned long int st_atimensec;	/* Nscecs of last access.  */
+    __time_t st_mtime;			/* Time of last modification.  */
+    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
+    __time_t st_ctime;			/* Time of last status change.  */
+    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
+#  endif
+    __ino64_t st_ino;			/* File serial number.		*/
+# endif /* __USE_TIME_BITS64  */
+  };
+#endif
+
+/* Tell code we have these members.  */
+#define	_STATBUF_ST_BLKSIZE
+#define _STATBUF_ST_RDEV
+/* Nanosecond resolution time values are supported.  */
+#define _STATBUF_ST_NSEC
+
+
+#endif /* _BITS_STRUCT_STAT_H  */
diff --git a/sysdeps/unix/sysv/linux/nios2/bits/struct_stat.h b/sysdeps/unix/sysv/linux/nios2/bits/struct_stat.h
new file mode 100644
index 0000000000..e00e71173e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/nios2/bits/struct_stat.h
@@ -0,0 +1,135 @@
+/* Definition for struct stat.  Linux/nios2 version.
+   Copyright (C) 2020-2022 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#if !defined _SYS_STAT_H && !defined _FCNTL_H
+# error "Never include <bits/struct_stat.h> directly; use <sys/stat.h> instead."
+#endif
+
+#ifndef _BITS_STRUCT_STAT_H
+#define _BITS_STRUCT_STAT_H	1
+
+#include <bits/endian.h>
+#include <bits/wordsize.h>
+
+#if defined __USE_FILE_OFFSET64
+# define __field64(type, type64, name) type64 name
+#elif __WORDSIZE == 64 || defined __INO_T_MATCHES_INO64_T
+# if defined __INO_T_MATCHES_INO64_T && !defined __OFF_T_MATCHES_OFF64_T
+#  error "ino_t and off_t must both be the same type"
+# endif
+# define __field64(type, type64, name) type name
+#elif __BYTE_ORDER == __LITTLE_ENDIAN
+# define __field64(type, type64, name) \
+  type name __attribute__((__aligned__ (__alignof__ (type64)))); int __##name##_pad
+#else
+# define __field64(type, type64, name) \
+  int __##name##_pad __attribute__((__aligned__ (__alignof__ (type64)))); type name
+#endif
+
+struct stat
+  {
+#ifdef __USE_TIME_BITS64
+# include <bits/struct_stat_time64_helper.h>
+#else
+    __dev_t st_dev;		/* Device.  */
+    __field64(__ino_t, __ino64_t, st_ino);  /* File serial number. */
+    __mode_t st_mode;		/* File mode.  */
+    __nlink_t st_nlink;		/* Link count.  */
+    __uid_t st_uid;		/* User ID of the file's owner.	*/
+    __gid_t st_gid;		/* Group ID of the file's group.*/
+    __dev_t st_rdev;		/* Device number, if device.  */
+    __dev_t __pad1;
+    __field64(__off_t, __off64_t, st_size);  /* Size of file, in bytes. */
+    __blksize_t st_blksize;	/* Optimal block size for I/O.  */
+    int __pad2;
+    __field64(__blkcnt_t, __blkcnt64_t, st_blocks);  /* 512-byte blocks */
+# ifdef __USE_XOPEN2K8
+    /* Nanosecond resolution timestamps are stored in a format
+       equivalent to 'struct timespec'.  This is the type used
+       whenever possible but the Unix namespace rules do not allow the
+       identifier 'timespec' to appear in the <sys/stat.h> header.
+       Therefore we have to handle the use of this header in strictly
+       standard-compliant sources special.  */
+    struct timespec st_atim;		/* Time of last access.  */
+    struct timespec st_mtim;		/* Time of last modification.  */
+    struct timespec st_ctim;		/* Time of last status change.  */
+#  define st_atime st_atim.tv_sec	/* Backward compatibility.  */
+#  define st_mtime st_mtim.tv_sec
+#  define st_ctime st_ctim.tv_sec
+# else
+    __time_t st_atime;			/* Time of last access.  */
+    unsigned long int st_atimensec;	/* Nscecs of last access.  */
+    __time_t st_mtime;			/* Time of last modification.  */
+    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
+    __time_t st_ctime;			/* Time of last status change.  */
+    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
+# endif
+    int __glibc_reserved[2];
+#endif
+  };
+
+#undef __field64
+
+#ifdef __USE_LARGEFILE64
+struct stat64
+  {
+# ifdef __USE_TIME_BITS64
+#  include <bits/struct_stat_time64_helper.h>
+# else
+    __dev_t st_dev;		/* Device.  */
+    __ino64_t st_ino;		/* File serial number.	*/
+    __mode_t st_mode;		/* File mode.  */
+    __nlink_t st_nlink;		/* Link count.  */
+    __uid_t st_uid;		/* User ID of the file's owner.	*/
+    __gid_t st_gid;		/* Group ID of the file's group.*/
+    __dev_t st_rdev;		/* Device number, if device.  */
+    __dev_t __pad1;
+    __off64_t st_size;		/* Size of file, in bytes.  */
+    __blksize_t st_blksize;	/* Optimal block size for I/O.  */
+    int __pad2;
+    __blkcnt64_t st_blocks;	/* Nr. 512-byte blocks allocated.  */
+#  ifdef __USE_XOPEN2K8
+    /* Nanosecond resolution timestamps are stored in a format
+       equivalent to 'struct timespec'.  This is the type used
+       whenever possible but the Unix namespace rules do not allow the
+       identifier 'timespec' to appear in the <sys/stat.h> header.
+       Therefore we have to handle the use of this header in strictly
+       standard-compliant sources special.  */
+    struct timespec st_atim;		/* Time of last access.  */
+    struct timespec st_mtim;		/* Time of last modification.  */
+    struct timespec st_ctim;		/* Time of last status change.  */
+#  else
+    __time_t st_atime;			/* Time of last access.  */
+    unsigned long int st_atimensec;	/* Nscecs of last access.  */
+    __time_t st_mtime;			/* Time of last modification.  */
+    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
+    __time_t st_ctime;			/* Time of last status change.  */
+    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
+#  endif
+    int __glibc_reserved[2];
+# endif
+  };
+#endif
+
+/* Tell code we have these members.  */
+#define	_STATBUF_ST_BLKSIZE
+#define _STATBUF_ST_RDEV
+/* Nanosecond resolution time values are supported.  */
+#define _STATBUF_ST_NSEC
+
+#endif /* _BITS_STRUCT_STAT_H  */
diff --git a/sysdeps/unix/sysv/linux/sh/bits/struct_stat.h b/sysdeps/unix/sysv/linux/sh/bits/struct_stat.h
new file mode 100644
index 0000000000..0f7c9cdc89
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/bits/struct_stat.h
@@ -0,0 +1,139 @@
+/* Definition for struct stat.  Linux/sh version.
+   Copyright (C) 2020-2022 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#if !defined _SYS_STAT_H && !defined _FCNTL_H
+# error "Never include <bits/struct_stat.h> directly; use <sys/stat.h> instead."
+#endif
+
+#ifndef _BITS_STRUCT_STAT_H
+#define _BITS_STRUCT_STAT_H	1
+
+#include <bits/endian.h>
+#include <bits/wordsize.h>
+
+struct stat
+  {
+#ifdef __USE_TIME_BITS64
+# include <bits/struct_stat_time64_helper.h>
+#else
+    __dev_t st_dev;			/* Device.  */
+    unsigned short int __pad1;
+# ifndef __USE_FILE_OFFSET64
+    __ino_t st_ino;			/* File serial number.	*/
+# else
+    __ino_t __st_ino;			/* 32bit file serial number.	*/
+# endif
+    __mode_t st_mode;			/* File mode.  */
+    __nlink_t st_nlink;			/* Link count.  */
+    __uid_t st_uid;			/* User ID of the file's owner.	*/
+    __gid_t st_gid;			/* Group ID of the file's group.*/
+    __dev_t st_rdev;			/* Device number, if device.  */
+    unsigned short int __pad2;
+# ifndef __USE_FILE_OFFSET64
+    __off_t st_size;			/* Size of file, in bytes.  */
+# else
+    __off64_t st_size;			/* Size of file, in bytes.  */
+# endif
+    __blksize_t st_blksize;		/* Optimal block size for I/O.  */
+
+# ifndef __USE_FILE_OFFSET64
+    __blkcnt_t st_blocks;		/* Number 512-byte blocks allocated. */
+# else
+    __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
+# endif
+# ifdef __USE_XOPEN2K8
+    /* Nanosecond resolution timestamps are stored in a format
+       equivalent to 'struct timespec'.  This is the type used
+       whenever possible but the Unix namespace rules do not allow the
+       identifier 'timespec' to appear in the <sys/stat.h> header.
+       Therefore we have to handle the use of this header in strictly
+       standard-compliant sources special.  */
+    struct timespec st_atim;		/* Time of last access.  */
+    struct timespec st_mtim;		/* Time of last modification.  */
+    struct timespec st_ctim;		/* Time of last status change.  */
+#  define st_atime st_atim.tv_sec	/* Backward compatibility.  */
+#  define st_mtime st_mtim.tv_sec
+#  define st_ctime st_ctim.tv_sec
+# else
+    __time_t st_atime;			/* Time of last access.  */
+    unsigned long int st_atimensec;	/* Nscecs of last access.  */
+    __time_t st_mtime;			/* Time of last modification.  */
+    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
+    __time_t st_ctime;			/* Time of last status change.  */
+    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
+# endif
+# ifndef __USE_FILE_OFFSET64
+    unsigned long int __glibc_reserved4;
+    unsigned long int __glibc_reserved5;
+# else
+    __ino64_t st_ino;			/* File serial number.	*/
+# endif
+#endif /* __USE_TIME_BITS64  */
+  };
+
+#ifdef __USE_LARGEFILE64
+struct stat64
+  {
+# ifdef __USE_TIME_BITS64
+#  include <bits/struct_stat_time64_helper.h>
+# else
+    __dev_t st_dev;			/* Device.  */
+    unsigned int __pad1;
+
+    __ino_t __st_ino;			/* 32bit file serial number.	*/
+    __mode_t st_mode;			/* File mode.  */
+    __nlink_t st_nlink;			/* Link count.  */
+    __uid_t st_uid;			/* User ID of the file's owner.	*/
+    __gid_t st_gid;			/* Group ID of the file's group.*/
+    __dev_t st_rdev;			/* Device number, if device.  */
+    unsigned int __pad2;
+    __off64_t st_size;			/* Size of file, in bytes.  */
+    __blksize_t st_blksize;		/* Optimal block size for I/O.  */
+
+    __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
+#  ifdef __USE_XOPEN2K8
+    /* Nanosecond resolution timestamps are stored in a format
+       equivalent to 'struct timespec'.  This is the type used
+       whenever possible but the Unix namespace rules do not allow the
+       identifier 'timespec' to appear in the <sys/stat.h> header.
+       Therefore we have to handle the use of this header in strictly
+       standard-compliant sources special.  */
+    struct timespec st_atim;		/* Time of last access.  */
+    struct timespec st_mtim;		/* Time of last modification.  */
+    struct timespec st_ctim;		/* Time of last status change.  */
+#  else
+    __time_t st_atime;			/* Time of last access.  */
+    unsigned long int st_atimensec;	/* Nscecs of last access.  */
+    __time_t st_mtime;			/* Time of last modification.  */
+    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
+    __time_t st_ctime;			/* Time of last status change.  */
+    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
+#  endif
+    __ino64_t st_ino;			/* File serial number.		*/
+# endif /* __USE_TIME_BITS64  */
+  };
+#endif
+
+/* Tell code we have these members.  */
+#define	_STATBUF_ST_BLKSIZE
+#define _STATBUF_ST_RDEV
+/* Nanosecond resolution time values are supported.  */
+#define _STATBUF_ST_NSEC
+
+
+#endif /* _BITS_STRUCT_STAT_H  */
-- 
2.34.1


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

* [PATCH 02/30] linux: Consolidate dl-origin.c
  2022-10-19 22:14 [PATCH 00/30] Remove Linux generic sysdep Adhemerval Zanella via Libc-alpha
  2022-10-19 22:14 ` [PATCH 01/30] linux: Fix generic struct_stat for 64 bit time (BZ# 29657) Adhemerval Zanella via Libc-alpha
@ 2022-10-19 22:14 ` Adhemerval Zanella via Libc-alpha
  2022-10-19 22:14 ` [PATCH 03/30] Linux: consolidate chmod implementation Adhemerval Zanella via Libc-alpha
                   ` (27 subsequent siblings)
  29 siblings, 0 replies; 68+ messages in thread
From: Adhemerval Zanella via Libc-alpha @ 2022-10-19 22:14 UTC (permalink / raw)
  To: libc-alpha

Use the generic implementation as the default, since the syscall
is supported by all architectures.

Also cleanup some headers and remove the INTERNAL_SYSCALL_ERROR_P
usage (the INTERNAL_SYSCALL_CALL macro already returns an negative
value if an error occurs).
---
 sysdeps/unix/sysv/linux/dl-origin.c         | 14 ++--
 sysdeps/unix/sysv/linux/generic/dl-origin.c | 79 ---------------------
 2 files changed, 5 insertions(+), 88 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/generic/dl-origin.c

diff --git a/sysdeps/unix/sysv/linux/dl-origin.c b/sysdeps/unix/sysv/linux/dl-origin.c
index 9a76c78648..2fd1e5f400 100644
--- a/sysdeps/unix/sysv/linux/dl-origin.c
+++ b/sysdeps/unix/sysv/linux/dl-origin.c
@@ -17,15 +17,11 @@
    <https://www.gnu.org/licenses/>.  */
 
 #include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/param.h>
+#include <dl-dst.h>
+#include <fcntl.h>
 #include <ldsodefs.h>
 #include <sysdep.h>
 
-#include <dl-dst.h>
-
 /* On Linux >= 2.1 systems which have the dcache implementation we can get
    the path of the application from the /proc/self/exe symlink.  Try this
    first and fall back on the generic method if necessary.  */
@@ -37,9 +33,9 @@ _dl_get_origin (void)
   char *result;
   int len;
 
-  len = INTERNAL_SYSCALL_CALL (readlink, "/proc/self/exe", linkval,
-			       sizeof (linkval));
-  if (! INTERNAL_SYSCALL_ERROR_P (len) && len > 0 && linkval[0] != '[')
+  len = INTERNAL_SYSCALL_CALL (readlinkat, AT_FDCWD, "/proc/self/exe",
+			       linkval, sizeof (linkval));
+  if (len > 0 && linkval[0] != '[')
     {
       /* We can use this value.  */
       assert (linkval[0] == '/');
diff --git a/sysdeps/unix/sysv/linux/generic/dl-origin.c b/sysdeps/unix/sysv/linux/generic/dl-origin.c
deleted file mode 100644
index ed3ac3570c..0000000000
--- a/sysdeps/unix/sysv/linux/generic/dl-origin.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Find path of executable.
-   Copyright (C) 1998-2022 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library.  If not, see
-   <https://www.gnu.org/licenses/>.  */
-
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/param.h>
-#include <ldsodefs.h>
-#include <sysdep.h>
-
-#include <dl-dst.h>
-
-/* On Linux >= 2.1 systems which have the dcache implementation we can get
-   the path of the application from the /proc/self/exe symlink.  Try this
-   first and fall back on the generic method if necessary.  */
-
-const char *
-_dl_get_origin (void)
-{
-  char linkval[PATH_MAX];
-  char *result;
-  int len;
-
-  len = INTERNAL_SYSCALL_CALL (readlinkat, AT_FDCWD, "/proc/self/exe",
-			       linkval, sizeof (linkval));
-  if (! INTERNAL_SYSCALL_ERROR_P (len) && len > 0 && linkval[0] != '[')
-    {
-      /* We can use this value.  */
-      assert (linkval[0] == '/');
-      while (len > 1 && linkval[len - 1] != '/')
-	--len;
-      result = (char *) malloc (len + 1);
-      if (result == NULL)
-	result = (char *) -1;
-      else if (len == 1)
-	memcpy (result, "/", 2);
-      else
-	*((char *) __mempcpy (result, linkval, len - 1)) = '\0';
-    }
-  else
-    {
-      result = (char *) -1;
-      /* We use the environment variable LD_ORIGIN_PATH.  If it is set make
-	 a copy and strip out trailing slashes.  */
-      if (GLRO(dl_origin_path) != NULL)
-	{
-	  size_t len = strlen (GLRO(dl_origin_path));
-	  result = (char *) malloc (len + 1);
-	  if (result == NULL)
-	    result = (char *) -1;
-	  else
-	    {
-	      char *cp = __mempcpy (result, GLRO(dl_origin_path), len);
-	      while (cp > result + 1 && cp[-1] == '/')
-		--cp;
-	      *cp = '\0';
-	    }
-	}
-    }
-
-  return result;
-}
-- 
2.34.1


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

* [PATCH 03/30] Linux: consolidate chmod implementation
  2022-10-19 22:14 [PATCH 00/30] Remove Linux generic sysdep Adhemerval Zanella via Libc-alpha
  2022-10-19 22:14 ` [PATCH 01/30] linux: Fix generic struct_stat for 64 bit time (BZ# 29657) Adhemerval Zanella via Libc-alpha
  2022-10-19 22:14 ` [PATCH 02/30] linux: Consolidate dl-origin.c Adhemerval Zanella via Libc-alpha
@ 2022-10-19 22:14 ` Adhemerval Zanella via Libc-alpha
  2022-12-05 16:39   ` Carlos O'Donell via Libc-alpha
  2022-10-19 22:14 ` [PATCH 04/30] Linux: consolidate chown implementation Adhemerval Zanella via Libc-alpha
                   ` (26 subsequent siblings)
  29 siblings, 1 reply; 68+ messages in thread
From: Adhemerval Zanella via Libc-alpha @ 2022-10-19 22:14 UTC (permalink / raw)
  To: libc-alpha

Use chmod syscall if defined, otherwise use fchmodat.

Checked on x86_64-linux-gnu.
---
 sysdeps/unix/sysv/linux/{generic => }/chmod.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
 rename sysdeps/unix/sysv/linux/{generic => }/chmod.c (78%)

diff --git a/sysdeps/unix/sysv/linux/generic/chmod.c b/sysdeps/unix/sysv/linux/chmod.c
similarity index 78%
rename from sysdeps/unix/sysv/linux/generic/chmod.c
rename to sysdeps/unix/sysv/linux/chmod.c
index 98b72c0be1..aedd4c0aed 100644
--- a/sysdeps/unix/sysv/linux/generic/chmod.c
+++ b/sysdeps/unix/sysv/linux/chmod.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2011-2022 Free Software Foundation, Inc.
+/* Change permissions of a file.  Linux version.
+   Copyright (C) 2011-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -16,14 +17,17 @@
    <https://www.gnu.org/licenses/>.  */
 
 #include <fcntl.h>
-#include <sys/types.h>
 #include <sysdep.h>
 
 /* Change the protections of FILE to MODE.  */
 int
 __chmod (const char *file, mode_t mode)
 {
-  return INLINE_SYSCALL (fchmodat, 3, AT_FDCWD, file, mode);
+#ifdef __NR_chmod
+  return INLINE_SYSCALL_CALL (chmod, file, mode);
+#else
+  return INLINE_SYSCALL_CALL (fchmodat, AT_FDCWD, file, mode);
+#endif
 }
 
 libc_hidden_def (__chmod)
-- 
2.34.1


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

* [PATCH 04/30] Linux: consolidate chown implementation
  2022-10-19 22:14 [PATCH 00/30] Remove Linux generic sysdep Adhemerval Zanella via Libc-alpha
                   ` (2 preceding siblings ...)
  2022-10-19 22:14 ` [PATCH 03/30] Linux: consolidate chmod implementation Adhemerval Zanella via Libc-alpha
@ 2022-10-19 22:14 ` Adhemerval Zanella via Libc-alpha
  2022-12-05 16:40   ` Carlos O'Donell via Libc-alpha
  2022-10-19 22:14 ` [PATCH 05/30] Linux: consolidate dup2 implementation Adhemerval Zanella via Libc-alpha
                   ` (25 subsequent siblings)
  29 siblings, 1 reply; 68+ messages in thread
From: Adhemerval Zanella via Libc-alpha @ 2022-10-19 22:14 UTC (permalink / raw)
  To: libc-alpha

Use chown syscall if defined, otherwise use fchownat.

Checked on x86_64-linux-gnu.
---
 sysdeps/unix/sysv/linux/{generic => }/chown.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
 rename sysdeps/unix/sysv/linux/{generic => }/chown.c (77%)

diff --git a/sysdeps/unix/sysv/linux/generic/chown.c b/sysdeps/unix/sysv/linux/chown.c
similarity index 77%
rename from sysdeps/unix/sysv/linux/generic/chown.c
rename to sysdeps/unix/sysv/linux/chown.c
index 53997a1127..c1cd4d6c3d 100644
--- a/sysdeps/unix/sysv/linux/generic/chown.c
+++ b/sysdeps/unix/sysv/linux/chown.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2011-2022 Free Software Foundation, Inc.
+/* Change ownership of a file.  Linux version.
+   Copyright (C) 2011-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -23,7 +24,11 @@
 int
 __chown (const char *file, uid_t owner, gid_t group)
 {
-  return INLINE_SYSCALL (fchownat, 5, AT_FDCWD, file, owner, group, 0);
+#ifdef __NR_chown
+  return INLINE_SYSCALL_CALL (chown, file, owner, groups);
+#else
+  return INLINE_SYSCALL_CALL (fchownat, AT_FDCWD, file, owner, group, 0);
+#endif
 }
 libc_hidden_def (__chown)
 weak_alias (__chown, chown)
-- 
2.34.1


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

* [PATCH 05/30] Linux: consolidate dup2 implementation
  2022-10-19 22:14 [PATCH 00/30] Remove Linux generic sysdep Adhemerval Zanella via Libc-alpha
                   ` (3 preceding siblings ...)
  2022-10-19 22:14 ` [PATCH 04/30] Linux: consolidate chown implementation Adhemerval Zanella via Libc-alpha
@ 2022-10-19 22:14 ` Adhemerval Zanella via Libc-alpha
  2022-12-05 16:40   ` Carlos O'Donell via Libc-alpha
  2022-10-19 22:14 ` [PATCH 06/30] Lninux: consolidate epoll_create implementation Adhemerval Zanella via Libc-alpha
                   ` (24 subsequent siblings)
  29 siblings, 1 reply; 68+ messages in thread
From: Adhemerval Zanella via Libc-alpha @ 2022-10-19 22:14 UTC (permalink / raw)
  To: libc-alpha

Use dup2 syscall if defined, otherwise use dup3.

Checked on x86_64-linux-gnu.
---
 sysdeps/unix/sysv/linux/{generic => }/dup2.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
 rename sysdeps/unix/sysv/linux/{generic => }/dup2.c (83%)

diff --git a/sysdeps/unix/sysv/linux/generic/dup2.c b/sysdeps/unix/sysv/linux/dup2.c
similarity index 83%
rename from sysdeps/unix/sysv/linux/generic/dup2.c
rename to sysdeps/unix/sysv/linux/dup2.c
index 0dc45e9b17..1182780e15 100644
--- a/sysdeps/unix/sysv/linux/generic/dup2.c
+++ b/sysdeps/unix/sysv/linux/dup2.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2011-2022 Free Software Foundation, Inc.
+/* Duplicate a file descriptor.  Linux version.
+   Copyright (C) 2011-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -24,12 +25,16 @@
 int
 __dup2 (int fd, int fd2)
 {
+#ifdef __NR_dup2
+  return INLINE_SYSCALL_CALL (dup2, fd, fd2);
+#else
   /* For the degenerate case, check if the fd is valid (by trying to
      get the file status flags) and return it, or else return EBADF.  */
   if (fd == fd2)
     return __libc_fcntl (fd, F_GETFL, 0) < 0 ? -1 : fd;
 
-  return INLINE_SYSCALL (dup3, 3, fd, fd2, 0);
+  return INLINE_SYSCALL_CALL (dup3, fd, fd2, 0);
+#endif
 }
 libc_hidden_def (__dup2)
 weak_alias (__dup2, dup2)
-- 
2.34.1


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

* [PATCH 06/30] Lninux: consolidate epoll_create implementation
  2022-10-19 22:14 [PATCH 00/30] Remove Linux generic sysdep Adhemerval Zanella via Libc-alpha
                   ` (4 preceding siblings ...)
  2022-10-19 22:14 ` [PATCH 05/30] Linux: consolidate dup2 implementation Adhemerval Zanella via Libc-alpha
@ 2022-10-19 22:14 ` Adhemerval Zanella via Libc-alpha
  2022-10-21  8:57   ` Florian Weimer via Libc-alpha
  2022-12-05 16:40   ` Carlos O'Donell via Libc-alpha
  2022-10-19 22:14 ` [PATCH 07/30] Linux: consolidate inotify_init implementation Adhemerval Zanella via Libc-alpha
                   ` (23 subsequent siblings)
  29 siblings, 2 replies; 68+ messages in thread
From: Adhemerval Zanella via Libc-alpha @ 2022-10-19 22:14 UTC (permalink / raw)
  To: libc-alpha

Use epoll_create syscall if defined, otherwise use epoll_create1.
---
 sysdeps/unix/sysv/linux/{generic => }/epoll_create.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
 rename sysdeps/unix/sysv/linux/{generic => }/epoll_create.c (79%)

diff --git a/sysdeps/unix/sysv/linux/generic/epoll_create.c b/sysdeps/unix/sysv/linux/epoll_create.c
similarity index 79%
rename from sysdeps/unix/sysv/linux/generic/epoll_create.c
rename to sysdeps/unix/sysv/linux/epoll_create.c
index fa28694929..afb1921637 100644
--- a/sysdeps/unix/sysv/linux/generic/epoll_create.c
+++ b/sysdeps/unix/sysv/linux/epoll_create.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2011-2022 Free Software Foundation, Inc.
+/* Open an epoll file descriptor.  Linux version.
+   Copyright (C) 2011-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -23,12 +24,16 @@ libc_hidden_proto (epoll_create)
 int
 epoll_create (int size)
 {
+#ifdef __NR_epoll_create
+  return INLINE_SYSCALL_CALL (epoll_create);
+#else
   if (size <= 0)
     {
       __set_errno (EINVAL);
       return -1;
     }
 
-  return INLINE_SYSCALL (epoll_create1, 1, 0);
+  return INLINE_SYSCALL_CALL (epoll_create1, 0);
+#endif
 }
 libc_hidden_def (epoll_create)
-- 
2.34.1


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

* [PATCH 07/30] Linux: consolidate inotify_init implementation
  2022-10-19 22:14 [PATCH 00/30] Remove Linux generic sysdep Adhemerval Zanella via Libc-alpha
                   ` (5 preceding siblings ...)
  2022-10-19 22:14 ` [PATCH 06/30] Lninux: consolidate epoll_create implementation Adhemerval Zanella via Libc-alpha
@ 2022-10-19 22:14 ` Adhemerval Zanella via Libc-alpha
  2022-12-05 16:40   ` Carlos O'Donell via Libc-alpha
  2022-10-19 22:14 ` [PATCH 08/30] Linux: consolidate lchown implementation Adhemerval Zanella via Libc-alpha
                   ` (22 subsequent siblings)
  29 siblings, 1 reply; 68+ messages in thread
From: Adhemerval Zanella via Libc-alpha @ 2022-10-19 22:14 UTC (permalink / raw)
  To: libc-alpha

Use inotify_init syscall if defined, otherwise use inotify_init1.
---
 sysdeps/unix/sysv/linux/{generic => }/inotify_init.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
 rename sysdeps/unix/sysv/linux/{generic => }/inotify_init.c (78%)

diff --git a/sysdeps/unix/sysv/linux/generic/inotify_init.c b/sysdeps/unix/sysv/linux/inotify_init.c
similarity index 78%
rename from sysdeps/unix/sysv/linux/generic/inotify_init.c
rename to sysdeps/unix/sysv/linux/inotify_init.c
index 3297ebc705..4da5b723a6 100644
--- a/sysdeps/unix/sysv/linux/generic/inotify_init.c
+++ b/sysdeps/unix/sysv/linux/inotify_init.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2011-2022 Free Software Foundation, Inc.
+/* Initialize an inotify instance.  Linux version.
+   Copyright (C) 2011-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -23,6 +24,10 @@ libc_hidden_proto (inotify_init)
 int
 inotify_init (void)
 {
-  return INLINE_SYSCALL (inotify_init1, 1, 0);
+#ifdef __NR_inotify_init
+  return INLINE_SYSCALL_CALL (inotify_init);
+#else
+  return INLINE_SYSCALL_CALL (inotify_init1, 0);
+#endif
 }
 libc_hidden_def (inotify_init)
-- 
2.34.1


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

* [PATCH 08/30] Linux: consolidate lchown implementation
  2022-10-19 22:14 [PATCH 00/30] Remove Linux generic sysdep Adhemerval Zanella via Libc-alpha
                   ` (6 preceding siblings ...)
  2022-10-19 22:14 ` [PATCH 07/30] Linux: consolidate inotify_init implementation Adhemerval Zanella via Libc-alpha
@ 2022-10-19 22:14 ` Adhemerval Zanella via Libc-alpha
  2022-12-05 16:40   ` Carlos O'Donell via Libc-alpha
  2022-10-19 22:14 ` [PATCH 09/30] Linux: consolidate link implementation Adhemerval Zanella via Libc-alpha
                   ` (21 subsequent siblings)
  29 siblings, 1 reply; 68+ messages in thread
From: Adhemerval Zanella via Libc-alpha @ 2022-10-19 22:14 UTC (permalink / raw)
  To: libc-alpha

Use lchown syscall if defined, otherwise use fchownat.

Checked on x86_64-linux-gnu.
---
 sysdeps/unix/sysv/linux/{generic => }/lchown.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
 rename sysdeps/unix/sysv/linux/{generic => }/lchown.c (75%)

diff --git a/sysdeps/unix/sysv/linux/generic/lchown.c b/sysdeps/unix/sysv/linux/lchown.c
similarity index 75%
rename from sysdeps/unix/sysv/linux/generic/lchown.c
rename to sysdeps/unix/sysv/linux/lchown.c
index 996925d799..4888e5f194 100644
--- a/sysdeps/unix/sysv/linux/generic/lchown.c
+++ b/sysdeps/unix/sysv/linux/lchown.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2011-2022 Free Software Foundation, Inc.
+/* Change ownership of a file.  Linux version.
+   Copyright (C) 2011-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -23,7 +24,11 @@
 int
 __lchown (const char *file, uid_t owner, gid_t group)
 {
-  return INLINE_SYSCALL (fchownat, 5, AT_FDCWD, file, owner, group,
-                         AT_SYMLINK_NOFOLLOW);
+#ifdef __NR_lchown
+  return INLINE_SYSCALL_CALL (lchown, file, owner, group);
+#else
+  return INLINE_SYSCALL_CALL (fchownat, AT_FDCWD, file, owner, group,
+			      AT_SYMLINK_NOFOLLOW);
+#endif
 }
 weak_alias (__lchown, lchown)
-- 
2.34.1


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

* [PATCH 09/30] Linux: consolidate link implementation
  2022-10-19 22:14 [PATCH 00/30] Remove Linux generic sysdep Adhemerval Zanella via Libc-alpha
                   ` (7 preceding siblings ...)
  2022-10-19 22:14 ` [PATCH 08/30] Linux: consolidate lchown implementation Adhemerval Zanella via Libc-alpha
@ 2022-10-19 22:14 ` Adhemerval Zanella via Libc-alpha
  2022-12-05 16:39   ` Carlos O'Donell via Libc-alpha
  2022-10-19 22:14 ` [PATCH 10/30] Linux: consolidate mkdir implementation Adhemerval Zanella via Libc-alpha
                   ` (20 subsequent siblings)
  29 siblings, 1 reply; 68+ messages in thread
From: Adhemerval Zanella via Libc-alpha @ 2022-10-19 22:14 UTC (permalink / raw)
  To: libc-alpha

Use link syscall if defined, otherwise use linkat.

Checked on x86_64-linux-gnu.
---
 sysdeps/unix/sysv/linux/{generic => }/link.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
 rename sysdeps/unix/sysv/linux/{generic => }/link.c (78%)

diff --git a/sysdeps/unix/sysv/linux/generic/link.c b/sysdeps/unix/sysv/linux/link.c
similarity index 78%
rename from sysdeps/unix/sysv/linux/generic/link.c
rename to sysdeps/unix/sysv/linux/link.c
index e07655d521..eb4fe1569e 100644
--- a/sysdeps/unix/sysv/linux/generic/link.c
+++ b/sysdeps/unix/sysv/linux/link.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2011-2022 Free Software Foundation, Inc.
+/* Make a new name for a file.  Linux version.
+   Copyright (C) 2011-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -23,7 +24,11 @@
 int
 __link (const char *from, const char *to)
 {
-  return INLINE_SYSCALL (linkat, 5, AT_FDCWD, from, AT_FDCWD, to, 0);
+#ifdef __NR_link
+  return INLINE_SYSCALL_CALL (link, from, to);
+#else
+  return INLINE_SYSCALL_CALL (linkat, AT_FDCWD, from, AT_FDCWD, to, 0);
+#endif
 }
 
 weak_alias (__link, link)
-- 
2.34.1


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

* [PATCH 10/30] Linux: consolidate mkdir implementation
  2022-10-19 22:14 [PATCH 00/30] Remove Linux generic sysdep Adhemerval Zanella via Libc-alpha
                   ` (8 preceding siblings ...)
  2022-10-19 22:14 ` [PATCH 09/30] Linux: consolidate link implementation Adhemerval Zanella via Libc-alpha
@ 2022-10-19 22:14 ` Adhemerval Zanella via Libc-alpha
  2022-12-05 16:40   ` Carlos O'Donell via Libc-alpha
  2022-10-19 22:14 ` [PATCH 11/30] Linux: consolidate readlink implementation Adhemerval Zanella via Libc-alpha
                   ` (19 subsequent siblings)
  29 siblings, 1 reply; 68+ messages in thread
From: Adhemerval Zanella via Libc-alpha @ 2022-10-19 22:14 UTC (permalink / raw)
  To: libc-alpha

Use mkdir syscall if defined, otherwise use mkdirat.

Checked on x86_64-linux-gnu.
---
 sysdeps/unix/sysv/linux/{generic => }/mkdir.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
 rename sysdeps/unix/sysv/linux/{generic => }/mkdir.c (79%)

diff --git a/sysdeps/unix/sysv/linux/generic/mkdir.c b/sysdeps/unix/sysv/linux/mkdir.c
similarity index 79%
rename from sysdeps/unix/sysv/linux/generic/mkdir.c
rename to sysdeps/unix/sysv/linux/mkdir.c
index f64fbd6176..a3653210fb 100644
--- a/sysdeps/unix/sysv/linux/generic/mkdir.c
+++ b/sysdeps/unix/sysv/linux/mkdir.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2011-2022 Free Software Foundation, Inc.
+/* Create a directory.  Linux version.
+   Copyright (C) 2011-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -15,19 +16,19 @@
    License along with the GNU C Library.  If not, see
    <https://www.gnu.org/licenses/>.  */
 
-#include <errno.h>
-#include <stddef.h>
-#include <sysdep.h>
 #include <fcntl.h>
 #include <sys/stat.h>
-#include <sys/types.h>
-
+#include <sysdep.h>
 
 /* Create a directory named PATH with protections MODE.  */
 int
 __mkdir (const char *path, mode_t mode)
 {
-  return INLINE_SYSCALL (mkdirat, 3, AT_FDCWD, path, mode);
+#ifdef __NR_mkdir
+  return INLINE_SYSCALL_CALL (mkdir,  path, mode);
+#else
+  return INLINE_SYSCALL_CALL (mkdirat, AT_FDCWD, path, mode);
+#endif
 }
 
 libc_hidden_def (__mkdir)
-- 
2.34.1


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

* [PATCH 11/30] Linux: consolidate readlink implementation
  2022-10-19 22:14 [PATCH 00/30] Remove Linux generic sysdep Adhemerval Zanella via Libc-alpha
                   ` (9 preceding siblings ...)
  2022-10-19 22:14 ` [PATCH 10/30] Linux: consolidate mkdir implementation Adhemerval Zanella via Libc-alpha
@ 2022-10-19 22:14 ` Adhemerval Zanella via Libc-alpha
  2022-12-05 16:39   ` Carlos O'Donell via Libc-alpha
  2022-10-19 22:14 ` [PATCH 12/30] Linux: consolidate rmdir implementation Adhemerval Zanella via Libc-alpha
                   ` (18 subsequent siblings)
  29 siblings, 1 reply; 68+ messages in thread
From: Adhemerval Zanella via Libc-alpha @ 2022-10-19 22:14 UTC (permalink / raw)
  To: libc-alpha

Use readlink syscall if defined, otherwise readlinkat.

Checked on x86_64-linux-gnu.
---
 sysdeps/unix/sysv/linux/{generic => }/readlink.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
 rename sysdeps/unix/sysv/linux/{generic => }/readlink.c (80%)

diff --git a/sysdeps/unix/sysv/linux/generic/readlink.c b/sysdeps/unix/sysv/linux/readlink.c
similarity index 80%
rename from sysdeps/unix/sysv/linux/generic/readlink.c
rename to sysdeps/unix/sysv/linux/readlink.c
index 9f25811a35..083dcaf502 100644
--- a/sysdeps/unix/sysv/linux/generic/readlink.c
+++ b/sysdeps/unix/sysv/linux/readlink.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2011-2022 Free Software Foundation, Inc.
+/* Read value of a symbolic link.  Linux version.
+   Copyright (C) 2011-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -25,6 +26,10 @@
 ssize_t
 __readlink (const char *path, char *buf, size_t len)
 {
-  return INLINE_SYSCALL (readlinkat, 4, AT_FDCWD, path, buf, len);
+#ifdef __NR_readlink
+  return INLINE_SYSCALL_CALL (readlink, path, buf, len);
+#else
+  return INLINE_SYSCALL_CALL (readlinkat, AT_FDCWD, path, buf, len);
+#endif
 }
 weak_alias (__readlink, readlink)
-- 
2.34.1


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

* [PATCH 12/30] Linux: consolidate rmdir implementation
  2022-10-19 22:14 [PATCH 00/30] Remove Linux generic sysdep Adhemerval Zanella via Libc-alpha
                   ` (10 preceding siblings ...)
  2022-10-19 22:14 ` [PATCH 11/30] Linux: consolidate readlink implementation Adhemerval Zanella via Libc-alpha
@ 2022-10-19 22:14 ` Adhemerval Zanella via Libc-alpha
  2022-12-05 16:39   ` Carlos O'Donell via Libc-alpha
  2022-10-19 22:14 ` [PATCH 13/30] Linux: consolidate symlink implementation Adhemerval Zanella via Libc-alpha
                   ` (17 subsequent siblings)
  29 siblings, 1 reply; 68+ messages in thread
From: Adhemerval Zanella via Libc-alpha @ 2022-10-19 22:14 UTC (permalink / raw)
  To: libc-alpha

Use rmdir syscall if defined, otherwise use unlinkat.

Checked on x86_64-linux-gnu.
---
 sysdeps/unix/sysv/linux/{generic => }/rmdir.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
 rename sysdeps/unix/sysv/linux/{generic => }/rmdir.c (78%)

diff --git a/sysdeps/unix/sysv/linux/generic/rmdir.c b/sysdeps/unix/sysv/linux/rmdir.c
similarity index 78%
rename from sysdeps/unix/sysv/linux/generic/rmdir.c
rename to sysdeps/unix/sysv/linux/rmdir.c
index 214ddc711b..cd5674f07c 100644
--- a/sysdeps/unix/sysv/linux/generic/rmdir.c
+++ b/sysdeps/unix/sysv/linux/rmdir.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2011-2022 Free Software Foundation, Inc.
+/* Delete a directory.  Linux version.
+   Copyright (C) 2011-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -23,6 +24,10 @@
 int
 __rmdir (const char *path)
 {
-  return INLINE_SYSCALL (unlinkat, 3, AT_FDCWD, path, AT_REMOVEDIR);
+#ifdef __NR_rmdir
+  return INLINE_SYSCALL_CALL (rmdir, path);
+#else
+  return INLINE_SYSCALL_CALL (unlinkat, AT_FDCWD, path, AT_REMOVEDIR);
+#endif
 }
 weak_alias (__rmdir, rmdir)
-- 
2.34.1


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

* [PATCH 13/30] Linux: consolidate symlink implementation
  2022-10-19 22:14 [PATCH 00/30] Remove Linux generic sysdep Adhemerval Zanella via Libc-alpha
                   ` (11 preceding siblings ...)
  2022-10-19 22:14 ` [PATCH 12/30] Linux: consolidate rmdir implementation Adhemerval Zanella via Libc-alpha
@ 2022-10-19 22:14 ` Adhemerval Zanella via Libc-alpha
  2022-12-05 16:40   ` Carlos O'Donell via Libc-alpha
  2022-10-19 22:14 ` [PATCH 14/30] Linux: consolidate unlink implementation Adhemerval Zanella via Libc-alpha
                   ` (16 subsequent siblings)
  29 siblings, 1 reply; 68+ messages in thread
From: Adhemerval Zanella via Libc-alpha @ 2022-10-19 22:14 UTC (permalink / raw)
  To: libc-alpha

Use symlink syscall if defined, otherwise use symlinkat.

Checked on x86_64-linux-gnu.
---
 sysdeps/unix/sysv/linux/{generic => }/symlink.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
 rename sysdeps/unix/sysv/linux/{generic => }/symlink.c (78%)

diff --git a/sysdeps/unix/sysv/linux/generic/symlink.c b/sysdeps/unix/sysv/linux/symlink.c
similarity index 78%
rename from sysdeps/unix/sysv/linux/generic/symlink.c
rename to sysdeps/unix/sysv/linux/symlink.c
index 9242f5825e..b336d5ec4c 100644
--- a/sysdeps/unix/sysv/linux/generic/symlink.c
+++ b/sysdeps/unix/sysv/linux/symlink.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2011-2022 Free Software Foundation, Inc.
+/* Make a new name for a file.  Linux version.
+   Copyright (C) 2011-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -23,6 +24,10 @@
 int
 __symlink (const char *from, const char *to)
 {
-  return INLINE_SYSCALL (symlinkat, 3, from, AT_FDCWD, to);
+#ifdef __NR_symlink
+  return INLINE_SYSCALL_CALL (symlink, from, to);
+#else
+  return INLINE_SYSCALL_CALL (symlinkat, from, AT_FDCWD, to);
+#endif
 }
 weak_alias (__symlink, symlink)
-- 
2.34.1


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

* [PATCH 14/30] Linux: consolidate unlink implementation
  2022-10-19 22:14 [PATCH 00/30] Remove Linux generic sysdep Adhemerval Zanella via Libc-alpha
                   ` (12 preceding siblings ...)
  2022-10-19 22:14 ` [PATCH 13/30] Linux: consolidate symlink implementation Adhemerval Zanella via Libc-alpha
@ 2022-10-19 22:14 ` Adhemerval Zanella via Libc-alpha
  2022-12-05 16:40   ` Carlos O'Donell via Libc-alpha
  2022-10-19 22:14 ` [PATCH 15/30] Linux: consolidate sendfile implementation Adhemerval Zanella via Libc-alpha
                   ` (15 subsequent siblings)
  29 siblings, 1 reply; 68+ messages in thread
From: Adhemerval Zanella via Libc-alpha @ 2022-10-19 22:14 UTC (permalink / raw)
  To: libc-alpha

Use unlink syscall if defined, otherwise use unlinkat.

Checked on x86_64-linux-gnu.
---
 sysdeps/unix/sysv/linux/{generic => }/unlink.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
 rename sysdeps/unix/sysv/linux/{generic => }/unlink.c (77%)

diff --git a/sysdeps/unix/sysv/linux/generic/unlink.c b/sysdeps/unix/sysv/linux/unlink.c
similarity index 77%
rename from sysdeps/unix/sysv/linux/generic/unlink.c
rename to sysdeps/unix/sysv/linux/unlink.c
index d2650acacc..e17b0a82d2 100644
--- a/sysdeps/unix/sysv/linux/generic/unlink.c
+++ b/sysdeps/unix/sysv/linux/unlink.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2011-2022 Free Software Foundation, Inc.
+/* Delete a name and possibly the file it refers to.  Linux version.
+   Copyright (C) 2011-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -23,6 +24,10 @@
 int
 __unlink (const char *name)
 {
-  return INLINE_SYSCALL (unlinkat, 3, AT_FDCWD, name, 0);
+#ifdef __NR_unlink
+  return INLINE_SYSCALL_CALL (unlink, name);
+#else
+  return INLINE_SYSCALL_CALL (unlinkat, AT_FDCWD, name, 0);
+#endif
 }
 weak_alias (__unlink, unlink)
-- 
2.34.1


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

* [PATCH 15/30] Linux: consolidate sendfile implementation
  2022-10-19 22:14 [PATCH 00/30] Remove Linux generic sysdep Adhemerval Zanella via Libc-alpha
                   ` (13 preceding siblings ...)
  2022-10-19 22:14 ` [PATCH 14/30] Linux: consolidate unlink implementation Adhemerval Zanella via Libc-alpha
@ 2022-10-19 22:14 ` Adhemerval Zanella via Libc-alpha
  2022-12-05 16:39   ` Carlos O'Donell via Libc-alpha
  2022-10-19 22:14 ` [PATCH 16/30] Linux: Move wordsize-32 Version to default Adhemerval Zanella via Libc-alpha
                   ` (14 subsequent siblings)
  29 siblings, 1 reply; 68+ messages in thread
From: Adhemerval Zanella via Libc-alpha @ 2022-10-19 22:14 UTC (permalink / raw)
  To: libc-alpha

This is similar to other LFS consolidation, where the non-LFS is only
built if __OFF_T_MATCHES_OFF64_T is not defined and the LFS version
is aliased to non-LFS name if __OFF_T_MATCHES_OFF64_T is defined.

For non-LFS variant, use sendfile syscall if defined, otherwise use
sendfile64 plus the offset overflow check (as generic implementation).

Checked on x86_64-linux-gnu.
---
 .../sysv/linux/mips/mips64/n64/sendfile64.c   |  1 -
 .../sysv/linux/mips/mips64/n64/syscalls.list  |  3 --
 .../{generic/wordsize-32 => }/sendfile.c      | 15 ++++++--
 sysdeps/unix/sysv/linux/sendfile64.c          | 37 +++++++++++++++++++
 sysdeps/unix/sysv/linux/syscalls.list         |  2 -
 .../unix/sysv/linux/wordsize-64/sendfile64.c  |  1 -
 .../unix/sysv/linux/wordsize-64/syscalls.list |  1 -
 7 files changed, 49 insertions(+), 11 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/mips/mips64/n64/sendfile64.c
 delete mode 100644 sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list
 rename sysdeps/unix/sysv/linux/{generic/wordsize-32 => }/sendfile.c (77%)
 create mode 100644 sysdeps/unix/sysv/linux/sendfile64.c
 delete mode 100644 sysdeps/unix/sysv/linux/wordsize-64/sendfile64.c

diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/sendfile64.c b/sysdeps/unix/sysv/linux/mips/mips64/n64/sendfile64.c
deleted file mode 100644
index 4c451bd093..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/sendfile64.c
+++ /dev/null
@@ -1 +0,0 @@
-/* sendfile64 is alias of sendfile syscall.  */
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list
deleted file mode 100644
index 0924f245d4..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list
+++ /dev/null
@@ -1,3 +0,0 @@
-# File name	Caller	Syscall name	# args	Strong name	Weak names
-
-sendfile	-	sendfile	i:iipi	sendfile	sendfile64
diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/sendfile.c b/sysdeps/unix/sysv/linux/sendfile.c
similarity index 77%
rename from sysdeps/unix/sysv/linux/generic/wordsize-32/sendfile.c
rename to sysdeps/unix/sysv/linux/sendfile.c
index 4fdf979324..c8bc890944 100644
--- a/sysdeps/unix/sysv/linux/generic/wordsize-32/sendfile.c
+++ b/sysdeps/unix/sysv/linux/sendfile.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2011-2022 Free Software Foundation, Inc.
+/* Transfer data between file descriptors.  Linux version.
+   Copyright (C) 2011-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -20,11 +21,16 @@
 #include <errno.h>
 #include <sysdep.h>
 
+#ifndef __OFF_T_MATCHES_OFF64_T
+
 /* Send COUNT bytes from file associated with IN_FD starting at OFFSET to
    descriptor OUT_FD.  */
 ssize_t
 sendfile (int out_fd, int in_fd, off_t *offset, size_t count)
 {
+# ifdef __NR_sendfile
+  return INLINE_SYSCALL_CALL (sendfile, out_fd, in_fd, offset, count);
+# else
   __off64_t off64;
   int rc;
 
@@ -38,9 +44,12 @@ sendfile (int out_fd, int in_fd, off_t *offset, size_t count)
       off64 = *offset;
     }
 
-  rc = INLINE_SYSCALL (sendfile64, 4, out_fd, in_fd,
-                       offset ? &off64 : NULL, count);
+  rc = INLINE_SYSCALL_CALL (sendfile64, out_fd, in_fd, offset ? &off64 : NULL,
+			    count);
   if (offset)
     *offset = off64;
   return rc;
+# endif
 }
+
+#endif
diff --git a/sysdeps/unix/sysv/linux/sendfile64.c b/sysdeps/unix/sysv/linux/sendfile64.c
new file mode 100644
index 0000000000..d9d2a4a4c2
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sendfile64.c
@@ -0,0 +1,37 @@
+/* Transfer data between file descriptors.  Linux version.
+   Copyright (C) 2022 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <sys/sendfile.h>
+#include <stddef.h>
+#include <errno.h>
+#include <sysdep.h>
+
+/* Send COUNT bytes from file associated with IN_FD starting at OFFSET to
+   descriptor OUT_FD.  */
+ssize_t
+sendfile64 (int out_fd, int in_fd, off64_t *offset, size_t count)
+{
+#ifndef __NR_sendfile64
+# define __NR_sendfile64 __NR_sendfile
+#endif
+  return INLINE_SYSCALL_CALL (sendfile64, out_fd, in_fd, offset, count);
+}
+
+#ifdef __OFF_T_MATCHES_OFF64_T
+strong_alias (sendfile64, sendfile)
+#endif
diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
index 6420049e8b..b9f45463c5 100644
--- a/sysdeps/unix/sysv/linux/syscalls.list
+++ b/sysdeps/unix/sysv/linux/syscalls.list
@@ -62,8 +62,6 @@ sched_primin	-	sched_get_priority_min	i:i	__sched_get_priority_min	sched_get_pri
 sched_setp	-	sched_setparam	i:ip	__sched_setparam	sched_setparam
 sched_sets	-	sched_setscheduler	i:iip	__sched_setscheduler	sched_setscheduler
 sched_yield	-	sched_yield	i:	__sched_yield	sched_yield
-sendfile	-	sendfile	i:iipU	sendfile
-sendfile64	-	sendfile64	i:iipU	sendfile64
 setfsgid	EXTRA	setfsgid	i:i	setfsgid
 setfsuid	EXTRA	setfsuid	i:i	setfsuid
 setpgid		-	setpgid		i:ii	__setpgid	setpgid
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/sendfile64.c b/sysdeps/unix/sysv/linux/wordsize-64/sendfile64.c
deleted file mode 100644
index 4c451bd093..0000000000
--- a/sysdeps/unix/sysv/linux/wordsize-64/sendfile64.c
+++ /dev/null
@@ -1 +0,0 @@
-/* sendfile64 is alias of sendfile syscall.  */
diff --git a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
index 3232f11f51..db80696e41 100644
--- a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
+++ b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
@@ -1,4 +1,3 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
-sendfile	-	sendfile	i:iipi	sendfile	sendfile64
 personality	EXTRA	personality	i:i	__personality	personality
-- 
2.34.1


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

* [PATCH 16/30] Linux: Move wordsize-32 Version to default
  2022-10-19 22:14 [PATCH 00/30] Remove Linux generic sysdep Adhemerval Zanella via Libc-alpha
                   ` (14 preceding siblings ...)
  2022-10-19 22:14 ` [PATCH 15/30] Linux: consolidate sendfile implementation Adhemerval Zanella via Libc-alpha
@ 2022-10-19 22:14 ` Adhemerval Zanella via Libc-alpha
  2022-12-05 16:40   ` Carlos O'Donell via Libc-alpha
  2022-10-19 22:14 ` [PATCH 17/30] Linux: consolidate ____longjmp_chk Adhemerval Zanella via Libc-alpha
                   ` (13 subsequent siblings)
  29 siblings, 1 reply; 68+ messages in thread
From: Adhemerval Zanella via Libc-alpha @ 2022-10-19 22:14 UTC (permalink / raw)
  To: libc-alpha

And remove redundant entries on other architectures Version.
---
 sysdeps/unix/sysv/linux/Versions                     | 3 +++
 sysdeps/unix/sysv/linux/arm/Versions                 | 3 ---
 sysdeps/unix/sysv/linux/generic/wordsize-32/Versions | 5 -----
 sysdeps/unix/sysv/linux/hppa/Versions                | 3 ---
 sysdeps/unix/sysv/linux/i386/Versions                | 4 ----
 sysdeps/unix/sysv/linux/m68k/Versions                | 3 ---
 sysdeps/unix/sysv/linux/microblaze/Versions          | 5 -----
 sysdeps/unix/sysv/linux/mips/Versions                | 3 ---
 sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions   | 3 ---
 sysdeps/unix/sysv/linux/s390/s390-32/Versions        | 3 ---
 sysdeps/unix/sysv/linux/sh/Versions                  | 3 ---
 sysdeps/unix/sysv/linux/sparc/sparc32/Versions       | 3 ---
 12 files changed, 3 insertions(+), 38 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/generic/wordsize-32/Versions
 delete mode 100644 sysdeps/unix/sysv/linux/microblaze/Versions

diff --git a/sysdeps/unix/sysv/linux/Versions b/sysdeps/unix/sysv/linux/Versions
index 65d2ceda2c..59c39739c7 100644
--- a/sysdeps/unix/sysv/linux/Versions
+++ b/sysdeps/unix/sysv/linux/Versions
@@ -157,6 +157,9 @@ libc {
   GLIBC_2.10 {
     fallocate;
   }
+  GLIBC_2.11 {
+    fallocate64;
+  }
   GLIBC_2.12 {
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
 
diff --git a/sysdeps/unix/sysv/linux/arm/Versions b/sysdeps/unix/sysv/linux/arm/Versions
index 7e5ba53455..6e7cb6e2e5 100644
--- a/sysdeps/unix/sysv/linux/arm/Versions
+++ b/sysdeps/unix/sysv/linux/arm/Versions
@@ -4,9 +4,6 @@ libc {
     inb; inw; inl;
     outb; outw; outl;
   }
-  GLIBC_2.11 {
-    fallocate64;
-  }
   GLIBC_2.24 {
     recvmsg; sendmsg;
   }
diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/Versions b/sysdeps/unix/sysv/linux/generic/wordsize-32/Versions
deleted file mode 100644
index cdc6022015..0000000000
--- a/sysdeps/unix/sysv/linux/generic/wordsize-32/Versions
+++ /dev/null
@@ -1,5 +0,0 @@
-libc {
-  GLIBC_2.15 {
-    fallocate64;
-  }
-}
diff --git a/sysdeps/unix/sysv/linux/hppa/Versions b/sysdeps/unix/sysv/linux/hppa/Versions
index 357c68a782..78528e5fa2 100644
--- a/sysdeps/unix/sysv/linux/hppa/Versions
+++ b/sysdeps/unix/sysv/linux/hppa/Versions
@@ -13,9 +13,6 @@ libc {
   GLIBC_2.4 {
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
   }
-  GLIBC_2.11 {
-    fallocate64;
-  }
   GLIBC_2.12 {
     _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
   }
diff --git a/sysdeps/unix/sysv/linux/i386/Versions b/sysdeps/unix/sysv/linux/i386/Versions
index 1335e6551b..f99a4d88d0 100644
--- a/sysdeps/unix/sysv/linux/i386/Versions
+++ b/sysdeps/unix/sysv/linux/i386/Versions
@@ -37,10 +37,6 @@ libc {
     # v*
     vm86;
   }
-  GLIBC_2.11 {
-    # f*
-    fallocate64;
-  }
   GLIBC_PRIVATE {
     __modify_ldt; __uname;
   }
diff --git a/sysdeps/unix/sysv/linux/m68k/Versions b/sysdeps/unix/sysv/linux/m68k/Versions
index d98ae120c1..a77ea60338 100644
--- a/sysdeps/unix/sysv/linux/m68k/Versions
+++ b/sysdeps/unix/sysv/linux/m68k/Versions
@@ -29,9 +29,6 @@ libc {
     # v*
     versionsort64;
   }
-  GLIBC_2.11 {
-    fallocate64;
-  }
   GLIBC_2.31 {
     msgctl; semctl; shmctl;
   }
diff --git a/sysdeps/unix/sysv/linux/microblaze/Versions b/sysdeps/unix/sysv/linux/microblaze/Versions
deleted file mode 100644
index aa48a3c155..0000000000
--- a/sysdeps/unix/sysv/linux/microblaze/Versions
+++ /dev/null
@@ -1,5 +0,0 @@
-libc {
-  GLIBC_2.18 {
-    fallocate64;
-  }
-}
diff --git a/sysdeps/unix/sysv/linux/mips/Versions b/sysdeps/unix/sysv/linux/mips/Versions
index db6222e9a7..9ea0fa65a4 100644
--- a/sysdeps/unix/sysv/linux/mips/Versions
+++ b/sysdeps/unix/sysv/linux/mips/Versions
@@ -26,9 +26,6 @@ libc {
     pthread_attr_setstack;
     pthread_attr_setstacksize;
   }
-  GLIBC_2.11 {
-    fallocate64;
-  }
   GLIBC_PRIVATE {
     # nptl/pthread_cond_timedwait.c uses INTERNAL_VSYSCALL(clock_gettime).
     __vdso_clock_gettime;
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions b/sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions
index 918e0231d0..416e8db5ae 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions
@@ -31,9 +31,6 @@ libc {
     siglongjmp;
     swapcontext;
   }
-  GLIBC_2.11 {
-    fallocate64;
-  }
   GLIBC_2.17 {
     __ppc_get_timebase_freq;
   }
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/Versions b/sysdeps/unix/sysv/linux/s390/s390-32/Versions
index bd1a46df88..1b96fc42a3 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/Versions
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/Versions
@@ -44,9 +44,6 @@ libc {
     getutmpx;
     login;
   }
-  GLIBC_2.11 {
-    fallocate64;
-  }
   GLIBC_2.31 {
     msgctl; semctl; shmctl;
   }
diff --git a/sysdeps/unix/sysv/linux/sh/Versions b/sysdeps/unix/sysv/linux/sh/Versions
index 9c734ff755..3ad702e165 100644
--- a/sysdeps/unix/sysv/linux/sh/Versions
+++ b/sysdeps/unix/sysv/linux/sh/Versions
@@ -22,9 +22,6 @@ libc {
     # v*
     versionsort64;
   }
-  GLIBC_2.11 {
-    fallocate64;
-  }
   GLIBC_2.16 {
     fanotify_mark;
   }
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/Versions b/sysdeps/unix/sysv/linux/sparc/sparc32/Versions
index d928a65346..4529e7fe6f 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/Versions
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/Versions
@@ -17,7 +17,4 @@ libc {
     # s*
     scandir64;
   }
-  GLIBC_2.11 {
-    fallocate64;
-  }
 }
-- 
2.34.1


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

* [PATCH 17/30] Linux: consolidate ____longjmp_chk
  2022-10-19 22:14 [PATCH 00/30] Remove Linux generic sysdep Adhemerval Zanella via Libc-alpha
                   ` (15 preceding siblings ...)
  2022-10-19 22:14 ` [PATCH 16/30] Linux: Move wordsize-32 Version to default Adhemerval Zanella via Libc-alpha
@ 2022-10-19 22:14 ` Adhemerval Zanella via Libc-alpha
  2022-12-05 16:40   ` Carlos O'Donell via Libc-alpha
  2022-10-19 22:14 ` [PATCH 18/30] Linux: Assume and consolidate bind wire-up syscall Adhemerval Zanella via Libc-alpha
                   ` (12 subsequent siblings)
  29 siblings, 1 reply; 68+ messages in thread
From: Adhemerval Zanella via Libc-alpha @ 2022-10-19 22:14 UTC (permalink / raw)
  To: libc-alpha

Checked on x86_64-linux-gnu.
---
 sysdeps/unix/sysv/linux/{generic => }/____longjmp_chk.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
 rename sysdeps/unix/sysv/linux/{generic => }/____longjmp_chk.c (90%)

diff --git a/sysdeps/unix/sysv/linux/generic/____longjmp_chk.c b/sysdeps/unix/sysv/linux/____longjmp_chk.c
similarity index 90%
rename from sysdeps/unix/sysv/linux/generic/____longjmp_chk.c
rename to sysdeps/unix/sysv/linux/____longjmp_chk.c
index aac1158853..687cb27133 100644
--- a/sysdeps/unix/sysv/linux/generic/____longjmp_chk.c
+++ b/sysdeps/unix/sysv/linux/____longjmp_chk.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2011-2022 Free Software Foundation, Inc.
+/* longjmp fortify implementation.  Linux version.
+   Copyright (C) 2011-2022 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -28,8 +29,7 @@
 #define called_from(this, saved) ((this) > (saved))
 #endif
 
-extern void ____longjmp_chk (__jmp_buf __env, int __val)
-  __attribute__ ((__noreturn__));
+_Noreturn extern void ____longjmp_chk (__jmp_buf __env, int __val);
 
 void ____longjmp_chk (__jmp_buf env, int val)
 {
-- 
2.34.1


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

* [PATCH 18/30] Linux: Assume and consolidate bind wire-up syscall
  2022-10-19 22:14 [PATCH 00/30] Remove Linux generic sysdep Adhemerval Zanella via Libc-alpha
                   ` (16 preceding siblings ...)
  2022-10-19 22:14 ` [PATCH 17/30] Linux: consolidate ____longjmp_chk Adhemerval Zanella via Libc-alpha
@ 2022-10-19 22:14 ` Adhemerval Zanella via Libc-alpha
  2022-12-05 16:39   ` Carlos O'Donell via Libc-alpha
  2022-10-19 22:14 ` [PATCH 19/30] Linux: Assume iand consolidate socket " Adhemerval Zanella via Libc-alpha
                   ` (11 subsequent siblings)
  29 siblings, 1 reply; 68+ messages in thread
From: Adhemerval Zanella via Libc-alpha @ 2022-10-19 22:14 UTC (permalink / raw)
  To: libc-alpha

And disable if kernel does not support it.

Checked on x86_64-linux-gnu and i686-linux-gnu.
---
 sysdeps/unix/sysv/linux/bind.c                       | 7 +------
 sysdeps/unix/sysv/linux/generic/syscalls.list        | 1 -
 sysdeps/unix/sysv/linux/i386/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/kernel-features.h            | 1 +
 sysdeps/unix/sysv/linux/m68k/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/microblaze/kernel-features.h | 1 -
 sysdeps/unix/sysv/linux/powerpc/kernel-features.h    | 1 -
 sysdeps/unix/sysv/linux/s390/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/sh/kernel-features.h         | 1 -
 sysdeps/unix/sysv/linux/sparc/kernel-features.h      | 5 ++++-
 10 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/bind.c b/sysdeps/unix/sysv/linux/bind.c
index 83992a5dbd..97a42c497f 100644
--- a/sysdeps/unix/sysv/linux/bind.c
+++ b/sysdeps/unix/sysv/linux/bind.c
@@ -15,19 +15,14 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-#include <errno.h>
-#include <signal.h>
 #include <sys/socket.h>
-
 #include <socketcall.h>
-#include <kernel-features.h>
-#include <sys/syscall.h>
 
 int
 __bind (int fd, __CONST_SOCKADDR_ARG addr, socklen_t len)
 {
 #ifdef __ASSUME_BIND_SYSCALL
-  return INLINE_SYSCALL (bind, 3, fd, addr.__sockaddr__, len);
+  return INLINE_SYSCALL_CALL (bind, fd, addr.__sockaddr__, len);
 #else
   return SOCKETCALL (bind, fd, addr.__sockaddr__, len, 0, 0, 0);
 #endif
diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index f573f27c8b..889b62bbea 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -3,7 +3,6 @@
 # Socket APIs
 socket		-	socket		i:iii	__socket	socket
 socketpair	-	socketpair	i:iiif	__socketpair	socketpair
-bind		-	bind		i:ipi	__bind		bind
 listen		-	listen		i:ii	__listen	listen
 getsockname	-	getsockname	i:ipp	__getsockname	getsockname
 getpeername	-	getpeername	i:ipp	__getpeername	getpeername
diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
index 87d610cd66..babb0ff83d 100644
--- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
@@ -21,7 +21,6 @@
 #if __LINUX_KERNEL_VERSION >= 0x040300
 # define __ASSUME_SOCKET_SYSCALL             1
 # define __ASSUME_SOCKETPAIR_SYSCALL         1
-# define __ASSUME_BIND_SYSCALL               1
 # define __ASSUME_LISTEN_SYSCALL             1
 # define __ASSUME_GETSOCKNAME_SYSCALL        1
 # define __ASSUME_GETPEERNAME_SYSCALL        1
@@ -41,6 +40,7 @@
 # undef __ASSUME_SENDTO_SYSCALL
 # undef __ASSUME_GETSOCKOPT_SYSCALL
 # undef __ASSUME_SETSOCKOPT_SYSCALL
+# undef __ASSUME_BIND_SYSCALL
 #endif
 
 /* i686 only supports ipc syscall before 5.1.  */
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index 74adc3956b..3dc93f5b11 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -79,6 +79,7 @@
 #define __ASSUME_SENDMMSG_SYSCALL	1
 #define __ASSUME_GETSOCKOPT_SYSCALL	1
 #define __ASSUME_SETSOCKOPT_SYSCALL	1
+#define __ASSUME_BIND_SYSCALL		1
 
 /* Support for SysV IPC through wired syscalls.  All supported architectures
    either support ipc syscall and/or all the ipc correspondent syscalls.  */
diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
index d807ac9cfd..37209378b9 100644
--- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -21,7 +21,6 @@
 #if __LINUX_KERNEL_VERSION >= 0x040300
 # define __ASSUME_SOCKET_SYSCALL             1
 # define __ASSUME_SOCKETPAIR_SYSCALL         1
-# define __ASSUME_BIND_SYSCALL               1
 # define __ASSUME_LISTEN_SYSCALL             1
 # define __ASSUME_GETSOCKNAME_SYSCALL        1
 # define __ASSUME_GETPEERNAME_SYSCALL        1
@@ -43,6 +42,7 @@
 # undef __ASSUME_SENDTO_SYSCALL
 # undef __ASSUME_GETSOCKOPT_SYSCALL
 # undef __ASSUME_SETSOCKOPT_SYSCALL
+# undef __ASSUME_BIND_SYSCALL
 #endif
 
 /* No support for PI futexes or robust mutexes before 3.10 for m68k.  */
diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
index 8ae3cdcd96..7fff6dd902 100644
--- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
@@ -19,7 +19,6 @@
 
 /* All supported kernel versions for MicroBlaze have these syscalls.  */
 #define __ASSUME_SOCKET_SYSCALL		1
-#define __ASSUME_BIND_SYSCALL		1
 #define __ASSUME_CONNECT_SYSCALL	1
 #define __ASSUME_LISTEN_SYSCALL		1
 #define __ASSUME_GETSOCKNAME_SYSCALL	1
diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
index 894f29d381..af4555bb1d 100644
--- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
@@ -19,7 +19,6 @@
 
 /* New syscalls added for PowerPC in 2.6.37.  */
 #define __ASSUME_SOCKET_SYSCALL	1
-#define __ASSUME_BIND_SYSCALL		1
 #define __ASSUME_CONNECT_SYSCALL	1
 #define __ASSUME_LISTEN_SYSCALL		1
 #define __ASSUME_GETSOCKNAME_SYSCALL	1
diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
index a457c84ba1..ae8dc626b2 100644
--- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
@@ -21,7 +21,6 @@
 #if __LINUX_KERNEL_VERSION >= 0x040300
 # define __ASSUME_SOCKET_SYSCALL             1
 # define __ASSUME_SOCKETPAIR_SYSCALL         1
-# define __ASSUME_BIND_SYSCALL               1
 # define __ASSUME_LISTEN_SYSCALL             1
 # define __ASSUME_GETSOCKNAME_SYSCALL        1
 # define __ASSUME_GETPEERNAME_SYSCALL        1
@@ -43,6 +42,7 @@
 # undef __ASSUME_SENDTO_SYSCALL
 # undef __ASSUME_GETSOCKOPT_SYSCALL
 # undef __ASSUME_SETSOCKOPT_SYSCALL
+# undef __ASSUME_BIND_SYSCALL
 #endif
 
 /* s390 only supports ipc syscall before 5.1.  */
diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
index 545bef40fd..2883da92b2 100644
--- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
@@ -24,7 +24,6 @@
 
 /* These syscalls were added for SH in 2.6.37.  */
 #define __ASSUME_SOCKET_SYSCALL		1
-#define __ASSUME_BIND_SYSCALL		1
 #define __ASSUME_CONNECT_SYSCALL	1
 #define __ASSUME_LISTEN_SYSCALL		1
 #define __ASSUME_GETSOCKNAME_SYSCALL	1
diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
index 6cbe189b2f..2b7056c0fb 100644
--- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
@@ -48,10 +48,13 @@
 
 /* These syscalls were added for both 32-bit and 64-bit in 4.4.  */
 #if __LINUX_KERNEL_VERSION >= 0x040400
-# define __ASSUME_BIND_SYSCALL               1
 # define __ASSUME_LISTEN_SYSCALL             1
 #endif
 
+#if __LINUX_KERNEL_VERSION < 0x040400
+# undef __ASSUME_BIND_SYSCALL
+#endif
+
 #ifdef __arch64__
 /* sparc64 defines __NR_pause,  however it is not supported (ENOSYS).
    Undefine so pause.c can use a correct alternative.  */
-- 
2.34.1


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

* [PATCH 19/30] Linux: Assume iand consolidate socket wire-up syscall
  2022-10-19 22:14 [PATCH 00/30] Remove Linux generic sysdep Adhemerval Zanella via Libc-alpha
                   ` (17 preceding siblings ...)
  2022-10-19 22:14 ` [PATCH 18/30] Linux: Assume and consolidate bind wire-up syscall Adhemerval Zanella via Libc-alpha
@ 2022-10-19 22:14 ` Adhemerval Zanella via Libc-alpha
  2022-12-05 16:39   ` Carlos O'Donell via Libc-alpha
  2022-10-19 22:14 ` [PATCH 20/30] Linux: Assume and consolidate socketpair " Adhemerval Zanella via Libc-alpha
                   ` (10 subsequent siblings)
  29 siblings, 1 reply; 68+ messages in thread
From: Adhemerval Zanella via Libc-alpha @ 2022-10-19 22:14 UTC (permalink / raw)
  To: libc-alpha

And disable if kernel does not support it.

Checked on x86_64-linux-gnu and i686-linux-gnu.
---
 sysdeps/unix/sysv/linux/generic/syscalls.list        | 1 -
 sysdeps/unix/sysv/linux/i386/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/kernel-features.h            | 1 +
 sysdeps/unix/sysv/linux/m68k/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/microblaze/kernel-features.h | 1 -
 sysdeps/unix/sysv/linux/powerpc/kernel-features.h    | 1 -
 sysdeps/unix/sysv/linux/s390/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/sh/kernel-features.h         | 1 -
 sysdeps/unix/sysv/linux/socket.c                     | 7 +------
 sysdeps/unix/sysv/linux/sparc/kernel-features.h      | 1 -
 10 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index 889b62bbea..e5a62811a5 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -1,7 +1,6 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
 # Socket APIs
-socket		-	socket		i:iii	__socket	socket
 socketpair	-	socketpair	i:iiif	__socketpair	socketpair
 listen		-	listen		i:ii	__listen	listen
 getsockname	-	getsockname	i:ipp	__getsockname	getsockname
diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
index babb0ff83d..4c2f1eb8f5 100644
--- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
@@ -19,7 +19,6 @@
 
 /* Direct socketcalls available with kernel 4.3.  */
 #if __LINUX_KERNEL_VERSION >= 0x040300
-# define __ASSUME_SOCKET_SYSCALL             1
 # define __ASSUME_SOCKETPAIR_SYSCALL         1
 # define __ASSUME_LISTEN_SYSCALL             1
 # define __ASSUME_GETSOCKNAME_SYSCALL        1
@@ -41,6 +40,7 @@
 # undef __ASSUME_GETSOCKOPT_SYSCALL
 # undef __ASSUME_SETSOCKOPT_SYSCALL
 # undef __ASSUME_BIND_SYSCALL
+# undef __ASSUME_SOCKET_SYSCALL
 #endif
 
 /* i686 only supports ipc syscall before 5.1.  */
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index 3dc93f5b11..a42b70c85b 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -80,6 +80,7 @@
 #define __ASSUME_GETSOCKOPT_SYSCALL	1
 #define __ASSUME_SETSOCKOPT_SYSCALL	1
 #define __ASSUME_BIND_SYSCALL		1
+#define __ASSUME_SOCKET_SYSCALL		1
 
 /* Support for SysV IPC through wired syscalls.  All supported architectures
    either support ipc syscall and/or all the ipc correspondent syscalls.  */
diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
index 37209378b9..38ffbdbaed 100644
--- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -19,7 +19,6 @@
 
 /* Direct socketcalls available with kernel 4.3.  */
 #if __LINUX_KERNEL_VERSION >= 0x040300
-# define __ASSUME_SOCKET_SYSCALL             1
 # define __ASSUME_SOCKETPAIR_SYSCALL         1
 # define __ASSUME_LISTEN_SYSCALL             1
 # define __ASSUME_GETSOCKNAME_SYSCALL        1
@@ -43,6 +42,7 @@
 # undef __ASSUME_GETSOCKOPT_SYSCALL
 # undef __ASSUME_SETSOCKOPT_SYSCALL
 # undef __ASSUME_BIND_SYSCALL
+# undef __ASSUME_SOCKET_SYSCALL
 #endif
 
 /* No support for PI futexes or robust mutexes before 3.10 for m68k.  */
diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
index 7fff6dd902..389dd146b4 100644
--- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
@@ -18,7 +18,6 @@
 #include <endian.h>
 
 /* All supported kernel versions for MicroBlaze have these syscalls.  */
-#define __ASSUME_SOCKET_SYSCALL		1
 #define __ASSUME_CONNECT_SYSCALL	1
 #define __ASSUME_LISTEN_SYSCALL		1
 #define __ASSUME_GETSOCKNAME_SYSCALL	1
diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
index af4555bb1d..9ee1dc2bc7 100644
--- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
@@ -18,7 +18,6 @@
    <https://www.gnu.org/licenses/>.  */
 
 /* New syscalls added for PowerPC in 2.6.37.  */
-#define __ASSUME_SOCKET_SYSCALL	1
 #define __ASSUME_CONNECT_SYSCALL	1
 #define __ASSUME_LISTEN_SYSCALL		1
 #define __ASSUME_GETSOCKNAME_SYSCALL	1
diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
index ae8dc626b2..d5991b265b 100644
--- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
@@ -19,7 +19,6 @@
 
 /* Direct socketcalls available with kernel 4.3.  */
 #if __LINUX_KERNEL_VERSION >= 0x040300
-# define __ASSUME_SOCKET_SYSCALL             1
 # define __ASSUME_SOCKETPAIR_SYSCALL         1
 # define __ASSUME_LISTEN_SYSCALL             1
 # define __ASSUME_GETSOCKNAME_SYSCALL        1
@@ -43,6 +42,7 @@
 # undef __ASSUME_GETSOCKOPT_SYSCALL
 # undef __ASSUME_SETSOCKOPT_SYSCALL
 # undef __ASSUME_BIND_SYSCALL
+# undef __ASSUME_SOCKET_SYSCALL
 #endif
 
 /* s390 only supports ipc syscall before 5.1.  */
diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
index 2883da92b2..3b57eb7f27 100644
--- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
@@ -23,7 +23,6 @@
 #include <endian.h>
 
 /* These syscalls were added for SH in 2.6.37.  */
-#define __ASSUME_SOCKET_SYSCALL		1
 #define __ASSUME_CONNECT_SYSCALL	1
 #define __ASSUME_LISTEN_SYSCALL		1
 #define __ASSUME_GETSOCKNAME_SYSCALL	1
diff --git a/sysdeps/unix/sysv/linux/socket.c b/sysdeps/unix/sysv/linux/socket.c
index 0fc7a61d06..0258fff872 100644
--- a/sysdeps/unix/sysv/linux/socket.c
+++ b/sysdeps/unix/sysv/linux/socket.c
@@ -15,19 +15,14 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-#include <errno.h>
-#include <signal.h>
 #include <sys/socket.h>
-
 #include <socketcall.h>
-#include <kernel-features.h>
-#include <sys/syscall.h>
 
 int
 __socket (int fd, int type, int domain)
 {
 #ifdef __ASSUME_SOCKET_SYSCALL
-  return INLINE_SYSCALL (socket, 3, fd, type, domain);
+  return INLINE_SYSCALL_CALL (socket, fd, type, domain);
 #else
   return SOCKETCALL (socket, fd, type, domain);
 #endif
diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
index 2b7056c0fb..f3a5ef6a99 100644
--- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
@@ -41,7 +41,6 @@
 # undef __ASSUME_GETSOCKOPT_SYSCALL
 # undef __ASSUME_SETSOCKOPT_SYSCALL
 #else
-# define __ASSUME_SOCKET_SYSCALL             1
 # define __ASSUME_SOCKETPAIR_SYSCALL         1
 # define __ASSUME_SHUTDOWN_SYSCALL           1
 #endif
-- 
2.34.1


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

* [PATCH 20/30] Linux: Assume and consolidate socketpair wire-up syscall
  2022-10-19 22:14 [PATCH 00/30] Remove Linux generic sysdep Adhemerval Zanella via Libc-alpha
                   ` (18 preceding siblings ...)
  2022-10-19 22:14 ` [PATCH 19/30] Linux: Assume iand consolidate socket " Adhemerval Zanella via Libc-alpha
@ 2022-10-19 22:14 ` Adhemerval Zanella via Libc-alpha
  2022-12-06 16:15   ` Carlos O'Donell via Libc-alpha
  2022-10-19 22:14 ` [PATCH 21/30] Linux: Assume and consolidate listen " Adhemerval Zanella via Libc-alpha
                   ` (9 subsequent siblings)
  29 siblings, 1 reply; 68+ messages in thread
From: Adhemerval Zanella via Libc-alpha @ 2022-10-19 22:14 UTC (permalink / raw)
  To: libc-alpha

And disable if kernel does not support it.

Checked on x86_64-linux-gnu and i686-linux-gnu.
---
 sysdeps/unix/sysv/linux/generic/syscalls.list        | 1 -
 sysdeps/unix/sysv/linux/i386/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/kernel-features.h            | 1 +
 sysdeps/unix/sysv/linux/m68k/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/microblaze/kernel-features.h | 1 -
 sysdeps/unix/sysv/linux/powerpc/kernel-features.h    | 1 -
 sysdeps/unix/sysv/linux/s390/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/sh/kernel-features.h         | 1 -
 sysdeps/unix/sysv/linux/socketpair.c                 | 7 +------
 sysdeps/unix/sysv/linux/sparc/kernel-features.h      | 1 -
 10 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index e5a62811a5..95ed2cbac8 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -1,7 +1,6 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
 # Socket APIs
-socketpair	-	socketpair	i:iiif	__socketpair	socketpair
 listen		-	listen		i:ii	__listen	listen
 getsockname	-	getsockname	i:ipp	__getsockname	getsockname
 getpeername	-	getpeername	i:ipp	__getpeername	getpeername
diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
index 4c2f1eb8f5..8a7fe47602 100644
--- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
@@ -19,7 +19,6 @@
 
 /* Direct socketcalls available with kernel 4.3.  */
 #if __LINUX_KERNEL_VERSION >= 0x040300
-# define __ASSUME_SOCKETPAIR_SYSCALL         1
 # define __ASSUME_LISTEN_SYSCALL             1
 # define __ASSUME_GETSOCKNAME_SYSCALL        1
 # define __ASSUME_GETPEERNAME_SYSCALL        1
@@ -41,6 +40,7 @@
 # undef __ASSUME_SETSOCKOPT_SYSCALL
 # undef __ASSUME_BIND_SYSCALL
 # undef __ASSUME_SOCKET_SYSCALL
+# undef __ASSUME_SOCKETPAIR_SYSCALL
 #endif
 
 /* i686 only supports ipc syscall before 5.1.  */
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index a42b70c85b..fd44b39cf4 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -81,6 +81,7 @@
 #define __ASSUME_SETSOCKOPT_SYSCALL	1
 #define __ASSUME_BIND_SYSCALL		1
 #define __ASSUME_SOCKET_SYSCALL		1
+#define __ASSUME_SOCKETPAIR_SYSCALL	1
 
 /* Support for SysV IPC through wired syscalls.  All supported architectures
    either support ipc syscall and/or all the ipc correspondent syscalls.  */
diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
index 38ffbdbaed..46b3045b56 100644
--- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -19,7 +19,6 @@
 
 /* Direct socketcalls available with kernel 4.3.  */
 #if __LINUX_KERNEL_VERSION >= 0x040300
-# define __ASSUME_SOCKETPAIR_SYSCALL         1
 # define __ASSUME_LISTEN_SYSCALL             1
 # define __ASSUME_GETSOCKNAME_SYSCALL        1
 # define __ASSUME_GETPEERNAME_SYSCALL        1
@@ -43,6 +42,7 @@
 # undef __ASSUME_SETSOCKOPT_SYSCALL
 # undef __ASSUME_BIND_SYSCALL
 # undef __ASSUME_SOCKET_SYSCALL
+# undef __ASSUME_SOCKETPAIR_SYSCALL
 #endif
 
 /* No support for PI futexes or robust mutexes before 3.10 for m68k.  */
diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
index 389dd146b4..198ff3209d 100644
--- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
@@ -22,7 +22,6 @@
 #define __ASSUME_LISTEN_SYSCALL		1
 #define __ASSUME_GETSOCKNAME_SYSCALL	1
 #define __ASSUME_GETPEERNAME_SYSCALL	1
-#define __ASSUME_SOCKETPAIR_SYSCALL	1
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_RECV_SYSCALL		1
 #define __ASSUME_SHUTDOWN_SYSCALL	1
diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
index 9ee1dc2bc7..72ec2df178 100644
--- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
@@ -22,7 +22,6 @@
 #define __ASSUME_LISTEN_SYSCALL		1
 #define __ASSUME_GETSOCKNAME_SYSCALL	1
 #define __ASSUME_GETPEERNAME_SYSCALL	1
-#define __ASSUME_SOCKETPAIR_SYSCALL	1
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_RECV_SYSCALL		1
 #define __ASSUME_SHUTDOWN_SYSCALL	1
diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
index d5991b265b..01fc98e9ab 100644
--- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
@@ -19,7 +19,6 @@
 
 /* Direct socketcalls available with kernel 4.3.  */
 #if __LINUX_KERNEL_VERSION >= 0x040300
-# define __ASSUME_SOCKETPAIR_SYSCALL         1
 # define __ASSUME_LISTEN_SYSCALL             1
 # define __ASSUME_GETSOCKNAME_SYSCALL        1
 # define __ASSUME_GETPEERNAME_SYSCALL        1
@@ -43,6 +42,7 @@
 # undef __ASSUME_SETSOCKOPT_SYSCALL
 # undef __ASSUME_BIND_SYSCALL
 # undef __ASSUME_SOCKET_SYSCALL
+# undef __ASSUME_SOCKETPAIR_SYSCALL
 #endif
 
 /* s390 only supports ipc syscall before 5.1.  */
diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
index 3b57eb7f27..b18314a9cd 100644
--- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
@@ -27,7 +27,6 @@
 #define __ASSUME_LISTEN_SYSCALL		1
 #define __ASSUME_GETSOCKNAME_SYSCALL	1
 #define __ASSUME_GETPEERNAME_SYSCALL	1
-#define __ASSUME_SOCKETPAIR_SYSCALL	1
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_RECV_SYSCALL		1
 #define __ASSUME_SHUTDOWN_SYSCALL	1
diff --git a/sysdeps/unix/sysv/linux/socketpair.c b/sysdeps/unix/sysv/linux/socketpair.c
index d06cbbc2c9..65f8cb46dc 100644
--- a/sysdeps/unix/sysv/linux/socketpair.c
+++ b/sysdeps/unix/sysv/linux/socketpair.c
@@ -15,19 +15,14 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-#include <errno.h>
-#include <signal.h>
 #include <sys/socket.h>
-
 #include <socketcall.h>
-#include <kernel-features.h>
-#include <sys/syscall.h>
 
 int
 __socketpair (int domain, int type, int protocol, int sv[2])
 {
 #ifdef __ASSUME_SOCKETPAIR_SYSCALL
-  return INLINE_SYSCALL (socketpair, 4, domain, type, protocol, &sv[0]);
+  return INLINE_SYSCALL_CALL (socketpair, domain, type, protocol, &sv[0]);
 #else
   return SOCKETCALL (socketpair, domain, type, protocol, sv);
 #endif
diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
index f3a5ef6a99..f43e5c384f 100644
--- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
@@ -41,7 +41,6 @@
 # undef __ASSUME_GETSOCKOPT_SYSCALL
 # undef __ASSUME_SETSOCKOPT_SYSCALL
 #else
-# define __ASSUME_SOCKETPAIR_SYSCALL         1
 # define __ASSUME_SHUTDOWN_SYSCALL           1
 #endif
 
-- 
2.34.1


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

* [PATCH 21/30] Linux: Assume and consolidate listen wire-up syscall
  2022-10-19 22:14 [PATCH 00/30] Remove Linux generic sysdep Adhemerval Zanella via Libc-alpha
                   ` (19 preceding siblings ...)
  2022-10-19 22:14 ` [PATCH 20/30] Linux: Assume and consolidate socketpair " Adhemerval Zanella via Libc-alpha
@ 2022-10-19 22:14 ` Adhemerval Zanella via Libc-alpha
  2022-12-06 16:17   ` Carlos O'Donell via Libc-alpha
  2022-10-19 22:14 ` [PATCH 22/30] Linux: Assume and consolidate getsockname " Adhemerval Zanella via Libc-alpha
                   ` (8 subsequent siblings)
  29 siblings, 1 reply; 68+ messages in thread
From: Adhemerval Zanella via Libc-alpha @ 2022-10-19 22:14 UTC (permalink / raw)
  To: libc-alpha

And disable if kernel does not support it.

Checked on x86_64-linux-gnu and i686-linux-gnu.
---
 sysdeps/unix/sysv/linux/generic/syscalls.list        | 1 -
 sysdeps/unix/sysv/linux/i386/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/kernel-features.h            | 1 +
 sysdeps/unix/sysv/linux/listen.c                     | 7 +------
 sysdeps/unix/sysv/linux/m68k/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/microblaze/kernel-features.h | 1 -
 sysdeps/unix/sysv/linux/powerpc/kernel-features.h    | 1 -
 sysdeps/unix/sysv/linux/s390/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/sh/kernel-features.h         | 1 -
 sysdeps/unix/sysv/linux/sparc/kernel-features.h      | 5 +----
 10 files changed, 6 insertions(+), 17 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index 95ed2cbac8..706893f245 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -1,7 +1,6 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
 # Socket APIs
-listen		-	listen		i:ii	__listen	listen
 getsockname	-	getsockname	i:ipp	__getsockname	getsockname
 getpeername	-	getpeername	i:ipp	__getpeername	getpeername
 shutdown	-	shutdown	i:ii	__shutdown	shutdown
diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
index 8a7fe47602..a79ec679cc 100644
--- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
@@ -19,7 +19,6 @@
 
 /* Direct socketcalls available with kernel 4.3.  */
 #if __LINUX_KERNEL_VERSION >= 0x040300
-# define __ASSUME_LISTEN_SYSCALL             1
 # define __ASSUME_GETSOCKNAME_SYSCALL        1
 # define __ASSUME_GETPEERNAME_SYSCALL        1
 # define __ASSUME_SHUTDOWN_SYSCALL           1
@@ -41,6 +40,7 @@
 # undef __ASSUME_BIND_SYSCALL
 # undef __ASSUME_SOCKET_SYSCALL
 # undef __ASSUME_SOCKETPAIR_SYSCALL
+# undef __ASSUME_LISTEN_SYSCALL
 #endif
 
 /* i686 only supports ipc syscall before 5.1.  */
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index fd44b39cf4..d1769b2d99 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -82,6 +82,7 @@
 #define __ASSUME_BIND_SYSCALL		1
 #define __ASSUME_SOCKET_SYSCALL		1
 #define __ASSUME_SOCKETPAIR_SYSCALL	1
+#define __ASSUME_LISTEN_SYSCALL		1
 
 /* Support for SysV IPC through wired syscalls.  All supported architectures
    either support ipc syscall and/or all the ipc correspondent syscalls.  */
diff --git a/sysdeps/unix/sysv/linux/listen.c b/sysdeps/unix/sysv/linux/listen.c
index 8d7ff85edf..e563e4df6c 100644
--- a/sysdeps/unix/sysv/linux/listen.c
+++ b/sysdeps/unix/sysv/linux/listen.c
@@ -15,19 +15,14 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-#include <errno.h>
-#include <signal.h>
 #include <sys/socket.h>
-
 #include <socketcall.h>
-#include <kernel-features.h>
-#include <sys/syscall.h>
 
 int
 listen (int fd, int backlog)
 {
 #ifdef __ASSUME_LISTEN_SYSCALL
-  return INLINE_SYSCALL (listen, 2, fd, backlog);
+  return INLINE_SYSCALL_CALL (listen, fd, backlog);
 #else
   return SOCKETCALL (listen, fd, backlog);
 #endif
diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
index 46b3045b56..a65fa63c5e 100644
--- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -19,7 +19,6 @@
 
 /* Direct socketcalls available with kernel 4.3.  */
 #if __LINUX_KERNEL_VERSION >= 0x040300
-# define __ASSUME_LISTEN_SYSCALL             1
 # define __ASSUME_GETSOCKNAME_SYSCALL        1
 # define __ASSUME_GETPEERNAME_SYSCALL        1
 # define __ASSUME_SHUTDOWN_SYSCALL           1
@@ -43,6 +42,7 @@
 # undef __ASSUME_BIND_SYSCALL
 # undef __ASSUME_SOCKET_SYSCALL
 # undef __ASSUME_SOCKETPAIR_SYSCALL
+# undef __ASSUME_LISTEN_SYSCALL
 #endif
 
 /* No support for PI futexes or robust mutexes before 3.10 for m68k.  */
diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
index 198ff3209d..e19e6bb6ba 100644
--- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
@@ -19,7 +19,6 @@
 
 /* All supported kernel versions for MicroBlaze have these syscalls.  */
 #define __ASSUME_CONNECT_SYSCALL	1
-#define __ASSUME_LISTEN_SYSCALL		1
 #define __ASSUME_GETSOCKNAME_SYSCALL	1
 #define __ASSUME_GETPEERNAME_SYSCALL	1
 #define __ASSUME_SEND_SYSCALL		1
diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
index 72ec2df178..eb73a91a5d 100644
--- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
@@ -19,7 +19,6 @@
 
 /* New syscalls added for PowerPC in 2.6.37.  */
 #define __ASSUME_CONNECT_SYSCALL	1
-#define __ASSUME_LISTEN_SYSCALL		1
 #define __ASSUME_GETSOCKNAME_SYSCALL	1
 #define __ASSUME_GETPEERNAME_SYSCALL	1
 #define __ASSUME_SEND_SYSCALL		1
diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
index 01fc98e9ab..3daee3f132 100644
--- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
@@ -19,7 +19,6 @@
 
 /* Direct socketcalls available with kernel 4.3.  */
 #if __LINUX_KERNEL_VERSION >= 0x040300
-# define __ASSUME_LISTEN_SYSCALL             1
 # define __ASSUME_GETSOCKNAME_SYSCALL        1
 # define __ASSUME_GETPEERNAME_SYSCALL        1
 # define __ASSUME_SHUTDOWN_SYSCALL           1
@@ -43,6 +42,7 @@
 # undef __ASSUME_BIND_SYSCALL
 # undef __ASSUME_SOCKET_SYSCALL
 # undef __ASSUME_SOCKETPAIR_SYSCALL
+# undef __ASSUME_LISTEN_SYSCALL
 #endif
 
 /* s390 only supports ipc syscall before 5.1.  */
diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
index b18314a9cd..23eadf84e0 100644
--- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
@@ -24,7 +24,6 @@
 
 /* These syscalls were added for SH in 2.6.37.  */
 #define __ASSUME_CONNECT_SYSCALL	1
-#define __ASSUME_LISTEN_SYSCALL		1
 #define __ASSUME_GETSOCKNAME_SYSCALL	1
 #define __ASSUME_GETPEERNAME_SYSCALL	1
 #define __ASSUME_SEND_SYSCALL		1
diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
index f43e5c384f..7070aaa1ae 100644
--- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
@@ -45,12 +45,9 @@
 #endif
 
 /* These syscalls were added for both 32-bit and 64-bit in 4.4.  */
-#if __LINUX_KERNEL_VERSION >= 0x040400
-# define __ASSUME_LISTEN_SYSCALL             1
-#endif
-
 #if __LINUX_KERNEL_VERSION < 0x040400
 # undef __ASSUME_BIND_SYSCALL
+# undef __ASSUME_LISTEN_SYSCALL
 #endif
 
 #ifdef __arch64__
-- 
2.34.1


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

* [PATCH 22/30] Linux: Assume and consolidate getsockname wire-up syscall
  2022-10-19 22:14 [PATCH 00/30] Remove Linux generic sysdep Adhemerval Zanella via Libc-alpha
                   ` (20 preceding siblings ...)
  2022-10-19 22:14 ` [PATCH 21/30] Linux: Assume and consolidate listen " Adhemerval Zanella via Libc-alpha
@ 2022-10-19 22:14 ` Adhemerval Zanella via Libc-alpha
  2022-10-20  0:01   ` Joseph Myers
  2022-12-06 16:18   ` Carlos O'Donell via Libc-alpha
  2022-10-19 22:14 ` [PATCH 23/30] Linux: Assume and consolidate getpeername " Adhemerval Zanella via Libc-alpha
                   ` (7 subsequent siblings)
  29 siblings, 2 replies; 68+ messages in thread
From: Adhemerval Zanella via Libc-alpha @ 2022-10-19 22:14 UTC (permalink / raw)
  To: libc-alpha

And disable if kernel does not support it.

Checked on x86_64-linux-gnu and i686-linux-gnu.
---
 sysdeps/unix/sysv/linux/generic/syscalls.list        | 1 -
 sysdeps/unix/sysv/linux/getsockname.c                | 7 +------
 sysdeps/unix/sysv/linux/i386/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/kernel-features.h            | 1 +
 sysdeps/unix/sysv/linux/m68k/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/microblaze/kernel-features.h | 1 -
 sysdeps/unix/sysv/linux/powerpc/kernel-features.h    | 1 -
 sysdeps/unix/sysv/linux/s390/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/sh/kernel-features.h         | 1 -
 9 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index 706893f245..a5bb00a3e4 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -1,6 +1,5 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
 # Socket APIs
-getsockname	-	getsockname	i:ipp	__getsockname	getsockname
 getpeername	-	getpeername	i:ipp	__getpeername	getpeername
 shutdown	-	shutdown	i:ii	__shutdown	shutdown
diff --git a/sysdeps/unix/sysv/linux/getsockname.c b/sysdeps/unix/sysv/linux/getsockname.c
index d0718c2aaf..8350b800fe 100644
--- a/sysdeps/unix/sysv/linux/getsockname.c
+++ b/sysdeps/unix/sysv/linux/getsockname.c
@@ -15,19 +15,14 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-#include <errno.h>
-#include <signal.h>
 #include <sys/socket.h>
-
 #include <socketcall.h>
-#include <kernel-features.h>
-#include <sys/syscall.h>
 
 int
 __getsockname (int fd, __SOCKADDR_ARG addr, socklen_t *len)
 {
 #ifdef __ASSUME_GETSOCKNAME_SYSCALL
-  return INLINE_SYSCALL (getsockname, 3, fd, addr.__sockaddr__, len);
+  return INLINE_SYSCALL_CALL (getsockname, fd, addr.__sockaddr__, len);
 #else
   return SOCKETCALL (getsockname, fd, addr.__sockaddr__, len);
 #endif
diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
index a79ec679cc..f294380215 100644
--- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
@@ -19,7 +19,6 @@
 
 /* Direct socketcalls available with kernel 4.3.  */
 #if __LINUX_KERNEL_VERSION >= 0x040300
-# define __ASSUME_GETSOCKNAME_SYSCALL        1
 # define __ASSUME_GETPEERNAME_SYSCALL        1
 # define __ASSUME_SHUTDOWN_SYSCALL           1
 #endif
@@ -41,6 +40,7 @@
 # undef __ASSUME_SOCKET_SYSCALL
 # undef __ASSUME_SOCKETPAIR_SYSCALL
 # undef __ASSUME_LISTEN_SYSCALL
+# undef __ASSUME_GETSOCKNAME_SYSCALL
 #endif
 
 /* i686 only supports ipc syscall before 5.1.  */
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index d1769b2d99..6fb99f5c35 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -83,6 +83,7 @@
 #define __ASSUME_SOCKET_SYSCALL		1
 #define __ASSUME_SOCKETPAIR_SYSCALL	1
 #define __ASSUME_LISTEN_SYSCALL		1
+#define __ASSUME_GETSOCKNAME_SYSCALL	1
 
 /* Support for SysV IPC through wired syscalls.  All supported architectures
    either support ipc syscall and/or all the ipc correspondent syscalls.  */
diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
index a65fa63c5e..898c24ba62 100644
--- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -19,7 +19,6 @@
 
 /* Direct socketcalls available with kernel 4.3.  */
 #if __LINUX_KERNEL_VERSION >= 0x040300
-# define __ASSUME_GETSOCKNAME_SYSCALL        1
 # define __ASSUME_GETPEERNAME_SYSCALL        1
 # define __ASSUME_SHUTDOWN_SYSCALL           1
 #endif
@@ -43,6 +42,7 @@
 # undef __ASSUME_SOCKET_SYSCALL
 # undef __ASSUME_SOCKETPAIR_SYSCALL
 # undef __ASSUME_LISTEN_SYSCALL
+# undef __ASSUME_GETSOCKNAME_SYSCALL
 #endif
 
 /* No support for PI futexes or robust mutexes before 3.10 for m68k.  */
diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
index e19e6bb6ba..7e2b15859e 100644
--- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
@@ -19,7 +19,6 @@
 
 /* All supported kernel versions for MicroBlaze have these syscalls.  */
 #define __ASSUME_CONNECT_SYSCALL	1
-#define __ASSUME_GETSOCKNAME_SYSCALL	1
 #define __ASSUME_GETPEERNAME_SYSCALL	1
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_RECV_SYSCALL		1
diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
index eb73a91a5d..8953cb019f 100644
--- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
@@ -19,7 +19,6 @@
 
 /* New syscalls added for PowerPC in 2.6.37.  */
 #define __ASSUME_CONNECT_SYSCALL	1
-#define __ASSUME_GETSOCKNAME_SYSCALL	1
 #define __ASSUME_GETPEERNAME_SYSCALL	1
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_RECV_SYSCALL		1
diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
index 3daee3f132..1422ee620c 100644
--- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
@@ -19,7 +19,6 @@
 
 /* Direct socketcalls available with kernel 4.3.  */
 #if __LINUX_KERNEL_VERSION >= 0x040300
-# define __ASSUME_GETSOCKNAME_SYSCALL        1
 # define __ASSUME_GETPEERNAME_SYSCALL        1
 # define __ASSUME_SHUTDOWN_SYSCALL           1
 #endif
@@ -43,6 +42,7 @@
 # undef __ASSUME_SOCKET_SYSCALL
 # undef __ASSUME_SOCKETPAIR_SYSCALL
 # undef __ASSUME_LISTEN_SYSCALL
+# undef __ASSUME_GETSOCKNAME_SYSCALL
 #endif
 
 /* s390 only supports ipc syscall before 5.1.  */
diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
index 23eadf84e0..91dc28f33f 100644
--- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
@@ -24,7 +24,6 @@
 
 /* These syscalls were added for SH in 2.6.37.  */
 #define __ASSUME_CONNECT_SYSCALL	1
-#define __ASSUME_GETSOCKNAME_SYSCALL	1
 #define __ASSUME_GETPEERNAME_SYSCALL	1
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_RECV_SYSCALL		1
-- 
2.34.1


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

* [PATCH 23/30] Linux: Assume and consolidate getpeername wire-up syscall
  2022-10-19 22:14 [PATCH 00/30] Remove Linux generic sysdep Adhemerval Zanella via Libc-alpha
                   ` (21 preceding siblings ...)
  2022-10-19 22:14 ` [PATCH 22/30] Linux: Assume and consolidate getsockname " Adhemerval Zanella via Libc-alpha
@ 2022-10-19 22:14 ` Adhemerval Zanella via Libc-alpha
  2022-10-20  0:02   ` Joseph Myers
  2022-12-06 16:20   ` Carlos O'Donell via Libc-alpha
  2022-10-19 22:14 ` [PATCH 24/30] Linux: Assume and consolidate shutdown " Adhemerval Zanella via Libc-alpha
                   ` (6 subsequent siblings)
  29 siblings, 2 replies; 68+ messages in thread
From: Adhemerval Zanella via Libc-alpha @ 2022-10-19 22:14 UTC (permalink / raw)
  To: libc-alpha

And disable if kernel does not support it.

Checked on x86_64-linux-gnu and i686-linux-gnu.
---
 sysdeps/unix/sysv/linux/generic/syscalls.list        | 1 -
 sysdeps/unix/sysv/linux/getpeername.c                | 7 +------
 sysdeps/unix/sysv/linux/i386/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/kernel-features.h            | 1 +
 sysdeps/unix/sysv/linux/m68k/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/microblaze/kernel-features.h | 1 -
 sysdeps/unix/sysv/linux/powerpc/kernel-features.h    | 1 -
 sysdeps/unix/sysv/linux/s390/kernel-features.h       | 2 +-
 sysdeps/unix/sysv/linux/sh/kernel-features.h         | 1 -
 9 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index a5bb00a3e4..b000ca3c7c 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -1,5 +1,4 @@
 # File name	Caller	Syscall name	# args	Strong name	Weak names
 
 # Socket APIs
-getpeername	-	getpeername	i:ipp	__getpeername	getpeername
 shutdown	-	shutdown	i:ii	__shutdown	shutdown
diff --git a/sysdeps/unix/sysv/linux/getpeername.c b/sysdeps/unix/sysv/linux/getpeername.c
index 09ca76b9ad..63fa8e2fe5 100644
--- a/sysdeps/unix/sysv/linux/getpeername.c
+++ b/sysdeps/unix/sysv/linux/getpeername.c
@@ -15,19 +15,14 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-#include <errno.h>
-#include <signal.h>
 #include <sys/socket.h>
-
 #include <socketcall.h>
-#include <kernel-features.h>
-#include <sys/syscall.h>
 
 int
 __getpeername (int fd, __SOCKADDR_ARG addr, socklen_t *len)
 {
 #ifdef __ASSUME_GETPEERNAME_SYSCALL
-  return INLINE_SYSCALL (getpeername, 3, fd, addr.__sockaddr__, len);
+  return INLINE_SYSCALL_CALL (getpeername, fd, addr.__sockaddr__, len);
 #else
   return SOCKETCALL (getpeername, fd, addr.__sockaddr__, len);
 #endif
diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
index f294380215..423edc9017 100644
--- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
@@ -19,7 +19,6 @@
 
 /* Direct socketcalls available with kernel 4.3.  */
 #if __LINUX_KERNEL_VERSION >= 0x040300
-# define __ASSUME_GETPEERNAME_SYSCALL        1
 # define __ASSUME_SHUTDOWN_SYSCALL           1
 #endif
 
@@ -41,6 +40,7 @@
 # undef __ASSUME_SOCKETPAIR_SYSCALL
 # undef __ASSUME_LISTEN_SYSCALL
 # undef __ASSUME_GETSOCKNAME_SYSCALL
+# undef __ASSUME_GETPEERNAME_SYSCALL
 #endif
 
 /* i686 only supports ipc syscall before 5.1.  */
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index 6fb99f5c35..c751530cd3 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -84,6 +84,7 @@
 #define __ASSUME_SOCKETPAIR_SYSCALL	1
 #define __ASSUME_LISTEN_SYSCALL		1
 #define __ASSUME_GETSOCKNAME_SYSCALL	1
+#define __ASSUME_GETPEERNAME_SYSCALL	1
 
 /* Support for SysV IPC through wired syscalls.  All supported architectures
    either support ipc syscall and/or all the ipc correspondent syscalls.  */
diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
index 898c24ba62..a7b3458a21 100644
--- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -19,7 +19,6 @@
 
 /* Direct socketcalls available with kernel 4.3.  */
 #if __LINUX_KERNEL_VERSION >= 0x040300
-# define __ASSUME_GETPEERNAME_SYSCALL        1
 # define __ASSUME_SHUTDOWN_SYSCALL           1
 #endif
 
@@ -43,6 +42,7 @@
 # undef __ASSUME_SOCKETPAIR_SYSCALL
 # undef __ASSUME_LISTEN_SYSCALL
 # undef __ASSUME_GETSOCKNAME_SYSCALL
+# undef __ASSUME_GETPEERNAME_SYSCALL
 #endif
 
 /* No support for PI futexes or robust mutexes before 3.10 for m68k.  */
diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
index 7e2b15859e..328529434d 100644
--- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
@@ -19,7 +19,6 @@
 
 /* All supported kernel versions for MicroBlaze have these syscalls.  */
 #define __ASSUME_CONNECT_SYSCALL	1
-#define __ASSUME_GETPEERNAME_SYSCALL	1
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_RECV_SYSCALL		1
 #define __ASSUME_SHUTDOWN_SYSCALL	1
diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
index 8953cb019f..7fae7ca429 100644
--- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
@@ -19,7 +19,6 @@
 
 /* New syscalls added for PowerPC in 2.6.37.  */
 #define __ASSUME_CONNECT_SYSCALL	1
-#define __ASSUME_GETPEERNAME_SYSCALL	1
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_RECV_SYSCALL		1
 #define __ASSUME_SHUTDOWN_SYSCALL	1
diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
index 1422ee620c..e797b71052 100644
--- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
@@ -19,7 +19,6 @@
 
 /* Direct socketcalls available with kernel 4.3.  */
 #if __LINUX_KERNEL_VERSION >= 0x040300
-# define __ASSUME_GETPEERNAME_SYSCALL        1
 # define __ASSUME_SHUTDOWN_SYSCALL           1
 #endif
 
@@ -43,6 +42,7 @@
 # undef __ASSUME_SOCKETPAIR_SYSCALL
 # undef __ASSUME_LISTEN_SYSCALL
 # undef __ASSUME_GETSOCKNAME_SYSCALL
+# undef __ASSUME_GETPEERNAME_SYSCALL
 #endif
 
 /* s390 only supports ipc syscall before 5.1.  */
diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
index 91dc28f33f..3a0b4e6198 100644
--- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
@@ -24,7 +24,6 @@
 
 /* These syscalls were added for SH in 2.6.37.  */
 #define __ASSUME_CONNECT_SYSCALL	1
-#define __ASSUME_GETPEERNAME_SYSCALL	1
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_RECV_SYSCALL		1
 #define __ASSUME_SHUTDOWN_SYSCALL	1
-- 
2.34.1


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

* [PATCH 24/30] Linux: Assume and consolidate shutdown wire-up syscall
  2022-10-19 22:14 [PATCH 00/30] Remove Linux generic sysdep Adhemerval Zanella via Libc-alpha
                   ` (22 preceding siblings ...)
  2022-10-19 22:14 ` [PATCH 23/30] Linux: Assume and consolidate getpeername " Adhemerval Zanella via Libc-alpha
@ 2022-10-19 22:14 ` Adhemerval Zanella via Libc-alpha
  2022-12-06 16:23   ` Carlos O'Donell via Libc-alpha
  2022-10-19 22:14 ` [PATCH 25/30] Linux: Remove unused generic Makefile Adhemerval Zanella via Libc-alpha
                   ` (5 subsequent siblings)
  29 siblings, 1 reply; 68+ messages in thread
From: Adhemerval Zanella via Libc-alpha @ 2022-10-19 22:14 UTC (permalink / raw)
  To: libc-alpha

And disable if kernel does not support it.

Checked on x86_64-linux-gnu and i686-linux-gnu.
---
 sysdeps/unix/sysv/linux/generic/syscalls.list        | 4 ----
 sysdeps/unix/sysv/linux/i386/kernel-features.h       | 7 ++-----
 sysdeps/unix/sysv/linux/kernel-features.h            | 1 +
 sysdeps/unix/sysv/linux/m68k/kernel-features.h       | 7 ++-----
 sysdeps/unix/sysv/linux/microblaze/kernel-features.h | 1 -
 sysdeps/unix/sysv/linux/powerpc/kernel-features.h    | 1 -
 sysdeps/unix/sysv/linux/s390/kernel-features.h       | 7 ++-----
 sysdeps/unix/sysv/linux/sh/kernel-features.h         | 1 -
 sysdeps/unix/sysv/linux/shutdown.c                   | 7 +------
 sysdeps/unix/sysv/linux/sparc/kernel-features.h      | 2 --
 10 files changed, 8 insertions(+), 30 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/generic/syscalls.list

diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
deleted file mode 100644
index b000ca3c7c..0000000000
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ /dev/null
@@ -1,4 +0,0 @@
-# File name	Caller	Syscall name	# args	Strong name	Weak names
-
-# Socket APIs
-shutdown	-	shutdown	i:ii	__shutdown	shutdown
diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
index 423edc9017..e726fc657a 100644
--- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
@@ -17,15 +17,11 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-/* Direct socketcalls available with kernel 4.3.  */
-#if __LINUX_KERNEL_VERSION >= 0x040300
-# define __ASSUME_SHUTDOWN_SYSCALL           1
-#endif
-
 #include_next <kernel-features.h>
 
 #undef __ASSUME_ACCEPT_SYSCALL
 
+/* Direct socketcalls available with kernel 4.3.  */
 #if __LINUX_KERNEL_VERSION < 0x040300
 # undef __ASSUME_ACCEPT4_SYSCALL
 # undef __ASSUME_SENDMSG_SYSCALL
@@ -41,6 +37,7 @@
 # undef __ASSUME_LISTEN_SYSCALL
 # undef __ASSUME_GETSOCKNAME_SYSCALL
 # undef __ASSUME_GETPEERNAME_SYSCALL
+# undef __ASSUME_SHUTDOWN_SYSCALL
 #endif
 
 /* i686 only supports ipc syscall before 5.1.  */
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index c751530cd3..23586c88d3 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -85,6 +85,7 @@
 #define __ASSUME_LISTEN_SYSCALL		1
 #define __ASSUME_GETSOCKNAME_SYSCALL	1
 #define __ASSUME_GETPEERNAME_SYSCALL	1
+#define __ASSUME_SHUTDOWN_SYSCALL	1
 
 /* Support for SysV IPC through wired syscalls.  All supported architectures
    either support ipc syscall and/or all the ipc correspondent syscalls.  */
diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
index a7b3458a21..1ad1193afb 100644
--- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -17,15 +17,11 @@
    License along with the GNU C Library.  If not, see
    <https://www.gnu.org/licenses/>.  */
 
-/* Direct socketcalls available with kernel 4.3.  */
-#if __LINUX_KERNEL_VERSION >= 0x040300
-# define __ASSUME_SHUTDOWN_SYSCALL           1
-#endif
-
 #include_next <kernel-features.h>
 
 #undef __ASSUME_ACCEPT_SYSCALL
 
+/* Direct socketcalls available with kernel 4.3.  */
 #if __LINUX_KERNEL_VERSION < 0x040300
 # undef __ASSUME_ACCEPT4_SYSCALL
 # undef __ASSUME_RECVMMSG_SYSCALL
@@ -43,6 +39,7 @@
 # undef __ASSUME_LISTEN_SYSCALL
 # undef __ASSUME_GETSOCKNAME_SYSCALL
 # undef __ASSUME_GETPEERNAME_SYSCALL
+# undef __ASSUME_SHUTDOWN_SYSCALL
 #endif
 
 /* No support for PI futexes or robust mutexes before 3.10 for m68k.  */
diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
index 328529434d..72496aa922 100644
--- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
@@ -21,7 +21,6 @@
 #define __ASSUME_CONNECT_SYSCALL	1
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_RECV_SYSCALL		1
-#define __ASSUME_SHUTDOWN_SYSCALL	1
 
 #include_next <kernel-features.h>
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
index 7fae7ca429..e2dc7a15a3 100644
--- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
@@ -21,7 +21,6 @@
 #define __ASSUME_CONNECT_SYSCALL	1
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_RECV_SYSCALL		1
-#define __ASSUME_SHUTDOWN_SYSCALL	1
 
 /* Define this if your 32-bit syscall API requires 64-bit register
    pairs to start with an even-number register.  */
diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
index e797b71052..b39e4736b3 100644
--- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
@@ -17,15 +17,11 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-/* Direct socketcalls available with kernel 4.3.  */
-#if __LINUX_KERNEL_VERSION >= 0x040300
-# define __ASSUME_SHUTDOWN_SYSCALL           1
-#endif
-
 #include_next <kernel-features.h>
 
 #undef __ASSUME_ACCEPT_SYSCALL
 
+/* Direct socketcalls available with kernel 4.3.  */
 #if __LINUX_KERNEL_VERSION < 0x040300
 # undef __ASSUME_ACCEPT4_SYSCALL
 # undef __ASSUME_RECVMMSG_SYSCALL
@@ -43,6 +39,7 @@
 # undef __ASSUME_LISTEN_SYSCALL
 # undef __ASSUME_GETSOCKNAME_SYSCALL
 # undef __ASSUME_GETPEERNAME_SYSCALL
+# undef __ASSUME_SHUTDOWN_SYSCALL
 #endif
 
 /* s390 only supports ipc syscall before 5.1.  */
diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
index 3a0b4e6198..ae1387e7d7 100644
--- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
@@ -26,7 +26,6 @@
 #define __ASSUME_CONNECT_SYSCALL	1
 #define __ASSUME_SEND_SYSCALL		1
 #define __ASSUME_RECV_SYSCALL		1
-#define __ASSUME_SHUTDOWN_SYSCALL	1
 
 #include_next <kernel-features.h>
 
diff --git a/sysdeps/unix/sysv/linux/shutdown.c b/sysdeps/unix/sysv/linux/shutdown.c
index 26772c9b28..4cee357b9b 100644
--- a/sysdeps/unix/sysv/linux/shutdown.c
+++ b/sysdeps/unix/sysv/linux/shutdown.c
@@ -15,19 +15,14 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-#include <errno.h>
-#include <signal.h>
 #include <sys/socket.h>
-
 #include <socketcall.h>
-#include <kernel-features.h>
-#include <sys/syscall.h>
 
 int
 __shutdown (int fd, int how)
 {
 #ifdef __ASSUME_SHUTDOWN_SYSCALL
-  return INLINE_SYSCALL (shutdown, 2, fd, how);
+  return INLINE_SYSCALL_CALL (shutdown, fd, how);
 #else
   return SOCKETCALL (shutdown, fd, how);
 #endif
diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
index 7070aaa1ae..12e98a9f95 100644
--- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
@@ -40,8 +40,6 @@
 # undef __ASSUME_SENDTO_SYSCALL
 # undef __ASSUME_GETSOCKOPT_SYSCALL
 # undef __ASSUME_SETSOCKOPT_SYSCALL
-#else
-# define __ASSUME_SHUTDOWN_SYSCALL           1
 #endif
 
 /* These syscalls were added for both 32-bit and 64-bit in 4.4.  */
-- 
2.34.1


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

* [PATCH 25/30] Linux: Remove unused generic Makefile
  2022-10-19 22:14 [PATCH 00/30] Remove Linux generic sysdep Adhemerval Zanella via Libc-alpha
                   ` (23 preceding siblings ...)
  2022-10-19 22:14 ` [PATCH 24/30] Linux: Assume and consolidate shutdown " Adhemerval Zanella via Libc-alpha
@ 2022-10-19 22:14 ` Adhemerval Zanella via Libc-alpha
  2022-12-06 17:24   ` Carlos O'Donell via Libc-alpha
  2022-10-19 22:14 ` [PATCH 26/30] Linux: Remove generic sysdep Adhemerval Zanella via Libc-alpha
                   ` (4 subsequent siblings)
  29 siblings, 1 reply; 68+ messages in thread
From: Adhemerval Zanella via Libc-alpha @ 2022-10-19 22:14 UTC (permalink / raw)
  To: libc-alpha

Both are already defined on default linux Makefile.
---
 sysdeps/unix/sysv/linux/generic/Makefile | 3 ---
 1 file changed, 3 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/generic/Makefile

diff --git a/sysdeps/unix/sysv/linux/generic/Makefile b/sysdeps/unix/sysv/linux/generic/Makefile
deleted file mode 100644
index 7e27e79772..0000000000
--- a/sysdeps/unix/sysv/linux/generic/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-ifeq ($(subdir),misc)
-sysdep_routines += epoll_create inotify_init
-endif
-- 
2.34.1


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

* [PATCH 26/30] Linux: Remove generic sysdep
  2022-10-19 22:14 [PATCH 00/30] Remove Linux generic sysdep Adhemerval Zanella via Libc-alpha
                   ` (24 preceding siblings ...)
  2022-10-19 22:14 ` [PATCH 25/30] Linux: Remove unused generic Makefile Adhemerval Zanella via Libc-alpha
@ 2022-10-19 22:14 ` Adhemerval Zanella via Libc-alpha
  2022-12-06 17:29   ` Carlos O'Donell via Libc-alpha
  2022-10-19 22:14 ` [PATCH 27/30] Linux: make generic xstatver.h the default one Adhemerval Zanella via Libc-alpha
                   ` (3 subsequent siblings)
  29 siblings, 1 reply; 68+ messages in thread
From: Adhemerval Zanella via Libc-alpha @ 2022-10-19 22:14 UTC (permalink / raw)
  To: libc-alpha

The includes chain is added on each architecture sysdep.h and
the __NR__llseek hack is moved to lseek.c and lseek64.c.
---
 sysdeps/unix/sysv/linux/aarch64/sysdep.h   |  3 ++-
 sysdeps/unix/sysv/linux/arc/sysdep.h       |  4 +++-
 sysdeps/unix/sysv/linux/csky/sysdep.h      |  2 +-
 sysdeps/unix/sysv/linux/generic/sysdep.h   | 26 ----------------------
 sysdeps/unix/sysv/linux/loongarch/sysdep.h |  3 ++-
 sysdeps/unix/sysv/linux/lseek.c            |  4 ++++
 sysdeps/unix/sysv/linux/lseek64.c          |  4 ++++
 sysdeps/unix/sysv/linux/nios2/sysdep.h     |  2 +-
 sysdeps/unix/sysv/linux/or1k/sysdep.h      |  3 ++-
 sysdeps/unix/sysv/linux/riscv/sysdep.h     |  3 ++-
 10 files changed, 21 insertions(+), 33 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/generic/sysdep.h

diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
index f1853e012f..df5075aceb 100644
--- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
@@ -21,7 +21,8 @@
 
 #include <sysdeps/unix/sysdep.h>
 #include <sysdeps/aarch64/sysdep.h>
-#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
+#include <sysdeps/unix/sysdep.h>
+#include <sysdeps/unix/sysv/linux/sysdep.h>
 
 /* Defines RTLD_PRIVATE_ERRNO and USE_DL_SYSINFO.  */
 #include <dl-sysdep.h>
diff --git a/sysdeps/unix/sysv/linux/arc/sysdep.h b/sysdeps/unix/sysv/linux/arc/sysdep.h
index d0c1a78381..90a92566a7 100644
--- a/sysdeps/unix/sysv/linux/arc/sysdep.h
+++ b/sysdeps/unix/sysv/linux/arc/sysdep.h
@@ -20,7 +20,9 @@
 #define _LINUX_ARC_SYSDEP_H 1
 
 #include <sysdeps/arc/sysdep.h>
-#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
+#include <bits/wordsize.h>
+#include <sysdeps/unix/sysdep.h>
+#include <sysdeps/unix/sysv/linux/sysdep.h>
 
 /* "workarounds" for generic code needing to handle 64-bit time_t.  */
 
diff --git a/sysdeps/unix/sysv/linux/csky/sysdep.h b/sysdeps/unix/sysv/linux/csky/sysdep.h
index 56c527fa8b..39c13c6d38 100644
--- a/sysdeps/unix/sysv/linux/csky/sysdep.h
+++ b/sysdeps/unix/sysv/linux/csky/sysdep.h
@@ -20,9 +20,9 @@
 #define _LINUX_CSKY_SYSDEP_H 1
 
 /* There is some commonality.  */
-#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
 #include <sysdeps/unix/sysv/linux/sysdep.h>
 #include <sysdeps/csky/sysdep.h>
+#include <sysdeps/unix/sysdep.h>
 
 /* Defines RTLD_PRIVATE_ERRNO and USE_DL_SYSINFO.  */
 #include <dl-sysdep.h>
diff --git a/sysdeps/unix/sysv/linux/generic/sysdep.h b/sysdeps/unix/sysv/linux/generic/sysdep.h
deleted file mode 100644
index 7af5cb4e16..0000000000
--- a/sysdeps/unix/sysv/linux/generic/sysdep.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Copyright (C) 2011-2022 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library.  If not, see
-   <https://www.gnu.org/licenses/>.  */
-
-#include <bits/wordsize.h>
-#include <kernel-features.h>
-#include <sysdeps/unix/sysdep.h>
-#include <sysdeps/unix/sysv/linux/sysdep.h>
-
-/* Provide the common name to allow more code reuse.  */
-#ifdef __NR_llseek
-# define __NR__llseek __NR_llseek
-#endif
diff --git a/sysdeps/unix/sysv/linux/loongarch/sysdep.h b/sysdeps/unix/sysv/linux/loongarch/sysdep.h
index f4a1d23a97..e2bb39a8f8 100644
--- a/sysdeps/unix/sysv/linux/loongarch/sysdep.h
+++ b/sysdeps/unix/sysv/linux/loongarch/sysdep.h
@@ -19,7 +19,8 @@
 #ifndef _LINUX_LOONGARCH_SYSDEP_H
 #define _LINUX_LOONGARCH_SYSDEP_H 1
 
-#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
+#include <sysdeps/unix/sysv/linux/sysdep.h>
+#include <sysdeps/unix/sysdep.h>
 #include <tls.h>
 
 #ifdef __ASSEMBLER__
diff --git a/sysdeps/unix/sysv/linux/lseek.c b/sysdeps/unix/sysv/linux/lseek.c
index 148503d7bc..3f10c8dc96 100644
--- a/sysdeps/unix/sysv/linux/lseek.c
+++ b/sysdeps/unix/sysv/linux/lseek.c
@@ -41,6 +41,10 @@ static inline off_t lseek_overflow (loff_t res)
 off_t
 __lseek (int fd, off_t offset, int whence)
 {
+#ifdef __NR_llseek
+# define __NR__llseek __NR_llseek
+#endif
+
 # ifdef __NR__llseek
   loff_t res;
   int rc = INLINE_SYSCALL_CALL (_llseek, fd,
diff --git a/sysdeps/unix/sysv/linux/lseek64.c b/sysdeps/unix/sysv/linux/lseek64.c
index 74aab82f5a..d14ba9e12b 100644
--- a/sysdeps/unix/sysv/linux/lseek64.c
+++ b/sysdeps/unix/sysv/linux/lseek64.c
@@ -26,6 +26,10 @@
 off64_t
 __lseek64 (int fd, off64_t offset, int whence)
 {
+#ifdef __NR_llseek
+# define __NR__llseek __NR_llseek
+#endif
+
 #ifdef __NR__llseek
   loff_t res;
   int rc = INLINE_SYSCALL_CALL (_llseek, fd,
diff --git a/sysdeps/unix/sysv/linux/nios2/sysdep.h b/sysdeps/unix/sysv/linux/nios2/sysdep.h
index 5fe960c2a5..4c9aba497b 100644
--- a/sysdeps/unix/sysv/linux/nios2/sysdep.h
+++ b/sysdeps/unix/sysv/linux/nios2/sysdep.h
@@ -19,9 +19,9 @@
 #ifndef _LINUX_NIOS2_SYSDEP_H
 #define _LINUX_NIOS2_SYSDEP_H 1
 
+#include <sysdeps/unix/sysv/linux/sysdep.h>
 #include <sysdeps/unix/sysdep.h>
 #include <sysdeps/nios2/sysdep.h>
-#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
 
 /* For RTLD_PRIVATE_ERRNO.  */
 #include <dl-sysdep.h>
diff --git a/sysdeps/unix/sysv/linux/or1k/sysdep.h b/sysdeps/unix/sysv/linux/or1k/sysdep.h
index 941c934554..fd884606ee 100644
--- a/sysdeps/unix/sysv/linux/or1k/sysdep.h
+++ b/sysdeps/unix/sysv/linux/or1k/sysdep.h
@@ -19,8 +19,9 @@
 #ifndef _LINUX_OR1K_SYSDEP_H
 #define _LINUX_OR1K_SYSDEP_H 1
 
+#include <sysdeps/unix/sysv/linux/sysdep.h>
 #include <sysdeps/or1k/sysdep.h>
-#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
+#include <sysdeps/unix/sysdep.h>
 #include <tls.h>
 
 /* "workarounds" for generic code needing to handle 64-bit time_t.  */
diff --git a/sysdeps/unix/sysv/linux/riscv/sysdep.h b/sysdeps/unix/sysv/linux/riscv/sysdep.h
index 9b03b10567..c2c9b0c937 100644
--- a/sysdeps/unix/sysv/linux/riscv/sysdep.h
+++ b/sysdeps/unix/sysv/linux/riscv/sysdep.h
@@ -19,7 +19,8 @@
 #ifndef _LINUX_RISCV_SYSDEP_H
 #define _LINUX_RISCV_SYSDEP_H 1
 
-#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
+#include <sysdeps/unix/sysv/linux/sysdep.h>
+#include <sysdeps/unix/sysdep.h>
 #include <tls.h>
 
 #undef SYS_ify
-- 
2.34.1


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

* [PATCH 27/30] Linux: make generic xstatver.h the default one
  2022-10-19 22:14 [PATCH 00/30] Remove Linux generic sysdep Adhemerval Zanella via Libc-alpha
                   ` (25 preceding siblings ...)
  2022-10-19 22:14 ` [PATCH 26/30] Linux: Remove generic sysdep Adhemerval Zanella via Libc-alpha
@ 2022-10-19 22:14 ` Adhemerval Zanella via Libc-alpha
  2022-12-06 17:33   ` Carlos O'Donell via Libc-alpha
  2022-10-19 22:14 ` [PATCH 28/30] Linux: Make generic fcntl.h " Adhemerval Zanella via Libc-alpha
                   ` (2 subsequent siblings)
  29 siblings, 1 reply; 68+ messages in thread
From: Adhemerval Zanella via Libc-alpha @ 2022-10-19 22:14 UTC (permalink / raw)
  To: libc-alpha

And copy the current default one to required ABIs.
---
 sysdeps/unix/sysv/linux/{generic => arm}/xstatver.h | 11 +++++++----
 sysdeps/unix/sysv/linux/hppa/xstatver.h             | 13 +++++++++++++
 sysdeps/unix/sysv/linux/sh/xstatver.h               | 13 +++++++++++++
 sysdeps/unix/sysv/linux/xstatver.h                  | 11 ++++-------
 4 files changed, 37 insertions(+), 11 deletions(-)
 rename sysdeps/unix/sysv/linux/{generic => arm}/xstatver.h (52%)
 create mode 100644 sysdeps/unix/sysv/linux/hppa/xstatver.h
 create mode 100644 sysdeps/unix/sysv/linux/sh/xstatver.h

diff --git a/sysdeps/unix/sysv/linux/generic/xstatver.h b/sysdeps/unix/sysv/linux/arm/xstatver.h
similarity index 52%
rename from sysdeps/unix/sysv/linux/generic/xstatver.h
rename to sysdeps/unix/sysv/linux/arm/xstatver.h
index d8fd35beb6..8e1801b603 100644
--- a/sysdeps/unix/sysv/linux/generic/xstatver.h
+++ b/sysdeps/unix/sysv/linux/arm/xstatver.h
@@ -1,10 +1,13 @@
 /* Versions of the 'struct stat' data structure used in compatibility xstat
    functions.  */
-#define _STAT_VER_KERNEL	0
-#define _STAT_VER_LINUX		0
-#define _STAT_VER		_STAT_VER_KERNEL
+#define _STAT_VER_LINUX_OLD	1
+#define _STAT_VER_KERNEL	1
+#define _STAT_VER_SVR4		2
+#define _STAT_VER_LINUX		3
+#define _STAT_VER		_STAT_VER_LINUX
 
 /* Versions of the 'xmknod' interface used in compatibility xmknod
    functions.  */
-#define _MKNOD_VER_LINUX	0
+#define _MKNOD_VER_LINUX	1
+#define _MKNOD_VER_SVR4		2
 #define _MKNOD_VER		_MKNOD_VER_LINUX
diff --git a/sysdeps/unix/sysv/linux/hppa/xstatver.h b/sysdeps/unix/sysv/linux/hppa/xstatver.h
new file mode 100644
index 0000000000..8e1801b603
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/hppa/xstatver.h
@@ -0,0 +1,13 @@
+/* Versions of the 'struct stat' data structure used in compatibility xstat
+   functions.  */
+#define _STAT_VER_LINUX_OLD	1
+#define _STAT_VER_KERNEL	1
+#define _STAT_VER_SVR4		2
+#define _STAT_VER_LINUX		3
+#define _STAT_VER		_STAT_VER_LINUX
+
+/* Versions of the 'xmknod' interface used in compatibility xmknod
+   functions.  */
+#define _MKNOD_VER_LINUX	1
+#define _MKNOD_VER_SVR4		2
+#define _MKNOD_VER		_MKNOD_VER_LINUX
diff --git a/sysdeps/unix/sysv/linux/sh/xstatver.h b/sysdeps/unix/sysv/linux/sh/xstatver.h
new file mode 100644
index 0000000000..8e1801b603
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/xstatver.h
@@ -0,0 +1,13 @@
+/* Versions of the 'struct stat' data structure used in compatibility xstat
+   functions.  */
+#define _STAT_VER_LINUX_OLD	1
+#define _STAT_VER_KERNEL	1
+#define _STAT_VER_SVR4		2
+#define _STAT_VER_LINUX		3
+#define _STAT_VER		_STAT_VER_LINUX
+
+/* Versions of the 'xmknod' interface used in compatibility xmknod
+   functions.  */
+#define _MKNOD_VER_LINUX	1
+#define _MKNOD_VER_SVR4		2
+#define _MKNOD_VER		_MKNOD_VER_LINUX
diff --git a/sysdeps/unix/sysv/linux/xstatver.h b/sysdeps/unix/sysv/linux/xstatver.h
index 8e1801b603..d8fd35beb6 100644
--- a/sysdeps/unix/sysv/linux/xstatver.h
+++ b/sysdeps/unix/sysv/linux/xstatver.h
@@ -1,13 +1,10 @@
 /* Versions of the 'struct stat' data structure used in compatibility xstat
    functions.  */
-#define _STAT_VER_LINUX_OLD	1
-#define _STAT_VER_KERNEL	1
-#define _STAT_VER_SVR4		2
-#define _STAT_VER_LINUX		3
-#define _STAT_VER		_STAT_VER_LINUX
+#define _STAT_VER_KERNEL	0
+#define _STAT_VER_LINUX		0
+#define _STAT_VER		_STAT_VER_KERNEL
 
 /* Versions of the 'xmknod' interface used in compatibility xmknod
    functions.  */
-#define _MKNOD_VER_LINUX	1
-#define _MKNOD_VER_SVR4		2
+#define _MKNOD_VER_LINUX	0
 #define _MKNOD_VER		_MKNOD_VER_LINUX
-- 
2.34.1


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

* [PATCH 28/30] Linux: Make generic fcntl.h the default one
  2022-10-19 22:14 [PATCH 00/30] Remove Linux generic sysdep Adhemerval Zanella via Libc-alpha
                   ` (26 preceding siblings ...)
  2022-10-19 22:14 ` [PATCH 27/30] Linux: make generic xstatver.h the default one Adhemerval Zanella via Libc-alpha
@ 2022-10-19 22:14 ` Adhemerval Zanella via Libc-alpha
  2022-12-06 17:36   ` Carlos O'Donell via Libc-alpha
  2022-10-19 22:14 ` [PATCH 29/30] Linux: Consolidate typesizes.h Adhemerval Zanella via Libc-alpha
  2022-10-19 22:14 ` [PATCH 30/30] Linux: Remove generic Implies Adhemerval Zanella via Libc-alpha
  29 siblings, 1 reply; 68+ messages in thread
From: Adhemerval Zanella via Libc-alpha @ 2022-10-19 22:14 UTC (permalink / raw)
  To: libc-alpha

It is currently used for csky, arc, nios2, and or1k.  Newer 64 bit
architecture, like riscv32 and loongarch, reimplement it to override
F_GETLK64/F_SETLK64/F_SETLKW64.
---
 sysdeps/unix/sysv/linux/bits/fcntl.h         | 56 +++++++++++++++++++-
 sysdeps/unix/sysv/linux/generic/bits/fcntl.h | 55 -------------------
 2 files changed, 54 insertions(+), 57 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/generic/bits/fcntl.h

diff --git a/sysdeps/unix/sysv/linux/bits/fcntl.h b/sysdeps/unix/sysv/linux/bits/fcntl.h
index be40350e82..112ee96df5 100644
--- a/sysdeps/unix/sysv/linux/bits/fcntl.h
+++ b/sysdeps/unix/sysv/linux/bits/fcntl.h
@@ -1,3 +1,55 @@
-/* bits/fcntl.h is architecture specific.  */
-#error "This file must be supplied by every Linux architecture."
+/* O_*, F_*, FD_* bit values for the generic Linux ABI.
+   Copyright (C) 2011-2022 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
 
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef	_FCNTL_H
+# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
+#endif
+
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 64
+# define __O_LARGEFILE	0
+#endif
+
+struct flock
+  {
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.	*/
+    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
+#ifndef __USE_FILE_OFFSET64
+    __off_t l_start;	/* Offset where the lock begins.  */
+    __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
+#else
+    __off64_t l_start;	/* Offset where the lock begins.  */
+    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
+#endif
+    __pid_t l_pid;	/* Process holding the lock.  */
+  };
+
+#ifdef __USE_LARGEFILE64
+struct flock64
+  {
+    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.	*/
+    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
+    __off64_t l_start;	/* Offset where the lock begins.  */
+    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
+    __pid_t l_pid;	/* Process holding the lock.  */
+  };
+#endif
+
+/* Include generic Linux declarations.  */
+#include <bits/fcntl-linux.h>
diff --git a/sysdeps/unix/sysv/linux/generic/bits/fcntl.h b/sysdeps/unix/sysv/linux/generic/bits/fcntl.h
deleted file mode 100644
index 112ee96df5..0000000000
--- a/sysdeps/unix/sysv/linux/generic/bits/fcntl.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* O_*, F_*, FD_* bit values for the generic Linux ABI.
-   Copyright (C) 2011-2022 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library.  If not, see
-   <https://www.gnu.org/licenses/>.  */
-
-#ifndef	_FCNTL_H
-# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
-#endif
-
-#include <bits/wordsize.h>
-
-#if __WORDSIZE == 64
-# define __O_LARGEFILE	0
-#endif
-
-struct flock
-  {
-    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.	*/
-    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
-#ifndef __USE_FILE_OFFSET64
-    __off_t l_start;	/* Offset where the lock begins.  */
-    __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
-#else
-    __off64_t l_start;	/* Offset where the lock begins.  */
-    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
-#endif
-    __pid_t l_pid;	/* Process holding the lock.  */
-  };
-
-#ifdef __USE_LARGEFILE64
-struct flock64
-  {
-    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.	*/
-    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
-    __off64_t l_start;	/* Offset where the lock begins.  */
-    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
-    __pid_t l_pid;	/* Process holding the lock.  */
-  };
-#endif
-
-/* Include generic Linux declarations.  */
-#include <bits/fcntl-linux.h>
-- 
2.34.1


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

* [PATCH 29/30] Linux: Consolidate typesizes.h
  2022-10-19 22:14 [PATCH 00/30] Remove Linux generic sysdep Adhemerval Zanella via Libc-alpha
                   ` (27 preceding siblings ...)
  2022-10-19 22:14 ` [PATCH 28/30] Linux: Make generic fcntl.h " Adhemerval Zanella via Libc-alpha
@ 2022-10-19 22:14 ` Adhemerval Zanella via Libc-alpha
  2022-12-06 17:47   ` Carlos O'Donell via Libc-alpha
  2022-10-19 22:14 ` [PATCH 30/30] Linux: Remove generic Implies Adhemerval Zanella via Libc-alpha
  29 siblings, 1 reply; 68+ messages in thread
From: Adhemerval Zanella via Libc-alpha @ 2022-10-19 22:14 UTC (permalink / raw)
  To: libc-alpha

The generic (sysdeps/unix/sysv/linux/generic/bits/typesizes.h) and
default (bits/typesizes.h) differs in two fields:

                    bits/typesizes.h    Linux generic
__NLINK_T_TYPE      __UWORD_TYPE        __U32_TYPE
__BLKSIZE_T_TYPE    __SLONGWORD_TYPE    __S32_TYPE

Sinceit leads to different C++ mangling names, the default typesize.h
is copied for the requires archtiectures and the generic is make the
default Linux one.
---
 sysdeps/unix/sysv/linux/arm/bits/typesizes.h  | 74 +++++++++++++++
 .../sysv/linux/{generic => }/bits/typesizes.h |  0
 sysdeps/unix/sysv/linux/hppa/bits/typesizes.h | 74 +++++++++++++++
 sysdeps/unix/sysv/linux/ia64/bits/typesizes.h | 86 +++++++++++++++++
 sysdeps/unix/sysv/linux/m68k/bits/typesizes.h | 74 +++++++++++++++
 .../sysv/linux/microblaze/bits/typesizes.h    | 74 +++++++++++++++
 sysdeps/unix/sysv/linux/mips/bits/typesizes.h | 95 +++++++++++++++++++
 .../unix/sysv/linux/powerpc/bits/typesizes.h  | 95 +++++++++++++++++++
 sysdeps/unix/sysv/linux/sh/bits/typesizes.h   | 74 +++++++++++++++
 9 files changed, 646 insertions(+)
 create mode 100644 sysdeps/unix/sysv/linux/arm/bits/typesizes.h
 rename sysdeps/unix/sysv/linux/{generic => }/bits/typesizes.h (100%)
 create mode 100644 sysdeps/unix/sysv/linux/hppa/bits/typesizes.h
 create mode 100644 sysdeps/unix/sysv/linux/ia64/bits/typesizes.h
 create mode 100644 sysdeps/unix/sysv/linux/m68k/bits/typesizes.h
 create mode 100644 sysdeps/unix/sysv/linux/microblaze/bits/typesizes.h
 create mode 100644 sysdeps/unix/sysv/linux/mips/bits/typesizes.h
 create mode 100644 sysdeps/unix/sysv/linux/powerpc/bits/typesizes.h
 create mode 100644 sysdeps/unix/sysv/linux/sh/bits/typesizes.h

diff --git a/sysdeps/unix/sysv/linux/arm/bits/typesizes.h b/sysdeps/unix/sysv/linux/arm/bits/typesizes.h
new file mode 100644
index 0000000000..255bf39de3
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/arm/bits/typesizes.h
@@ -0,0 +1,74 @@
+/* bits/typesizes.h -- underlying types for *_t.  ARM version.
+   Copyright (C) 2002-2022 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _BITS_TYPES_H
+# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
+#endif
+
+#ifndef	_BITS_TYPESIZES_H
+#define	_BITS_TYPESIZES_H	1
+
+/* See <bits/types.h> for the meaning of these macros.  This file exists so
+   that <bits/types.h> need not vary across different GNU platforms.  */
+
+#define __DEV_T_TYPE		__UQUAD_TYPE
+#define __UID_T_TYPE		__U32_TYPE
+#define __GID_T_TYPE		__U32_TYPE
+#define __INO_T_TYPE		__ULONGWORD_TYPE
+#define __INO64_T_TYPE		__UQUAD_TYPE
+#define __MODE_T_TYPE		__U32_TYPE
+#define __NLINK_T_TYPE		__UWORD_TYPE
+#define __OFF_T_TYPE		__SLONGWORD_TYPE
+#define __OFF64_T_TYPE		__SQUAD_TYPE
+#define __PID_T_TYPE		__S32_TYPE
+#define __RLIM_T_TYPE		__ULONGWORD_TYPE
+#define __RLIM64_T_TYPE		__UQUAD_TYPE
+#define	__BLKCNT_T_TYPE		__SLONGWORD_TYPE
+#define	__BLKCNT64_T_TYPE	__SQUAD_TYPE
+#define	__FSBLKCNT_T_TYPE	__ULONGWORD_TYPE
+#define	__FSBLKCNT64_T_TYPE	__UQUAD_TYPE
+#define	__FSFILCNT_T_TYPE	__ULONGWORD_TYPE
+#define	__FSFILCNT64_T_TYPE	__UQUAD_TYPE
+#define	__FSWORD_T_TYPE		__SWORD_TYPE
+#define	__ID_T_TYPE		__U32_TYPE
+#define __CLOCK_T_TYPE		__SLONGWORD_TYPE
+#define __TIME_T_TYPE		__SLONGWORD_TYPE
+#define __USECONDS_T_TYPE	__U32_TYPE
+#define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE
+#define __SUSECONDS64_T_TYPE	__SQUAD_TYPE
+#define __DADDR_T_TYPE		__S32_TYPE
+#define __KEY_T_TYPE		__S32_TYPE
+#define __CLOCKID_T_TYPE	__S32_TYPE
+#define __TIMER_T_TYPE		void *
+#define __BLKSIZE_T_TYPE	__SLONGWORD_TYPE
+#define __FSID_T_TYPE		struct { int __val[2]; }
+#define __SSIZE_T_TYPE		__SWORD_TYPE
+#define __SYSCALL_SLONG_TYPE	__SLONGWORD_TYPE
+#define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE
+#define __CPU_MASK_TYPE 	__ULONGWORD_TYPE
+
+#define __RLIM_T_MATCHES_RLIM64_T		0
+#define __STATFS_MATCHES_STATFS64		0
+/* And for getitimer, setitimer and rusage  */
+#define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64	0
+
+/* Number of descriptors that can fit in an `fd_set'.  */
+#define	__FD_SETSIZE		1024
+
+
+#endif /* bits/typesizes.h */
diff --git a/sysdeps/unix/sysv/linux/generic/bits/typesizes.h b/sysdeps/unix/sysv/linux/bits/typesizes.h
similarity index 100%
rename from sysdeps/unix/sysv/linux/generic/bits/typesizes.h
rename to sysdeps/unix/sysv/linux/bits/typesizes.h
diff --git a/sysdeps/unix/sysv/linux/hppa/bits/typesizes.h b/sysdeps/unix/sysv/linux/hppa/bits/typesizes.h
new file mode 100644
index 0000000000..d32e354d36
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/hppa/bits/typesizes.h
@@ -0,0 +1,74 @@
+/* bits/typesizes.h -- underlying types for *_t.  HPPA version.
+   Copyright (C) 2002-2022 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _BITS_TYPES_H
+# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
+#endif
+
+#ifndef	_BITS_TYPESIZES_H
+#define	_BITS_TYPESIZES_H	1
+
+/* See <bits/types.h> for the meaning of these macros.  This file exists so
+   that <bits/types.h> need not vary across different GNU platforms.  */
+
+#define __DEV_T_TYPE		__UQUAD_TYPE
+#define __UID_T_TYPE		__U32_TYPE
+#define __GID_T_TYPE		__U32_TYPE
+#define __INO_T_TYPE		__ULONGWORD_TYPE
+#define __INO64_T_TYPE		__UQUAD_TYPE
+#define __MODE_T_TYPE		__U32_TYPE
+#define __NLINK_T_TYPE		__UWORD_TYPE
+#define __OFF_T_TYPE		__SLONGWORD_TYPE
+#define __OFF64_T_TYPE		__SQUAD_TYPE
+#define __PID_T_TYPE		__S32_TYPE
+#define __RLIM_T_TYPE		__ULONGWORD_TYPE
+#define __RLIM64_T_TYPE		__UQUAD_TYPE
+#define	__BLKCNT_T_TYPE		__SLONGWORD_TYPE
+#define	__BLKCNT64_T_TYPE	__SQUAD_TYPE
+#define	__FSBLKCNT_T_TYPE	__ULONGWORD_TYPE
+#define	__FSBLKCNT64_T_TYPE	__UQUAD_TYPE
+#define	__FSFILCNT_T_TYPE	__ULONGWORD_TYPE
+#define	__FSFILCNT64_T_TYPE	__UQUAD_TYPE
+#define	__FSWORD_T_TYPE		__SWORD_TYPE
+#define	__ID_T_TYPE		__U32_TYPE
+#define __CLOCK_T_TYPE		__SLONGWORD_TYPE
+#define __TIME_T_TYPE		__SLONGWORD_TYPE
+#define __USECONDS_T_TYPE	__U32_TYPE
+#define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE
+#define __SUSECONDS64_T_TYPE	__SQUAD_TYPE
+#define __DADDR_T_TYPE		__S32_TYPE
+#define __KEY_T_TYPE		__S32_TYPE
+#define __CLOCKID_T_TYPE	__S32_TYPE
+#define __TIMER_T_TYPE		void *
+#define __BLKSIZE_T_TYPE	__SLONGWORD_TYPE
+#define __FSID_T_TYPE		struct { int __val[2]; }
+#define __SSIZE_T_TYPE		__SWORD_TYPE
+#define __SYSCALL_SLONG_TYPE	__SLONGWORD_TYPE
+#define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE
+#define __CPU_MASK_TYPE 	__ULONGWORD_TYPE
+
+#define __RLIM_T_MATCHES_RLIM64_T		0
+#define __STATFS_MATCHES_STATFS64		0
+/* And for getitimer, setitimer and rusage  */
+#define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64	0
+
+/* Number of descriptors that can fit in an `fd_set'.  */
+#define	__FD_SETSIZE		1024
+
+
+#endif /* bits/typesizes.h */
diff --git a/sysdeps/unix/sysv/linux/ia64/bits/typesizes.h b/sysdeps/unix/sysv/linux/ia64/bits/typesizes.h
new file mode 100644
index 0000000000..20a2f886cb
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/ia64/bits/typesizes.h
@@ -0,0 +1,86 @@
+/* bits/typesizes.h -- underlying types for *_t.  IA64 version.
+   Copyright (C) 2002-2022 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _BITS_TYPES_H
+# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
+#endif
+
+#ifndef	_BITS_TYPESIZES_H
+#define	_BITS_TYPESIZES_H	1
+
+/* See <bits/types.h> for the meaning of these macros.  This file exists so
+   that <bits/types.h> need not vary across different GNU platforms.  */
+
+#define __DEV_T_TYPE		__UQUAD_TYPE
+#define __UID_T_TYPE		__U32_TYPE
+#define __GID_T_TYPE		__U32_TYPE
+#define __INO_T_TYPE		__ULONGWORD_TYPE
+#define __INO64_T_TYPE		__UQUAD_TYPE
+#define __MODE_T_TYPE		__U32_TYPE
+#define __NLINK_T_TYPE		__UWORD_TYPE
+#define __OFF_T_TYPE		__SLONGWORD_TYPE
+#define __OFF64_T_TYPE		__SQUAD_TYPE
+#define __PID_T_TYPE		__S32_TYPE
+#define __RLIM_T_TYPE		__ULONGWORD_TYPE
+#define __RLIM64_T_TYPE		__UQUAD_TYPE
+#define	__BLKCNT_T_TYPE		__SLONGWORD_TYPE
+#define	__BLKCNT64_T_TYPE	__SQUAD_TYPE
+#define	__FSBLKCNT_T_TYPE	__ULONGWORD_TYPE
+#define	__FSBLKCNT64_T_TYPE	__UQUAD_TYPE
+#define	__FSFILCNT_T_TYPE	__ULONGWORD_TYPE
+#define	__FSFILCNT64_T_TYPE	__UQUAD_TYPE
+#define	__FSWORD_T_TYPE		__SWORD_TYPE
+#define	__ID_T_TYPE		__U32_TYPE
+#define __CLOCK_T_TYPE		__SLONGWORD_TYPE
+#define __TIME_T_TYPE		__SLONGWORD_TYPE
+#define __USECONDS_T_TYPE	__U32_TYPE
+#define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE
+#define __SUSECONDS64_T_TYPE	__SQUAD_TYPE
+#define __DADDR_T_TYPE		__S32_TYPE
+#define __KEY_T_TYPE		__S32_TYPE
+#define __CLOCKID_T_TYPE	__S32_TYPE
+#define __TIMER_T_TYPE		void *
+#define __BLKSIZE_T_TYPE	__SLONGWORD_TYPE
+#define __FSID_T_TYPE		struct { int __val[2]; }
+#define __SSIZE_T_TYPE		__SWORD_TYPE
+#define __SYSCALL_SLONG_TYPE	__SLONGWORD_TYPE
+#define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE
+#define __CPU_MASK_TYPE 	__ULONGWORD_TYPE
+
+/* Tell the libc code that off_t and off64_t are actually the same type
+   for all ABI purposes, even if possibly expressed as different base types
+   for C type-checking purposes.  */
+#define __OFF_T_MATCHES_OFF64_T	1
+
+/* Same for ino_t and ino64_t.  */
+#define __INO_T_MATCHES_INO64_T	1
+
+/* And for rlim_t and rlim64_t.  */
+#define __RLIM_T_MATCHES_RLIM64_T	1
+
+/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t.  */
+#define __STATFS_MATCHES_STATFS64  1
+
+/* And for getitimer, setitimer and rusage  */
+#define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1
+
+/* Number of descriptors that can fit in an `fd_set'.  */
+#define	__FD_SETSIZE		1024
+
+
+#endif /* bits/typesizes.h */
diff --git a/sysdeps/unix/sysv/linux/m68k/bits/typesizes.h b/sysdeps/unix/sysv/linux/m68k/bits/typesizes.h
new file mode 100644
index 0000000000..eeb050200a
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/m68k/bits/typesizes.h
@@ -0,0 +1,74 @@
+/* bits/typesizes.h -- underlying types for *_t.  m68k version.
+   Copyright (C) 2002-2022 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _BITS_TYPES_H
+# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
+#endif
+
+#ifndef	_BITS_TYPESIZES_H
+#define	_BITS_TYPESIZES_H	1
+
+/* See <bits/types.h> for the meaning of these macros.  This file exists so
+   that <bits/types.h> need not vary across different GNU platforms.  */
+
+#define __DEV_T_TYPE		__UQUAD_TYPE
+#define __UID_T_TYPE		__U32_TYPE
+#define __GID_T_TYPE		__U32_TYPE
+#define __INO_T_TYPE		__ULONGWORD_TYPE
+#define __INO64_T_TYPE		__UQUAD_TYPE
+#define __MODE_T_TYPE		__U32_TYPE
+#define __NLINK_T_TYPE		__UWORD_TYPE
+#define __OFF_T_TYPE		__SLONGWORD_TYPE
+#define __OFF64_T_TYPE		__SQUAD_TYPE
+#define __PID_T_TYPE		__S32_TYPE
+#define __RLIM_T_TYPE		__ULONGWORD_TYPE
+#define __RLIM64_T_TYPE		__UQUAD_TYPE
+#define	__BLKCNT_T_TYPE		__SLONGWORD_TYPE
+#define	__BLKCNT64_T_TYPE	__SQUAD_TYPE
+#define	__FSBLKCNT_T_TYPE	__ULONGWORD_TYPE
+#define	__FSBLKCNT64_T_TYPE	__UQUAD_TYPE
+#define	__FSFILCNT_T_TYPE	__ULONGWORD_TYPE
+#define	__FSFILCNT64_T_TYPE	__UQUAD_TYPE
+#define	__FSWORD_T_TYPE		__SWORD_TYPE
+#define	__ID_T_TYPE		__U32_TYPE
+#define __CLOCK_T_TYPE		__SLONGWORD_TYPE
+#define __TIME_T_TYPE		__SLONGWORD_TYPE
+#define __USECONDS_T_TYPE	__U32_TYPE
+#define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE
+#define __SUSECONDS64_T_TYPE	__SQUAD_TYPE
+#define __DADDR_T_TYPE		__S32_TYPE
+#define __KEY_T_TYPE		__S32_TYPE
+#define __CLOCKID_T_TYPE	__S32_TYPE
+#define __TIMER_T_TYPE		void *
+#define __BLKSIZE_T_TYPE	__SLONGWORD_TYPE
+#define __FSID_T_TYPE		struct { int __val[2]; }
+#define __SSIZE_T_TYPE		__SWORD_TYPE
+#define __SYSCALL_SLONG_TYPE	__SLONGWORD_TYPE
+#define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE
+#define __CPU_MASK_TYPE 	__ULONGWORD_TYPE
+
+#define __RLIM_T_MATCHES_RLIM64_T		0
+#define __STATFS_MATCHES_STATFS64		0
+/* And for getitimer, setitimer and rusage  */
+#define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64	0
+
+/* Number of descriptors that can fit in an `fd_set'.  */
+#define	__FD_SETSIZE		1024
+
+
+#endif /* bits/typesizes.h */
diff --git a/sysdeps/unix/sysv/linux/microblaze/bits/typesizes.h b/sysdeps/unix/sysv/linux/microblaze/bits/typesizes.h
new file mode 100644
index 0000000000..4585f506f9
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/microblaze/bits/typesizes.h
@@ -0,0 +1,74 @@
+/* bits/typesizes.h -- underlying types for *_t.  Microblaze version.
+   Copyright (C) 2002-2022 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _BITS_TYPES_H
+# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
+#endif
+
+#ifndef	_BITS_TYPESIZES_H
+#define	_BITS_TYPESIZES_H	1
+
+/* See <bits/types.h> for the meaning of these macros.  This file exists so
+   that <bits/types.h> need not vary across different GNU platforms.  */
+
+#define __DEV_T_TYPE		__UQUAD_TYPE
+#define __UID_T_TYPE		__U32_TYPE
+#define __GID_T_TYPE		__U32_TYPE
+#define __INO_T_TYPE		__ULONGWORD_TYPE
+#define __INO64_T_TYPE		__UQUAD_TYPE
+#define __MODE_T_TYPE		__U32_TYPE
+#define __NLINK_T_TYPE		__UWORD_TYPE
+#define __OFF_T_TYPE		__SLONGWORD_TYPE
+#define __OFF64_T_TYPE		__SQUAD_TYPE
+#define __PID_T_TYPE		__S32_TYPE
+#define __RLIM_T_TYPE		__ULONGWORD_TYPE
+#define __RLIM64_T_TYPE		__UQUAD_TYPE
+#define	__BLKCNT_T_TYPE		__SLONGWORD_TYPE
+#define	__BLKCNT64_T_TYPE	__SQUAD_TYPE
+#define	__FSBLKCNT_T_TYPE	__ULONGWORD_TYPE
+#define	__FSBLKCNT64_T_TYPE	__UQUAD_TYPE
+#define	__FSFILCNT_T_TYPE	__ULONGWORD_TYPE
+#define	__FSFILCNT64_T_TYPE	__UQUAD_TYPE
+#define	__FSWORD_T_TYPE		__SWORD_TYPE
+#define	__ID_T_TYPE		__U32_TYPE
+#define __CLOCK_T_TYPE		__SLONGWORD_TYPE
+#define __TIME_T_TYPE		__SLONGWORD_TYPE
+#define __USECONDS_T_TYPE	__U32_TYPE
+#define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE
+#define __SUSECONDS64_T_TYPE	__SQUAD_TYPE
+#define __DADDR_T_TYPE		__S32_TYPE
+#define __KEY_T_TYPE		__S32_TYPE
+#define __CLOCKID_T_TYPE	__S32_TYPE
+#define __TIMER_T_TYPE		void *
+#define __BLKSIZE_T_TYPE	__SLONGWORD_TYPE
+#define __FSID_T_TYPE		struct { int __val[2]; }
+#define __SSIZE_T_TYPE		__SWORD_TYPE
+#define __SYSCALL_SLONG_TYPE	__SLONGWORD_TYPE
+#define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE
+#define __CPU_MASK_TYPE 	__ULONGWORD_TYPE
+
+#define __RLIM_T_MATCHES_RLIM64_T		0
+#define __STATFS_MATCHES_STATFS64		0
+/* And for getitimer, setitimer and rusage  */
+#define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64	0
+
+/* Number of descriptors that can fit in an `fd_set'.  */
+#define	__FD_SETSIZE		1024
+
+
+#endif /* bits/typesizes.h */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/typesizes.h b/sysdeps/unix/sysv/linux/mips/bits/typesizes.h
new file mode 100644
index 0000000000..7e46d0f53f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/bits/typesizes.h
@@ -0,0 +1,95 @@
+/* bits/typesizes.h -- underlying types for *_t.  MIPS version.
+   Copyright (C) 2002-2022 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _BITS_TYPES_H
+# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
+#endif
+
+#ifndef	_BITS_TYPESIZES_H
+#define	_BITS_TYPESIZES_H	1
+
+/* See <bits/types.h> for the meaning of these macros.  This file exists so
+   that <bits/types.h> need not vary across different GNU platforms.  */
+
+#define __DEV_T_TYPE		__UQUAD_TYPE
+#define __UID_T_TYPE		__U32_TYPE
+#define __GID_T_TYPE		__U32_TYPE
+#define __INO_T_TYPE		__ULONGWORD_TYPE
+#define __INO64_T_TYPE		__UQUAD_TYPE
+#define __MODE_T_TYPE		__U32_TYPE
+#define __NLINK_T_TYPE		__UWORD_TYPE
+#define __OFF_T_TYPE		__SLONGWORD_TYPE
+#define __OFF64_T_TYPE		__SQUAD_TYPE
+#define __PID_T_TYPE		__S32_TYPE
+#define __RLIM_T_TYPE		__ULONGWORD_TYPE
+#define __RLIM64_T_TYPE		__UQUAD_TYPE
+#define	__BLKCNT_T_TYPE		__SLONGWORD_TYPE
+#define	__BLKCNT64_T_TYPE	__SQUAD_TYPE
+#define	__FSBLKCNT_T_TYPE	__ULONGWORD_TYPE
+#define	__FSBLKCNT64_T_TYPE	__UQUAD_TYPE
+#define	__FSFILCNT_T_TYPE	__ULONGWORD_TYPE
+#define	__FSFILCNT64_T_TYPE	__UQUAD_TYPE
+#define	__FSWORD_T_TYPE		__SWORD_TYPE
+#define	__ID_T_TYPE		__U32_TYPE
+#define __CLOCK_T_TYPE		__SLONGWORD_TYPE
+#define __TIME_T_TYPE		__SLONGWORD_TYPE
+#define __USECONDS_T_TYPE	__U32_TYPE
+#define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE
+#define __SUSECONDS64_T_TYPE	__SQUAD_TYPE
+#define __DADDR_T_TYPE		__S32_TYPE
+#define __KEY_T_TYPE		__S32_TYPE
+#define __CLOCKID_T_TYPE	__S32_TYPE
+#define __TIMER_T_TYPE		void *
+#define __BLKSIZE_T_TYPE	__SLONGWORD_TYPE
+#define __FSID_T_TYPE		struct { int __val[2]; }
+#define __SSIZE_T_TYPE		__SWORD_TYPE
+#define __SYSCALL_SLONG_TYPE	__SLONGWORD_TYPE
+#define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE
+#define __CPU_MASK_TYPE 	__ULONGWORD_TYPE
+
+#ifdef __LP64__
+/* Tell the libc code that off_t and off64_t are actually the same type
+   for all ABI purposes, even if possibly expressed as different base types
+   for C type-checking purposes.  */
+# define __OFF_T_MATCHES_OFF64_T	1
+
+/* Same for ino_t and ino64_t.  */
+# define __INO_T_MATCHES_INO64_T	1
+
+/* And for rlim_t and rlim64_t.  */
+# define __RLIM_T_MATCHES_RLIM64_T	1
+
+/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t.  */
+# define __STATFS_MATCHES_STATFS64  1
+
+/* And for getitimer, setitimer and rusage  */
+# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1
+#else
+# define __RLIM_T_MATCHES_RLIM64_T	0
+
+# define __STATFS_MATCHES_STATFS64  0
+
+/* And for getitimer, setitimer and rusage  */
+# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0
+#endif
+
+/* Number of descriptors that can fit in an `fd_set'.  */
+#define	__FD_SETSIZE		1024
+
+
+#endif /* bits/typesizes.h */
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/typesizes.h b/sysdeps/unix/sysv/linux/powerpc/bits/typesizes.h
new file mode 100644
index 0000000000..d2a15df721
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/typesizes.h
@@ -0,0 +1,95 @@
+/* bits/typesizes.h -- underlying types for *_t.  PowerPC version.
+   Copyright (C) 2002-2022 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _BITS_TYPES_H
+# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
+#endif
+
+#ifndef	_BITS_TYPESIZES_H
+#define	_BITS_TYPESIZES_H	1
+
+/* See <bits/types.h> for the meaning of these macros.  This file exists so
+   that <bits/types.h> need not vary across different GNU platforms.  */
+
+#define __DEV_T_TYPE		__UQUAD_TYPE
+#define __UID_T_TYPE		__U32_TYPE
+#define __GID_T_TYPE		__U32_TYPE
+#define __INO_T_TYPE		__ULONGWORD_TYPE
+#define __INO64_T_TYPE		__UQUAD_TYPE
+#define __MODE_T_TYPE		__U32_TYPE
+#define __NLINK_T_TYPE		__UWORD_TYPE
+#define __OFF_T_TYPE		__SLONGWORD_TYPE
+#define __OFF64_T_TYPE		__SQUAD_TYPE
+#define __PID_T_TYPE		__S32_TYPE
+#define __RLIM_T_TYPE		__ULONGWORD_TYPE
+#define __RLIM64_T_TYPE		__UQUAD_TYPE
+#define	__BLKCNT_T_TYPE		__SLONGWORD_TYPE
+#define	__BLKCNT64_T_TYPE	__SQUAD_TYPE
+#define	__FSBLKCNT_T_TYPE	__ULONGWORD_TYPE
+#define	__FSBLKCNT64_T_TYPE	__UQUAD_TYPE
+#define	__FSFILCNT_T_TYPE	__ULONGWORD_TYPE
+#define	__FSFILCNT64_T_TYPE	__UQUAD_TYPE
+#define	__FSWORD_T_TYPE		__SWORD_TYPE
+#define	__ID_T_TYPE		__U32_TYPE
+#define __CLOCK_T_TYPE		__SLONGWORD_TYPE
+#define __TIME_T_TYPE		__SLONGWORD_TYPE
+#define __USECONDS_T_TYPE	__U32_TYPE
+#define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE
+#define __SUSECONDS64_T_TYPE	__SQUAD_TYPE
+#define __DADDR_T_TYPE		__S32_TYPE
+#define __KEY_T_TYPE		__S32_TYPE
+#define __CLOCKID_T_TYPE	__S32_TYPE
+#define __TIMER_T_TYPE		void *
+#define __BLKSIZE_T_TYPE	__SLONGWORD_TYPE
+#define __FSID_T_TYPE		struct { int __val[2]; }
+#define __SSIZE_T_TYPE		__SWORD_TYPE
+#define __SYSCALL_SLONG_TYPE	__SLONGWORD_TYPE
+#define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE
+#define __CPU_MASK_TYPE 	__ULONGWORD_TYPE
+
+#ifdef __LP64__
+/* Tell the libc code that off_t and off64_t are actually the same type
+   for all ABI purposes, even if possibly expressed as different base types
+   for C type-checking purposes.  */
+# define __OFF_T_MATCHES_OFF64_T	1
+
+/* Same for ino_t and ino64_t.  */
+# define __INO_T_MATCHES_INO64_T	1
+
+/* And for rlim_t and rlim64_t.  */
+# define __RLIM_T_MATCHES_RLIM64_T	1
+
+/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t.  */
+# define __STATFS_MATCHES_STATFS64  1
+
+/* And for getitimer, setitimer and rusage  */
+# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1
+#else
+# define __RLIM_T_MATCHES_RLIM64_T	0
+
+# define __STATFS_MATCHES_STATFS64  0
+
+/* And for getitimer, setitimer and rusage  */
+# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0
+#endif
+
+/* Number of descriptors that can fit in an `fd_set'.  */
+#define	__FD_SETSIZE		1024
+
+
+#endif /* bits/typesizes.h */
diff --git a/sysdeps/unix/sysv/linux/sh/bits/typesizes.h b/sysdeps/unix/sysv/linux/sh/bits/typesizes.h
new file mode 100644
index 0000000000..ab1ac9ea9c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sh/bits/typesizes.h
@@ -0,0 +1,74 @@
+/* bits/typesizes.h -- underlying types for *_t.  SH version.
+   Copyright (C) 2002-2022 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _BITS_TYPES_H
+# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
+#endif
+
+#ifndef	_BITS_TYPESIZES_H
+#define	_BITS_TYPESIZES_H	1
+
+/* See <bits/types.h> for the meaning of these macros.  This file exists so
+   that <bits/types.h> need not vary across different GNU platforms.  */
+
+#define __DEV_T_TYPE		__UQUAD_TYPE
+#define __UID_T_TYPE		__U32_TYPE
+#define __GID_T_TYPE		__U32_TYPE
+#define __INO_T_TYPE		__ULONGWORD_TYPE
+#define __INO64_T_TYPE		__UQUAD_TYPE
+#define __MODE_T_TYPE		__U32_TYPE
+#define __NLINK_T_TYPE		__UWORD_TYPE
+#define __OFF_T_TYPE		__SLONGWORD_TYPE
+#define __OFF64_T_TYPE		__SQUAD_TYPE
+#define __PID_T_TYPE		__S32_TYPE
+#define __RLIM_T_TYPE		__ULONGWORD_TYPE
+#define __RLIM64_T_TYPE		__UQUAD_TYPE
+#define	__BLKCNT_T_TYPE		__SLONGWORD_TYPE
+#define	__BLKCNT64_T_TYPE	__SQUAD_TYPE
+#define	__FSBLKCNT_T_TYPE	__ULONGWORD_TYPE
+#define	__FSBLKCNT64_T_TYPE	__UQUAD_TYPE
+#define	__FSFILCNT_T_TYPE	__ULONGWORD_TYPE
+#define	__FSFILCNT64_T_TYPE	__UQUAD_TYPE
+#define	__FSWORD_T_TYPE		__SWORD_TYPE
+#define	__ID_T_TYPE		__U32_TYPE
+#define __CLOCK_T_TYPE		__SLONGWORD_TYPE
+#define __TIME_T_TYPE		__SLONGWORD_TYPE
+#define __USECONDS_T_TYPE	__U32_TYPE
+#define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE
+#define __SUSECONDS64_T_TYPE	__SQUAD_TYPE
+#define __DADDR_T_TYPE		__S32_TYPE
+#define __KEY_T_TYPE		__S32_TYPE
+#define __CLOCKID_T_TYPE	__S32_TYPE
+#define __TIMER_T_TYPE		void *
+#define __BLKSIZE_T_TYPE	__SLONGWORD_TYPE
+#define __FSID_T_TYPE		struct { int __val[2]; }
+#define __SSIZE_T_TYPE		__SWORD_TYPE
+#define __SYSCALL_SLONG_TYPE	__SLONGWORD_TYPE
+#define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE
+#define __CPU_MASK_TYPE 	__ULONGWORD_TYPE
+
+#define __RLIM_T_MATCHES_RLIM64_T		0
+#define __STATFS_MATCHES_STATFS64		0
+/* And for getitimer, setitimer and rusage  */
+#define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64	0
+
+/* Number of descriptors that can fit in an `fd_set'.  */
+#define	__FD_SETSIZE		1024
+
+
+#endif /* bits/typesizes.h */
-- 
2.34.1


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

* [PATCH 30/30] Linux: Remove generic Implies
  2022-10-19 22:14 [PATCH 00/30] Remove Linux generic sysdep Adhemerval Zanella via Libc-alpha
                   ` (28 preceding siblings ...)
  2022-10-19 22:14 ` [PATCH 29/30] Linux: Consolidate typesizes.h Adhemerval Zanella via Libc-alpha
@ 2022-10-19 22:14 ` Adhemerval Zanella via Libc-alpha
  2022-12-06 17:50   ` Carlos O'Donell via Libc-alpha
  29 siblings, 1 reply; 68+ messages in thread
From: Adhemerval Zanella via Libc-alpha @ 2022-10-19 22:14 UTC (permalink / raw)
  To: libc-alpha

The default Linux implementation already handled the Linux generic
ABIs interface used on newer architectures, so there is no need to
Imply the generic any longer.
---
 sysdeps/unix/sysv/linux/aarch64/Implies        |  1 -
 sysdeps/unix/sysv/linux/arc/Implies            |  2 --
 sysdeps/unix/sysv/linux/csky/Implies           |  2 --
 sysdeps/unix/sysv/linux/generic/README         | 11 -----------
 sysdeps/unix/sysv/linux/loongarch/lp64/Implies |  1 -
 sysdeps/unix/sysv/linux/nios2/Implies          |  2 --
 sysdeps/unix/sysv/linux/or1k/Implies           |  2 --
 sysdeps/unix/sysv/linux/riscv/rv32/Implies     |  2 --
 sysdeps/unix/sysv/linux/riscv/rv64/Implies     |  1 -
 9 files changed, 24 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/generic/README

diff --git a/sysdeps/unix/sysv/linux/aarch64/Implies b/sysdeps/unix/sysv/linux/aarch64/Implies
index 4409e19b92..9c2d2c9870 100644
--- a/sysdeps/unix/sysv/linux/aarch64/Implies
+++ b/sysdeps/unix/sysv/linux/aarch64/Implies
@@ -1,3 +1,2 @@
 aarch64/nptl
-unix/sysv/linux/generic
 unix/sysv/linux/wordsize-64
diff --git a/sysdeps/unix/sysv/linux/arc/Implies b/sysdeps/unix/sysv/linux/arc/Implies
index 7f739a0340..5c1698c045 100644
--- a/sysdeps/unix/sysv/linux/arc/Implies
+++ b/sysdeps/unix/sysv/linux/arc/Implies
@@ -1,3 +1 @@
 arc/nptl
-unix/sysv/linux/generic/wordsize-32
-unix/sysv/linux/generic
diff --git a/sysdeps/unix/sysv/linux/csky/Implies b/sysdeps/unix/sysv/linux/csky/Implies
index f37776ccef..2259772947 100644
--- a/sysdeps/unix/sysv/linux/csky/Implies
+++ b/sysdeps/unix/sysv/linux/csky/Implies
@@ -1,3 +1 @@
-unix/sysv/linux/generic/wordsize-32
-unix/sysv/linux/generic
 csky/nptl
diff --git a/sysdeps/unix/sysv/linux/generic/README b/sysdeps/unix/sysv/linux/generic/README
deleted file mode 100644
index 301a6107e1..0000000000
--- a/sysdeps/unix/sysv/linux/generic/README
+++ /dev/null
@@ -1,11 +0,0 @@
-This hierarchy supports Linux systems using the new
-asm-generic/unistd.h, which removes many familiar old syscalls.  For
-example, to implement open(), newer Linux architectures require glibc
-to invoke the __NR_openat syscall with AT_FDCWD.  This hierarchy
-provides all those implementations.
-
-It also provides support for 32-bit platforms using the 64-bit kernel
-syscall APIs, as the 32-bit ones are no longer provided.  Note that
-newer ILP32 environments (x32 or AArch64:ILP32, for example) are
-converting to use more 64-bit types in kernel syscalls, so that aspect
-of this support is in more flux as of this writing.
diff --git a/sysdeps/unix/sysv/linux/loongarch/lp64/Implies b/sysdeps/unix/sysv/linux/loongarch/lp64/Implies
index 117c2b8efe..e0390cc3bf 100644
--- a/sysdeps/unix/sysv/linux/loongarch/lp64/Implies
+++ b/sysdeps/unix/sysv/linux/loongarch/lp64/Implies
@@ -1,3 +1,2 @@
 unix/sysv/linux/loongarch
-unix/sysv/linux/generic
 unix/sysv/linux/wordsize-64
diff --git a/sysdeps/unix/sysv/linux/nios2/Implies b/sysdeps/unix/sysv/linux/nios2/Implies
index 4d0478bf8f..e6c9be4665 100644
--- a/sysdeps/unix/sysv/linux/nios2/Implies
+++ b/sysdeps/unix/sysv/linux/nios2/Implies
@@ -1,3 +1 @@
 nios2/nptl
-unix/sysv/linux/generic/wordsize-32
-unix/sysv/linux/generic
diff --git a/sysdeps/unix/sysv/linux/or1k/Implies b/sysdeps/unix/sysv/linux/or1k/Implies
index f39f16c04a..07f8e71adc 100644
--- a/sysdeps/unix/sysv/linux/or1k/Implies
+++ b/sysdeps/unix/sysv/linux/or1k/Implies
@@ -1,3 +1 @@
 or1k/nptl
-unix/sysv/linux/generic/wordsize-32
-unix/sysv/linux/generic
diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/Implies b/sysdeps/unix/sysv/linux/riscv/rv32/Implies
index 8b7deb33cd..83db34c5d5 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv32/Implies
+++ b/sysdeps/unix/sysv/linux/riscv/rv32/Implies
@@ -1,3 +1 @@
 unix/sysv/linux/riscv
-unix/sysv/linux/generic/wordsize-32
-unix/sysv/linux/generic
diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/Implies b/sysdeps/unix/sysv/linux/riscv/rv64/Implies
index f042343bf7..2f9ad9ff94 100644
--- a/sysdeps/unix/sysv/linux/riscv/rv64/Implies
+++ b/sysdeps/unix/sysv/linux/riscv/rv64/Implies
@@ -1,3 +1,2 @@
 unix/sysv/linux/riscv
-unix/sysv/linux/generic
 unix/sysv/linux/wordsize-64
-- 
2.34.1


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

* Re: [PATCH 22/30] Linux: Assume and consolidate getsockname wire-up syscall
  2022-10-19 22:14 ` [PATCH 22/30] Linux: Assume and consolidate getsockname " Adhemerval Zanella via Libc-alpha
@ 2022-10-20  0:01   ` Joseph Myers
  2022-10-20 18:12     ` Adhemerval Zanella Netto via Libc-alpha
  2022-12-06 16:18   ` Carlos O'Donell via Libc-alpha
  1 sibling, 1 reply; 68+ messages in thread
From: Joseph Myers @ 2022-10-20  0:01 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha

On Wed, 19 Oct 2022, Adhemerval Zanella via Libc-alpha wrote:

> And disable if kernel does not support it.

How did you determine what #undefs to add?  I'd have expected a #undef for 
32-bit SPARC at least (where getpeername and getsockname were only added 
to the compat syscall table for SPARC in 4.20 (Linux commit 
1f2b5b8e2df4591fbca430aff9c5a072dcc0f408)).

-- 
Joseph S. Myers
joseph@codesourcery.com

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

* Re: [PATCH 23/30] Linux: Assume and consolidate getpeername wire-up syscall
  2022-10-19 22:14 ` [PATCH 23/30] Linux: Assume and consolidate getpeername " Adhemerval Zanella via Libc-alpha
@ 2022-10-20  0:02   ` Joseph Myers
  2022-12-06 16:20   ` Carlos O'Donell via Libc-alpha
  1 sibling, 0 replies; 68+ messages in thread
From: Joseph Myers @ 2022-10-20  0:02 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha

On Wed, 19 Oct 2022, Adhemerval Zanella via Libc-alpha wrote:

> And disable if kernel does not support it.

The same comment applies as for getsockname: I'd have expected a #undef 
for 32-bit SPARC before kernel 4.20.

-- 
Joseph S. Myers
joseph@codesourcery.com

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

* Re: [PATCH 22/30] Linux: Assume and consolidate getsockname wire-up syscall
  2022-10-20  0:01   ` Joseph Myers
@ 2022-10-20 18:12     ` Adhemerval Zanella Netto via Libc-alpha
  0 siblings, 0 replies; 68+ messages in thread
From: Adhemerval Zanella Netto via Libc-alpha @ 2022-10-20 18:12 UTC (permalink / raw)
  To: Joseph Myers; +Cc: libc-alpha



On 19/10/22 21:01, Joseph Myers wrote:
> On Wed, 19 Oct 2022, Adhemerval Zanella via Libc-alpha wrote:
> 
>> And disable if kernel does not support it.
> 
> How did you determine what #undefs to add?  I'd have expected a #undef for 
> 32-bit SPARC at least (where getpeername and getsockname were only added 
> to the compat syscall table for SPARC in 4.20 (Linux commit 
> 1f2b5b8e2df4591fbca430aff9c5a072dcc0f408)).
> 

I wrongly assumed the comments on sparc kernel-features.h for socket support
was up to date, which does not seems the case. I check the kernel history and
fix it.

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

* Re: [PATCH 06/30] Lninux: consolidate epoll_create implementation
  2022-10-19 22:14 ` [PATCH 06/30] Lninux: consolidate epoll_create implementation Adhemerval Zanella via Libc-alpha
@ 2022-10-21  8:57   ` Florian Weimer via Libc-alpha
  2022-12-05 16:40   ` Carlos O'Donell via Libc-alpha
  1 sibling, 0 replies; 68+ messages in thread
From: Florian Weimer via Libc-alpha @ 2022-10-21  8:57 UTC (permalink / raw)
  To: Adhemerval Zanella via Libc-alpha

* Adhemerval Zanella via Libc-alpha:

> Use epoll_create syscall if defined, otherwise use epoll_create1.

Warning: Typo in commit subject.  Patch looks okay.

Reviewed-by: Florian Weimer <fweimer@redhat.com>

Thanks,
Florian


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

* Re: [PATCH 01/30] linux: Fix generic struct_stat for 64 bit time (BZ# 29657)
  2022-10-19 22:14 ` [PATCH 01/30] linux: Fix generic struct_stat for 64 bit time (BZ# 29657) Adhemerval Zanella via Libc-alpha
@ 2022-10-25 17:50   ` Joseph Myers
  2022-12-05 16:39   ` Carlos O'Donell via Libc-alpha
  1 sibling, 0 replies; 68+ messages in thread
From: Joseph Myers @ 2022-10-25 17:50 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha

On Wed, 19 Oct 2022, Adhemerval Zanella via Libc-alpha wrote:

> The generic Linux struct_stat misses the conditionals to use
> bits/struct_stat_time64_helper.h in the __USE_TIME_BITS64 for
> architecture that uses __TIMESIZE == 32 (currently csky and nios2).
> 
> Since newer ports should not support 32 bit time_t, the generic
> implementation should be used as default.
> 
> For arm, hppa, and sh a copy of default struct_stat is added,
> while for cky and nios a new one based on generic is used, along
> with conditionals to use bits/struct_stat_time64_helper.h.
> 
> The default struct_stat is also replaced with the generic one.
> 
> Checked on aarch64-linux-gnu and arm-linux-gnueabihf.

OK (with s/cky/csky/ in the commit message).

-- 
Joseph S. Myers
joseph@codesourcery.com

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

* Re: [PATCH 01/30] linux: Fix generic struct_stat for 64 bit time (BZ# 29657)
  2022-10-19 22:14 ` [PATCH 01/30] linux: Fix generic struct_stat for 64 bit time (BZ# 29657) Adhemerval Zanella via Libc-alpha
  2022-10-25 17:50   ` Joseph Myers
@ 2022-12-05 16:39   ` Carlos O'Donell via Libc-alpha
  1 sibling, 0 replies; 68+ messages in thread
From: Carlos O'Donell via Libc-alpha @ 2022-12-05 16:39 UTC (permalink / raw)
  To: Adhemerval Zanella, libc-alpha

On 10/19/22 18:14, Adhemerval Zanella via Libc-alpha wrote:
> The generic Linux struct_stat misses the conditionals to use
> bits/struct_stat_time64_helper.h in the __USE_TIME_BITS64 for
> architecture that uses __TIMESIZE == 32 (currently csky and nios2).
> 
> Since newer ports should not support 32 bit time_t, the generic
> implementation should be used as default.

Agreed.
 
> For arm, hppa, and sh a copy of default struct_stat is added,
> while for cky and nios a new one based on generic is used, along
> with conditionals to use bits/struct_stat_time64_helper.h.
> 
> The default struct_stat is also replaced with the generic one.
> 
> Checked on aarch64-linux-gnu and arm-linux-gnueabihf.

LGTM.

No regressions on x86_64 and i686.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>

> ---
>  .../unix/sysv/linux/arm/bits/struct_stat.h    | 139 ++++++++++++++++++
>  sysdeps/unix/sysv/linux/bits/struct_stat.h    | 116 +++++++--------
>  .../{generic => csky}/bits/struct_stat.h      |  28 ++--
>  .../unix/sysv/linux/hppa/bits/struct_stat.h   | 139 ++++++++++++++++++
>  .../unix/sysv/linux/nios2/bits/struct_stat.h  | 135 +++++++++++++++++
>  sysdeps/unix/sysv/linux/sh/bits/struct_stat.h | 139 ++++++++++++++++++
>  6 files changed, 622 insertions(+), 74 deletions(-)
>  create mode 100644 sysdeps/unix/sysv/linux/arm/bits/struct_stat.h
>  rename sysdeps/unix/sysv/linux/{generic => csky}/bits/struct_stat.h (92%)
>  create mode 100644 sysdeps/unix/sysv/linux/hppa/bits/struct_stat.h
>  create mode 100644 sysdeps/unix/sysv/linux/nios2/bits/struct_stat.h
>  create mode 100644 sysdeps/unix/sysv/linux/sh/bits/struct_stat.h
> 
> diff --git a/sysdeps/unix/sysv/linux/arm/bits/struct_stat.h b/sysdeps/unix/sysv/linux/arm/bits/struct_stat.h
> new file mode 100644
> index 0000000000..30ee6279d2
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/arm/bits/struct_stat.h
> @@ -0,0 +1,139 @@
> +/* Definition for struct stat.  Linux/arm version.
> +   Copyright (C) 2020-2022 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library.  If not, see
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#if !defined _SYS_STAT_H && !defined _FCNTL_H
> +# error "Never include <bits/struct_stat.h> directly; use <sys/stat.h> instead."
> +#endif
> +
> +#ifndef _BITS_STRUCT_STAT_H
> +#define _BITS_STRUCT_STAT_H	1
> +
> +#include <bits/endian.h>
> +#include <bits/wordsize.h>
> +
> +struct stat
> +  {
> +#ifdef __USE_TIME_BITS64
> +# include <bits/struct_stat_time64_helper.h>
> +#else
> +    __dev_t st_dev;			/* Device.  */
> +    unsigned short int __pad1;
> +# ifndef __USE_FILE_OFFSET64
> +    __ino_t st_ino;			/* File serial number.	*/
> +# else
> +    __ino_t __st_ino;			/* 32bit file serial number.	*/
> +# endif
> +    __mode_t st_mode;			/* File mode.  */
> +    __nlink_t st_nlink;			/* Link count.  */
> +    __uid_t st_uid;			/* User ID of the file's owner.	*/
> +    __gid_t st_gid;			/* Group ID of the file's group.*/
> +    __dev_t st_rdev;			/* Device number, if device.  */
> +    unsigned short int __pad2;
> +# ifndef __USE_FILE_OFFSET64
> +    __off_t st_size;			/* Size of file, in bytes.  */
> +# else
> +    __off64_t st_size;			/* Size of file, in bytes.  */
> +# endif
> +    __blksize_t st_blksize;		/* Optimal block size for I/O.  */
> +
> +# ifndef __USE_FILE_OFFSET64
> +    __blkcnt_t st_blocks;		/* Number 512-byte blocks allocated. */
> +# else
> +    __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
> +# endif
> +# ifdef __USE_XOPEN2K8
> +    /* Nanosecond resolution timestamps are stored in a format
> +       equivalent to 'struct timespec'.  This is the type used
> +       whenever possible but the Unix namespace rules do not allow the
> +       identifier 'timespec' to appear in the <sys/stat.h> header.
> +       Therefore we have to handle the use of this header in strictly
> +       standard-compliant sources special.  */
> +    struct timespec st_atim;		/* Time of last access.  */
> +    struct timespec st_mtim;		/* Time of last modification.  */
> +    struct timespec st_ctim;		/* Time of last status change.  */
> +#  define st_atime st_atim.tv_sec	/* Backward compatibility.  */
> +#  define st_mtime st_mtim.tv_sec
> +#  define st_ctime st_ctim.tv_sec
> +# else
> +    __time_t st_atime;			/* Time of last access.  */
> +    unsigned long int st_atimensec;	/* Nscecs of last access.  */
> +    __time_t st_mtime;			/* Time of last modification.  */
> +    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
> +    __time_t st_ctime;			/* Time of last status change.  */
> +    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
> +# endif
> +# ifndef __USE_FILE_OFFSET64
> +    unsigned long int __glibc_reserved4;
> +    unsigned long int __glibc_reserved5;
> +# else
> +    __ino64_t st_ino;			/* File serial number.	*/
> +# endif
> +#endif /* __USE_TIME_BITS64  */
> +  };
> +
> +#ifdef __USE_LARGEFILE64
> +struct stat64
> +  {
> +# ifdef __USE_TIME_BITS64
> +#  include <bits/struct_stat_time64_helper.h>
> +# else
> +    __dev_t st_dev;			/* Device.  */
> +    unsigned int __pad1;
> +
> +    __ino_t __st_ino;			/* 32bit file serial number.	*/
> +    __mode_t st_mode;			/* File mode.  */
> +    __nlink_t st_nlink;			/* Link count.  */
> +    __uid_t st_uid;			/* User ID of the file's owner.	*/
> +    __gid_t st_gid;			/* Group ID of the file's group.*/
> +    __dev_t st_rdev;			/* Device number, if device.  */
> +    unsigned int __pad2;
> +    __off64_t st_size;			/* Size of file, in bytes.  */
> +    __blksize_t st_blksize;		/* Optimal block size for I/O.  */
> +
> +    __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
> +#  ifdef __USE_XOPEN2K8
> +    /* Nanosecond resolution timestamps are stored in a format
> +       equivalent to 'struct timespec'.  This is the type used
> +       whenever possible but the Unix namespace rules do not allow the
> +       identifier 'timespec' to appear in the <sys/stat.h> header.
> +       Therefore we have to handle the use of this header in strictly
> +       standard-compliant sources special.  */
> +    struct timespec st_atim;		/* Time of last access.  */
> +    struct timespec st_mtim;		/* Time of last modification.  */
> +    struct timespec st_ctim;		/* Time of last status change.  */
> +#  else
> +    __time_t st_atime;			/* Time of last access.  */
> +    unsigned long int st_atimensec;	/* Nscecs of last access.  */
> +    __time_t st_mtime;			/* Time of last modification.  */
> +    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
> +    __time_t st_ctime;			/* Time of last status change.  */
> +    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
> +#  endif
> +    __ino64_t st_ino;			/* File serial number.		*/
> +# endif /* __USE_TIME_BITS64  */
> +  };
> +#endif
> +
> +/* Tell code we have these members.  */
> +#define	_STATBUF_ST_BLKSIZE
> +#define _STATBUF_ST_RDEV
> +/* Nanosecond resolution time values are supported.  */
> +#define _STATBUF_ST_NSEC
> +
> +
> +#endif /* _BITS_STRUCT_STAT_H  */
> diff --git a/sysdeps/unix/sysv/linux/bits/struct_stat.h b/sysdeps/unix/sysv/linux/bits/struct_stat.h
> index 25bd6cb638..fb11a3fba4 100644
> --- a/sysdeps/unix/sysv/linux/bits/struct_stat.h
> +++ b/sysdeps/unix/sysv/linux/bits/struct_stat.h
> @@ -26,37 +26,36 @@
>  #include <bits/endian.h>
>  #include <bits/wordsize.h>
>  
> -struct stat
> -  {
> -#ifdef __USE_TIME_BITS64
> -# include <bits/struct_stat_time64_helper.h>
> -#else
> -    __dev_t st_dev;			/* Device.  */
> -    unsigned short int __pad1;
> -# ifndef __USE_FILE_OFFSET64
> -    __ino_t st_ino;			/* File serial number.	*/
> -# else
> -    __ino_t __st_ino;			/* 32bit file serial number.	*/
> +#if defined __USE_FILE_OFFSET64
> +# define __field64(type, type64, name) type64 name
> +#elif __WORDSIZE == 64 || defined __INO_T_MATCHES_INO64_T
> +# if defined __INO_T_MATCHES_INO64_T && !defined __OFF_T_MATCHES_OFF64_T
> +#  error "ino_t and off_t must both be the same type"
>  # endif
> -    __mode_t st_mode;			/* File mode.  */
> -    __nlink_t st_nlink;			/* Link count.  */
> -    __uid_t st_uid;			/* User ID of the file's owner.	*/
> -    __gid_t st_gid;			/* Group ID of the file's group.*/
> -    __dev_t st_rdev;			/* Device number, if device.  */
> -    unsigned short int __pad2;
> -# ifndef __USE_FILE_OFFSET64
> -    __off_t st_size;			/* Size of file, in bytes.  */
> -# else
> -    __off64_t st_size;			/* Size of file, in bytes.  */
> -# endif
> -    __blksize_t st_blksize;		/* Optimal block size for I/O.  */
> +# define __field64(type, type64, name) type name
> +#elif __BYTE_ORDER == __LITTLE_ENDIAN
> +# define __field64(type, type64, name) \
> +  type name __attribute__((__aligned__ (__alignof__ (type64)))); int __##name##_pad
> +#else
> +# define __field64(type, type64, name) \
> +  int __##name##_pad __attribute__((__aligned__ (__alignof__ (type64)))); type name
> +#endif
>  
> -# ifndef __USE_FILE_OFFSET64
> -    __blkcnt_t st_blocks;		/* Number 512-byte blocks allocated. */
> -# else
> -    __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
> -# endif
> -# ifdef __USE_XOPEN2K8
> +struct stat
> +  {
> +    __dev_t st_dev;		/* Device.  */
> +    __field64(__ino_t, __ino64_t, st_ino);  /* File serial number. */
> +    __mode_t st_mode;		/* File mode.  */
> +    __nlink_t st_nlink;		/* Link count.  */
> +    __uid_t st_uid;		/* User ID of the file's owner.	*/
> +    __gid_t st_gid;		/* Group ID of the file's group.*/
> +    __dev_t st_rdev;		/* Device number, if device.  */
> +    __dev_t __pad1;
> +    __field64(__off_t, __off64_t, st_size);  /* Size of file, in bytes. */
> +    __blksize_t st_blksize;	/* Optimal block size for I/O.  */
> +    int __pad2;
> +    __field64(__blkcnt_t, __blkcnt64_t, st_blocks);  /* 512-byte blocks */
> +#ifdef __USE_XOPEN2K8
>      /* Nanosecond resolution timestamps are stored in a format
>         equivalent to 'struct timespec'.  This is the type used
>         whenever possible but the Unix namespace rules do not allow the
> @@ -66,47 +65,38 @@ struct stat
>      struct timespec st_atim;		/* Time of last access.  */
>      struct timespec st_mtim;		/* Time of last modification.  */
>      struct timespec st_ctim;		/* Time of last status change.  */
> -#  define st_atime st_atim.tv_sec	/* Backward compatibility.  */
> -#  define st_mtime st_mtim.tv_sec
> -#  define st_ctime st_ctim.tv_sec
> -# else
> +# define st_atime st_atim.tv_sec	/* Backward compatibility.  */
> +# define st_mtime st_mtim.tv_sec
> +# define st_ctime st_ctim.tv_sec
> +#else
>      __time_t st_atime;			/* Time of last access.  */
>      unsigned long int st_atimensec;	/* Nscecs of last access.  */
>      __time_t st_mtime;			/* Time of last modification.  */
>      unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
>      __time_t st_ctime;			/* Time of last status change.  */
>      unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
> -# endif
> -# ifndef __USE_FILE_OFFSET64
> -    unsigned long int __glibc_reserved4;
> -    unsigned long int __glibc_reserved5;
> -# else
> -    __ino64_t st_ino;			/* File serial number.	*/
> -# endif
> -#endif /* __USE_TIME_BITS64  */
> +#endif
> +    int __glibc_reserved[2];
>    };
>  
> +#undef __field64
> +
>  #ifdef __USE_LARGEFILE64
>  struct stat64
>    {
> -# ifdef __USE_TIME_BITS64
> -#  include <bits/struct_stat_time64_helper.h>
> -# else
> -    __dev_t st_dev;			/* Device.  */
> -    unsigned int __pad1;
> -
> -    __ino_t __st_ino;			/* 32bit file serial number.	*/
> -    __mode_t st_mode;			/* File mode.  */
> -    __nlink_t st_nlink;			/* Link count.  */
> -    __uid_t st_uid;			/* User ID of the file's owner.	*/
> -    __gid_t st_gid;			/* Group ID of the file's group.*/
> -    __dev_t st_rdev;			/* Device number, if device.  */
> -    unsigned int __pad2;
> -    __off64_t st_size;			/* Size of file, in bytes.  */
> -    __blksize_t st_blksize;		/* Optimal block size for I/O.  */
> -
> -    __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
> -#  ifdef __USE_XOPEN2K8
> +    __dev_t st_dev;		/* Device.  */
> +    __ino64_t st_ino;		/* File serial number.	*/
> +    __mode_t st_mode;		/* File mode.  */
> +    __nlink_t st_nlink;		/* Link count.  */
> +    __uid_t st_uid;		/* User ID of the file's owner.	*/
> +    __gid_t st_gid;		/* Group ID of the file's group.*/
> +    __dev_t st_rdev;		/* Device number, if device.  */
> +    __dev_t __pad1;
> +    __off64_t st_size;		/* Size of file, in bytes.  */
> +    __blksize_t st_blksize;	/* Optimal block size for I/O.  */
> +    int __pad2;
> +    __blkcnt64_t st_blocks;	/* Nr. 512-byte blocks allocated.  */
> +#ifdef __USE_XOPEN2K8
>      /* Nanosecond resolution timestamps are stored in a format
>         equivalent to 'struct timespec'.  This is the type used
>         whenever possible but the Unix namespace rules do not allow the
> @@ -116,16 +106,15 @@ struct stat64
>      struct timespec st_atim;		/* Time of last access.  */
>      struct timespec st_mtim;		/* Time of last modification.  */
>      struct timespec st_ctim;		/* Time of last status change.  */
> -#  else
> +#else
>      __time_t st_atime;			/* Time of last access.  */
>      unsigned long int st_atimensec;	/* Nscecs of last access.  */
>      __time_t st_mtime;			/* Time of last modification.  */
>      unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
>      __time_t st_ctime;			/* Time of last status change.  */
>      unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
> -#  endif
> -    __ino64_t st_ino;			/* File serial number.		*/
> -# endif /* __USE_TIME_BITS64  */
> +#endif
> +    int __glibc_reserved[2];
>    };
>  #endif
>  
> @@ -135,5 +124,4 @@ struct stat64
>  /* Nanosecond resolution time values are supported.  */
>  #define _STATBUF_ST_NSEC
>  
> -
>  #endif /* _BITS_STRUCT_STAT_H  */
> diff --git a/sysdeps/unix/sysv/linux/generic/bits/struct_stat.h b/sysdeps/unix/sysv/linux/csky/bits/struct_stat.h
> similarity index 92%
> rename from sysdeps/unix/sysv/linux/generic/bits/struct_stat.h
> rename to sysdeps/unix/sysv/linux/csky/bits/struct_stat.h
> index fb11a3fba4..f0ee455748 100644
> --- a/sysdeps/unix/sysv/linux/generic/bits/struct_stat.h
> +++ b/sysdeps/unix/sysv/linux/csky/bits/struct_stat.h
> @@ -1,4 +1,4 @@
> -/* Definition for struct stat.
> +/* Definition for struct stat.  Linux/csky version.
>     Copyright (C) 2020-2022 Free Software Foundation, Inc.
>     This file is part of the GNU C Library.
>  
> @@ -43,6 +43,9 @@
>  
>  struct stat
>    {
> +#ifdef __USE_TIME_BITS64
> +# include <bits/struct_stat_time64_helper.h>
> +#else
>      __dev_t st_dev;		/* Device.  */
>      __field64(__ino_t, __ino64_t, st_ino);  /* File serial number. */
>      __mode_t st_mode;		/* File mode.  */
> @@ -55,7 +58,7 @@ struct stat
>      __blksize_t st_blksize;	/* Optimal block size for I/O.  */
>      int __pad2;
>      __field64(__blkcnt_t, __blkcnt64_t, st_blocks);  /* 512-byte blocks */
> -#ifdef __USE_XOPEN2K8
> +# ifdef __USE_XOPEN2K8
>      /* Nanosecond resolution timestamps are stored in a format
>         equivalent to 'struct timespec'.  This is the type used
>         whenever possible but the Unix namespace rules do not allow the
> @@ -65,18 +68,19 @@ struct stat
>      struct timespec st_atim;		/* Time of last access.  */
>      struct timespec st_mtim;		/* Time of last modification.  */
>      struct timespec st_ctim;		/* Time of last status change.  */
> -# define st_atime st_atim.tv_sec	/* Backward compatibility.  */
> -# define st_mtime st_mtim.tv_sec
> -# define st_ctime st_ctim.tv_sec
> -#else
> +#  define st_atime st_atim.tv_sec	/* Backward compatibility.  */
> +#  define st_mtime st_mtim.tv_sec
> +#  define st_ctime st_ctim.tv_sec
> +# else
>      __time_t st_atime;			/* Time of last access.  */
>      unsigned long int st_atimensec;	/* Nscecs of last access.  */
>      __time_t st_mtime;			/* Time of last modification.  */
>      unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
>      __time_t st_ctime;			/* Time of last status change.  */
>      unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
> -#endif
> +# endif
>      int __glibc_reserved[2];
> +#endif
>    };
>  
>  #undef __field64
> @@ -84,6 +88,9 @@ struct stat
>  #ifdef __USE_LARGEFILE64
>  struct stat64
>    {
> +# ifdef __USE_TIME_BITS64
> +#  include <bits/struct_stat_time64_helper.h>
> +# else
>      __dev_t st_dev;		/* Device.  */
>      __ino64_t st_ino;		/* File serial number.	*/
>      __mode_t st_mode;		/* File mode.  */
> @@ -96,7 +103,7 @@ struct stat64
>      __blksize_t st_blksize;	/* Optimal block size for I/O.  */
>      int __pad2;
>      __blkcnt64_t st_blocks;	/* Nr. 512-byte blocks allocated.  */
> -#ifdef __USE_XOPEN2K8
> +#  ifdef __USE_XOPEN2K8
>      /* Nanosecond resolution timestamps are stored in a format
>         equivalent to 'struct timespec'.  This is the type used
>         whenever possible but the Unix namespace rules do not allow the
> @@ -106,15 +113,16 @@ struct stat64
>      struct timespec st_atim;		/* Time of last access.  */
>      struct timespec st_mtim;		/* Time of last modification.  */
>      struct timespec st_ctim;		/* Time of last status change.  */
> -#else
> +#  else
>      __time_t st_atime;			/* Time of last access.  */
>      unsigned long int st_atimensec;	/* Nscecs of last access.  */
>      __time_t st_mtime;			/* Time of last modification.  */
>      unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
>      __time_t st_ctime;			/* Time of last status change.  */
>      unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
> -#endif
> +#  endif
>      int __glibc_reserved[2];
> +# endif
>    };
>  #endif
>  
> diff --git a/sysdeps/unix/sysv/linux/hppa/bits/struct_stat.h b/sysdeps/unix/sysv/linux/hppa/bits/struct_stat.h
> new file mode 100644
> index 0000000000..38b6e13e68
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/hppa/bits/struct_stat.h
> @@ -0,0 +1,139 @@
> +/* Definition for struct stat.  Linux/hppa version.
> +   Copyright (C) 2020-2022 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library.  If not, see
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#if !defined _SYS_STAT_H && !defined _FCNTL_H
> +# error "Never include <bits/struct_stat.h> directly; use <sys/stat.h> instead."
> +#endif
> +
> +#ifndef _BITS_STRUCT_STAT_H
> +#define _BITS_STRUCT_STAT_H	1
> +
> +#include <bits/endian.h>
> +#include <bits/wordsize.h>
> +
> +struct stat
> +  {
> +#ifdef __USE_TIME_BITS64
> +# include <bits/struct_stat_time64_helper.h>
> +#else
> +    __dev_t st_dev;			/* Device.  */
> +    unsigned short int __pad1;
> +# ifndef __USE_FILE_OFFSET64
> +    __ino_t st_ino;			/* File serial number.	*/
> +# else
> +    __ino_t __st_ino;			/* 32bit file serial number.	*/
> +# endif
> +    __mode_t st_mode;			/* File mode.  */
> +    __nlink_t st_nlink;			/* Link count.  */
> +    __uid_t st_uid;			/* User ID of the file's owner.	*/
> +    __gid_t st_gid;			/* Group ID of the file's group.*/
> +    __dev_t st_rdev;			/* Device number, if device.  */
> +    unsigned short int __pad2;
> +# ifndef __USE_FILE_OFFSET64
> +    __off_t st_size;			/* Size of file, in bytes.  */
> +# else
> +    __off64_t st_size;			/* Size of file, in bytes.  */
> +# endif
> +    __blksize_t st_blksize;		/* Optimal block size for I/O.  */
> +
> +# ifndef __USE_FILE_OFFSET64
> +    __blkcnt_t st_blocks;		/* Number 512-byte blocks allocated. */
> +# else
> +    __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
> +# endif
> +# ifdef __USE_XOPEN2K8
> +    /* Nanosecond resolution timestamps are stored in a format
> +       equivalent to 'struct timespec'.  This is the type used
> +       whenever possible but the Unix namespace rules do not allow the
> +       identifier 'timespec' to appear in the <sys/stat.h> header.
> +       Therefore we have to handle the use of this header in strictly
> +       standard-compliant sources special.  */
> +    struct timespec st_atim;		/* Time of last access.  */
> +    struct timespec st_mtim;		/* Time of last modification.  */
> +    struct timespec st_ctim;		/* Time of last status change.  */
> +#  define st_atime st_atim.tv_sec	/* Backward compatibility.  */
> +#  define st_mtime st_mtim.tv_sec
> +#  define st_ctime st_ctim.tv_sec
> +# else
> +    __time_t st_atime;			/* Time of last access.  */
> +    unsigned long int st_atimensec;	/* Nscecs of last access.  */
> +    __time_t st_mtime;			/* Time of last modification.  */
> +    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
> +    __time_t st_ctime;			/* Time of last status change.  */
> +    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
> +# endif
> +# ifndef __USE_FILE_OFFSET64
> +    unsigned long int __glibc_reserved4;
> +    unsigned long int __glibc_reserved5;
> +# else
> +    __ino64_t st_ino;			/* File serial number.	*/
> +# endif
> +#endif /* __USE_TIME_BITS64  */
> +  };
> +
> +#ifdef __USE_LARGEFILE64
> +struct stat64
> +  {
> +# ifdef __USE_TIME_BITS64
> +#  include <bits/struct_stat_time64_helper.h>
> +# else
> +    __dev_t st_dev;			/* Device.  */
> +    unsigned int __pad1;
> +
> +    __ino_t __st_ino;			/* 32bit file serial number.	*/
> +    __mode_t st_mode;			/* File mode.  */
> +    __nlink_t st_nlink;			/* Link count.  */
> +    __uid_t st_uid;			/* User ID of the file's owner.	*/
> +    __gid_t st_gid;			/* Group ID of the file's group.*/
> +    __dev_t st_rdev;			/* Device number, if device.  */
> +    unsigned int __pad2;
> +    __off64_t st_size;			/* Size of file, in bytes.  */
> +    __blksize_t st_blksize;		/* Optimal block size for I/O.  */
> +
> +    __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
> +#  ifdef __USE_XOPEN2K8
> +    /* Nanosecond resolution timestamps are stored in a format
> +       equivalent to 'struct timespec'.  This is the type used
> +       whenever possible but the Unix namespace rules do not allow the
> +       identifier 'timespec' to appear in the <sys/stat.h> header.
> +       Therefore we have to handle the use of this header in strictly
> +       standard-compliant sources special.  */
> +    struct timespec st_atim;		/* Time of last access.  */
> +    struct timespec st_mtim;		/* Time of last modification.  */
> +    struct timespec st_ctim;		/* Time of last status change.  */
> +#  else
> +    __time_t st_atime;			/* Time of last access.  */
> +    unsigned long int st_atimensec;	/* Nscecs of last access.  */
> +    __time_t st_mtime;			/* Time of last modification.  */
> +    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
> +    __time_t st_ctime;			/* Time of last status change.  */
> +    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
> +#  endif
> +    __ino64_t st_ino;			/* File serial number.		*/
> +# endif /* __USE_TIME_BITS64  */
> +  };
> +#endif
> +
> +/* Tell code we have these members.  */
> +#define	_STATBUF_ST_BLKSIZE
> +#define _STATBUF_ST_RDEV
> +/* Nanosecond resolution time values are supported.  */
> +#define _STATBUF_ST_NSEC
> +
> +
> +#endif /* _BITS_STRUCT_STAT_H  */
> diff --git a/sysdeps/unix/sysv/linux/nios2/bits/struct_stat.h b/sysdeps/unix/sysv/linux/nios2/bits/struct_stat.h
> new file mode 100644
> index 0000000000..e00e71173e
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/nios2/bits/struct_stat.h
> @@ -0,0 +1,135 @@
> +/* Definition for struct stat.  Linux/nios2 version.
> +   Copyright (C) 2020-2022 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library.  If not, see
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#if !defined _SYS_STAT_H && !defined _FCNTL_H
> +# error "Never include <bits/struct_stat.h> directly; use <sys/stat.h> instead."
> +#endif
> +
> +#ifndef _BITS_STRUCT_STAT_H
> +#define _BITS_STRUCT_STAT_H	1
> +
> +#include <bits/endian.h>
> +#include <bits/wordsize.h>
> +
> +#if defined __USE_FILE_OFFSET64
> +# define __field64(type, type64, name) type64 name
> +#elif __WORDSIZE == 64 || defined __INO_T_MATCHES_INO64_T
> +# if defined __INO_T_MATCHES_INO64_T && !defined __OFF_T_MATCHES_OFF64_T
> +#  error "ino_t and off_t must both be the same type"
> +# endif
> +# define __field64(type, type64, name) type name
> +#elif __BYTE_ORDER == __LITTLE_ENDIAN
> +# define __field64(type, type64, name) \
> +  type name __attribute__((__aligned__ (__alignof__ (type64)))); int __##name##_pad
> +#else
> +# define __field64(type, type64, name) \
> +  int __##name##_pad __attribute__((__aligned__ (__alignof__ (type64)))); type name
> +#endif
> +
> +struct stat
> +  {
> +#ifdef __USE_TIME_BITS64
> +# include <bits/struct_stat_time64_helper.h>
> +#else
> +    __dev_t st_dev;		/* Device.  */
> +    __field64(__ino_t, __ino64_t, st_ino);  /* File serial number. */
> +    __mode_t st_mode;		/* File mode.  */
> +    __nlink_t st_nlink;		/* Link count.  */
> +    __uid_t st_uid;		/* User ID of the file's owner.	*/
> +    __gid_t st_gid;		/* Group ID of the file's group.*/
> +    __dev_t st_rdev;		/* Device number, if device.  */
> +    __dev_t __pad1;
> +    __field64(__off_t, __off64_t, st_size);  /* Size of file, in bytes. */
> +    __blksize_t st_blksize;	/* Optimal block size for I/O.  */
> +    int __pad2;
> +    __field64(__blkcnt_t, __blkcnt64_t, st_blocks);  /* 512-byte blocks */
> +# ifdef __USE_XOPEN2K8
> +    /* Nanosecond resolution timestamps are stored in a format
> +       equivalent to 'struct timespec'.  This is the type used
> +       whenever possible but the Unix namespace rules do not allow the
> +       identifier 'timespec' to appear in the <sys/stat.h> header.
> +       Therefore we have to handle the use of this header in strictly
> +       standard-compliant sources special.  */
> +    struct timespec st_atim;		/* Time of last access.  */
> +    struct timespec st_mtim;		/* Time of last modification.  */
> +    struct timespec st_ctim;		/* Time of last status change.  */
> +#  define st_atime st_atim.tv_sec	/* Backward compatibility.  */
> +#  define st_mtime st_mtim.tv_sec
> +#  define st_ctime st_ctim.tv_sec
> +# else
> +    __time_t st_atime;			/* Time of last access.  */
> +    unsigned long int st_atimensec;	/* Nscecs of last access.  */
> +    __time_t st_mtime;			/* Time of last modification.  */
> +    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
> +    __time_t st_ctime;			/* Time of last status change.  */
> +    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
> +# endif
> +    int __glibc_reserved[2];
> +#endif
> +  };
> +
> +#undef __field64
> +
> +#ifdef __USE_LARGEFILE64
> +struct stat64
> +  {
> +# ifdef __USE_TIME_BITS64
> +#  include <bits/struct_stat_time64_helper.h>
> +# else
> +    __dev_t st_dev;		/* Device.  */
> +    __ino64_t st_ino;		/* File serial number.	*/
> +    __mode_t st_mode;		/* File mode.  */
> +    __nlink_t st_nlink;		/* Link count.  */
> +    __uid_t st_uid;		/* User ID of the file's owner.	*/
> +    __gid_t st_gid;		/* Group ID of the file's group.*/
> +    __dev_t st_rdev;		/* Device number, if device.  */
> +    __dev_t __pad1;
> +    __off64_t st_size;		/* Size of file, in bytes.  */
> +    __blksize_t st_blksize;	/* Optimal block size for I/O.  */
> +    int __pad2;
> +    __blkcnt64_t st_blocks;	/* Nr. 512-byte blocks allocated.  */
> +#  ifdef __USE_XOPEN2K8
> +    /* Nanosecond resolution timestamps are stored in a format
> +       equivalent to 'struct timespec'.  This is the type used
> +       whenever possible but the Unix namespace rules do not allow the
> +       identifier 'timespec' to appear in the <sys/stat.h> header.
> +       Therefore we have to handle the use of this header in strictly
> +       standard-compliant sources special.  */
> +    struct timespec st_atim;		/* Time of last access.  */
> +    struct timespec st_mtim;		/* Time of last modification.  */
> +    struct timespec st_ctim;		/* Time of last status change.  */
> +#  else
> +    __time_t st_atime;			/* Time of last access.  */
> +    unsigned long int st_atimensec;	/* Nscecs of last access.  */
> +    __time_t st_mtime;			/* Time of last modification.  */
> +    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
> +    __time_t st_ctime;			/* Time of last status change.  */
> +    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
> +#  endif
> +    int __glibc_reserved[2];
> +# endif
> +  };
> +#endif
> +
> +/* Tell code we have these members.  */
> +#define	_STATBUF_ST_BLKSIZE
> +#define _STATBUF_ST_RDEV
> +/* Nanosecond resolution time values are supported.  */
> +#define _STATBUF_ST_NSEC
> +
> +#endif /* _BITS_STRUCT_STAT_H  */
> diff --git a/sysdeps/unix/sysv/linux/sh/bits/struct_stat.h b/sysdeps/unix/sysv/linux/sh/bits/struct_stat.h
> new file mode 100644
> index 0000000000..0f7c9cdc89
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/sh/bits/struct_stat.h
> @@ -0,0 +1,139 @@
> +/* Definition for struct stat.  Linux/sh version.
> +   Copyright (C) 2020-2022 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library.  If not, see
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#if !defined _SYS_STAT_H && !defined _FCNTL_H
> +# error "Never include <bits/struct_stat.h> directly; use <sys/stat.h> instead."
> +#endif
> +
> +#ifndef _BITS_STRUCT_STAT_H
> +#define _BITS_STRUCT_STAT_H	1
> +
> +#include <bits/endian.h>
> +#include <bits/wordsize.h>
> +
> +struct stat
> +  {
> +#ifdef __USE_TIME_BITS64
> +# include <bits/struct_stat_time64_helper.h>
> +#else
> +    __dev_t st_dev;			/* Device.  */
> +    unsigned short int __pad1;
> +# ifndef __USE_FILE_OFFSET64
> +    __ino_t st_ino;			/* File serial number.	*/
> +# else
> +    __ino_t __st_ino;			/* 32bit file serial number.	*/
> +# endif
> +    __mode_t st_mode;			/* File mode.  */
> +    __nlink_t st_nlink;			/* Link count.  */
> +    __uid_t st_uid;			/* User ID of the file's owner.	*/
> +    __gid_t st_gid;			/* Group ID of the file's group.*/
> +    __dev_t st_rdev;			/* Device number, if device.  */
> +    unsigned short int __pad2;
> +# ifndef __USE_FILE_OFFSET64
> +    __off_t st_size;			/* Size of file, in bytes.  */
> +# else
> +    __off64_t st_size;			/* Size of file, in bytes.  */
> +# endif
> +    __blksize_t st_blksize;		/* Optimal block size for I/O.  */
> +
> +# ifndef __USE_FILE_OFFSET64
> +    __blkcnt_t st_blocks;		/* Number 512-byte blocks allocated. */
> +# else
> +    __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
> +# endif
> +# ifdef __USE_XOPEN2K8
> +    /* Nanosecond resolution timestamps are stored in a format
> +       equivalent to 'struct timespec'.  This is the type used
> +       whenever possible but the Unix namespace rules do not allow the
> +       identifier 'timespec' to appear in the <sys/stat.h> header.
> +       Therefore we have to handle the use of this header in strictly
> +       standard-compliant sources special.  */
> +    struct timespec st_atim;		/* Time of last access.  */
> +    struct timespec st_mtim;		/* Time of last modification.  */
> +    struct timespec st_ctim;		/* Time of last status change.  */
> +#  define st_atime st_atim.tv_sec	/* Backward compatibility.  */
> +#  define st_mtime st_mtim.tv_sec
> +#  define st_ctime st_ctim.tv_sec
> +# else
> +    __time_t st_atime;			/* Time of last access.  */
> +    unsigned long int st_atimensec;	/* Nscecs of last access.  */
> +    __time_t st_mtime;			/* Time of last modification.  */
> +    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
> +    __time_t st_ctime;			/* Time of last status change.  */
> +    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
> +# endif
> +# ifndef __USE_FILE_OFFSET64
> +    unsigned long int __glibc_reserved4;
> +    unsigned long int __glibc_reserved5;
> +# else
> +    __ino64_t st_ino;			/* File serial number.	*/
> +# endif
> +#endif /* __USE_TIME_BITS64  */
> +  };
> +
> +#ifdef __USE_LARGEFILE64
> +struct stat64
> +  {
> +# ifdef __USE_TIME_BITS64
> +#  include <bits/struct_stat_time64_helper.h>
> +# else
> +    __dev_t st_dev;			/* Device.  */
> +    unsigned int __pad1;
> +
> +    __ino_t __st_ino;			/* 32bit file serial number.	*/
> +    __mode_t st_mode;			/* File mode.  */
> +    __nlink_t st_nlink;			/* Link count.  */
> +    __uid_t st_uid;			/* User ID of the file's owner.	*/
> +    __gid_t st_gid;			/* Group ID of the file's group.*/
> +    __dev_t st_rdev;			/* Device number, if device.  */
> +    unsigned int __pad2;
> +    __off64_t st_size;			/* Size of file, in bytes.  */
> +    __blksize_t st_blksize;		/* Optimal block size for I/O.  */
> +
> +    __blkcnt64_t st_blocks;		/* Number 512-byte blocks allocated. */
> +#  ifdef __USE_XOPEN2K8
> +    /* Nanosecond resolution timestamps are stored in a format
> +       equivalent to 'struct timespec'.  This is the type used
> +       whenever possible but the Unix namespace rules do not allow the
> +       identifier 'timespec' to appear in the <sys/stat.h> header.
> +       Therefore we have to handle the use of this header in strictly
> +       standard-compliant sources special.  */
> +    struct timespec st_atim;		/* Time of last access.  */
> +    struct timespec st_mtim;		/* Time of last modification.  */
> +    struct timespec st_ctim;		/* Time of last status change.  */
> +#  else
> +    __time_t st_atime;			/* Time of last access.  */
> +    unsigned long int st_atimensec;	/* Nscecs of last access.  */
> +    __time_t st_mtime;			/* Time of last modification.  */
> +    unsigned long int st_mtimensec;	/* Nsecs of last modification.  */
> +    __time_t st_ctime;			/* Time of last status change.  */
> +    unsigned long int st_ctimensec;	/* Nsecs of last status change.  */
> +#  endif
> +    __ino64_t st_ino;			/* File serial number.		*/
> +# endif /* __USE_TIME_BITS64  */
> +  };
> +#endif
> +
> +/* Tell code we have these members.  */
> +#define	_STATBUF_ST_BLKSIZE
> +#define _STATBUF_ST_RDEV
> +/* Nanosecond resolution time values are supported.  */
> +#define _STATBUF_ST_NSEC
> +
> +
> +#endif /* _BITS_STRUCT_STAT_H  */

-- 
Cheers,
Carlos.


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

* Re: [PATCH 19/30] Linux: Assume iand consolidate socket wire-up syscall
  2022-10-19 22:14 ` [PATCH 19/30] Linux: Assume iand consolidate socket " Adhemerval Zanella via Libc-alpha
@ 2022-12-05 16:39   ` Carlos O'Donell via Libc-alpha
  0 siblings, 0 replies; 68+ messages in thread
From: Carlos O'Donell via Libc-alpha @ 2022-12-05 16:39 UTC (permalink / raw)
  To: Adhemerval Zanella, libc-alpha

On 10/19/22 18:14, Adhemerval Zanella via Libc-alpha wrote:
> And disable if kernel does not support it.

LGTM.

No regressions on x86_64 and i686.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
 
> Checked on x86_64-linux-gnu and i686-linux-gnu.
> ---
>  sysdeps/unix/sysv/linux/generic/syscalls.list        | 1 -
>  sysdeps/unix/sysv/linux/i386/kernel-features.h       | 2 +-
>  sysdeps/unix/sysv/linux/kernel-features.h            | 1 +
>  sysdeps/unix/sysv/linux/m68k/kernel-features.h       | 2 +-
>  sysdeps/unix/sysv/linux/microblaze/kernel-features.h | 1 -
>  sysdeps/unix/sysv/linux/powerpc/kernel-features.h    | 1 -
>  sysdeps/unix/sysv/linux/s390/kernel-features.h       | 2 +-
>  sysdeps/unix/sysv/linux/sh/kernel-features.h         | 1 -
>  sysdeps/unix/sysv/linux/socket.c                     | 7 +------
>  sysdeps/unix/sysv/linux/sparc/kernel-features.h      | 1 -
>  10 files changed, 5 insertions(+), 14 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
> index 889b62bbea..e5a62811a5 100644
> --- a/sysdeps/unix/sysv/linux/generic/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
> @@ -1,7 +1,6 @@
>  # File name	Caller	Syscall name	# args	Strong name	Weak names
>  
>  # Socket APIs
> -socket		-	socket		i:iii	__socket	socket
>  socketpair	-	socketpair	i:iiif	__socketpair	socketpair
>  listen		-	listen		i:ii	__listen	listen
>  getsockname	-	getsockname	i:ipp	__getsockname	getsockname
> diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
> index babb0ff83d..4c2f1eb8f5 100644
> --- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
> @@ -19,7 +19,6 @@
>  
>  /* Direct socketcalls available with kernel 4.3.  */
>  #if __LINUX_KERNEL_VERSION >= 0x040300
> -# define __ASSUME_SOCKET_SYSCALL             1
>  # define __ASSUME_SOCKETPAIR_SYSCALL         1
>  # define __ASSUME_LISTEN_SYSCALL             1
>  # define __ASSUME_GETSOCKNAME_SYSCALL        1
> @@ -41,6 +40,7 @@
>  # undef __ASSUME_GETSOCKOPT_SYSCALL
>  # undef __ASSUME_SETSOCKOPT_SYSCALL
>  # undef __ASSUME_BIND_SYSCALL
> +# undef __ASSUME_SOCKET_SYSCALL
>  #endif
>  
>  /* i686 only supports ipc syscall before 5.1.  */
> diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
> index 3dc93f5b11..a42b70c85b 100644
> --- a/sysdeps/unix/sysv/linux/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/kernel-features.h
> @@ -80,6 +80,7 @@
>  #define __ASSUME_GETSOCKOPT_SYSCALL	1
>  #define __ASSUME_SETSOCKOPT_SYSCALL	1
>  #define __ASSUME_BIND_SYSCALL		1
> +#define __ASSUME_SOCKET_SYSCALL		1
>  
>  /* Support for SysV IPC through wired syscalls.  All supported architectures
>     either support ipc syscall and/or all the ipc correspondent syscalls.  */
> diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> index 37209378b9..38ffbdbaed 100644
> --- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> @@ -19,7 +19,6 @@
>  
>  /* Direct socketcalls available with kernel 4.3.  */
>  #if __LINUX_KERNEL_VERSION >= 0x040300
> -# define __ASSUME_SOCKET_SYSCALL             1
>  # define __ASSUME_SOCKETPAIR_SYSCALL         1
>  # define __ASSUME_LISTEN_SYSCALL             1
>  # define __ASSUME_GETSOCKNAME_SYSCALL        1
> @@ -43,6 +42,7 @@
>  # undef __ASSUME_GETSOCKOPT_SYSCALL
>  # undef __ASSUME_SETSOCKOPT_SYSCALL
>  # undef __ASSUME_BIND_SYSCALL
> +# undef __ASSUME_SOCKET_SYSCALL
>  #endif
>  
>  /* No support for PI futexes or robust mutexes before 3.10 for m68k.  */
> diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
> index 7fff6dd902..389dd146b4 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
> @@ -18,7 +18,6 @@
>  #include <endian.h>
>  
>  /* All supported kernel versions for MicroBlaze have these syscalls.  */
> -#define __ASSUME_SOCKET_SYSCALL		1
>  #define __ASSUME_CONNECT_SYSCALL	1
>  #define __ASSUME_LISTEN_SYSCALL		1
>  #define __ASSUME_GETSOCKNAME_SYSCALL	1
> diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
> index af4555bb1d..9ee1dc2bc7 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
> @@ -18,7 +18,6 @@
>     <https://www.gnu.org/licenses/>.  */
>  
>  /* New syscalls added for PowerPC in 2.6.37.  */
> -#define __ASSUME_SOCKET_SYSCALL	1
>  #define __ASSUME_CONNECT_SYSCALL	1
>  #define __ASSUME_LISTEN_SYSCALL		1
>  #define __ASSUME_GETSOCKNAME_SYSCALL	1
> diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
> index ae8dc626b2..d5991b265b 100644
> --- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
> @@ -19,7 +19,6 @@
>  
>  /* Direct socketcalls available with kernel 4.3.  */
>  #if __LINUX_KERNEL_VERSION >= 0x040300
> -# define __ASSUME_SOCKET_SYSCALL             1
>  # define __ASSUME_SOCKETPAIR_SYSCALL         1
>  # define __ASSUME_LISTEN_SYSCALL             1
>  # define __ASSUME_GETSOCKNAME_SYSCALL        1
> @@ -43,6 +42,7 @@
>  # undef __ASSUME_GETSOCKOPT_SYSCALL
>  # undef __ASSUME_SETSOCKOPT_SYSCALL
>  # undef __ASSUME_BIND_SYSCALL
> +# undef __ASSUME_SOCKET_SYSCALL
>  #endif
>  
>  /* s390 only supports ipc syscall before 5.1.  */
> diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
> index 2883da92b2..3b57eb7f27 100644
> --- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
> @@ -23,7 +23,6 @@
>  #include <endian.h>
>  
>  /* These syscalls were added for SH in 2.6.37.  */
> -#define __ASSUME_SOCKET_SYSCALL		1
>  #define __ASSUME_CONNECT_SYSCALL	1
>  #define __ASSUME_LISTEN_SYSCALL		1
>  #define __ASSUME_GETSOCKNAME_SYSCALL	1
> diff --git a/sysdeps/unix/sysv/linux/socket.c b/sysdeps/unix/sysv/linux/socket.c
> index 0fc7a61d06..0258fff872 100644
> --- a/sysdeps/unix/sysv/linux/socket.c
> +++ b/sysdeps/unix/sysv/linux/socket.c
> @@ -15,19 +15,14 @@
>     License along with the GNU C Library; if not, see
>     <https://www.gnu.org/licenses/>.  */
>  
> -#include <errno.h>
> -#include <signal.h>
>  #include <sys/socket.h>
> -
>  #include <socketcall.h>
> -#include <kernel-features.h>
> -#include <sys/syscall.h>
>  
>  int
>  __socket (int fd, int type, int domain)
>  {
>  #ifdef __ASSUME_SOCKET_SYSCALL
> -  return INLINE_SYSCALL (socket, 3, fd, type, domain);
> +  return INLINE_SYSCALL_CALL (socket, fd, type, domain);
>  #else
>    return SOCKETCALL (socket, fd, type, domain);
>  #endif
> diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
> index 2b7056c0fb..f3a5ef6a99 100644
> --- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
> @@ -41,7 +41,6 @@
>  # undef __ASSUME_GETSOCKOPT_SYSCALL
>  # undef __ASSUME_SETSOCKOPT_SYSCALL
>  #else
> -# define __ASSUME_SOCKET_SYSCALL             1
>  # define __ASSUME_SOCKETPAIR_SYSCALL         1
>  # define __ASSUME_SHUTDOWN_SYSCALL           1
>  #endif

-- 
Cheers,
Carlos.


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

* Re: [PATCH 18/30] Linux: Assume and consolidate bind wire-up syscall
  2022-10-19 22:14 ` [PATCH 18/30] Linux: Assume and consolidate bind wire-up syscall Adhemerval Zanella via Libc-alpha
@ 2022-12-05 16:39   ` Carlos O'Donell via Libc-alpha
  0 siblings, 0 replies; 68+ messages in thread
From: Carlos O'Donell via Libc-alpha @ 2022-12-05 16:39 UTC (permalink / raw)
  To: Adhemerval Zanella, libc-alpha

On 10/19/22 18:14, Adhemerval Zanella via Libc-alpha wrote:
> And disable if kernel does not support it.
> 
> Checked on x86_64-linux-gnu and i686-linux-gnu.

LGTM.

No regressions on x86_64 and i686.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>

> ---
>  sysdeps/unix/sysv/linux/bind.c                       | 7 +------
>  sysdeps/unix/sysv/linux/generic/syscalls.list        | 1 -
>  sysdeps/unix/sysv/linux/i386/kernel-features.h       | 2 +-
>  sysdeps/unix/sysv/linux/kernel-features.h            | 1 +
>  sysdeps/unix/sysv/linux/m68k/kernel-features.h       | 2 +-
>  sysdeps/unix/sysv/linux/microblaze/kernel-features.h | 1 -
>  sysdeps/unix/sysv/linux/powerpc/kernel-features.h    | 1 -
>  sysdeps/unix/sysv/linux/s390/kernel-features.h       | 2 +-
>  sysdeps/unix/sysv/linux/sh/kernel-features.h         | 1 -
>  sysdeps/unix/sysv/linux/sparc/kernel-features.h      | 5 ++++-
>  10 files changed, 9 insertions(+), 14 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/bind.c b/sysdeps/unix/sysv/linux/bind.c
> index 83992a5dbd..97a42c497f 100644
> --- a/sysdeps/unix/sysv/linux/bind.c
> +++ b/sysdeps/unix/sysv/linux/bind.c
> @@ -15,19 +15,14 @@
>     License along with the GNU C Library; if not, see
>     <https://www.gnu.org/licenses/>.  */
>  
> -#include <errno.h>
> -#include <signal.h>
>  #include <sys/socket.h>
> -
>  #include <socketcall.h>
> -#include <kernel-features.h>
> -#include <sys/syscall.h>
>  
>  int
>  __bind (int fd, __CONST_SOCKADDR_ARG addr, socklen_t len)
>  {
>  #ifdef __ASSUME_BIND_SYSCALL
> -  return INLINE_SYSCALL (bind, 3, fd, addr.__sockaddr__, len);
> +  return INLINE_SYSCALL_CALL (bind, fd, addr.__sockaddr__, len);

OK.

>  #else
>    return SOCKETCALL (bind, fd, addr.__sockaddr__, len, 0, 0, 0);
>  #endif
> diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
> index f573f27c8b..889b62bbea 100644
> --- a/sysdeps/unix/sysv/linux/generic/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
> @@ -3,7 +3,6 @@
>  # Socket APIs
>  socket		-	socket		i:iii	__socket	socket
>  socketpair	-	socketpair	i:iiif	__socketpair	socketpair
> -bind		-	bind		i:ipi	__bind		bind

OK. C wrapper always present.

>  listen		-	listen		i:ii	__listen	listen
>  getsockname	-	getsockname	i:ipp	__getsockname	getsockname
>  getpeername	-	getpeername	i:ipp	__getpeername	getpeername
> diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
> index 87d610cd66..babb0ff83d 100644
> --- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
> @@ -21,7 +21,6 @@
>  #if __LINUX_KERNEL_VERSION >= 0x040300
>  # define __ASSUME_SOCKET_SYSCALL             1
>  # define __ASSUME_SOCKETPAIR_SYSCALL         1
> -# define __ASSUME_BIND_SYSCALL               1

OK.

>  # define __ASSUME_LISTEN_SYSCALL             1
>  # define __ASSUME_GETSOCKNAME_SYSCALL        1
>  # define __ASSUME_GETPEERNAME_SYSCALL        1
> @@ -41,6 +40,7 @@
>  # undef __ASSUME_SENDTO_SYSCALL
>  # undef __ASSUME_GETSOCKOPT_SYSCALL
>  # undef __ASSUME_SETSOCKOPT_SYSCALL
> +# undef __ASSUME_BIND_SYSCALL
>  #endif
>  
>  /* i686 only supports ipc syscall before 5.1.  */
> diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
> index 74adc3956b..3dc93f5b11 100644
> --- a/sysdeps/unix/sysv/linux/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/kernel-features.h
> @@ -79,6 +79,7 @@
>  #define __ASSUME_SENDMMSG_SYSCALL	1
>  #define __ASSUME_GETSOCKOPT_SYSCALL	1
>  #define __ASSUME_SETSOCKOPT_SYSCALL	1
> +#define __ASSUME_BIND_SYSCALL		1

OK.

>  
>  /* Support for SysV IPC through wired syscalls.  All supported architectures
>     either support ipc syscall and/or all the ipc correspondent syscalls.  */
> diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> index d807ac9cfd..37209378b9 100644
> --- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> @@ -21,7 +21,6 @@
>  #if __LINUX_KERNEL_VERSION >= 0x040300
>  # define __ASSUME_SOCKET_SYSCALL             1
>  # define __ASSUME_SOCKETPAIR_SYSCALL         1
> -# define __ASSUME_BIND_SYSCALL               1
>  # define __ASSUME_LISTEN_SYSCALL             1
>  # define __ASSUME_GETSOCKNAME_SYSCALL        1
>  # define __ASSUME_GETPEERNAME_SYSCALL        1
> @@ -43,6 +42,7 @@
>  # undef __ASSUME_SENDTO_SYSCALL
>  # undef __ASSUME_GETSOCKOPT_SYSCALL
>  # undef __ASSUME_SETSOCKOPT_SYSCALL
> +# undef __ASSUME_BIND_SYSCALL

OK.

>  #endif
>  
>  /* No support for PI futexes or robust mutexes before 3.10 for m68k.  */
> diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
> index 8ae3cdcd96..7fff6dd902 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
> @@ -19,7 +19,6 @@
>  
>  /* All supported kernel versions for MicroBlaze have these syscalls.  */
>  #define __ASSUME_SOCKET_SYSCALL		1
> -#define __ASSUME_BIND_SYSCALL		1

OK.

>  #define __ASSUME_CONNECT_SYSCALL	1
>  #define __ASSUME_LISTEN_SYSCALL		1
>  #define __ASSUME_GETSOCKNAME_SYSCALL	1
> diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
> index 894f29d381..af4555bb1d 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
> @@ -19,7 +19,6 @@
>  
>  /* New syscalls added for PowerPC in 2.6.37.  */
>  #define __ASSUME_SOCKET_SYSCALL	1
> -#define __ASSUME_BIND_SYSCALL		1

OK.

>  #define __ASSUME_CONNECT_SYSCALL	1
>  #define __ASSUME_LISTEN_SYSCALL		1
>  #define __ASSUME_GETSOCKNAME_SYSCALL	1
> diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
> index a457c84ba1..ae8dc626b2 100644
> --- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
> @@ -21,7 +21,6 @@
>  #if __LINUX_KERNEL_VERSION >= 0x040300
>  # define __ASSUME_SOCKET_SYSCALL             1
>  # define __ASSUME_SOCKETPAIR_SYSCALL         1
> -# define __ASSUME_BIND_SYSCALL               1

OK.

>  # define __ASSUME_LISTEN_SYSCALL             1
>  # define __ASSUME_GETSOCKNAME_SYSCALL        1
>  # define __ASSUME_GETPEERNAME_SYSCALL        1
> @@ -43,6 +42,7 @@
>  # undef __ASSUME_SENDTO_SYSCALL
>  # undef __ASSUME_GETSOCKOPT_SYSCALL
>  # undef __ASSUME_SETSOCKOPT_SYSCALL
> +# undef __ASSUME_BIND_SYSCALL
>  #endif
>  
>  /* s390 only supports ipc syscall before 5.1.  */
> diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
> index 545bef40fd..2883da92b2 100644
> --- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
> @@ -24,7 +24,6 @@
>  
>  /* These syscalls were added for SH in 2.6.37.  */
>  #define __ASSUME_SOCKET_SYSCALL		1
> -#define __ASSUME_BIND_SYSCALL		1

OK.

>  #define __ASSUME_CONNECT_SYSCALL	1
>  #define __ASSUME_LISTEN_SYSCALL		1
>  #define __ASSUME_GETSOCKNAME_SYSCALL	1
> diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
> index 6cbe189b2f..2b7056c0fb 100644
> --- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
> @@ -48,10 +48,13 @@
>  
>  /* These syscalls were added for both 32-bit and 64-bit in 4.4.  */
>  #if __LINUX_KERNEL_VERSION >= 0x040400
> -# define __ASSUME_BIND_SYSCALL               1

OK.

>  # define __ASSUME_LISTEN_SYSCALL             1
>  #endif
>  
> +#if __LINUX_KERNEL_VERSION < 0x040400
> +# undef __ASSUME_BIND_SYSCALL
> +#endif
> +
>  #ifdef __arch64__
>  /* sparc64 defines __NR_pause,  however it is not supported (ENOSYS).
>     Undefine so pause.c can use a correct alternative.  */

-- 
Cheers,
Carlos.


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

* Re: [PATCH 15/30] Linux: consolidate sendfile implementation
  2022-10-19 22:14 ` [PATCH 15/30] Linux: consolidate sendfile implementation Adhemerval Zanella via Libc-alpha
@ 2022-12-05 16:39   ` Carlos O'Donell via Libc-alpha
  0 siblings, 0 replies; 68+ messages in thread
From: Carlos O'Donell via Libc-alpha @ 2022-12-05 16:39 UTC (permalink / raw)
  To: Adhemerval Zanella, libc-alpha

On 10/19/22 18:14, Adhemerval Zanella via Libc-alpha wrote:
> This is similar to other LFS consolidation, where the non-LFS is only
> built if __OFF_T_MATCHES_OFF64_T is not defined and the LFS version
> is aliased to non-LFS name if __OFF_T_MATCHES_OFF64_T is defined.
> 
> For non-LFS variant, use sendfile syscall if defined, otherwise use
> sendfile64 plus the offset overflow check (as generic implementation).

LGTM.

No regressions on x86_64 and i686.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>

> 
> Checked on x86_64-linux-gnu.
> ---
>  .../sysv/linux/mips/mips64/n64/sendfile64.c   |  1 -
>  .../sysv/linux/mips/mips64/n64/syscalls.list  |  3 --
>  .../{generic/wordsize-32 => }/sendfile.c      | 15 ++++++--
>  sysdeps/unix/sysv/linux/sendfile64.c          | 37 +++++++++++++++++++
>  sysdeps/unix/sysv/linux/syscalls.list         |  2 -
>  .../unix/sysv/linux/wordsize-64/sendfile64.c  |  1 -
>  .../unix/sysv/linux/wordsize-64/syscalls.list |  1 -
>  7 files changed, 49 insertions(+), 11 deletions(-)
>  delete mode 100644 sysdeps/unix/sysv/linux/mips/mips64/n64/sendfile64.c
>  delete mode 100644 sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list
>  rename sysdeps/unix/sysv/linux/{generic/wordsize-32 => }/sendfile.c (77%)
>  create mode 100644 sysdeps/unix/sysv/linux/sendfile64.c
>  delete mode 100644 sysdeps/unix/sysv/linux/wordsize-64/sendfile64.c
> 
> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/sendfile64.c b/sysdeps/unix/sysv/linux/mips/mips64/n64/sendfile64.c
> deleted file mode 100644
> index 4c451bd093..0000000000
> --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/sendfile64.c
> +++ /dev/null
> @@ -1 +0,0 @@
> -/* sendfile64 is alias of sendfile syscall.  */

OK. Remove.

> diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list
> deleted file mode 100644
> index 0924f245d4..0000000000
> --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list
> +++ /dev/null
> @@ -1,3 +0,0 @@
> -# File name	Caller	Syscall name	# args	Strong name	Weak names
> -
> -sendfile	-	sendfile	i:iipi	sendfile	sendfile64

OK. Remove.

> diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/sendfile.c b/sysdeps/unix/sysv/linux/sendfile.c
> similarity index 77%
> rename from sysdeps/unix/sysv/linux/generic/wordsize-32/sendfile.c
> rename to sysdeps/unix/sysv/linux/sendfile.c
> index 4fdf979324..c8bc890944 100644
> --- a/sysdeps/unix/sysv/linux/generic/wordsize-32/sendfile.c
> +++ b/sysdeps/unix/sysv/linux/sendfile.c

OK. Moved.

> @@ -1,4 +1,5 @@
> -/* Copyright (C) 2011-2022 Free Software Foundation, Inc.
> +/* Transfer data between file descriptors.  Linux version.
> +   Copyright (C) 2011-2022 Free Software Foundation, Inc.
>     This file is part of the GNU C Library.
>  
>     The GNU C Library is free software; you can redistribute it and/or
> @@ -20,11 +21,16 @@
>  #include <errno.h>
>  #include <sysdep.h>
>  
> +#ifndef __OFF_T_MATCHES_OFF64_T
> +
>  /* Send COUNT bytes from file associated with IN_FD starting at OFFSET to
>     descriptor OUT_FD.  */
>  ssize_t
>  sendfile (int out_fd, int in_fd, off_t *offset, size_t count)
>  {
> +# ifdef __NR_sendfile
> +  return INLINE_SYSCALL_CALL (sendfile, out_fd, in_fd, offset, count);

OK. Consolidated. Call sendfile if we have it.

> +# else
>    __off64_t off64;
>    int rc;
>  
> @@ -38,9 +44,12 @@ sendfile (int out_fd, int in_fd, off_t *offset, size_t count)
>        off64 = *offset;
>      }
>  
> -  rc = INLINE_SYSCALL (sendfile64, 4, out_fd, in_fd,
> -                       offset ? &off64 : NULL, count);
> +  rc = INLINE_SYSCALL_CALL (sendfile64, out_fd, in_fd, offset ? &off64 : NULL,
> +			    count);

OK. Otherwise call sendfile64.

>    if (offset)
>      *offset = off64;
>    return rc;
> +# endif
>  }
> +
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/sendfile64.c b/sysdeps/unix/sysv/linux/sendfile64.c
> new file mode 100644
> index 0000000000..d9d2a4a4c2
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/sendfile64.c
> @@ -0,0 +1,37 @@
> +/* Transfer data between file descriptors.  Linux version.

OK. New consolidated version.

> +   Copyright (C) 2022 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library.  If not, see
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#include <sys/sendfile.h>
> +#include <stddef.h>
> +#include <errno.h>
> +#include <sysdep.h>
> +
> +/* Send COUNT bytes from file associated with IN_FD starting at OFFSET to
> +   descriptor OUT_FD.  */
> +ssize_t
> +sendfile64 (int out_fd, int in_fd, off64_t *offset, size_t count)
> +{
> +#ifndef __NR_sendfile64
> +# define __NR_sendfile64 __NR_sendfile
> +#endif
> +  return INLINE_SYSCALL_CALL (sendfile64, out_fd, in_fd, offset, count);

OK.

> +}
> +
> +#ifdef __OFF_T_MATCHES_OFF64_T
> +strong_alias (sendfile64, sendfile)

OK. Alias.

> +#endif
> diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list
> index 6420049e8b..b9f45463c5 100644
> --- a/sysdeps/unix/sysv/linux/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/syscalls.list
> @@ -62,8 +62,6 @@ sched_primin	-	sched_get_priority_min	i:i	__sched_get_priority_min	sched_get_pri
>  sched_setp	-	sched_setparam	i:ip	__sched_setparam	sched_setparam
>  sched_sets	-	sched_setscheduler	i:iip	__sched_setscheduler	sched_setscheduler
>  sched_yield	-	sched_yield	i:	__sched_yield	sched_yield
> -sendfile	-	sendfile	i:iipU	sendfile
> -sendfile64	-	sendfile64	i:iipU	sendfile64

OK. Remove. We have C files for these.

>  setfsgid	EXTRA	setfsgid	i:i	setfsgid
>  setfsuid	EXTRA	setfsuid	i:i	setfsuid
>  setpgid		-	setpgid		i:ii	__setpgid	setpgid
> diff --git a/sysdeps/unix/sysv/linux/wordsize-64/sendfile64.c b/sysdeps/unix/sysv/linux/wordsize-64/sendfile64.c
> deleted file mode 100644
> index 4c451bd093..0000000000
> --- a/sysdeps/unix/sysv/linux/wordsize-64/sendfile64.c
> +++ /dev/null
> @@ -1 +0,0 @@
> -/* sendfile64 is alias of sendfile syscall.  */

OK.

> diff --git a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
> index 3232f11f51..db80696e41 100644
> --- a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list
> @@ -1,4 +1,3 @@
>  # File name	Caller	Syscall name	# args	Strong name	Weak names
>  
> -sendfile	-	sendfile	i:iipi	sendfile	sendfile64

OK. Have C files.

>  personality	EXTRA	personality	i:i	__personality	personality

-- 
Cheers,
Carlos.


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

* Re: [PATCH 12/30] Linux: consolidate rmdir implementation
  2022-10-19 22:14 ` [PATCH 12/30] Linux: consolidate rmdir implementation Adhemerval Zanella via Libc-alpha
@ 2022-12-05 16:39   ` Carlos O'Donell via Libc-alpha
  0 siblings, 0 replies; 68+ messages in thread
From: Carlos O'Donell via Libc-alpha @ 2022-12-05 16:39 UTC (permalink / raw)
  To: Adhemerval Zanella, libc-alpha

On 10/19/22 18:14, Adhemerval Zanella via Libc-alpha wrote:
> Use rmdir syscall if defined, otherwise use unlinkat.
> 
> Checked on x86_64-linux-gnu.


LGTM.

No regressions on x86_64 and i686.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>

> ---
>  sysdeps/unix/sysv/linux/{generic => }/rmdir.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>  rename sysdeps/unix/sysv/linux/{generic => }/rmdir.c (78%)
> 
> diff --git a/sysdeps/unix/sysv/linux/generic/rmdir.c b/sysdeps/unix/sysv/linux/rmdir.c
> similarity index 78%
> rename from sysdeps/unix/sysv/linux/generic/rmdir.c
> rename to sysdeps/unix/sysv/linux/rmdir.c
> index 214ddc711b..cd5674f07c 100644
> --- a/sysdeps/unix/sysv/linux/generic/rmdir.c
> +++ b/sysdeps/unix/sysv/linux/rmdir.c
> @@ -1,4 +1,5 @@
> -/* Copyright (C) 2011-2022 Free Software Foundation, Inc.
> +/* Delete a directory.  Linux version.
> +   Copyright (C) 2011-2022 Free Software Foundation, Inc.
>     This file is part of the GNU C Library.
>  
>     The GNU C Library is free software; you can redistribute it and/or
> @@ -23,6 +24,10 @@
>  int
>  __rmdir (const char *path)
>  {
> -  return INLINE_SYSCALL (unlinkat, 3, AT_FDCWD, path, AT_REMOVEDIR);
> +#ifdef __NR_rmdir
> +  return INLINE_SYSCALL_CALL (rmdir, path);
> +#else
> +  return INLINE_SYSCALL_CALL (unlinkat, AT_FDCWD, path, AT_REMOVEDIR);
> +#endif

OK.

>  }
>  weak_alias (__rmdir, rmdir)

-- 
Cheers,
Carlos.


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

* Re: [PATCH 11/30] Linux: consolidate readlink implementation
  2022-10-19 22:14 ` [PATCH 11/30] Linux: consolidate readlink implementation Adhemerval Zanella via Libc-alpha
@ 2022-12-05 16:39   ` Carlos O'Donell via Libc-alpha
  0 siblings, 0 replies; 68+ messages in thread
From: Carlos O'Donell via Libc-alpha @ 2022-12-05 16:39 UTC (permalink / raw)
  To: Adhemerval Zanella, libc-alpha

On 10/19/22 18:14, Adhemerval Zanella via Libc-alpha wrote:
> Use readlink syscall if defined, otherwise readlinkat.
> 
> Checked on x86_64-linux-gnu.

LGTM.

No regressions on x86_64 and i686.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>


> ---
>  sysdeps/unix/sysv/linux/{generic => }/readlink.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>  rename sysdeps/unix/sysv/linux/{generic => }/readlink.c (80%)
> 
> diff --git a/sysdeps/unix/sysv/linux/generic/readlink.c b/sysdeps/unix/sysv/linux/readlink.c
> similarity index 80%
> rename from sysdeps/unix/sysv/linux/generic/readlink.c
> rename to sysdeps/unix/sysv/linux/readlink.c
> index 9f25811a35..083dcaf502 100644
> --- a/sysdeps/unix/sysv/linux/generic/readlink.c
> +++ b/sysdeps/unix/sysv/linux/readlink.c
> @@ -1,4 +1,5 @@
> -/* Copyright (C) 2011-2022 Free Software Foundation, Inc.
> +/* Read value of a symbolic link.  Linux version.
> +   Copyright (C) 2011-2022 Free Software Foundation, Inc.
>     This file is part of the GNU C Library.
>  
>     The GNU C Library is free software; you can redistribute it and/or
> @@ -25,6 +26,10 @@
>  ssize_t
>  __readlink (const char *path, char *buf, size_t len)
>  {
> -  return INLINE_SYSCALL (readlinkat, 4, AT_FDCWD, path, buf, len);
> +#ifdef __NR_readlink
> +  return INLINE_SYSCALL_CALL (readlink, path, buf, len);
> +#else
> +  return INLINE_SYSCALL_CALL (readlinkat, AT_FDCWD, path, buf, len);
> +#endif

OK.

>  }
>  weak_alias (__readlink, readlink)

-- 
Cheers,
Carlos.


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

* Re: [PATCH 03/30] Linux: consolidate chmod implementation
  2022-10-19 22:14 ` [PATCH 03/30] Linux: consolidate chmod implementation Adhemerval Zanella via Libc-alpha
@ 2022-12-05 16:39   ` Carlos O'Donell via Libc-alpha
  0 siblings, 0 replies; 68+ messages in thread
From: Carlos O'Donell via Libc-alpha @ 2022-12-05 16:39 UTC (permalink / raw)
  To: Adhemerval Zanella, libc-alpha

On 10/19/22 18:14, Adhemerval Zanella via Libc-alpha wrote:
> Use chmod syscall if defined, otherwise use fchmodat.
> 
> Checked on x86_64-linux-gnu.

LGTM.

No regressions on x86_64 and i686.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>

> ---
>  sysdeps/unix/sysv/linux/{generic => }/chmod.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>  rename sysdeps/unix/sysv/linux/{generic => }/chmod.c (78%)
> 
> diff --git a/sysdeps/unix/sysv/linux/generic/chmod.c b/sysdeps/unix/sysv/linux/chmod.c
> similarity index 78%
> rename from sysdeps/unix/sysv/linux/generic/chmod.c
> rename to sysdeps/unix/sysv/linux/chmod.c
> index 98b72c0be1..aedd4c0aed 100644
> --- a/sysdeps/unix/sysv/linux/generic/chmod.c
> +++ b/sysdeps/unix/sysv/linux/chmod.c
> @@ -1,4 +1,5 @@
> -/* Copyright (C) 2011-2022 Free Software Foundation, Inc.
> +/* Change permissions of a file.  Linux version.
> +   Copyright (C) 2011-2022 Free Software Foundation, Inc.
>     This file is part of the GNU C Library.
>  
>     The GNU C Library is free software; you can redistribute it and/or
> @@ -16,14 +17,17 @@
>     <https://www.gnu.org/licenses/>.  */
>  
>  #include <fcntl.h>
> -#include <sys/types.h>
>  #include <sysdep.h>
>  
>  /* Change the protections of FILE to MODE.  */
>  int
>  __chmod (const char *file, mode_t mode)
>  {
> -  return INLINE_SYSCALL (fchmodat, 3, AT_FDCWD, file, mode);
> +#ifdef __NR_chmod
> +  return INLINE_SYSCALL_CALL (chmod, file, mode);
> +#else
> +  return INLINE_SYSCALL_CALL (fchmodat, AT_FDCWD, file, mode);
> +#endif

OK.

>  }
>  
>  libc_hidden_def (__chmod)

-- 
Cheers,
Carlos.


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

* Re: [PATCH 09/30] Linux: consolidate link implementation
  2022-10-19 22:14 ` [PATCH 09/30] Linux: consolidate link implementation Adhemerval Zanella via Libc-alpha
@ 2022-12-05 16:39   ` Carlos O'Donell via Libc-alpha
  0 siblings, 0 replies; 68+ messages in thread
From: Carlos O'Donell via Libc-alpha @ 2022-12-05 16:39 UTC (permalink / raw)
  To: Adhemerval Zanella, libc-alpha

On 10/19/22 18:14, Adhemerval Zanella via Libc-alpha wrote:
> Use link syscall if defined, otherwise use linkat.
> 
> Checked on x86_64-linux-gnu.

LGTM.

No regressions on x86_64 and i686.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>


> ---
>  sysdeps/unix/sysv/linux/{generic => }/link.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>  rename sysdeps/unix/sysv/linux/{generic => }/link.c (78%)
> 
> diff --git a/sysdeps/unix/sysv/linux/generic/link.c b/sysdeps/unix/sysv/linux/link.c
> similarity index 78%
> rename from sysdeps/unix/sysv/linux/generic/link.c
> rename to sysdeps/unix/sysv/linux/link.c
> index e07655d521..eb4fe1569e 100644
> --- a/sysdeps/unix/sysv/linux/generic/link.c
> +++ b/sysdeps/unix/sysv/linux/link.c
> @@ -1,4 +1,5 @@
> -/* Copyright (C) 2011-2022 Free Software Foundation, Inc.
> +/* Make a new name for a file.  Linux version.
> +   Copyright (C) 2011-2022 Free Software Foundation, Inc.
>     This file is part of the GNU C Library.
>  
>     The GNU C Library is free software; you can redistribute it and/or
> @@ -23,7 +24,11 @@
>  int
>  __link (const char *from, const char *to)
>  {
> -  return INLINE_SYSCALL (linkat, 5, AT_FDCWD, from, AT_FDCWD, to, 0);
> +#ifdef __NR_link
> +  return INLINE_SYSCALL_CALL (link, from, to);
> +#else
> +  return INLINE_SYSCALL_CALL (linkat, AT_FDCWD, from, AT_FDCWD, to, 0);
> +#endif

OK.

>  }
>  
>  weak_alias (__link, link)

-- 
Cheers,
Carlos.


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

* Re: [PATCH 10/30] Linux: consolidate mkdir implementation
  2022-10-19 22:14 ` [PATCH 10/30] Linux: consolidate mkdir implementation Adhemerval Zanella via Libc-alpha
@ 2022-12-05 16:40   ` Carlos O'Donell via Libc-alpha
  0 siblings, 0 replies; 68+ messages in thread
From: Carlos O'Donell via Libc-alpha @ 2022-12-05 16:40 UTC (permalink / raw)
  To: Adhemerval Zanella, libc-alpha

On 10/19/22 18:14, Adhemerval Zanella via Libc-alpha wrote:
> Use mkdir syscall if defined, otherwise use mkdirat.
> 
> Checked on x86_64-linux-gnu.

LGTM.

No regressions on x86_64 and i686.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>


> ---
>  sysdeps/unix/sysv/linux/{generic => }/mkdir.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
>  rename sysdeps/unix/sysv/linux/{generic => }/mkdir.c (79%)
> 
> diff --git a/sysdeps/unix/sysv/linux/generic/mkdir.c b/sysdeps/unix/sysv/linux/mkdir.c
> similarity index 79%
> rename from sysdeps/unix/sysv/linux/generic/mkdir.c
> rename to sysdeps/unix/sysv/linux/mkdir.c
> index f64fbd6176..a3653210fb 100644
> --- a/sysdeps/unix/sysv/linux/generic/mkdir.c
> +++ b/sysdeps/unix/sysv/linux/mkdir.c
> @@ -1,4 +1,5 @@
> -/* Copyright (C) 2011-2022 Free Software Foundation, Inc.
> +/* Create a directory.  Linux version.
> +   Copyright (C) 2011-2022 Free Software Foundation, Inc.
>     This file is part of the GNU C Library.
>  
>     The GNU C Library is free software; you can redistribute it and/or
> @@ -15,19 +16,19 @@
>     License along with the GNU C Library.  If not, see
>     <https://www.gnu.org/licenses/>.  */
>  
> -#include <errno.h>
> -#include <stddef.h>
> -#include <sysdep.h>
>  #include <fcntl.h>
>  #include <sys/stat.h>
> -#include <sys/types.h>
> -
> +#include <sysdep.h>
>  
>  /* Create a directory named PATH with protections MODE.  */
>  int
>  __mkdir (const char *path, mode_t mode)
>  {
> -  return INLINE_SYSCALL (mkdirat, 3, AT_FDCWD, path, mode);
> +#ifdef __NR_mkdir
> +  return INLINE_SYSCALL_CALL (mkdir,  path, mode);
> +#else
> +  return INLINE_SYSCALL_CALL (mkdirat, AT_FDCWD, path, mode);
> +#endif

OK.

>  }
>  
>  libc_hidden_def (__mkdir)

-- 
Cheers,
Carlos.


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

* Re: [PATCH 16/30] Linux: Move wordsize-32 Version to default
  2022-10-19 22:14 ` [PATCH 16/30] Linux: Move wordsize-32 Version to default Adhemerval Zanella via Libc-alpha
@ 2022-12-05 16:40   ` Carlos O'Donell via Libc-alpha
  2022-12-07  0:10     ` Joseph Myers
  0 siblings, 1 reply; 68+ messages in thread
From: Carlos O'Donell via Libc-alpha @ 2022-12-05 16:40 UTC (permalink / raw)
  To: Adhemerval Zanella, libc-alpha

On 10/19/22 18:14, Adhemerval Zanella via Libc-alpha wrote:
> And remove redundant entries on other architectures Version.

There are discrepancies between 2.11, 2.15, and 2.18 that need to be explained
in the comment or changed.

If all 32-bit arches were using 2.11 and the wordsize-32/Versions was never
used, then that should be explained in the comment.

If microblaze had a default version of 2.18 that pushed up the 2.11 value
then that should be explained.

Need a v2.

> ---
>  sysdeps/unix/sysv/linux/Versions                     | 3 +++
>  sysdeps/unix/sysv/linux/arm/Versions                 | 3 ---
>  sysdeps/unix/sysv/linux/generic/wordsize-32/Versions | 5 -----
>  sysdeps/unix/sysv/linux/hppa/Versions                | 3 ---
>  sysdeps/unix/sysv/linux/i386/Versions                | 4 ----
>  sysdeps/unix/sysv/linux/m68k/Versions                | 3 ---
>  sysdeps/unix/sysv/linux/microblaze/Versions          | 5 -----
>  sysdeps/unix/sysv/linux/mips/Versions                | 3 ---
>  sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions   | 3 ---
>  sysdeps/unix/sysv/linux/s390/s390-32/Versions        | 3 ---
>  sysdeps/unix/sysv/linux/sh/Versions                  | 3 ---
>  sysdeps/unix/sysv/linux/sparc/sparc32/Versions       | 3 ---
>  12 files changed, 3 insertions(+), 38 deletions(-)
>  delete mode 100644 sysdeps/unix/sysv/linux/generic/wordsize-32/Versions
>  delete mode 100644 sysdeps/unix/sysv/linux/microblaze/Versions
> 
> diff --git a/sysdeps/unix/sysv/linux/Versions b/sysdeps/unix/sysv/linux/Versions
> index 65d2ceda2c..59c39739c7 100644
> --- a/sysdeps/unix/sysv/linux/Versions
> +++ b/sysdeps/unix/sysv/linux/Versions
> @@ -157,6 +157,9 @@ libc {
>    GLIBC_2.10 {
>      fallocate;
>    }
> +  GLIBC_2.11 {
> +    fallocate64;
> +  }

The generic version says 2.15?

sysdeps/unix/sysv/linux/generic/wordsize-32/Versions:

libc {
  GLIBC_2.15 {
    fallocate64;
  }
}


>    GLIBC_2.12 {
>      _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
>  
> diff --git a/sysdeps/unix/sysv/linux/arm/Versions b/sysdeps/unix/sysv/linux/arm/Versions
> index 7e5ba53455..6e7cb6e2e5 100644
> --- a/sysdeps/unix/sysv/linux/arm/Versions
> +++ b/sysdeps/unix/sysv/linux/arm/Versions
> @@ -4,9 +4,6 @@ libc {
>      inb; inw; inl;
>      outb; outw; outl;
>    }
> -  GLIBC_2.11 {
> -    fallocate64;
> -  }

OK.

>    GLIBC_2.24 {
>      recvmsg; sendmsg;
>    }
> diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/Versions b/sysdeps/unix/sysv/linux/generic/wordsize-32/Versions
> deleted file mode 100644
> index cdc6022015..0000000000
> --- a/sysdeps/unix/sysv/linux/generic/wordsize-32/Versions
> +++ /dev/null
> @@ -1,5 +0,0 @@
> -libc {
> -  GLIBC_2.15 {
> -    fallocate64;
> -  }
> -}

Doesn't match.

> diff --git a/sysdeps/unix/sysv/linux/hppa/Versions b/sysdeps/unix/sysv/linux/hppa/Versions
> index 357c68a782..78528e5fa2 100644
> --- a/sysdeps/unix/sysv/linux/hppa/Versions
> +++ b/sysdeps/unix/sysv/linux/hppa/Versions
> @@ -13,9 +13,6 @@ libc {
>    GLIBC_2.4 {
>      _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
>    }
> -  GLIBC_2.11 {
> -    fallocate64;
> -  }

OK.

>    GLIBC_2.12 {
>      _sys_errlist; sys_errlist; _sys_nerr; sys_nerr;
>    }
> diff --git a/sysdeps/unix/sysv/linux/i386/Versions b/sysdeps/unix/sysv/linux/i386/Versions
> index 1335e6551b..f99a4d88d0 100644
> --- a/sysdeps/unix/sysv/linux/i386/Versions
> +++ b/sysdeps/unix/sysv/linux/i386/Versions
> @@ -37,10 +37,6 @@ libc {
>      # v*
>      vm86;
>    }
> -  GLIBC_2.11 {
> -    # f*
> -    fallocate64;
> -  }

OK.

>    GLIBC_PRIVATE {
>      __modify_ldt; __uname;
>    }
> diff --git a/sysdeps/unix/sysv/linux/m68k/Versions b/sysdeps/unix/sysv/linux/m68k/Versions
> index d98ae120c1..a77ea60338 100644
> --- a/sysdeps/unix/sysv/linux/m68k/Versions
> +++ b/sysdeps/unix/sysv/linux/m68k/Versions
> @@ -29,9 +29,6 @@ libc {
>      # v*
>      versionsort64;
>    }
> -  GLIBC_2.11 {
> -    fallocate64;
> -  }

OK.

>    GLIBC_2.31 {
>      msgctl; semctl; shmctl;
>    }
> diff --git a/sysdeps/unix/sysv/linux/microblaze/Versions b/sysdeps/unix/sysv/linux/microblaze/Versions
> deleted file mode 100644
> index aa48a3c155..0000000000
> --- a/sysdeps/unix/sysv/linux/microblaze/Versions
> +++ /dev/null
> @@ -1,5 +0,0 @@
> -libc {
> -  GLIBC_2.18 {
> -    fallocate64;
> -  }
> -}

Doesn't match.

> diff --git a/sysdeps/unix/sysv/linux/mips/Versions b/sysdeps/unix/sysv/linux/mips/Versions
> index db6222e9a7..9ea0fa65a4 100644
> --- a/sysdeps/unix/sysv/linux/mips/Versions
> +++ b/sysdeps/unix/sysv/linux/mips/Versions
> @@ -26,9 +26,6 @@ libc {
>      pthread_attr_setstack;
>      pthread_attr_setstacksize;
>    }
> -  GLIBC_2.11 {
> -    fallocate64;
> -  }

OK.

>    GLIBC_PRIVATE {
>      # nptl/pthread_cond_timedwait.c uses INTERNAL_VSYSCALL(clock_gettime).
>      __vdso_clock_gettime;
> diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions b/sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions
> index 918e0231d0..416e8db5ae 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions
> +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions
> @@ -31,9 +31,6 @@ libc {
>      siglongjmp;
>      swapcontext;
>    }
> -  GLIBC_2.11 {
> -    fallocate64;
> -  }

OK.

>    GLIBC_2.17 {
>      __ppc_get_timebase_freq;
>    }
> diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/Versions b/sysdeps/unix/sysv/linux/s390/s390-32/Versions
> index bd1a46df88..1b96fc42a3 100644
> --- a/sysdeps/unix/sysv/linux/s390/s390-32/Versions
> +++ b/sysdeps/unix/sysv/linux/s390/s390-32/Versions
> @@ -44,9 +44,6 @@ libc {
>      getutmpx;
>      login;
>    }
> -  GLIBC_2.11 {
> -    fallocate64;
> -  }

OK.

>    GLIBC_2.31 {
>      msgctl; semctl; shmctl;
>    }
> diff --git a/sysdeps/unix/sysv/linux/sh/Versions b/sysdeps/unix/sysv/linux/sh/Versions
> index 9c734ff755..3ad702e165 100644
> --- a/sysdeps/unix/sysv/linux/sh/Versions
> +++ b/sysdeps/unix/sysv/linux/sh/Versions
> @@ -22,9 +22,6 @@ libc {
>      # v*
>      versionsort64;
>    }
> -  GLIBC_2.11 {
> -    fallocate64;
> -  }

OK.

>    GLIBC_2.16 {
>      fanotify_mark;
>    }
> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/Versions b/sysdeps/unix/sysv/linux/sparc/sparc32/Versions
> index d928a65346..4529e7fe6f 100644
> --- a/sysdeps/unix/sysv/linux/sparc/sparc32/Versions
> +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/Versions
> @@ -17,7 +17,4 @@ libc {
>      # s*
>      scandir64;
>    }
> -  GLIBC_2.11 {
> -    fallocate64;
> -  }

OK.

>  }

-- 
Cheers,
Carlos.


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

* Re: [PATCH 13/30] Linux: consolidate symlink implementation
  2022-10-19 22:14 ` [PATCH 13/30] Linux: consolidate symlink implementation Adhemerval Zanella via Libc-alpha
@ 2022-12-05 16:40   ` Carlos O'Donell via Libc-alpha
  0 siblings, 0 replies; 68+ messages in thread
From: Carlos O'Donell via Libc-alpha @ 2022-12-05 16:40 UTC (permalink / raw)
  To: Adhemerval Zanella, libc-alpha

On 10/19/22 18:14, Adhemerval Zanella via Libc-alpha wrote:
> Use symlink syscall if defined, otherwise use symlinkat.
> 
> Checked on x86_64-linux-gnu.

LGTM.

No regressions on x86_64 and i686.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>


> ---
>  sysdeps/unix/sysv/linux/{generic => }/symlink.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>  rename sysdeps/unix/sysv/linux/{generic => }/symlink.c (78%)
> 
> diff --git a/sysdeps/unix/sysv/linux/generic/symlink.c b/sysdeps/unix/sysv/linux/symlink.c
> similarity index 78%
> rename from sysdeps/unix/sysv/linux/generic/symlink.c
> rename to sysdeps/unix/sysv/linux/symlink.c
> index 9242f5825e..b336d5ec4c 100644
> --- a/sysdeps/unix/sysv/linux/generic/symlink.c
> +++ b/sysdeps/unix/sysv/linux/symlink.c
> @@ -1,4 +1,5 @@
> -/* Copyright (C) 2011-2022 Free Software Foundation, Inc.
> +/* Make a new name for a file.  Linux version.
> +   Copyright (C) 2011-2022 Free Software Foundation, Inc.
>     This file is part of the GNU C Library.
>  
>     The GNU C Library is free software; you can redistribute it and/or
> @@ -23,6 +24,10 @@
>  int
>  __symlink (const char *from, const char *to)
>  {
> -  return INLINE_SYSCALL (symlinkat, 3, from, AT_FDCWD, to);
> +#ifdef __NR_symlink
> +  return INLINE_SYSCALL_CALL (symlink, from, to);

OK.

> +#else
> +  return INLINE_SYSCALL_CALL (symlinkat, from, AT_FDCWD, to);
> +#endif
>  }
>  weak_alias (__symlink, symlink)

-- 
Cheers,
Carlos.


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

* Re: [PATCH 06/30] Lninux: consolidate epoll_create implementation
  2022-10-19 22:14 ` [PATCH 06/30] Lninux: consolidate epoll_create implementation Adhemerval Zanella via Libc-alpha
  2022-10-21  8:57   ` Florian Weimer via Libc-alpha
@ 2022-12-05 16:40   ` Carlos O'Donell via Libc-alpha
  1 sibling, 0 replies; 68+ messages in thread
From: Carlos O'Donell via Libc-alpha @ 2022-12-05 16:40 UTC (permalink / raw)
  To: Adhemerval Zanella, libc-alpha

On 10/19/22 18:14, Adhemerval Zanella via Libc-alpha wrote:

As noted by Florian s/Lninux/Linux/g so first line has  typo.

This needs a v2.

> Use epoll_create syscall if defined, otherwise use epoll_create1.

Tested-by: Carlos O'Donell <carlos@redhat.com>

> ---
>  sysdeps/unix/sysv/linux/{generic => }/epoll_create.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>  rename sysdeps/unix/sysv/linux/{generic => }/epoll_create.c (79%)
> 
> diff --git a/sysdeps/unix/sysv/linux/generic/epoll_create.c b/sysdeps/unix/sysv/linux/epoll_create.c
> similarity index 79%
> rename from sysdeps/unix/sysv/linux/generic/epoll_create.c
> rename to sysdeps/unix/sysv/linux/epoll_create.c
> index fa28694929..afb1921637 100644
> --- a/sysdeps/unix/sysv/linux/generic/epoll_create.c
> +++ b/sysdeps/unix/sysv/linux/epoll_create.c
> @@ -1,4 +1,5 @@
> -/* Copyright (C) 2011-2022 Free Software Foundation, Inc.
> +/* Open an epoll file descriptor.  Linux version.
> +   Copyright (C) 2011-2022 Free Software Foundation, Inc.
>     This file is part of the GNU C Library.
>  
>     The GNU C Library is free software; you can redistribute it and/or
> @@ -23,12 +24,16 @@ libc_hidden_proto (epoll_create)
>  int
>  epoll_create (int size)
>  {
> +#ifdef __NR_epoll_create
> +  return INLINE_SYSCALL_CALL (epoll_create);

OK.

> +#else
>    if (size <= 0)
>      {
>        __set_errno (EINVAL);
>        return -1;
>      }
>  
> -  return INLINE_SYSCALL (epoll_create1, 1, 0);
> +  return INLINE_SYSCALL_CALL (epoll_create1, 0);

OK.

> +#endif
>  }
>  libc_hidden_def (epoll_create)

-- 
Cheers,
Carlos.


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

* Re: [PATCH 04/30] Linux: consolidate chown implementation
  2022-10-19 22:14 ` [PATCH 04/30] Linux: consolidate chown implementation Adhemerval Zanella via Libc-alpha
@ 2022-12-05 16:40   ` Carlos O'Donell via Libc-alpha
  0 siblings, 0 replies; 68+ messages in thread
From: Carlos O'Donell via Libc-alpha @ 2022-12-05 16:40 UTC (permalink / raw)
  To: Adhemerval Zanella, libc-alpha

On 10/19/22 18:14, Adhemerval Zanella via Libc-alpha wrote:
> Use chown syscall if defined, otherwise use fchownat.
> 
> Checked on x86_64-linux-gnu.

LGTM.

No regressions on x86_64 and i686.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>


> ---
>  sysdeps/unix/sysv/linux/{generic => }/chown.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>  rename sysdeps/unix/sysv/linux/{generic => }/chown.c (77%)
> 
> diff --git a/sysdeps/unix/sysv/linux/generic/chown.c b/sysdeps/unix/sysv/linux/chown.c
> similarity index 77%
> rename from sysdeps/unix/sysv/linux/generic/chown.c
> rename to sysdeps/unix/sysv/linux/chown.c
> index 53997a1127..c1cd4d6c3d 100644
> --- a/sysdeps/unix/sysv/linux/generic/chown.c
> +++ b/sysdeps/unix/sysv/linux/chown.c
> @@ -1,4 +1,5 @@
> -/* Copyright (C) 2011-2022 Free Software Foundation, Inc.
> +/* Change ownership of a file.  Linux version.
> +   Copyright (C) 2011-2022 Free Software Foundation, Inc.
>     This file is part of the GNU C Library.
>  
>     The GNU C Library is free software; you can redistribute it and/or
> @@ -23,7 +24,11 @@
>  int
>  __chown (const char *file, uid_t owner, gid_t group)
>  {
> -  return INLINE_SYSCALL (fchownat, 5, AT_FDCWD, file, owner, group, 0);
> +#ifdef __NR_chown
> +  return INLINE_SYSCALL_CALL (chown, file, owner, groups);
> +#else
> +  return INLINE_SYSCALL_CALL (fchownat, AT_FDCWD, file, owner, group, 0);
> +#endif

OK.

>  }
>  libc_hidden_def (__chown)
>  weak_alias (__chown, chown)

-- 
Cheers,
Carlos.


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

* Re: [PATCH 05/30] Linux: consolidate dup2 implementation
  2022-10-19 22:14 ` [PATCH 05/30] Linux: consolidate dup2 implementation Adhemerval Zanella via Libc-alpha
@ 2022-12-05 16:40   ` Carlos O'Donell via Libc-alpha
  0 siblings, 0 replies; 68+ messages in thread
From: Carlos O'Donell via Libc-alpha @ 2022-12-05 16:40 UTC (permalink / raw)
  To: Adhemerval Zanella, libc-alpha

On 10/19/22 18:14, Adhemerval Zanella via Libc-alpha wrote:
> Use dup2 syscall if defined, otherwise use dup3.
> 
> Checked on x86_64-linux-gnu.

LGTM.

No regressions on x86_64 and i686.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>

> ---
>  sysdeps/unix/sysv/linux/{generic => }/dup2.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>  rename sysdeps/unix/sysv/linux/{generic => }/dup2.c (83%)
> 
> diff --git a/sysdeps/unix/sysv/linux/generic/dup2.c b/sysdeps/unix/sysv/linux/dup2.c
> similarity index 83%
> rename from sysdeps/unix/sysv/linux/generic/dup2.c
> rename to sysdeps/unix/sysv/linux/dup2.c
> index 0dc45e9b17..1182780e15 100644
> --- a/sysdeps/unix/sysv/linux/generic/dup2.c
> +++ b/sysdeps/unix/sysv/linux/dup2.c
> @@ -1,4 +1,5 @@
> -/* Copyright (C) 2011-2022 Free Software Foundation, Inc.
> +/* Duplicate a file descriptor.  Linux version.
> +   Copyright (C) 2011-2022 Free Software Foundation, Inc.
>     This file is part of the GNU C Library.
>  
>     The GNU C Library is free software; you can redistribute it and/or
> @@ -24,12 +25,16 @@
>  int
>  __dup2 (int fd, int fd2)
>  {
> +#ifdef __NR_dup2
> +  return INLINE_SYSCALL_CALL (dup2, fd, fd2);

OK.

> +#else
>    /* For the degenerate case, check if the fd is valid (by trying to
>       get the file status flags) and return it, or else return EBADF.  */
>    if (fd == fd2)
>      return __libc_fcntl (fd, F_GETFL, 0) < 0 ? -1 : fd;
>  
> -  return INLINE_SYSCALL (dup3, 3, fd, fd2, 0);
> +  return INLINE_SYSCALL_CALL (dup3, fd, fd2, 0);

OK.

> +#endif
>  }
>  libc_hidden_def (__dup2)
>  weak_alias (__dup2, dup2)

-- 
Cheers,
Carlos.


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

* Re: [PATCH 08/30] Linux: consolidate lchown implementation
  2022-10-19 22:14 ` [PATCH 08/30] Linux: consolidate lchown implementation Adhemerval Zanella via Libc-alpha
@ 2022-12-05 16:40   ` Carlos O'Donell via Libc-alpha
  0 siblings, 0 replies; 68+ messages in thread
From: Carlos O'Donell via Libc-alpha @ 2022-12-05 16:40 UTC (permalink / raw)
  To: Adhemerval Zanella, libc-alpha

On 10/19/22 18:14, Adhemerval Zanella via Libc-alpha wrote:
> Use lchown syscall if defined, otherwise use fchownat.
> 
> Checked on x86_64-linux-gnu.

LGTM.

No regressions on x86_64 and i686.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>

> ---
>  sysdeps/unix/sysv/linux/{generic => }/lchown.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
>  rename sysdeps/unix/sysv/linux/{generic => }/lchown.c (75%)
> 
> diff --git a/sysdeps/unix/sysv/linux/generic/lchown.c b/sysdeps/unix/sysv/linux/lchown.c
> similarity index 75%
> rename from sysdeps/unix/sysv/linux/generic/lchown.c
> rename to sysdeps/unix/sysv/linux/lchown.c
> index 996925d799..4888e5f194 100644
> --- a/sysdeps/unix/sysv/linux/generic/lchown.c
> +++ b/sysdeps/unix/sysv/linux/lchown.c
> @@ -1,4 +1,5 @@
> -/* Copyright (C) 2011-2022 Free Software Foundation, Inc.
> +/* Change ownership of a file.  Linux version.
> +   Copyright (C) 2011-2022 Free Software Foundation, Inc.
>     This file is part of the GNU C Library.
>  
>     The GNU C Library is free software; you can redistribute it and/or
> @@ -23,7 +24,11 @@
>  int
>  __lchown (const char *file, uid_t owner, gid_t group)
>  {
> -  return INLINE_SYSCALL (fchownat, 5, AT_FDCWD, file, owner, group,
> -                         AT_SYMLINK_NOFOLLOW);
> +#ifdef __NR_lchown
> +  return INLINE_SYSCALL_CALL (lchown, file, owner, group);
> +#else
> +  return INLINE_SYSCALL_CALL (fchownat, AT_FDCWD, file, owner, group,
> +			      AT_SYMLINK_NOFOLLOW);

OK.

> +#endif
>  }
>  weak_alias (__lchown, lchown)

-- 
Cheers,
Carlos.


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

* Re: [PATCH 14/30] Linux: consolidate unlink implementation
  2022-10-19 22:14 ` [PATCH 14/30] Linux: consolidate unlink implementation Adhemerval Zanella via Libc-alpha
@ 2022-12-05 16:40   ` Carlos O'Donell via Libc-alpha
  0 siblings, 0 replies; 68+ messages in thread
From: Carlos O'Donell via Libc-alpha @ 2022-12-05 16:40 UTC (permalink / raw)
  To: Adhemerval Zanella, libc-alpha

On 10/19/22 18:14, Adhemerval Zanella via Libc-alpha wrote:
> Use unlink syscall if defined, otherwise use unlinkat.
> 
> Checked on x86_64-linux-gnu.

LGTM.

No regressions on x86_64 and i686.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>


> ---
>  sysdeps/unix/sysv/linux/{generic => }/unlink.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>  rename sysdeps/unix/sysv/linux/{generic => }/unlink.c (77%)
> 
> diff --git a/sysdeps/unix/sysv/linux/generic/unlink.c b/sysdeps/unix/sysv/linux/unlink.c
> similarity index 77%
> rename from sysdeps/unix/sysv/linux/generic/unlink.c
> rename to sysdeps/unix/sysv/linux/unlink.c
> index d2650acacc..e17b0a82d2 100644
> --- a/sysdeps/unix/sysv/linux/generic/unlink.c
> +++ b/sysdeps/unix/sysv/linux/unlink.c
> @@ -1,4 +1,5 @@
> -/* Copyright (C) 2011-2022 Free Software Foundation, Inc.
> +/* Delete a name and possibly the file it refers to.  Linux version.
> +   Copyright (C) 2011-2022 Free Software Foundation, Inc.
>     This file is part of the GNU C Library.
>  
>     The GNU C Library is free software; you can redistribute it and/or
> @@ -23,6 +24,10 @@
>  int
>  __unlink (const char *name)
>  {
> -  return INLINE_SYSCALL (unlinkat, 3, AT_FDCWD, name, 0);
> +#ifdef __NR_unlink
> +  return INLINE_SYSCALL_CALL (unlink, name);
> +#else
> +  return INLINE_SYSCALL_CALL (unlinkat, AT_FDCWD, name, 0);

OK.

> +#endif
>  }
>  weak_alias (__unlink, unlink)

-- 
Cheers,
Carlos.


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

* Re: [PATCH 17/30] Linux: consolidate ____longjmp_chk
  2022-10-19 22:14 ` [PATCH 17/30] Linux: consolidate ____longjmp_chk Adhemerval Zanella via Libc-alpha
@ 2022-12-05 16:40   ` Carlos O'Donell via Libc-alpha
  0 siblings, 0 replies; 68+ messages in thread
From: Carlos O'Donell via Libc-alpha @ 2022-12-05 16:40 UTC (permalink / raw)
  To: Adhemerval Zanella, libc-alpha

On 10/19/22 18:14, Adhemerval Zanella via Libc-alpha wrote:
> Checked on x86_64-linux-gnu.

LGTM.

No regressions on x86_64 and i686.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>


> ---
>  sysdeps/unix/sysv/linux/{generic => }/____longjmp_chk.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>  rename sysdeps/unix/sysv/linux/{generic => }/____longjmp_chk.c (90%)
> 
> diff --git a/sysdeps/unix/sysv/linux/generic/____longjmp_chk.c b/sysdeps/unix/sysv/linux/____longjmp_chk.c
> similarity index 90%
> rename from sysdeps/unix/sysv/linux/generic/____longjmp_chk.c
> rename to sysdeps/unix/sysv/linux/____longjmp_chk.c
> index aac1158853..687cb27133 100644
> --- a/sysdeps/unix/sysv/linux/generic/____longjmp_chk.c
> +++ b/sysdeps/unix/sysv/linux/____longjmp_chk.c
> @@ -1,4 +1,5 @@
> -/* Copyright (C) 2011-2022 Free Software Foundation, Inc.
> +/* longjmp fortify implementation.  Linux version.
> +   Copyright (C) 2011-2022 Free Software Foundation, Inc.
>     This file is part of the GNU C Library.
>  
>     The GNU C Library is free software; you can redistribute it and/or
> @@ -28,8 +29,7 @@
>  #define called_from(this, saved) ((this) > (saved))
>  #endif
>  
> -extern void ____longjmp_chk (__jmp_buf __env, int __val)
> -  __attribute__ ((__noreturn__));
> +_Noreturn extern void ____longjmp_chk (__jmp_buf __env, int __val);

OK.

>  
>  void ____longjmp_chk (__jmp_buf env, int val)
>  {

-- 
Cheers,
Carlos.


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

* Re: [PATCH 07/30] Linux: consolidate inotify_init implementation
  2022-10-19 22:14 ` [PATCH 07/30] Linux: consolidate inotify_init implementation Adhemerval Zanella via Libc-alpha
@ 2022-12-05 16:40   ` Carlos O'Donell via Libc-alpha
  0 siblings, 0 replies; 68+ messages in thread
From: Carlos O'Donell via Libc-alpha @ 2022-12-05 16:40 UTC (permalink / raw)
  To: Adhemerval Zanella, libc-alpha

On 10/19/22 18:14, Adhemerval Zanella via Libc-alpha wrote:
> Use inotify_init syscall if defined, otherwise use inotify_init1.

LGTM.

No regressions on x86_64 and i686.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>

> ---
>  sysdeps/unix/sysv/linux/{generic => }/inotify_init.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>  rename sysdeps/unix/sysv/linux/{generic => }/inotify_init.c (78%)
> 
> diff --git a/sysdeps/unix/sysv/linux/generic/inotify_init.c b/sysdeps/unix/sysv/linux/inotify_init.c
> similarity index 78%
> rename from sysdeps/unix/sysv/linux/generic/inotify_init.c
> rename to sysdeps/unix/sysv/linux/inotify_init.c
> index 3297ebc705..4da5b723a6 100644
> --- a/sysdeps/unix/sysv/linux/generic/inotify_init.c
> +++ b/sysdeps/unix/sysv/linux/inotify_init.c
> @@ -1,4 +1,5 @@
> -/* Copyright (C) 2011-2022 Free Software Foundation, Inc.
> +/* Initialize an inotify instance.  Linux version.
> +   Copyright (C) 2011-2022 Free Software Foundation, Inc.
>     This file is part of the GNU C Library.
>  
>     The GNU C Library is free software; you can redistribute it and/or
> @@ -23,6 +24,10 @@ libc_hidden_proto (inotify_init)
>  int
>  inotify_init (void)
>  {
> -  return INLINE_SYSCALL (inotify_init1, 1, 0);
> +#ifdef __NR_inotify_init
> +  return INLINE_SYSCALL_CALL (inotify_init);
> +#else
> +  return INLINE_SYSCALL_CALL (inotify_init1, 0);

OK.

> +#endif
>  }
>  libc_hidden_def (inotify_init)

-- 
Cheers,
Carlos.


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

* Re: [PATCH 20/30] Linux: Assume and consolidate socketpair wire-up syscall
  2022-10-19 22:14 ` [PATCH 20/30] Linux: Assume and consolidate socketpair " Adhemerval Zanella via Libc-alpha
@ 2022-12-06 16:15   ` Carlos O'Donell via Libc-alpha
  0 siblings, 0 replies; 68+ messages in thread
From: Carlos O'Donell via Libc-alpha @ 2022-12-06 16:15 UTC (permalink / raw)
  To: Adhemerval Zanella, libc-alpha

On 10/19/22 18:14, Adhemerval Zanella via Libc-alpha wrote:
> And disable if kernel does not support it.
> 
> Checked on x86_64-linux-gnu and i686-linux-gnu.

LGTM.

No regressions on x86_64 and i686.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>

> ---
>  sysdeps/unix/sysv/linux/generic/syscalls.list        | 1 -
>  sysdeps/unix/sysv/linux/i386/kernel-features.h       | 2 +-
>  sysdeps/unix/sysv/linux/kernel-features.h            | 1 +
>  sysdeps/unix/sysv/linux/m68k/kernel-features.h       | 2 +-
>  sysdeps/unix/sysv/linux/microblaze/kernel-features.h | 1 -
>  sysdeps/unix/sysv/linux/powerpc/kernel-features.h    | 1 -
>  sysdeps/unix/sysv/linux/s390/kernel-features.h       | 2 +-
>  sysdeps/unix/sysv/linux/sh/kernel-features.h         | 1 -
>  sysdeps/unix/sysv/linux/socketpair.c                 | 7 +------
>  sysdeps/unix/sysv/linux/sparc/kernel-features.h      | 1 -
>  10 files changed, 5 insertions(+), 14 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
> index e5a62811a5..95ed2cbac8 100644
> --- a/sysdeps/unix/sysv/linux/generic/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
> @@ -1,7 +1,6 @@
>  # File name	Caller	Syscall name	# args	Strong name	Weak names
>  
>  # Socket APIs
> -socketpair	-	socketpair	i:iiif	__socketpair	socketpair

OK. Remove wrapper.

>  listen		-	listen		i:ii	__listen	listen
>  getsockname	-	getsockname	i:ipp	__getsockname	getsockname
>  getpeername	-	getpeername	i:ipp	__getpeername	getpeername
> diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
> index 4c2f1eb8f5..8a7fe47602 100644
> --- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
> @@ -19,7 +19,6 @@
>  
>  /* Direct socketcalls available with kernel 4.3.  */
>  #if __LINUX_KERNEL_VERSION >= 0x040300
> -# define __ASSUME_SOCKETPAIR_SYSCALL         1
>  # define __ASSUME_LISTEN_SYSCALL             1
>  # define __ASSUME_GETSOCKNAME_SYSCALL        1
>  # define __ASSUME_GETPEERNAME_SYSCALL        1
> @@ -41,6 +40,7 @@
>  # undef __ASSUME_SETSOCKOPT_SYSCALL
>  # undef __ASSUME_BIND_SYSCALL
>  # undef __ASSUME_SOCKET_SYSCALL
> +# undef __ASSUME_SOCKETPAIR_SYSCALL

OK. Expect it.

>  #endif
>  
>  /* i686 only supports ipc syscall before 5.1.  */
> diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
> index a42b70c85b..fd44b39cf4 100644
> --- a/sysdeps/unix/sysv/linux/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/kernel-features.h
> @@ -81,6 +81,7 @@
>  #define __ASSUME_SETSOCKOPT_SYSCALL	1
>  #define __ASSUME_BIND_SYSCALL		1
>  #define __ASSUME_SOCKET_SYSCALL		1
> +#define __ASSUME_SOCKETPAIR_SYSCALL	1

OK. Default.

>  
>  /* Support for SysV IPC through wired syscalls.  All supported architectures
>     either support ipc syscall and/or all the ipc correspondent syscalls.  */
> diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> index 38ffbdbaed..46b3045b56 100644
> --- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> @@ -19,7 +19,6 @@
>  
>  /* Direct socketcalls available with kernel 4.3.  */
>  #if __LINUX_KERNEL_VERSION >= 0x040300
> -# define __ASSUME_SOCKETPAIR_SYSCALL         1
>  # define __ASSUME_LISTEN_SYSCALL             1
>  # define __ASSUME_GETSOCKNAME_SYSCALL        1
>  # define __ASSUME_GETPEERNAME_SYSCALL        1
> @@ -43,6 +42,7 @@
>  # undef __ASSUME_SETSOCKOPT_SYSCALL
>  # undef __ASSUME_BIND_SYSCALL
>  # undef __ASSUME_SOCKET_SYSCALL
> +# undef __ASSUME_SOCKETPAIR_SYSCALL
>  #endif
>  
>  /* No support for PI futexes or robust mutexes before 3.10 for m68k.  */
> diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
> index 389dd146b4..198ff3209d 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
> @@ -22,7 +22,6 @@
>  #define __ASSUME_LISTEN_SYSCALL		1
>  #define __ASSUME_GETSOCKNAME_SYSCALL	1
>  #define __ASSUME_GETPEERNAME_SYSCALL	1
> -#define __ASSUME_SOCKETPAIR_SYSCALL	1
>  #define __ASSUME_SEND_SYSCALL		1
>  #define __ASSUME_RECV_SYSCALL		1
>  #define __ASSUME_SHUTDOWN_SYSCALL	1
> diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
> index 9ee1dc2bc7..72ec2df178 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
> @@ -22,7 +22,6 @@
>  #define __ASSUME_LISTEN_SYSCALL		1
>  #define __ASSUME_GETSOCKNAME_SYSCALL	1
>  #define __ASSUME_GETPEERNAME_SYSCALL	1
> -#define __ASSUME_SOCKETPAIR_SYSCALL	1
>  #define __ASSUME_SEND_SYSCALL		1
>  #define __ASSUME_RECV_SYSCALL		1
>  #define __ASSUME_SHUTDOWN_SYSCALL	1
> diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
> index d5991b265b..01fc98e9ab 100644
> --- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
> @@ -19,7 +19,6 @@
>  
>  /* Direct socketcalls available with kernel 4.3.  */
>  #if __LINUX_KERNEL_VERSION >= 0x040300
> -# define __ASSUME_SOCKETPAIR_SYSCALL         1
>  # define __ASSUME_LISTEN_SYSCALL             1
>  # define __ASSUME_GETSOCKNAME_SYSCALL        1
>  # define __ASSUME_GETPEERNAME_SYSCALL        1
> @@ -43,6 +42,7 @@
>  # undef __ASSUME_SETSOCKOPT_SYSCALL
>  # undef __ASSUME_BIND_SYSCALL
>  # undef __ASSUME_SOCKET_SYSCALL
> +# undef __ASSUME_SOCKETPAIR_SYSCALL
>  #endif
>  
>  /* s390 only supports ipc syscall before 5.1.  */
> diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
> index 3b57eb7f27..b18314a9cd 100644
> --- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
> @@ -27,7 +27,6 @@
>  #define __ASSUME_LISTEN_SYSCALL		1
>  #define __ASSUME_GETSOCKNAME_SYSCALL	1
>  #define __ASSUME_GETPEERNAME_SYSCALL	1
> -#define __ASSUME_SOCKETPAIR_SYSCALL	1
>  #define __ASSUME_SEND_SYSCALL		1
>  #define __ASSUME_RECV_SYSCALL		1
>  #define __ASSUME_SHUTDOWN_SYSCALL	1
> diff --git a/sysdeps/unix/sysv/linux/socketpair.c b/sysdeps/unix/sysv/linux/socketpair.c
> index d06cbbc2c9..65f8cb46dc 100644
> --- a/sysdeps/unix/sysv/linux/socketpair.c
> +++ b/sysdeps/unix/sysv/linux/socketpair.c

OK. Default C implementation.

> @@ -15,19 +15,14 @@
>     License along with the GNU C Library; if not, see
>     <https://www.gnu.org/licenses/>.  */
>  
> -#include <errno.h>
> -#include <signal.h>
>  #include <sys/socket.h>
> -
>  #include <socketcall.h>
> -#include <kernel-features.h>
> -#include <sys/syscall.h>
>  
>  int
>  __socketpair (int domain, int type, int protocol, int sv[2])
>  {
>  #ifdef __ASSUME_SOCKETPAIR_SYSCALL
> -  return INLINE_SYSCALL (socketpair, 4, domain, type, protocol, &sv[0]);
> +  return INLINE_SYSCALL_CALL (socketpair, domain, type, protocol, &sv[0]);

OK.

>  #else
>    return SOCKETCALL (socketpair, domain, type, protocol, sv);
>  #endif
> diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
> index f3a5ef6a99..f43e5c384f 100644
> --- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
> @@ -41,7 +41,6 @@
>  # undef __ASSUME_GETSOCKOPT_SYSCALL
>  # undef __ASSUME_SETSOCKOPT_SYSCALL
>  #else
> -# define __ASSUME_SOCKETPAIR_SYSCALL         1
>  # define __ASSUME_SHUTDOWN_SYSCALL           1
>  #endif
>  

-- 
Cheers,
Carlos.


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

* Re: [PATCH 21/30] Linux: Assume and consolidate listen wire-up syscall
  2022-10-19 22:14 ` [PATCH 21/30] Linux: Assume and consolidate listen " Adhemerval Zanella via Libc-alpha
@ 2022-12-06 16:17   ` Carlos O'Donell via Libc-alpha
  0 siblings, 0 replies; 68+ messages in thread
From: Carlos O'Donell via Libc-alpha @ 2022-12-06 16:17 UTC (permalink / raw)
  To: Adhemerval Zanella, libc-alpha

On 10/19/22 18:14, Adhemerval Zanella via Libc-alpha wrote:
> And disable if kernel does not support it.
> 
> Checked on x86_64-linux-gnu and i686-linux-gnu.

LGTM.

No regressions on x86_64 and i686.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>

> ---
>  sysdeps/unix/sysv/linux/generic/syscalls.list        | 1 -
>  sysdeps/unix/sysv/linux/i386/kernel-features.h       | 2 +-
>  sysdeps/unix/sysv/linux/kernel-features.h            | 1 +
>  sysdeps/unix/sysv/linux/listen.c                     | 7 +------
>  sysdeps/unix/sysv/linux/m68k/kernel-features.h       | 2 +-
>  sysdeps/unix/sysv/linux/microblaze/kernel-features.h | 1 -
>  sysdeps/unix/sysv/linux/powerpc/kernel-features.h    | 1 -
>  sysdeps/unix/sysv/linux/s390/kernel-features.h       | 2 +-
>  sysdeps/unix/sysv/linux/sh/kernel-features.h         | 1 -
>  sysdeps/unix/sysv/linux/sparc/kernel-features.h      | 5 +----
>  10 files changed, 6 insertions(+), 17 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
> index 95ed2cbac8..706893f245 100644
> --- a/sysdeps/unix/sysv/linux/generic/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
> @@ -1,7 +1,6 @@
>  # File name	Caller	Syscall name	# args	Strong name	Weak names
>  
>  # Socket APIs
> -listen		-	listen		i:ii	__listen	listen

OK. Remove wrapper.

>  getsockname	-	getsockname	i:ipp	__getsockname	getsockname
>  getpeername	-	getpeername	i:ipp	__getpeername	getpeername
>  shutdown	-	shutdown	i:ii	__shutdown	shutdown
> diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
> index 8a7fe47602..a79ec679cc 100644
> --- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
> @@ -19,7 +19,6 @@
>  
>  /* Direct socketcalls available with kernel 4.3.  */
>  #if __LINUX_KERNEL_VERSION >= 0x040300
> -# define __ASSUME_LISTEN_SYSCALL             1
>  # define __ASSUME_GETSOCKNAME_SYSCALL        1
>  # define __ASSUME_GETPEERNAME_SYSCALL        1
>  # define __ASSUME_SHUTDOWN_SYSCALL           1
> @@ -41,6 +40,7 @@
>  # undef __ASSUME_BIND_SYSCALL
>  # undef __ASSUME_SOCKET_SYSCALL
>  # undef __ASSUME_SOCKETPAIR_SYSCALL
> +# undef __ASSUME_LISTEN_SYSCALL

OK. Accept it.

>  #endif
>  
>  /* i686 only supports ipc syscall before 5.1.  */
> diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
> index fd44b39cf4..d1769b2d99 100644
> --- a/sysdeps/unix/sysv/linux/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/kernel-features.h
> @@ -82,6 +82,7 @@
>  #define __ASSUME_BIND_SYSCALL		1
>  #define __ASSUME_SOCKET_SYSCALL		1
>  #define __ASSUME_SOCKETPAIR_SYSCALL	1
> +#define __ASSUME_LISTEN_SYSCALL		1

OK. Default.

>  
>  /* Support for SysV IPC through wired syscalls.  All supported architectures
>     either support ipc syscall and/or all the ipc correspondent syscalls.  */
> diff --git a/sysdeps/unix/sysv/linux/listen.c b/sysdeps/unix/sysv/linux/listen.c
> index 8d7ff85edf..e563e4df6c 100644
> --- a/sysdeps/unix/sysv/linux/listen.c
> +++ b/sysdeps/unix/sysv/linux/listen.c

OK. Now the default wrapper.

> @@ -15,19 +15,14 @@
>     License along with the GNU C Library; if not, see
>     <https://www.gnu.org/licenses/>.  */
>  
> -#include <errno.h>
> -#include <signal.h>
>  #include <sys/socket.h>
> -
>  #include <socketcall.h>
> -#include <kernel-features.h>
> -#include <sys/syscall.h>
>  
>  int
>  listen (int fd, int backlog)
>  {
>  #ifdef __ASSUME_LISTEN_SYSCALL
> -  return INLINE_SYSCALL (listen, 2, fd, backlog);
> +  return INLINE_SYSCALL_CALL (listen, fd, backlog);

OK.

>  #else
>    return SOCKETCALL (listen, fd, backlog);
>  #endif
> diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> index 46b3045b56..a65fa63c5e 100644
> --- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> @@ -19,7 +19,6 @@
>  
>  /* Direct socketcalls available with kernel 4.3.  */
>  #if __LINUX_KERNEL_VERSION >= 0x040300
> -# define __ASSUME_LISTEN_SYSCALL             1
>  # define __ASSUME_GETSOCKNAME_SYSCALL        1
>  # define __ASSUME_GETPEERNAME_SYSCALL        1
>  # define __ASSUME_SHUTDOWN_SYSCALL           1
> @@ -43,6 +42,7 @@
>  # undef __ASSUME_BIND_SYSCALL
>  # undef __ASSUME_SOCKET_SYSCALL
>  # undef __ASSUME_SOCKETPAIR_SYSCALL
> +# undef __ASSUME_LISTEN_SYSCALL
>  #endif
>  
>  /* No support for PI futexes or robust mutexes before 3.10 for m68k.  */
> diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
> index 198ff3209d..e19e6bb6ba 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
> @@ -19,7 +19,6 @@
>  
>  /* All supported kernel versions for MicroBlaze have these syscalls.  */
>  #define __ASSUME_CONNECT_SYSCALL	1
> -#define __ASSUME_LISTEN_SYSCALL		1
>  #define __ASSUME_GETSOCKNAME_SYSCALL	1
>  #define __ASSUME_GETPEERNAME_SYSCALL	1
>  #define __ASSUME_SEND_SYSCALL		1
> diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
> index 72ec2df178..eb73a91a5d 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
> @@ -19,7 +19,6 @@
>  
>  /* New syscalls added for PowerPC in 2.6.37.  */
>  #define __ASSUME_CONNECT_SYSCALL	1
> -#define __ASSUME_LISTEN_SYSCALL		1
>  #define __ASSUME_GETSOCKNAME_SYSCALL	1
>  #define __ASSUME_GETPEERNAME_SYSCALL	1
>  #define __ASSUME_SEND_SYSCALL		1
> diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
> index 01fc98e9ab..3daee3f132 100644
> --- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
> @@ -19,7 +19,6 @@
>  
>  /* Direct socketcalls available with kernel 4.3.  */
>  #if __LINUX_KERNEL_VERSION >= 0x040300
> -# define __ASSUME_LISTEN_SYSCALL             1
>  # define __ASSUME_GETSOCKNAME_SYSCALL        1
>  # define __ASSUME_GETPEERNAME_SYSCALL        1
>  # define __ASSUME_SHUTDOWN_SYSCALL           1
> @@ -43,6 +42,7 @@
>  # undef __ASSUME_BIND_SYSCALL
>  # undef __ASSUME_SOCKET_SYSCALL
>  # undef __ASSUME_SOCKETPAIR_SYSCALL
> +# undef __ASSUME_LISTEN_SYSCALL
>  #endif
>  
>  /* s390 only supports ipc syscall before 5.1.  */
> diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
> index b18314a9cd..23eadf84e0 100644
> --- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
> @@ -24,7 +24,6 @@
>  
>  /* These syscalls were added for SH in 2.6.37.  */
>  #define __ASSUME_CONNECT_SYSCALL	1
> -#define __ASSUME_LISTEN_SYSCALL		1
>  #define __ASSUME_GETSOCKNAME_SYSCALL	1
>  #define __ASSUME_GETPEERNAME_SYSCALL	1
>  #define __ASSUME_SEND_SYSCALL		1
> diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
> index f43e5c384f..7070aaa1ae 100644
> --- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
> @@ -45,12 +45,9 @@
>  #endif
>  
>  /* These syscalls were added for both 32-bit and 64-bit in 4.4.  */
> -#if __LINUX_KERNEL_VERSION >= 0x040400
> -# define __ASSUME_LISTEN_SYSCALL             1
> -#endif
> -
>  #if __LINUX_KERNEL_VERSION < 0x040400
>  # undef __ASSUME_BIND_SYSCALL
> +# undef __ASSUME_LISTEN_SYSCALL
>  #endif
>  
>  #ifdef __arch64__

-- 
Cheers,
Carlos.


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

* Re: [PATCH 22/30] Linux: Assume and consolidate getsockname wire-up syscall
  2022-10-19 22:14 ` [PATCH 22/30] Linux: Assume and consolidate getsockname " Adhemerval Zanella via Libc-alpha
  2022-10-20  0:01   ` Joseph Myers
@ 2022-12-06 16:18   ` Carlos O'Donell via Libc-alpha
  1 sibling, 0 replies; 68+ messages in thread
From: Carlos O'Donell via Libc-alpha @ 2022-12-06 16:18 UTC (permalink / raw)
  To: Adhemerval Zanella, libc-alpha

On 10/19/22 18:14, Adhemerval Zanella via Libc-alpha wrote:
> And disable if kernel does not support it.
> 
> Checked on x86_64-linux-gnu and i686-linux-gnu.

LGTM.

No regressions on x86_64 and i686.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>

> ---
>  sysdeps/unix/sysv/linux/generic/syscalls.list        | 1 -
>  sysdeps/unix/sysv/linux/getsockname.c                | 7 +------
>  sysdeps/unix/sysv/linux/i386/kernel-features.h       | 2 +-
>  sysdeps/unix/sysv/linux/kernel-features.h            | 1 +
>  sysdeps/unix/sysv/linux/m68k/kernel-features.h       | 2 +-
>  sysdeps/unix/sysv/linux/microblaze/kernel-features.h | 1 -
>  sysdeps/unix/sysv/linux/powerpc/kernel-features.h    | 1 -
>  sysdeps/unix/sysv/linux/s390/kernel-features.h       | 2 +-
>  sysdeps/unix/sysv/linux/sh/kernel-features.h         | 1 -
>  9 files changed, 5 insertions(+), 13 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
> index 706893f245..a5bb00a3e4 100644
> --- a/sysdeps/unix/sysv/linux/generic/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
> @@ -1,6 +1,5 @@
>  # File name	Caller	Syscall name	# args	Strong name	Weak names
>  
>  # Socket APIs
> -getsockname	-	getsockname	i:ipp	__getsockname	getsockname

OK. Remove wrapper.

>  getpeername	-	getpeername	i:ipp	__getpeername	getpeername
>  shutdown	-	shutdown	i:ii	__shutdown	shutdown
> diff --git a/sysdeps/unix/sysv/linux/getsockname.c b/sysdeps/unix/sysv/linux/getsockname.c
> index d0718c2aaf..8350b800fe 100644
> --- a/sysdeps/unix/sysv/linux/getsockname.c
> +++ b/sysdeps/unix/sysv/linux/getsockname.c
> @@ -15,19 +15,14 @@
>     License along with the GNU C Library; if not, see
>     <https://www.gnu.org/licenses/>.  */
>  
> -#include <errno.h>
> -#include <signal.h>
>  #include <sys/socket.h>
> -
>  #include <socketcall.h>
> -#include <kernel-features.h>
> -#include <sys/syscall.h>
>  
>  int
>  __getsockname (int fd, __SOCKADDR_ARG addr, socklen_t *len)
>  {
>  #ifdef __ASSUME_GETSOCKNAME_SYSCALL
> -  return INLINE_SYSCALL (getsockname, 3, fd, addr.__sockaddr__, len);
> +  return INLINE_SYSCALL_CALL (getsockname, fd, addr.__sockaddr__, len);

OK.

>  #else
>    return SOCKETCALL (getsockname, fd, addr.__sockaddr__, len);
>  #endif
> diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
> index a79ec679cc..f294380215 100644
> --- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
> @@ -19,7 +19,6 @@
>  
>  /* Direct socketcalls available with kernel 4.3.  */
>  #if __LINUX_KERNEL_VERSION >= 0x040300
> -# define __ASSUME_GETSOCKNAME_SYSCALL        1
>  # define __ASSUME_GETPEERNAME_SYSCALL        1
>  # define __ASSUME_SHUTDOWN_SYSCALL           1
>  #endif
> @@ -41,6 +40,7 @@
>  # undef __ASSUME_SOCKET_SYSCALL
>  # undef __ASSUME_SOCKETPAIR_SYSCALL
>  # undef __ASSUME_LISTEN_SYSCALL
> +# undef __ASSUME_GETSOCKNAME_SYSCALL
>  #endif
>  
>  /* i686 only supports ipc syscall before 5.1.  */
> diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
> index d1769b2d99..6fb99f5c35 100644
> --- a/sysdeps/unix/sysv/linux/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/kernel-features.h
> @@ -83,6 +83,7 @@
>  #define __ASSUME_SOCKET_SYSCALL		1
>  #define __ASSUME_SOCKETPAIR_SYSCALL	1
>  #define __ASSUME_LISTEN_SYSCALL		1
> +#define __ASSUME_GETSOCKNAME_SYSCALL	1
>  
>  /* Support for SysV IPC through wired syscalls.  All supported architectures
>     either support ipc syscall and/or all the ipc correspondent syscalls.  */
> diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> index a65fa63c5e..898c24ba62 100644
> --- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> @@ -19,7 +19,6 @@
>  
>  /* Direct socketcalls available with kernel 4.3.  */
>  #if __LINUX_KERNEL_VERSION >= 0x040300
> -# define __ASSUME_GETSOCKNAME_SYSCALL        1
>  # define __ASSUME_GETPEERNAME_SYSCALL        1
>  # define __ASSUME_SHUTDOWN_SYSCALL           1
>  #endif
> @@ -43,6 +42,7 @@
>  # undef __ASSUME_SOCKET_SYSCALL
>  # undef __ASSUME_SOCKETPAIR_SYSCALL
>  # undef __ASSUME_LISTEN_SYSCALL
> +# undef __ASSUME_GETSOCKNAME_SYSCALL
>  #endif
>  
>  /* No support for PI futexes or robust mutexes before 3.10 for m68k.  */
> diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
> index e19e6bb6ba..7e2b15859e 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
> @@ -19,7 +19,6 @@
>  
>  /* All supported kernel versions for MicroBlaze have these syscalls.  */
>  #define __ASSUME_CONNECT_SYSCALL	1
> -#define __ASSUME_GETSOCKNAME_SYSCALL	1
>  #define __ASSUME_GETPEERNAME_SYSCALL	1
>  #define __ASSUME_SEND_SYSCALL		1
>  #define __ASSUME_RECV_SYSCALL		1
> diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
> index eb73a91a5d..8953cb019f 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
> @@ -19,7 +19,6 @@
>  
>  /* New syscalls added for PowerPC in 2.6.37.  */
>  #define __ASSUME_CONNECT_SYSCALL	1
> -#define __ASSUME_GETSOCKNAME_SYSCALL	1
>  #define __ASSUME_GETPEERNAME_SYSCALL	1
>  #define __ASSUME_SEND_SYSCALL		1
>  #define __ASSUME_RECV_SYSCALL		1
> diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
> index 3daee3f132..1422ee620c 100644
> --- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
> @@ -19,7 +19,6 @@
>  
>  /* Direct socketcalls available with kernel 4.3.  */
>  #if __LINUX_KERNEL_VERSION >= 0x040300
> -# define __ASSUME_GETSOCKNAME_SYSCALL        1
>  # define __ASSUME_GETPEERNAME_SYSCALL        1
>  # define __ASSUME_SHUTDOWN_SYSCALL           1
>  #endif
> @@ -43,6 +42,7 @@
>  # undef __ASSUME_SOCKET_SYSCALL
>  # undef __ASSUME_SOCKETPAIR_SYSCALL
>  # undef __ASSUME_LISTEN_SYSCALL
> +# undef __ASSUME_GETSOCKNAME_SYSCALL
>  #endif
>  
>  /* s390 only supports ipc syscall before 5.1.  */
> diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
> index 23eadf84e0..91dc28f33f 100644
> --- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
> @@ -24,7 +24,6 @@
>  
>  /* These syscalls were added for SH in 2.6.37.  */
>  #define __ASSUME_CONNECT_SYSCALL	1
> -#define __ASSUME_GETSOCKNAME_SYSCALL	1
>  #define __ASSUME_GETPEERNAME_SYSCALL	1
>  #define __ASSUME_SEND_SYSCALL		1
>  #define __ASSUME_RECV_SYSCALL		1

-- 
Cheers,
Carlos.


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

* Re: [PATCH 23/30] Linux: Assume and consolidate getpeername wire-up syscall
  2022-10-19 22:14 ` [PATCH 23/30] Linux: Assume and consolidate getpeername " Adhemerval Zanella via Libc-alpha
  2022-10-20  0:02   ` Joseph Myers
@ 2022-12-06 16:20   ` Carlos O'Donell via Libc-alpha
  1 sibling, 0 replies; 68+ messages in thread
From: Carlos O'Donell via Libc-alpha @ 2022-12-06 16:20 UTC (permalink / raw)
  To: Adhemerval Zanella, libc-alpha

On 10/19/22 18:14, Adhemerval Zanella via Libc-alpha wrote:
> And disable if kernel does not support it.
> 
> Checked on x86_64-linux-gnu and i686-linux-gnu.

I assume this needs a v2 for the sparc32 changes noted by Joseph.

It looks good to me for the other arches.

Tested-by: Carlos O'Donell <carlos@redhat.com>

> ---
>  sysdeps/unix/sysv/linux/generic/syscalls.list        | 1 -
>  sysdeps/unix/sysv/linux/getpeername.c                | 7 +------
>  sysdeps/unix/sysv/linux/i386/kernel-features.h       | 2 +-
>  sysdeps/unix/sysv/linux/kernel-features.h            | 1 +
>  sysdeps/unix/sysv/linux/m68k/kernel-features.h       | 2 +-
>  sysdeps/unix/sysv/linux/microblaze/kernel-features.h | 1 -
>  sysdeps/unix/sysv/linux/powerpc/kernel-features.h    | 1 -
>  sysdeps/unix/sysv/linux/s390/kernel-features.h       | 2 +-
>  sysdeps/unix/sysv/linux/sh/kernel-features.h         | 1 -
>  9 files changed, 5 insertions(+), 13 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
> index a5bb00a3e4..b000ca3c7c 100644
> --- a/sysdeps/unix/sysv/linux/generic/syscalls.list
> +++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
> @@ -1,5 +1,4 @@
>  # File name	Caller	Syscall name	# args	Strong name	Weak names
>  
>  # Socket APIs
> -getpeername	-	getpeername	i:ipp	__getpeername	getpeername

OK. Remove default wrapper.

>  shutdown	-	shutdown	i:ii	__shutdown	shutdown
> diff --git a/sysdeps/unix/sysv/linux/getpeername.c b/sysdeps/unix/sysv/linux/getpeername.c
> index 09ca76b9ad..63fa8e2fe5 100644
> --- a/sysdeps/unix/sysv/linux/getpeername.c
> +++ b/sysdeps/unix/sysv/linux/getpeername.c
> @@ -15,19 +15,14 @@
>     License along with the GNU C Library; if not, see
>     <https://www.gnu.org/licenses/>.  */
>  
> -#include <errno.h>
> -#include <signal.h>
>  #include <sys/socket.h>
> -
>  #include <socketcall.h>
> -#include <kernel-features.h>
> -#include <sys/syscall.h>
>  
>  int
>  __getpeername (int fd, __SOCKADDR_ARG addr, socklen_t *len)
>  {
>  #ifdef __ASSUME_GETPEERNAME_SYSCALL
> -  return INLINE_SYSCALL (getpeername, 3, fd, addr.__sockaddr__, len);
> +  return INLINE_SYSCALL_CALL (getpeername, fd, addr.__sockaddr__, len);

OK. Default wrapper.

>  #else
>    return SOCKETCALL (getpeername, fd, addr.__sockaddr__, len);
>  #endif
> diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
> index f294380215..423edc9017 100644
> --- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
> @@ -19,7 +19,6 @@
>  
>  /* Direct socketcalls available with kernel 4.3.  */
>  #if __LINUX_KERNEL_VERSION >= 0x040300
> -# define __ASSUME_GETPEERNAME_SYSCALL        1
>  # define __ASSUME_SHUTDOWN_SYSCALL           1
>  #endif
>  
> @@ -41,6 +40,7 @@
>  # undef __ASSUME_SOCKETPAIR_SYSCALL
>  # undef __ASSUME_LISTEN_SYSCALL
>  # undef __ASSUME_GETSOCKNAME_SYSCALL
> +# undef __ASSUME_GETPEERNAME_SYSCALL
>  #endif
>  
>  /* i686 only supports ipc syscall before 5.1.  */
> diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
> index 6fb99f5c35..c751530cd3 100644
> --- a/sysdeps/unix/sysv/linux/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/kernel-features.h
> @@ -84,6 +84,7 @@
>  #define __ASSUME_SOCKETPAIR_SYSCALL	1
>  #define __ASSUME_LISTEN_SYSCALL		1
>  #define __ASSUME_GETSOCKNAME_SYSCALL	1
> +#define __ASSUME_GETPEERNAME_SYSCALL	1
>  
>  /* Support for SysV IPC through wired syscalls.  All supported architectures
>     either support ipc syscall and/or all the ipc correspondent syscalls.  */
> diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> index 898c24ba62..a7b3458a21 100644
> --- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> @@ -19,7 +19,6 @@
>  
>  /* Direct socketcalls available with kernel 4.3.  */
>  #if __LINUX_KERNEL_VERSION >= 0x040300
> -# define __ASSUME_GETPEERNAME_SYSCALL        1
>  # define __ASSUME_SHUTDOWN_SYSCALL           1
>  #endif
>  
> @@ -43,6 +42,7 @@
>  # undef __ASSUME_SOCKETPAIR_SYSCALL
>  # undef __ASSUME_LISTEN_SYSCALL
>  # undef __ASSUME_GETSOCKNAME_SYSCALL
> +# undef __ASSUME_GETPEERNAME_SYSCALL
>  #endif
>  
>  /* No support for PI futexes or robust mutexes before 3.10 for m68k.  */
> diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
> index 7e2b15859e..328529434d 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
> @@ -19,7 +19,6 @@
>  
>  /* All supported kernel versions for MicroBlaze have these syscalls.  */
>  #define __ASSUME_CONNECT_SYSCALL	1
> -#define __ASSUME_GETPEERNAME_SYSCALL	1
>  #define __ASSUME_SEND_SYSCALL		1
>  #define __ASSUME_RECV_SYSCALL		1
>  #define __ASSUME_SHUTDOWN_SYSCALL	1
> diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
> index 8953cb019f..7fae7ca429 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
> @@ -19,7 +19,6 @@
>  
>  /* New syscalls added for PowerPC in 2.6.37.  */
>  #define __ASSUME_CONNECT_SYSCALL	1
> -#define __ASSUME_GETPEERNAME_SYSCALL	1
>  #define __ASSUME_SEND_SYSCALL		1
>  #define __ASSUME_RECV_SYSCALL		1
>  #define __ASSUME_SHUTDOWN_SYSCALL	1
> diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
> index 1422ee620c..e797b71052 100644
> --- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
> @@ -19,7 +19,6 @@
>  
>  /* Direct socketcalls available with kernel 4.3.  */
>  #if __LINUX_KERNEL_VERSION >= 0x040300
> -# define __ASSUME_GETPEERNAME_SYSCALL        1
>  # define __ASSUME_SHUTDOWN_SYSCALL           1
>  #endif
>  
> @@ -43,6 +42,7 @@
>  # undef __ASSUME_SOCKETPAIR_SYSCALL
>  # undef __ASSUME_LISTEN_SYSCALL
>  # undef __ASSUME_GETSOCKNAME_SYSCALL
> +# undef __ASSUME_GETPEERNAME_SYSCALL
>  #endif
>  
>  /* s390 only supports ipc syscall before 5.1.  */
> diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
> index 91dc28f33f..3a0b4e6198 100644
> --- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
> @@ -24,7 +24,6 @@
>  
>  /* These syscalls were added for SH in 2.6.37.  */
>  #define __ASSUME_CONNECT_SYSCALL	1
> -#define __ASSUME_GETPEERNAME_SYSCALL	1
>  #define __ASSUME_SEND_SYSCALL		1
>  #define __ASSUME_RECV_SYSCALL		1
>  #define __ASSUME_SHUTDOWN_SYSCALL	1

-- 
Cheers,
Carlos.


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

* Re: [PATCH 24/30] Linux: Assume and consolidate shutdown wire-up syscall
  2022-10-19 22:14 ` [PATCH 24/30] Linux: Assume and consolidate shutdown " Adhemerval Zanella via Libc-alpha
@ 2022-12-06 16:23   ` Carlos O'Donell via Libc-alpha
  0 siblings, 0 replies; 68+ messages in thread
From: Carlos O'Donell via Libc-alpha @ 2022-12-06 16:23 UTC (permalink / raw)
  To: Adhemerval Zanella, libc-alpha

On 10/19/22 18:14, Adhemerval Zanella via Libc-alpha wrote:
> And disable if kernel does not support it.
> 
> Checked on x86_64-linux-gnu and i686-linux-gnu.

LGTM.

No regressions on x86_64 and i686.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>

> ---
>  sysdeps/unix/sysv/linux/generic/syscalls.list        | 4 ----
>  sysdeps/unix/sysv/linux/i386/kernel-features.h       | 7 ++-----
>  sysdeps/unix/sysv/linux/kernel-features.h            | 1 +
>  sysdeps/unix/sysv/linux/m68k/kernel-features.h       | 7 ++-----
>  sysdeps/unix/sysv/linux/microblaze/kernel-features.h | 1 -
>  sysdeps/unix/sysv/linux/powerpc/kernel-features.h    | 1 -
>  sysdeps/unix/sysv/linux/s390/kernel-features.h       | 7 ++-----
>  sysdeps/unix/sysv/linux/sh/kernel-features.h         | 1 -
>  sysdeps/unix/sysv/linux/shutdown.c                   | 7 +------
>  sysdeps/unix/sysv/linux/sparc/kernel-features.h      | 2 --
>  10 files changed, 8 insertions(+), 30 deletions(-)
>  delete mode 100644 sysdeps/unix/sysv/linux/generic/syscalls.list
> 
> diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
> deleted file mode 100644
> index b000ca3c7c..0000000000
> --- a/sysdeps/unix/sysv/linux/generic/syscalls.list
> +++ /dev/null
> @@ -1,4 +0,0 @@
> -# File name	Caller	Syscall name	# args	Strong name	Weak names
> -
> -# Socket APIs
> -shutdown	-	shutdown	i:ii	__shutdown	shutdown

OK. Remove shutdown syscall wrapper and removes last entry in syscalls.list.

> diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
> index 423edc9017..e726fc657a 100644
> --- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
> @@ -17,15 +17,11 @@
>     License along with the GNU C Library; if not, see
>     <https://www.gnu.org/licenses/>.  */
>  
> -/* Direct socketcalls available with kernel 4.3.  */
> -#if __LINUX_KERNEL_VERSION >= 0x040300
> -# define __ASSUME_SHUTDOWN_SYSCALL           1
> -#endif
> -

OK.

>  #include_next <kernel-features.h>
>  
>  #undef __ASSUME_ACCEPT_SYSCALL
>  
> +/* Direct socketcalls available with kernel 4.3.  */
>  #if __LINUX_KERNEL_VERSION < 0x040300
>  # undef __ASSUME_ACCEPT4_SYSCALL
>  # undef __ASSUME_SENDMSG_SYSCALL
> @@ -41,6 +37,7 @@
>  # undef __ASSUME_LISTEN_SYSCALL
>  # undef __ASSUME_GETSOCKNAME_SYSCALL
>  # undef __ASSUME_GETPEERNAME_SYSCALL
> +# undef __ASSUME_SHUTDOWN_SYSCALL
>  #endif
>  
>  /* i686 only supports ipc syscall before 5.1.  */
> diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
> index c751530cd3..23586c88d3 100644
> --- a/sysdeps/unix/sysv/linux/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/kernel-features.h
> @@ -85,6 +85,7 @@
>  #define __ASSUME_LISTEN_SYSCALL		1
>  #define __ASSUME_GETSOCKNAME_SYSCALL	1
>  #define __ASSUME_GETPEERNAME_SYSCALL	1
> +#define __ASSUME_SHUTDOWN_SYSCALL	1
>  
>  /* Support for SysV IPC through wired syscalls.  All supported architectures
>     either support ipc syscall and/or all the ipc correspondent syscalls.  */
> diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> index a7b3458a21..1ad1193afb 100644
> --- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
> @@ -17,15 +17,11 @@
>     License along with the GNU C Library.  If not, see
>     <https://www.gnu.org/licenses/>.  */
>  
> -/* Direct socketcalls available with kernel 4.3.  */
> -#if __LINUX_KERNEL_VERSION >= 0x040300
> -# define __ASSUME_SHUTDOWN_SYSCALL           1
> -#endif
> -
>  #include_next <kernel-features.h>
>  
>  #undef __ASSUME_ACCEPT_SYSCALL
>  
> +/* Direct socketcalls available with kernel 4.3.  */
>  #if __LINUX_KERNEL_VERSION < 0x040300
>  # undef __ASSUME_ACCEPT4_SYSCALL
>  # undef __ASSUME_RECVMMSG_SYSCALL
> @@ -43,6 +39,7 @@
>  # undef __ASSUME_LISTEN_SYSCALL
>  # undef __ASSUME_GETSOCKNAME_SYSCALL
>  # undef __ASSUME_GETPEERNAME_SYSCALL
> +# undef __ASSUME_SHUTDOWN_SYSCALL
>  #endif
>  
>  /* No support for PI futexes or robust mutexes before 3.10 for m68k.  */
> diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
> index 328529434d..72496aa922 100644
> --- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
> @@ -21,7 +21,6 @@
>  #define __ASSUME_CONNECT_SYSCALL	1
>  #define __ASSUME_SEND_SYSCALL		1
>  #define __ASSUME_RECV_SYSCALL		1
> -#define __ASSUME_SHUTDOWN_SYSCALL	1
>  
>  #include_next <kernel-features.h>
>  
> diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
> index 7fae7ca429..e2dc7a15a3 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
> @@ -21,7 +21,6 @@
>  #define __ASSUME_CONNECT_SYSCALL	1
>  #define __ASSUME_SEND_SYSCALL		1
>  #define __ASSUME_RECV_SYSCALL		1
> -#define __ASSUME_SHUTDOWN_SYSCALL	1
>  
>  /* Define this if your 32-bit syscall API requires 64-bit register
>     pairs to start with an even-number register.  */
> diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
> index e797b71052..b39e4736b3 100644
> --- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
> @@ -17,15 +17,11 @@
>     License along with the GNU C Library; if not, see
>     <https://www.gnu.org/licenses/>.  */
>  
> -/* Direct socketcalls available with kernel 4.3.  */
> -#if __LINUX_KERNEL_VERSION >= 0x040300
> -# define __ASSUME_SHUTDOWN_SYSCALL           1
> -#endif
> -
>  #include_next <kernel-features.h>
>  
>  #undef __ASSUME_ACCEPT_SYSCALL
>  
> +/* Direct socketcalls available with kernel 4.3.  */
>  #if __LINUX_KERNEL_VERSION < 0x040300
>  # undef __ASSUME_ACCEPT4_SYSCALL
>  # undef __ASSUME_RECVMMSG_SYSCALL
> @@ -43,6 +39,7 @@
>  # undef __ASSUME_LISTEN_SYSCALL
>  # undef __ASSUME_GETSOCKNAME_SYSCALL
>  # undef __ASSUME_GETPEERNAME_SYSCALL
> +# undef __ASSUME_SHUTDOWN_SYSCALL
>  #endif
>  
>  /* s390 only supports ipc syscall before 5.1.  */
> diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
> index 3a0b4e6198..ae1387e7d7 100644
> --- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
> @@ -26,7 +26,6 @@
>  #define __ASSUME_CONNECT_SYSCALL	1
>  #define __ASSUME_SEND_SYSCALL		1
>  #define __ASSUME_RECV_SYSCALL		1
> -#define __ASSUME_SHUTDOWN_SYSCALL	1
>  
>  #include_next <kernel-features.h>
>  
> diff --git a/sysdeps/unix/sysv/linux/shutdown.c b/sysdeps/unix/sysv/linux/shutdown.c
> index 26772c9b28..4cee357b9b 100644
> --- a/sysdeps/unix/sysv/linux/shutdown.c
> +++ b/sysdeps/unix/sysv/linux/shutdown.c
> @@ -15,19 +15,14 @@
>     License along with the GNU C Library; if not, see
>     <https://www.gnu.org/licenses/>.  */
>  
> -#include <errno.h>
> -#include <signal.h>
>  #include <sys/socket.h>
> -
>  #include <socketcall.h>
> -#include <kernel-features.h>
> -#include <sys/syscall.h>
>  
>  int
>  __shutdown (int fd, int how)
>  {
>  #ifdef __ASSUME_SHUTDOWN_SYSCALL
> -  return INLINE_SYSCALL (shutdown, 2, fd, how);
> +  return INLINE_SYSCALL_CALL (shutdown, fd, how);

OK.

>  #else
>    return SOCKETCALL (shutdown, fd, how);
>  #endif
> diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
> index 7070aaa1ae..12e98a9f95 100644
> --- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
> +++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
> @@ -40,8 +40,6 @@
>  # undef __ASSUME_SENDTO_SYSCALL
>  # undef __ASSUME_GETSOCKOPT_SYSCALL
>  # undef __ASSUME_SETSOCKOPT_SYSCALL
> -#else
> -# define __ASSUME_SHUTDOWN_SYSCALL           1
>  #endif
>  
>  /* These syscalls were added for both 32-bit and 64-bit in 4.4.  */

-- 
Cheers,
Carlos.


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

* Re: [PATCH 25/30] Linux: Remove unused generic Makefile
  2022-10-19 22:14 ` [PATCH 25/30] Linux: Remove unused generic Makefile Adhemerval Zanella via Libc-alpha
@ 2022-12-06 17:24   ` Carlos O'Donell via Libc-alpha
  2022-12-07 21:19     ` Adhemerval Zanella Netto via Libc-alpha
  0 siblings, 1 reply; 68+ messages in thread
From: Carlos O'Donell via Libc-alpha @ 2022-12-06 17:24 UTC (permalink / raw)
  To: Adhemerval Zanella, libc-alpha

On 10/19/22 18:14, Adhemerval Zanella via Libc-alpha wrote:
> Both are already defined on default linux Makefile.

Is this true? It is defined in the default syscalls.list and built
as a wrapper from that.

With your series applied I see things like:

(echo '#define SYSCALL_NAME epoll_create'; \
 echo '#define SYSCALL_NARGS 1'; \
 echo '#define SYSCALL_ULONG_ARG_1 0'; \
 echo '#define SYSCALL_ULONG_ARG_2 0'; \
 echo '#define SYSCALL_SYMBOL epoll_create'; \
 echo '#define SYSCALL_NOERRNO 0'; \
 echo '#define SYSCALL_ERRVAL 0'; \
 echo '#include <syscall-template.S>'; \
) | gcc -Wl,--build-id=none -c ...

objdump -ldr misc/epoll_create.os

misc/epoll_create.os:     file format elf64-x86-64


Disassembly of section .text:

0000000000000000 <__GI_epoll_create>:
epoll_create():
/mnt/ssd/carlos/src/glibc-work/misc/../sysdeps/unix/syscall-template.S:120
   0:	b8 d5 00 00 00       	mov    $0xd5,%eax
   5:	0f 05                	syscall 
   7:	48 3d 01 f0 ff ff    	cmp    $0xfffffffffffff001,%rax
   d:	73 01                	jae    10 <__GI_epoll_create+0x10>
/mnt/ssd/carlos/src/glibc-work/misc/../sysdeps/unix/syscall-template.S:122
   f:	c3                   	ret    
/mnt/ssd/carlos/src/glibc-work/misc/../sysdeps/unix/syscall-template.S:123
  10:	48 8b 0d 00 00 00 00 	mov    0x0(%rip),%rcx        # 17 <__GI_epoll_create+0x17>
			13: R_X86_64_GOTTPOFF	__libc_errno-0x4
  17:	f7 d8                	neg    %eax
  19:	64 89 01             	mov    %eax,%fs:(%rcx)
  1c:	48 83 c8 ff          	or     $0xffffffffffffffff,%rax
  20:	c3                   	ret    

There is no Makefile definition for these so the C versions are
going to be unused until the syscalls.list entry is removed?

May you please confirm using a final build that we don't still need this?

Likewise we should probably cross-check bewteen the makefiles and the
syscalls-list to see what is and isn't being built with wrappers.

> ---
>  sysdeps/unix/sysv/linux/generic/Makefile | 3 ---
>  1 file changed, 3 deletions(-)
>  delete mode 100644 sysdeps/unix/sysv/linux/generic/Makefile
> 
> diff --git a/sysdeps/unix/sysv/linux/generic/Makefile b/sysdeps/unix/sysv/linux/generic/Makefile
> deleted file mode 100644
> index 7e27e79772..0000000000
> --- a/sysdeps/unix/sysv/linux/generic/Makefile
> +++ /dev/null
> @@ -1,3 +0,0 @@
> -ifeq ($(subdir),misc)
> -sysdep_routines += epoll_create inotify_init
> -endif



-- 
Cheers,
Carlos.


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

* Re: [PATCH 26/30] Linux: Remove generic sysdep
  2022-10-19 22:14 ` [PATCH 26/30] Linux: Remove generic sysdep Adhemerval Zanella via Libc-alpha
@ 2022-12-06 17:29   ` Carlos O'Donell via Libc-alpha
  0 siblings, 0 replies; 68+ messages in thread
From: Carlos O'Donell via Libc-alpha @ 2022-12-06 17:29 UTC (permalink / raw)
  To: Adhemerval Zanella, libc-alpha

On 10/19/22 18:14, Adhemerval Zanella via Libc-alpha wrote:
> The includes chain is added on each architecture sysdep.h and
> the __NR__llseek hack is moved to lseek.c and lseek64.c.

LGTM.

No regressions on x86_64 and i686.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>

> ---
>  sysdeps/unix/sysv/linux/aarch64/sysdep.h   |  3 ++-
>  sysdeps/unix/sysv/linux/arc/sysdep.h       |  4 +++-
>  sysdeps/unix/sysv/linux/csky/sysdep.h      |  2 +-
>  sysdeps/unix/sysv/linux/generic/sysdep.h   | 26 ----------------------
>  sysdeps/unix/sysv/linux/loongarch/sysdep.h |  3 ++-
>  sysdeps/unix/sysv/linux/lseek.c            |  4 ++++
>  sysdeps/unix/sysv/linux/lseek64.c          |  4 ++++
>  sysdeps/unix/sysv/linux/nios2/sysdep.h     |  2 +-
>  sysdeps/unix/sysv/linux/or1k/sysdep.h      |  3 ++-
>  sysdeps/unix/sysv/linux/riscv/sysdep.h     |  3 ++-
>  10 files changed, 21 insertions(+), 33 deletions(-)
>  delete mode 100644 sysdeps/unix/sysv/linux/generic/sysdep.h
> 
> diff --git a/sysdeps/unix/sysv/linux/aarch64/sysdep.h b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
> index f1853e012f..df5075aceb 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/sysdep.h
> +++ b/sysdeps/unix/sysv/linux/aarch64/sysdep.h
> @@ -21,7 +21,8 @@
>  
>  #include <sysdeps/unix/sysdep.h>
>  #include <sysdeps/aarch64/sysdep.h>
> -#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
> +#include <sysdeps/unix/sysdep.h>
> +#include <sysdeps/unix/sysv/linux/sysdep.h>
>  
>  /* Defines RTLD_PRIVATE_ERRNO and USE_DL_SYSINFO.  */
>  #include <dl-sysdep.h>
> diff --git a/sysdeps/unix/sysv/linux/arc/sysdep.h b/sysdeps/unix/sysv/linux/arc/sysdep.h
> index d0c1a78381..90a92566a7 100644
> --- a/sysdeps/unix/sysv/linux/arc/sysdep.h
> +++ b/sysdeps/unix/sysv/linux/arc/sysdep.h
> @@ -20,7 +20,9 @@
>  #define _LINUX_ARC_SYSDEP_H 1
>  
>  #include <sysdeps/arc/sysdep.h>
> -#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
> +#include <bits/wordsize.h>
> +#include <sysdeps/unix/sysdep.h>
> +#include <sysdeps/unix/sysv/linux/sysdep.h>
>  
>  /* "workarounds" for generic code needing to handle 64-bit time_t.  */
>  
> diff --git a/sysdeps/unix/sysv/linux/csky/sysdep.h b/sysdeps/unix/sysv/linux/csky/sysdep.h
> index 56c527fa8b..39c13c6d38 100644
> --- a/sysdeps/unix/sysv/linux/csky/sysdep.h
> +++ b/sysdeps/unix/sysv/linux/csky/sysdep.h
> @@ -20,9 +20,9 @@
>  #define _LINUX_CSKY_SYSDEP_H 1
>  
>  /* There is some commonality.  */
> -#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
>  #include <sysdeps/unix/sysv/linux/sysdep.h>
>  #include <sysdeps/csky/sysdep.h>
> +#include <sysdeps/unix/sysdep.h>
>  
>  /* Defines RTLD_PRIVATE_ERRNO and USE_DL_SYSINFO.  */
>  #include <dl-sysdep.h>
> diff --git a/sysdeps/unix/sysv/linux/generic/sysdep.h b/sysdeps/unix/sysv/linux/generic/sysdep.h
> deleted file mode 100644
> index 7af5cb4e16..0000000000
> --- a/sysdeps/unix/sysv/linux/generic/sysdep.h
> +++ /dev/null
> @@ -1,26 +0,0 @@
> -/* Copyright (C) 2011-2022 Free Software Foundation, Inc.
> -   This file is part of the GNU C Library.
> -
> -   The GNU C Library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 of the License, or (at your option) any later version.
> -
> -   The GNU C Library is distributed in the hope that it will be useful,
> -   but WITHOUT ANY WARRANTY; without even the implied warranty of
> -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with the GNU C Library.  If not, see
> -   <https://www.gnu.org/licenses/>.  */
> -
> -#include <bits/wordsize.h>
> -#include <kernel-features.h>
> -#include <sysdeps/unix/sysdep.h>
> -#include <sysdeps/unix/sysv/linux/sysdep.h>
> -
> -/* Provide the common name to allow more code reuse.  */
> -#ifdef __NR_llseek
> -# define __NR__llseek __NR_llseek
> -#endif

OK. Remove generic version and consolidate.

> diff --git a/sysdeps/unix/sysv/linux/loongarch/sysdep.h b/sysdeps/unix/sysv/linux/loongarch/sysdep.h
> index f4a1d23a97..e2bb39a8f8 100644
> --- a/sysdeps/unix/sysv/linux/loongarch/sysdep.h
> +++ b/sysdeps/unix/sysv/linux/loongarch/sysdep.h
> @@ -19,7 +19,8 @@
>  #ifndef _LINUX_LOONGARCH_SYSDEP_H
>  #define _LINUX_LOONGARCH_SYSDEP_H 1
>  
> -#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
> +#include <sysdeps/unix/sysv/linux/sysdep.h>
> +#include <sysdeps/unix/sysdep.h>
>  #include <tls.h>
>  
>  #ifdef __ASSEMBLER__
> diff --git a/sysdeps/unix/sysv/linux/lseek.c b/sysdeps/unix/sysv/linux/lseek.c
> index 148503d7bc..3f10c8dc96 100644
> --- a/sysdeps/unix/sysv/linux/lseek.c
> +++ b/sysdeps/unix/sysv/linux/lseek.c
> @@ -41,6 +41,10 @@ static inline off_t lseek_overflow (loff_t res)
>  off_t
>  __lseek (int fd, off_t offset, int whence)
>  {
> +#ifdef __NR_llseek
> +# define __NR__llseek __NR_llseek
> +#endif

OK. Agreed, good to move this here.

> +
>  # ifdef __NR__llseek
>    loff_t res;
>    int rc = INLINE_SYSCALL_CALL (_llseek, fd,
> diff --git a/sysdeps/unix/sysv/linux/lseek64.c b/sysdeps/unix/sysv/linux/lseek64.c
> index 74aab82f5a..d14ba9e12b 100644
> --- a/sysdeps/unix/sysv/linux/lseek64.c
> +++ b/sysdeps/unix/sysv/linux/lseek64.c
> @@ -26,6 +26,10 @@
>  off64_t
>  __lseek64 (int fd, off64_t offset, int whence)
>  {
> +#ifdef __NR_llseek
> +# define __NR__llseek __NR_llseek
> +#endif

OK. Agreed.

> +
>  #ifdef __NR__llseek
>    loff_t res;
>    int rc = INLINE_SYSCALL_CALL (_llseek, fd,
> diff --git a/sysdeps/unix/sysv/linux/nios2/sysdep.h b/sysdeps/unix/sysv/linux/nios2/sysdep.h
> index 5fe960c2a5..4c9aba497b 100644
> --- a/sysdeps/unix/sysv/linux/nios2/sysdep.h
> +++ b/sysdeps/unix/sysv/linux/nios2/sysdep.h
> @@ -19,9 +19,9 @@
>  #ifndef _LINUX_NIOS2_SYSDEP_H
>  #define _LINUX_NIOS2_SYSDEP_H 1
>  
> +#include <sysdeps/unix/sysv/linux/sysdep.h>
>  #include <sysdeps/unix/sysdep.h>
>  #include <sysdeps/nios2/sysdep.h>
> -#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
>  
>  /* For RTLD_PRIVATE_ERRNO.  */
>  #include <dl-sysdep.h>
> diff --git a/sysdeps/unix/sysv/linux/or1k/sysdep.h b/sysdeps/unix/sysv/linux/or1k/sysdep.h
> index 941c934554..fd884606ee 100644
> --- a/sysdeps/unix/sysv/linux/or1k/sysdep.h
> +++ b/sysdeps/unix/sysv/linux/or1k/sysdep.h
> @@ -19,8 +19,9 @@
>  #ifndef _LINUX_OR1K_SYSDEP_H
>  #define _LINUX_OR1K_SYSDEP_H 1
>  
> +#include <sysdeps/unix/sysv/linux/sysdep.h>
>  #include <sysdeps/or1k/sysdep.h>
> -#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
> +#include <sysdeps/unix/sysdep.h>
>  #include <tls.h>
>  
>  /* "workarounds" for generic code needing to handle 64-bit time_t.  */
> diff --git a/sysdeps/unix/sysv/linux/riscv/sysdep.h b/sysdeps/unix/sysv/linux/riscv/sysdep.h
> index 9b03b10567..c2c9b0c937 100644
> --- a/sysdeps/unix/sysv/linux/riscv/sysdep.h
> +++ b/sysdeps/unix/sysv/linux/riscv/sysdep.h
> @@ -19,7 +19,8 @@
>  #ifndef _LINUX_RISCV_SYSDEP_H
>  #define _LINUX_RISCV_SYSDEP_H 1
>  
> -#include <sysdeps/unix/sysv/linux/generic/sysdep.h>
> +#include <sysdeps/unix/sysv/linux/sysdep.h>
> +#include <sysdeps/unix/sysdep.h>
>  #include <tls.h>
>  
>  #undef SYS_ify

-- 
Cheers,
Carlos.


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

* Re: [PATCH 27/30] Linux: make generic xstatver.h the default one
  2022-10-19 22:14 ` [PATCH 27/30] Linux: make generic xstatver.h the default one Adhemerval Zanella via Libc-alpha
@ 2022-12-06 17:33   ` Carlos O'Donell via Libc-alpha
  0 siblings, 0 replies; 68+ messages in thread
From: Carlos O'Donell via Libc-alpha @ 2022-12-06 17:33 UTC (permalink / raw)
  To: Adhemerval Zanella, libc-alpha

On 10/19/22 18:14, Adhemerval Zanella via Libc-alpha wrote:
> And copy the current default one to required ABIs.

LGTM.

No regressions on x86_64 and i686.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>

> ---
>  sysdeps/unix/sysv/linux/{generic => arm}/xstatver.h | 11 +++++++----
>  sysdeps/unix/sysv/linux/hppa/xstatver.h             | 13 +++++++++++++
>  sysdeps/unix/sysv/linux/sh/xstatver.h               | 13 +++++++++++++
>  sysdeps/unix/sysv/linux/xstatver.h                  | 11 ++++-------
>  4 files changed, 37 insertions(+), 11 deletions(-)
>  rename sysdeps/unix/sysv/linux/{generic => arm}/xstatver.h (52%)
>  create mode 100644 sysdeps/unix/sysv/linux/hppa/xstatver.h
>  create mode 100644 sysdeps/unix/sysv/linux/sh/xstatver.h
> 
> diff --git a/sysdeps/unix/sysv/linux/generic/xstatver.h b/sysdeps/unix/sysv/linux/arm/xstatver.h
> similarity index 52%
> rename from sysdeps/unix/sysv/linux/generic/xstatver.h
> rename to sysdeps/unix/sysv/linux/arm/xstatver.h
> index d8fd35beb6..8e1801b603 100644
> --- a/sysdeps/unix/sysv/linux/generic/xstatver.h
> +++ b/sysdeps/unix/sysv/linux/arm/xstatver.h
> @@ -1,10 +1,13 @@
>  /* Versions of the 'struct stat' data structure used in compatibility xstat
>     functions.  */
> -#define _STAT_VER_KERNEL	0
> -#define _STAT_VER_LINUX		0
> -#define _STAT_VER		_STAT_VER_KERNEL
> +#define _STAT_VER_LINUX_OLD	1
> +#define _STAT_VER_KERNEL	1
> +#define _STAT_VER_SVR4		2
> +#define _STAT_VER_LINUX		3
> +#define _STAT_VER		_STAT_VER_LINUX

OK. Matches.

>  
>  /* Versions of the 'xmknod' interface used in compatibility xmknod
>     functions.  */
> -#define _MKNOD_VER_LINUX	0
> +#define _MKNOD_VER_LINUX	1
> +#define _MKNOD_VER_SVR4		2
>  #define _MKNOD_VER		_MKNOD_VER_LINUX

OK. Matches.

> diff --git a/sysdeps/unix/sysv/linux/hppa/xstatver.h b/sysdeps/unix/sysv/linux/hppa/xstatver.h
> new file mode 100644
> index 0000000000..8e1801b603
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/hppa/xstatver.h
> @@ -0,0 +1,13 @@
> +/* Versions of the 'struct stat' data structure used in compatibility xstat
> +   functions.  */
> +#define _STAT_VER_LINUX_OLD	1
> +#define _STAT_VER_KERNEL	1
> +#define _STAT_VER_SVR4		2
> +#define _STAT_VER_LINUX		3
> +#define _STAT_VER		_STAT_VER_LINUX

OK. Matches.

> +
> +/* Versions of the 'xmknod' interface used in compatibility xmknod
> +   functions.  */
> +#define _MKNOD_VER_LINUX	1
> +#define _MKNOD_VER_SVR4		2
> +#define _MKNOD_VER		_MKNOD_VER_LINUX

OK. Matches.

> diff --git a/sysdeps/unix/sysv/linux/sh/xstatver.h b/sysdeps/unix/sysv/linux/sh/xstatver.h
> new file mode 100644
> index 0000000000..8e1801b603
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/sh/xstatver.h
> @@ -0,0 +1,13 @@
> +/* Versions of the 'struct stat' data structure used in compatibility xstat
> +   functions.  */
> +#define _STAT_VER_LINUX_OLD	1
> +#define _STAT_VER_KERNEL	1
> +#define _STAT_VER_SVR4		2
> +#define _STAT_VER_LINUX		3
> +#define _STAT_VER		_STAT_VER_LINUX

OK. Matches.

> +
> +/* Versions of the 'xmknod' interface used in compatibility xmknod
> +   functions.  */
> +#define _MKNOD_VER_LINUX	1
> +#define _MKNOD_VER_SVR4		2
> +#define _MKNOD_VER		_MKNOD_VER_LINUX

OK. Matches.

> diff --git a/sysdeps/unix/sysv/linux/xstatver.h b/sysdeps/unix/sysv/linux/xstatver.h
> index 8e1801b603..d8fd35beb6 100644
> --- a/sysdeps/unix/sysv/linux/xstatver.h
> +++ b/sysdeps/unix/sysv/linux/xstatver.h
> @@ -1,13 +1,10 @@
>  /* Versions of the 'struct stat' data structure used in compatibility xstat
>     functions.  */
> -#define _STAT_VER_LINUX_OLD	1
> -#define _STAT_VER_KERNEL	1
> -#define _STAT_VER_SVR4		2
> -#define _STAT_VER_LINUX		3
> -#define _STAT_VER		_STAT_VER_LINUX

OK. Move to the targets.

> +#define _STAT_VER_KERNEL	0
> +#define _STAT_VER_LINUX		0
> +#define _STAT_VER		_STAT_VER_KERNEL
>  
>  /* Versions of the 'xmknod' interface used in compatibility xmknod
>     functions.  */
> -#define _MKNOD_VER_LINUX	1
> -#define _MKNOD_VER_SVR4		2

OK. Move to the targets.

> +#define _MKNOD_VER_LINUX	0
>  #define _MKNOD_VER		_MKNOD_VER_LINUX

-- 
Cheers,
Carlos.


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

* Re: [PATCH 28/30] Linux: Make generic fcntl.h the default one
  2022-10-19 22:14 ` [PATCH 28/30] Linux: Make generic fcntl.h " Adhemerval Zanella via Libc-alpha
@ 2022-12-06 17:36   ` Carlos O'Donell via Libc-alpha
  0 siblings, 0 replies; 68+ messages in thread
From: Carlos O'Donell via Libc-alpha @ 2022-12-06 17:36 UTC (permalink / raw)
  To: Adhemerval Zanella, libc-alpha

On 10/19/22 18:14, Adhemerval Zanella via Libc-alpha wrote:
> It is currently used for csky, arc, nios2, and or1k.  Newer 64 bit
> architecture, like riscv32 and loongarch, reimplement it to override
> F_GETLK64/F_SETLK64/F_SETLKW64.

LGTM.

No regressions on x86_64 and i686.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>


> ---
>  sysdeps/unix/sysv/linux/bits/fcntl.h         | 56 +++++++++++++++++++-
>  sysdeps/unix/sysv/linux/generic/bits/fcntl.h | 55 -------------------
>  2 files changed, 54 insertions(+), 57 deletions(-)
>  delete mode 100644 sysdeps/unix/sysv/linux/generic/bits/fcntl.h
> 
> diff --git a/sysdeps/unix/sysv/linux/bits/fcntl.h b/sysdeps/unix/sysv/linux/bits/fcntl.h
> index be40350e82..112ee96df5 100644
> --- a/sysdeps/unix/sysv/linux/bits/fcntl.h
> +++ b/sysdeps/unix/sysv/linux/bits/fcntl.h
> @@ -1,3 +1,55 @@
> -/* bits/fcntl.h is architecture specific.  */
> -#error "This file must be supplied by every Linux architecture."
> +/* O_*, F_*, FD_* bit values for the generic Linux ABI.
> +   Copyright (C) 2011-2022 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
>  
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library.  If not, see
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#ifndef	_FCNTL_H
> +# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
> +#endif
> +
> +#include <bits/wordsize.h>
> +
> +#if __WORDSIZE == 64
> +# define __O_LARGEFILE	0
> +#endif
> +
> +struct flock
> +  {
> +    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.	*/
> +    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
> +#ifndef __USE_FILE_OFFSET64
> +    __off_t l_start;	/* Offset where the lock begins.  */
> +    __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
> +#else
> +    __off64_t l_start;	/* Offset where the lock begins.  */
> +    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
> +#endif
> +    __pid_t l_pid;	/* Process holding the lock.  */
> +  };
> +
> +#ifdef __USE_LARGEFILE64
> +struct flock64
> +  {
> +    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.	*/
> +    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
> +    __off64_t l_start;	/* Offset where the lock begins.  */
> +    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
> +    __pid_t l_pid;	/* Process holding the lock.  */
> +  };
> +#endif
> +
> +/* Include generic Linux declarations.  */
> +#include <bits/fcntl-linux.h>

OK. Move generic to linux. Flattens the structure and one less file to maintain.

> diff --git a/sysdeps/unix/sysv/linux/generic/bits/fcntl.h b/sysdeps/unix/sysv/linux/generic/bits/fcntl.h
> deleted file mode 100644
> index 112ee96df5..0000000000
> --- a/sysdeps/unix/sysv/linux/generic/bits/fcntl.h
> +++ /dev/null
> @@ -1,55 +0,0 @@
> -/* O_*, F_*, FD_* bit values for the generic Linux ABI.
> -   Copyright (C) 2011-2022 Free Software Foundation, Inc.
> -   This file is part of the GNU C Library.
> -
> -   The GNU C Library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 of the License, or (at your option) any later version.
> -
> -   The GNU C Library is distributed in the hope that it will be useful,
> -   but WITHOUT ANY WARRANTY; without even the implied warranty of
> -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with the GNU C Library.  If not, see
> -   <https://www.gnu.org/licenses/>.  */
> -
> -#ifndef	_FCNTL_H
> -# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
> -#endif
> -
> -#include <bits/wordsize.h>
> -
> -#if __WORDSIZE == 64
> -# define __O_LARGEFILE	0
> -#endif
> -
> -struct flock
> -  {
> -    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.	*/
> -    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
> -#ifndef __USE_FILE_OFFSET64
> -    __off_t l_start;	/* Offset where the lock begins.  */
> -    __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
> -#else
> -    __off64_t l_start;	/* Offset where the lock begins.  */
> -    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
> -#endif
> -    __pid_t l_pid;	/* Process holding the lock.  */
> -  };
> -
> -#ifdef __USE_LARGEFILE64
> -struct flock64
> -  {
> -    short int l_type;	/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.	*/
> -    short int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
> -    __off64_t l_start;	/* Offset where the lock begins.  */
> -    __off64_t l_len;	/* Size of the locked area; zero means until EOF.  */
> -    __pid_t l_pid;	/* Process holding the lock.  */
> -  };
> -#endif
> -
> -/* Include generic Linux declarations.  */
> -#include <bits/fcntl-linux.h>

-- 
Cheers,
Carlos.


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

* Re: [PATCH 29/30] Linux: Consolidate typesizes.h
  2022-10-19 22:14 ` [PATCH 29/30] Linux: Consolidate typesizes.h Adhemerval Zanella via Libc-alpha
@ 2022-12-06 17:47   ` Carlos O'Donell via Libc-alpha
  0 siblings, 0 replies; 68+ messages in thread
From: Carlos O'Donell via Libc-alpha @ 2022-12-06 17:47 UTC (permalink / raw)
  To: Adhemerval Zanella, libc-alpha

On 10/19/22 18:14, Adhemerval Zanella via Libc-alpha wrote:
> The generic (sysdeps/unix/sysv/linux/generic/bits/typesizes.h) and
> default (bits/typesizes.h) differs in two fields:
> 
>                     bits/typesizes.h    Linux generic
> __NLINK_T_TYPE      __UWORD_TYPE        __U32_TYPE
> __BLKSIZE_T_TYPE    __SLONGWORD_TYPE    __S32_TYPE
> 
> Sinceit leads to different C++ mangling names, the default typesize.h
> is copied for the requires archtiectures and the generic is make the
> default Linux one.

LGTM. Although this isn't quite a consolidation. However, for future-looking work we
now have one default Linux typesizes.h to use (rather than a generic and a linux one).
I appreciate that we flatten the set of files to maintain and remove the generic
version. This is conceptually easier to understand e.g. Generic, Generic Linux, Archful
-> Generic Linux, Archful.

The types look correctly copied to me, and match what was existing for the architectures.

No regressions on x86_64 and i686.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>

> ---
>  sysdeps/unix/sysv/linux/arm/bits/typesizes.h  | 74 +++++++++++++++
>  .../sysv/linux/{generic => }/bits/typesizes.h |  0
>  sysdeps/unix/sysv/linux/hppa/bits/typesizes.h | 74 +++++++++++++++
>  sysdeps/unix/sysv/linux/ia64/bits/typesizes.h | 86 +++++++++++++++++
>  sysdeps/unix/sysv/linux/m68k/bits/typesizes.h | 74 +++++++++++++++
>  .../sysv/linux/microblaze/bits/typesizes.h    | 74 +++++++++++++++
>  sysdeps/unix/sysv/linux/mips/bits/typesizes.h | 95 +++++++++++++++++++
>  .../unix/sysv/linux/powerpc/bits/typesizes.h  | 95 +++++++++++++++++++
>  sysdeps/unix/sysv/linux/sh/bits/typesizes.h   | 74 +++++++++++++++
>  9 files changed, 646 insertions(+)
>  create mode 100644 sysdeps/unix/sysv/linux/arm/bits/typesizes.h
>  rename sysdeps/unix/sysv/linux/{generic => }/bits/typesizes.h (100%)
>  create mode 100644 sysdeps/unix/sysv/linux/hppa/bits/typesizes.h
>  create mode 100644 sysdeps/unix/sysv/linux/ia64/bits/typesizes.h
>  create mode 100644 sysdeps/unix/sysv/linux/m68k/bits/typesizes.h
>  create mode 100644 sysdeps/unix/sysv/linux/microblaze/bits/typesizes.h
>  create mode 100644 sysdeps/unix/sysv/linux/mips/bits/typesizes.h
>  create mode 100644 sysdeps/unix/sysv/linux/powerpc/bits/typesizes.h
>  create mode 100644 sysdeps/unix/sysv/linux/sh/bits/typesizes.h
> 
> diff --git a/sysdeps/unix/sysv/linux/arm/bits/typesizes.h b/sysdeps/unix/sysv/linux/arm/bits/typesizes.h
> new file mode 100644
> index 0000000000..255bf39de3
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/arm/bits/typesizes.h
> @@ -0,0 +1,74 @@
> +/* bits/typesizes.h -- underlying types for *_t.  ARM version.
> +   Copyright (C) 2002-2022 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#ifndef _BITS_TYPES_H
> +# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
> +#endif
> +
> +#ifndef	_BITS_TYPESIZES_H
> +#define	_BITS_TYPESIZES_H	1
> +
> +/* See <bits/types.h> for the meaning of these macros.  This file exists so
> +   that <bits/types.h> need not vary across different GNU platforms.  */
> +
> +#define __DEV_T_TYPE		__UQUAD_TYPE
> +#define __UID_T_TYPE		__U32_TYPE
> +#define __GID_T_TYPE		__U32_TYPE
> +#define __INO_T_TYPE		__ULONGWORD_TYPE
> +#define __INO64_T_TYPE		__UQUAD_TYPE
> +#define __MODE_T_TYPE		__U32_TYPE
> +#define __NLINK_T_TYPE		__UWORD_TYPE
> +#define __OFF_T_TYPE		__SLONGWORD_TYPE
> +#define __OFF64_T_TYPE		__SQUAD_TYPE
> +#define __PID_T_TYPE		__S32_TYPE
> +#define __RLIM_T_TYPE		__ULONGWORD_TYPE
> +#define __RLIM64_T_TYPE		__UQUAD_TYPE
> +#define	__BLKCNT_T_TYPE		__SLONGWORD_TYPE
> +#define	__BLKCNT64_T_TYPE	__SQUAD_TYPE
> +#define	__FSBLKCNT_T_TYPE	__ULONGWORD_TYPE
> +#define	__FSBLKCNT64_T_TYPE	__UQUAD_TYPE
> +#define	__FSFILCNT_T_TYPE	__ULONGWORD_TYPE
> +#define	__FSFILCNT64_T_TYPE	__UQUAD_TYPE
> +#define	__FSWORD_T_TYPE		__SWORD_TYPE
> +#define	__ID_T_TYPE		__U32_TYPE
> +#define __CLOCK_T_TYPE		__SLONGWORD_TYPE
> +#define __TIME_T_TYPE		__SLONGWORD_TYPE
> +#define __USECONDS_T_TYPE	__U32_TYPE
> +#define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE
> +#define __SUSECONDS64_T_TYPE	__SQUAD_TYPE
> +#define __DADDR_T_TYPE		__S32_TYPE
> +#define __KEY_T_TYPE		__S32_TYPE
> +#define __CLOCKID_T_TYPE	__S32_TYPE
> +#define __TIMER_T_TYPE		void *
> +#define __BLKSIZE_T_TYPE	__SLONGWORD_TYPE
> +#define __FSID_T_TYPE		struct { int __val[2]; }
> +#define __SSIZE_T_TYPE		__SWORD_TYPE
> +#define __SYSCALL_SLONG_TYPE	__SLONGWORD_TYPE
> +#define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE
> +#define __CPU_MASK_TYPE 	__ULONGWORD_TYPE
> +
> +#define __RLIM_T_MATCHES_RLIM64_T		0
> +#define __STATFS_MATCHES_STATFS64		0
> +/* And for getitimer, setitimer and rusage  */
> +#define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64	0
> +
> +/* Number of descriptors that can fit in an `fd_set'.  */
> +#define	__FD_SETSIZE		1024
> +
> +
> +#endif /* bits/typesizes.h */
> diff --git a/sysdeps/unix/sysv/linux/generic/bits/typesizes.h b/sysdeps/unix/sysv/linux/bits/typesizes.h
> similarity index 100%
> rename from sysdeps/unix/sysv/linux/generic/bits/typesizes.h
> rename to sysdeps/unix/sysv/linux/bits/typesizes.h
> diff --git a/sysdeps/unix/sysv/linux/hppa/bits/typesizes.h b/sysdeps/unix/sysv/linux/hppa/bits/typesizes.h
> new file mode 100644
> index 0000000000..d32e354d36
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/hppa/bits/typesizes.h
> @@ -0,0 +1,74 @@
> +/* bits/typesizes.h -- underlying types for *_t.  HPPA version.
> +   Copyright (C) 2002-2022 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#ifndef _BITS_TYPES_H
> +# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
> +#endif
> +
> +#ifndef	_BITS_TYPESIZES_H
> +#define	_BITS_TYPESIZES_H	1
> +
> +/* See <bits/types.h> for the meaning of these macros.  This file exists so
> +   that <bits/types.h> need not vary across different GNU platforms.  */
> +
> +#define __DEV_T_TYPE		__UQUAD_TYPE
> +#define __UID_T_TYPE		__U32_TYPE
> +#define __GID_T_TYPE		__U32_TYPE
> +#define __INO_T_TYPE		__ULONGWORD_TYPE
> +#define __INO64_T_TYPE		__UQUAD_TYPE
> +#define __MODE_T_TYPE		__U32_TYPE
> +#define __NLINK_T_TYPE		__UWORD_TYPE
> +#define __OFF_T_TYPE		__SLONGWORD_TYPE
> +#define __OFF64_T_TYPE		__SQUAD_TYPE
> +#define __PID_T_TYPE		__S32_TYPE
> +#define __RLIM_T_TYPE		__ULONGWORD_TYPE
> +#define __RLIM64_T_TYPE		__UQUAD_TYPE
> +#define	__BLKCNT_T_TYPE		__SLONGWORD_TYPE
> +#define	__BLKCNT64_T_TYPE	__SQUAD_TYPE
> +#define	__FSBLKCNT_T_TYPE	__ULONGWORD_TYPE
> +#define	__FSBLKCNT64_T_TYPE	__UQUAD_TYPE
> +#define	__FSFILCNT_T_TYPE	__ULONGWORD_TYPE
> +#define	__FSFILCNT64_T_TYPE	__UQUAD_TYPE
> +#define	__FSWORD_T_TYPE		__SWORD_TYPE
> +#define	__ID_T_TYPE		__U32_TYPE
> +#define __CLOCK_T_TYPE		__SLONGWORD_TYPE
> +#define __TIME_T_TYPE		__SLONGWORD_TYPE
> +#define __USECONDS_T_TYPE	__U32_TYPE
> +#define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE
> +#define __SUSECONDS64_T_TYPE	__SQUAD_TYPE
> +#define __DADDR_T_TYPE		__S32_TYPE
> +#define __KEY_T_TYPE		__S32_TYPE
> +#define __CLOCKID_T_TYPE	__S32_TYPE
> +#define __TIMER_T_TYPE		void *
> +#define __BLKSIZE_T_TYPE	__SLONGWORD_TYPE
> +#define __FSID_T_TYPE		struct { int __val[2]; }
> +#define __SSIZE_T_TYPE		__SWORD_TYPE
> +#define __SYSCALL_SLONG_TYPE	__SLONGWORD_TYPE
> +#define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE
> +#define __CPU_MASK_TYPE 	__ULONGWORD_TYPE
> +
> +#define __RLIM_T_MATCHES_RLIM64_T		0
> +#define __STATFS_MATCHES_STATFS64		0
> +/* And for getitimer, setitimer and rusage  */
> +#define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64	0
> +
> +/* Number of descriptors that can fit in an `fd_set'.  */
> +#define	__FD_SETSIZE		1024
> +
> +
> +#endif /* bits/typesizes.h */
> diff --git a/sysdeps/unix/sysv/linux/ia64/bits/typesizes.h b/sysdeps/unix/sysv/linux/ia64/bits/typesizes.h
> new file mode 100644
> index 0000000000..20a2f886cb
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/ia64/bits/typesizes.h
> @@ -0,0 +1,86 @@
> +/* bits/typesizes.h -- underlying types for *_t.  IA64 version.
> +   Copyright (C) 2002-2022 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#ifndef _BITS_TYPES_H
> +# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
> +#endif
> +
> +#ifndef	_BITS_TYPESIZES_H
> +#define	_BITS_TYPESIZES_H	1
> +
> +/* See <bits/types.h> for the meaning of these macros.  This file exists so
> +   that <bits/types.h> need not vary across different GNU platforms.  */
> +
> +#define __DEV_T_TYPE		__UQUAD_TYPE
> +#define __UID_T_TYPE		__U32_TYPE
> +#define __GID_T_TYPE		__U32_TYPE
> +#define __INO_T_TYPE		__ULONGWORD_TYPE
> +#define __INO64_T_TYPE		__UQUAD_TYPE
> +#define __MODE_T_TYPE		__U32_TYPE
> +#define __NLINK_T_TYPE		__UWORD_TYPE
> +#define __OFF_T_TYPE		__SLONGWORD_TYPE
> +#define __OFF64_T_TYPE		__SQUAD_TYPE
> +#define __PID_T_TYPE		__S32_TYPE
> +#define __RLIM_T_TYPE		__ULONGWORD_TYPE
> +#define __RLIM64_T_TYPE		__UQUAD_TYPE
> +#define	__BLKCNT_T_TYPE		__SLONGWORD_TYPE
> +#define	__BLKCNT64_T_TYPE	__SQUAD_TYPE
> +#define	__FSBLKCNT_T_TYPE	__ULONGWORD_TYPE
> +#define	__FSBLKCNT64_T_TYPE	__UQUAD_TYPE
> +#define	__FSFILCNT_T_TYPE	__ULONGWORD_TYPE
> +#define	__FSFILCNT64_T_TYPE	__UQUAD_TYPE
> +#define	__FSWORD_T_TYPE		__SWORD_TYPE
> +#define	__ID_T_TYPE		__U32_TYPE
> +#define __CLOCK_T_TYPE		__SLONGWORD_TYPE
> +#define __TIME_T_TYPE		__SLONGWORD_TYPE
> +#define __USECONDS_T_TYPE	__U32_TYPE
> +#define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE
> +#define __SUSECONDS64_T_TYPE	__SQUAD_TYPE
> +#define __DADDR_T_TYPE		__S32_TYPE
> +#define __KEY_T_TYPE		__S32_TYPE
> +#define __CLOCKID_T_TYPE	__S32_TYPE
> +#define __TIMER_T_TYPE		void *
> +#define __BLKSIZE_T_TYPE	__SLONGWORD_TYPE
> +#define __FSID_T_TYPE		struct { int __val[2]; }
> +#define __SSIZE_T_TYPE		__SWORD_TYPE
> +#define __SYSCALL_SLONG_TYPE	__SLONGWORD_TYPE
> +#define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE
> +#define __CPU_MASK_TYPE 	__ULONGWORD_TYPE
> +
> +/* Tell the libc code that off_t and off64_t are actually the same type
> +   for all ABI purposes, even if possibly expressed as different base types
> +   for C type-checking purposes.  */
> +#define __OFF_T_MATCHES_OFF64_T	1
> +
> +/* Same for ino_t and ino64_t.  */
> +#define __INO_T_MATCHES_INO64_T	1
> +
> +/* And for rlim_t and rlim64_t.  */
> +#define __RLIM_T_MATCHES_RLIM64_T	1
> +
> +/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t.  */
> +#define __STATFS_MATCHES_STATFS64  1
> +
> +/* And for getitimer, setitimer and rusage  */
> +#define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1
> +
> +/* Number of descriptors that can fit in an `fd_set'.  */
> +#define	__FD_SETSIZE		1024
> +
> +
> +#endif /* bits/typesizes.h */
> diff --git a/sysdeps/unix/sysv/linux/m68k/bits/typesizes.h b/sysdeps/unix/sysv/linux/m68k/bits/typesizes.h
> new file mode 100644
> index 0000000000..eeb050200a
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/m68k/bits/typesizes.h
> @@ -0,0 +1,74 @@
> +/* bits/typesizes.h -- underlying types for *_t.  m68k version.
> +   Copyright (C) 2002-2022 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#ifndef _BITS_TYPES_H
> +# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
> +#endif
> +
> +#ifndef	_BITS_TYPESIZES_H
> +#define	_BITS_TYPESIZES_H	1
> +
> +/* See <bits/types.h> for the meaning of these macros.  This file exists so
> +   that <bits/types.h> need not vary across different GNU platforms.  */
> +
> +#define __DEV_T_TYPE		__UQUAD_TYPE
> +#define __UID_T_TYPE		__U32_TYPE
> +#define __GID_T_TYPE		__U32_TYPE
> +#define __INO_T_TYPE		__ULONGWORD_TYPE
> +#define __INO64_T_TYPE		__UQUAD_TYPE
> +#define __MODE_T_TYPE		__U32_TYPE
> +#define __NLINK_T_TYPE		__UWORD_TYPE
> +#define __OFF_T_TYPE		__SLONGWORD_TYPE
> +#define __OFF64_T_TYPE		__SQUAD_TYPE
> +#define __PID_T_TYPE		__S32_TYPE
> +#define __RLIM_T_TYPE		__ULONGWORD_TYPE
> +#define __RLIM64_T_TYPE		__UQUAD_TYPE
> +#define	__BLKCNT_T_TYPE		__SLONGWORD_TYPE
> +#define	__BLKCNT64_T_TYPE	__SQUAD_TYPE
> +#define	__FSBLKCNT_T_TYPE	__ULONGWORD_TYPE
> +#define	__FSBLKCNT64_T_TYPE	__UQUAD_TYPE
> +#define	__FSFILCNT_T_TYPE	__ULONGWORD_TYPE
> +#define	__FSFILCNT64_T_TYPE	__UQUAD_TYPE
> +#define	__FSWORD_T_TYPE		__SWORD_TYPE
> +#define	__ID_T_TYPE		__U32_TYPE
> +#define __CLOCK_T_TYPE		__SLONGWORD_TYPE
> +#define __TIME_T_TYPE		__SLONGWORD_TYPE
> +#define __USECONDS_T_TYPE	__U32_TYPE
> +#define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE
> +#define __SUSECONDS64_T_TYPE	__SQUAD_TYPE
> +#define __DADDR_T_TYPE		__S32_TYPE
> +#define __KEY_T_TYPE		__S32_TYPE
> +#define __CLOCKID_T_TYPE	__S32_TYPE
> +#define __TIMER_T_TYPE		void *
> +#define __BLKSIZE_T_TYPE	__SLONGWORD_TYPE
> +#define __FSID_T_TYPE		struct { int __val[2]; }
> +#define __SSIZE_T_TYPE		__SWORD_TYPE
> +#define __SYSCALL_SLONG_TYPE	__SLONGWORD_TYPE
> +#define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE
> +#define __CPU_MASK_TYPE 	__ULONGWORD_TYPE
> +
> +#define __RLIM_T_MATCHES_RLIM64_T		0
> +#define __STATFS_MATCHES_STATFS64		0
> +/* And for getitimer, setitimer and rusage  */
> +#define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64	0
> +
> +/* Number of descriptors that can fit in an `fd_set'.  */
> +#define	__FD_SETSIZE		1024
> +
> +
> +#endif /* bits/typesizes.h */
> diff --git a/sysdeps/unix/sysv/linux/microblaze/bits/typesizes.h b/sysdeps/unix/sysv/linux/microblaze/bits/typesizes.h
> new file mode 100644
> index 0000000000..4585f506f9
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/microblaze/bits/typesizes.h
> @@ -0,0 +1,74 @@
> +/* bits/typesizes.h -- underlying types for *_t.  Microblaze version.
> +   Copyright (C) 2002-2022 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#ifndef _BITS_TYPES_H
> +# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
> +#endif
> +
> +#ifndef	_BITS_TYPESIZES_H
> +#define	_BITS_TYPESIZES_H	1
> +
> +/* See <bits/types.h> for the meaning of these macros.  This file exists so
> +   that <bits/types.h> need not vary across different GNU platforms.  */
> +
> +#define __DEV_T_TYPE		__UQUAD_TYPE
> +#define __UID_T_TYPE		__U32_TYPE
> +#define __GID_T_TYPE		__U32_TYPE
> +#define __INO_T_TYPE		__ULONGWORD_TYPE
> +#define __INO64_T_TYPE		__UQUAD_TYPE
> +#define __MODE_T_TYPE		__U32_TYPE
> +#define __NLINK_T_TYPE		__UWORD_TYPE
> +#define __OFF_T_TYPE		__SLONGWORD_TYPE
> +#define __OFF64_T_TYPE		__SQUAD_TYPE
> +#define __PID_T_TYPE		__S32_TYPE
> +#define __RLIM_T_TYPE		__ULONGWORD_TYPE
> +#define __RLIM64_T_TYPE		__UQUAD_TYPE
> +#define	__BLKCNT_T_TYPE		__SLONGWORD_TYPE
> +#define	__BLKCNT64_T_TYPE	__SQUAD_TYPE
> +#define	__FSBLKCNT_T_TYPE	__ULONGWORD_TYPE
> +#define	__FSBLKCNT64_T_TYPE	__UQUAD_TYPE
> +#define	__FSFILCNT_T_TYPE	__ULONGWORD_TYPE
> +#define	__FSFILCNT64_T_TYPE	__UQUAD_TYPE
> +#define	__FSWORD_T_TYPE		__SWORD_TYPE
> +#define	__ID_T_TYPE		__U32_TYPE
> +#define __CLOCK_T_TYPE		__SLONGWORD_TYPE
> +#define __TIME_T_TYPE		__SLONGWORD_TYPE
> +#define __USECONDS_T_TYPE	__U32_TYPE
> +#define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE
> +#define __SUSECONDS64_T_TYPE	__SQUAD_TYPE
> +#define __DADDR_T_TYPE		__S32_TYPE
> +#define __KEY_T_TYPE		__S32_TYPE
> +#define __CLOCKID_T_TYPE	__S32_TYPE
> +#define __TIMER_T_TYPE		void *
> +#define __BLKSIZE_T_TYPE	__SLONGWORD_TYPE
> +#define __FSID_T_TYPE		struct { int __val[2]; }
> +#define __SSIZE_T_TYPE		__SWORD_TYPE
> +#define __SYSCALL_SLONG_TYPE	__SLONGWORD_TYPE
> +#define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE
> +#define __CPU_MASK_TYPE 	__ULONGWORD_TYPE
> +
> +#define __RLIM_T_MATCHES_RLIM64_T		0
> +#define __STATFS_MATCHES_STATFS64		0
> +/* And for getitimer, setitimer and rusage  */
> +#define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64	0
> +
> +/* Number of descriptors that can fit in an `fd_set'.  */
> +#define	__FD_SETSIZE		1024
> +
> +
> +#endif /* bits/typesizes.h */
> diff --git a/sysdeps/unix/sysv/linux/mips/bits/typesizes.h b/sysdeps/unix/sysv/linux/mips/bits/typesizes.h
> new file mode 100644
> index 0000000000..7e46d0f53f
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/mips/bits/typesizes.h
> @@ -0,0 +1,95 @@
> +/* bits/typesizes.h -- underlying types for *_t.  MIPS version.
> +   Copyright (C) 2002-2022 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#ifndef _BITS_TYPES_H
> +# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
> +#endif
> +
> +#ifndef	_BITS_TYPESIZES_H
> +#define	_BITS_TYPESIZES_H	1
> +
> +/* See <bits/types.h> for the meaning of these macros.  This file exists so
> +   that <bits/types.h> need not vary across different GNU platforms.  */
> +
> +#define __DEV_T_TYPE		__UQUAD_TYPE
> +#define __UID_T_TYPE		__U32_TYPE
> +#define __GID_T_TYPE		__U32_TYPE
> +#define __INO_T_TYPE		__ULONGWORD_TYPE
> +#define __INO64_T_TYPE		__UQUAD_TYPE
> +#define __MODE_T_TYPE		__U32_TYPE
> +#define __NLINK_T_TYPE		__UWORD_TYPE
> +#define __OFF_T_TYPE		__SLONGWORD_TYPE
> +#define __OFF64_T_TYPE		__SQUAD_TYPE
> +#define __PID_T_TYPE		__S32_TYPE
> +#define __RLIM_T_TYPE		__ULONGWORD_TYPE
> +#define __RLIM64_T_TYPE		__UQUAD_TYPE
> +#define	__BLKCNT_T_TYPE		__SLONGWORD_TYPE
> +#define	__BLKCNT64_T_TYPE	__SQUAD_TYPE
> +#define	__FSBLKCNT_T_TYPE	__ULONGWORD_TYPE
> +#define	__FSBLKCNT64_T_TYPE	__UQUAD_TYPE
> +#define	__FSFILCNT_T_TYPE	__ULONGWORD_TYPE
> +#define	__FSFILCNT64_T_TYPE	__UQUAD_TYPE
> +#define	__FSWORD_T_TYPE		__SWORD_TYPE
> +#define	__ID_T_TYPE		__U32_TYPE
> +#define __CLOCK_T_TYPE		__SLONGWORD_TYPE
> +#define __TIME_T_TYPE		__SLONGWORD_TYPE
> +#define __USECONDS_T_TYPE	__U32_TYPE
> +#define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE
> +#define __SUSECONDS64_T_TYPE	__SQUAD_TYPE
> +#define __DADDR_T_TYPE		__S32_TYPE
> +#define __KEY_T_TYPE		__S32_TYPE
> +#define __CLOCKID_T_TYPE	__S32_TYPE
> +#define __TIMER_T_TYPE		void *
> +#define __BLKSIZE_T_TYPE	__SLONGWORD_TYPE
> +#define __FSID_T_TYPE		struct { int __val[2]; }
> +#define __SSIZE_T_TYPE		__SWORD_TYPE
> +#define __SYSCALL_SLONG_TYPE	__SLONGWORD_TYPE
> +#define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE
> +#define __CPU_MASK_TYPE 	__ULONGWORD_TYPE
> +
> +#ifdef __LP64__
> +/* Tell the libc code that off_t and off64_t are actually the same type
> +   for all ABI purposes, even if possibly expressed as different base types
> +   for C type-checking purposes.  */
> +# define __OFF_T_MATCHES_OFF64_T	1
> +
> +/* Same for ino_t and ino64_t.  */
> +# define __INO_T_MATCHES_INO64_T	1
> +
> +/* And for rlim_t and rlim64_t.  */
> +# define __RLIM_T_MATCHES_RLIM64_T	1
> +
> +/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t.  */
> +# define __STATFS_MATCHES_STATFS64  1
> +
> +/* And for getitimer, setitimer and rusage  */
> +# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1
> +#else
> +# define __RLIM_T_MATCHES_RLIM64_T	0
> +
> +# define __STATFS_MATCHES_STATFS64  0
> +
> +/* And for getitimer, setitimer and rusage  */
> +# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0
> +#endif
> +
> +/* Number of descriptors that can fit in an `fd_set'.  */
> +#define	__FD_SETSIZE		1024
> +
> +
> +#endif /* bits/typesizes.h */
> diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/typesizes.h b/sysdeps/unix/sysv/linux/powerpc/bits/typesizes.h
> new file mode 100644
> index 0000000000..d2a15df721
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/powerpc/bits/typesizes.h
> @@ -0,0 +1,95 @@
> +/* bits/typesizes.h -- underlying types for *_t.  PowerPC version.
> +   Copyright (C) 2002-2022 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#ifndef _BITS_TYPES_H
> +# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
> +#endif
> +
> +#ifndef	_BITS_TYPESIZES_H
> +#define	_BITS_TYPESIZES_H	1
> +
> +/* See <bits/types.h> for the meaning of these macros.  This file exists so
> +   that <bits/types.h> need not vary across different GNU platforms.  */
> +
> +#define __DEV_T_TYPE		__UQUAD_TYPE
> +#define __UID_T_TYPE		__U32_TYPE
> +#define __GID_T_TYPE		__U32_TYPE
> +#define __INO_T_TYPE		__ULONGWORD_TYPE
> +#define __INO64_T_TYPE		__UQUAD_TYPE
> +#define __MODE_T_TYPE		__U32_TYPE
> +#define __NLINK_T_TYPE		__UWORD_TYPE
> +#define __OFF_T_TYPE		__SLONGWORD_TYPE
> +#define __OFF64_T_TYPE		__SQUAD_TYPE
> +#define __PID_T_TYPE		__S32_TYPE
> +#define __RLIM_T_TYPE		__ULONGWORD_TYPE
> +#define __RLIM64_T_TYPE		__UQUAD_TYPE
> +#define	__BLKCNT_T_TYPE		__SLONGWORD_TYPE
> +#define	__BLKCNT64_T_TYPE	__SQUAD_TYPE
> +#define	__FSBLKCNT_T_TYPE	__ULONGWORD_TYPE
> +#define	__FSBLKCNT64_T_TYPE	__UQUAD_TYPE
> +#define	__FSFILCNT_T_TYPE	__ULONGWORD_TYPE
> +#define	__FSFILCNT64_T_TYPE	__UQUAD_TYPE
> +#define	__FSWORD_T_TYPE		__SWORD_TYPE
> +#define	__ID_T_TYPE		__U32_TYPE
> +#define __CLOCK_T_TYPE		__SLONGWORD_TYPE
> +#define __TIME_T_TYPE		__SLONGWORD_TYPE
> +#define __USECONDS_T_TYPE	__U32_TYPE
> +#define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE
> +#define __SUSECONDS64_T_TYPE	__SQUAD_TYPE
> +#define __DADDR_T_TYPE		__S32_TYPE
> +#define __KEY_T_TYPE		__S32_TYPE
> +#define __CLOCKID_T_TYPE	__S32_TYPE
> +#define __TIMER_T_TYPE		void *
> +#define __BLKSIZE_T_TYPE	__SLONGWORD_TYPE
> +#define __FSID_T_TYPE		struct { int __val[2]; }
> +#define __SSIZE_T_TYPE		__SWORD_TYPE
> +#define __SYSCALL_SLONG_TYPE	__SLONGWORD_TYPE
> +#define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE
> +#define __CPU_MASK_TYPE 	__ULONGWORD_TYPE
> +
> +#ifdef __LP64__
> +/* Tell the libc code that off_t and off64_t are actually the same type
> +   for all ABI purposes, even if possibly expressed as different base types
> +   for C type-checking purposes.  */
> +# define __OFF_T_MATCHES_OFF64_T	1
> +
> +/* Same for ino_t and ino64_t.  */
> +# define __INO_T_MATCHES_INO64_T	1
> +
> +/* And for rlim_t and rlim64_t.  */
> +# define __RLIM_T_MATCHES_RLIM64_T	1
> +
> +/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t.  */
> +# define __STATFS_MATCHES_STATFS64  1
> +
> +/* And for getitimer, setitimer and rusage  */
> +# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1
> +#else
> +# define __RLIM_T_MATCHES_RLIM64_T	0
> +
> +# define __STATFS_MATCHES_STATFS64  0
> +
> +/* And for getitimer, setitimer and rusage  */
> +# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0
> +#endif
> +
> +/* Number of descriptors that can fit in an `fd_set'.  */
> +#define	__FD_SETSIZE		1024
> +
> +
> +#endif /* bits/typesizes.h */
> diff --git a/sysdeps/unix/sysv/linux/sh/bits/typesizes.h b/sysdeps/unix/sysv/linux/sh/bits/typesizes.h
> new file mode 100644
> index 0000000000..ab1ac9ea9c
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/sh/bits/typesizes.h
> @@ -0,0 +1,74 @@
> +/* bits/typesizes.h -- underlying types for *_t.  SH version.
> +   Copyright (C) 2002-2022 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <https://www.gnu.org/licenses/>.  */
> +
> +#ifndef _BITS_TYPES_H
> +# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
> +#endif
> +
> +#ifndef	_BITS_TYPESIZES_H
> +#define	_BITS_TYPESIZES_H	1
> +
> +/* See <bits/types.h> for the meaning of these macros.  This file exists so
> +   that <bits/types.h> need not vary across different GNU platforms.  */
> +
> +#define __DEV_T_TYPE		__UQUAD_TYPE
> +#define __UID_T_TYPE		__U32_TYPE
> +#define __GID_T_TYPE		__U32_TYPE
> +#define __INO_T_TYPE		__ULONGWORD_TYPE
> +#define __INO64_T_TYPE		__UQUAD_TYPE
> +#define __MODE_T_TYPE		__U32_TYPE
> +#define __NLINK_T_TYPE		__UWORD_TYPE
> +#define __OFF_T_TYPE		__SLONGWORD_TYPE
> +#define __OFF64_T_TYPE		__SQUAD_TYPE
> +#define __PID_T_TYPE		__S32_TYPE
> +#define __RLIM_T_TYPE		__ULONGWORD_TYPE
> +#define __RLIM64_T_TYPE		__UQUAD_TYPE
> +#define	__BLKCNT_T_TYPE		__SLONGWORD_TYPE
> +#define	__BLKCNT64_T_TYPE	__SQUAD_TYPE
> +#define	__FSBLKCNT_T_TYPE	__ULONGWORD_TYPE
> +#define	__FSBLKCNT64_T_TYPE	__UQUAD_TYPE
> +#define	__FSFILCNT_T_TYPE	__ULONGWORD_TYPE
> +#define	__FSFILCNT64_T_TYPE	__UQUAD_TYPE
> +#define	__FSWORD_T_TYPE		__SWORD_TYPE
> +#define	__ID_T_TYPE		__U32_TYPE
> +#define __CLOCK_T_TYPE		__SLONGWORD_TYPE
> +#define __TIME_T_TYPE		__SLONGWORD_TYPE
> +#define __USECONDS_T_TYPE	__U32_TYPE
> +#define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE
> +#define __SUSECONDS64_T_TYPE	__SQUAD_TYPE
> +#define __DADDR_T_TYPE		__S32_TYPE
> +#define __KEY_T_TYPE		__S32_TYPE
> +#define __CLOCKID_T_TYPE	__S32_TYPE
> +#define __TIMER_T_TYPE		void *
> +#define __BLKSIZE_T_TYPE	__SLONGWORD_TYPE
> +#define __FSID_T_TYPE		struct { int __val[2]; }
> +#define __SSIZE_T_TYPE		__SWORD_TYPE
> +#define __SYSCALL_SLONG_TYPE	__SLONGWORD_TYPE
> +#define __SYSCALL_ULONG_TYPE	__ULONGWORD_TYPE
> +#define __CPU_MASK_TYPE 	__ULONGWORD_TYPE
> +
> +#define __RLIM_T_MATCHES_RLIM64_T		0
> +#define __STATFS_MATCHES_STATFS64		0
> +/* And for getitimer, setitimer and rusage  */
> +#define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64	0
> +
> +/* Number of descriptors that can fit in an `fd_set'.  */
> +#define	__FD_SETSIZE		1024
> +
> +
> +#endif /* bits/typesizes.h */

-- 
Cheers,
Carlos.


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

* Re: [PATCH 30/30] Linux: Remove generic Implies
  2022-10-19 22:14 ` [PATCH 30/30] Linux: Remove generic Implies Adhemerval Zanella via Libc-alpha
@ 2022-12-06 17:50   ` Carlos O'Donell via Libc-alpha
  0 siblings, 0 replies; 68+ messages in thread
From: Carlos O'Donell via Libc-alpha @ 2022-12-06 17:50 UTC (permalink / raw)
  To: Adhemerval Zanella, libc-alpha

On 10/19/22 18:14, Adhemerval Zanella via Libc-alpha wrote:
> The default Linux implementation already handled the Linux generic
> ABIs interface used on newer architectures, so there is no need to
> Imply the generic any longer.

Agreed.

LGTM.

No regressions on x86_64 and i686.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>

> ---
>  sysdeps/unix/sysv/linux/aarch64/Implies        |  1 -
>  sysdeps/unix/sysv/linux/arc/Implies            |  2 --
>  sysdeps/unix/sysv/linux/csky/Implies           |  2 --
>  sysdeps/unix/sysv/linux/generic/README         | 11 -----------
>  sysdeps/unix/sysv/linux/loongarch/lp64/Implies |  1 -
>  sysdeps/unix/sysv/linux/nios2/Implies          |  2 --
>  sysdeps/unix/sysv/linux/or1k/Implies           |  2 --
>  sysdeps/unix/sysv/linux/riscv/rv32/Implies     |  2 --
>  sysdeps/unix/sysv/linux/riscv/rv64/Implies     |  1 -
>  9 files changed, 24 deletions(-)
>  delete mode 100644 sysdeps/unix/sysv/linux/generic/README
> 
> diff --git a/sysdeps/unix/sysv/linux/aarch64/Implies b/sysdeps/unix/sysv/linux/aarch64/Implies
> index 4409e19b92..9c2d2c9870 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/Implies
> +++ b/sysdeps/unix/sysv/linux/aarch64/Implies
> @@ -1,3 +1,2 @@
>  aarch64/nptl
> -unix/sysv/linux/generic
>  unix/sysv/linux/wordsize-64
> diff --git a/sysdeps/unix/sysv/linux/arc/Implies b/sysdeps/unix/sysv/linux/arc/Implies
> index 7f739a0340..5c1698c045 100644
> --- a/sysdeps/unix/sysv/linux/arc/Implies
> +++ b/sysdeps/unix/sysv/linux/arc/Implies
> @@ -1,3 +1 @@
>  arc/nptl
> -unix/sysv/linux/generic/wordsize-32
> -unix/sysv/linux/generic
> diff --git a/sysdeps/unix/sysv/linux/csky/Implies b/sysdeps/unix/sysv/linux/csky/Implies
> index f37776ccef..2259772947 100644
> --- a/sysdeps/unix/sysv/linux/csky/Implies
> +++ b/sysdeps/unix/sysv/linux/csky/Implies
> @@ -1,3 +1 @@
> -unix/sysv/linux/generic/wordsize-32
> -unix/sysv/linux/generic
>  csky/nptl
> diff --git a/sysdeps/unix/sysv/linux/generic/README b/sysdeps/unix/sysv/linux/generic/README
> deleted file mode 100644
> index 301a6107e1..0000000000
> --- a/sysdeps/unix/sysv/linux/generic/README
> +++ /dev/null
> @@ -1,11 +0,0 @@
> -This hierarchy supports Linux systems using the new
> -asm-generic/unistd.h, which removes many familiar old syscalls.  For
> -example, to implement open(), newer Linux architectures require glibc
> -to invoke the __NR_openat syscall with AT_FDCWD.  This hierarchy
> -provides all those implementations.
> -
> -It also provides support for 32-bit platforms using the 64-bit kernel
> -syscall APIs, as the 32-bit ones are no longer provided.  Note that
> -newer ILP32 environments (x32 or AArch64:ILP32, for example) are
> -converting to use more 64-bit types in kernel syscalls, so that aspect
> -of this support is in more flux as of this writing.
> diff --git a/sysdeps/unix/sysv/linux/loongarch/lp64/Implies b/sysdeps/unix/sysv/linux/loongarch/lp64/Implies
> index 117c2b8efe..e0390cc3bf 100644
> --- a/sysdeps/unix/sysv/linux/loongarch/lp64/Implies
> +++ b/sysdeps/unix/sysv/linux/loongarch/lp64/Implies
> @@ -1,3 +1,2 @@
>  unix/sysv/linux/loongarch
> -unix/sysv/linux/generic
>  unix/sysv/linux/wordsize-64
> diff --git a/sysdeps/unix/sysv/linux/nios2/Implies b/sysdeps/unix/sysv/linux/nios2/Implies
> index 4d0478bf8f..e6c9be4665 100644
> --- a/sysdeps/unix/sysv/linux/nios2/Implies
> +++ b/sysdeps/unix/sysv/linux/nios2/Implies
> @@ -1,3 +1 @@
>  nios2/nptl
> -unix/sysv/linux/generic/wordsize-32
> -unix/sysv/linux/generic
> diff --git a/sysdeps/unix/sysv/linux/or1k/Implies b/sysdeps/unix/sysv/linux/or1k/Implies
> index f39f16c04a..07f8e71adc 100644
> --- a/sysdeps/unix/sysv/linux/or1k/Implies
> +++ b/sysdeps/unix/sysv/linux/or1k/Implies
> @@ -1,3 +1 @@
>  or1k/nptl
> -unix/sysv/linux/generic/wordsize-32
> -unix/sysv/linux/generic
> diff --git a/sysdeps/unix/sysv/linux/riscv/rv32/Implies b/sysdeps/unix/sysv/linux/riscv/rv32/Implies
> index 8b7deb33cd..83db34c5d5 100644
> --- a/sysdeps/unix/sysv/linux/riscv/rv32/Implies
> +++ b/sysdeps/unix/sysv/linux/riscv/rv32/Implies
> @@ -1,3 +1 @@
>  unix/sysv/linux/riscv
> -unix/sysv/linux/generic/wordsize-32
> -unix/sysv/linux/generic
> diff --git a/sysdeps/unix/sysv/linux/riscv/rv64/Implies b/sysdeps/unix/sysv/linux/riscv/rv64/Implies
> index f042343bf7..2f9ad9ff94 100644
> --- a/sysdeps/unix/sysv/linux/riscv/rv64/Implies
> +++ b/sysdeps/unix/sysv/linux/riscv/rv64/Implies
> @@ -1,3 +1,2 @@
>  unix/sysv/linux/riscv
> -unix/sysv/linux/generic
>  unix/sysv/linux/wordsize-64

-- 
Cheers,
Carlos.


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

* Re: [PATCH 16/30] Linux: Move wordsize-32 Version to default
  2022-12-05 16:40   ` Carlos O'Donell via Libc-alpha
@ 2022-12-07  0:10     ` Joseph Myers
  2022-12-07 20:19       ` Adhemerval Zanella Netto via Libc-alpha
  0 siblings, 1 reply; 68+ messages in thread
From: Joseph Myers @ 2022-12-07  0:10 UTC (permalink / raw)
  To: Carlos O'Donell; +Cc: Adhemerval Zanella, libc-alpha

On Mon, 5 Dec 2022, Carlos O'Donell via Libc-alpha wrote:

> On 10/19/22 18:14, Adhemerval Zanella via Libc-alpha wrote:
> > And remove redundant entries on other architectures Version.
> 
> There are discrepancies between 2.11, 2.15, and 2.18 that need to be explained
> in the comment or changed.
> 
> If all 32-bit arches were using 2.11 and the wordsize-32/Versions was never
> used, then that should be explained in the comment.

The version for fallocate64 was supposed to be 2.10.  It was then added to 
32-bit platforms in 2.11 because it mistakenly wasn't exported for them in 
2.10 (see the commit message for commit 
1f3615a1c97a030bca59f728f998947f852679b9).  linux/generic didn't exist 
before 2.15, i.e. when the tile ports were added (and microblaze didn't 
exist before 2.18), which explains those differences but also illustrates 
that "2.11 for 32-bit, 2.10 for 64-bit" should be sufficient since 
versions older than the minimum for the architecture are automatically 
adjusted.

-- 
Joseph S. Myers
joseph@codesourcery.com

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

* Re: [PATCH 16/30] Linux: Move wordsize-32 Version to default
  2022-12-07  0:10     ` Joseph Myers
@ 2022-12-07 20:19       ` Adhemerval Zanella Netto via Libc-alpha
  0 siblings, 0 replies; 68+ messages in thread
From: Adhemerval Zanella Netto via Libc-alpha @ 2022-12-07 20:19 UTC (permalink / raw)
  To: Joseph Myers, Carlos O'Donell; +Cc: libc-alpha



On 06/12/22 21:10, Joseph Myers wrote:
> On Mon, 5 Dec 2022, Carlos O'Donell via Libc-alpha wrote:
> 
>> On 10/19/22 18:14, Adhemerval Zanella via Libc-alpha wrote:
>>> And remove redundant entries on other architectures Version.
>>
>> There are discrepancies between 2.11, 2.15, and 2.18 that need to be explained
>> in the comment or changed.
>>
>> If all 32-bit arches were using 2.11 and the wordsize-32/Versions was never
>> used, then that should be explained in the comment.
> 
> The version for fallocate64 was supposed to be 2.10.  It was then added to 
> 32-bit platforms in 2.11 because it mistakenly wasn't exported for them in 
> 2.10 (see the commit message for commit 
> 1f3615a1c97a030bca59f728f998947f852679b9).  linux/generic didn't exist 
> before 2.15, i.e. when the tile ports were added (and microblaze didn't 
> exist before 2.18), which explains those differences but also illustrates 
> that "2.11 for 32-bit, 2.10 for 64-bit" should be sufficient since 
> versions older than the minimum for the architecture are automatically 
> adjusted.
> 

Thanks to explain it better than me, I will update the comment with this.

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

* Re: [PATCH 25/30] Linux: Remove unused generic Makefile
  2022-12-06 17:24   ` Carlos O'Donell via Libc-alpha
@ 2022-12-07 21:19     ` Adhemerval Zanella Netto via Libc-alpha
  0 siblings, 0 replies; 68+ messages in thread
From: Adhemerval Zanella Netto via Libc-alpha @ 2022-12-07 21:19 UTC (permalink / raw)
  To: Carlos O'Donell, libc-alpha



On 06/12/22 14:24, Carlos O'Donell wrote:
> On 10/19/22 18:14, Adhemerval Zanella via Libc-alpha wrote:
>> Both are already defined on default linux Makefile.
> 
> Is this true? It is defined in the default syscalls.list and built
> as a wrapper from that.
> 
> With your series applied I see things like:
> 
> (echo '#define SYSCALL_NAME epoll_create'; \
>  echo '#define SYSCALL_NARGS 1'; \
>  echo '#define SYSCALL_ULONG_ARG_1 0'; \
>  echo '#define SYSCALL_ULONG_ARG_2 0'; \
>  echo '#define SYSCALL_SYMBOL epoll_create'; \
>  echo '#define SYSCALL_NOERRNO 0'; \
>  echo '#define SYSCALL_ERRVAL 0'; \
>  echo '#include <syscall-template.S>'; \
> ) | gcc -Wl,--build-id=none -c ...
> 
> objdump -ldr misc/epoll_create.os
> 
> misc/epoll_create.os:     file format elf64-x86-64
> 
> 
> Disassembly of section .text:
> 
> 0000000000000000 <__GI_epoll_create>:
> epoll_create():
> /mnt/ssd/carlos/src/glibc-work/misc/../sysdeps/unix/syscall-template.S:120
>    0:	b8 d5 00 00 00       	mov    $0xd5,%eax
>    5:	0f 05                	syscall 
>    7:	48 3d 01 f0 ff ff    	cmp    $0xfffffffffffff001,%rax
>    d:	73 01                	jae    10 <__GI_epoll_create+0x10>
> /mnt/ssd/carlos/src/glibc-work/misc/../sysdeps/unix/syscall-template.S:122
>    f:	c3                   	ret    
> /mnt/ssd/carlos/src/glibc-work/misc/../sysdeps/unix/syscall-template.S:123
>   10:	48 8b 0d 00 00 00 00 	mov    0x0(%rip),%rcx        # 17 <__GI_epoll_create+0x17>
> 			13: R_X86_64_GOTTPOFF	__libc_errno-0x4
>   17:	f7 d8                	neg    %eax
>   19:	64 89 01             	mov    %eax,%fs:(%rcx)
>   1c:	48 83 c8 ff          	or     $0xffffffffffffffff,%rax
>   20:	c3                   	ret    
> 
> There is no Makefile definition for these so the C versions are
> going to be unused until the syscalls.list entry is removed?
> 
> May you please confirm using a final build that we don't still need this?
> 

You are right, syscalls.list will generate the Makefile entries required in this
case.  Since we now have the default implementation on Linux folder, I will add
Makefile tools to make it explicit and remove the syscalls.list entry.

> Likewise we should probably cross-check bewteen the makefiles and the
> syscalls-list to see what is and isn't being built with wrappers.

It is on my backlog.

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

end of thread, other threads:[~2022-12-07 21:20 UTC | newest]

Thread overview: 68+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-19 22:14 [PATCH 00/30] Remove Linux generic sysdep Adhemerval Zanella via Libc-alpha
2022-10-19 22:14 ` [PATCH 01/30] linux: Fix generic struct_stat for 64 bit time (BZ# 29657) Adhemerval Zanella via Libc-alpha
2022-10-25 17:50   ` Joseph Myers
2022-12-05 16:39   ` Carlos O'Donell via Libc-alpha
2022-10-19 22:14 ` [PATCH 02/30] linux: Consolidate dl-origin.c Adhemerval Zanella via Libc-alpha
2022-10-19 22:14 ` [PATCH 03/30] Linux: consolidate chmod implementation Adhemerval Zanella via Libc-alpha
2022-12-05 16:39   ` Carlos O'Donell via Libc-alpha
2022-10-19 22:14 ` [PATCH 04/30] Linux: consolidate chown implementation Adhemerval Zanella via Libc-alpha
2022-12-05 16:40   ` Carlos O'Donell via Libc-alpha
2022-10-19 22:14 ` [PATCH 05/30] Linux: consolidate dup2 implementation Adhemerval Zanella via Libc-alpha
2022-12-05 16:40   ` Carlos O'Donell via Libc-alpha
2022-10-19 22:14 ` [PATCH 06/30] Lninux: consolidate epoll_create implementation Adhemerval Zanella via Libc-alpha
2022-10-21  8:57   ` Florian Weimer via Libc-alpha
2022-12-05 16:40   ` Carlos O'Donell via Libc-alpha
2022-10-19 22:14 ` [PATCH 07/30] Linux: consolidate inotify_init implementation Adhemerval Zanella via Libc-alpha
2022-12-05 16:40   ` Carlos O'Donell via Libc-alpha
2022-10-19 22:14 ` [PATCH 08/30] Linux: consolidate lchown implementation Adhemerval Zanella via Libc-alpha
2022-12-05 16:40   ` Carlos O'Donell via Libc-alpha
2022-10-19 22:14 ` [PATCH 09/30] Linux: consolidate link implementation Adhemerval Zanella via Libc-alpha
2022-12-05 16:39   ` Carlos O'Donell via Libc-alpha
2022-10-19 22:14 ` [PATCH 10/30] Linux: consolidate mkdir implementation Adhemerval Zanella via Libc-alpha
2022-12-05 16:40   ` Carlos O'Donell via Libc-alpha
2022-10-19 22:14 ` [PATCH 11/30] Linux: consolidate readlink implementation Adhemerval Zanella via Libc-alpha
2022-12-05 16:39   ` Carlos O'Donell via Libc-alpha
2022-10-19 22:14 ` [PATCH 12/30] Linux: consolidate rmdir implementation Adhemerval Zanella via Libc-alpha
2022-12-05 16:39   ` Carlos O'Donell via Libc-alpha
2022-10-19 22:14 ` [PATCH 13/30] Linux: consolidate symlink implementation Adhemerval Zanella via Libc-alpha
2022-12-05 16:40   ` Carlos O'Donell via Libc-alpha
2022-10-19 22:14 ` [PATCH 14/30] Linux: consolidate unlink implementation Adhemerval Zanella via Libc-alpha
2022-12-05 16:40   ` Carlos O'Donell via Libc-alpha
2022-10-19 22:14 ` [PATCH 15/30] Linux: consolidate sendfile implementation Adhemerval Zanella via Libc-alpha
2022-12-05 16:39   ` Carlos O'Donell via Libc-alpha
2022-10-19 22:14 ` [PATCH 16/30] Linux: Move wordsize-32 Version to default Adhemerval Zanella via Libc-alpha
2022-12-05 16:40   ` Carlos O'Donell via Libc-alpha
2022-12-07  0:10     ` Joseph Myers
2022-12-07 20:19       ` Adhemerval Zanella Netto via Libc-alpha
2022-10-19 22:14 ` [PATCH 17/30] Linux: consolidate ____longjmp_chk Adhemerval Zanella via Libc-alpha
2022-12-05 16:40   ` Carlos O'Donell via Libc-alpha
2022-10-19 22:14 ` [PATCH 18/30] Linux: Assume and consolidate bind wire-up syscall Adhemerval Zanella via Libc-alpha
2022-12-05 16:39   ` Carlos O'Donell via Libc-alpha
2022-10-19 22:14 ` [PATCH 19/30] Linux: Assume iand consolidate socket " Adhemerval Zanella via Libc-alpha
2022-12-05 16:39   ` Carlos O'Donell via Libc-alpha
2022-10-19 22:14 ` [PATCH 20/30] Linux: Assume and consolidate socketpair " Adhemerval Zanella via Libc-alpha
2022-12-06 16:15   ` Carlos O'Donell via Libc-alpha
2022-10-19 22:14 ` [PATCH 21/30] Linux: Assume and consolidate listen " Adhemerval Zanella via Libc-alpha
2022-12-06 16:17   ` Carlos O'Donell via Libc-alpha
2022-10-19 22:14 ` [PATCH 22/30] Linux: Assume and consolidate getsockname " Adhemerval Zanella via Libc-alpha
2022-10-20  0:01   ` Joseph Myers
2022-10-20 18:12     ` Adhemerval Zanella Netto via Libc-alpha
2022-12-06 16:18   ` Carlos O'Donell via Libc-alpha
2022-10-19 22:14 ` [PATCH 23/30] Linux: Assume and consolidate getpeername " Adhemerval Zanella via Libc-alpha
2022-10-20  0:02   ` Joseph Myers
2022-12-06 16:20   ` Carlos O'Donell via Libc-alpha
2022-10-19 22:14 ` [PATCH 24/30] Linux: Assume and consolidate shutdown " Adhemerval Zanella via Libc-alpha
2022-12-06 16:23   ` Carlos O'Donell via Libc-alpha
2022-10-19 22:14 ` [PATCH 25/30] Linux: Remove unused generic Makefile Adhemerval Zanella via Libc-alpha
2022-12-06 17:24   ` Carlos O'Donell via Libc-alpha
2022-12-07 21:19     ` Adhemerval Zanella Netto via Libc-alpha
2022-10-19 22:14 ` [PATCH 26/30] Linux: Remove generic sysdep Adhemerval Zanella via Libc-alpha
2022-12-06 17:29   ` Carlos O'Donell via Libc-alpha
2022-10-19 22:14 ` [PATCH 27/30] Linux: make generic xstatver.h the default one Adhemerval Zanella via Libc-alpha
2022-12-06 17:33   ` Carlos O'Donell via Libc-alpha
2022-10-19 22:14 ` [PATCH 28/30] Linux: Make generic fcntl.h " Adhemerval Zanella via Libc-alpha
2022-12-06 17:36   ` Carlos O'Donell via Libc-alpha
2022-10-19 22:14 ` [PATCH 29/30] Linux: Consolidate typesizes.h Adhemerval Zanella via Libc-alpha
2022-12-06 17:47   ` Carlos O'Donell via Libc-alpha
2022-10-19 22:14 ` [PATCH 30/30] Linux: Remove generic Implies Adhemerval Zanella via Libc-alpha
2022-12-06 17:50   ` Carlos O'Donell via Libc-alpha

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