diff options
author | Mattias Andrée <maandree@kth.se> | 2023-12-03 19:23:35 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2023-12-03 19:23:35 +0100 |
commit | c131f122778c62f920a99bbf854ced4a37ee8b03 (patch) | |
tree | 14c933f98f4d64dffb0a594bc40dd5121c6c5a8e /linux | |
download | libsyscalls-c131f122778c62f920a99bbf854ced4a37ee8b03.tar.gz libsyscalls-c131f122778c62f920a99bbf854ced4a37ee8b03.tar.bz2 libsyscalls-c131f122778c62f920a99bbf854ced4a37ee8b03.tar.xz |
First commit
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'linux')
-rw-r--r-- | linux/download.mk | 33 | ||||
-rw-r--r-- | linux/errors.c | 130 | ||||
-rw-r--r-- | linux/errors.mk | 52 | ||||
-rw-r--r-- | linux/linux-support.mk | 54 | ||||
-rw-r--r-- | linux/no.mk | 0 | ||||
-rw-r--r-- | linux/signals.c | 130 | ||||
-rw-r--r-- | linux/signals.mk | 138 | ||||
-rw-r--r-- | linux/symbols.c | 321 | ||||
-rw-r--r-- | linux/symbols.mk | 73 | ||||
-rw-r--r-- | linux/syscall-table.c | 58 | ||||
-rw-r--r-- | linux/syscall-table.mk | 60 | ||||
-rw-r--r-- | linux/syscalls.h | 988 | ||||
-rw-r--r-- | linux/syscalls.mk | 450 | ||||
-rw-r--r-- | linux/types.c | 54 | ||||
-rw-r--r-- | linux/types.mk | 2 | ||||
-rwxr-xr-x | linux/what-architecture-am-i-using | 26 | ||||
l--------- | linux/yes.mk | 1 |
17 files changed, 2570 insertions, 0 deletions
diff --git a/linux/download.mk b/linux/download.mk new file mode 100644 index 0000000..31da0b1 --- /dev/null +++ b/linux/download.mk @@ -0,0 +1,33 @@ +LINUX_MIRROR = https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/snapshot +LINUX_TAREXT = tar.gz +LINUX_TARBALL = $(LINUX_MIRROR)/linux-$(LINUX_VERSION).$(LINUX_TAREXT) +LINUX_UNPACK = (gunzip | tar -x) + +LINUX_DIR = linux-src/linux-$(LINUX_VERSION) +LINUX_SOURCE = $(LINUX_DIR)/README + + +SILENCE_LINUX_SOURCE_IF_EXISTS != test ! -f "$(LINUX_SOURCE)" || printf '@' +SILENCE_LINUX_TARBALL_IF_EXISTS != test ! -f "$(LINUX_DIR).$(LINUX_TAREXT)" || printf '@' + +$(LINUX_SOURCE): $(LINUX_DIR).$(LINUX_TAREXT) + $(SILENCE_LINUX_SOURCE_IF_EXISTS)if test ! -f "$@"; then \ + (cd -- linux-src && $(LINUX_UNPACK)) < $(LINUX_DIR).$(LINUX_TAREXT) && \ + (test -d $(LINUX_DIR) || \ + mv -- linux-src/linux-v$(LINUX_VERSION) $(LINUX_DIR) || \ + mv -- linux-src/$(LINUX_VERSION) $(LINUX_DIR) || \ + mv -- linux-src/v$(LINUX_VERSION) $(LINUX_DIR) \ + ) && \ + touch -- "$@"; \ + fi + +$(LINUX_DIR).$(LINUX_TAREXT): + $(SILENCE_LINUX_TARBALL_IF_EXISTS)mkdir -p -- linux-src + $(SILENCE_LINUX_TARBALL_IF_EXISTS)test -f "$@" || $(DOWNLOAD) $(LINUX_TARBALL) > "$@" || (rm -f -- "$@"; false) + + +download-linux: $(LINUX_DIR).$(LINUX_TAREXT) +download: download-linux + + +.PHONY: download-linux diff --git a/linux/errors.c b/linux/errors.c new file mode 100644 index 0000000..d8a0e7f --- /dev/null +++ b/linux/errors.c @@ -0,0 +1,130 @@ +/* See LICENSE file for copyright and license details. */ + +/* This file is included from ../libsyscalls_get_syscall_errors.c */ + + +#include "../generated/linux-errors.h" + +static enum libsyscalls_error +get_linux_syscall_errors(enum libsyscalls_arch arch, const struct libsyscalls_named_number **errs_out, size_t *nerrs_out) +{ +#define CASE(ARCH)\ + *errs_out = linux_errors_for_##ARCH;\ + *nerrs_out = sizeof(linux_errors_for_##ARCH) / sizeof(*linux_errors_for_##ARCH);\ + goto out + + switch ((int)arch) { + case LIBSYSCALLS_ARCH_ALPHA: +#ifdef LIST_LINUX_ERRORS_FOR_ALPHA + CASE(alpha); +#else + break; +#endif + + case LIBSYSCALLS_ARCH_AMD64: + case LIBSYSCALLS_ARCH_AMD64_X32: + case LIBSYSCALLS_ARCH_I386: +#ifdef LIST_LINUX_ERRORS_FOR_X86 + CASE(x86); +#else + break; +#endif + + case LIBSYSCALLS_ARCH_ARM_OABI: + case LIBSYSCALLS_ARCH_ARM_EABI: +#ifdef LIST_LINUX_ERRORS_FOR_ARM + CASE(arm); +#else + break; +#endif + + case LIBSYSCALLS_ARCH_IA64: +#ifdef LIST_LINUX_ERRORS_FOR_IA64 + CASE(ia64); +#else + break; +#endif + + case LIBSYSCALLS_ARCH_M68K: +#ifdef LIST_LINUX_ERRORS_FOR_M68K + CASE(m68k); +#else + break; +#endif + + case LIBSYSCALLS_ARCH_MICROBLAZE: +#ifdef LIST_LINUX_ERRORS_FOR_MICROBLAZE + CASE(microblaze); +#else + break; +#endif + + case LIBSYSCALLS_ARCH_MIPS_O32: + case LIBSYSCALLS_ARCH_MIPS_N32: + case LIBSYSCALLS_ARCH_MIPS_N64: +#ifdef LIST_LINUX_ERRORS_FOR_MIPS + CASE(mips); +#else + break; +#endif + + case LIBSYSCALLS_ARCH_PARISC_32: + case LIBSYSCALLS_ARCH_PARISC_64: +#ifdef LIST_LINUX_ERRORS_FOR_PARISC + CASE(parisc); +#else + break; +#endif + + case LIBSYSCALLS_ARCH_POWERPC_32: + case LIBSYSCALLS_ARCH_POWERPC_64: + case LIBSYSCALLS_ARCH_POWERPC_NOSPU: + case LIBSYSCALLS_ARCH_POWERPC_SPU: +#ifdef LIST_LINUX_ERRORS_FOR_POWERPC + CASE(powerpc); +#else + break; +#endif + + case LIBSYSCALLS_ARCH_S390_32: + case LIBSYSCALLS_ARCH_S390_64: +#ifdef LIST_LINUX_ERRORS_FOR_S390 + CASE(s390); +#else + break; +#endif + + case LIBSYSCALLS_ARCH_SH: +#ifdef LIST_LINUX_ERRORS_FOR_SH + CASE(sh); +#else + break; +#endif + + case LIBSYSCALLS_ARCH_SPARC_32: + case LIBSYSCALLS_ARCH_SPARC_64: +#ifdef LIST_LINUX_ERRORS_FOR_SPARC + CASE(sparc); +#else + break; +#endif + + case LIBSYSCALLS_ARCH_XTENSA: +#ifdef LIST_LINUX_ERRORS_FOR_XTENSA + CASE(xtensa); +#else + break; +#endif + + default: + return LIBSYSCALLS_E_ARCHNOSUP; + } + + *errs_out = linux_errors_for_generic; + *nerrs_out = sizeof(linux_errors_for_generic) / sizeof(*linux_errors_for_generic); + +out: + return LIBSYSCALLS_E_OK; + +#undef CASE +} diff --git a/linux/errors.mk b/linux/errors.mk new file mode 100644 index 0000000..b6b7197 --- /dev/null +++ b/linux/errors.mk @@ -0,0 +1,52 @@ +libsyscalls_get_syscall_errors.o: generated/linux-errors.h linux/errors.c +libsyscalls_get_syscall_errors.lo: generated/linux-errors.h linux/errors.c + +generated/linux-errors.tbl: $(LINUX_SOURCE) linux/errors.mk + mkdir -p -- generated + set -e; ( \ + get_gcc_or_clang () { \ + ( \ + ( \ + IFS=:; \ + for dir in $$PATH; do \ + if test ! -d "$$dir"; then continue; fi; \ + for file in "$$dir"/*; do \ + if test ! -x "$$file"; then continue; fi; \ + printf '%s\n' "$$file"; \ + done \ + done \ + ) | grep '/\(gcc\|clang\)\(-[0-9.]\+\)\?$$'; \ + printf '%s\n' gcc; \ + ) | sed 1q; \ + }; \ + extract="$$(get_gcc_or_clang) -E -dM"; \ + toolsdir="linux-src/linux-$(LINUX_VERSION)/tools"; \ + process_arch() \ + { \ + ($$extract "-I$$toolsdir/include/uapi" "$$2" && \ + cat -- "linux-src/linux-$(LINUX_VERSION)/include/linux/errno.h") \ + | sed -n 's/^\s*\x23\s*define\s\+\(E[^\s]\+\)\s\+\([0-9]\+\)\s*\(\/.*\)\?$$/'"$$1"' \2 \1/p' \ + | sort -k 2 -nu; \ + }; \ + for arch in $$(printf '%s\n' "$$toolsdir/arch"/*/ | sed 's:^.*/\([^/]*\)/$$:\1:'); do \ + if test -f "$$toolsdir/arch/$$arch/include/uapi/asm/errno.h"; then \ + process_arch "$$arch" "$$toolsdir/arch/$$arch/include/uapi/asm/errno.h"; \ + fi; \ + done; \ + process_arch generic "$$toolsdir/include/uapi/asm-generic/errno.h"; \ + ) > $@ + +generated/linux-errors.h: generated/linux-errors.tbl linux/errors.mk + set -e; \ + for arch in $$(cut -d ' ' -f 1 < generated/linux-errors.tbl | uniq); do \ + ARCH="$$(printf '%s\n' "$$arch" | tr '[a-z]' '[A-Z]')"; \ + printf '#define LIST_LINUX_ERRORS_FOR_%s(X, D)\\\n' "$$ARCH"; \ + sed -n 's/^'"$$arch"' \([0-9]\+\) \(.*\)$$/\tX(\1, "\2") D\\/p' \ + < generated/linux-errors.tbl \ + | sed '$$s/ D\\//'; \ + printf 'static struct libsyscalls_named_number linux_errors_for_%s[] = {\n' "$$arch"; \ + printf '#define X(NR, NAME) {.number.s = NR, .name = NAME}\n'; \ + printf '\tLIST_LINUX_ERRORS_FOR_%s(X, COMMA)\n' "$$ARCH"; \ + printf '#undef X\n'; \ + printf '};\n'; \ + done > $@ diff --git a/linux/linux-support.mk b/linux/linux-support.mk new file mode 100644 index 0000000..5efeafe --- /dev/null +++ b/linux/linux-support.mk @@ -0,0 +1,54 @@ +LINUX_VERSION = 6.6 +# Changing this number can potentially break the build, +# silently or violently, so make sure everything still +# works afterwards + +SUPPORTED_LINUX_ARCHES =\ + ALPHA\ + AMD64\ + AMD64_X32\ + ARM_OABI\ + ARM_EABI\ + IA64\ + M68K\ + MICROBLAZE\ + MIPS_O32\ + MIPS_N32\ + MIPS_N64\ + PARISC_32\ + PARISC_64\ + POWERPC_32\ + POWERPC_64\ + POWERPC_NOSPU\ + POWERPC_SPU\ + S390_32\ + S390_64\ + SH\ + SPARC_32\ + SPARC_64\ + I386\ + XTENSA + +OPERATING_SYSTEMS += linux +NPARAMS += 8 + + +SUPPORTED_LINUX_ARCHES != printf '%s\n' $(SUPPORTED_LINUX_ARCHES) $(SUPPORTED_ARCHES) | sort | uniq -d + + +include linux/download.mk +include linux/errors.mk +include linux/signals.mk +include linux/syscalls.mk +include linux/syscall-table.mk +include linux/symbols.mk +include linux/types.mk + + +HDR += generated/linux-arches.h + +generated/linux-arches.h: linux/linux-support.mk + mkdir -p -- generated + (printf '\43define LIST_LINUX_ARCHES(X, D)\\\n' && \ + printf '\tX(%s) D\\\n' $(SUPPORTED_LINUX_ARCHES); \ + ) | sed '$$s/ D\\//' > $@ diff --git a/linux/no.mk b/linux/no.mk new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/linux/no.mk diff --git a/linux/signals.c b/linux/signals.c new file mode 100644 index 0000000..7d7f868 --- /dev/null +++ b/linux/signals.c @@ -0,0 +1,130 @@ +/* See LICENSE file for copyright and license details. */ + +/* This file is included from ../libsyscalls_get_signals.c */ + + +#include "../generated/linux-signals.h" + +static enum libsyscalls_error +get_linux_signals(enum libsyscalls_arch arch, const struct libsyscalls_named_number **sigs_out, size_t *nsigs_out) +{ +#define CASE(ARCH)\ + *sigs_out = linux_signals_for_##ARCH;\ + *nsigs_out = sizeof(linux_signals_for_##ARCH) / sizeof(*linux_signals_for_##ARCH);\ + goto out + + switch ((int)arch) { + case LIBSYSCALLS_ARCH_ALPHA: +#ifdef LIST_LINUX_SIGNALS_FOR_ALPHA + CASE(alpha); +#else + break; +#endif + + case LIBSYSCALLS_ARCH_AMD64: + case LIBSYSCALLS_ARCH_AMD64_X32: + case LIBSYSCALLS_ARCH_I386: +#ifdef LIST_LINUX_SIGNALS_FOR_X86 + CASE(x86); +#else + break; +#endif + + case LIBSYSCALLS_ARCH_ARM_OABI: + case LIBSYSCALLS_ARCH_ARM_EABI: +#ifdef LIST_LINUX_SIGNALS_FOR_ARM + CASE(arm); +#else + break; +#endif + + case LIBSYSCALLS_ARCH_IA64: +#ifdef LIST_LINUX_SIGNALS_FOR_IA64 + CASE(ia64); +#else + break; +#endif + + case LIBSYSCALLS_ARCH_M68K: +#ifdef LIST_LINUX_SIGNALS_FOR_M68K + CASE(m68k); +#else + break; +#endif + + case LIBSYSCALLS_ARCH_MICROBLAZE: +#ifdef LIST_LINUX_SIGNALS_FOR_MICROBLAZE + CASE(microblaze); +#else + break; +#endif + + case LIBSYSCALLS_ARCH_MIPS_O32: + case LIBSYSCALLS_ARCH_MIPS_N32: + case LIBSYSCALLS_ARCH_MIPS_N64: +#ifdef LIST_LINUX_SIGNALS_FOR_MIPS + CASE(mips); +#else + break; +#endif + + case LIBSYSCALLS_ARCH_PARISC_32: + case LIBSYSCALLS_ARCH_PARISC_64: +#ifdef LIST_LINUX_SIGNALS_FOR_PARISC + CASE(parisc); +#else + break; +#endif + + case LIBSYSCALLS_ARCH_POWERPC_32: + case LIBSYSCALLS_ARCH_POWERPC_64: + case LIBSYSCALLS_ARCH_POWERPC_NOSPU: + case LIBSYSCALLS_ARCH_POWERPC_SPU: +#ifdef LIST_LINUX_SIGNALS_FOR_POWERPC + CASE(powerpc); +#else + break; +#endif + + case LIBSYSCALLS_ARCH_S390_32: + case LIBSYSCALLS_ARCH_S390_64: +#ifdef LIST_LINUX_SIGNALS_FOR_S390 + CASE(s390); +#else + break; +#endif + + case LIBSYSCALLS_ARCH_SH: +#ifdef LIST_LINUX_SIGNALS_FOR_SH + CASE(sh); +#else + break; +#endif + + case LIBSYSCALLS_ARCH_SPARC_32: + case LIBSYSCALLS_ARCH_SPARC_64: +#ifdef LIST_LINUX_SIGNALS_FOR_SPARC + CASE(sparc); +#else + break; +#endif + + case LIBSYSCALLS_ARCH_XTENSA: +#ifdef LIST_LINUX_SIGNALS_FOR_XTENSA + CASE(xtensa); +#else + break; +#endif + + default: + return LIBSYSCALLS_E_ARCHNOSUP; + } + + *sigs_out = linux_signals_for_generic; + *nsigs_out = sizeof(linux_signals_for_generic) / sizeof(*linux_signals_for_generic); + +out: + return LIBSYSCALLS_E_OK; + +#undef CASE +} diff --git a/linux/signals.mk b/linux/signals.mk new file mode 100644 index 0000000..f7a8a45 --- /dev/null +++ b/linux/signals.mk @@ -0,0 +1,138 @@ +libsyscalls_get_signals.o: generated/linux-signals.h linux/signals.c +libsyscalls_get_signals.lo: generated/linux-signals.h linux/signals.c + +generated/linux-signals.tbl: $(LINUX_SOURCE) linux/signals.mk + mkdir -p -- generated + set -e; ( \ + get_gcc_or_clang () { \ + ( \ + ( \ + IFS=:; \ + for dir in $$PATH; do \ + if test ! -d "$$dir"; then continue; fi; \ + for file in "$$dir"/*; do \ + if test ! -x "$$file"; then continue; fi; \ + printf '%s\n' "$$file"; \ + done \ + done \ + ) | grep '/\(gcc\|clang\)\(-[0-9.]\+\)\?$$'; \ + printf '%s\n' gcc; \ + ) | sed 1q; \ + }; \ + if test -n "$(CC_DEF_EXTRACT)"; then \ + c="$(CC_DEF_EXTRACT)"; \ + else \ + c="$(CC)"; \ + fi; \ + c="$$($$c --version 2>&1 | sed 1q | sed 's/^.*(\(.*\)).*$$/\1/' | tr '[A-Z]' '[a-z]' | cut -d ' ' -f 1)"; \ + if test ! "$$c" = gcc && test ! "$$c" = clang; then \ + c="$$(get_gcc_or_clang)"; \ + fi; \ + extract="$$c -E -dM -D__KERNEL__"; \ + srcdir="linux-src/linux-$(LINUX_VERSION)"; \ + mkdir -p -- "$$srcdir/tools/include/generated/"; \ + touch -- "$$srcdir/tools/include/generated/bounds.h"; \ + touch -- "$$srcdir/tools/include/generated/timeconst.h"; \ + process_arch () \ + { \ + set -e; \ + signals="$$( \ + $$extract "-I$$srcdir/tools/include" $$fixes "$$2" \ + | sed -n 's/^\s*\x23\s*define\s\+\(SIG[^\s]\+\)\s\+\([0-9]\+\)\s*\(\/.*\)\?$$/'"$$1"' \2 \1/p' \ + | grep -v ' SIG_' \ + | grep -v ' SIGSTKSZ' \ + | sort -k 2 -nu; \ + )"; \ + if test "$$1" = arm; then \ + signals="$$(printf "%s\n" "$$signals" | sed 's/\bSIGSWI\b/SIGRTMIN/')"; \ + fi; \ + printf "%s\n" "$$signals"; \ + sigrtmin="$$(printf "%s\n" "$$signals" | sed -n 's/^.* \([0-9]\+\) SIGRTMIN$$/\1/p')"; \ + maxnamed="$$(printf "%s\n" "$$signals" | sed -n '$$s/^.* \([0-9]\+\) .*$$/\1/p')"; \ + test "$$sigrtmin" = "$$maxnamed"; \ + maxsig=_NSIG; \ + depth=0; \ + while test -n "$$maxsig" && test -n "$$(printf '%s\n' "$$maxsig" | tr -d '[0-9]')" ; do \ + printf '%s: looking for %s\n' "$$1" "$$maxsig" >&2; \ + def="$$maxsig"; \ + maxsig="$$($$extract "-I$$srcdir/tools/include" $$fixes "$$2" \ + | sed -n 's/^\s*\x23\s*define\s\+'"$$def"'\s\+\([A-Z0-9_]\+\)\s*\(\/.*\)\?$$/\1/p')"; \ + if test -z "$$maxsig"; then \ + maxsig="$$($$extract "-I$$srcdir/tools/include" \ + "-I$$srcdir/arch/$$1/include" \ + "-I$$srcdir/include" \ + "-I$$srcdir" \ + $$fixes \ + "$$(printf '%s\n' "$$2" | sed 's:/uapi/:/:')" \ + | sed -n 's/^\s*\x23\s*define\s\+'"$$def"'\s\+\([A-Z0-9_]\+\)\s*\(\/.*\)\?$$/\1/p')"; \ + fi; \ + printf '%s: found %s\n' "$$1" "$$maxsig" >&2; \ + : $$(( depth++ )); \ + test $$(( depth )) -lt 1000; \ + done; \ + test -n "$$maxsig"; \ + i=1; \ + while (( sigrtmin + i <= maxsig )); do \ + printf '%s %d SIGRTMIN+%d\n' "$$1" $$(( sigrtmin + i )) $$i; \ + : $$(( i++ )); \ + done; \ + }; \ + getsigs () { \ + process_arch "$$@" | sed 's/\bSIGRTMIN\b/_&/'; \ + }; \ + for arch in $$(printf '%s\n' "$$srcdir/arch"/*/ | sed 's:^.*/\([^/]*\)/$$:\1:'); do \ + if test ! "$$arch" = s390 && test -f "$$srcdir/arch/$$arch/include/uapi/asm/signal.h"; then \ + getsigs "$$arch" "$$srcdir/arch/$$arch/include/uapi/asm/signal.h"; \ + fi; \ + done; \ + getsigs generic "$$srcdir/include/uapi/asm-generic/signal.h"; \ + ) > $@ + @printf '\033[1;32m%s\033[m\n' \ + 'Compiler warnings above are not of interest, they were generated during' \ + 'extraction of the Linux source code and are not part of this library' + @grep '^generic.*SIGRTMIN+.*' >/dev/null 2>/dev/null < $@ + grep '^generic ' < $@ | cut -d ' ' -f 2 > generated/linux-signals.generic.tbl + @# For most architectures the signal numbers are the same, + @# yet they have their own signal.h listing them, so to remove + @# duplication in the library, we removing duplicates after + @# validating that they have not diverged + grep '^arm ' < $@ | cut -d ' ' -f 2 | diff -u generated/linux-signals.generic.tbl - + sed '/^arm /d' < $@ > $@.tmp && mv -- $@.tmp $@ + grep '^arm64 ' < $@ | cut -d ' ' -f 2 | diff -u generated/linux-signals.generic.tbl - + sed '/^arm64 /d' < $@ > $@.tmp && mv -- $@.tmp $@ + grep '^hexagon ' < $@ | cut -d ' ' -f 2 | diff -u generated/linux-signals.generic.tbl - + sed '/^hexagon /d' < $@ > $@.tmp && mv -- $@.tmp $@ + grep '^loongarch ' < $@ | cut -d ' ' -f 2 | diff -u generated/linux-signals.generic.tbl - + sed '/^loongarch /d' < $@ > $@.tmp && mv -- $@.tmp $@ + grep '^arc ' < $@ | cut -d ' ' -f 2 | diff -u generated/linux-signals.generic.tbl - + sed '/^arc /d' < $@ > $@.tmp && mv -- $@.tmp $@ + grep '^nios2 ' < $@ | cut -d ' ' -f 2 | diff -u generated/linux-signals.generic.tbl - + sed '/^nios2 /d' < $@ > $@.tmp && mv -- $@.tmp $@ + grep '^ia64 ' < $@ | cut -d ' ' -f 2 | diff -u generated/linux-signals.generic.tbl - + sed '/^ia64 /d' < $@ > $@.tmp && mv -- $@.tmp $@ + grep '^m68k ' < $@ | cut -d ' ' -f 2 | diff -u generated/linux-signals.generic.tbl - + sed '/^m68k /d' < $@ > $@.tmp && mv -- $@.tmp $@ + grep '^powerpc ' < $@ | cut -d ' ' -f 2 | diff -u generated/linux-signals.generic.tbl - + sed '/^powerpc /d' < $@ > $@.tmp && mv -- $@.tmp $@ + grep '^sh ' < $@ | cut -d ' ' -f 2 | diff -u generated/linux-signals.generic.tbl - + sed '/^sh /d' < $@ > $@.tmp && mv -- $@.tmp $@ + grep '^x86 ' < $@ | cut -d ' ' -f 2 | diff -u generated/linux-signals.generic.tbl - + sed '/^x86 /d' < $@ > $@.tmp && mv -- $@.tmp $@ + grep '^xtensa ' < $@ | cut -d ' ' -f 2 | diff -u generated/linux-signals.generic.tbl - + sed '/^xtensa /d' < $@ > $@.tmp && mv -- $@.tmp $@ + rm -f -- generated/linux-signals.*.tbl + +generated/linux-signals.h: generated/linux-signals.tbl linux/signals.mk + set -e; \ + for arch in $$(cut -d ' ' -f 1 < generated/linux-signals.tbl | uniq); do \ + ARCH="$$(printf '%s\n' "$$arch" | tr '[a-z]' '[A-Z]')"; \ + printf '#define LIST_LINUX_SIGNALS_FOR_%s(X, D)\\\n' "$$ARCH"; \ + sed -n 's/^'"$$arch"' \([0-9]\+\) \(.*\)$$/\tX(\1, "\2") D\\/p' \ + < generated/linux-signals.tbl \ + | sed '$$s/ D\\//'; \ + printf 'static struct libsyscalls_named_number linux_signals_for_%s[] = {\n' "$$arch"; \ + printf '#define X(NR, NAME) {.number.s = NR, .name = NAME}\n'; \ + printf '\tLIST_LINUX_SIGNALS_FOR_%s(X, COMMA)\n' "$$ARCH"; \ + printf '#undef X\n'; \ + printf '};\n'; \ + done > $@ diff --git a/linux/symbols.c b/linux/symbols.c new file mode 100644 index 0000000..d91880f --- /dev/null +++ b/linux/symbols.c @@ -0,0 +1,321 @@ +/* See LICENSE file for copyright and license details. */ + +/* This file is included from ../libsyscalls_get_syscall_display_info.c */ + +/* TODO (see syscalls.h) */ +#define extract_linux_symbol_madvise extract_linux_symbol_noflags +#define extract_linux_symbol_msync extract_linux_symbol_noflags +#define extract_linux_symbol_mlock extract_linux_symbol_noflags +#define extract_linux_symbol_mcl extract_linux_symbol_noflags +#define extract_linux_symbol_epoll extract_linux_symbol_noflags +#define extract_linux_symbol_sock_fd extract_linux_symbol_noflags +#define extract_linux_symbol_dup3 extract_linux_symbol_noflags +#define extract_linux_symbol_pipe extract_linux_symbol_noflags +#define extract_linux_symbol_inotify_fd extract_linux_symbol_noflags +#define extract_linux_symbol_fan_event_f extract_linux_symbol_noflags +#define extract_linux_symbol_mq_open extract_linux_symbol_noflags +#define extract_linux_symbol_swapon extract_linux_symbol_noflags +#define extract_linux_symbol_inotify_mask extract_linux_symbol_noflags +#define extract_linux_symbol_shmget extract_linux_symbol_noflags +#define extract_linux_symbol_fan_class extract_linux_symbol_noflags +#define extract_linux_symbol_fan_mark extract_linux_symbol_noflags +#define extract_linux_symbol_fan extract_linux_symbol_noflags +#define extract_linux_symbol_socket extract_linux_symbol_noflags +#define extract_linux_symbol_reboot extract_linux_symbol_noflags + + +static const char * +extract_linux_symbol_signal(struct libsyscalls_symbol_printer_data *data, unsigned long long int *valuep, char *fallback_out) +{ + return extract_signal(LIBSYSCALLS_OS_LINUX, data->arch, valuep, fallback_out, + 0 /* doesn't matter, unsigned is probably faster */); +} + + +static const char * +extract_linux_symbol_mode(struct libsyscalls_symbol_printer_data *data, unsigned long long int *valuep, char *fallback_out) +{ + unsigned long long int value; + size_t i; + *fallback_out = 'o'; + *valuep ^= value = *valuep & 07777ULL; + i = 0; + data->buf[i++] = '0'; + if (value & 07000) goto digits4; + if (value & 0700) goto digits3; + if (value & 070) goto digits2; + if (value & 07) goto digits1; + if (0) { + digits4: + data->buf[i++] = '0' | (value & 07000); + digits3: + data->buf[i++] = '0' | (value & 0700); + digits2: + data->buf[i++] = '0' | (value & 070); + digits1: + data->buf[i++] = '0' | (value & 07); + } + data->buf[i++] = ' '; + data->buf[i++] = '('; + data->buf[i++] = (value & 0400) ? 'r' : '-'; + data->buf[i++] = (value & 0200) ? 'w' : '-'; + if (value & 04000) + data->buf[i++] = (value & 0100) ? 's' : 'S'; + else + data->buf[i++] = (value & 0100) ? 'x' : '-'; + data->buf[i++] = (value & 040) ? 'r' : '-'; + data->buf[i++] = (value & 020) ? 'w' : '-'; + if (value & 02000) + data->buf[i++] = (value & 010) ? 's' : 'S'; + else + data->buf[i++] = (value & 010) ? 'x' : '-'; + data->buf[i++] = (value & 04) ? 'r' : '-'; + data->buf[i++] = (value & 02) ? 'w' : '-'; + if (value & 01000) + data->buf[i++] = (value & 01) ? 't' : 'T'; + else + data->buf[i++] = (value & 01) ? 'x' : '-'; + data->buf[i++] = ')'; + data->buf[i] = '\0'; + return data->buf; +} + + +static const char * +extract_linux_symbol_umask(struct libsyscalls_symbol_printer_data *data, unsigned long long int *valuep, char *fallback_out) +{ + unsigned long long int value; + size_t i; + *fallback_out = 'o'; + *valuep ^= value = *valuep & 0777ULL; + i = 0; + data->buf[i++] = '0'; + if (value & 0700) goto digits3; + if (value & 070) goto digits2; + if (value & 07) goto digits1; + if (0) { + digits3: + data->buf[i++] = '0' | (value & 0700); + digits2: + data->buf[i++] = '0' | (value & 070); + digits1: + data->buf[i++] = '0' | (value & 07); + } + data->buf[i++] = ' '; + data->buf[i++] = '('; + data->buf[i++] = 'u'; + data->buf[i++] = ':'; + data->buf[i++] = ':'; + data->buf[i++] = (value & 0400) ? '-' : 'r'; + data->buf[i++] = (value & 0200) ? '-' : 'w'; + data->buf[i++] = (value & 0100) ? '-' : 'x'; + data->buf[i++] = ','; + data->buf[i++] = 'g'; + data->buf[i++] = ':'; + data->buf[i++] = ':'; + data->buf[i++] = (value & 040) ? '-' : 'r'; + data->buf[i++] = (value & 020) ? '-' : 'w'; + data->buf[i++] = (value & 010) ? '-' : 'x'; + data->buf[i++] = ','; + data->buf[i++] = 'o'; + data->buf[i++] = ':'; + data->buf[i++] = ':'; + data->buf[i++] = (value & 04) ? '-' : 'r'; + data->buf[i++] = (value & 02) ? '-' : 'w'; + data->buf[i++] = (value & 01) ? '-' : 'x'; + data->buf[i++] = ')'; + data->buf[i] = '\0'; + return data->buf; +} + + +static const char * +extract_linux_symbol_dev(struct libsyscalls_symbol_printer_data *data, unsigned long long int *valuep, char *fallback_out) +{ + unsigned long long int value; + unsigned long long int major, major1, major2; + unsigned long long int minor, minor1, minor2; + + *fallback_out = 'x'; + + major1 = 0xFFFFF00000000000ULL; + minor1 = 0x00000FFFFFF00000ULL; + major2 = 0x00000000000FFF00ULL; + minor2 = 0x00000000000000FFULL; + + *valuep ^= value = *valuep & (major1 | minor1 | major2 | minor2); + + major1 = (value & major1) / LOWEST_BIT(major1) * POST_HIGHEST_OF_CONSECUTIVELY_BITS(major2); + major2 = (value & major2) / LOWEST_BIT(major2); + + minor1 = (value & minor1) / LOWEST_BIT(minor1) * POST_HIGHEST_OF_CONSECUTIVELY_BITS(minor2); + minor2 = (value & minor2) / LOWEST_BIT(minor2); + + major = major1 | major2; + minor = minor1 | minor1; + + sprintf(data->buf, "%llu (%llu:%llu)", value, major, minor); + return data->buf; +} + + +static const char * +extract_linux_symbol_clockid_t(struct libsyscalls_symbol_printer_data *data, unsigned long long int *valuep, char *fallback_out) +{ + if (*valuep >= 0) + return NULL; + else if ((*valuep & 7) == 2) + sprintf(data->buf, "%lli (pid: %llu)", (long long int)*valuep, ~*valuep / 8); + else if ((*valuep & 7) == 3) + sprintf(data->buf, "%lli (fd: %llu)", (long long int)*valuep, ~*valuep / 8); + else if ((*valuep & 7) == 6) + sprintf(data->buf, "%lli (tid: %llu)", (long long int)*valuep, ~*valuep / 8); + else + sprintf(data->buf, "%lli (~%llu*8 + %u)", (long long int)*valuep, ~*valuep / 8, *valuep & 7); + *valuep = 0; + return data->buf; +} + + +#define SYMBOL_PRINTERS_ONLY +#include "syscalls.h" +#undef SYMBOL_PRINTERS_ONLY + +#include "../generated/linux-symbol-extractors.h" + + +static int +get_linux_symbol_extractor_by_sym_nr(LIBSYSCALLS_SYMBOL_PRINTER printer, libsyscalls_symbol_printer_function **function_out, + enum libsyscalls_arch arch, const struct libsyscalls_syscall_abi *syscall, int nr, + struct libsyscalls_symbol_printer_data *data_out) +{ + int ret; + +#define CASE(E, F, N)\ + case E:\ + *function_out = &F;\ + ret = N;\ + break + + switch (printer) { + LIST_LINUX_EXTRACTORS(CASE, ;); + + case LINUX_SYMBOL_PRINTER_SIGNAL: + *function_out = &extract_linux_symbol_signal; + ret = 1; + break; + + default: + abort(); + } + +#undef CASE + + data_out->arch = arch; + data_out->nr = nr; + + (void) syscall; + return ret; +} + + +static libsyscalls_symbol_printer_function * +get_linux_symbol_extractor_by_arg_nr(enum libsyscalls_arch arch, const struct libsyscalls_syscall_abi *syscall, + int arg, struct libsyscalls_symbol_printer_data *data_out) +{ + int nr, n; + unsigned mask; + LIBSYSCALLS_SYMBOL_PRINTER first, second; + libsyscalls_symbol_printer_function *function; + + if (!syscall->symbol_printer || arg >= NPARAMS) { + return NULL; + } else if (arg < 0) { + if (syscall->symbolic_return) + nr = 0; + else + return NULL; + } else if ((syscall->symbolic_mask >> arg) & 1) { + mask = (unsigned)syscall->symbolic_mask; + nr = (int)syscall->symbolic_return; + for (mask &= (1U << arg) - 1; mask; mask >>= 1) + nr += (int)mask & 1; + } else { + return NULL; + } + + first = (syscall->symbol_printer & 0x00FF) >> 0; + second = (syscall->symbol_printer & 0xFF00) >> 8; + if (second && !first) + second = syscall->symbol_printer; + + if (first) { + n = get_linux_symbol_extractor_by_sym_nr(first, &function, arch, syscall, nr, data_out); + if (nr < n) + goto have_fun; + nr -= n; + } + + if (second) { + n = get_linux_symbol_extractor_by_sym_nr(second, &function, arch, syscall, nr, data_out); + if (nr < n) + goto have_fun; + } + + abort(); + +have_fun: + return function; +} + + +static struct libsyscalls_syscall_display_info * +get_linux_syscall_display_info(enum libsyscalls_arch arch, const struct libsyscalls_syscall_abi *syscall, + long long int syscall_number, unsigned long long int *syscall_argument) +{ + LIBSYSCALLS_SYMBOL_PRINTER_DATA *data; + libsyscalls_symbol_printer_function **funcs; + int i, nargs, nsyms; + size_t data_size = offsetof(LIBSYSCALLS_SYMBOL_PRINTER_DATA, buf); + size_t data_align = alignof(*data); + size_t bufspace, bufspace1, bufspace2; + LIBSYSCALLS_SYMBOL_PRINTER first, second; + + nargs = (int)syscall->max_argument_count; + nargs = nargs < 0 ? 0 : nargs; + + first = (syscall->symbol_printer & 0x00FF) >> 0; + second = (syscall->symbol_printer & 0xFF00) >> 8; + if (second && !first) + second = syscall->symbol_printer; + + bufspace1 = LINUX_REQUIRE_SYMBOL_BUFFER(first); + bufspace2 = LINUX_REQUIRE_SYMBOL_BUFFER(second); + bufspace = bufspace1 > bufspace2 ? bufspace1 : bufspace2; + data_size += bufspace; + if (bufspace & (data_align - 1)) { + data_size |= data_align - 1; + data_size += 1; + } + + { + char data_vla_buf[(nargs + 1) * data_size + data_align]; + libsyscalls_symbol_printer_function *funcs_vla[nargs + 1]; + + data = (void *)ALIGN_BUF(data_vla_buf, data_align); + funcs = funcs_vla; + + nsyms = 0; + for (i = 0; i < nargs; i++) { + funcs[i] = get_linux_symbol_extractor_by_arg_nr(arch, syscall, i, &data[i]); + nsyms += !!funcs[i]; + } + funcs[i] = get_linux_symbol_extractor_by_arg_nr(arch, syscall, -1, &data[i]); + nsyms += !!funcs[i]; + + (void) syscall_argument; + (void) syscall_number; + + return build_syscall_display_info(data, data_size, data_align, funcs, syscall, nargs, nsyms); + } +} diff --git a/linux/symbols.mk b/linux/symbols.mk new file mode 100644 index 0000000..f045222 --- /dev/null +++ b/linux/symbols.mk @@ -0,0 +1,73 @@ +LINUX_SYMBOL_TABLES != sed -n 's/^.*LINUX_SYMBOL_PRINTER_\([A-Z0-9_]\+\)\b.*\$$\$$\$$.*\$$\$$\$$.*$$/\1/p' < linux/syscalls.h + +LINUX_SYMBOL_TABLE_FILES != printf 'linux-src/symbols-$(LINUX_VERSION)/%s\n' $(LINUX_SYMBOL_TABLES) + +LINUX_SYMBOL_TABLE_DEPS =\ + $(LINUX_SOURCE)\ + linux/symbols.mk\ + linux/syscalls.h\ + util/getdefs\ + util/getenum + +LINUX_SYMBOL_EXTRACTOR_DEPS =\ + $(LINUX_SYMBOL_TABLE_FILES)\ + linux/symbols.mk\ + linux/syscalls.h\ + util/make-enum\ + util/make-mask\ + util/make-multiextractor\ + util/make-sym-extractor + + +libsyscalls_get_syscall_display_info.o: generated/linux-symbol-extractors.h linux/symbols.c +libsyscalls_get_syscall_display_info.lo: generated/linux-symbol-extractors.h linux/symbols.c + + +$(LINUX_SYMBOL_TABLE_FILES): $(LINUX_SYMBOL_TABLE_DEPS) + mkdir -p -- linux-src/symbols-$(LINUX_VERSION) + table="$$(printf '%s\n' "$@" | tr / '\n' | sed -n '$$p')" && \ + command="$$(sed -n 's/^.*LINUX_SYMBOL_PRINTER_'"$$table"'\b.*\$$\$$\$$\s*\(.*\)\s*\$$\$$\$$.*$$/\1/p' < linux/syscalls.h)" && \ + test -n "$$command" && \ + printf '%s\n' "$$command" && \ + (cd -- linux-src/linux-$(LINUX_VERSION) && env PATH="../../util:$${PATH}" sh -e -c "$$command") > $@ + +generated/linux-symbol-extractors.h: $(LINUX_SYMBOL_EXTRACTOR_DEPS) + mkdir -p -- generated + set -e; \ + for tablefile in $(LINUX_SYMBOL_TABLE_FILES); do \ + tablename="$$(printf '%s\n' "$$tablefile" | cut -d / -f 3)"; \ + how="$$(sed -n < linux/syscalls.h \ + 's/^.*LINUX_SYMBOL_PRINTER_'"$$tablename"'\b.*\/\*\s*\(.*\)\s*\$$\$$\$$.*\$$\$$\$$.*$$/\1/p')"; \ + printf '\n'; \ + util/make-sym-extractor "$$tablename" "$$how" < "$$tablefile"; \ + done > $@.tmp + set -e; \ + pattern='\s\+LINUX_SYMBOL_PRINTER_\([A-Z0-9_]\+\)\s*'; \ + funcprefix='extract_linux_symbol_'; \ + sed -n 's/^\s*\x23\s*define'"$$pattern$$pattern"'\(\/.*\)\?$$/\x23define '$$funcprefix'\1 '$$funcprefix'\2/p' \ + < linux/syscalls.h | tr '[A-Z]' '[a-z]' > $@ + storage_and_rettype="$$(sed '/^$$/d' < $@.tmp | sed 1q | sed 's/\*/\\\*/g' | sed 's/[^\*]$$/& /')"; \ + sed -n 's/^extract_symbol_.*/'"$${storage_and_rettype}"'&;/p' < $@.tmp | cat - $@.tmp >> $@ + -rm -f -- $@.tmp + set -e; \ + sed 's/, */ /g' < linux/syscalls.h \ + | sed -n 's/^.*LINUX_SYMBOL_PRINTER_\([A-Z0-9_]\+\)\b.*[^$$]\$$\$$\s*SYMBOLS(\(.*\))\s*\$$\$$[^$$].*$$/\1 \2/p' \ + | while read line; do \ + printf '\n'; \ + util/make-multiextractor $$line; \ + done >> $@ + printf '\n\43define LIST_LINUX_EXTRACTORS(X, D)\\\n' >> $@ + set -e; \ + phonies="$$(sed -n '/\$$\$$\$$\s*BEGIN\s\+PHONIES\s*\$$\$$\$$/,/\$$\$$\$$\s*END\s\+PHONIES\s*\$$\$$\$$/p' < linux/syscalls.h \ + | sed -n 's/^\s*LINUX_SYMBOL_PRINTER_\([A-Z0-9_]\+\)\b.*$$/\1/p')"; \ + sed -n 's/^extract_symbol_\([^)]*\)(.*)\s*\/\*\s*\([0-9]\+\)\s*\*\/\s*$$/\1 \2/p' < $@ \ + | while read name n; do \ + if ! printf '%s\n' "$$phonies" | grep -i \^"$$name"\$$ > /dev/null; then \ + printf '\tX(LINUX_SYMBOL_PRINTER_%s, extract_symbol_%s, %i) D\\\n' \ + "$$(printf '%s\n' "$$name" | tr '[a-z]' '[A-Z]')" \ + "$$name" \ + "$$n"; \ + fi; \ + done \ + | sed '$$s/ \D\\$$//' >> $@ + sed 's/extract_symbol/extract_linux_symbol/g' < $@ > $@.tmp && mv -- $@.tmp $@ diff --git a/linux/syscall-table.c b/linux/syscall-table.c new file mode 100644 index 0000000..6bcd480 --- /dev/null +++ b/linux/syscall-table.c @@ -0,0 +1,58 @@ +/* See LICENSE file for copyright and license details. */ +#define REQUIRE_FLEXABLE_OR_NPARAMS +#include "../common.h" + + +#include "../generated/linux-syscall-table.h" +#include "../generated/linux-syscalls.h" +#include "syscalls.h" + + +/* generated/linux-syscall-dedup.h removes references to duplicate symbols, then compiler optimisation removes them */ +#if defined(__clang__) +# pragma clang diagnostic ignored "-Wunused-const-variable" +#elif defined(__GNUC__) +# pragma GCC diagnostic ignored "-Wunused-const-variable" +#endif + + +#define MAKE_SYSCALL_WITHOUT_COMPAT(ARCH, NR, NAME, ACTUAL)\ + static const struct libsyscalls_syscall linux_##ARCH##_syscall_##NAME = {\ + .name = #NAME,\ + .actual_syscall = &linux_syscall_##ACTUAL,\ + .actual_compat_syscall = NULL\ + } + +#define MAKE_SYSCALL_WITH_COMPAT(ARCH, NR, NAME, ACTUAL, COMPAT)\ + static const struct libsyscalls_syscall linux_##ARCH##_syscall_##NAME = {\ + .name = #NAME,\ + .actual_syscall = &linux_syscall_##ACTUAL,\ + .actual_compat_syscall = &linux_syscall_##COMPAT\ + } + + +#define X(ARCH)\ + LIST_LINUX_SYSCALLS_FOR_##ARCH(MAKE_##ARCH##_SYSCALL_WITHOUT_COMPAT, MAKE_##ARCH##_SYSCALL_WITH_COMPAT, ;) +LIST_LINUX_ARCHES(X, ;); +#undef X + +#ifndef CREATING_DEDUP_TABLE +# include "../generated/linux-syscall-dedup.h" +#endif + +#define MAKE_SYSCALL_TABLE_ENTRY(ARCH, NR, NAME, ...)\ + [NR] = &linux_##ARCH##_syscall_##NAME + +#define X(ARCH)\ + static const struct libsyscalls_syscall *const linux_##ARCH##_syscalls_table[] = {\ + LIST_LINUX_SYSCALLS_FOR_##ARCH(MAKE_##ARCH##_SYSCALL_TABLE_ENTRY, MAKE_##ARCH##_SYSCALL_TABLE_ENTRY, COMMA)\ + } +LIST_LINUX_ARCHES(X, ;); +#undef X + + +const struct libsyscalls_syscall *const *const libsyscalls_linux_syscalls_table_[] = { +#define X(ARCH) [LIBSYSCALLS_ARCH_##ARCH] = linux_##ARCH##_syscalls_table + LIST_LINUX_ARCHES(X, COMMA) +#undef X +}; diff --git a/linux/syscall-table.mk b/linux/syscall-table.mk new file mode 100644 index 0000000..3f0d944 --- /dev/null +++ b/linux/syscall-table.mk @@ -0,0 +1,60 @@ +OBJ += linux/syscall-table.o + + +linux/syscall-table.o: generated/linux-syscall-table.h linux/syscalls.h $(LINUX_SYSCALLS_HDR) generated/linux-syscall-dedup.h +linux/syscall-table.lo: generated/linux-syscall-table.h linux/syscalls.h $(LINUX_SYSCALLS_HDR) generated/linux-syscall-dedup.h + +libsyscalls_get_syscall_range.o: $(LINUX_SYSCALLS_HDR) +libsyscalls_get_syscall_range.lo: $(LINUX_SYSCALLS_HDR) + + +generated/linux-syscall-table.h: linux/syscall-table.c common.h linux/linux-support.mk + set -e; \ + macros="$$(sed -n 's/^\s*\x23\s*define\s\+MAKE_\([^(]*\)(.*$$/\1/p' < linux/syscall-table.c)"; \ + for arch in $(SUPPORTED_LINUX_ARCHES); do \ + for macro in $$macros; do \ + printf '\43define MAKE_%s_%s(...) MAKE_%s(%s, __VA_ARGS__)\n' \ + "$$arch" "$$macro" "$$macro" "$$arch"; \ + done; \ + done > $@ + + +generated/linux-syscalls.h: linux/syscalls.mk + mkdir -p -- generated + printf '\43include "%s"\n' $(LINUX_SYSCALLS_HDR) \ + | grep -v '"$@"' \ + | sed 's:generated/::' > $@ + + +generated/linux-syscall-ranges.h: $(LINUX_SYSCALLS_ARCH_HDR) + printf '%s\n' 'This may take some time ...'; \ + set -e; arch=; \ + cat -- $(LINUX_SYSCALLS_ARCH_HDR) \ + | sed 's/^\s*X[A-Z_]*(\([^,]*\).*$$/\1/' \ + | sed 's/\x23\s*define\s\+LIST_LINUX_SYSCALLS_FOR_\(.*\)(.*/\1/' \ + | sed '/^\s*$$/d' \ + | (\ + while read line; do \ + if test -z "$$(printf '%s\n' "$$line" | sed 's/^[A-Z].*$$//')"; then \ + if test -n "$$arch"; then \ + printf '\43define %s_LINUX_SYSCALL_FOR_%s %i\n' \ + MIN "$$arch" "$$min" \ + MAX "$$arch" "$$max"; \ + fi; \ + arch="$$line"; \ + min=; \ + max=; \ + else \ + val=$$(( $$line )); \ + if test -z "$$min" || test "$$val" -lt "$$min"; then \ + min=$$val; \ + fi; \ + if test -z "$$max" || test "$$val" -gt "$$max"; then \ + max=$$val; \ + fi; \ + fi; \ + done; \ + printf '\43define %s_LINUX_SYSCALL_FOR_%s %i\n' \ + MIN "$$arch" "$$min" \ + MAX "$$arch" "$$max"; \ + ) > $@ diff --git a/linux/syscalls.h b/linux/syscalls.h new file mode 100644 index 0000000..94d714e --- /dev/null +++ b/linux/syscalls.h @@ -0,0 +1,988 @@ +/* See LICENSE file for copyright and license details. */ + +/* This file is included from syscall-table.c or symbols.c */ + + +#define LINUX_MODE_BUFFER_SIZE sizeof("07777 (rwsrwsrwt)") +#define LINUX_UMASK_BUFFER_SIZE sizeof("0777 (u::rwx,g::rwx,o::rwx)") +#define LINUX_DEV_BUFFER_SIZE sizeof("18446744073709551615 (4294967295:4294967295)") +#define LINUX_CLOCKID_T_BUFFER_SIZE (sizeof("- (~*8 + 7)") + 2 * 3 * sizeof(long long int)) + +#define LINUX_REQUIRE_SYMBOL_BUFFER(PRINTER)\ + ((PRINTER) == LINUX_SYMBOL_PRINTER_ATFD_MODE ? LINUX_MODE_BUFFER_SIZE :\ + (PRINTER) == LINUX_SYMBOL_PRINTER_MODE ? LINUX_MODE_BUFFER_SIZE :\ + (PRINTER) == LINUX_SYMBOL_PRINTER_UMASK ? LINUX_UMASK_BUFFER_SIZE :\ + (PRINTER) == LINUX_SYMBOL_PRINTER_DEV ? LINUX_DEV_BUFFER_SIZE :\ + (PRINTER) == LINUX_SYMBOL_PRINTER_CLOCKID ? LINUX_CLOCKID_T_BUFFER_SIZE : 0) + +enum { /* LIBSYSCALLS_SYMBOL_PRINTER */ + NO_LINUX_SYMBOL_PRINTER = 0, + + /* The comments after the enum constnts are used by linux/symbols.mk, do not break them */ + + LINUX_SYMBOL_PRINTER_CLOCKID, /* clockid_t,enum $$$ getdefs CLOCK < include/uapi/linux/time.h $$$ */ + LINUX_SYMBOL_PRINTER_MODE, /* mode_t (e.g. "0666 (rw-rw-rw-)") */ + LINUX_SYMBOL_PRINTER_UMASK, /* mode_t (e.g. "022 (u::rwx,g::r-x,o::r-x)") */ + LINUX_SYMBOL_PRINTER_DEV, /* int (major:minor) */ + LINUX_SYMBOL_PRINTER_SIGNAL, + + LINUX_SYMBOL_PRINTER_2ATFD, /* $$ SYMBOLS(ATFD, ATFD) $$ */ + LINUX_SYMBOL_PRINTER_ATFD_MODE, /* $$ SYMBOLS(ATFD, MODE) $$ */ + LINUX_SYMBOL_PRINTER_FACCESSAT, /* $$ SYMBOLS(ATFD, ACCESS_OK) $$ */ + LINUX_SYMBOL_PRINTER_FANOTIFY_MARK, /* $$ SYMBOLS(FAN_MARK, FAN) $$ */ + LINUX_SYMBOL_PRINTER_3STATX, /* $$ SYMBOLS(ATFD, AT_STATX, STATX) $$ */ + + LINUX_SYMBOL_PRINTER_ITIMER, /* enum $$$ getdefs ITIMER < include/uapi/linux/time.h $$$ */ + LINUX_SYMBOL_PRINTER_SEEK, /* enum $$$ getdefs SEEK < include/uapi/linux/fs.h $$$ */ + LINUX_SYMBOL_PRINTER_EPOLL_CTL, /* enum $$$ getdefs EPOLL_CTL < include/uapi/linux/eventpoll.h $$$ */ + LINUX_SYMBOL_PRINTER_SCHEDULER, /* enum $$$ grep -v '0x' < include/uapi/linux/sched.h | getdefs SCHED | grep -v '^SCHED_FLAG_' $$$ */ + LINUX_SYMBOL_PRINTER_SHUT, /* enum $$$ getenum sock_shutdown_cmd < include/linux/net.h $$$ */ + LINUX_SYMBOL_PRINTER_FADVISE, /* enum $$$ getdefs FADV POSIX_FADV < include/uapi/linux/fadvise.h $$$ */ + LINUX_SYMBOL_PRINTER_ADJTIMEX, /* enum $$$ getdefs TIME < include/uapi/linux/timex.h $$$ */ + LINUX_SYMBOL_PRINTER_IPC_KEY, /* enum $$$ grep IPC_PRIVATE < include/uapi/linux/ipc.h | sed 's/(\s*\(__kernel_\)\?key_t\s*)//g' | getdefs IPC $$$ */ + LINUX_SYMBOL_PRINTER_ATFD, /* enum $$$ getdefs AT < tools/include/uapi/linux/fcntl.h | grep '^AT_FDCWD ' $$$ */ + LINUX_SYMBOL_PRINTER_MSGCTL, /* IPCCTL,enum $$$ sed '1,/ctl commands/d;/ctl commands/d;/^\//q' < include/uapi/linux/msg.h | getdefs MSG $$$ */ + LINUX_SYMBOL_PRINTER_SHMCTL, /* IPCCTL,enum $$$ sed '1,/ctl commands/d;/ctl commands/d;/^\//q' < include/uapi/linux/shm.h | getdefs SHM $$$ */ + LINUX_SYMBOL_PRINTER_SEMCTL, /* IPCCTL,IPCCTL_SEM,enum $$$ sed '1,/[cC]ommand [dD]efinitions/d;/^\//q' < include/uapi/linux/sem.h | getdefs $$$ */ + LINUX_SYMBOL_PRINTER_NOFLAGS, /* mask $$$ true $$$ */ + LINUX_SYMBOL_PRINTER_ACCESS_OK, /* mask $$$ printf '%s_OK %i\n' X 1 W 2 R 4 F 0 $$$ */ + LINUX_SYMBOL_PRINTER_SPLICE_F, /* mask $$$ getdefs SPLICE < include/linux/splice.h $$$ */ + LINUX_SYMBOL_PRINTER_XATTR, /* mask $$$ getdefs XATTR < include/uapi/linux/xattr.h $$$ */ + LINUX_SYMBOL_PRINTER_SYNC_FILE_RANGE, /* mask $$$ getdefs SYNC_FILE_RANGE < include/uapi/linux/fs.h $$$ */ + LINUX_SYMBOL_PRINTER_RENAME, /* mask $$$ getdefs RENAME < include/uapi/linux/fs.h $$$ */ + LINUX_SYMBOL_PRINTER_GRND, /* mask $$$ getdefs GRND < include/uapi/linux/random.h $$$ */ + LINUX_SYMBOL_PRINTER_CLOSE_RANGE, /* mask $$$ getdefs CLOSE_RANGE < include/uapi/linux/close_range.h $$$ */ + LINUX_SYMBOL_PRINTER_FSOPEN, /* mask $$$ getdefs FSOPEN < include/uapi/linux/mount.h $$$ */ + LINUX_SYMBOL_PRINTER_LOCK, /* mask $$$ getdefs LOCK < include/uapi/asm-generic/fcntl.h | grep -v '^LOCK_RW '; ! cat arch'/'*\/include/uapi/asm/fcntl.h | grep \\sLOCK_ > /dev/null $$$ */ + LINUX_SYMBOL_PRINTER_RWF, /* mask $$$ sed 's/(\s*__force\s\+__kernel_rwf_t\s*)//' < include/uapi/linux/fs.h | getdefs RWF $$$ */ + LINUX_SYMBOL_PRINTER_STATX, /* mask $$$ getdefs STATX < include/uapi/linux/stat.h | grep -v '^STATX_\(BASIC_STATS \|ALL \|ATTR_\)' $$$ */ + LINUX_SYMBOL_PRINTER_FALLOC, /* mask $$$ getdefs FALLOC_FL < include/uapi/linux/falloc.h $$$ */ + LINUX_SYMBOL_PRINTER_AT, /* mask $$$ grep '\(AT_EMPTY_PATH\|AT_SYMLINK_NOFOLLOW\)' < include/uapi/linux/fcntl.h | getdefs AT $$$ */ + LINUX_SYMBOL_PRINTER_TIMER, /* mask $$$ getdefs TIMER < include/uapi/linux/time.h $$$ */ + LINUX_SYMBOL_PRINTER_UMOUNT, /* mask $$$ getdefs MNT UMOUNT < include/linux/fs.h $$$ */ + LINUX_SYMBOL_PRINTER_RECV, /* mask $$$ grep -v 'sendpage()' < include/linux/socket.h | getdefs MSG | grep -v MSG_'\(WAITFORONE\|BATCH\|TRYHARD\)' | grep -v ' 0$' $$$ */ /* TODO MSG_TRYHARD should be used instead of MSG_DONTROUT for DECnet */ + LINUX_SYMBOL_PRINTER_IPC_NOWAIT, /* mask $$$ grep IPC_NOWAIT < include/uapi/linux/ipc.h | getdefs IPC $$$ */ + LINUX_SYMBOL_PRINTER_IPCGET, /* mask $$$ grep '\(IPC_CREAT\|IPC_EXCL\)' < include/uapi/linux/ipc.h | getdefs IPC $$$ */ + LINUX_SYMBOL_PRINTER_UNLINK, /* mask $$$ getdefs AT < tools/include/uapi/linux/fcntl.h | grep '^AT_REMOVEDIR ' $$$ */ + LINUX_SYMBOL_PRINTER_SHM, /* mask $$$ sed '1,/shmat()/d;/^\//q' < include/uapi/linux/shm.h | getdefs SHM $$$ */ + LINUX_SYMBOL_PRINTER_FACCESSAT2, /* AT|mask $$$ grep AT_EACCESS < include/uapi/linux/fcntl.h | getdefs AT $$$ */ + LINUX_SYMBOL_PRINTER_AT_AUTOMOUNT, /* AT|mask $$$ grep AT_NO_AUTOMOUNT < include/uapi/linux/fcntl.h | getdefs AT $$$ */ + LINUX_SYMBOL_PRINTER_AT_STATX, /* AT_AUTOMOUNT|mask $$$ getdefs AT_STATX < include/uapi/linux/fcntl.h | grep -v '^AT_STATX_SYNC_TYPE ' $$$ */ + LINUX_SYMBOL_PRINTER_RECVM, /* RECV|mask $$$ getdefs MSG < include/linux/socket.h | grep '^MSG_WAITFORONE ' $$$ */ + LINUX_SYMBOL_PRINTER_SENDM, /* SEND|mask $$$ getdefs MSG < include/linux/socket.h | grep '^MSG_BATCH ' $$$ */ + LINUX_SYMBOL_PRINTER_MSGRCV, /* IPC_NOWAIT|mask $$$ grep '^.*\s0[0-9a-fA-FxulUL]*\s*\(/.*\)\?$' < include/uapi/linux/msg.h | getdefs MSG $$$ */ + LINUX_SYMBOL_PRINTER_SCHEDULER_SET, /* SCHEDULER|mask $$$ grep '0x' < include/uapi/linux/sched.h | getdefs SCHED | grep -v '^SCHED_FLAG_' $$$ */ + + /* arch dependent (TODO -- don't forget to remove #define from top of symbols.c) */ + LINUX_SYMBOL_PRINTER_MADVISE, /* MADV_{NORMAL, RANDOM, SEQUENTIAL, WILLNEED, DONTNEED, REMOVE, ...} */ + LINUX_SYMBOL_PRINTER_MSYNC, /* MS_{ASYNC, SYNC}|MS_INVALIDATE */ + LINUX_SYMBOL_PRINTER_MLOCK, /* MLOCK_ONFAULT, 0 */ + LINUX_SYMBOL_PRINTER_MCL, /* MCL_CURRENT|MCL_FUTURE|MCL_ONFAULT */ + LINUX_SYMBOL_PRINTER_EPOLL, /* EPOLL_CLOEXEC|0 */ + LINUX_SYMBOL_PRINTER_SOCK_FD, /* SOCK_NONBLOCK|SOCK_CLOEXEC */ + LINUX_SYMBOL_PRINTER_DUP3, /* O_CLOEXEC|0 */ + LINUX_SYMBOL_PRINTER_PIPE, /* O_CLOEXEC|O_DIRECT|O_NONBLOCK|O_NOTIFICATION_PIPE */ + LINUX_SYMBOL_PRINTER_INOTIFY_FD, /* IN_NONBLOCK|IN_CLOEXEC */ + LINUX_SYMBOL_PRINTER_FAN_EVENT_F, /* O_{RDONLY, WRONLY, RDWR}|O_{LARGEFILE|CLOEXEC|APPEND|DSYNC|NOATIME|NONBLOCK|SYNC} */ + LINUX_SYMBOL_PRINTER_MQ_OPEN, /* {O_RDONLY, O_WRONLY, O_RDWR}|O_CLOEXEC|O_CREAT|O_EXCL|O_NONBLOCK */ + + /* TODO -- don't forget to remove #define from top of symbols.c */ + LINUX_SYMBOL_PRINTER_SWAPON, /* swapon(2) flags */ + LINUX_SYMBOL_PRINTER_INOTIFY_MASK, /* inotify(7) */ + LINUX_SYMBOL_PRINTER_SHMGET, /* IPCGET|mask $ SHM_HUGETLB|... */ + LINUX_SYMBOL_PRINTER_FAN_CLASS, /* FAN_CLASS_{PRE_CONTENT, CONTENT, NOTIF}|FAN_{CLOEXEC|NONBLOCK|...} */ + LINUX_SYMBOL_PRINTER_FAN_MARK, /* FAN_MARK_{{ADD, REMOVE, FLUSH}|DONT_FOLLOW|ONLYDIR|MOUNT|...} */ + LINUX_SYMBOL_PRINTER_FAN, /* FAN_{ACCESS,MODIFY|CLOSE_WRITE|CLOSE_NOWRITE|OPEN|...} */ + LINUX_SYMBOL_PRINTER_SOCKET, /* all three parameters of socket(2) */ + LINUX_SYMBOL_PRINTER_REBOOT, /* all parameters of reboot(2), and used to infer whether the fourth argument is included */ + +#define LINUX_SYMBOL_PRINTER_SEMGET LINUX_SYMBOL_PRINTER_IPCGET +#define LINUX_SYMBOL_PRINTER_MSGGET LINUX_SYMBOL_PRINTER_IPCGET +#define LINUX_SYMBOL_PRINTER_SEND LINUX_SYMBOL_PRINTER_RECV /* TODO */ +#define LINUX_SYMBOL_PRINTER_MSGSND LINUX_SYMBOL_PRINTER_IPC_NOWAIT + + END_OF_LINUX_SYMBOL_PRINTERS + +#if 0 /* $$$ BEGIN PHONIES $$$ */ /* These are just for the implementation */ + LINUX_SYMBOL_PRINTER_IPCCTL /* enum $$$ sed '/IPC_RMID/p;1,/IPC_RMID/d;/^\//q' < include/uapi/linux/ipc.h | getdefs IPC $$$ */ + LINUX_SYMBOL_PRINTER_IPCCTL_SEM /* enum $$$ sed '1,/ctl \(commands\|cmds\)/d;/ctl \(commands\|cmds\)/d;/^\//q' < include/uapi/linux/sem.h | getdefs SEM $$$ */ +#endif /* $$$ END PHONIES $$$ */ +}; + +_Static_assert(END_OF_LINUX_SYMBOL_PRINTERS <= 0xFF, "LINUX_SYMBOL_PRINTER enums"); /* We only have 16 bits, and SYMBOLS can back in two values */ + + +#ifndef SYMBOL_PRINTERS_ONLY + + +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wgnu-flexible-array-initializer" +# pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments" /* TODO how does that make sense in C23? */ +#elif defined(__GNUC__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wpedantic" +#endif + +#define SYS(...) SYSCALL_ABI(linux, __VA_ARGS__) + +#define SYMBOLS(A, ...) .symbol_printer = (LINUX_SYMBOL_PRINTER_##A __VA_OPT__(SYMBOLS_2(__VA_ARGS__))) +#define SYMBOLS_2(A, ...) | (LINUX_SYMBOL_PRINTER_##A << 8) __VA_OPT__(SYMBOLS_3(__VA_ARGS__)) + + +#define linux_syscall_sys_exit linux_syscall_sys_exit_group +#define linux_syscall_sys_fdatasync linux_syscall_sys_fsync +#define linux_syscall_sys_syncfs linux_syscall_sys_fsync +#define linux_syscall_sys_getpid linux_syscall_sys_gettid +#define linux_syscall_sys_getpgrp linux_syscall_sys_gettid +#define linux_syscall_sys_getgid linux_syscall_sys_getuid +#define linux_syscall_sys_geteuid linux_syscall_sys_getuid +#define linux_syscall_sys_getegid linux_syscall_sys_getuid +#define linux_syscall_sys_geteuid16 linux_syscall_sys_getuid16 +#define linux_syscall_sys_getgid16 linux_syscall_sys_getuid16 +#define linux_syscall_sys_getegid16 linux_syscall_sys_getuid16 +#define linux_syscall_sys_setgid16 linux_syscall_sys_setuid16 +#define linux_syscall_sys_setfsuid16 linux_syscall_sys_setuid16 +#define linux_syscall_sys_setfsgid16 linux_syscall_sys_setuid16 +#define linux_syscall_sys_setregid16 linux_syscall_sys_setreuid16 +#define linux_syscall_sys_setresgid16 linux_syscall_sys_setresuid16 +#define linux_syscall_sys_getresgid16 linux_syscall_sys_getresuid16 +#define linux_syscall_sys_getxgid linux_syscall_sys_getxuid +#define linux_syscall_sys_setfsgid linux_syscall_sys_setuid +#define linux_syscall_sys_setgid linux_syscall_sys_setuid +#define linux_syscall_sys_setregid linux_syscall_sys_setreuid +#define linux_syscall_sys_setresgid linux_syscall_sys_setresuid +#define linux_syscall_sys_getresgid linux_syscall_sys_getresuid +#define linux_syscall_sys_getpgid linux_syscall_sys_getsid +#define linux_syscall_sys_setfsuid linux_syscall_sys_setuid +#define linux_syscall_sys_vfork linux_syscall_sys_fork +#define linux_syscall_sys_symlink linux_syscall_sys_link +#define linux_syscall_sys_rmdir linux_syscall_sys_unlink +#define linux_syscall_sys_lsetxattr linux_syscall_sys_setxattr +#define linux_syscall_sys_lgetxattr linux_syscall_sys_getxattr +#define linux_syscall_sys_llistxattr linux_syscall_sys_listxattr +#define linux_syscall_sys_lremovexattr linux_syscall_sys_removexattr +#define linux_syscall_sys_lstat linux_syscall_sys_stat +#define linux_syscall_sys_newlstat linux_syscall_sys_newstat +#define linux_syscall_sys_lchown linux_syscall_sys_chown +#define linux_syscall_sys_lchown16 linux_syscall_sys_chown16 +#define linux_syscall_sys_lstat64 linux_syscall_sys_stat64 +#define linux_syscall_sys_setdomainname linux_syscall_sys_sethostname +#define linux_syscall_sys_old_shmctl linux_syscall_sys_shmctl +#define linux_syscall_sys_old_semctl linux_syscall_sys_semctl +#define linux_syscall_sys_old_msgctl linux_syscall_sys_msgctl +#define linux_syscall_sys_sched_get_priority_max linux_syscall_sys_sched_get_priority_min +#define linux_syscall_sys_tkill linux_syscall_sys_kill +#define linux_syscall_alpha_clone linux_syscall_sys_clone +#define linux_syscall_alpha_fork linux_syscall_sys_fork +#define linux_syscall_alpha_vfork linux_syscall_sys_fork +#define linux_syscall_sys_osf_brk linux_syscall_sys_brk +#define linux_syscall_sys_ia64_pipe linux_syscall_sys_alpha_pipe +#define linux_syscall_sys_sh_pipe linux_syscall_sys_alpha_pipe +#define linux_syscall_compat_sys_sigreturn linux_syscall_sys_sigreturn +#define linux_syscall_compat_sys_rt_sigreturn linux_syscall_sys_rt_sigreturn +#define linux_syscall_compat_sys_x32_rt_sigreturn linux_syscall_sys_rt_sigreturn +#define linux_syscall_compat_sys_arch_prctl linux_syscall_sys_arch_prctl + +SYS(sys_accept, NETWORK_ENABLED_IPC, ACCEPT, 3, INT_FD, PARAMS(_,INT_FD, OUT,STRUCT_SOCKADDR, OUT,UINT)); +SYS(sys_listen, NETWORK_ENABLED_IPC, LISTEN, 2, ZERO(INT), PARAMS(_,INT_FD, _,INT)); +SYS(sys_bind, NETWORK_ENABLED_IPC, BIND, 3, ZERO(INT), PARAMS(_,INT_FD, IN,STRUCT_SOCKADDR, _,INT)); +SYS(sys_connect, NETWORK_ENABLED_IPC, CONNECT, 3, ZERO(INT), PARAMS(_,INT_FD, IN,STRUCT_SOCKADDR, _,INT)); +SYS(sys_getsockname, NETWORK_ENABLED_IPC, STAT, 3, ZERO(INT), PARAMS(_,INT_FD, OUT,STRUCT_SOCKADDR, BI,INT)); +SYS(sys_getpeername, NETWORK_ENABLED_IPC, STAT, 3, ZERO(INT), PARAMS(_,INT_FD, OUT,STRUCT_SOCKADDR, BI,INT)); +SYS(sys_acct, LOGGING, PROCESSES, 1, ZERO(INT), PARAMS(_,STRING)); +SYS(sys_alarm, TIME, TIMER_RELATIVE, 1, UINT, PARAMS(_,UINT)); +SYS(sys_nanosleep, TIME, SLEEP_RELATIVE, 2, ZERO(INT), PARAMS(IN,STRUCT_TIMESPEC, OUT,STRUCT_TIMESPEC)); +SYS(sys_nanosleep_time32, TIME, SLEEP_RELATIVE, 2, ZERO(INT), PARAMS(IN,STRUCT_OLD_TIMESPEC32, OUT,STRUCT_OLD_TIMESPEC32)); +SYS(sys_close, FILE_DESCRIPTORS, DUP_OR_CLOSE, 1, ZERO(INT), PARAMS(_,INT_FD)); +SYS(sys_dup, FILE_DESCRIPTORS, DUP_OR_CLOSE, 1, INT, PARAMS(_,INT_FD)); +SYS(sys_dup2, FILE_DESCRIPTORS, DUP_OR_CLOSE, 2, INT, PARAMS(_,INT_FD, _,INT_FD)); +SYS(sys_exit, PROCESSES, EXIT, 1, ZERO(NO_RETURN), PARAMS(_,INT)); +SYS(sys_pause, SIGNALS, PAUSE, 0, ZERO(INT), PARAMS()); +SYS(sys_gettid, PROCESSES, STAT_SELF, 0, INT, PARAMS()); +SYS(sys_getppid, PROCESSES, STAT_PARENT, 0, INT, PARAMS()); +SYS(sys_getxpid, PROCESSES, STAT_PARENT, 0, 2_INTS, PARAMS()); +SYS(sys_getxuid, PROCESSES, STAT_SELF, 0, 2_UINT32S, PARAMS()); +SYS(sys_getuid, PROCESSES, STAT_SELF, 0, UINT32, PARAMS()); +SYS(sys_getuid16, PROCESSES, STAT_SELF, 0, USHORT, PARAMS()); +SYS(sys_getresuid, PROCESSES, STAT_SELF, 3, ZERO(INT), PARAMS(OUT,UINT32, OUT,UINT32, OUT,UINT32)); +SYS(sys_getresuid16, PROCESSES, STAT_SELF, 3, ZERO(INT), PARAMS(OUT,USHORT, OUT,USHORT, OUT,USHORT)); +SYS(sys_getsid, PROCESSES, STAT_SELF, 1, INT, PARAMS(_,INT)); +SYS(sys_setresuid, PROCESSES, CHANGE_PERMISSIONS, 3, ZERO(INT), PARAMS(_,UINT32, _,UINT32, _,UINT32)); +SYS(sys_setresuid16, PROCESSES, CHANGE_PERMISSIONS, 3, ZERO(INT), PARAMS(_,USHORT, _,USHORT, _,USHORT)); +SYS(sys_setreuid, PROCESSES, CHANGE_PERMISSIONS, 2, ZERO(INT), PARAMS(_,UINT32, _,UINT32)); +SYS(sys_setreuid16, PROCESSES, CHANGE_PERMISSIONS, 2, ZERO(INT), PARAMS(_,USHORT, _,USHORT)); +SYS(sys_setuid, PROCESSES, CHANGE_PERMISSIONS, 1, INT, PARAMS(_,UINT32)); +SYS(sys_setuid16, PROCESSES, CHANGE_PERMISSIONS, 1, ZERO(INT), PARAMS(_,USHORT)); +SYS(sys_sync, FILESYSTEM, SYNC, 0, ZERO(INT), PARAMS()); +SYS(sys_fsync, FILESYSTEM, SYNC, 1, ZERO(INT), PARAMS(_,INT_FD)); +SYS(sys_fork, PROCESSES, CLONE, 0, INT, PARAMS()); +SYS(sys_link, FILESYSTEM, LINK, 2, ZERO(INT), PARAMS(_,STRING, _,STRING)); +SYS(sys_unlink, FILESYSTEM, UNLINK, 1, ZERO(INT), PARAMS(_,STRING)); +SYS(sys_rename, FILESYSTEM, LINK_OR_UNLINK, 2, ZERO(INT), PARAMS(_,STRING, _,STRING)); +SYS(sys_read, FILE_DESCRIPTORS, READ, 3, SSIZE, PARAMS(_,INT_FD, OUT,BUFFER, _,SIZE)); +SYS(sys_write, FILE_DESCRIPTORS, WRITE, 3, SSIZE, PARAMS(_,INT_FD, IN,BUFFER, _,SIZE)); +SYS(sys_sendfile, FILE_DESCRIPTORS, READ_OR_PEEK_AND_WRITE, 4, SSIZE, PARAMS(_,INT_FD, _,INT_FD, BI,LONG, _,SIZE)); +SYS(sys_sendfile64, FILE_DESCRIPTORS, READ_OR_PEEK_AND_WRITE, 4, SSIZE, PARAMS(_,INT_FD, _,INT_FD, BI,LLONG, _,SIZE)); +SYS(sys_getxattr, FILESYSTEM, STAT, 4, SSIZE, PARAMS(_,STRING, _,STRING, OUT,BUFFER, _,SIZE)); +SYS(sys_fgetxattr, FILE_DESCRIPTORS, STAT, 4, SSIZE, PARAMS(_,INT_FD, _,STRING, OUT,BUFFER, _,SIZE)); +SYS(sys_listxattr, FILESYSTEM, STAT, 3, SSIZE, PARAMS(_,STRING, OUT,BUFFER, _,SIZE)); +SYS(sys_flistxattr, FILE_DESCRIPTORS, STAT, 3, SSIZE, PARAMS(,INT_FD, OUT,BUFFER, _,SIZE)); +SYS(sys_removexattr, FILESYSTEM, MODIFY, 2, ZERO(INT), PARAMS(_,STRING, _,STRING)); +SYS(sys_fremovexattr, FILE_DESCRIPTORS, MODIFY, 2, ZERO(INT), PARAMS(_,INT_FD, _,STRING)); +SYS(sys_chdir, PROCESSES, CHDIR, 1, ZERO(INT), PARAMS(_,STRING)); +SYS(sys_fchdir, PROCESSES, CHDIR, 1, ZERO(INT), PARAMS(_,INT_FD)); +SYS(sys_chroot, PROCESSES, CHROOT, 1, ZERO(INT), PARAMS(_,STRING)); +SYS(sys_pivot_root, PROCESSES, CHROOT, 2, ZERO(INT), PARAMS(_,STRING, _,STRING)); +SYS(sys_getcwd, PROCESSES, STAT_SELF, 2, LONG, PARAMS(OUT,BUFFER, _,ULONG)); +SYS(sys_readahead, FILE_DESCRIPTORS, ADVISE, 3, ZERO(INT), PARAMS(_,INT_FD, _,LLONG, _,SIZE)); +SYS(sys_chown, FILESYSTEM, MODIFY, 3, ZERO(INT), PARAMS(_,STRING, _,UINT32, _,UINT32)); +SYS(sys_chown16, FILESYSTEM, MODIFY, 3, ZERO(INT), PARAMS(_,STRING, _,USHORT, _,USHORT)); +SYS(sys_fchown, FILE_DESCRIPTORS, MODIFY, 3, ZERO(INT), PARAMS(_,INT_FD, _,UINT32, _,UINT32)); +SYS(sys_fchown16, FILE_DESCRIPTORS, MODIFY, 3, ZERO(INT), PARAMS(_,INT_FD, _,USHORT, _,USHORT)); +SYS(sys_truncate, FILESYSTEM, WRITE, 2, ZERO(INT), PARAMS(_,STRING, _,LONG)); +SYS(compat_sys_truncate, FILESYSTEM, WRITE, 2, ZERO(INT), PARAMS(_,STRING, _,INT32)); +SYS(sys_truncate64, FILESYSTEM, WRITE, 2, ZERO(INT), PARAMS(_,STRING, _,LLONG)); +SYS(sparc___compat_sys_truncate64, FILESYSTEM, WRITE, 3, ZERO(INT), PARAMS(_,STRING, _,UINT64_HIGH_32, _,UINT64_LOW_32)); +SYS(sys_ftruncate, FILE_DESCRIPTORS, WRITE, 2, ZERO(INT), PARAMS(_,INT_FD, _,ULONG)); +SYS(compat_sys_ftruncate, FILE_DESCRIPTORS, WRITE, 2, ZERO(INT), PARAMS(_,INT_FD, _,UINT32)); +SYS(sys_ftruncate64, FILE_DESCRIPTORS, WRITE, 2, ZERO(INT), PARAMS(_,INT_FD, _,LLONG)); +SYS(sparc___compat_sys_ftruncate64, FILE_DESCRIPTORS, WRITE, 3, ZERO(INT), PARAMS(_,INT_FD, _,UINT64_HIGH_32, _,UINT64_LOW_32)); +SYS(sys_brk, MEMORY, ALLOCATE, 1, MEMORY_ADDRESS, PARAMS(_,MEMORY_ADDRESS)); +SYS(sys_swapoff, SYSTEM, SWAP, 1, ZERO(INT), PARAMS(_,STRING)); +SYS(sys_oldumount, FILESYSTEM, MOUNTPOINT, 1, ZERO(INT), PARAMS(_,STRING)); +SYS(sys_execve, PROCESSES, EXEC, 3, ZERO(INT), PARAMS(_,STRING, _,STRINGS_THEN_NULL, _,STRINGS_THEN_NULL)); +SYS(sys_newstat, FILESYSTEM, STAT, 2, ZERO(INT), PARAMS(_,STRING, OUT,STRUCT_STAT)); +SYS(sys_stat64, FILESYSTEM, STAT, 2, ZERO(INT), PARAMS(_,STRING, OUT,STRUCT_STAT64)); +SYS(sys_stat, FILESYSTEM, STAT, 2, ZERO(INT), PARAMS(_,STRING, OUT,STRUCT_OLD_STAT)); +SYS(sys_newfstat, FILE_DESCRIPTORS, STAT, 2, ZERO(INT), PARAMS(_,INT_FD, OUT,STRUCT_STAT)); +SYS(sys_fstat64, FILE_DESCRIPTORS, STAT, 2, ZERO(INT), PARAMS(_,LONG_FD, OUT,STRUCT_STAT64)); +SYS(sys_fstat, FILE_DESCRIPTORS, STAT, 2, ZERO(INT), PARAMS(_,INT, OUT,STRUCT_OLD_STAT)); +SYS(sys_pipe, FILE_DESCRIPTORS, CREATE, 1, ZERO(INT), PARAMS(OUT,2_INTS_FD)); +SYS(sys_alpha_pipe, FILE_DESCRIPTORS, CREATE, 0, 2_INTS_FD, PARAMS()); +SYS(sys_readlink, FILESYSTEM, READLINK, 3, INT, PARAMS(_,STRING, OUT,BUFFER, _,INT)); +SYS(sys_munlockall, MEMORY, UNLOCK, 0, ZERO(INT), PARAMS()); +SYS(sys_munlock, MEMORY, UNLOCK, 2, ZERO(INT), PARAMS(_,MEMORY_ADDRESS, _,SIZE)); +SYS(sys_mlock, MEMORY, LOCK, 2, ZERO(INT), PARAMS(_,MEMORY_ADDRESS, _,SIZE)); +SYS(sys_epoll_create, FILE_DESCRIPTORS, CREATE_POLL, 1, INT_FD, PARAMS(_,INT)); +SYS(sys_pread64, FILE_DESCRIPTORS, PEEK, 4, SSIZE, PARAMS(_,INT_FD, OUT,BUFFER, _,SIZE, _,LLONG)); +SYS(sys_pwrite64, FILE_DESCRIPTORS, WRITE, 4, SSIZE, PARAMS(_,INT_FD, INT,BUFFER, _,SIZE, _,LLONG)); +SYS(sys_gethostname, SYSTEM, GET_NAME, 2, ZERO(INT), PARAMS(OUT,BUFFER, _,INT)); +SYS(sys_olduname, SYSTEM, GET_NAME, 1, ZERO(INT), PARAMS(OUT,STRUCT_OLDOLD_UTSNAME)); +SYS(sys_uname, SYSTEM, GET_NAME, 1, ZERO(INT), PARAMS(OUT,STRUCT_OLD_UTSNAME)); +SYS(sys_newuname, SYSTEM, GET_NAME, 1, ZERO(INT), PARAMS(OUT,STRUCT_NEW_UTSNAME)); +SYS(sys_sethostname, SYSTEM, SET_NAME, 2, ZERO(INT), PARAMS(IN,BUFFER, _,INT)); +SYS(sys_sysinfo, SYSTEM, STAT, 1, ZERO(INT), PARAMS(OUT,STRUCT_SYSINFO)); +SYS(sys_shmdt, IPC, DETACH, 1, ZERO(INT), PARAMS(_,MEMORY_ADDRESS)); +SYS(sys_mq_unlink, IPC, CONTROL, 1, ZERO(INT), PARAMS(_,STRING)); +SYS(sys_mq_notify, IPC, CONTROL, 2, ZERO(INT), PARAMS(_,INT_FD, IN,STRUCT_SIGEVENT)); +SYS(sys_mq_getsetattr, IPC, CONTROL, 3, ZERO(INT), PARAMS(_,INT_FD, IN,STRUCT_MQ_ATTR, OUT,STRUCT_MQ_ATTR)); +SYS(sys_mq_timedsend, IPC, COMMUNICATE_WITH_ABSOLUTE_TIMEOUT, 5, ZERO(INT), PARAMS(_,INT_FD, _,BUFFER, _,SIZE, _,UINT, IN,STRUCT_TIMESPEC)); +SYS(sys_mq_timedsend_time32, IPC, COMMUNICATE_WITH_ABSOLUTE_TIMEOUT, 5, ZERO(INT), PARAMS(_,INT_FD, _,BUFFER, _,UINT, _,UINT, IN,STRUCT_OLD_TIMESPEC32)); +SYS(sys_mq_timedreceive, IPC, COMMUNICATE_WITH_ABSOLUTE_TIMEOUT, 5, SSIZE, PARAMS(_,INT_FD, OUT,BUFFER, _,SIZE, OUT,UINT, IN,STRUCT_TIMESPEC)); +SYS(sys_mq_timedreceive_time32, IPC, COMMUNICATE_WITH_ABSOLUTE_TIMEOUT, 5, SSIZE, PARAMS(_,INT_FD, OUT,BUFFER, _,UINT, OUT,UINT, IN,STRUCT_OLD_TIMESPEC32)); +SYS(sys_vhangup, PROCESSES, SESSION, 0, ZERO(INT), PARAMS()); +SYS(sys_setsid, PROCESSES, SESSION, 0, INT, PARAMS()); +SYS(sys_setpgid, PROCESSES, SESSION, 2, INT, PARAMS(_,INT, _,INT)); +SYS(sys_sched_yield, SCHEDULING, YEILD, 0, ZERO(INT), PARAMS()); +SYS(sys_sched_setparam, SCHEDULING, SET, 2, ZERO(INT), PARAMS(_,INT, IN,STRUCT_SCHED_PARAM)); +SYS(sys_sched_getparam, SCHEDULING, GET, 2, ZERO(INT), PARAMS(_,INT, OUT,STRUCT_SCHED_PARAM)); +SYS(sys_sched_rr_get_interval, SCHEDULING, GET, 2, ZERO(INT), PARAMS(_,INT, OUT,STRUCT_TIMESPEC)); +SYS(sys_sched_rr_get_interval_time32, SCHEDULING, GET, 2, ZERO(INT), PARAMS(_,INT, OUT,STRUCT_OLD_TIMESPEC32)); +SYS(sys_inotify_init, FILESYSTEM, MONITOR, 0, INT_FD, PARAMS()); +SYS(sys_inotify_rm_watch, FILESYSTEM, MONITOR, 2, ZERO(INT), PARAMS(_,INT_FD, _,INT32)); +SYS(sys_getpagesize, SYSTEM, FUNDAMENTAL, 0, INT, PARAMS()); +SYS(sys_kill, SIGNALS, KILL, 2, ZERO(INT), PARAMS(_,INT, SYM,INT_SIGNAL), SYMBOLS(SIGNAL)); +SYS(sys_tgkill, SIGNALS, KILL, 3, ZERO(INT), PARAMS(_,INT, _,INT, SYM,INT_SIGNAL), SYMBOLS(SIGNAL)); +SYS(sys_symlinkat, FILESYSTEM, LINK, 3, ZERO(INT), PARAMS(_,STRING, SYM,INT_ATFD, _,STRING), SYMBOLS(ATFD)); +SYS(sys_renameat, FILESYSTEM, LINK_OR_UNLINK, 4, ZERO(INT), PARAMS(SYM,INT_ATFD, _,STRING, SYM,INT_ATFD, _,STRING), SYMBOLS(ATFD, ATFD)); +SYS(sys_readlinkat, FILESYSTEM, READLINK, 4, INT, PARAMS(SYM,INT_ATFD, _,STRING, OUT,BUFFER, _,INT), SYMBOLS(ATFD)); +SYS(sys_clock_getres, TIME, INTROSPECT, 2, ZERO(INT), PARAMS(SYM,INT, OUT,STRUCT_TIMESPEC), SYMBOLS(CLOCKID)); +SYS(sys_clock_getres_time32, TIME, INTROSPECT, 2, ZERO(INT), PARAMS(SYM,INT, OUT,STRUCT_OLD_TIMESPEC32), SYMBOLS(CLOCKID)); +SYS(sys_clock_gettime, TIME, GET, 2, ZERO(INT), PARAMS(SYM,INT, OUT,STRUCT_TIMESPEC), SYMBOLS(CLOCKID)); +SYS(sys_clock_gettime32, TIME, GET, 2, ZERO(INT), PARAMS(SYM,INT, OUT,STRUCT_OLD_TIMESPEC32), SYMBOLS(CLOCKID)); +SYS(sys_clock_settime, TIME, SET, 2, ZERO(INT), PARAMS(SYM,INT, IN,STRUCT_TIMESPEC), SYMBOLS(CLOCKID)); +SYS(sys_clock_settime32, TIME, SET, 2, ZERO(INT), PARAMS(SYM,INT, IN,STRUCT_OLD_TIMESPEC32), SYMBOLS(CLOCKID)); +SYS(sys_shutdown, FILE_DESCRIPTORS, DUP_OR_CLOSE, 2, ZERO(INT), PARAMS(_,INT_FD, SYM,UINT), SYMBOLS(SHUT)); +SYS(sys_close_range, FILE_DESCRIPTORS, CLOSE_OR_UNSHARE, 3, ZERO(INT), PARAMS(_,UINT, _,UINT, SYM,UINT), SYMBOLS(CLOSE_RANGE)); +SYS(sys_send, FILE_DESCRIPTORS, WRITE, 4, SSIZE, PARAMS(_,INT_FD, IN,BUFFER, _,SIZE, SYM,UINT), SYMBOLS(SEND)); +SYS(sys_sendto, FILE_DESCRIPTORS, WRITE, 6, SSIZE, PARAMS(_,INT_FD, IN,BUFFER, _,SIZE, SYM,UINT, IN,STRUCT_SOCKADDR, _,INT), SYMBOLS(SEND)); +SYS(sys_sendmsg, FILE_DESCRIPTORS, WRITE, 3, SSIZE, PARAMS(_,INT_FD, IN,STRUCT_MSGHDR, SYM,UINT), SYMBOLS(SEND)); +SYS(sys_sendmmsg, FILE_DESCRIPTORS, WRITE, 4, INT, PARAMS(_,INT_FD, BI,STRUCT_MMSGHDR, _,UINT, SYM,UINT), SYMBOLS(SENDM)); +SYS(sys_lseek, FILE_DESCRIPTORS, SEEK, 3, LONG, PARAMS(_,INT_FD, _,LONG, SYM,UINT), SYMBOLS(SEEK)); +SYS(sys_llseek, FILE_DESCRIPTORS, SEEK, 5, INT, PARAMS(_,INT_FD, _,INT64_HIGH_32, _,INT64_LOW_32, OUT,LLONG, SYM,UINT), SYMBOLS(SEEK)); +SYS(sys_sched_getscheduler, SCHEDULING, GET, 1, INT, PARAMS(_,INT), SYMBOLS(SCHEDULER)); +SYS(sys_sched_getattr, SCHEDULING, GET, 4, ZERO(INT), PARAMS(_,INT, OUT,STRUCT_SCHED_ATTR, _,UINT, SYM,UINT), SYMBOLS(NOFLAGS)); +SYS(sys_sched_setattr, SCHEDULING, SET, 3, INT, PARAMS(_,INT, IN,STRUCT_SCHED_ATTR, SYM,UINT), SYMBOLS(NOFLAGS)); +SYS(sys_recv, FILE_DESCRIPTORS, READ_OR_PEEK, 4, SSIZE, PARAMS(_,INT_FD, OUT,BUFFER, _,SIZE, SYM,UINT), SYMBOLS(RECV)); +SYS(sys_recvfrom, FILE_DESCRIPTORS, READ_OR_PEEK_AND_STAT, 6, SSIZE, PARAMS(_,INT_FD, OUT,BUFFER, _,SIZE, SYM,UINT, OUT,STRUCT_SOCKADDR, BI,INT), SYMBOLS(RECV)); +SYS(sys_recvmsg, FILE_DESCRIPTORS, READ_OR_PEEK_AND_STAT, 3, SSIZE, PARAMS(_,INT_FD, BI,STRUCT_MSGHDR, SYM,UINT), SYMBOLS(RECV)); +SYS(sys_recvmmsg, FILE_DESCRIPTORS, READ_OR_PEEK_AND_STAT, 5, INT, PARAMS(_,INT_FD, BI,STRUCT_MMSGHDR, _,UINT, SYM,UINT, BI,STRUCT_TIMESPEC), SYMBOLS(RECVM)); +SYS(sys_recvmmsg_time32, FILE_DESCRIPTORS, READ_OR_PEEK_AND_STAT, 5, INT, PARAMS(_,INT_FD, BI,STRUCT_MMSGHDR, _,UINT, SYM,UINT, BI,STRUCT_OLD_TIMESPEC32), SYMBOLS(RECVM)); +SYS(sys_splice, FILE_DESCRIPTORS, READ_OR_PEEK_AND_WRITE, 6, SSIZE, PARAMS(_,INT_FD, BI,LLONG, _,INT_FD, BI,LLONG, _,SIZE, SYM,UINT), SYMBOLS(SPLICE_F)); +SYS(sys_tee, FILE_DESCRIPTORS, PEEK_AND_WRITE, 4, SSIZE, PARAMS(_,INT_FD, _,INT_FD, _,SIZE, SYM,UINT), SYMBOLS(SPLICE_F)); +SYS(sys_setxattr, FILESYSTEM, MODIFY, 5, ZERO(INT), PARAMS(_,STRING, _,STRING, IN,BUFFER, _,SIZE, SYM,UINT), SYMBOLS(XATTR)); +SYS(sys_fsetxattr, FILE_DESCRIPTORS, MODIFY, 5, ZERO(INT), PARAMS(_,INT_FD, _,STRING, IN,BUFFER, _,SIZE, SYM,UINT), SYMBOLS(XATTR)); +SYS(sys_fadvise64, FILE_DESCRIPTORS, ADVISE, 4, ZERO(INT), PARAMS(_,INT_FD, _,LLONG, _,SIZE, SYM,INT), SYMBOLS(FADVISE)); +SYS(sys_fadvise64_64, FILE_DESCRIPTORS, ADVISE, 4, ZERO(INT), PARAMS(_,INT_FD, _,LLONG, _,LLONG, SYM,INT), SYMBOLS(FADVISE)); +SYS(sys_sched_get_priority_min, SCHEDULING, INTROSPECT, 1, INT, PARAMS(SYM,INT), SYMBOLS(SCHEDULER)); +SYS(sys_sched_setscheduler, SCHEDULING, SET, 3, ZERO(INT), PARAMS(_,INT, SYM,INT, OUT,STRUCT_SCHED_PARAM), SYMBOLS(SCHEDULER_SET)); +SYS(sys_adjtimex, TIME, GET_OR_SET, 1, SYMB(INT), PARAMS(BI,STRUCT_TIMEX), SYMBOLS(ADJTIMEX)); +SYS(sys_adjtimex_time32, TIME, GET_OR_SET, 1, SYMB(INT), PARAMS(BI,STRUCT_OLD_TIMEX32), SYMBOLS(ADJTIMEX)); +SYS(sys_access, FILESYSTEM, STAT, 2, ZERO(INT), PARAMS(_,STRING, SYM,UINT), SYMBOLS(ACCESS_OK)); +SYS(sys_faccessat, FILESYSTEM, STAT, 3, ZERO(INT), PARAMS(SYM,INT_ATFD, _,STRING, SYM,UINT), SYMBOLS(ATFD, ACCESS_OK)); +SYS(sys_clock_adjtime, TIME, GET_OR_SET, 2, SYMB(INT), PARAMS(SYMB,INT, BI,STRUCT_TIMEX), SYMBOLS(ADJTIMEX, CLOCKID)); +SYS(sys_clock_adjtime32, TIME, GET_OR_SET, 2, INT, PARAMS(SYM,INT, BI,STRUCT_OLD_TIMEX32), SYMBOLS(ADJTIMEX, CLOCKID)); +SYS(sys_getitimer, TIME, TIMER_RELATIVE_READ, 2, ZERO(INT), PARAMS(SYM,INT, OUT,STRUCT_OLD_ITIMERVAL), SYMBOLS(ITIMER)); +SYS(sys_setitimer, TIME, TIMER_RELATIVE_WITH_READ, 3, ZERO(INT), PARAMS(SYM,INT, INT,STRUCT_OLD_ITIMERVAL, OUT,STRUCT_OLD_ITIMERVAL), SYMBOLS(ITIMER)); +SYS(sys_umount, FILESYSTEM, MOUNTPOINT, 2, ZERO(INT), PARAMS(_,STRING, SYM,UINT), SYMBOLS(UMOUNT)); +SYS(sys_msync, FILESYSTEM, SYNC, 3, ZERO(INT), PARAMS(_,MEMORY_ADDRESS, _,SIZE, SYM,UINT), SYMBOLS(MSYNC)); +SYS(sys_madvise, MEMORY, WRITE_OR_ADVISE, 3, ZERO(INT), PARAMS(_,MEMORY_ADDRESS, _,SIZE, SYM,INT), SYMBOLS(MADVISE)); +SYS(sys_epoll_create1, FILE_DESCRIPTORS, CREATE_POLL, 1, INT_FD, PARAMS(SYM,UINT), SYMBOLS(EPOLL)); +SYS(sys_epoll_ctl, FILE_DESCRIPTORS, CREATE_POLL, 4, ZERO(INT), PARAMS(_,INT_FD, SYM,INT, _,INT, IN,STRUCT_EPOLL_EVENT), SYMBOLS(EPOLL_CTL)); +SYS(sys_accept4, NETWORK_ENABLED_IPC, ACCEPT, 4, INT_FD, PARAMS(_,INT_FD, OUT,STRUCT_SOCKADDR, OUT,INT, _,UINT), SYMBOLS(SOCK_FD)); +SYS(sys_clock_nanosleep, TIME, SLEEP, 4, ZERO(INT), PARAMS(SYM,INT, SYM,UINT, IN,STRUCT_TIMESPEC, OUT,STRUCT_TIMESPEC), SYMBOLS(CLOCKID, TIMER)); +SYS(sys_clock_nanosleep_time32, TIME, SLEEP, 4, ZERO(INT), PARAMS(SYM,INT, SYM,UINT, IN,STRUCT_OLD_TIMESPEC32, OUT,STRUCT_OLD_TIMESPEC32), SYMBOLS(CLOCKID, TIMER)); +SYS(sys_dup3, FILE_DESCRIPTORS, DUP_OR_CLOSE, 3, INT, PARAMS(_,INT_FD, _,INT_FD, SYM,UINT), SYMBOLS(DUP3)); +SYS(sys_sync_file_range, FILESYSTEM, SYNC, 4, ZERO(INT), PARAMS(_,INT_FD, _,LLONG, _,LLONG, SYM,UINT), SYMBOLS(SYNC_FILE_RANGE)); +SYS(sys_sync_file_range2, FILESYSTEM, SYNC, 4, ZERO(INT), PARAMS(_,INT_FD, SYM,UINT, _,LLONG, _,LLONG), SYMBOLS(SYNC_FILE_RANGE)); +SYS(sys_renameat2, FILESYSTEM, LINK_OR_UNLINK, 5, ZERO(INT), PARAMS(SYM,INT_ATFD, _,STRING, SYM,INT_ATFD, _,STRING, SYM,UINT), SYMBOLS(2ATFD, RENAME)); +SYS(sys_mknod, FILESYSTEM, LINK, 3, ZERO(INT), PARAMS(_,STRING, SYM,USHORT, SYM,UINT), SYMBOLS(MODE, DEV)); +SYS(sys_mknodat, FILESYSTEM, LINK, 4, ZERO(INT), PARAMS(SYM,INT_ATFD, _,STRING, SYM,USHORT, SYM,UINT), SYMBOLS(ATFD_MODE, DEV)); +SYS(sys_mkdir, FILESYSTEM, LINK, 2, ZERO(INT), PARAMS(_,STRING, SYM,USHORT), SYMBOLS(MODE)); +SYS(sys_mkdirat, FILESYSTEM, LINK, 3, ZERO(INT), PARAMS(SYM,INT_ATFD, _,STRING, SYM,USHORT), SYMBOLS(ATFD, MODE)); +SYS(sys_umask, FILESYSTEM, UMASK, 1, SYMB(UINT), PARAMS(SYM,UINT), SYMBOLS(UMASK, UMASK)); +SYS(sys_flock, IPC, FILE_LOCK, 2, ZERO(INT), PARAMS(_,INT_FD, SYM,UINT), SYMBOLS(LOCK)); +SYS(sys_fchmod, FILE_DESCRIPTORS, MODIFY, 2, ZERO(INT), PARAMS(_,INT_FD, SYM,USHORT), SYMBOLS(MODE)); +SYS(sys_chmod, FILESYSTEM, MODIFY, 2, ZERO(INT), PARAMS(_,STRING, SYM,USHORT), SYMBOLS(MODE)); +SYS(sys_fchmodat, FILESYSTEM, MODIFY, 3, ZERO(INT), PARAMS(SYM,INT_ATFD, _,STRING, SYM,USHORT), SYMBOLS(ATFD, MODE)); +SYS(sys_fchmodat2, FILESYSTEM, MODIFY, 4, ZERO(INT), PARAMS(SYM,INT_ATFD, _,STRING, SYM,USHORT, SYM,UINT), SYMBOLS(ATFD_MODE, AT)); +SYS(sys_fallocate, FILE_DESCRIPTORS, WRITE, 4, ZERO(INT), PARAMS(_,INT_FD, SYM,INT, _,LLONG, _,LLONG), SYMBOLS(FALLOC)); +SYS(sys_execveat, PROCESSES, EXEC, 5, ZERO(INT), PARAMS(SYM,INT_ATFD, _,STRING, IN,STRINGS_THEN_NULL, IN,STRINGS_THEN_NULL, SYM,UINT), SYMBOLS(ATFD, AT)); +SYS(sys_newfstatat, FILESYSTEM, STAT, 4, ZERO(INT), PARAMS(SYM,INT_ATFD, _,STRING, OUT,STRUCT_STAT, SYM,UINT), SYMBOLS(ATFD, AT_AUTOMOUNT)); +SYS(sys_fstatat64, FILESYSTEM, STAT, 4, ZERO(INT), PARAMS(SYM,INT_ATFD, _,STRING, OUT,STRUCT_STAT64, SYM,INT), SYMBOLS(ATFD, AT_AUTOMOUNT)); +SYS(sys_linkat, FILESYSTEM, LINK, 5, ZERO(INT), PARAMS(SYM,INT_ATFD, _,STRING, SYM,INT_ATFD, _,STRING, SYM,UINT), SYMBOLS(2ATFD, AT)); +SYS(sys_unlinkat, FILESYSTEM, UNLINK, 3, ZERO(INT), PARAMS(SYM,INT_ATFD, _,STRING, SYM,UINT), SYMBOLS(ATFD, UNLINK)); +SYS(sys_fchownat, FILESYSTEM, MODIFY, 5, ZERO(INT), PARAMS(SYM,INT_ATFD, _,STRING, _,UINT32, _,UINT32, SYM,UINT), SYMBOLS(ATFD, AT)); +SYS(sys_swapon, SYSTEM, SWAP, 2, ZERO(INT), PARAMS(_,STRING, SYM,INT), SYMBOLS(SWAPON)); +SYS(sys_shmctl, IPC, CONTROL, 2, INT, PARAMS(_,INT, SYM,INT, BI/* depends on command*/,DYNAMIC), SYMBOLS(SHMCTL)); +SYS(sys_msgctl, IPC, CONTROL, 2, INT, PARAMS(_,INT, SYM,INT, BI/* depends on command*/,DYNAMIC), SYMBOLS(MSGCTL)); +SYS(sys_semctl, IPC, CONTROL, 3, INT, PARAMS(_,INT, _,INT, SYM,INT, BI/* depends on command*/,DYNAMIC), SYMBOLS(SEMCTL)); +SYS(sys_mlock2, MEMORY, LOCK, 3, ZERO(INT), PARAMS(_,MEMORY_ADDRESS, _,SIZE, SYM,UINT), SYMBOLS(MLOCK)); +SYS(sys_mlockall, MEMORY, LOCK, 1, ZERO(INT), PARAMS(SYM,INT), SYMBOLS(MCL)); +SYS(sys_preadv2, FILE_DESCRIPTORS, READ_OR_PEEK, 6, SSIZE, PARAMS(_,LONG_FD, BI,STRUCT_IOVEC_ARRAY, _,ULONG, _,INT64_LOW_32, _,INT64_HIGH_32, SYM,UINT), SYMBOLS(RWF)); +SYS(sys_pwritev2, FILE_DESCRIPTORS, WRITE, 6, SSIZE, PARAMS(_,LONG_FD, IN,STRUCT_IOVEC_ARRAY, _,ULONG, _,INT64_LOW_32, _,INT64_HIGH_32, SYM,UINT), SYMBOLS(RWF)); +SYS(sys_shmat, IPC, ATTACH, 3, MEMORY_ADDRESS, PARAMS(_,INT, _,MEMORY_ADDRESS, SYM,UINT), SYMBOLS(SHM)); +SYS(sys_faccessat2, FILESYSTEM, STAT, 4, ZERO(INT), PARAMS(SYM,INT_ATFD, _,STRING,SYM,UINT, SYM,UINT), SYMBOLS(FACCESSAT, FACCESSAT2)); +SYS(sys_fsopen, FILESYSTEM, MOUNTPOINT, 2, INT_FD, PARAMS(_,STRING, SYM,UINT), SYMBOLS(FSOPEN)); +SYS(sys_statx, FILESYSTEM, STAT, 5, ZERO(INT), PARAMS(SYM,INT_ATFD, _,STRING, SYM,UINT, SYM,UINT, OUT,STRUCT_STATX), SYMBOLS(3STATX)); +SYS(sys_pipe2, FILE_DESCRIPTORS, CREATE, 2, ZERO(INT), PARAMS(OUT,2_INTS_FD, SYM,UINT), SYMBOLS(PIPE)); +SYS(sys_getrandom, SYSTEM, RANDOM, 3, SSIZE, PARAMS(OUT,BUFFER, _,SIZE, SYM,UINT), SYMBOLS(GRND)); +SYS(sys_inotify_init1, FILESYSTEM, MONITOR, 1, INT_FD, PARAMS(SYM,UINT), SYMBOLS(INOTIFY_FD)); +SYS(sys_inotify_add_watch, FILESYSTEM, MONITOR, 3, INT32, PARAMS(_,INT_FD, _,STRING, SYM,UINT32), SYMBOLS(INOTIFY_MASK)); +SYS(sys_shmget, IPC, CONTROL, 3, INT, PARAMS(SYM,INT, _,SIZE, SYM,UINT), SYMBOLS(IPC_KEY, SHMGET)); +SYS(sys_msgget, IPC, CONTROL, 2, INT, PARAMS(SYM,INT, SYM,UINT), SYMBOLS(IPC_KEY, MSGGET)); +SYS(sys_semget, IPC, CONTROL, 3, INT, PARAMS(SYM,INT, _,INT, SYM,UINT), SYMBOLS(IPC_KEY, SEMGET)); +SYS(sys_msgrcv, IPC, COMMUNICATE, 5, INT, PARAMS( _,INT_FD, IN,STRUCT_MSGBUF, _,SIZE, _,LONG, SYM,UINT), SYMBOLS(MSGRCV)); +SYS(sys_msgsnd, IPC, COMMUNICATE, 4, ZERO(SSIZE), PARAMS(_,INT, OUT,STRUCT_MSGBUF, _,SIZE, SYM,UINT), SYMBOLS(MSGSND)); +SYS(sys_fanotify_mark, FILESYSTEM, MONITOR, 5, ZERO(INT), PARAMS(_,INT_FD, SYM,UINT, SYM,UINT64, SYM,INT_ATFD, _,STRING), SYMBOLS(FANOTIFY_MARK, ATFD)); +SYS(sys_mq_open, IPC, CONTROL, 4, INT_FD, PARAMS(_,STRING, SYM,UINT, SYM,USHORT, IN,STRUCT_MQ_ATTR), SYMBOLS(MQ_OPEN, MODE)); +SYS(sys_fanotify_init, FILESYSTEM, MONITOR, 2, INT_FD, PARAMS(SYM,UINT, SYM,UINT), SYMBOLS(FAN_CLASS, FAN_EVENT_F)); +SYS(sys_socket, FILE_DESCRIPTORS, CREATE, 3, INT_FD, PARAMS(SYM,INT, SYM,UINT, SYM,UINT), SYMBOLS(SOCKET)); +SYS(sys_socketpair, FILE_DESCRIPTORS, CREATE, 4, ZERO(INT), PARAMS(SYM,INT, SYM,UINT, SYM,UINT, OUT,2_INTS_FD), SYMBOLS(SOCKET)); +SYS(sys_epoll_wait, FILE_DESCRIPTORS, POLL, 4, INT, PARAMS(_,INT_FD, OUT,STRUCT_EPOLL_EVENT_ARRAY, _,INT, _,INT)); +SYS(sys_epoll_pwait, FILE_DESCRIPTORS, POLL, 6, INT, PARAMS(_,INT_FD, OUT,STRUCT_EPOLL_EVENT_ARRAY, _,INT, _,INT, IN,ULONG_ARRAY, _,SIZE)); +SYS(sys_epoll_pwait2, FILE_DESCRIPTORS, POLL, 6, INT, PARAMS(_,INT_FD, OUT,STRUCT_EPOLL_EVENT_ARRAY, _,INT, IN,STRUCT_TIMESPEC, IN,ULONG_ARRAY, _,SIZE)); +SYS(sys_getgroups, PROCESSES, STAT_SELF, 2, INT, PARAMS(_,INT, OUT,UINT32_ARRAY)); +SYS(sys_getgroups16, PROCESSES, STAT_SELF, 2, INT, PARAMS(_,INT, OUT,USHORT_ARRAY)); +SYS(sys_setgroups, PROCESSES, CHANGE_PERMISSIONS, 2, ZERO(INT), PARAMS(_,INT, IN,UINT32_ARRAY)); +SYS(sys_setgroups16, PROCESSES, CHANGE_PERMISSIONS, 2, ZERO(INT), PARAMS(_,INT, IN,USHORT_ARRAY)); +SYS(sys_semop, IPC, COMMUNICATE, 3, ZERO(INT), PARAMS(_,INT, IN,STRUCT_SEMBUF_ARRAY, _,UINT)); +SYS(sys_semtimedop, IPC, COMMUNICATE_WITH_RELATIVE_TIMEOUT, 4, ZERO(INT), PARAMS(_,INT, IN,STRUCT_SEMBUF_ARRAY, _,UINT, IN,STRUCT_TIMESPEC)); +SYS(sys_semtimedop_time32, IPC, COMMUNICATE_WITH_RELATIVE_TIMEOUT, 4, ZERO(INT), PARAMS(_,INT, IN,STRUCT_SEMBUF_ARRAY, _,UINT, IN,STRUCT_OLD_TIMESPEC32)); +SYS(sys_mincore, MEMORY, STAT, 3, ZERO(INT), PARAMS(_,MEMORY_ADDRESS, _,SIZE, OUT,UCHAR_ARRAY_UNKNOWN_FILL /* entirely filled */)); +SYS(sys_reboot, SYSTEM, REBOOT, 3, ZERO(INT), PARAMS(SYM,UINT, SYM,UINT, SYM,UINT, _,STRING), SYMBOLS(REBOOT)); + +#define TODO_SYS(...) SYS(__VA_ARGS__, .queer = 1) +TODO_SYS(sys_poll, FILE_DESCRIPTORS, POLL, 3, INT, PARAMS(BI,STRUCT_POLLFD_ARRAY, _,UINT, _,INT)); +TODO_SYS(sys_ppoll, FILE_DESCRIPTORS, POLL, 5, INT, PARAMS(BI,STRUCT_POLLFD_ARRAY, _,UINT, IN,STRUCT_TIMESPEC, IN,ULONG_ARRAY, _,SIZE)); +TODO_SYS(sys_ppoll_time32, FILE_DESCRIPTORS, POLL, 5, INT, PARAMS(BI,STRUCT_POLLFD_ARRAY, _,UINT, IN,STRUCT_OLD_TIMESPEC32, IN,ULONG_ARRAY, _,SIZE)); +TODO_SYS(sys_old_select, FILE_DESCRIPTORS, POLL, 1, INT, PARAMS(BI,STRUCT_SEL_ARG_STRUCT)); +TODO_SYS(sys_select, FILE_DESCRIPTORS, POLL, 5, INT, PARAMS(_,INT, BI,FD_SET, BI,FD_SET, BI,FD_SET, BI,STRUCT_OLD_TIMEVAL)); /* unlike pselect6, select may update the timeout argument */ +TODO_SYS(sys_pselect6, FILE_DESCRIPTORS, POLL, 6, INT, PARAMS(_,INT, BI,FD_SET, BI,FD_SET, BI,FD_SET, OUT,STRUCT_TIMESPEC, IN,ULONG)); +TODO_SYS(sys_pselect6_time32, FILE_DESCRIPTORS, POLL, 6, INT, PARAMS(_,INT, BI,FD_SET, BI,FD_SET, BI,FD_SET, OUT,STRUCT_OLD_TIMESPEC32, IN,ULONG)); +TODO_SYS(sys_readv, FILE_DESCRIPTORS, READ, 3, SSIZE, PARAMS(_,LONG_FD, BI,STRUCT_IOVEC_ARRAY, _,ULONG)); +TODO_SYS(sys_writev, FILE_DESCRIPTORS, WRITE, 3, SSIZE, PARAMS(_,LONG_FD, IN,STRUCT_IOVEC_ARRAY, _,ULONG)); +TODO_SYS(sys_preadv, FILE_DESCRIPTORS, PEEK, 5, SSIZE, PARAMS(_,LONG_FD, BI,STRUCT_IOVEC_ARRAY, _,ULONG, _,INT64_LOW_32, _,INT64_HIGH_32)); +TODO_SYS(sys_pwritev, FILE_DESCRIPTORS, WRITE, 5, SSIZE, PARAMS(_,LONG_FD, IN,STRUCT_IOVEC_ARRAY, _,ULONG, _,INT64_LOW_32, _,INT64_HIGH_32)); +TODO_SYS(sys_sched_getaffinity, SCHEDULING, GET, 3, INT, PARAMS(_,INT, _,UINT, OUT,ULONG_ARRAY)); +TODO_SYS(sys_sched_setaffinity, SCHEDULING, SET, 3, ZERO(INT), PARAMS(_,INT, _,UINT, IN,ULONG_ARRAY)); +#undef TODO_SYS + + +#define XXX TODO /* when none on the architectures is not support yet by libsyscalls's core */ +static struct libsyscalls_syscall_abi TODO = + {.category = LIBSYSCALLS_CAT_SUPPORT_PENDING, + .min_argument_count = -1, + .max_argument_count = -1}; + +#define linux_syscall_sys_add_key TODO +#define linux_syscall_sys_arch_prctl TODO +#define linux_syscall_sys_bpf TODO +#define linux_syscall_sys_cachestat TODO +#define linux_syscall_sys_capget TODO +#define linux_syscall_sys_capset TODO +#define linux_syscall_sys_clone TODO +#define linux_syscall_sys_clone3 TODO +#define linux_syscall_sys_copy_file_range TODO +#define linux_syscall_sys_creat TODO +#define linux_syscall_sys_delete_module TODO +#define linux_syscall_sys_eventfd TODO +#define linux_syscall_sys_eventfd2 TODO +#define linux_syscall_sys_fcntl TODO +#define linux_syscall_sys_finit_module TODO +#define linux_syscall_sys_fsconfig TODO +#define linux_syscall_sys_fsmount TODO +#define linux_syscall_sys_fspick TODO +#define linux_syscall_sys_fstatfs TODO +#define linux_syscall_sys_futex TODO +#define linux_syscall_sys_futex_waitv TODO +#define linux_syscall_sys_futimesat TODO +#define linux_syscall_sys_getcpu TODO +#define linux_syscall_sys_getdents TODO +#define linux_syscall_sys_getdents64 TODO +#define linux_syscall_sys_get_mempolicy TODO +#define linux_syscall_sys_getpriority TODO +#define linux_syscall_sys_getrlimit TODO +#define linux_syscall_sys_get_robust_list TODO +#define linux_syscall_sys_getrusage TODO +#define linux_syscall_sys_getsockopt TODO +#define linux_syscall_sys_gettimeofday TODO +#define linux_syscall_sys_init_module TODO +#define linux_syscall_sys_io_cancel TODO +#define linux_syscall_sys_ioctl TODO +#define linux_syscall_sys_io_destroy TODO +#define linux_syscall_sys_io_getevents TODO +#define linux_syscall_sys_ioperm TODO +#define linux_syscall_sys_io_pgetevents TODO +#define linux_syscall_sys_iopl TODO +#define linux_syscall_sys_ioprio_get TODO +#define linux_syscall_sys_ioprio_set TODO +#define linux_syscall_sys_io_setup TODO +#define linux_syscall_sys_io_submit TODO +#define linux_syscall_sys_io_uring_enter TODO +#define linux_syscall_sys_io_uring_register TODO +#define linux_syscall_sys_io_uring_setup TODO +#define linux_syscall_sys_kcmp TODO +#define linux_syscall_sys_kexec_file_load TODO +#define linux_syscall_sys_kexec_load TODO +#define linux_syscall_sys_keyctl TODO +#define linux_syscall_sys_landlock_add_rule TODO +#define linux_syscall_sys_landlock_create_ruleset TODO +#define linux_syscall_sys_landlock_restrict_self TODO +#define linux_syscall_sys_lookup_dcookie TODO +#define linux_syscall_sys_map_shadow_stack TODO +#define linux_syscall_sys_mbind TODO +#define linux_syscall_sys_membarrier TODO +#define linux_syscall_sys_memfd_create TODO +#define linux_syscall_sys_memfd_secret TODO +#define linux_syscall_sys_migrate_pages TODO +#define linux_syscall_sys_mmap TODO +#define linux_syscall_sys_modify_ldt TODO +#define linux_syscall_sys_mount TODO +#define linux_syscall_sys_mount_setattr TODO +#define linux_syscall_sys_move_mount TODO +#define linux_syscall_sys_move_pages TODO +#define linux_syscall_sys_mprotect TODO +#define linux_syscall_sys_mremap TODO +#define linux_syscall_sys_munmap TODO +#define linux_syscall_sys_name_to_handle_at TODO +#define linux_syscall_sys_ni_syscall TODO +#define linux_syscall_sys_open TODO +#define linux_syscall_sys_openat TODO +#define linux_syscall_sys_openat2 TODO +#define linux_syscall_sys_open_by_handle_at TODO +#define linux_syscall_sys_open_tree TODO +#define linux_syscall_sys_perf_event_open TODO +#define linux_syscall_sys_personality TODO +#define linux_syscall_sys_pidfd_getfd TODO +#define linux_syscall_sys_pidfd_open TODO +#define linux_syscall_sys_pidfd_send_signal TODO +#define linux_syscall_sys_pkey_alloc TODO +#define linux_syscall_sys_pkey_free TODO +#define linux_syscall_sys_pkey_mprotect TODO +#define linux_syscall_sys_prctl TODO +#define linux_syscall_sys_prlimit64 TODO +#define linux_syscall_sys_process_madvise TODO +#define linux_syscall_sys_process_mrelease TODO +#define linux_syscall_sys_process_vm_readv TODO +#define linux_syscall_sys_process_vm_writev TODO +#define linux_syscall_sys_ptrace TODO +#define linux_syscall_sys_quotactl TODO +#define linux_syscall_sys_quotactl_fd TODO +#define linux_syscall_sys_remap_file_pages TODO +#define linux_syscall_sys_request_key TODO +#define linux_syscall_sys_restart_syscall TODO +#define linux_syscall_sys_rseq TODO +#define linux_syscall_sys_rt_sigaction TODO +#define linux_syscall_sys_rt_sigpending TODO +#define linux_syscall_sys_rt_sigprocmask TODO +#define linux_syscall_sys_rt_sigqueueinfo TODO +#define linux_syscall_sys_rt_sigreturn TODO +#define linux_syscall_sys_rt_sigsuspend TODO +#define linux_syscall_sys_rt_sigtimedwait TODO +#define linux_syscall_sys_rt_tgsigqueueinfo TODO +#define linux_syscall_sys_seccomp TODO +#define linux_syscall_sys_set_mempolicy TODO +#define linux_syscall_sys_set_mempolicy_home_node TODO +#define linux_syscall_sys_setns TODO +#define linux_syscall_sys_setpriority TODO +#define linux_syscall_sys_setrlimit TODO +#define linux_syscall_sys_set_robust_list TODO +#define linux_syscall_sys_setsockopt TODO +#define linux_syscall_sys_set_tid_address TODO +#define linux_syscall_sys_settimeofday TODO +#define linux_syscall_sys_sigaltstack TODO +#define linux_syscall_sys_signalfd TODO +#define linux_syscall_sys_signalfd4 TODO +#define linux_syscall_sys_statfs TODO +#define linux_syscall_sys_sysfs TODO +#define linux_syscall_sys_syslog TODO +#define linux_syscall_sys_time TODO +#define linux_syscall_sys_timer_create TODO +#define linux_syscall_sys_timer_delete TODO +#define linux_syscall_sys_timerfd_create TODO +#define linux_syscall_sys_timerfd_gettime TODO +#define linux_syscall_sys_timerfd_settime TODO +#define linux_syscall_sys_timer_getoverrun TODO +#define linux_syscall_sys_timer_gettime TODO +#define linux_syscall_sys_timer_settime TODO +#define linux_syscall_sys_times TODO +#define linux_syscall_sys_unshare TODO +#define linux_syscall_sys_userfaultfd TODO +#define linux_syscall_sys_ustat TODO +#define linux_syscall_sys_utime TODO +#define linux_syscall_sys_utimensat TODO +#define linux_syscall_sys_utimes TODO +#define linux_syscall_sys_vmsplice TODO +#define linux_syscall_sys_wait4 TODO +#define linux_syscall_sys_waitid TODO +#define linux_syscall_sys_waitpid TODO +#define linux_syscall_sys_create_module TODO +#define linux_syscall_sys_epoll_ctl_old TODO +#define linux_syscall_sys_epoll_wait_old TODO +#define linux_syscall_sys_get_kernel_syms TODO +#define linux_syscall_sys_get_thread_area TODO +#define linux_syscall_sys_nfsservctl TODO +#define linux_syscall_sys_query_module TODO +#define linux_syscall_sys_set_thread_area TODO +#define linux_syscall_sys_uselib TODO + +#define linux_syscall_compat_sys_recvfrom TODO /* i386 x32 mips powerpc s390 */ +#define linux_syscall_compat_sys_execve TODO /* i386 x32 mips powerpc s390 parisc */ +#define linux_syscall_compat_sys_execveat TODO /* i386 x32 mips powerpc s390 parisc */ +#define linux_syscall_compat_sys_fcntl64 TODO /* i386 x32 mips powerpc s390 parisc sparc */ +#define linux_syscall_compat_sys_get_robust_list TODO /* i386 x32 mips powerpc s390 parisc sparc */ +#define linux_syscall_compat_sys_io_setup TODO /* i386 x32 mips powerpc s390 parisc sparc */ +#define linux_syscall_compat_sys_io_submit TODO /* i386 x32 mips powerpc s390 parisc sparc */ +#define linux_syscall_compat_sys_ioctl TODO /* i386 x32 mips powerpc s390 parisc sparc */ +#define linux_syscall_compat_sys_kexec_load TODO /* i386 x32 mips powerpc s390 parisc sparc */ +#define linux_syscall_compat_sys_mq_notify TODO /* i386 x32 mips powerpc s390 parisc sparc */ +#define linux_syscall_compat_sys_ptrace TODO /* i386 x32 mips powerpc s390 parisc sparc */ +#define linux_syscall_compat_sys_recvmmsg_time64 TODO /* i386 x32 mips powerpc s390 parisc sparc */ +#define linux_syscall_compat_sys_recvmsg TODO /* i386 x32 mips powerpc s390 parisc sparc */ +#define linux_syscall_compat_sys_rt_sigaction TODO /* i386 x32 mips powerpc s390 parisc sparc */ +#define linux_syscall_compat_sys_rt_sigpending TODO /* i386 x32 mips powerpc s390 parisc sparc */ +#define linux_syscall_compat_sys_rt_sigqueueinfo TODO /* i386 x32 mips powerpc s390 parisc sparc */ +#define linux_syscall_compat_sys_rt_sigtimedwait_time64 TODO /* i386 x32 mips powerpc s390 parisc sparc */ +#define linux_syscall_compat_sys_rt_tgsigqueueinfo TODO /* i386 x32 mips powerpc s390 parisc sparc */ +#define linux_syscall_compat_sys_sendmmsg TODO /* i386 x32 mips powerpc s390 parisc sparc */ +#define linux_syscall_compat_sys_sendmsg TODO /* i386 x32 mips powerpc s390 parisc sparc */ +#define linux_syscall_compat_sys_set_robust_list TODO /* i386 x32 mips powerpc s390 parisc sparc */ +#define linux_syscall_compat_sys_sigaltstack TODO /* i386 x32 mips powerpc s390 parisc sparc */ +#define linux_syscall_compat_sys_timer_create TODO /* i386 x32 mips powerpc s390 parisc sparc */ +#define linux_syscall_compat_sys_waitid TODO /* i386 x32 mips powerpc s390 parisc sparc */ + +#define linux_syscall_sys_io_pgetevents_time32 TODO /* i386 arm mips microblaze parisc powerpc sparc */ +#define linux_syscall_sys_fcntl64 TODO /* i386 arm mips m68k microblaze parisc powerpc sh sparc xtensa */ +#define linux_syscall_sys_rt_sigtimedwait_time32 TODO /* i386 arm mips m68k microblaze parisc powerpc sh sparc xtensa */ +#define linux_syscall_sys_futex_time32 TODO /* i386 arm mips m68k microblaze parisc powerpc sh sparc s390 xtensa */ +#define linux_syscall_sys_futimesat_time32 TODO /* i386 arm mips m68k microblaze parisc powerpc sh sparc s390 xtensa */ +#define linux_syscall_sys_io_getevents_time32 TODO /* i386 arm mips m68k microblaze parisc powerpc sh sparc s390 xtensa */ +#define linux_syscall_sys_timer_gettime32 TODO /* i386 arm mips m68k microblaze parisc powerpc sh sparc s390 xtensa */ +#define linux_syscall_sys_timer_settime32 TODO /* i386 arm mips m68k microblaze parisc powerpc sh sparc s390 xtensa */ +#define linux_syscall_sys_timerfd_gettime32 TODO /* i386 arm mips m68k microblaze parisc powerpc sh sparc s390 xtensa */ +#define linux_syscall_sys_timerfd_settime32 TODO /* i386 arm mips m68k microblaze parisc powerpc sh sparc s390 xtensa */ +#define linux_syscall_sys_utime32 TODO /* i386 arm mips m68k microblaze parisc powerpc sh sparc s390 xtensa */ +#define linux_syscall_sys_utimensat_time32 TODO /* i386 arm mips m68k microblaze parisc powerpc sh sparc s390 xtensa */ +#define linux_syscall_sys_utimes_time32 TODO /* i386 arm mips m68k microblaze parisc powerpc sh sparc s390 xtensa */ +#define linux_syscall_sys_sigpending TODO /* i386 arm mips m68k microblaze parisc powerpc sh sparc s390 alpha */ +#define linux_syscall_sys_nice TODO /* i386 arm mips m68k microblaze parisc powerpc sh sparc s390 */ +#define linux_syscall_sys_sigprocmask TODO /* i386 arm mips m68k microblaze parisc powerpc sh sparc s390 */ +#define linux_syscall_sys_socketcall TODO /* i386 arm mips m68k microblaze parisc powerpc sh sparc s390 */ +#define linux_syscall_sys_stime32 TODO /* i386 arm mips m68k microblaze parisc powerpc sh sparc s390 */ +#define linux_syscall_sys_time32 TODO /* i386 arm mips m68k microblaze parisc powerpc sh sparc s390 */ +#define linux_syscall_sys_sgetmask TODO /* i386 arm mips m68k microblaze parisc powerpc sh sparc */ +#define linux_syscall_sys_ssetmask TODO /* i386 arm mips m68k microblaze parisc powerpc sh sparc */ +#define linux_syscall_sys_sigaction TODO /* i386 arm mips m68k powerpc sh s390 */ +#define linux_syscall_sys_sigsuspend TODO /* i386 arm mips m68k powerpc sh sparc s390 alpha */ +#define linux_syscall_sys_ipc TODO /* i386 arm mips m68k powerpc sh sparc */ +#define linux_syscall_sys_old_readdir TODO /* i386 arm mips m68k powerpc sh sparc */ +#define linux_syscall_sys_signal TODO /* i386 arm m68k microblaze parisc powerpc sh sparc s390 */ +#define linux_syscall_sys_old_getrlimit TODO /* i386 arm m68k powerpc sh */ +#define linux_syscall_sys_old_mmap TODO /* i386 arm m68k s390 */ +#define linux_syscall_sys_vm86 TODO /* i386 arm */ + +#define linux_syscall_sys_fstatfs64 TODO /* i386 mips m68k ia64 microblaze parisc powerpc sh sparc s390 alpha xtensa */ +#define linux_syscall_sys_statfs64 TODO /* i386 mips m68k ia64 microblaze parisc powerpc sh sparc s390 alpha xtensa */ +#define linux_syscall_sys_sigreturn TODO /* i386 mips m68k powerpc sh sparc s390 alpha */ +#define linux_syscall_compat_sys_getitimer TODO /* i386 mips parisc powerpc sparc s390 alpha */ +#define linux_syscall_compat_sys_setitimer TODO /* i386 mips parisc powerpc sparc s390 alpha */ +#define linux_syscall_compat_sys_epoll_pwait2 TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_fstatfs TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_fstatfs64 TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_getdents TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_getrlimit TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_getrusage TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_gettimeofday TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_io_pgetevents TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_keyctl TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_lookup_dcookie TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_mq_getsetattr TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_mq_open TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_msgctl TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_msgrcv TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_msgsnd TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_newfstat TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_newlstat TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_newstat TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_open TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_open_by_handle_at TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_openat TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_ppoll_time32 TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_ppoll_time64 TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_preadv TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_preadv2 TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_pselect6_time32 TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_pselect6_time64 TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_pwritev TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_pwritev2 TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_recvmmsg_time32 TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_rt_sigprocmask TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_rt_sigsuspend TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_rt_sigtimedwait_time32 TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_sched_getaffinity TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_sched_setaffinity TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_select TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_semctl TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_sendfile TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_setrlimit TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_settimeofday TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_shmat TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_shmctl TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_signalfd TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_sigpending TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_sigprocmask TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_statfs TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_statfs64 TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_sysinfo TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_times TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_ustat TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_wait4 TODO /* i386 mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_old_readdir TODO /* i386 mips powerpc sparc s390 */ +#define linux_syscall_compat_sys_signalfd4 TODO /* i386 mips powerpc sparc s390 */ +#define linux_syscall_compat_sys_ipc TODO /* i386 mips powerpc sparc */ +#define linux_syscall_compat_sys_socketcall TODO /* i386 mips powerpc s390 */ +#define linux_syscall_sys_setaltroot TODO /* i386 mips */ + +#define linux_syscall_compat_sys_lseek TODO /* i386 powerpc s390 parisc sparc */ +#define linux_syscall_compat_sys_sigaction TODO /* i386 powerpc s390 */ +#define linux_syscall_compat_sys_old_getrlimit TODO /* i386 powerpc s390 */ +#define linux_syscall_compat_sys_old_select TODO /* i386 powerpc */ +#define linux_syscall_sys_set_zone_reclaim TODO /* i386 microblaze */ +#define linux_syscall_sys_mmap_pgoff TODO /* i386 xtensa */ +#define linux_syscall_sys_ia32_fadvise64 TODO /* i386 */ +#define linux_syscall_sys_ia32_fadvise64_64 TODO /* i386 */ +#define linux_syscall_sys_ia32_fallocate TODO /* i386 */ +#define linux_syscall_sys_ia32_ftruncate64 TODO /* i386 */ +#define linux_syscall_sys_ia32_pread64 TODO /* i386 */ +#define linux_syscall_sys_ia32_pwrite64 TODO /* i386 */ +#define linux_syscall_sys_ia32_readahead TODO /* i386 */ +#define linux_syscall_sys_ia32_sync_file_range TODO /* i386 */ +#define linux_syscall_sys_ia32_truncate64 TODO /* i386 */ +#define linux_syscall_sys_vm86old TODO /* i386 */ +#define linux_syscall_compat_sys_ia32_clone TODO /* i386 */ +#define linux_syscall_compat_sys_ia32_fstat64 TODO /* i386 */ +#define linux_syscall_compat_sys_ia32_fstatat64 TODO /* i386 */ +#define linux_syscall_compat_sys_ia32_lstat64 TODO /* i386 */ +#define linux_syscall_compat_sys_ia32_mmap TODO /* i386 */ +#define linux_syscall_compat_sys_ia32_stat64 TODO /* i386 */ + +#define linux_syscall_compat_sys_preadv64 TODO /* x32 */ +#define linux_syscall_compat_sys_preadv64v2 TODO /* x32 */ +#define linux_syscall_compat_sys_pwritev64 TODO /* x32 */ +#define linux_syscall_compat_sys_pwritev64v2 TODO /* x32 */ + +#define linux_syscall_sys_idle XXX /* arm alpha */ +#define linux_syscall_sys_pciconfig_iobase XXX /* arm alpha powerpc */ +#define linux_syscall_sys_pciconfig_read TODO /* arm alpha powerpc sparc ia64 */ +#define linux_syscall_sys_pciconfig_write TODO /* arm alpha powerpc sparc ia64 */ +#define linux_syscall_sys_syscall XXX /* arm mips */ +#define linux_syscall_sys_mmap2 TODO /* arm microblaze parisc powerpc sparc ia64 m64k sh */ +#define linux_syscall_sys_rt_sigreturn_wrapper TODO /* arm microblaze parisc */ +#define linux_syscall_sys_afs_syscall XXX /* arm */ +#define linux_syscall_sys_arm_fadvise64_64 XXX /* arm */ +#define linux_syscall_sys_break XXX /* arm */ +#define linux_syscall_sys_fstatfs64_wrapper XXX /* arm */ +#define linux_syscall_sys_ftime XXX /* arm */ +#define linux_syscall_sys_gtty XXX /* arm */ +#define linux_syscall_sys_lock XXX /* arm */ +#define linux_syscall_sys_mpx XXX /* arm */ +#define linux_syscall_sys_oabi_bind XXX /* arm */ +#define linux_syscall_sys_oabi_connect XXX /* arm */ +#define linux_syscall_sys_oabi_epoll_ctl XXX /* arm */ +#define linux_syscall_sys_oabi_fcntl64 XXX /* arm */ +#define linux_syscall_sys_oabi_fstat64 XXX /* arm */ +#define linux_syscall_sys_oabi_fstatat64 XXX /* arm */ +#define linux_syscall_sys_oabi_ftruncate64 XXX /* arm */ +#define linux_syscall_sys_oabi_ipc XXX /* arm */ +#define linux_syscall_sys_oabi_lstat64 XXX /* arm */ +#define linux_syscall_sys_oabi_pread64 XXX /* arm */ +#define linux_syscall_sys_oabi_pwrite64 XXX /* arm */ +#define linux_syscall_sys_oabi_readahead XXX /* arm */ +#define linux_syscall_sys_oabi_semop XXX /* arm */ +#define linux_syscall_sys_oabi_semtimedop XXX /* arm */ +#define linux_syscall_sys_oabi_sendmsg XXX /* arm */ +#define linux_syscall_sys_oabi_sendto XXX /* arm */ +#define linux_syscall_sys_oabi_socketcall XXX /* arm */ +#define linux_syscall_sys_oabi_stat64 XXX /* arm */ +#define linux_syscall_sys_oabi_truncate64 XXX /* arm */ +#define linux_syscall_sys_prof XXX /* arm */ +#define linux_syscall_sys_profil XXX /* arm */ +#define linux_syscall_sys_sigreturn_wrapper XXX /* arm */ +#define linux_syscall_sys_statfs64_wrapper XXX /* arm */ +#define linux_syscall_sys_stty XXX /* arm */ +#define linux_syscall_sys_ulimit XXX /* arm */ + +#define linux_syscall_compat_sys_epoll_pwait TODO /* mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_fanotify_mark TODO /* mips parisc powerpc sparc s390 */ +#define linux_syscall_compat_sys_fcntl TODO /* mips parisc powerpc sparc s390 */ +#define linux_syscall_sys_cacheflush TODO /* mips parisc m68k sh */ +#define linux_syscall_sys32_rt_sigreturn TODO /* mips sparc */ +#define linux_syscall_sys32_sigreturn TODO /* mips sparc */ +#define linux_syscall_compat_sys_recv XXX /* mips powerpc */ +#define linux_syscall___sys_clone TODO /* mips m68k */ +#define linux_syscall___sys_clone3 TODO /* mips m68k */ +#define linux_syscall___sys_fork TODO /* mips m68k */ +#define linux_syscall___sys_sysmips XXX /* mips */ +#define linux_syscall_compat_sys_old_msgctl XXX /* mips */ +#define linux_syscall_compat_sys_old_semctl XXX /* mips */ +#define linux_syscall_compat_sys_old_shmctl XXX /* mips */ +#define linux_syscall_sys32_fadvise64_64 XXX /* mips */ +#define linux_syscall_sys32_fallocate XXX /* mips */ +#define linux_syscall_sys32_readahead XXX /* mips */ +#define linux_syscall_sys32_sigsuspend XXX /* mips */ +#define linux_syscall_sys32_sync_file_range XXX /* mips */ +#define linux_syscall_sys32_syscall XXX /* mips */ +#define linux_syscall_sys_32_ftruncate64 XXX /* mips */ +#define linux_syscall_sys_32_llseek XXX /* mips */ +#define linux_syscall_sys_32_personality XXX /* mips */ +#define linux_syscall_sys_32_pread XXX /* mips */ +#define linux_syscall_sys_32_pwrite XXX /* mips */ +#define linux_syscall_sys_32_sigaction XXX /* mips */ +#define linux_syscall_sys_32_truncate64 XXX /* mips */ +#define linux_syscall_sys_cachectl XXX /* mips */ +#define linux_syscall_sys_mips_mmap XXX /* mips */ +#define linux_syscall_sys_mips_mmap2 XXX /* mips */ +#define linux_syscall_sysm_pipe XXX /* mips */ +#define linux_syscall_sysn32_rt_sigreturn XXX /* mips */ + +#define linux_syscall_sys_stime TODO /* powerpc parisc sparc */ +#define linux_syscall_compat_sys_sendfile64 TODO /* powerpc parisc s390 */ +#define linux_syscall_compat_sys_fallocate TODO /* powerpc sparc */ + +#define linux_syscall_alpha_syscall_zero XXX /* alpha */ +#define linux_syscall_sys_getdtablesize XXX /* alpha */ +#define linux_syscall_sys_old_adjtimex XXX /* alpha */ +#define linux_syscall_sys_osf_fstat XXX /* alpha */ +#define linux_syscall_sys_osf_fstatfs XXX /* alpha */ +#define linux_syscall_sys_osf_fstatfs64 XXX /* alpha */ +#define linux_syscall_sys_osf_getdirentries XXX /* alpha */ +#define linux_syscall_sys_osf_getdomainname XXX /* alpha */ +#define linux_syscall_sys_osf_getpriority XXX /* alpha */ +#define linux_syscall_sys_osf_getrusage XXX /* alpha */ +#define linux_syscall_sys_osf_getsysinfo XXX /* alpha */ +#define linux_syscall_sys_osf_gettimeofday XXX /* alpha */ +#define linux_syscall_sys_osf_lstat XXX /* alpha */ +#define linux_syscall_sys_osf_mmap XXX /* alpha */ +#define linux_syscall_sys_osf_mount XXX /* alpha */ +#define linux_syscall_sys_osf_proplist_syscall XXX /* alpha */ +#define linux_syscall_sys_osf_select XXX /* alpha */ +#define linux_syscall_sys_osf_set_program_attributes XXX /* alpha */ +#define linux_syscall_sys_osf_setsysinfo XXX /* alpha */ +#define linux_syscall_sys_osf_settimeofday XXX /* alpha */ +#define linux_syscall_sys_osf_sigaction XXX /* alpha */ +#define linux_syscall_sys_osf_sigprocmask XXX /* alpha */ +#define linux_syscall_sys_osf_sigstack XXX /* alpha */ +#define linux_syscall_sys_osf_stat XXX /* alpha */ +#define linux_syscall_sys_osf_statfs XXX /* alpha */ +#define linux_syscall_sys_osf_statfs64 XXX /* alpha */ +#define linux_syscall_sys_osf_sysinfo XXX /* alpha */ +#define linux_syscall_sys_osf_usleep_thread XXX /* alpha */ +#define linux_syscall_sys_osf_utimes XXX /* alpha */ +#define linux_syscall_sys_osf_utsname XXX /* alpha */ +#define linux_syscall_sys_osf_wait4 XXX /* alpha */ +#define linux_syscall_sys_sethae XXX /* alpha */ /* return 0; see syscalls(2) */ + +#define linux_syscall_xtensa_fadvise64_64 XXX /* xtensa */ +#define linux_syscall_xtensa_rt_sigreturn XXX /* xtensa */ +#define linux_syscall_xtensa_shmat XXX /* xtensa */ + +#define linux_syscall_ia64_brk XXX /* ia64 */ +#define linux_syscall_ia64_clock_getres XXX /* ia64 */ +#define linux_syscall_ia64_execve XXX /* ia64 */ +#define linux_syscall_ia64_getpriority XXX /* ia64 */ +#define linux_syscall_ia64_mremap XXX /* ia64 */ +#define linux_syscall_sys_clone2 XXX /* ia64 */ +#define linux_syscall_sys_getunwind XXX /* ia64 */ + +#define linux_syscall_old_mmap XXX /* sh */ +#define linux_syscall_sys_fadvise64_64_wrapper XXX /* sh */ +#define linux_syscall_sys_pread_wrapper XXX /* sh */ +#define linux_syscall_sys_pwrite_wrapper XXX /* sh */ + +#define linux_syscall___sys_vfork TODO /* m68k */ +#define linux_syscall_sys_atomic_barrier TODO /* m68k */ +#define linux_syscall_sys_atomic_cmpxchg_32 TODO /* m68k */ + +#define linux_syscall_compat_sys_io_pgetevents_time64 TODO /* parisc */ +#define linux_syscall_parisc_compat_signalfd4 TODO /* parisc */ +#define linux_syscall_parisc_eventfd2 TODO /* parisc */ +#define linux_syscall_parisc_fadvise64_64 TODO /* parisc */ +#define linux_syscall_parisc_fallocate TODO /* parisc */ +#define linux_syscall_parisc_ftruncate64 TODO /* parisc */ +#define linux_syscall_parisc_inotify_init1 TODO /* parisc */ +#define linux_syscall_parisc_madvise TODO /* parisc */ +#define linux_syscall_parisc_personality TODO /* parisc */ +#define linux_syscall_parisc_pipe2 TODO /* parisc */ +#define linux_syscall_parisc_pread64 TODO /* parisc */ +#define linux_syscall_parisc_pwrite64 TODO /* parisc */ +#define linux_syscall_parisc_readahead TODO /* parisc */ +#define linux_syscall_parisc_signalfd4 TODO /* parisc */ +#define linux_syscall_parisc_sync_file_range TODO /* parisc */ +#define linux_syscall_parisc_timerfd_create TODO /* parisc */ +#define linux_syscall_parisc_truncate64 TODO /* parisc */ +#define linux_syscall_parisc_userfaultfd TODO /* parisc */ +#define linux_syscall_sys32_fanotify_mark TODO /* parisc */ +#define linux_syscall_sys32_unimplemented TODO /* parisc */ +#define linux_syscall_sys_acl_get TODO /* parisc */ +#define linux_syscall_sys_acl_set TODO /* parisc */ +#define linux_syscall_sys_alloc_hugepages TODO /* parisc */ +#define linux_syscall_sys_attrctl TODO /* parisc */ +#define linux_syscall_sys_clone3_wrapper TODO /* parisc */ +#define linux_syscall_sys_clone_wrapper TODO /* parisc */ +#define linux_syscall_sys_fork_wrapper TODO /* parisc */ +#define linux_syscall_sys_free_hugepages TODO /* parisc */ +#define linux_syscall_sys_timerfd TODO /* parisc */ +#define linux_syscall_sys_vfork_wrapper TODO /* parisc */ + +#define linux_syscall_compat_sys_fadvise64 TODO /* sparc */ +#define linux_syscall_compat_sys_fadvise64_64 TODO /* sparc */ +#define linux_syscall_compat_sys_fstat64 TODO /* sparc */ +#define linux_syscall_compat_sys_fstatat64 TODO /* sparc */ +#define linux_syscall_compat_sys_lstat64 TODO /* sparc */ +#define linux_syscall_compat_sys_pread64 TODO /* sparc */ +#define linux_syscall_compat_sys_pwrite64 TODO /* sparc */ +#define linux_syscall_compat_sys_readahead TODO /* sparc */ +#define linux_syscall_compat_sys_sparc_sigaction TODO /* sparc */ +#define linux_syscall_compat_sys_stat64 TODO /* sparc */ +#define linux_syscall_compat_sys_sync_file_range TODO /* sparc */ +#define linux_syscall_sparc_exit TODO /* sparc */ +#define linux_syscall_sparc_exit_group TODO /* sparc */ +#define linux_syscall_sunos_execv TODO /* sparc */ +#define linux_syscall_sys32_execve TODO /* sparc */ +#define linux_syscall_sys32_execveat TODO /* sparc */ +#define linux_syscall_sys32_mmap2 TODO /* sparc */ +#define linux_syscall_sys32_socketcall TODO /* sparc */ +#define linux_syscall_sys64_execve TODO /* sparc */ +#define linux_syscall_sys64_execveat TODO /* sparc */ +#define linux_syscall_sys_64_mremap TODO /* sparc */ +#define linux_syscall_sys_64_munmap TODO /* sparc */ +#define linux_syscall_sys_getdomainname TODO /* sparc */ +#define linux_syscall_sys_kern_features TODO /* sparc */ +#define linux_syscall_sys_memory_ordering TODO /* sparc */ +#define linux_syscall_sys_nis_syscall TODO /* sparc */ +#define linux_syscall_sys_sparc64_personality TODO /* sparc */ +#define linux_syscall_sys_sparc_adjtimex TODO /* sparc */ +#define linux_syscall_sys_sparc_clock_adjtime TODO /* sparc */ +#define linux_syscall_sys_sparc_ipc TODO /* sparc */ +#define linux_syscall_sys_sparc_pipe TODO /* sparc */ +#define linux_syscall_sys_sparc_remap_file_pages TODO /* sparc */ +#define linux_syscall_sys_sparc_sigaction TODO /* sparc */ +#define linux_syscall_sys_utrap_install TODO /* sparc */ + +#define linux_syscall_compat_sys_mmap2 XXX /* powerpc */ +#define linux_syscall_compat_sys_ppc32_fadvise64 XXX /* powerpc */ +#define linux_syscall_compat_sys_ppc64_personality XXX /* powerpc */ +#define linux_syscall_compat_sys_ppc_ftruncate64 XXX /* powerpc */ +#define linux_syscall_compat_sys_ppc_pread64 XXX /* powerpc */ +#define linux_syscall_compat_sys_ppc_pwrite64 XXX /* powerpc */ +#define linux_syscall_compat_sys_ppc_readahead XXX /* powerpc */ +#define linux_syscall_compat_sys_ppc_sync_file_range2 XXX /* powerpc */ +#define linux_syscall_compat_sys_ppc_truncate64 XXX /* powerpc */ +#define linux_syscall_compat_sys_swapcontext XXX /* powerpc */ +#define linux_syscall_sys_debug_setcontext XXX /* powerpc */ +#define linux_syscall_sys_ppc32_fadvise64 XXX /* powerpc */ +#define linux_syscall_sys_ppc64_personality XXX /* powerpc */ +#define linux_syscall_sys_ppc_fadvise64_64 XXX /* powerpc */ +#define linux_syscall_sys_ppc_fallocate XXX /* powerpc */ +#define linux_syscall_sys_ppc_ftruncate64 XXX /* powerpc */ +#define linux_syscall_sys_ppc_pread64 XXX /* powerpc */ +#define linux_syscall_sys_ppc_pwrite64 XXX /* powerpc */ +#define linux_syscall_sys_ppc_readahead XXX /* powerpc */ +#define linux_syscall_sys_ppc_sync_file_range2 XXX /* powerpc */ +#define linux_syscall_sys_ppc_truncate64 XXX /* powerpc */ +#define linux_syscall_sys_rtas XXX /* powerpc */ +#define linux_syscall_sys_spu_create XXX /* powerpc */ +#define linux_syscall_sys_spu_run XXX /* powerpc */ +#define linux_syscall_sys_subpage_prot XXX /* powerpc */ +#define linux_syscall_sys_swapcontext XXX /* powerpc */ +#define linux_syscall_sys_switch_endian XXX /* powerpc */ + +#define linux_syscall_compat_sys_s390_fadvise64 XXX /* s390 */ +#define linux_syscall_compat_sys_s390_fadvise64_64 XXX /* s390 */ +#define linux_syscall_compat_sys_s390_fallocate XXX /* s390 */ +#define linux_syscall_compat_sys_s390_fstat64 XXX /* s390 */ +#define linux_syscall_compat_sys_s390_fstatat64 XXX /* s390 */ +#define linux_syscall_compat_sys_s390_ftruncate64 XXX /* s390 */ +#define linux_syscall_compat_sys_s390_ipc XXX /* s390 */ +#define linux_syscall_compat_sys_s390_lstat64 XXX /* s390 */ +#define linux_syscall_compat_sys_s390_mmap2 XXX /* s390 */ +#define linux_syscall_compat_sys_s390_old_mmap XXX /* s390 */ +#define linux_syscall_compat_sys_s390_pread64 XXX /* s390 */ +#define linux_syscall_compat_sys_s390_pwrite64 XXX /* s390 */ +#define linux_syscall_compat_sys_s390_read XXX /* s390 */ +#define linux_syscall_compat_sys_s390_readahead XXX /* s390 */ +#define linux_syscall_compat_sys_s390_stat64 XXX /* s390 */ +#define linux_syscall_compat_sys_s390_sync_file_range XXX /* s390 */ +#define linux_syscall_compat_sys_s390_truncate64 XXX /* s390 */ +#define linux_syscall_compat_sys_s390_write XXX /* s390 */ +#define linux_syscall_sys__sysctl XXX /* s390 */ +#define linux_syscall_sys_getpmsg XXX /* s390 */ +#define linux_syscall_sys_putpmsg XXX /* s390 */ +#define linux_syscall_sys_s390_guarded_storage XXX /* s390 */ +#define linux_syscall_sys_s390_ipc XXX /* s390 */ +#define linux_syscall_sys_s390_pci_mmio_read XXX /* s390 */ +#define linux_syscall_sys_s390_pci_mmio_write XXX /* s390 */ +#define linux_syscall_sys_s390_personality XXX /* s390 */ +#define linux_syscall_sys_s390_runtime_instr XXX /* s390 */ +#define linux_syscall_sys_s390_sthyi XXX /* s390 */ + +#if defined(__clang__) +# pragma clang diagnostic pop +#else +# pragma GCC diagnostic pop +#endif + + +#endif /* !SYMBOL_PRINTERS_ONLY */ diff --git a/linux/syscalls.mk b/linux/syscalls.mk new file mode 100644 index 0000000..7c13441 --- /dev/null +++ b/linux/syscalls.mk @@ -0,0 +1,450 @@ +LINUX_SYSCALL_DIR = linux-src/syscalls-$(LINUX_VERSION) + +LINUX_SYSCALLS_ARCH_TBL_SPLIT_X64 != printf '$(LINUX_SYSCALL_DIR)/%s.tbl\n' amd64 x86 +LINUX_SYSCALLS_ARCH_TBL_SPLIT_MIPS != printf '$(LINUX_SYSCALL_DIR)/%s.tbl\n' mips-n32 mips-o32 mips-n64 + +LINUX_SYSCALLS_ARCHES_SPLIT != grep '^LINUX_SYSCALLS_ARCH_TBL_SPLIT_' < linux/syscalls.mk | cut -d \% -f 2 | cut -d ' ' -f 2- +LINUX_SYSCALLS_ARCHES_SIMPLE != (sed -n 's/^generated\/linux-syscalls-\([a-zA-Z0-9_-]\+\)\.h\s*:.*$$/\1/p' && \ + printf '%s\n' $(LINUX_SYSCALLS_ARCHES_SPLIT)) < linux/syscalls.mk | sort | uniq -u +LINUX_SYSCALLS_ARCHES = $(LINUX_SYSCALLS_ARCHES_SIMPLE) $(LINUX_SYSCALLS_ARCHES_SPLIT) +LINUX_SYSCALLS_ARCH_HDR != printf 'generated/linux-syscalls-%s.h\n' $(LINUX_SYSCALLS_ARCHES) +LINUX_SYSCALLS_ARCH_TBL_SIMPLE != printf '$(LINUX_SYSCALL_DIR)/%s.tbl\n' $(LINUX_SYSCALLS_ARCHES_SIMPLE) +LINUX_SYSCALLS_ARCH_TBL_SPLIT != printf '$(LINUX_SYSCALL_DIR)/%s.tbl\n' $(LINUX_SYSCALLS_ARCHES_SPLIT) +LINUX_SYSCALLS_ARCH_TBL = $(LINUX_SYSCALLS_ARCH_TBL_SIMPLE) $(LINUX_SYSCALLS_ARCH_TBL_SPLIT) + +LINUX_SYSCALLS_HDR =\ + generated/linux-syscalls.h\ + generated/linux-syscall-ranges.h\ + $(LINUX_SYSCALLS_ARCH_HDR) + + +generated/linux-syscalls-alpha.h: $(LINUX_SYSCALL_DIR)/alpha.tbl linux/syscalls.mk + mkdir -p -- generated + printf '\43define LIST_LINUX_SYSCALLS_FOR_ALPHA(X, _X_COMPAT, D)\\\n' > $@ + printf '%i common %s %s\n' \ + 320 idle sys_idle \ + | cat -- $(LINUX_SYSCALL_DIR)/alpha.tbl - \ + | sed '/^\s*\(\x23.*\)\?$$/d' \ + | awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\"}' \ + | sed '$$s/ D\\$$//' >> $@ + test "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/alpha.tbl | awk '{ print $$2 }')" = \ + "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/alpha.tbl | awk '{ print $$2 }' | grep '^common$$')" + + +$(LINUX_SYSCALL_DIR)/amd64.tbl.fixed: $(LINUX_SYSCALL_DIR)/amd64.tbl linux/syscalls.mk + cat -- $(LINUX_SYSCALL_DIR)/amd64.tbl \ + | sed 's/\s\+\(getpmsg\|putpmsg\|afs_syscall\|tuxcall\|security\|vserver\)\s*$$/& sys_ni_syscall/' \ + | sed 's/^\s*[0-9]\+\s\+[a-z0-9]\+\s\+\([A-Za-z0-9_]\+\)\s*$$/& sys_\1/' \ + > $@ + +generated/linux-syscalls-amd64.h: $(LINUX_SYSCALL_DIR)/amd64.tbl.fixed linux/syscalls.mk + mkdir -p -- generated + printf '\43define LIST_LINUX_SYSCALLS_FOR_AMD64(X, _X_COMPAT, D)\\\n' > $@ + cat -- $(LINUX_SYSCALL_DIR)/amd64.tbl.fixed \ + | sed '/^\s*\(\x23.*\)\?$$/d' \ + | awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\" $$2}' \ + | sed -n 's/\\\(common\|64\)$$/\\/p' \ + | sed '$$s/ D\\$$//' >> $@ + printf '\n\43define LIST_LINUX_SYSCALLS_FOR_AMD64_X32(X, _X_COMPAT, D)\\\n' >> $@ + cat -- $(LINUX_SYSCALL_DIR)/amd64.tbl.fixed \ + | sed '/^\s*\(\x23.*\)\?$$/d' \ + | awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\" $$2}' \ + | sed -n 's/\\\(common\|x32\)$$/\\/p' \ + | sed '$$s/ D\\$$//' >> $@ + test "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/amd64.tbl.fixed | awk '{ print $$2 }')" = \ + "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/amd64.tbl.fixed | awk '{ print $$2 }' | \ + grep '^\(common\|64\|x32\)$$')" + + +$(LINUX_SYSCALL_DIR)/arm.tbl.fixed: $(LINUX_SYSCALL_DIR)/arm.tbl linux/syscalls.mk + printf '%i common %s %s\n' \ + 7 waitpid sys_waitpid \ + 17 break sys_break \ + 18 old_stat sys_stat \ + 28 old_fstat sys_fstat \ + 31 stty sys_stty \ + 32 gtty sys_gtty \ + 35 ftime sys_ftime \ + 44 prof sys_prof \ + 48 signal sys_signal \ + 53 lock sys_lock \ + 56 mpx sys_mpx \ + 58 ulimit sys_ulimit \ + 59 oldolduname sys_olduname \ + 68 sgetmask sys_sgetmask \ + 69 ssetmask sys_ssetmask \ + 84 old_lstat sys_lstat \ + 98 profil sys_profil \ + 101 ioperm sys_ioperm \ + 109 olduname sys_uname \ + 110 iopl sys_iopl \ + 112 idle sys_idle \ + 123 modify_ldt sys_modify_ldt \ + 127 create_module sys_create_module \ + 130 get_kernel_syms sys_get_kernel_syms \ + 137 afs_syscall sys_afs_syscall \ + 166 vm86 sys_vm86 \ + 167 query_module sys_query_module \ + | cat -- $(LINUX_SYSCALL_DIR)/arm.tbl - \ + | sed 's/\svserver\s*$$/& sys_ni_syscall/' \ + | sed 's/\snfsservctl\s*$$/& sys_nfsservctl/' \ + > $@ + +generated/linux-syscalls-arm.h: $(LINUX_SYSCALL_DIR)/arm.tbl.fixed linux/syscalls.mk + mkdir -p -- generated + printf '\43define LIST_LINUX_SYSCALLS_FOR_ARM_EABI(X, _X_COMPAT, D)\\\n' > $@ + cat -- $(LINUX_SYSCALL_DIR)/arm.tbl.fixed \ + | sed '/^\s*\(\x23.*\)\?$$/d' \ + | awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\" $$2}' \ + | sed -n 's/\\\(common\|eabi\)$$/\\/p' \ + | sed '$$s/ D\\$$//' >> $@ + printf '\n\43define LIST_LINUX_SYSCALLS_FOR_ARM_OABI(X, X_COMPAT, D)\\\n' >> $@ + cat -- $(LINUX_SYSCALL_DIR)/arm.tbl.fixed \ + | sed '/^\s*\(\x23.*\)\?$$/d' \ + | awk '{ print "\tX_COMPAT(" $$1 ", " $$3 ", " $$4 ", " $$5 ") D\\" $$2}' \ + | sed -n 's/\\\(common\|oabi\)$$/\\/p' \ + | sed 's/X_COMPAT(\(.*\), ) D\\$$/X(\1) D\\/' \ + | sed '$$s/ D\\$$//' >> $@ + test "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/arm.tbl.fixed | awk '{ print $$2 }')" = \ + "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/arm.tbl.fixed | awk '{ print $$2 }' | \ + grep '^\(common\|oabi\|eabi\)$$')" + + +generated/linux-syscalls-ia64.h: $(LINUX_SYSCALL_DIR)/ia64.tbl linux/syscalls.mk + mkdir -p -- generated + printf '\43define LIST_LINUX_SYSCALLS_FOR_IA64(X, _X_COMPAT, D)\\\n' > $@ + printf '%i common %s %s\n' \ + $$(( 1120 - 1024 )) old_stat sys_stat \ + $$(( 1121 - 1024 )) old_lstat sys_lstat \ + $$(( 1122 - 1024 )) old_fstat sys_fstat \ + $$(( 1132 - 1024 )) create_module sys_create_module \ + $$(( 1135 - 1024 )) get_kernel_syms sys_get_kernel_syms \ + $$(( 1136 - 1024 )) query_module sys_query_module \ + | cat -- $(LINUX_SYSCALL_DIR)/ia64.tbl - \ + | sed '/^\s*\(\x23.*\)\?$$/d' \ + | awk '{ print "\tX((" $$1 " + 1024), " $$3 ", " $$4 ") D\\"}' \ + | sed '$$s/ D\\$$//' >> $@ + test "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/ia64.tbl | awk '{ print $$2 }')" = \ + "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/ia64.tbl | awk '{ print $$2 }' | grep '^common$$')" + + +generated/linux-syscalls-m68k.h: $(LINUX_SYSCALL_DIR)/m68k.tbl linux/syscalls.mk + mkdir -p -- generated + printf '\43define LIST_LINUX_SYSCALLS_FOR_M68K(X, _X_COMPAT, D)\\\n' > $@ + printf '%i common %s %s\n' \ + 17 break sys_ni_syscall \ + 31 stty sys_ni_syscall \ + 32 gtty sys_ni_syscall \ + 35 ftime sys_ni_syscall \ + 44 prof sys_ni_syscall \ + 53 lock sys_ni_syscall \ + 56 mpx sys_ni_syscall \ + 58 ulimit sys_ni_syscall \ + 59 oldolduname sys_olduname \ + 98 profil sys_ni_syscall \ + 101 ioperm sys_ioperm \ + 109 olduname sys_uname \ + 110 iopl sys_iopl \ + 112 idle sys_idle \ + 113 vm86 sys_vm86 \ + 137 afs_syscall sys_ni_syscall \ + 278 vserver sys_ni_syscall \ + | cat -- $(LINUX_SYSCALL_DIR)/m68k.tbl - \ + | sed '/^\s*\(\x23.*\)\?$$/d' \ + | awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\"}' \ + | sed '$$s/ D\\$$//' >> $@ + test "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/m68k.tbl | awk '{ print $$2 }')" = \ + "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/m68k.tbl | awk '{ print $$2 }' | grep '^common$$')" + + +generated/linux-syscalls-microblaze.h: $(LINUX_SYSCALL_DIR)/microblaze.tbl linux/syscalls.mk + mkdir -p -- generated + printf '\43define LIST_LINUX_SYSCALLS_FOR_MICROBLAZE(X, _X_COMPAT, D)\\\n' > $@ + printf '%i common %s %s\n' \ + 251 set_zone_reclaim sys_set_zone_reclaim \ + 285 setaltroot sys_setaltroot \ + | cat -- $(LINUX_SYSCALL_DIR)/microblaze.tbl - \ + | sed '/^\s*\(\x23.*\)\?$$/d' \ + | awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\"}' \ + | sed '$$s/ D\\$$//' >> $@ + test "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/microblaze.tbl | awk '{ print $$2 }')" = \ + "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/microblaze.tbl | awk '{ print $$2 }' | grep '^common$$')" + + +generated/linux-syscalls-mips-n32.h: $(LINUX_SYSCALL_DIR)/mips-n32.tbl linux/syscalls.mk + mkdir -p -- generated + printf '\43define LIST_LINUX_SYSCALLS_FOR_MIPS_N32(X, _X_COMPAT, D)\\\n' > $@ + printf '%i common %s %s\n' \ + 242 setaltroot sys_setaltroot \ + | cat -- $(LINUX_SYSCALL_DIR)/mips-n32.tbl - \ + | sed '/^\s*\(\x23.*\)\?$$/d' \ + | awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\"}' \ + | sed '$$s/ D\\$$//' >> $@ + test "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/mips-n32.tbl | awk '{ print $$2 }')" = \ + "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/mips-n32.tbl | awk '{ print $$2 }' | grep '^n32$$')" + + +generated/linux-syscalls-mips-n64.h: $(LINUX_SYSCALL_DIR)/mips-n64.tbl linux/syscalls.mk + mkdir -p -- generated + printf '\43define LIST_LINUX_SYSCALLS_FOR_MIPS_N64(X, _X_COMPAT, D)\\\n' > $@ + printf '%i common %s %s\n' \ + 238 setaltroot sys_setaltroot \ + | cat -- $(LINUX_SYSCALL_DIR)/mips-n64.tbl - \ + | sed '/^\s*\(\x23.*\)\?$$/d' \ + | awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\"}' \ + | sed '$$s/ D\\$$//' >> $@ + test "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/mips-n64.tbl | awk '{ print $$2 }')" = \ + "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/mips-n64.tbl | awk '{ print $$2 }' | \ + grep '^\(n64\|common\)$$')" + + +generated/linux-syscalls-mips-o32.h: $(LINUX_SYSCALL_DIR)/mips-o32.tbl linux/syscalls.mk + mkdir -p -- generated + printf '\43define LIST_LINUX_SYSCALLS_FOR_MIPS_O32(X, X_COMPAT, D)\\\n' > $@ + printf '%i common %s %s\n' \ + 18 old_stat sys_stat \ + 28 old_fstat sys_fstat \ + 82 select sys_old_select \ + 84 old_lstat sys_lstat \ + 279 setaltroot sys_setaltroot \ + | cat -- $(LINUX_SYSCALL_DIR)/mips-o32.tbl - \ + | sed '/^\s*\(18\|28\|82\|84\)\s\+o32.*$$/d' \ + | sed '/^\s*\(\x23.*\)\?$$/d' \ + | awk '{ print "\tX_COMPAT(" $$1 ", " $$3 ", " $$4 ", " $$5 ") D\\"}' \ + | sed 's/X_COMPAT(\(.*\), ) D\\$$/X(\1) D\\/' \ + | sed '$$s/ D\\$$//' >> $@ + test "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/mips-o32.tbl | awk '{ print $$2 }')" = \ + "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/mips-o32.tbl | awk '{ print $$2 }' | grep '^o32$$')" + + +$(LINUX_SYSCALL_DIR)/parisc.tbl.fixed: $(LINUX_SYSCALL_DIR)/parisc.tbl linux/syscalls.mk + printf '%i common %s %s\n' \ + 102 socketcall sys_socketcall \ + 127 create_module sys_create_module \ + 130 get_kernel_syms sys_get_kernel_syms \ + 137 afs_syscall sys_ni_syscall \ + 167 query_module sys_query_module \ + 169 nfsservctl sys_nfsservctl \ + 196 getpmsg sys_ni_syscall \ + 197 putpmsg sys_ni_syscall \ + 203 attrctl sys_attrctl \ + 204 acl_get sys_acl_get \ + 205 acl_set sys_acl_set \ + 213 set_thread_area sys_set_thread_area \ + 214 get_thread_area sys_get_thread_area \ + 220 alloc_hugepages sys_alloc_hugepages \ + 221 free_hugepages sys_free_hugepages \ + 263 vserver sys_ni_syscall \ + 303 timerfd sys_timerfd \ + | cat -- $(LINUX_SYSCALL_DIR)/parisc.tbl - > $@ + +generated/linux-syscalls-parisc.h: $(LINUX_SYSCALL_DIR)/parisc.tbl.fixed linux/syscalls.mk + mkdir -p -- generated + printf '\43define LIST_LINUX_SYSCALLS_FOR_PARISC_64(X, _X_COMPAT, D)\\\n' > $@ + cat -- $(LINUX_SYSCALL_DIR)/parisc.tbl.fixed \ + | sed '/^\s*\(\x23.*\)\?$$/d' \ + | awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\" $$2}' \ + | sed -n 's/\\\(common\|64\)$$/\\/p' \ + | sed '$$s/ D\\$$//' >> $@ + printf '\n\43define LIST_LINUX_SYSCALLS_FOR_PARISC_32(X, X_COMPAT, D)\\\n' >> $@ + cat -- $(LINUX_SYSCALL_DIR)/parisc.tbl.fixed \ + | sed '/^\s*\(\x23.*\)\?$$/d' \ + | awk '{ print "\tX_COMPAT(" $$1 ", " $$3 ", " $$4 ", " $$5 ") D\\" $$2}' \ + | sed -n 's/\\\(common\|32\)$$/\\/p' \ + | sed 's/X_COMPAT(\(.*\), ) D\\$$/X(\1) D\\/' \ + | sed '$$s/ D\\$$//' >> $@ + test "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/parisc.tbl.fixed | awk '{ print $$2 }')" = \ + "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/parisc.tbl.fixed | awk '{ print $$2 }' | \ + grep '^\(common\|64\|32\)$$')" + + +generated/linux-syscalls-powerpc.h: $(LINUX_SYSCALL_DIR)/powerpc.tbl linux/syscalls.mk + mkdir -p -- generated + printf '\43define LIST_LINUX_SYSCALLS_FOR_POWERPC_32(X, X_COMPAT, D)\\\n' > $@ + cat -- $(LINUX_SYSCALL_DIR)/powerpc.tbl \ + | sed '/^\s*\(\x23.*\)\?$$/d' \ + | awk '{ print "\tX_COMPAT(" $$1 ", " $$3 ", " $$4 ", " $$5 ") D\\" $$2}' \ + | sed -n 's/\\\(common\|32\)$$/\\/p' \ + | sed 's/X_COMPAT(\(.*\), ) D\\$$/X(\1) D\\/' \ + | sed '$$s/ D\\$$//' >> $@ + printf '\n\43define LIST_LINUX_SYSCALLS_FOR_POWERPC_NOSPU(X, X_COMPAT, D)\\\n' >> $@ + cat -- $(LINUX_SYSCALL_DIR)/powerpc.tbl \ + | sed '/^\s*\(\x23.*\)\?$$/d' \ + | awk '{ print "\tX_COMPAT(" $$1 ", " $$3 ", " $$4 ", " $$5 ") D\\" $$2}' \ + | sed -n 's/\\\(common\|nospu\)$$/\\/p' \ + | sed 's/X_COMPAT(\(.*\), ) D\\$$/X(\1) D\\/' \ + | sed '$$s/ D\\$$//' >> $@ + printf '\n\43define LIST_LINUX_SYSCALLS_FOR_POWERPC_64(X, _X_COMPAT, D)\\\n' >> $@ + cat -- $(LINUX_SYSCALL_DIR)/powerpc.tbl \ + | sed '/^\s*\(\x23.*\)\?$$/d' \ + | awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\" $$2}' \ + | sed -n 's/\\\(common\|64\)$$/\\/p' \ + | sed '$$s/ D\\$$//' >> $@ + printf '\n\43define LIST_LINUX_SYSCALLS_FOR_POWERPC_SPU(X, _X_COMPAT, D)\\\n' >> $@ + cat -- $(LINUX_SYSCALL_DIR)/powerpc.tbl \ + | sed '/^\s*\(\x23.*\)\?$$/d' \ + | awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\" $$2}' \ + | sed -n 's/\\\(common\|spu\)$$/\\/p' \ + | sed '$$s/ D\\$$//' >> $@ + test "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/powerpc.tbl | awk '{ print $$2 }')" = \ + "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/powerpc.tbl | awk '{ print $$2 }' | \ + grep '^\(common\|spu\|nospu\|64\|32\)$$')" + + +generated/linux-syscalls-s390.h: $(LINUX_SYSCALL_DIR)/s390.tbl linux/syscalls.mk + mkdir -p -- generated + printf '\43define LIST_LINUX_SYSCALLS_FOR_S390_32(X, _X_COMPAT, D)\\\n' > $@ + cat -- $(LINUX_SYSCALL_DIR)/s390.tbl \ + | sed '/^\s*\(\x23.*\)\?$$/d' \ + | sed 's/^\s*\([0-9]\+\)\s\+\([A-Za-z0-9_]\+\)\s\+\([A-Za-z0-9_]\+\)\s\+-\s\+-\s*$$/\1 \2 \3 sys_\3 sys_\3/' \ + | awk '{ print "\tX(" $$1 ", " $$3 ", " $$5 ") D\\" $$2}' \ + | sed -n 's/\\\(common\|32\)$$/\\/p' \ + | sed '$$s/ D\\$$//' >> $@ + printf '\n\43define LIST_LINUX_SYSCALLS_FOR_S390_64(X, _X_COMPAT, D)\\\n' >> $@ + cat -- $(LINUX_SYSCALL_DIR)/s390.tbl \ + | sed '/^\s*\(\x23.*\)\?$$/d' \ + | sed 's/^\s*\([0-9]\+\)\s\+\([A-Za-z0-9_]\+\)\s\+\([A-Za-z0-9_]\+\)\s\+-\s\+-\s*$$/\1 \2 \3 sys_\3 sys_\3/' \ + | sed 's/^\s*\(89\)\s\+\(common\)\s\+\(readdir\)\s\+-\s\+/\1 \2 \3 sys_old_readdir /' \ + | awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\" $$2}' \ + | sed -n 's/\\\(common\|64\)$$/\\/p' \ + | sed '$$s/ D\\$$//' >> $@ + test "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/s390.tbl | awk '{ print $$2 }')" = \ + "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/s390.tbl | awk '{ print $$2 }' | \ + grep '^\(common\|32\|64\)$$')" + + +generated/linux-syscalls-sh.h: $(LINUX_SYSCALL_DIR)/sh.tbl linux/syscalls.mk + mkdir -p -- generated + printf '\43define LIST_LINUX_SYSCALLS_FOR_SH(X, _X_COMPAT, D)\\\n' > $@ + printf '%i common %s %s\n' \ + 17 break sys_ni_syscall \ + 31 stty sys_ni_syscall \ + 32 gtty sys_ni_syscall \ + 35 ftime sys_ni_syscall \ + 44 prof sys_ni_syscall \ + 53 lock sys_ni_syscall \ + 56 mpx sys_ni_syscall \ + 58 ulimit sys_ni_syscall \ + 59 oldolduname sys_olduname \ + 82 select sys_old_select \ + 98 profil sys_ni_syscall \ + 101 ioperm sys_ioperm \ + 110 iopl sys_iopl \ + 112 idle sys_idle \ + 113 vm86old sys_vm86old \ + 127 create_module sys_create_module \ + 130 get_kernel_syms sys_get_kernel_syms \ + 137 afs_syscall sys_ni_syscall \ + 166 vm86 sys_vm86 \ + 167 query_module sys_query_module \ + | cat -- $(LINUX_SYSCALL_DIR)/sh.tbl - \ + | sed '/^\s*\(\x23.*\)\?$$/d' \ + | awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\"}' \ + | sed '$$s/ D\\$$//' >> $@ + test "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/sh.tbl | awk '{ print $$2 }')" = \ + "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/sh.tbl | awk '{ print $$2 }' | grep '^common$$')" + + +generated/linux-syscalls-sparc.h: $(LINUX_SYSCALL_DIR)/sparc.tbl linux/syscalls.mk + mkdir -p -- generated + printf '\43define LIST_LINUX_SYSCALLS_FOR_SPARC_32(X, X_COMPAT, D)\\\n' > $@ + printf '%i common %s %s\n' \ + 267 vserver sys_vserver \ + | cat -- $(LINUX_SYSCALL_DIR)/sparc.tbl - \ + | sed 's/compat_sys_\(truncate64\|ftruncate64\)/sparc___&/g' \ + | sed '/^\s*267\s\+common\s\+vserver\s\+.*$$/d' \ + | sed '/^\s*\(\x23.*\)\?$$/d' \ + | awk '{ print "\tX_COMPAT(" $$1 ", " $$3 ", " $$4 ", " $$5 ") D\\" $$2}' \ + | sed -n 's/\\\(common\|32\)$$/\\/p' \ + | sed 's/X_COMPAT(\(.*\), ) D\\$$/X(\1) D\\/' \ + | sed '$$s/ D\\$$//' >> $@ + printf '\n\43define LIST_LINUX_SYSCALLS_FOR_SPARC_64(X, _X_COMPAT, D)\\\n' >> $@ + printf '%i common %s %s\n' \ + 267 vserver sys_vserver \ + | cat -- $(LINUX_SYSCALL_DIR)/sparc.tbl - \ + | sed '/^\s*267\s\+common\s\+vserver\s\+.*$$/d' \ + | sed '/^\s*\(\x23.*\)\?$$/d' \ + | awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\" $$2}' \ + | sed -n 's/\\\(common\|64\)$$/\\/p' \ + | sed '$$s/ D\\$$//' >> $@ + test "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/sparc.tbl | awk '{ print $$2 }')" = \ + "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/sparc.tbl | awk '{ print $$2 }' | \ + grep '^\(common\|32\|64\)$$')" + + +generated/linux-syscalls-x86.h: $(LINUX_SYSCALL_DIR)/x86.tbl linux/syscalls.mk + mkdir -p -- generated + printf '\43define LIST_LINUX_SYSCALLS_FOR_I386(X, X_COMPAT, D)\\\n' > $@ + printf '%i common %s %s\n' \ + 251 set_zone_reclaim sys_set_zone_reclaim \ + 285 setaltroot sys_setaltroot \ + | cat -- $(LINUX_SYSCALL_DIR)/x86.tbl - \ + | sed 's/\s\+\(break\|stty\|gtty\|ftime\|prof\|lock\|mpx\|ulimit\|profil\|idle\|afs_syscall\|getpmsg\|putpmsg\|vserver\)\s*$$/& sys_ni_syscall/' \ + | sed 's/^\s*[0-9]\+\s\+[a-z0-9]\+\s\+\([A-Za-z0-9_]\+\)\s*$$/& sys_\1/' \ + | sed '/^\s*\(\x23.*\)\?$$/d' \ + | awk '{ print "\tX_COMPAT(" $$1 ", " $$3 ", " $$4 ", " $$5 ") D\\"}' \ + | sed 's/X_COMPAT(\(.*\), ) D\\$$/X(\1) D\\/' \ + | sed '$$s/ D\\$$//' >> $@ + test "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/x86.tbl | awk '{ print $$2 }')" = \ + "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/x86.tbl | awk '{ print $$2 }' | grep '^i386$$')" + + +generated/linux-syscalls-xtensa.h: $(LINUX_SYSCALL_DIR)/xtensa.tbl linux/syscalls.mk + mkdir -p -- generated + printf '\43define LIST_LINUX_SYSCALLS_FOR_XTENSA(X, _X_COMPAT, D)\\\n' > $@ + printf '%i common %s %s\n' \ + 305 timerfd sys_timerfd \ + | cat -- $(LINUX_SYSCALL_DIR)/xtensa.tbl - \ + | sed 's/reserved152\s\+sys_ni_syscall/set_thread_area sys_set_thread_area/' \ + | sed 's/reserved153\s\+sys_ni_syscall/get_thread_area sys_get_thread_area/' \ + | sed 's/nfsservctl\s\+sys_ni_syscall/nfsservctl sys_nfsservctl/' \ + | sed '/^\s*\(\x23.*\)\?$$/d' \ + | awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\"}' \ + | sed '$$s/ D\\$$//' >> $@ + test "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/xtensa.tbl | awk '{ print $$2 }')" = \ + "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/xtensa.tbl | awk '{ print $$2 }' | grep '^common$$')" + + +$(LINUX_SYSCALLS_ARCH_TBL_SIMPLE): $(LINUX_SOURCE) linux/syscalls.mk + mkdir -p -- $(LINUX_SYSCALL_DIR) + arch="$$(printf '%s\n' "$(@F)" | cut -d . -f 1)"; \ + if test "$$arch" = arm; then \ + printf '%s\n' "ln -sf -- ../tools $(LINUX_DIR)/arch/$$arch/kernel/syscalls" && \ + ln -sf -- ../tools $(LINUX_DIR)/arch/$$arch/kernel/syscalls || exit 1; \ + fi && \ + printf '%s\n' "cp -- $(LINUX_DIR)/arch/$$arch/kernel/syscalls/syscall.tbl $@" && \ + cp -- $(LINUX_DIR)/arch/$$arch/kernel/syscalls/syscall.tbl $@ + +$(LINUX_SYSCALLS_ARCH_TBL_SPLIT_X64): $(LINUX_SOURCE) linux/syscalls.mk + mkdir -p -- $(LINUX_SYSCALL_DIR) + test -e $(LINUX_DIR)/arch/x86/kernel/syscalls || \ + ln -sf -- ../entry/syscalls $(LINUX_DIR)/arch/x86/kernel/syscalls + cp -- $(LINUX_DIR)/arch/x86/kernel/syscalls/syscall_32.tbl $(LINUX_SYSCALL_DIR)/x86.tbl + cp -- $(LINUX_DIR)/arch/x86/kernel/syscalls/syscall_64.tbl $(LINUX_SYSCALL_DIR)/amd64.tbl + +$(LINUX_SYSCALLS_ARCH_TBL_SPLIT_MIPS): $(LINUX_SOURCE) linux/syscalls.mk + mkdir -p -- $(LINUX_SYSCALL_DIR) + cp -- $(LINUX_DIR)/arch/mips/kernel/syscalls/syscall_n32.tbl $(LINUX_SYSCALL_DIR)/mips-n32.tbl + cp -- $(LINUX_DIR)/arch/mips/kernel/syscalls/syscall_o32.tbl $(LINUX_SYSCALL_DIR)/mips-o32.tbl + cp -- $(LINUX_DIR)/arch/mips/kernel/syscalls/syscall_n64.tbl $(LINUX_SYSCALL_DIR)/mips-n64.tbl + + +generated/linux-syscall-dedup.h: $(HDR) $(LINUX_SYSCALLS_HDR) linux/syscalls.h linux/syscall-table.c linux/syscalls.mk + mkdir -p -- generated + cpp -DCREATING_DEDUP_TABLE linux/syscall-table.c \ + | grep -v '^#' \ + | tr '\n;\t' ' \n ' \ + | sed -n 's/^.* libsyscalls_syscall \+\(linux_[A-Z0-9a-z_]\+_syscall_[A-Z0-9a-z_]\+.*\)$$/\1/p' \ + | tr -d ' ' \ + | sed 's/=/ /' \ + | sort -k 2 \ + | (set -e; master=; mastertext=; \ + while read slave slavetext; do \ + if test "$$slavetext" = "$$mastertext"; then \ + printf '#define %s %s\n' "$$slave" "$$master"; \ + else \ + master="$$slave"; \ + mastertext="$$slavetext"; \ + fi; \ + done \ + ) > $@ diff --git a/linux/types.c b/linux/types.c new file mode 100644 index 0000000..fee69fe --- /dev/null +++ b/linux/types.c @@ -0,0 +1,54 @@ +/* See LICENSE file for copyright and license details. */ + +/* This file is included from ../libsyscalls_get_datatype_description.c */ + + +/* If new architectures are added, the table at the top of + * ../libsyscalls_get_datatype_description.c must be updated */ + + +static enum libsyscalls_error +get_linux_datatype_description(enum libsyscalls_arch arch, enum libsyscalls_datatype *datatype, + struct libsyscalls_datatype_description *description_out, + int *divide_array_size_with_type_size_out) +{ + /* + * Generally Linux has char as 8 bit, short int as 16, int as 32 bit, + * and long long int as 64 bit (it's code even make such assumptions), + * however that's is not necessarily the case for more exotic + * architectures, for example, some specialised processors have 16 bit + * chars and run Linux (although not mainline). Linux also used + * long int for addresses (intptr_t), which is normally how it should + * be done but Windows always set long int to 32 bit (at least on x86/amd64) + * for backwards compatibility, and of course it cannot be assumed that + * Linux does something similar this for some architecture in the future + * (although that looks very unlikely, at least 32+-bit architecture, + * it is of course possible that if Linux is ported to a 16-bit architecture, + * intptr_t would be 16 bits, and thus long int must be something else + * as it must be at least 32 bits). It's probably safe to assume, + * system calls use intptr_t/uintptr_t. + */ + + switch ((int)*datatype) { + case LIBSYSCALLS_TYPE_SCHAR: description_out->width_in_bits = 8; break; + case LIBSYSCALLS_TYPE_SHORT: description_out->width_in_bits = 16; break; + case LIBSYSCALLS_TYPE_INT: description_out->width_in_bits = 32; break; + case LIBSYSCALLS_TYPE_LLONG: description_out->width_in_bits = 64; break; + + case LIBSYSCALLS_TYPE_LONG: + case LIBSYSCALLS_TYPE_DYNAMIC: /* syscall */ + *datatype = LIBSYSCALLS_TYPE_INTPTR; + break; + + case LIBSYSCALLS_TYPE_FD_SET: + *datatype = LIBSYSCALLS_TYPE_INTPTR; + description_out->array_size = 1024; + *divide_array_size_with_type_size_out = 1; + break; + + default: + /* something only defined on some other operating system */ + return LIBSYSCALLS_E_NOSUCHTYPE; + } + return LIBSYSCALLS_E_OK; +} diff --git a/linux/types.mk b/linux/types.mk new file mode 100644 index 0000000..0e27c13 --- /dev/null +++ b/linux/types.mk @@ -0,0 +1,2 @@ +libsyscalls_get_datatype_description.o: linux/types.c +libsyscalls_get_datatype_description.lo: linux/types.c diff --git a/linux/what-architecture-am-i-using b/linux/what-architecture-am-i-using new file mode 100755 index 0000000..1c7a9ba --- /dev/null +++ b/linux/what-architecture-am-i-using @@ -0,0 +1,26 @@ +#!/bin/sh + +set -e + +# TODO complete this list + +if uname -s | grep -i linux > /dev/null; then + arch="$(uname -m)" + if test "$arch" = x86_64; then + printf '%s\n' AMD64 + if test $# = 0 || "$@"; then + if test $# = 0 || gunzip < /proc/config.gz | grep '^CONFIG_X86_X32_ABI=y$' > /dev/null; then + printf '%s\n' AMD64_X32 + fi + if test $# = 0 || gunzip < /proc/config.gz | grep '^CONFIG_X86=y$' > /dev/null; then + printf '%s\n' I386 + fi + fi + elif test "$arch" = i686 || test "$arch" = i386; then + printf '%s\n' I386 + else + exit 1 + fi +else + exit 2 +fi diff --git a/linux/yes.mk b/linux/yes.mk new file mode 120000 index 0000000..7b78b0b --- /dev/null +++ b/linux/yes.mk @@ -0,0 +1 @@ +linux-support.mk
\ No newline at end of file |