Fix mapping for <bits/syscall.h>

SYS_xxx macros, which are implemented in glibc in
<bits/syscall.h>, are intended to be included from
<sys/syscall.h>.  See syscall(2), amd also see the following:

$ grepc -k 'SYS_[a-z]\w+' /usr/include | head
/usr/include/x86_64-linux-gnu/bits/syscall.h:35:# define SYS_accept __NR_accept
/usr/include/x86_64-linux-gnu/bits/syscall.h:39:# define SYS_accept4 __NR_accept4
/usr/include/x86_64-linux-gnu/bits/syscall.h:43:# define SYS_access __NR_access
/usr/include/x86_64-linux-gnu/bits/syscall.h:47:# define SYS_acct __NR_acct
/usr/include/x86_64-linux-gnu/bits/syscall.h:51:# define SYS_acl_get __NR_acl_get
/usr/include/x86_64-linux-gnu/bits/syscall.h:55:# define SYS_acl_set __NR_acl_set
/usr/include/x86_64-linux-gnu/bits/syscall.h:59:# define SYS_add_key __NR_add_key
/usr/include/x86_64-linux-gnu/bits/syscall.h:63:# define SYS_adjtimex __NR_adjtimex
/usr/include/x86_64-linux-gnu/bits/syscall.h:67:# define SYS_afs_syscall __NR_afs_syscall
/usr/include/x86_64-linux-gnu/bits/syscall.h:71:# define SYS_alarm __NR_alarm
$ grep -rn bits/syscall.h /usr/include
/usr/include/x86_64-linux-gnu/bits/syscall.h:5:# error "Never use <bits/syscall.h> directly; include <sys/syscall.h> instead."
/usr/include/x86_64-linux-gnu/sys/syscall.h:27:   programs expect the traditional form SYS_*.  <bits/syscall.h>
/usr/include/x86_64-linux-gnu/sys/syscall.h:29:#include <bits/syscall.h>

I removed duplicate mappings, and also removed the mapping for
<syscall.h>, which is an undocumented feature of glibc.  Portable
programs should stick to <sys/syscall.h> (and unportable ones
too, since there's no gain apart from those 4 bytes).

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
This commit is contained in:
Alejandro Colomar 2022-08-01 17:12:20 +02:00 committed by Kim Gräsman
parent 4ad1d428ff
commit 75623bce3b
2 changed files with 4 additions and 8 deletions

View File

@ -91,7 +91,7 @@
{ include: [ "<bits/string3.h>", private, "<string.h>", public ] },
{ include: [ "<bits/stropts.h>", private, "<stropts.h>", public ] },
{ include: [ "<bits/sys_errlist.h>", private, "<stdio.h>", public ] },
{ include: [ "<bits/syscall.h>", private, "<sys/syscall.h>", private ] },
{ include: [ "<bits/syscall.h>", private, "<sys/syscall.h>", public ] },
{ include: [ "<bits/sysctl.h>", private, "<sys/sysctl.h>", public ] },
{ include: [ "<bits/syslog-ldbl.h>", private, "<sys/syslog.h>", private ] },
{ include: [ "<bits/syslog-path.h>", private, "<sys/syslog.h>", private ] },
@ -169,7 +169,6 @@
{ include: [ "<bits/string.h>", private, "<string.h>", public ] },
{ include: [ "<bits/string2.h>", private, "<string.h>", public ] },
{ include: [ "<bits/string3.h>", private, "<string.h>", public ] },
{ include: [ "<bits/syscall.h>", private, "<sys/syscall.h>", private ] },
{ include: [ "<bits/timerfd.h>", private, "<sys/timerfd.h>", public ] },
{ include: [ "<bits/typesizes.h>", private, "<sys/types.h>", public ] },
# Top-level #includes that just forward to another file:
@ -180,7 +179,6 @@
# to decide which of the two files is canonical. If neither is
# on the POSIX.1 1998 list, I just choose the top-level one.
{ include: [ "<sys/poll.h>", private, "<poll.h>", public ] },
{ include: [ "<sys/syscall.h>", private, "<syscall.h>", public ] },
{ include: [ "<sys/syslog.h>", private, "<syslog.h>", public ] },
{ include: [ "<sys/ustat.h>", private, "<ustat.h>", public ] },
{ include: [ "<wait.h>", private, "<sys/wait.h>", public ] },
@ -202,7 +200,7 @@
{ include: [ "<asm/errno.h>", private, "<errno.h>", public ] },
{ include: [ "<asm/errno-base.h>", private, "<errno.h>", public ] },
{ include: [ "<asm/ptrace-abi.h>", private, "<asm/ptrace.h>", public ] },
{ include: [ "<asm/unistd.h>", private, "<syscall.h>", public ] },
{ include: [ "<asm/unistd.h>", private, "<sys/syscall.h>", public ] },
{ include: [ "<linux/limits.h>", private, "<limits.h>", public ] }, # PATH_MAX
{ include: [ "<linux/prctl.h>", private, "<sys/prctl.h>", public ] },
{ include: [ "<sys/ucontext.h>", private, "<ucontext.h>", public ] },

View File

@ -460,7 +460,7 @@ const IncludeMapEntry libc_include_map[] = {
{ "<bits/string3.h>", kPrivate, "<string.h>", kPublic },
{ "<bits/stropts.h>", kPrivate, "<stropts.h>", kPublic },
{ "<bits/sys_errlist.h>", kPrivate, "<stdio.h>", kPublic },
{ "<bits/syscall.h>", kPrivate, "<sys/syscall.h>", kPrivate },
{ "<bits/syscall.h>", kPrivate, "<sys/syscall.h>", kPublic },
{ "<bits/sysctl.h>", kPrivate, "<sys/sysctl.h>", kPublic },
{ "<bits/syslog-ldbl.h>", kPrivate, "<sys/syslog.h>", kPrivate },
{ "<bits/syslog-path.h>", kPrivate, "<sys/syslog.h>", kPrivate },
@ -538,7 +538,6 @@ const IncludeMapEntry libc_include_map[] = {
{ "<bits/string.h>", kPrivate, "<string.h>", kPublic },
{ "<bits/string2.h>", kPrivate, "<string.h>", kPublic },
{ "<bits/string3.h>", kPrivate, "<string.h>", kPublic },
{ "<bits/syscall.h>", kPrivate, "<sys/syscall.h>", kPrivate },
{ "<bits/timerfd.h>", kPrivate, "<sys/timerfd.h>", kPublic },
{ "<bits/typesizes.h>", kPrivate, "<sys/types.h>", kPublic },
// Top-level #includes that just forward to another file:
@ -549,7 +548,6 @@ const IncludeMapEntry libc_include_map[] = {
// to decide which of the two files is canonical. If neither is
// on the POSIX.1 1998 list, I just choose the top-level one.
{ "<sys/poll.h>", kPrivate, "<poll.h>", kPublic },
{ "<sys/syscall.h>", kPrivate, "<syscall.h>", kPublic },
{ "<sys/syslog.h>", kPrivate, "<syslog.h>", kPublic },
{ "<sys/ustat.h>", kPrivate, "<ustat.h>", kPublic },
{ "<wait.h>", kPrivate, "<sys/wait.h>", kPublic },
@ -571,7 +569,7 @@ const IncludeMapEntry libc_include_map[] = {
{ "<asm/errno.h>", kPrivate, "<errno.h>", kPublic },
{ "<asm/errno-base.h>", kPrivate, "<errno.h>", kPublic },
{ "<asm/ptrace-abi.h>", kPrivate, "<asm/ptrace.h>", kPublic },
{ "<asm/unistd.h>", kPrivate, "<syscall.h>", kPublic },
{ "<asm/unistd.h>", kPrivate, "<sys/syscall.h>", kPublic },
{ "<linux/limits.h>", kPrivate, "<limits.h>", kPublic }, // PATH_MAX
{ "<linux/prctl.h>", kPrivate, "<sys/prctl.h>", kPublic },
{ "<sys/ucontext.h>", kPrivate, "<ucontext.h>", kPublic },