glibc/sysdeps/unix/sysv/linux/microblaze/kernel-features.h

70 lines
2.2 KiB
C
Raw Normal View History

/* Copyright (C) 2011-2019 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
<http://www.gnu.org/licenses/>. */
Use direct socket syscalls for new kernels on i386, m68k, microblaze, sh. Now that we have __ASSUME_* macros for direct socket syscalls to use them instead of socketcall when they can be assumed to be available on socketcall architectures, this patch defines those macros when appropriate for i386, m68k, microblaze and sh (for 4.3, 4.3, all supported kernels and 2.6.37, respectively; the only use of socketcall support on microblaze is it allows accept4 and sendmmsg to be supported on a wider range of kernel versions). David, it seems that 32-bit SPARC is the only architecture supported by glibc that still lacks these direct syscalls. It would be good to get them added to the SPARC kernel so we can eventually eliminate socketcall support in glibc (and thereby just use entries in sysdeps/unix/syscalls.list for most of these functions) when we can assume new-enough kernels. Tested for i386 (testsuite, and that installed shared libraries are unchanged by this patch - not using a new enough kernel, so this doesn't actually test much, but the i386 and m68k code is essentially the same as that already in use for s390). * sysdeps/unix/sysv/linux/i386/kernel-features.h [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_SOCKET_SYSCALL): New macro. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_SOCKETPAIR_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_BIND_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_CONNECT_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_LISTEN_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_ACCEPT4_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_GETSOCKOPT_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_SETSOCKOPT_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_GETSOCKNAME_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_GETPEERNAME_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_SENDTO_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_SENDTO_FOR_SEND_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_SENDMSG_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_RECVFROM_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_RECVFROM_FOR_RECV_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_RECVMSG_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_SHUTDOWN_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/m68k/kernel-features.h [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_RECVMMSG_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_SENDMMSG_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_SOCKET_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_SOCKETPAIR_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_BIND_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_CONNECT_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_LISTEN_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_ACCEPT4_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_ACCEPT4_FOR_ACCEPT_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_GETSOCKOPT_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_SETSOCKOPT_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_GETSOCKNAME_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_GETPEERNAME_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_SENDTO_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_SENDTO_FOR_SEND_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_SENDMSG_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_RECVFROM_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_RECVFROM_FOR_RECV_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_RECVMSG_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x040300] (__ASSUME_SHUTDOWN_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/microblaze/kernel-features.h (__ASSUME_SOCKET_SYSCALL): Likewise. (__ASSUME_BIND_SYSCALL): Likewise. (__ASSUME_CONNECT_SYSCALL): Likewise. (__ASSUME_LISTEN_SYSCALL): Likewise. (__ASSUME_ACCEPT_SYSCALL): Likewise. (__ASSUME_GETSOCKNAME_SYSCALL): Likewise. (__ASSUME_GETPEERNAME_SYSCALL): Likewise. (__ASSUME_SOCKETPAIR_SYSCALL): Likewise. (__ASSUME_SEND_SYSCALL): Likewise. (__ASSUME_SENDTO_SYSCALL): Likewise. (__ASSUME_RECV_SYSCALL): Likewise. (__ASSUME_RECVFROM_SYSCALL): Likewise. (__ASSUME_SHUTDOWN_SYSCALL): Likewise. (__ASSUME_GETSOCKOPT_SYSCALL): Likewise. (__ASSUME_SETSOCKOPT_SYSCALL): Likewise. (__ASSUME_SENDMSG_SYSCALL): Likewise. (__ASSUME_RECVMSG_SYSCALL): Likewise. * sysdeps/unix/sysv/linux/sh/kernel-features.h [__LINUX_KERNEL_VERSION >= 0x020625] (__ASSUME_SOCKET_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x020625] (__ASSUME_BIND_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x020625] (__ASSUME_CONNECT_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x020625] (__ASSUME_LISTEN_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x020625] (__ASSUME_ACCEPT_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x020625] (__ASSUME_GETSOCKNAME_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x020625] (__ASSUME_GETPEERNAME_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x020625] (__ASSUME_SOCKETPAIR_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x020625] (__ASSUME_SEND_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x020625] (__ASSUME_SENDTO_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x020625] (__ASSUME_RECV_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x020625] (__ASSUME_RECVFROM_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x020625] (__ASSUME_SHUTDOWN_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x020625] (__ASSUME_GETSOCKOPT_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x020625] (__ASSUME_SETSOCKOPT_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x020625] (__ASSUME_SENDMSG_SYSCALL): Likewise. [__LINUX_KERNEL_VERSION >= 0x020625] (__ASSUME_RECVMSG_SYSCALL): Likewise.
2015-12-09 21:59:43 +01:00
/* 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
#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
#define __ASSUME_GETSOCKOPT_SYSCALL 1
#define __ASSUME_SETSOCKOPT_SYSCALL 1
#include_next <kernel-features.h>
/* Support for the pselect6, preadv and pwritev syscalls was added in
3.15. */
#if __LINUX_KERNEL_VERSION < 0x030f00
# undef __ASSUME_PSELECT
# undef __ASSUME_PREADV
# undef __ASSUME_PWRITEV
#endif
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 22:09:33 +01:00
/* Support for the sendmmsg syscall was added in 3.3. */
#if __LINUX_KERNEL_VERSION < 0x030300
# undef __ASSUME_SENDMMSG_SYSCALL
#endif
/* Support for the renameat2 syscall was added in 3.17. */
#if __LINUX_KERNEL_VERSION < 0x031100
# undef __ASSUME_RENAMEAT2
#endif
/* Support for the execveat syscall was added in 4.0. */
#if __LINUX_KERNEL_VERSION < 0x040000
# undef __ASSUME_EXECVEAT
#endif
/* Support for the mlock2 syscall was added in 4.7. */
#if __LINUX_KERNEL_VERSION < 0x040700
# undef __ASSUME_MLOCK2
#endif
2018-07-10 16:14:45 +02:00
/* Support for statx was added in kernel 4.12. */
#if __LINUX_KERNEL_VERSION < 0X040C00
# undef __ASSUME_STATX
#endif
Refactor Linux ARCH_FORK implementation This patch refactors the ARCH_FORK macro and the required architecture specific header to simplify the required architecture definitions to provide the fork syscall semantic and proper document current Linux clone ABI variant. Instead of require the reimplementation of arch-fork.h header, this patch changes the ARCH_FORK to an inline function with clone ABI defined by kernel-features.h define. The generic kernel ABI meant for newer ports is used as default and redefine if the architecture requires. Checked on x86_64-linux-gnu and i686-linux-gnu. Also with a build for all the afected ABIs. * sysdeps/nptl/fork.c (ARCH_FORK): Replace by auch_fork. * sysdeps/unix/sysv/linux/alpha/arch-fork.h: Remove file. * sysdeps/unix/sysv/linux/riscv/arch-fork.h: Likewise. * sysdeps/unix/sysv/linux/aarch64/arch-fork.h: Likewise. * sysdeps/unix/sysv/linux/arm/arch-fork.h: Likewise. * sysdeps/unix/sysv/linux/hppa/arch-fork.h: Likewise. * sysdeps/unix/sysv/linux/i386/arch-fork.h: Likewise. * sysdeps/unix/sysv/linux/ia64/arch-fork.h: Likewise. * sysdeps/unix/sysv/linux/m68k/arch-fork.h: Likewise. * sysdeps/unix/sysv/linux/microblaze/arch-fork.h: Likewise. * sysdeps/unix/sysv/linux/mips/arch-fork.h: Likewise. * sysdeps/unix/sysv/linux/nios2/arch-fork.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/arch-fork.h: Likewise. * sysdeps/unix/sysv/linux/s390/arch-fork.h: Likewise. * sysdeps/unix/sysv/linux/sh/arch-fork.h: Likewise. * sysdeps/unix/sysv/linux/sparc/arch-fork.h: Likewise. * sysdeps/unix/sysv/linux/tile/arch-fork.h: Likewise. * sysdeps/unix/sysv/linux/x86_64/arch-fork.h: Likewise. * sysdeps/unix/sysv/linux/arch-fork.h (arch_fork): New function. * sysdeps/unix/sysv/linux/aarch64/kernel-features.h: New file. * sysdeps/unix/sysv/linux/riscv/kernel-features.h: Likewise. * sysdeps/unix/sysv/linux/arm/kernel-features.h (__ASSUME_CLONE_BACKWARDS): Define. * sysdeps/unix/sysv/linux/createthread.c (ARCH_CLONE): Define to __clone2 if __NR_clone2 is defined. * sysdeps/unix/sysv/linux/hppa/kernel-features.h (__ASSUME_CLONE_BACKWARDS): Likewise. * sysdeps/unix/sysv/linux/i386/kernel-features.h (__ASSUME_CLONE_BACKWARDS): Likewise. * sysdeps/unix/sysv/linux/ia64/kernel-features.h (__ASSUME_CLONE2): Likewise. * sysdeps/unix/sysv/linux/microblaze/kernel-features.h (__ASSUME_CLONE_BACKWARDS3): Likewise. * sysdeps/unix/sysv/linux/kernel-features.h: Document possible clone variants and the define architecture can use. (__ASSUME_CLONE_DEFAULT): Define as default. * sysdeps/unix/sysv/linux/mips/kernel-features.h (__ASSUME_CLONE_BACKWARDS): Likewise. * sysdeps/unix/sysv/linux/powerpc/kernel-features.h (__ASSUME_CLONE_BACKWARDS): Likewise. * sysdeps/unix/sysv/linux/s390/kernel-features.h (__ASSUME_CLONE_BACKWARDS2): Likewise.
2018-01-05 18:38:06 +01:00
#undef __ASSUME_CLONE_DEFAULT
#define __ASSUME_CLONE_BACKWARDS3