[444] | 1 | /* Set flags signalling availability of kernel features based on given |
---|
| 2 | kernel version number. |
---|
| 3 | Copyright (C) 1999, 2000, 2001 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, write to the Free |
---|
| 18 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
---|
| 19 | 02111-1307 USA. */ |
---|
| 20 | |
---|
| 21 | /* This file must not contain any C code. At least it must be protected |
---|
| 22 | to allow using the file also in assembler files. */ |
---|
| 23 | |
---|
| 24 | #ifndef __LINUX_KERNEL_VERSION |
---|
| 25 | /* We assume the worst; all kernels should be supported. */ |
---|
| 26 | # define __LINUX_KERNEL_VERSION 0 |
---|
| 27 | #endif |
---|
| 28 | |
---|
| 29 | /* We assume for __LINUX_KERNEL_VERSION the same encoding used in |
---|
| 30 | linux/version.h. I.e., the major, minor, and subminor all get a |
---|
| 31 | byte with the major number being in the highest byte. This means |
---|
| 32 | we can do numeric comparisons. |
---|
| 33 | |
---|
| 34 | In the following we will define certain symbols depending on |
---|
| 35 | whether the describes kernel feature is available in the kernel |
---|
| 36 | version given by __LINUX_KERNEL_VERSION. We are not always exactly |
---|
| 37 | recording the correct versions in which the features were |
---|
| 38 | introduced. If somebody cares these values can afterwards be |
---|
| 39 | corrected. Most of the numbers here are set corresponding to |
---|
| 40 | 2.2.0. */ |
---|
| 41 | |
---|
| 42 | /* `getcwd' system call. */ |
---|
| 43 | #if __LINUX_KERNEL_VERSION >= 131584 |
---|
| 44 | # define __ASSUME_GETCWD_SYSCALL 1 |
---|
| 45 | #endif |
---|
| 46 | |
---|
| 47 | /* Real-time signal became usable in 2.1.70. */ |
---|
| 48 | #if __LINUX_KERNEL_VERSION >= 131398 |
---|
| 49 | # define __ASSUME_REALTIME_SIGNALS 1 |
---|
| 50 | #endif |
---|
| 51 | |
---|
| 52 | /* When were the `pread'/`pwrite' syscalls introduced? */ |
---|
| 53 | #if __LINUX_KERNEL_VERSION >= 131584 |
---|
| 54 | # define __ASSUME_PREAD_SYSCALL 1 |
---|
| 55 | # define __ASSUME_PWRITE_SYSCALL 1 |
---|
| 56 | #endif |
---|
| 57 | |
---|
| 58 | /* When was `poll' introduced? */ |
---|
| 59 | #if __LINUX_KERNEL_VERSION >= 131584 |
---|
| 60 | # define __ASSUME_POLL_SYSCALL 1 |
---|
| 61 | #endif |
---|
| 62 | |
---|
| 63 | /* The `lchown' syscall was introduced in 2.1.80. */ |
---|
| 64 | #if __LINUX_KERNEL_VERSION >= 131408 |
---|
| 65 | # define __ASSUME_LCHOWN_SYSCALL 1 |
---|
| 66 | #endif |
---|
| 67 | |
---|
| 68 | /* When did the `setresuid' sysall became available? */ |
---|
| 69 | #if __LINUX_KERNEL_VERSION >= 131584 && !defined __sparc__ |
---|
| 70 | # define __ASSUME_SETRESUID_SYSCALL 1 |
---|
| 71 | #endif |
---|
| 72 | |
---|
| 73 | /* The SIOCGIFNAME ioctl is available starting with 2.1.50. */ |
---|
| 74 | #if __LINUX_KERNEL_VERSION >= 131408 |
---|
| 75 | # define __ASSUME_SIOCGIFNAME 1 |
---|
| 76 | #endif |
---|
| 77 | |
---|
| 78 | /* On x86 another `getrlimit' syscall was added in 2.3.25. */ |
---|
| 79 | #if __LINUX_KERNEL_VERSION >= 131865 && defined __i386__ |
---|
| 80 | # define __ASSUME_NEW_GETRLIMIT_SYSCALL 1 |
---|
| 81 | #endif |
---|
| 82 | |
---|
| 83 | /* On x86 the truncate64/ftruncate64 syscalls were introduced in 2.3.31. */ |
---|
| 84 | #if __LINUX_KERNEL_VERSION >= 131871 && defined __i386__ |
---|
| 85 | # define __ASSUME_TRUNCATE64_SYSCALL 1 |
---|
| 86 | #endif |
---|
| 87 | |
---|
| 88 | /* On x86 the mmap2 syscall was introduced in 2.3.31. */ |
---|
| 89 | #if __LINUX_KERNEL_VERSION >= 131871 && defined __i386__ |
---|
| 90 | # define __ASSUME_MMAP2_SYSCALL 1 |
---|
| 91 | #endif |
---|
| 92 | |
---|
| 93 | /* On x86 the stat64/lstat64/fstat64 syscalls were introduced in 2.3.34. */ |
---|
| 94 | #if __LINUX_KERNEL_VERSION >= 131874 && defined __i386__ |
---|
| 95 | # define __ASSUME_STAT64_SYSCALL 1 |
---|
| 96 | #endif |
---|
| 97 | |
---|
| 98 | /* On sparc and ARM the truncate64/ftruncate64/mmap2/stat64/lstat64/fstat64 |
---|
| 99 | syscalls were introduced in 2.3.35. */ |
---|
| 100 | #if __LINUX_KERNEL_VERSION >= 131875 && (defined __sparc__ || defined __arm__) |
---|
| 101 | # define __ASSUME_TRUNCATE64_SYSCALL 1 |
---|
| 102 | # define __ASSUME_MMAP2_SYSCALL 1 |
---|
| 103 | # define __ASSUME_STAT64_SYSCALL 1 |
---|
| 104 | #endif |
---|
| 105 | |
---|
| 106 | /* I know for sure that these are in 2.3.35 on powerpc. */ |
---|
| 107 | #if __LINUX_KERNEL_VERSION >= 131875 && defined __powerpc__ |
---|
| 108 | # define __ASSUME_TRUNCATE64_SYSCALL 1 |
---|
| 109 | # define __ASSUME_STAT64_SYSCALL 1 |
---|
| 110 | # define __ASSUME_NEW_GETRLIMIT_SYSCALL 1 |
---|
| 111 | #endif |
---|
| 112 | |
---|
| 113 | /* Linux 2.3.39 introduced 32bit UID/GIDs and IPC64. Some platforms had 32 |
---|
| 114 | bit type all along. */ |
---|
| 115 | #if __LINUX_KERNEL_VERSION >= 131879 || defined __powerpc__ || defined __mips__ |
---|
| 116 | # define __ASSUME_32BITUIDS 1 |
---|
| 117 | # ifndef __powerpc__ |
---|
| 118 | # define __ASSUME_IPC64 1 |
---|
| 119 | # endif |
---|
| 120 | # ifdef __sparc__ |
---|
| 121 | # define __ASSUME_SETRESUID_SYSCALL 1 |
---|
| 122 | # endif |
---|
| 123 | #endif |
---|
| 124 | |
---|
| 125 | /* Linux 2.4.0 on PPC introduced a correct IPC64. */ |
---|
| 126 | #if __LINUX_KERNEL_VERSION >= 132096 && defined __powerpc__ |
---|
| 127 | # define __ASSUME_IPC64 1 |
---|
| 128 | #endif |
---|
| 129 | |
---|
| 130 | /* We can use the LDTs for threading with Linux 2.3.99 and newer. */ |
---|
| 131 | #if __LINUX_KERNEL_VERSION >= 131939 |
---|
| 132 | # define __ASSUME_LDT_WORKS 1 |
---|
| 133 | #endif |
---|
| 134 | |
---|
| 135 | /* The changed st_ino field appeared in 2.4.0-test6. But we cannot |
---|
| 136 | distinguish this version from other 2.4.0 releases. Therefore play |
---|
| 137 | save and assume it available is for 2.4.1 and up. */ |
---|
| 138 | #if __LINUX_KERNEL_VERSION >= 132097 |
---|
| 139 | # define __ASSUME_ST_INO_64_BIT 1 |
---|
| 140 | #endif |
---|
| 141 | |
---|
| 142 | /* To support locking of large files a new fcntl() syscall was introduced |
---|
| 143 | in 2.4.0-test7. We test for 2.4.1 for the earliest version we know |
---|
| 144 | the syscall is available. */ |
---|
| 145 | #if __LINUX_KERNEL_VERSION >= 132097 && (defined __i386__ || defined __sparc__) |
---|
| 146 | # define __ASSUME_FCNTL64 1 |
---|
| 147 | #endif |
---|
| 148 | |
---|
| 149 | /* Arm got fcntl64 in 2.4.4, PowerPC and SH have it also in 2.4.4 (I |
---|
| 150 | don't know when it got introduced). */ |
---|
| 151 | #if __LINUX_KERNEL_VERSION >= 132100 \ |
---|
| 152 | && (defined __arm__ || defined __powerpc__ || defined __sh__) |
---|
| 153 | # define __ASSUME_FCNTL64 1 |
---|
| 154 | #endif |
---|
| 155 | |
---|
| 156 | /* The getdents64 syscall was introduced in 2.4.0-test7. We test for |
---|
| 157 | 2.4.1 for the earliest version we know the syscall is available. */ |
---|
| 158 | #if __LINUX_KERNEL_VERSION >= 132097 |
---|
| 159 | # define __ASSUME_GETDENTS64_SYSCALL 1 |
---|
| 160 | #endif |
---|
| 161 | |
---|
| 162 | /* When did O_DIRECTORY became available? Early in 2.3 but when? |
---|
| 163 | Be safe, use 2.3.99. */ |
---|
| 164 | #if __LINUX_KERNEL_VERSION >= 131939 |
---|
| 165 | # define __ASSUME_O_DIRECTORY 1 |
---|
| 166 | #endif |
---|
| 167 | |
---|
| 168 | /* Starting with one of the 2.4.0 pre-releases the Linux kernel passes |
---|
| 169 | up the page size information. */ |
---|
| 170 | #if __LINUX_KERNEL_VERSION >= 132097 |
---|
| 171 | # define __ASSUME_AT_PAGESIZE 1 |
---|
| 172 | #endif |
---|
| 173 | |
---|
| 174 | /* Starting with 2.4.5 kernels PPC passes the AUXV in the standard way |
---|
| 175 | and the mmap2 syscall made it into the official kernel. */ |
---|
| 176 | #if __LINUX_KERNEL_VERSION >= (132096+5) && defined __powerpc__ |
---|
| 177 | # define __ASSUME_STD_AUXV 1 |
---|
| 178 | # define __ASSUME_MMAP2_SYSCALL 1 |
---|
| 179 | #endif |
---|
| 180 | |
---|
| 181 | /* There are an infinite number of PA-RISC kernel versions numbered |
---|
| 182 | 2.4.0. But they've not really been released as such. We require |
---|
| 183 | and expect the final version here. */ |
---|
| 184 | #ifdef __hppa__ |
---|
| 185 | # define __ASSUME_32BITUIDS 1 |
---|
| 186 | # define __ASSUME_TRUNCATE64_SYSCALL 1 |
---|
| 187 | # define __ASSUME_MMAP2_SYSCALL 1 |
---|
| 188 | # define __ASSUME_STAT64_SYSCALL 1 |
---|
| 189 | # define __ASSUME_IPC64 1 |
---|
| 190 | # define __ASSUME_ST_INO_64_BIT 1 |
---|
| 191 | # define __ASSUME_FCNTL64 1 |
---|
| 192 | # define __ASSUME_GETDENTS64_SYSCALL 1 |
---|
| 193 | #endif |
---|