Commit Graph

26 Commits

Author SHA1 Message Date
Florian Weimer da347f4aa3 io: Remove copy_file_range emulation [BZ #24744]
The kernel is evolving this interface (e.g., removal of the
restriction on cross-device copies), and keeping up with that
is difficult.  Applications which need the function should
run kernels which support the system call instead of relying on
the imperfect glibc emulation.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
(cherry picked from commit 5a659ccc0ec217ab02a4c273a1f6d346a359560a)
2019-07-09 10:01:21 +02:00
Joseph Myers 04277e02d7 Update copyright dates with scripts/update-copyrights.
* All files with FSF copyright notices: Update copyright dates
	using scripts/update-copyrights.
	* locale/programs/charmap-kw.h: Regenerated.
	* locale/programs/locfile-kw.h: Likewise.
2019-01-01 00:11:28 +00:00
Joseph Myers 646ce7e0be Remove __ASSUME_ST_INO_64_BIT.
kernel-features.h has a macro __ASSUME_ST_INO_64_BIT, with a comment
"However, SH is lame, and still does not have a 64-bit inode field.".

The macro is, in fact, defined to 0 by Alpha as well as SH.  The Alpha
case is, however, trivially useless: none of the files that test
__ASSUME_ST_INO_64_BIT are built for Alpha (which gained kernel
support for stat64 syscalls, with a 64-bit st_ino field, in Linux
2.6.4; the define to 0 for Alpha in glibc predates that).

The SH kernel gained support for a 64-bit st_ino in struct stat64 in
commit 760bcb1deec13c50e20399c84cb6a8ea41cc2820 ("sh: Fix fstatat64()
syscall."), which is in Linux 2.6.22 and later.  So the redefinition
of __ASSUME_ST_INO_64_BIT to 0 is of no use for SH either; three of
the files testing it do so immediately after a stat64-family syscall
has been used, which will always have set the 64-bit st_ino correctly
(in addition to the 32-bit __st_ino), while the relevant code
__xstat32_conv executes only after such a syscall in the function
calling __xstat32_conv.

Thus this patch removes __ASSUME_ST_INO_64_BIT and code testing it.
Removing the useless [!__ASSUME_ST_INO_64_BIT] code in __xstat32_conv
renders the [_HAVE_STAT64___ST_INO] and [!_HAVE_STAT64___ST_INO] cases
around it identical, so that conditional is also removed.

Tested compilation with build-many-glibcs.py for its Alpha and SH
configurations; also ran the glibc testsuite for x86_64 and x86.

	* sysdeps/unix/sysv/linux/kernel-features.h
	(__ASSUME_ST_INO_64_BIT): Remove macro definition.
	* sysdeps/unix/sysv/linux/alpha/kernel-features.h
	(__ASSUME_ST_INO_64_BIT): Do not undefine and define.
	* sysdeps/unix/sysv/linux/sh/kernel-features.h
	(__ASSUME_ST_INO_64_BIT): Likewise.
	* sysdeps/unix/sysv/linux/fxstat64.c: Do not include
	<kernel-features.h>.
	(___fxstat64) [_HAVE_STAT64___ST_INO && !__ASSUME_ST_INO_64_BIT]:
	Remove conditional code.
	* sysdeps/unix/sysv/linux/lxstat64.c: Do not include
	<kernel-features.h>.
	(___lxstat64) [_HAVE_STAT64___ST_INO && !__ASSUME_ST_INO_64_BIT]:
	Remove conditional code.
	* sysdeps/unix/sysv/linux/xstat64.c: Do not include
	<kernel-features.h>.
	(___xstat64) [_HAVE_STAT64___ST_INO && !__ASSUME_ST_INO_64_BIT]:
	Remove conditional code.
	* sysdeps/unix/sysv/linux/xstatconv.c: Do not include
	<kernel-features.h>.
	(__xstat32_conv) [_HAVE_STAT64___ST_INO]: Remove conditional code.
	[!_HAVE_STAT64___ST_INO]: Make code unconditional.
2018-12-18 13:35:39 +00:00
Florian Weimer e0f9c462d8 alpha: mlock2, copy_file_range syscalls were introduced in kernel 4.13 2018-07-24 22:38:39 +02:00
Florian Weimer fd70af4552 Add the statx function 2018-07-10 16:14:45 +02:00
Florian Weimer d6da5cb6a8 Add renameat2 function [BZ #17662]
The implementation falls back to renameat if renameat2 is not available
in the kernel (or in the kernel headers) and the flags argument is zero.
Without kernel support, a non-zero argument returns EINVAL, not ENOSYS.
This mirrors what the kernel does for invalid renameat2 flags.
2018-07-05 19:00:10 +02:00
Joseph Myers 688903eb3e Update copyright dates with scripts/update-copyrights.
* All files with FSF copyright notices: Update copyright dates
	using scripts/update-copyrights.
	* locale/programs/charmap-kw.h: Regenerated.
	* locale/programs/locfile-kw.h: Likewise.
2018-01-01 00:32:25 +00:00
Andreas Schwab 43ffc53a35 Use execveat syscall in fexecve (bug 22134)
By using execveat we no longer depend on /proc.  The execveat syscall was
introduced in 3.19, except for a few late comers.
2017-09-19 16:19:14 +02:00
Marko Myllynen cb09a3d497 Fix send consolidation typo
Fix 60f9423b type for alpha kernel-features.h definition.

	* sysdeps/unix/sysv/linux/alpha/kernel-features.h
        (__ASSUME_RECV_SYSCALL): Replace duplicate by
        __ASSUME_SEND_SYSCALL.
2017-03-12 17:25:00 -03:00
Adhemerval Zanella 60f9423b6b Consolidate Linux send implementation
This patch consolidates the send Linux syscall implementation on
sysdeps/unix/sysv/linux/send{to}.c.  The changes are:

  1. Remove send from auto-generation syscalls.list on the architecture
     that uses __NR_send.
  2. Define __NR_send for architectures that supports it. It was done instead
     of defining in default kernel-features.h because current Linux practice
     for new ports are to implement only __NR_sendto [1] and it will
     require adding new kernel-features for ports that do not require it
     (aarch64 for instance).
  3. Remove __ASSUME_SENDTO_FOR_SEND_SYSCALL and decide to use
     __NR_sendto for send generation based on __ASSUME_SENDTO_SYSCALL.

Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu.

	* sysdeps/unix/sysv/linux/sysdep.h (HAVE_INTERNAL_SEND_SYMBOL):
	Define.
	* sysdeps/unix/sysv/linux/aarch64/sysdep.h
	(HAVE_INTERNAL_SEND_SYMBOL): Undefine.
	* sysdeps/unix/sysv/linux/nios2/sysdep.h
	(HAVE_INTERNAL_SEND_SYMBOL): Likewise.
	* sysdeps/unix/sysv/linux/tile/sysdep.h
	(HAVE_INTERNAL_SEND_SYMBOL): Likewise.
	* sysdeps/unix/sysv/linux/alpha/kernel-features.h
	(__ASSUME_RECV_SYSCALL): Define.
	* sysdeps/unix/sysv/linux/arm/kernel-features.h
	(__ASSUME_RECV_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/hppa/kernel-features.h
	(__ASSUME_RECV_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/ia64/kernel-features.h
	(__ASSUME_RECV_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/mips/kernel-features.h
	(__ASSUME_RECV_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/i386/kernel-features.h
	(__ASSUME_SENDTO_FOR_SEND_SYSCALL): Remove define.
	* sysdeps/unix/sysv/linux/m68k/kernel-features.h
	(__ASSUME_SENDTO_FOR_SEND_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/s390/kernel-features.h
	(__ASSUME_SENDTO_FOR_SEND_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove send from
	auto-generation list.
	* sysdeps/unix/sysv/linux/arm/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/hppa/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/ia64/syscalls.list: Likewike.
	* sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/send.c: Simplify includes.
	(__ASSUME_SENDTO_FOR_SEND_SYSCALL): Replace by
	__ASSUME_SENDTO_SYSCALL.
	* sysdeps/unix/sysv/linux/x86_64/send.c: Remove file.
	* sysdeps/unix/sysv/linux/mips/mips64/send.c: Likewise.
	* sysdeps/unix/sysv/linux/generic/send.c: Likewise.
2017-03-09 15:22:06 +01:00
Adhemerval Zanella df799d9eb3 Consolidate Linux recv implementation
This patch consolidates the recv Linux syscall implementation on
sysdeps/unix/sysv/linux/recv.c.  The changes are:

  1. Remove recv from auto-generation syscalls.list on the architecture
     that uses __NR_recv.
  2. Define __NR_recv for architectures that supports it.  It was done
     instead of defining in default kernel-features.h because current Linux
     practice for new ports is to implement only __NR_recvfrom [1] and it will
     require adding new kernel-features for ports that do not require it
     (aarch64 for instance).
  3. Remove __ASSUME_RECVFROM_FOR_RECV_SYSCALL and decide to use
     __NR_recvfrom for recv generation based on __ASSUME_RECVFROM_SYSCALL.

Checked on i686-linux-gnu, x86_64-linux-gnu, x86_64-linux-gnux32,
aarch64-linux-gnu, arm-linux-gnueabihf, and powerpc64le-linux-gnu.

	* sysdeps/unix/sysv/linux/alpha/syscalls.list: Remove recv from
	auto-generation list.
	* sysdeps/unix/sysv/linux/arm/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/hppa/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/ia64/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise.
	* sysdeps/unix/sysv/linux/alpha/kernel-features.h
	(__ASSUME_RECV_SYSCALL): New define.
	* sysdeps/unix/sysv/linux/arm/kernel-features.h
	(__ASSUME_RECV_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/hppa/kernel-features.h
	(__ASSUME_RECV_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/ia64/kernel-features.h
	(__ASSUME_RECV_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/mips/kernel-features.h
	(__ASSUME_RECV_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/i386/kernel-features.h
	(__ASSUME_RECVFROM_FOR_RECV_SYSCALL): Remove define.
	* sysdeps/unix/sysv/linux/m68k/kernel-features.h
	(__ASSUME_RECVFROM_FOR_RECV_SYSCALL): Remove define.
	* sysdeps/unix/sysv/linux/s390/kernel-features.h
	(__ASSUME_RECVFROM_FOR_RECV_SYSCALL): Remove define.
	* sysdeps/unix/sysv/linux/generic/recv.c: Remove file.
	* sysdeps/unix/sysv/linux/mips/mips64/recv.c: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/recv.c: Likewise.
	* sysdeps/unix/sysv/linux/recv.c: Simplify includes.
	(__libc_recv): Use __ASSUME_RECVFROM_SYSCALL instead of
	__ASSUME_RECVFROM_FOR_RECV_SYSCALL to issue recvfrom syscall.

[1] include/asm-generic/unistd.h (__ARCH_WANT_SYSCALL_DEPRECATED)
2017-03-09 15:22:06 +01:00
Joseph Myers bfff8b1bec Update copyright dates with scripts/update-copyrights. 2017-01-01 00:14:16 +00:00
Adhemerval Zanella 8232e7d209 Use shmat syscall for Linux implementation
This patch add a direct call to shmat syscall if it is supported by
kernel features.

Checked on x86_64, i686, powerpc64le, aarch64, and armhf.

	* sysdeps/unix/sysv/linux/alpha/syscalls.list (shmat): Remove.
	* sysdeps/unix/sysv/linux/arm/syscalls.list (shmat): Likewise.
	* sysdeps/unix/sysv/linux/generic/syscalls.list (shmat): Likewise.
	* sysdeps/unix/sysv/linux/hppa/syscalls.list (shmat): Likewise.
	* sysdeps/unix/sysv/linux/ia64/syscalls.list (shmat): Likewise.
	* sysdeps/unix/sysv/linux/microblaze/syscalls.list (shmat): Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/syscalls.list (shmat):
	Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (shmat):
	Likewise.
	* sysdeps/unix/sysv/linux/x86_64/syscalls.list (shmat): Likewise.
	* sysdeps/unix/sysv/linux/alpha/kernel-features.h (__NR_shmat):
	Define to __NR_osf_shmat.
	* sysdeps/unix/sysv/linux/shmat.c (shmat): Use shmat syscall if it is
	defined.
2016-12-28 20:31:05 -02:00
Steve Ellcey 327792ce57 Define __ASSUME_ST_INO_64_BIT on all platforms.
* sysdeps/unix/sysv/linux/alpha/kernel-features.h: #define
	  __ASSUME_ST_INO_64_BIT as 0
	* sysdeps/unix/sysv/linux/sh/kernel-features.h: Likewise.
	* sysdeps/unix/sysv/linux/fxstat64.c: Replace #ifdef with #if
	  over the code where __ASSUME_ST_INO_64_BIT is used.
	* sysdeps/unix/sysv/linux/lxstat64.c: Likewise.
	* sysdeps/unix/sysv/linux/xstat64.c: Likewise.
	* sysdeps/unix/sysv/linux/xstatconv.c: Likewise.
2016-11-07 13:26:27 -08:00
Joseph Myers 35ade9f11b Adjust kernel-features.h defaults for socket syscalls.
This patch adjusts the defaults for kernel-features.h macros relating
to availability of accept4, recvmmsg and sendmmsg.  It is not intended
to affect which macros end up getting defined in any configuration.

At present, all architectures with syscalls for those functions need
to define __ASSUME_*_SYSCALL macros; in particular, any new
architecture needs its own kernel-features.h file for that purpose,
though it may not otherwise need such a header.  Those macros are then
used together with __ASSUME_SOCKETCALL to define macros for whether
the functions in question are available.

This patch changes the defaults so that the syscalls are assumed to be
available by default with recent-enough kernels, and it is the
responsibility of architecture headers to undefine the macros if they
are unavailable in supported kernels at least as recent as the version
where the architecture-independent functionality was introduced.  The
__ASSUME_<function> macros are defaulted similarly instead of being
defined based on other macros (defining based on other macros would no
longer work because the #undefs appear after the generic header is
included), so where the syscall being unavailable means the function
is unavailable this means the architecture header has to undefine the
__ASSUME_<function> macro; this only affects __ASSUME_ACCEPT4 for
ia64, as other cases where the syscalls were added late enough to be
relevant with current kernel version requirements are all on
socketcall architectures.

As a consequence, the AArch64 and Nios II kernel-features.h header
files are removed, and others simplified.  When the minimum kernel
version becomes 4.3 or later on all architectures, the syscalls in
question can just be assumed unconditionally, permitting further
simplification.

Tested for x86_64, x86 and powerpc (that installed shared libraries
are unchanged by the patch, and testsuite for x86_64 and x86).

	* sysdeps/unix/sysv/linux/kernel-features.h
	(__ASSUME_ACCEPT4_SYSCALL): Define unconditionally.
	(__ASSUME_ACCEPT4): Likewise.
	[__LINUX_KERNEL_VERSION >= 0x020621] (__ASSUME_RECVMMSG_SYSCALL):
	Define.
	[__LINUX_KERNEL_VERSION >= 0x020621] (__ASSUME_RECVMMSG):
	Likewise.
	[__LINUX_KERNEL_VERSION >= 0x030000] (__ASSUME_SENDMMSG_SYSCALL):
	Likewise.
	[__LINUX_KERNEL_VERSION >= 0x030000] (__ASSUME_SENDMMSG):
	Likewise.
	* sysdeps/unix/sysv/linux/aarch64/kernel-features.h: Remove file.
	* sysdeps/unix/sysv/linux/nios2/kernel-features.h: Likewise.
	* sysdeps/unix/sysv/linux/alpha/kernel-features.h
	(__ASSUME_RECVMMSG_SYSCALL): Do not define.
	(__ASSUME_ACCEPT4_SYSCALL): Likewise.
	(__ASSUME_SENDMMSG_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/arm/kernel-features.h
	(__ASSUME_RECVMMSG_SYSCALL): Likewise.
	(__ASSUME_ACCEPT4_SYSCALL): Likewise.
	(__ASSUME_SENDMMSG_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/hppa/kernel-features.h
	(__ASSUME_ACCEPT4_SYSCALL): Likewise.
	(__ASSUME_RECVMMSG_SYSCALL): Likewise.
	(__ASSUME_SENDMMSG_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/i386/kernel-features.h
	[__LINUX_KERNEL_VERSION >= 0x020621] (__ASSUME_RECVMMSG_SYSCALL):
	Likewise.
	[__LINUX_KERNEL_VERSION >= 0x030000] (__ASSUME_SENDMMSG_SYSCALL):
	Likewise.
	(__ASSUME_ACCEPT4_SYSCALL): Undefine if [__LINUX_KERNEL_VERSION <
	0x040300] instead of defining if [__LINUX_KERNEL_VERSION >=
	0x040300].
	* sysdeps/unix/sysv/linux/ia64/kernel-features.h
	(__ASSUME_RECVMMSG_SYSCALL): Do not define.
	(__ASSUME_SENDMMSG_SYSCALL): Likewise.
	(__ASSUME_ACCEPT4_SYSCALL): Undefine if [__LINUX_KERNEL_VERSION <
	0x030300] instead of defining if [__LINUX_KERNEL_VERSION >=
	0x030300].
	[__LINUX_KERNEL_VERSION < 0x030300] (__ASSUME_ACCEPT4): Undefine.
	* sysdeps/unix/sysv/linux/m68k/kernel-features.h
	(__ASSUME_ACCEPT4_SYSCALL): Undefine if [__LINUX_KERNEL_VERSION <
	0x040300] instead of defining if [__LINUX_KERNEL_VERSION >=
	0x040300].
	(__ASSUME_RECVMMSG_SYSCALL): Likewise.
	(__ASSUME_SENDMMSG_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/microblaze/kernel-features.h
	(__ASSUME_ACCEPT4_SYSCALL): Do not define.
	(__ASSUME_RECVMMSG_SYSCALL): Likewise.
	(__ASSUME_SENDMMSG_SYSCALL): Undefine if [__LINUX_KERNEL_VERSION <
	0x030300] instead of defining if [__LINUX_KERNEL_VERSION >=
	0x030300].
	* sysdeps/unix/sysv/linux/mips/kernel-features.h
	(__ASSUME_ACCEPT4_SYSCALL): Do not define.
	(__ASSUME_RECVMMSG_SYSCALL): Likewise.
	(__ASSUME_SENDMMSG_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/kernel-features.h
	(__ASSUME_ACCEPT4_SYSCALL): Likewise.
	(__ASSUME_RECVMMSG_SYSCALL): Likewise.
	(__ASSUME_SENDMMSG_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/s390/kernel-features.h
	(__ASSUME_ACCEPT4_SYSCALL): Undefine if [__LINUX_KERNEL_VERSION <
	0x040300] instead of defining if [__LINUX_KERNEL_VERSION >=
	0x040300].
	(__ASSUME_RECVMMSG_SYSCALL): Likewise.
	(__ASSUME_SENDMMSG_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/sh/kernel-features.h
	(__ASSUME_ACCEPT4_SYSCALL): Do not define.
	(__ASSUME_RECVMMSG_SYSCALL): Likewise.
	(__ASSUME_SENDMMSG_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/sparc/kernel-features.h
	(__ASSUME_ACCEPT4_SYSCALL): Likewise.
	(__ASSUME_RECVMMSG_SYSCALL): Likewise.
	(__ASSUME_SENDMMSG_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/tile/kernel-features.h
	(__ASSUME_ACCEPT4_SYSCALL): Likewise.
	(__ASSUME_RECVMMSG_SYSCALL): Likewise.
	(__ASSUME_SENDMMSG_SYSCALL): Likewise.
	* sysdeps/unix/sysv/linux/x86_64/kernel-features.h
	(__ASSUME_ACCEPT4_SYSCALL): Likewise.
	[__LINUX_KERNEL_VERSION >= 0x020621] (__ASSUME_RECVMMSG_SYSCALL):
	Likewise.
	[__LINUX_KERNEL_VERSION >= 0x030000] (__ASSUME_SENDMMSG_SYSCALL):
	Likewise.
2016-03-15 21:09:33 +00:00
Joseph Myers ad1b6d85ba Remove kernel-features.h conditionals on pre-3.2 kernels.
This patch follows up on the increase in minimum kernel version by
removing conditionals in non-x86, non-x86_64 kernel-features.h headers
that are now constant for all supported kernel versions.

	* sysdeps/unix/sysv/linux/alpha/kernel-features.h
	[__LINUX_KERNEL_VERSION >= 0x020621]: Make code unconditional.
	[__LINUX_KERNEL_VERSION >= 0x030200]: Likewise.
	[__LINUX_KERNEL_VERSION < 0x020621]: Remove conditional code.
	* sysdeps/unix/sysv/linux/arm/kernel-features.h
	[__LINUX_KERNEL_VERSION >= 0x020621]: Make code unconditional.
	[__LINUX_KERNEL_VERSION >= 0x020624]: Likewise.
	[__LINUX_KERNEL_VERSION >= 0x030000]: Likewise.
	* sysdeps/unix/sysv/linux/hppa/kernel-features.h
	[__LINUX_KERNEL_VERSION >= 0x020622]: Likewise.
	[__LINUX_KERNEL_VERSION >= 0x030100]: Likewise.
	[__LINUX_KERNEL_VERSION < 0x020625]: Remove conditional code.
	* sysdeps/unix/sysv/linux/ia64/kernel-features.h
	[__LINUX_KERNEL_VERSION >= 0x020621]: Make code unconditional.
	[__LINUX_KERNEL_VERSION >= 0x030000]: Likewise.
	* sysdeps/unix/sysv/linux/m68k/kernel-features.h
	[__LINUX_KERNEL_VERSION < 0x030000]: Remove conditional code.
	* sysdeps/unix/sysv/linux/microblaze/kernel-features.h
	[__LINUX_KERNEL_VERSION >= 0x020621]: Make code unconditional.
	[__LINUX_KERNEL_VERSION < 0x020621]: Remove conditional code.
	[__LINUX_KERNEL_VERSION < 0x020625]: Likewise.
	* sysdeps/unix/sysv/linux/mips/kernel-features.h
	[__LINUX_KERNEL_VERSION >= 0x020621]: Make code unconditional.
	[__LINUX_KERNEL_VERSION >= 0x030100]: Likewise.
	[_MIPS_SIM == _ABIN32 && __LINUX_KERNEL_VERSION < 0x020623]:
	Remove conditional code.
	* sysdeps/unix/sysv/linux/powerpc/kernel-features.h
	[__LINUX_KERNEL_VERSION >= 0x020625]: Make code unconditional.
	[__LINUX_KERNEL_VERSION >= 0x030000]: Likewise.
	* sysdeps/unix/sysv/linux/sh/kernel-features.h
	[__LINUX_KERNEL_VERSION >= 0x020625]: Likewise.
	[__LINUX_KERNEL_VERSION >= 0x030000]: Likewise.
	[__LINUX_KERNEL_VERSION < 0x020625]: Remove conditional code.
	* sysdeps/unix/sysv/linux/sparc/kernel-features.h
	[__LINUX_KERNEL_VERSION >= 0x020621]: Make code unconditional.
	[__LINUX_KERNEL_VERSION >= 0x030000]: Likewise.
	* sysdeps/unix/sysv/linux/tile/kernel-features.h
	[__LINUX_KERNEL_VERSION >= 0x030000]: Likewise.
2016-02-26 16:17:25 +00:00
Joseph Myers f7a9f785e5 Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
Mike Frysinger 8a44513e9c alpha: drop __ASSUME_FDATASYNC
Since we require a new enough kernel all the time, the __ASSUME_FDATASYNC
define has been hardcoded to 1.  That means we can delete the alpha file
for fdatasync now and rely on the syscalls list like other ports.
2015-09-17 23:19:10 -04:00
Joseph Myers b168057aaa Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
Joseph Myers 5e7698c6f1 Reduce kernel-features.h duplication.
This patch reduces duplication between different architectures'
kernel-features.h files by making the architecture-independent file
define various macros unconditionally (instead of only for a
particular list of architectures), with the architecture-specific
files then undefining the macros if necessary.

Specifically, __ASSUME_O_CLOEXEC (O_CLOEXEC flag to open) and
__ASSUME_SOCK_CLOEXEC (SOCK_NONBLOCK and SOCK_CLOEXEC flags to socket)
are supported on all architectures as of 2.6.32 or the minimum kernel
version for the architecture if later.  For __ASSUME_IN_NONBLOCK,
__ASSUME_PIPE2, __ASSUME_EVENTFD2, __ASSUME_SIGNALFD4 and
__ASSUME_DUP3, the relevant syscalls were added for alpha in 2.6.33
but otherwise the features are available as of 2.6.32.  For
__ASSUME_UTIMES, support is everywhere in 2.6.32 except for
asm-generic architectures and hppa.

Although those were the main cases of duplication among
kernel-features.h files, some other cases of unnecessary definitions
were also cleaned up: the hppa file defined various macros that were
either no longer used at all, or defined by the main file by default
anyway, the ia64 file had duplicative definitions of __ASSUME_PSELECT
and __ASSUME_PPOLL, while mips had such a definition of
__ASSUME_IPC64.

Really, rather than being defined in the main file then undefined for
asm-generic architectures, __ASSUME_UTIMES should become an
hppa-specific macro.  Given that __ASSUME_ATFCTS and
__ASSUME_UTIMENSAT are now always true, the only live __ASSUME_UTIMES
conditional is in sysdeps/unix/sysv/linux/utimes.c, which is not used
for asm-generic architectures.  I think the desired state would be an
hppa-specific file (that includes sysdeps/unix/sysv/linux/utimes.c if
__ASSUME_UTIMES, and otherwise has fallback code), with the fallback
code being removed from the main utimes.c.  But I think that's most
reasonably a separate cleanup once __ASSUME_ATFCTS and
__ASSUME_UTIMESAT have both had conditional code cleaned up.

Given this patch, I think it's straightforward to move non-ex-ports
architectures to having their own kernel-features.h files, like
ex-ports architectures, rather than conditionals in the main file
(i.e., such a move won't require the architecture-specific file to
contain anything that isn't genuinely architecture-specific), and
would encourage architecture maintainers to do so.

Tested x86_64 that the installed shared libraries are unchanged by
this patch.  Note that on some architectures this *will* cause
__ASSUME_* macros to be defined in cases where they weren't previously
but should have been (but this is just optimization, not a fix to a
user-visible bug, so doesn't need a bug report in Bugzilla).

	* sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_UTIMES):
	Define unconditionally.
	(__ASSUME_O_CLOEXEC): Likewise.
	(__ASSUME_SOCK_CLOEXEC): Likewise.
	(__ASSUME_IN_NONBLOCK): Likewise.
	(__ASSUME_PIPE2): Likewise.
	(__ASSUME_EVENTFD2): Likewise.
	(__ASSUME_SIGNALFD4): Likewise.
	(__ASSUME_DUP3): Likewise.
	* sysdeps/unix/sysv/linux/aarch64/kernel-features.h
	(__ASSUME_DUP3): Do not define.
	(__ASSUME_EVENTFD2): Likewise.
	(__ASSUME_IN_NONBLOCK): Likewise.
	(__ASSUME_O_CLOEXEC): Likewise.
	(__ASSUME_PIPE2): Likewise.
	(__ASSUME_SIGNALFD4): Likewise.
	(__ASSUME_SOCK_CLOEXEC): Likewise.
	(__ASSUME_UTIMES): Undefine.
	* sysdeps/unix/sysv/linux/alpha/kernel-features.h
	(__ASSUME_UTIMES): Do not define.
	(__ASSUME_O_CLOEXEC): Likewise.
	(__ASSUME_SOCK_CLOEXEC): Likewise.
	(__ASSUME_IN_NONBLOCK): Undefine if [__LINUX_KERNEL_VERSION <
	0x020621] instead of defining if [__LINUX_KERNEL_VERSION >=
	0x020621].
	(__ASSUME_PIPE2): Likewise.
	(__ASSUME_EVENTFD2): Likewise.
	(__ASSUME_SIGNALFD4): Likewise.
	[__LINUX_KERNEL_VERSION < 0x020621] (__ASSUME_DUP3): Undefine.
	* sysdeps/unix/sysv/linux/arm/kernel-features.h (__ASSUME_UTIMES):
	Do not define.
	(__ASSUME_EVENTFD2): Likewise.
	(__ASSUME_SIGNALFD4): Likewise.
	* sysdeps/unix/sysv/linux/hppa/kernel-features.h
	(__ASSUME_32BITUIDS): Likewise.
	(__ASSUME_TRUNCATE64_SYSCALL): Likewise.
	(__ASSUME_IPC64): Likewise.
	(__ASSUME_ST_INO_64_BIT): Likewise.
	(__ASSUME_GETDENTS64_SYSCALL): Likewise.
	[__LINUX_KERNEL_VERSION < 0x030e00] (__ASSUME_UTIMES): Undefine.
	* sysdeps/unix/sysv/linux/ia64/kernel-features.h
	(__ASSUME_UTIMES): Do not define.
	(__ASSUME_PSELECT): Likewise.
	(__ASSUME_PPOLL): Likewise.
	(__ASSUME_O_CLOEXEC): Likewise.
	(__ASSUME_SOCK_CLOEXEC): Likewise.
	(__ASSUME_IN_NONBLOCK): Likewise.
	(__ASSUME_PIPE2): Likewise.
	(__ASSUME_EVENTFD2): Likewise.
	(__ASSUME_SIGNALFD4): Likewise.
	(__ASSUME_DUP3): Likewise.
	* sysdeps/unix/sysv/linux/m68k/kernel-features.h
	(__ASSUME_UTIMES): Likewise.
	(__ASSUME_O_CLOEXEC): Likewise.
	(__ASSUME_SOCK_CLOEXEC): Likewise.
	(__ASSUME_IN_NONBLOCK): Likewise.
	(__ASSUME_PIPE2): Likewise.
	(__ASSUME_EVENTFD2): Likewise.
	(__ASSUME_SIGNALFD4): Likewise.
	(__ASSUME_DUP3): Likewise.
	* sysdeps/unix/sysv/linux/microblaze/kernel-features.h
	(__ASSUME_UTIMES): Likewise.
	(__ASSUME_O_CLOEXEC): Likewise.
	(__ASSUME_SOCK_CLOEXEC): Likewise.
	(__ASSUME_IN_NONBLOCK): Likewise.
	(__ASSUME_PIPE2): Likewise.
	(__ASSUME_EVENTFD2): Likewise.
	(__ASSUME_SIGNALFD4): Likewise.
	(__ASSUME_DUP3): Likewise.
	* sysdeps/unix/sysv/linux/mips/kernel-features.h (__ASSUME_IPC64):
	Likewise.
	(__ASSUME_UTIMES): Likewise.
	(__ASSUME_EVENTFD2): Likewise.
	(__ASSUME_SIGNALFD4): Likewise.
	* sysdeps/unix/sysv/linux/tile/kernel-features.h
	(__ASSUME_O_CLOEXEC): Likewise.
	(__ASSUME_SOCK_CLOEXEC): Likewise.
	(__ASSUME_IN_NONBLOCK): Likewise.
	(__ASSUME_PIPE2): Likewise.
	(__ASSUME_EVENTFD2): Likewise.
	(__ASSUME_SIGNALFD4): Likewise.
	(__ASSUME_DUP3): Likewise.
	(__ASSUME_UTIMES): Undefine.
2014-05-14 00:45:19 +00:00
Joseph Myers 637461d965 Clean up kernel version conditionals for pre-2.6.32 kernels.
This patch does some initial cleanup, following the move to 2.6.32
minimum kernel version, by removing __LINUX_KERNEL_VERSION
conditionals that are now always-true or always-false.  In the case of
__ASSUME_ARG_MAX_STACK_BASED, where the conditional used a kernel
version that was itself in a macro, the associated sysconf.c code is
also cleaned up and __ASSUME_ARG_MAX_STACK_BASED removed completely.

Tested x86_64 that disassembly of installed shared libraries is
unchanged by the patch.

	* sysdeps/unix/sysv/linux/kernel-features.h [__s390__]
	(__ASSUME_UTIMES): Do not condition on kernel version.
	(__ASSUME_PSELECT): Define unconditionally.
	(__ASSUME_PPOLL): Likewise.
	(__ASSUME_ATFCTS): Likewise.
	(__ASSUME_SET_ROBUST_LIST): Do not condition on kernel version.
	(__ASSUME_COMPLETE_READV_WRITEV): Define unconditionally.
	(__ASSUME_FUTEX_LOCK_PI): Do not condition on kernel version.
	(__ASSUME_UTIMENSAT): Define unconditionally.
	(__ASSUME_PRIVATE_FUTEX): Likewise.
	(__ASSUME_FALLOCATE): Likewise.
	(__ASSUME_O_CLOEXEC): Likewise.
	(__LINUX_ARG_MAX_STACK_BASED_MIN_KERNEL): Remove.
	(__ASSUME_ARG_MAX_STACK_BASED): Likewise.
	(__ASSUME_ADJ_OFFSET_SS_READ): Define unconditionally.
	(__ASSUME_SOCK_CLOEXEC): Do not condition on kernel version.
	(__ASSUME_IN_NONBLOCK): Likewise.
	(__ASSUME_PIPE2): Likewise.
	(__ASSUME_EVENTFD2): Likewise.
	(__ASSUME_SIGNALFD4): Likewise.
	(__ASSUME_DUP3): Likewise.
	[__x86_64__ || __sparc__] (__ASSUME_ACCEPT4_SYSCALL): Likewise.
	(__ASSUME_FUTEX_CLOCK_REALTIME): Define unconditionally.
	(__ASSUME_AT_RANDOM): Likewise.
	(__ASSUME_PREADV): Likewise.
	(__ASSUME_PWRITEV): Likewise.
	(__ASSUME_REQUEUE_PI): Do not condition on kernel version.
	(__ASSUME_F_GETOWN_EX): Define unconditionally.
	(__ASSUME_XFS_RESTRICTED_CHOWN): Likewise.
	* sysdeps/unix/sysv/linux/sysconf.c (__sysconf)
	[!__ASSUME_ARG_MAX_STACK_BASED]: Remove conditional code.
	* sysdeps/unix/sysv/linux/alpha/kernel-features.h
	(__ASSUME_O_CLOEXEC): Define unconditionally.
	(__ASSUME_PSELECT): Do not undefine conditionally.
	(__ASSUME_PPOLL): Likewise.
	(__ASSUME_ATFCTS): Likewise.
	(__ASSUME_SET_ROBUST_LIST): Likewise.
	(__ASSUME_UTIMENSAT): Likewise.
	(__ASSUME_FDATASYNC): Define unconditionally.
	* sysdeps/unix/sysv/linux/arm/kernel-features.h
	(__ASSUME_SIGFRAME_V2): Likewise.
	)__ASSUME_EVENTFD2): Likewise.
	(__ASSUME_SIGNALFD4): Likewise.
	(__ASSUME_PSELECT): Do not undefine conditionally.
	(__ASSUME_PPOLL): Likewise.
	* sysdeps/unix/sysv/linux/ia64/kernel-features.h
	(__ASSUME_PSELECT): Define unconditionally.
	(__ASSUME_PPOLL): Likewise.
	(__ASSUME_O_CLOEXEC): Likewise.
	(__ASSUME_SOCK_CLOEXEC): Likewise.
	(__ASSUME_IN_NONBLOCK): Likewise.
	(__ASSUME_PIPE2): Likewise.
	(__ASSUME_EVENTFD2): Likewise.
	(__ASSUME_SIGNALFD4): Likewise.
	(__ASSUME_DUP3): Likewise.
	* sysdeps/unix/sysv/linux/m68k/kernel-features.h
	(__ASSUME_O_CLOEXEC): Likewise.
	(__ASSUME_SOCK_CLOEXEC): Likewise.
	(__ASSUME_IN_NONBLOCK): Likewise.
	(__ASSUME_PIPE2): Likewise.
	(__ASSUME_EVENTFD2): Likewise.
	(__ASSUME_SIGNALFD4): Likewise.
	(__ASSUME_DUP3): Likewise.
	* sysdeps/unix/sysv/linux/mips/kernel-features.h
	(__ASSUME_EVENTFD2): Likewise.
	(__ASSUME_SIGNALFD4): Likewise.
	(__ASSUME_ACCEPT4_SYSCALL): Likewise.
2014-05-12 22:48:25 +00:00
Joseph Myers b1115e916a Fix __ASSUME_PREADV and __ASSUME_PWRITEV for Alpha and MicroBlaze (bug 16649).
Reviewing (for all architectures, with a baseline kernel version of
2.6.32) the kernel support for features for which __ASSUME_* macros
would be affected by a move to 2.6.32 as minimum kernel version showed
up that __ASSUME_PREADV and __ASSUME_PWRITEV were wrongly defined for
MicroBlaze (despite the corresponding syscall table entries not being
wired up in the kernel) and Alpha for 2.6.30 and above (although the
support on Alpha was added in 2.6.33).  This patch makes the
kernel-features.h files undefine those macros for appropriate
versions.

	[BZ #16649]
	* sysdeps/unix/sysv/linux/alpha/kernel-features.h
	[__LINUX_KERNEL_VERSION < 0x020621] (__ASSUME_PREADV): Undefine.
	[__LINUX_KERNEL_VERSION < 0x020621] (__ASSUME_PWRITEV): Likewise.
	* sysdeps/unix/sysv/linux/microblaze/kernel-features.h
	(__ASSUME_PREADV): Undefine.
	(__ASSUME_PWRITEV): Likewise.
2014-03-19 13:10:52 +00:00
Joseph Myers bc688c1029 Fix __ASSUME_SENDMMSG issues (bug 16611).
Similar to the issues for accept4 and recvmmsg, __ASSUME_SENDMMSG is
also confused about whether it relates to function availability or
socketcall operation availability, and the conditions for the
definition are always wrong (sendmmsg appeared in Linux kernel 3.0,
not 2.6.39); this is now bug 16611.

This patch splits the macro into separate macros like those for
accept4 and recvmmsg, defining them for appropriate kernel versions.

Tested x86_64, including that disassembly of the installed shared
libraries is unchanged by this patch.

	[BZ #16611]
	* sysdeps/unix/sysv/linux/kernel-features.h
	[__LINUX_KERNEL_VERSION >= 0x030000 && __ASSUME_SOCKETCALL]
	(__ASSUME_SENDMMSG_SOCKETCALL): Define.
	[__LINUX_KERNEL_VERSION >= 0x030000 && (__i386__ || __x86_64__ ||
	__powerpc__ || __sh__ || __sparc__)] (__ASSUME_SENDMMSG_SYSCALL):
	Likewise.
	[__i386__ || __powerpc__ || __sh__ || __sparc__]
	(__ASSUME_SENDMMSG_SYSCALL_WITH_SOCKETCALL): Likewise.
	[__ASSUME_SENDMMSG_SOCKETCALL || __ASSUME_SENDMMSG_SYSCALL]
	(__ASSUME_SENDMMSG): Define instead of using previous
	[__LINUX_KERNEL_VERSION >= 0x020627] condition.
	* sysdeps/unix/sysv/linux/aarch64/kernel-features.h
	(__ASSUME_SENDMMSG_SYSCALL): Define.
	* sysdeps/unix/sysv/linux/alpha/kernel-features.h
	[__LINUX_KERNEL_VERSION >= 0x030200] (__ASSUME_SENDMMSG_SYSCALL):
	Likewise.
	* sysdeps/unix/sysv/linux/arm/kernel-features.h
	[__LINUX_KERNEL_VERSION >= 0x030000] (__ASSUME_SENDMMSG_SYSCALL):
	Likewise.
	* sysdeps/unix/sysv/linux/ia64/kernel-features.h
	[__LINUX_KERNEL_VERSION >= 0x030000] (__ASSUME_SENDMMSG_SYSCALL):
	Likewise.
	* sysdeps/unix/sysv/linux/internal_sendmmsg.S [__ASSUME_SOCKETCALL
	&& !__ASSUME_SENDMMSG_SYSCALL_WITH_SOCKETCALL &&
	!__ASSUME_SENDMMSG_SYSCALL] (__NR_sendmmsg): Undefine.
	[__ASSUME_SENDMMSG]: Change conditionals to
	[__ASSUME_SENDMMSG_SOCKETCALL].
	* sysdeps/unix/sysv/linux/microblaze/kernel-features.h
	[__LINUX_KERNEL_VERSION >= 0x030300] (__ASSUME_SENDMMSG_SYSCALL):
	Define.
	* sysdeps/unix/sysv/linux/mips/kernel-features.h
	[__LINUX_KERNEL_VERSION >= 0x030100] (__ASSUME_SENDMMSG_SYSCALL):
	Likewise.
	* sysdeps/unix/sysv/linux/sendmmsg.c [__ASSUME_SOCKETCALL &&
	!__ASSUME_SENDMMSG_SYSCALL_WITH_SOCKETCALL &&
	!__ASSUME_SENDMMSG_SYSCALL] (__NR_sendmmsg): Undefine.
	[!__ASSUME_SENDMMSG]: Change conditional to
	[!__ASSUME_SENDMMSG_SOCKETCALL].
	* sysdeps/unix/sysv/linux/tile/kernel-features.h
	[__LINUX_KERNEL_VERSION >= 0x030000] (__ASSUME_SENDMMSG_SYSCALL):
	Define.

	* sysdeps/unix/sysv/linux/hppa/kernel-features.h
	[__LINUX_KERNEL_VERSION >= 0x030100] (__ASSUME_SENDMMSG_SYSCALL):
	Define.
2014-02-20 17:55:35 +00:00
Joseph Myers 0e31b18ca2 Fix __ASSUME_RECVMMSG issues (bug 16610).
Similar to the issues for accept4, __ASSUME_RECVMMSG is also confused
about whether it relates to function availability or socketcall
operation availability; this is now bug 16610.

Nothing actually tests __ASSUME_RECVMMSG for function availability,
but implicit in the definition in kernel-features.h is the idea that
it makes sense when the syscall is available and socketcall is not
being used.  As with accept4, there are architectures where the
syscall was added later than the socketcall operation, meaning that
assuming glibc is built with recent enough kernel headers, it does not
attempt to use socketcall for these operations and __ASSUME_RECVMMSG
gets defined for kernels >= 2.6.33 even when the syscall was only
added later.

This patch splits the macro into separate macros like those used for
accept4; having similar macro structure in both cases (and for
sendmmsg once I've dealt with that) seems likely to be less confusing
than having a different structure on the basis of nothing actually
needing to assume the recvmmsg function works.  Appropriate
definitions are added for all architectures.

Architecture-specific note: Tile's kernel-features.h says "TILE glibc
support starts with 2.6.36", which is accurate in that 2.6.36 was the
first kernel version with Tile support, and on that basis I've made
that header define __ASSUME_RECVMMSG_SYSCALL unconditionally.
However, Tile's configure.ac has arch_minimum_kernel=2.6.32.  Since
arch_minimum_kernel is meant to reflect only kernel.org kernel
versions, I think that should change to 2.6.36.  (If using glibc with
kernel versions from before a port went in kernel.org, it's your
responsibility to change arch_minimum_kernel in a local patch, and at
the same time to adjust any __ASSUME_* definitions that may not be
correct for your older kernel; for developing the official glibc it
should only ever be necessary to consider what official kernel.org
releases support.)

Tested x86_64, including that disassembly of the installed shared
libraries is unchanged by this patch.

	[BZ #16610]
	* sysdeps/unix/sysv/linux/kernel-features.h
	[__LINUX_KERNEL_VERSION >= 0x020621 && __ASSUME_SOCKETCALL]
	(__ASSUME_RECVMMSG_SOCKETCALL): Define.
	[(__LINUX_KERNEL_VERSION >= 0x020621 && (__i386__ || __x86_64__ ||
	__sparc__)) || (__LINUX_KERNEL_VERSION >= 0x020625 && (__powerpc__
	|| __sh__))] (__ASSUME_RECVMMSG_SYSCALL): Likewise.
	[__i386__ || __sparc__]
	(__ASSUME_RECVMMSG_SYSCALL_WITH_SOCKETCALL): Likewise.
	[__ASSUME_RECVMMSG_SOCKETCALL || __ASSUME_RECVMMSG_SYSCALL]
	(__ASSUME_RECVMMSG): Define instead of using previous
	[__LINUX_KERNEL_VERSION >= 0x020621] condition.
	* sysdeps/unix/sysv/linux/aarch64/kernel-features.h
	(__ASSUME_RECVMMSG_SYSCALL): Define.
	* sysdeps/unix/sysv/linux/alpha/kernel-features.h
	[__LINUX_KERNEL_VERSION >= 0x020621] (__ASSUME_RECVMMSG_SYSCALL):
	Likewise.
	* sysdeps/unix/sysv/linux/arm/kernel-features.h
	[__LINUX_KERNEL_VERSION >= 0x020621] (__ASSUME_RECVMMSG_SYSCALL):
	Likewise.
	* sysdeps/unix/sysv/linux/ia64/kernel-features.h
	[__LINUX_KERNEL_VERSION >= 0x020621] (__ASSUME_RECVMMSG_SYSCALL):
	Likewise.
	* sysdeps/unix/sysv/linux/internal_recvmmsg.S [__ASSUME_SOCKETCALL
	&& !__ASSUME_RECVMMSG_SYSCALL_WITH_SOCKETCALL &&
	!__ASSUME_RECVMMSG_SYSCALL] (__NR_recvmmsg): Undefine.
	[__ASSUME_RECVMMSG]: Change condition to
	[__ASSUME_RECVMMSG_SOCKETCALL].
	* sysdeps/unix/sysv/linux/microblaze/kernel-features.h
	[__LINUX_KERNEL_VERSION >= 0x020621] (__ASSUME_RECVMMSG_SYSCALL):
	Define.
	(__ASSUME_RECVMMSG_SYSCALL_WITH_SOCKETCALL): Likewise.
	* sysdeps/unix/sysv/linux/mips/kernel-features.h
	[__LINUX_KERNEL_VERSION >= 0x020621] (__ASSUME_RECVMMSG_SYSCALL):
	Likewise.
	* sysdeps/unix/sysv/linux/recvmmsg.c [__ASSUME_SOCKETCALL &&
	!__ASSUME_RECVMMSG_SYSCALL_WITH_SOCKETCALL &&
	!__ASSUME_RECVMMSG_SYSCALL] (__NR_recvmmsg): Undefine.
	[!__ASSUME_RECVMMSG]: Change condition to
	[!__ASSUME_RECVMMSG_SOCKETCALL].
	* sysdeps/unix/sysv/linux/tile/kernel-features.h
	(__ASSUME_RECVMMSG_SYSCALL): Define.

	* sysdeps/unix/sysv/linux/hppa/kernel-features.h
	[__LINUX_KERNEL_VERSION >= 0x020622] (__ASSUME_RECVMMSG_SYSCALL):
	Define.
2014-02-20 17:53:08 +00:00
Joseph Myers dd481ccffd Fix __ASSUME_ACCEPT4 issues (bug 16609).
In <https://sourceware.org/ml/libc-alpha/2013-12/msg00008.html>,
Aurelien noted issues with the definition of __ASSUME_ACCEPT4, which I
discussed in more detail in
<https://sourceware.org/ml/libc-alpha/2013-12/msg00014.html>; these
are now bug 16609.

As previously noted, __ASSUME_ACCEPT4 is used in two ways:

* In OS-independent code, to mean "accept4 can be assumed to work
  rather than fail with ENOSYS".  It doesn't matter whether it's
  implemented with socketcall or a separate syscall.

* In Linux-specific code, to mean "the socketcall multiplex syscall
  can be assumed to handle the accept4 operation.  When used in
  Linux-specific code, it *never* refers to anything relating to the
  accept4 syscall, only to the socketcall multiplexer.

This patch splits the macro into separate __ASSUME_ACCEPT4_SOCKETCALL,
__ASSUME_ACCEPT4_SYSCALL and __ASSUME_ACCEPT4 to clarify the different
cases involved.  A macro __ASSUME_SOCKETCALL is added for convenience
in writing logic relating to all socketcall architectures.  In
addition, to address the issue of architectures where socketcall
support for accept4 was added before a separate syscall was added (and
so the separate syscall should not be used unless known to be present
or fallback to socketcall is available), a fourth macro
__ASSUME_ACCEPT4_SYSCALL_WITH_SOCKETCALL is added to indicate that the
syscall became available at the same time as socketcall support.  This
is then used in the relevant places in a conditional determining
whether to undefine __NR_accept4 (the simple approach to avoiding the
syscall's presence causing problems; I didn't try to implement runtime
fallback from the syscall to socketcall).

Architecture-specific note: alpha defined __ASSUME_ACCEPT4 for 2.6.33
and later, but actually the syscall was added for alpha in 3.2, so
this patch uses the correct condition for __ASSUME_ACCEPT4_SYSCALL
there.

Tested x86_64, including that disassembly of the installed shared
libraries is unchanged by this patch.

	[BZ #16609]
	* sysdeps/unix/sysv/linux/kernel-features.h [__i386__ ||
	__powerpc__ || __s390__ || __sh__ || __sparc__]
	(__ASSUME_SOCKETCALL): Define.
	[__LINUX_KERNEL_VERSION && __ASSUME_SOCKETCALL]
	(__ASSUME_ACCEPT4_SOCKETCALL): Likewise.
	[(__LINUX_KERNEL_VERSION >= 0x02061c && (__x86_64__ || __sparc__))
	|| (__LINUX_KERNEL_VERSION >= 0x020625 && (__powerpc__ ||
	__sh__))] (__ASSUME_ACCEPT4_SYSCALL): Likewise.
	[__sparc__] (__ASSUME_ACCEPT4_SYSCALL_WITH_SOCKETCALL): Likewise.
	[__ASSUME_ACCEPT4_SOCKETCALL || __ASSUME_ACCEPT4_SYSCALL]
	(__ASSUME_ACCEPT4): Define instead of using previous
	[__LINUX_KERNEL_VERSION >= 0x02061c && (__i386__ || __x86_64__ ||
	__powerpc__ || __sparc__ || __s390__)] condition.
	* sysdeps/unix/sysv/linux/aarch64/kernel-features.h
	(__ASSUME_ACCEPT4): Change to __ASSUME_ACCEPT4_SYSCALL.
	* sysdeps/unix/sysv/linux/accept4.c [__ASSUME_SOCKETCALL &&
	!__ASSUME_ACCEPT4_SYSCALL_WITH_SOCKETCALL &&
	!__ASSUME_ACCEPT4_SYSCALL] (__NR_accept4): Undefine.
	[!__ASSUME_ACCEPT4]: Change condition to
	[!__ASSUME_ACCEPT4_SOCKETCALL].
	* sysdeps/unix/sysv/linux/alpha/kernel-features.h
	(__ASSUME_ACCEPT4): Change to __ASSUME_ACCEPT4_SYSCALL.  Correct
	condition to [__LINUX_KERNEL_VERSION >= 0x030200].
	* sysdeps/unix/sysv/linux/arm/kernel-features.h
	[__LINUX_KERNEL_VERSION >= 0x020624] (__ASSUME_ACCEPT4): Change to
	__ASSUME_ACCEPT4_SYSCALL.
	* sysdeps/unix/sysv/linux/i386/accept4.S [__ASSUME_ACCEPT4]:
	Change conditions to [__ASSUME_ACCEPT4_SOCKETCALL].
	* sysdeps/unix/sysv/linux/ia64/kernel-features.h
	[__LINUX_KERNEL_VERSION >= 0x030300] (__ASSUME_ACCEPT4): Change to
	__ASSUME_ACCEPT4_SYSCALL.
	* sysdeps/unix/sysv/linux/internal_accept4.S [__ASSUME_SOCKETCALL
	&& !__ASSUME_ACCEPT4_SYSCALL_WITH_SOCKETCALL &&
	!__ASSUME_ACCEPT4_SYSCALL] (__NR_accept4): Undefine.
	[__ASSUME_ACCEPT4]: Change condition to
	[__ASSUME_ACCEPT4_SOCKETCALL].
	* sysdeps/unix/sysv/linux/m68k/kernel-features.h
	(__ASSUME_SOCKETCALL): Define.
	[__LINUX_KERNEL_VERSION >= 0x02061c] (__ASSUME_ACCEPT4): Remove.
	* sysdeps/unix/sysv/linux/microblaze/kernel-features.h
	(__ASSUME_SOCKETCALL): Define.
	(__ASSUME_ACCEPT4): Remove.
	[__LINUX_KERNEL_VERSION >= 0x020621] (__ASSUME_ACCEPT4_SYSCALL):
	Define.
	* sysdeps/unix/sysv/linux/mips/kernel-features.h
	[__LINUX_KERNEL_VERSION >= 0x02061f] (__ASSUME_ACCEPT4_SYSCALL):
	Likewise.
	* sysdeps/unix/sysv/linux/tile/kernel-features.h
	(__ASSUME_ACCEPT4): Change to __ASSUME_ACCEPT4_SYSCALL.

	* sysdeps/unix/sysv/linux/hppa/kernel-features.h
	[__LINUX_KERNEL_VERSION >= 0x020622] (__ASSUME_ACCEPT4_SYSCALL):
	Define.
2014-02-20 17:50:31 +00:00
Richard Henderson 68b7efaadb Relocate alpha from ports to libc
Also fixed the following whitespace nits to satisfy the push:

sysdeps/alpha/alphaev6/memset.S:142: space before tab in indent.
sysdeps/alpha/configure:1: new blank line at EOF.
sysdeps/alpha/fpu/e_sqrt.c:126: space before tab in indent.
sysdeps/alpha/preconfigure:1: new blank line at EOF.
sysdeps/unix/sysv/linux/alpha/syscalls.list:1: new blank line at EOF.
2014-02-12 07:00:06 -08:00