2 # Consistency checks for the system call list
3 # Copyright (C) 2017-2023 Free Software Foundation, Inc.
4 # This file is part of the GNU C Library.
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.
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.
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 # <https://www.gnu.org/licenses/>.
25 echo "error: wrong number of arguments: $#"
34 linux_version
="$("$GAWK" \
35 '/#define LINUX_VERSION_CODE / {print $3}' < "$macros")"
36 glibc_linux_version
="$("$GAWK" \
37 '/#define __GLIBC_LINUX_VERSION_CODE / {print $3}' < "$macros")"
39 echo "info: LINUX_VERSION_CODE: $linux_version"
40 echo "info: __GLIBC_LINUX_VERSION_CODE: $glibc_linux_version"
41 # Ignore the subrelease in the comparison.
42 if test $
(expr "$glibc_linux_version" / 256) \
43 -lt $
(expr "$linux_version" / 256); then
44 echo "info: The kernel major/minor version is newer than the glibc version"
53 # Use getpid as a system call which is expected to be always defined.
54 # alpha uses getxpid instead, so it is permitted as an alternative.
55 if ! grep -E -q '^getx?pid$' -- "$list_nr"; then
56 echo "error: __NR_getpid not defined"
59 if ! grep -E -q '^getx?pid$' -- "$list_sys"; then
60 echo "error: SYS_getpid not defined"
66 comm_result
="$(mktemp)"
68 rm -f -- "$comm_1" "$comm_2" "$comm_result"
72 sort -o "$comm_1" -- "$list_nr"
73 sort -o "$comm_2" -- "$list_sys"
75 # Check for missing SYS_* macros.
76 comm --check-order -2 -3 -- "$comm_1" "$comm_2" > "$comm_result"
77 if test -s "$comm_result"; then
78 echo "error: These system calls need to be added to syscall-names.list:"
80 # This is only an error if our version is older than the kernel
81 # version because we cannot predict future kernel development.
82 if $kernel_newer; then
84 echo "warning: This error has been ignored because the glibc"
85 echo "warning: system call list is older than the kernel version."
91 # Check for additional SYS_* macros.
92 comm --check-order -1 -3 -- "$comm_1" "$comm_2" > "$comm_result"
93 if test -s "$comm_result"; then
94 echo "error: The following system calls have unexpected SYS_* macros:"