]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/unix/sysv/linux/kernel-features.h
Fix concurrent changes on nscd aware files (BZ #23178)
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / kernel-features.h
1 /* Set flags signalling availability of kernel features based on given
2 kernel version number.
3 Copyright (C) 1999-2018 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
5
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
19
20 /* This file must not contain any C code. At least it must be protected
21 to allow using the file also in assembler files. */
22
23 #ifndef __LINUX_KERNEL_VERSION
24 /* We assume the worst; all kernels should be supported. */
25 # define __LINUX_KERNEL_VERSION 0
26 #endif
27
28 /* We assume for __LINUX_KERNEL_VERSION the same encoding used in
29 linux/version.h. I.e., the major, minor, and subminor all get a
30 byte with the major number being in the highest byte. This means
31 we can do numeric comparisons.
32
33 In the following we will define certain symbols depending on
34 whether the describes kernel feature is available in the kernel
35 version given by __LINUX_KERNEL_VERSION. We are not always exactly
36 recording the correct versions in which the features were
37 introduced. If somebody cares these values can afterwards be
38 corrected. */
39
40 /* Some architectures use the socketcall multiplexer for some or all
41 socket-related operations instead of separate syscalls.
42 __ASSUME_SOCKETCALL is defined for such architectures. */
43
44 /* The changed st_ino field appeared in 2.4.0-test6. However, SH is lame,
45 and still does not have a 64-bit inode field. */
46 #define __ASSUME_ST_INO_64_BIT 1
47
48 /* The statfs64 syscalls are available in 2.5.74 (but not for alpha). */
49 #define __ASSUME_STATFS64 1
50
51 /* pselect/ppoll were introduced just after 2.6.16-rc1. On x86_64 and
52 SH this appeared first in 2.6.19-rc1, on ia64 in 2.6.22-rc1. */
53 #define __ASSUME_PSELECT 1
54
55 /* The *at syscalls were introduced just after 2.6.16-rc1. On PPC
56 they were introduced in 2.6.17-rc1, on SH in 2.6.19-rc1. */
57 #define __ASSUME_ATFCTS 1
58
59 /* Support for inter-process robust mutexes was added in 2.6.17 (but
60 some architectures lack futex_atomic_cmpxchg_inatomic in some
61 configurations). */
62 #define __ASSUME_SET_ROBUST_LIST 1
63
64 /* Support for private futexes was added in 2.6.22. */
65 #define __ASSUME_PRIVATE_FUTEX 1
66
67 /* Support for various CLOEXEC and NONBLOCK flags was added in
68 2.6.27. */
69 #define __ASSUME_IN_NONBLOCK 1
70
71 /* Support for the FUTEX_CLOCK_REALTIME flag was added in 2.6.29. */
72 #define __ASSUME_FUTEX_CLOCK_REALTIME 1
73
74 /* Support for preadv and pwritev was added in 2.6.30. */
75 #define __ASSUME_PREADV 1
76 #define __ASSUME_PWRITEV 1
77
78 /* Support for sendmmsg functionality was added in 3.0. */
79 #define __ASSUME_SENDMMSG 1
80
81 /* On most architectures, most socket syscalls are supported for all
82 supported kernel versions, but on some socketcall architectures
83 separate syscalls were only added later. */
84 #define __ASSUME_SENDMSG_SYSCALL 1
85 #define __ASSUME_RECVMSG_SYSCALL 1
86 #define __ASSUME_ACCEPT_SYSCALL 1
87 #define __ASSUME_CONNECT_SYSCALL 1
88 #define __ASSUME_RECVFROM_SYSCALL 1
89 #define __ASSUME_SENDTO_SYSCALL 1
90 #define __ASSUME_ACCEPT4_SYSCALL 1
91 #define __ASSUME_RECVMMSG_SYSCALL 1
92 #define __ASSUME_SENDMMSG_SYSCALL 1
93
94 /* Support for SysV IPC through wired syscalls. All supported architectures
95 either support ipc syscall and/or all the ipc correspondent syscalls. */
96 #define __ASSUME_DIRECT_SYSVIPC_SYSCALLS 1
97
98 /* Support for p{read,write}v2 was added in 4.6. However Linux default
99 implementation does not assume the __ASSUME_* and instead use a fallback
100 implementation based on p{read,write}v and returning an error for
101 non supported flags. */
102
103 /* Support for the execveat syscall was added in 3.19. */
104 #if __LINUX_KERNEL_VERSION >= 0x031300
105 # define __ASSUME_EXECVEAT 1
106 #endif
107
108 #if __LINUX_KERNEL_VERSION >= 0x040400
109 # define __ASSUME_MLOCK2 1
110 #endif
111
112 #if __LINUX_KERNEL_VERSION >= 0x040500
113 # define __ASSUME_COPY_FILE_RANGE 1
114 #endif
115
116 /* Support for clone call used on fork. The signature varies across the
117 architectures with current 4 different variants:
118
119 1. long int clone (unsigned long flags, unsigned long newsp,
120 int *parent_tidptr, unsigned long tls,
121 int *child_tidptr)
122
123 2. long int clone (unsigned long newsp, unsigned long clone_flags,
124 int *parent_tidptr, int * child_tidptr,
125 unsigned long tls)
126
127 3. long int clone (unsigned long flags, unsigned long newsp,
128 int stack_size, int *parent_tidptr,
129 int *child_tidptr, unsigned long tls)
130
131 4. long int clone (unsigned long flags, unsigned long newsp,
132 int *parent_tidptr, int *child_tidptr,
133 unsigned long tls)
134
135 The fourth variant is intended to be used as the default for newer ports,
136 Also IA64 uses the third variant but with __NR_clone2 instead of
137 __NR_clone.
138
139 The macros names to define the variant used for the architecture is
140 similar to kernel:
141
142 - __ASSUME_CLONE_BACKWARDS: for variant 1.
143 - __ASSUME_CLONE_BACKWARDS2: for variant 2 (s390).
144 - __ASSUME_CLONE_BACKWARDS3: for variant 3 (microblaze).
145 - __ASSUME_CLONE_DEFAULT: for variant 4.
146 - __ASSUME_CLONE2: for clone2 with variant 3 (ia64).
147 */
148
149 #define __ASSUME_CLONE_DEFAULT 1