hjl / source-git / glibc

Forked from source-git/glibc 3 years ago
Clone

Blame sysdeps/unix/sysv/linux/kernel-features.h

Packit 6c4009
/* Set flags signalling availability of kernel features based on given
Packit 6c4009
   kernel version number.
Packit 6c4009
   Copyright (C) 1999-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
/* This file must not contain any C code.  At least it must be protected
Packit 6c4009
   to allow using the file also in assembler files.  */
Packit 6c4009
Packit 6c4009
#ifndef __LINUX_KERNEL_VERSION
Packit 6c4009
/* We assume the worst; all kernels should be supported.  */
Packit 6c4009
# define __LINUX_KERNEL_VERSION	0
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* We assume for __LINUX_KERNEL_VERSION the same encoding used in
Packit 6c4009
   linux/version.h.  I.e., the major, minor, and subminor all get a
Packit 6c4009
   byte with the major number being in the highest byte.  This means
Packit 6c4009
   we can do numeric comparisons.
Packit 6c4009
Packit 6c4009
   In the following we will define certain symbols depending on
Packit 6c4009
   whether the describes kernel feature is available in the kernel
Packit 6c4009
   version given by __LINUX_KERNEL_VERSION.  We are not always exactly
Packit 6c4009
   recording the correct versions in which the features were
Packit 6c4009
   introduced.  If somebody cares these values can afterwards be
Packit 6c4009
   corrected.  */
Packit 6c4009
Packit 6c4009
/* Some architectures use the socketcall multiplexer for some or all
Packit 6c4009
   socket-related operations instead of separate syscalls.
Packit 6c4009
   __ASSUME_SOCKETCALL is defined for such architectures.  */
Packit 6c4009
Packit 6c4009
/* The changed st_ino field appeared in 2.4.0-test6.  However, SH is lame,
Packit 6c4009
   and still does not have a 64-bit inode field.  */
Packit 6c4009
#define __ASSUME_ST_INO_64_BIT		1
Packit 6c4009
Packit 6c4009
/* The statfs64 syscalls are available in 2.5.74 (but not for alpha).  */
Packit 6c4009
#define __ASSUME_STATFS64	1
Packit 6c4009
Packit 6c4009
/* pselect/ppoll were introduced just after 2.6.16-rc1.  On x86_64 and
Packit 6c4009
   SH this appeared first in 2.6.19-rc1, on ia64 in 2.6.22-rc1.  */
Packit 6c4009
#define __ASSUME_PSELECT	1
Packit 6c4009
Packit 6c4009
/* The *at syscalls were introduced just after 2.6.16-rc1.  On PPC
Packit 6c4009
   they were introduced in 2.6.17-rc1, on SH in 2.6.19-rc1.  */
Packit 6c4009
#define __ASSUME_ATFCTS	1
Packit 6c4009
Packit 6c4009
/* Support for inter-process robust mutexes was added in 2.6.17 (but
Packit 6c4009
   some architectures lack futex_atomic_cmpxchg_inatomic in some
Packit 6c4009
   configurations).  */
Packit 6c4009
#define __ASSUME_SET_ROBUST_LIST	1
Packit 6c4009
Packit 6c4009
/* Support for various CLOEXEC and NONBLOCK flags was added in
Packit 6c4009
   2.6.27.  */
Packit 6c4009
#define __ASSUME_IN_NONBLOCK	1
Packit 6c4009
Packit 6c4009
/* Support for the FUTEX_CLOCK_REALTIME flag was added in 2.6.29.  */
Packit 6c4009
#define __ASSUME_FUTEX_CLOCK_REALTIME	1
Packit 6c4009
Packit 6c4009
/* Support for preadv and pwritev was added in 2.6.30.  */
Packit 6c4009
#define __ASSUME_PREADV	1
Packit 6c4009
#define __ASSUME_PWRITEV	1
Packit 6c4009
Packit 6c4009
/* Support for sendmmsg functionality was added in 3.0.  */
Packit 6c4009
#define __ASSUME_SENDMMSG	1
Packit 6c4009
Packit 6c4009
/* On most architectures, most socket syscalls are supported for all
Packit 6c4009
   supported kernel versions, but on some socketcall architectures
Packit 6c4009
   separate syscalls were only added later.  */
Packit 6c4009
#define __ASSUME_SENDMSG_SYSCALL	1
Packit 6c4009
#define __ASSUME_RECVMSG_SYSCALL	1
Packit 6c4009
#define __ASSUME_ACCEPT_SYSCALL		1
Packit 6c4009
#define __ASSUME_CONNECT_SYSCALL	1
Packit 6c4009
#define __ASSUME_RECVFROM_SYSCALL	1
Packit 6c4009
#define __ASSUME_SENDTO_SYSCALL		1
Packit 6c4009
#define __ASSUME_ACCEPT4_SYSCALL	1
Packit 6c4009
#define __ASSUME_RECVMMSG_SYSCALL	1
Packit 6c4009
#define __ASSUME_SENDMMSG_SYSCALL	1
Packit 6c4009
Packit 6c4009
/* Support for SysV IPC through wired syscalls.  All supported architectures
Packit 6c4009
   either support ipc syscall and/or all the ipc correspondent syscalls.  */
Packit 6c4009
#define __ASSUME_DIRECT_SYSVIPC_SYSCALLS	1
Packit 6c4009
Packit 6c4009
/* Support for p{read,write}v2 was added in 4.6.  However Linux default
Packit 6c4009
   implementation does not assume the __ASSUME_* and instead use a fallback
Packit 6c4009
   implementation based on p{read,write}v and returning an error for
Packit 6c4009
   non supported flags.  */
Packit 6c4009
Packit 6c4009
/* Support for the renameat2 system call was added in kernel 3.15.  */
Packit 6c4009
#if __LINUX_KERNEL_VERSION >= 0x030F00
Packit 6c4009
# define __ASSUME_RENAMEAT2
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Support for the execveat syscall was added in 3.19.  */
Packit 6c4009
#if __LINUX_KERNEL_VERSION >= 0x031300
Packit 6c4009
# define __ASSUME_EXECVEAT	1
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#if __LINUX_KERNEL_VERSION >= 0x040400
Packit 6c4009
# define __ASSUME_MLOCK2 1
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Support for statx was added in kernel 4.11.  */
Packit 6c4009
#if __LINUX_KERNEL_VERSION >= 0x040B00
Packit 6c4009
# define __ASSUME_STATX 1
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Support for clone call used on fork.  The signature varies across the
Packit 6c4009
   architectures with current 4 different variants:
Packit 6c4009
Packit 6c4009
   1. long int clone (unsigned long flags, unsigned long newsp,
Packit 6c4009
		      int *parent_tidptr, unsigned long tls,
Packit 6c4009
		      int *child_tidptr)
Packit 6c4009
Packit 6c4009
   2. long int clone (unsigned long newsp, unsigned long clone_flags,
Packit 6c4009
		      int *parent_tidptr, int * child_tidptr,
Packit 6c4009
		      unsigned long tls)
Packit 6c4009
Packit 6c4009
   3. long int clone (unsigned long flags, unsigned long newsp,
Packit 6c4009
		      int stack_size, int *parent_tidptr,
Packit 6c4009
		      int *child_tidptr, unsigned long tls)
Packit 6c4009
Packit 6c4009
   4. long int clone (unsigned long flags, unsigned long newsp,
Packit 6c4009
		      int *parent_tidptr, int *child_tidptr,
Packit 6c4009
		      unsigned long tls)
Packit 6c4009
Packit 6c4009
   The fourth variant is intended to be used as the default for newer ports,
Packit 6c4009
   Also IA64 uses the third variant but with __NR_clone2 instead of
Packit 6c4009
   __NR_clone.
Packit 6c4009
Packit 6c4009
   The macros names to define the variant used for the architecture is
Packit 6c4009
   similar to kernel:
Packit 6c4009
Packit 6c4009
   - __ASSUME_CLONE_BACKWARDS: for variant 1.
Packit 6c4009
   - __ASSUME_CLONE_BACKWARDS2: for variant 2 (s390).
Packit 6c4009
   - __ASSUME_CLONE_BACKWARDS3: for variant 3 (microblaze).
Packit 6c4009
   - __ASSUME_CLONE_DEFAULT: for variant 4.
Packit 6c4009
   - __ASSUME_CLONE2: for clone2 with variant 3 (ia64).
Packit 6c4009
   */
Packit 6c4009
Packit 6c4009
#define __ASSUME_CLONE_DEFAULT 1