strace/tests/ksysent.sed
Dmitry V. Levin bab4ef4272 tests: add ksysent.test
Check that syscall names and numbers defined in syscallent files
match kernel __NR_* constants defined by <asm/unistd.h>.

Tested on various platforms, including the following combinations
of architectures and kernel headers:

x86_64: 4.4-rc, 4.3, 4.2, 4.1, 3.19, 3.17, 3.16, 3.12, 3.11,
3.10-rhel, 2.6.32-rhel, 2.6.27-sle, 2.6.18-rhel
i386: 4.4-rc, 4.3, 4.2, 4.1, 3.19, 3.17, 3.16, 3.11,
3.10-rhel, 2.6.32-rhel, 2.6.27-sle, 2.6.18-rhel
aarch64: 4.4-rc
alpha: 4.3
arm eabi: 4.4-rc, 4.2, 4.1
hppa: 3.18
ia64: 3.18
mips o32: 4.1
ppc: 3.18
ppc64: 3.10-rhel, 2.6.32-rhel
s390: 3.18
s390x: 3.18
sparc: 4.1
sparc: 3.18
x32: 3.19

The only platform which is known at this moment to fail the test
is CentOS-5 provided by OBS.  On x86_64 instance it fails with
error: "prlimit64" syscall #300 is "fanotify_init" in syscallent.h
and on i586 it similarly fails with
error: "prlimit64" syscall #338 is "fanotify_init" in syscallent.h
So this is a real platform bug that is not likely to be worked around
on the strace side.

* tests/ksysent.c: New file.
* tests/ksysent.sed: Likewise.
* tests/ksysent.test: New test.
* tests/Makefile.am (AM_CPPFLAGS): Add -I$(builddir).
(check_PROGRAMS): Add ksysent.
(TESTS): Add ksysent.test.
(EXTRA_DIST): Add ksysent.sed.
(ksysent.h): New rule.
(BUILT_SOURCES, CLEANFILES): Add ksysent.h.
* tests/.gitignore: Add ksysent.
2015-12-10 02:06:25 +00:00

16 lines
516 B
Sed

#!/bin/sed -nf
# should not have been exported at all
/#define[[:space:]]\+__NR_\(sys_epoll_\|arch_specific_syscall\|syscalls\|syscall_count\|syscall_max\|available\|reserved\|unused\)/d
# should not be named this way
s/__NR_\(arm\|xtensa\)_fadvise64_64/__NR_fadvise64_64/
# legacy names
s/__NR_get_cpu/__NR_getcpu/
s/__NR_madvise1/__NR_madvise/
s/__NR_paccept/__NR_accept4/
# generate
s/#define[[:space:]]\+__NR_\([a-z_][^[:space:]]\+\)\([[:space:]].*\)\?$/#ifdef __NR_\1\n[__NR_\1 \& 0xffff] = "\1",\n#endif/p