# See LICENSE file for copyright and license details.
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_-]\{1,\}\)\.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/linux-syscalls
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)/$(@F:.h=.tbl) - \
| sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \
| awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\"}' \
| sed '$$s/ D\\$$//' >> $@
test "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \
"$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }' | grep '^common$$')"
$(LINUX_SYSCALL_DIR)/amd64.tbl.fixed: $(LINUX_SYSCALL_DIR)/amd64.tbl linux/syscalls.mk
cat -- $(@:.fixed=) \
| sed 's/$(s)\{1,\}\(getpmsg\|putpmsg\|afs_syscall\|tuxcall\|security\|vserver\)$(s)*$$/& sys_ni_syscall/' \
| sed 's/^$(s)*[0-9]\{1,\}$(s)\{1,\}[a-z0-9]\{1,\}$(s)\{1,\}\([A-Za-z0-9_]\{1,\}\)$(s)*$$/& sys_\1/' \
> $@
generated/linux-syscalls/amd64.h: $(LINUX_SYSCALL_DIR)/amd64.tbl.fixed linux/syscalls.mk
mkdir -p -- generated/linux-syscalls
printf '\43define LIST_LINUX_SYSCALLS_FOR_AMD64(X, _X_COMPAT, D)\\\n' > $@
cat -- $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl).fixed \
| sed '/^$(s)*\($(h).*\)\{0,1\}$$/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)/$(@F:.h=.tbl).fixed \
| sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \
| awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\" $$2}' \
| sed -n 's/\\\(common\|x32\)$$/\\/p' \
| sed '$$s/ D\\$$//' >> $@
test "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl).fixed | awk '{ print $$2 }')" = \
"$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.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)/$(@F:.fixed=) - \
| sed 's/$(s)vserver$(s)*$$/& sys_ni_syscall/' \
| sed 's/$(s)nfsservctl$(s)*$$/& sys_nfsservctl/' \
> $@
generated/linux-syscalls/arm.h: $(LINUX_SYSCALL_DIR)/arm.tbl.fixed linux/syscalls.mk
mkdir -p -- generated/linux-syscalls
printf '\43define LIST_LINUX_SYSCALLS_FOR_ARM_EABI(X, _X_COMPAT, D)\\\n' > $@
cat -- $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl).fixed \
| sed '/^$(s)*\($(h).*\)\{0,1\}$$/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)/$(@F:.h=.tbl).fixed \
| sed '/^$(s)*\($(h).*\)\{0,1\}$$/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)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl).fixed | awk '{ print $$2 }')" = \
"$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.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/linux-syscalls
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)/$(@F:.h=.tbl) - \
| sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \
| awk '{ print "\tX((" $$1 " + 1024), " $$3 ", " $$4 ") D\\"}' \
| sed '$$s/ D\\$$//' >> $@
test "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \
"$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }' | grep '^common$$')"
generated/linux-syscalls/m68k.h: $(LINUX_SYSCALL_DIR)/m68k.tbl linux/syscalls.mk
mkdir -p -- generated/linux-syscalls
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)/$(@F:.h=.tbl) - \
| sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \
| awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\"}' \
| sed '$$s/ D\\$$//' >> $@
test "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \
"$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }' | grep '^common$$')"
generated/linux-syscalls/microblaze.h: $(LINUX_SYSCALL_DIR)/microblaze.tbl linux/syscalls.mk
mkdir -p -- generated/linux-syscalls
printf '\43define LIST_LINUX_SYSCALLS_FOR_MICROBLAZE_32(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)/$(@F:.h=.tbl) - \
| sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \
| awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\"}' \
| sed '$$s/ D\\$$//' >> $@
test "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \
"$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }' | grep '^common$$')"
generated/linux-syscalls/mips-n32.h: $(LINUX_SYSCALL_DIR)/mips-n32.tbl linux/syscalls.mk
mkdir -p -- generated/linux-syscalls
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)/$(@F:.h=.tbl) - \
| sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \
| awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\"}' \
| sed '$$s/ D\\$$//' >> $@
test "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \
"$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }' | grep '^n32$$')"
generated/linux-syscalls/mips-n64.h: $(LINUX_SYSCALL_DIR)/mips-n64.tbl linux/syscalls.mk
mkdir -p -- generated/linux-syscalls
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)/$(@F:.h=.tbl) - \
| sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \
| awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\"}' \
| sed '$$s/ D\\$$//' >> $@
test "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \
"$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.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/linux-syscalls
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)/$(@F:.h=.tbl) - \
| sed '/^$(s)*\(18\|28\|82\|84\)$(s)\{1,\}o32.*$$/d' \
| sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \
| awk '{ print "\tX_COMPAT(" $$1 ", " $$3 ", " $$4 ", " $$5 ") D\\"}' \
| sed 's/X_COMPAT(\(.*\), ) D\\$$/X(\1) D\\/' \
| sed '$$s/ D\\$$//' >> $@
test "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \
"$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.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)/$(@F:.fixed=) - > $@
generated/linux-syscalls/parisc.h: $(LINUX_SYSCALL_DIR)/parisc.tbl.fixed linux/syscalls.mk
mkdir -p -- generated/linux-syscalls
printf '\43define LIST_LINUX_SYSCALLS_FOR_PARISC_64(X, _X_COMPAT, D)\\\n' > $@
cat -- $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl).fixed \
| sed '/^$(s)*\($(h).*\)\{0,1\}$$/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)/$(@F:.h=.tbl).fixed \
| sed '/^$(s)*\($(h).*\)\{0,1\}$$/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)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl).fixed | awk '{ print $$2 }')" = \
"$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.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/linux-syscalls
printf '\43define LIST_LINUX_SYSCALLS_FOR_POWERPC_32(X, X_COMPAT, D)\\\n' > $@
cat -- $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) \
| sed '/^$(s)*\($(h).*\)\{0,1\}$$/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)/$(@F:.h=.tbl) \
| sed '/^$(s)*\($(h).*\)\{0,1\}$$/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)/$(@F:.h=.tbl) \
| sed '/^$(s)*\($(h).*\)\{0,1\}$$/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)/$(@F:.h=.tbl) \
| sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \
| awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\" $$2}' \
| sed -n 's/\\\(common\|spu\)$$/\\/p' \
| sed '$$s/ D\\$$//' >> $@
test "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \
"$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.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/linux-syscalls
printf '\43define LIST_LINUX_SYSCALLS_FOR_S390_32(X, _X_COMPAT, D)\\\n' > $@
cat -- $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) \
| sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \
| sed 's/^$(s)*\([0-9]\{1,\}\)$(s)\{1,\}\([A-Za-z0-9_]\{1,\}\)$(s)\{1,\}\([A-Za-z0-9_]\{1,\}\)$(s)\{1,\}-$(s)\{1,\}-$(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)/$(@F:.h=.tbl) \
| sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \
| sed 's/^$(s)*\([0-9]\{1,\}\)$(s)\{1,\}\([A-Za-z0-9_]\{1,\}\)$(s)\{1,\}\([A-Za-z0-9_]\{1,\}\)$(s)\{1,\}-$(s)\{1,\}-$(s)*$$/\1 \2 \3 sys_\3 sys_\3/' \
| sed 's/^$(s)*\(89\)$(s)\{1,\}\(common\)$(s)\{1,\}\(readdir\)$(s)\{1,\}-$(s)\{1,\}/\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)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \
"$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }' | \
grep '^\(common\|32\|64\)$$')"
generated/linux-syscalls/sh.h: $(LINUX_SYSCALL_DIR)/sh.tbl linux/syscalls.mk
mkdir -p -- generated/linux-syscalls
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)*\($(h).*\)\{0,1\}$$/d' \
| awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\"}' \
| sed '$$s/ D\\$$//' >> $@
test "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \
"$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }' | grep '^common$$')"
generated/linux-syscalls/sparc.h: $(LINUX_SYSCALL_DIR)/sparc.tbl linux/syscalls.mk
mkdir -p -- generated/linux-syscalls
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)/$(@F:.h=.tbl) - \
| sed 's/compat_sys_\(truncate64\|ftruncate64\)/sparc___&/g' \
| sed '/^$(s)*267$(s)\{1,\}common$(s)\{1,\}vserver$(s)\{1,\}.*$$/d' \
| sed '/^$(s)*\($(h).*\)\{0,1\}$$/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)/$(@F:.h=.tbl) - \
| sed '/^$(s)*267$(s)\{1,\}common$(s)\{1,\}vserver$(s)\{1,\}.*$$/d' \
| sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \
| awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\" $$2}' \
| sed -n 's/\\\(common\|64\)$$/\\/p' \
| sed '$$s/ D\\$$//' >> $@
test "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \
"$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }' | \
grep '^\(common\|32\|64\)$$')"
generated/linux-syscalls/x86.h: $(LINUX_SYSCALL_DIR)/x86.tbl linux/syscalls.mk
mkdir -p -- generated/linux-syscalls
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)/$(@F:.h=.tbl) - \
| sed 's/$(s)\{1,\}\(break\|stty\|gtty\|ftime\|prof\|lock\|mpx\|ulimit\|profil\|idle\|afs_syscall\|getpmsg\|putpmsg\|vserver\)$(s)*$$/& sys_ni_syscall/' \
| sed 's/^$(s)*[0-9]\{1,\}$(s)\{1,\}[a-z0-9]\{1,\}$(s)\{1,\}\([A-Za-z0-9_]\{1,\}\)$(s)*$$/& sys_\1/' \
| sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \
| awk '{ print "\tX_COMPAT(" $$1 ", " $$3 ", " $$4 ", " $$5 ") D\\"}' \
| sed 's/X_COMPAT(\(.*\), ) D\\$$/X(\1) D\\/' \
| sed '$$s/ D\\$$//' >> $@
test "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \
"$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }' | grep '^i386$$')"
generated/linux-syscalls/xtensa.h: $(LINUX_SYSCALL_DIR)/xtensa.tbl linux/syscalls.mk
mkdir -p -- generated/linux-syscalls
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)/$(@F:.h=.tbl) - \
| sed 's/reserved152$(s)\{1,\}sys_ni_syscall/set_thread_area sys_set_thread_area/' \
| sed 's/reserved153$(s)\{1,\}sys_ni_syscall/get_thread_area sys_get_thread_area/' \
| sed 's/nfsservctl$(s)\{1,\}sys_ni_syscall/nfsservctl sys_nfsservctl/' \
| sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \
| awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\"}' \
| sed '$$s/ D\\$$//' >> $@
test "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \
"$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.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 \{1,\}\(linux_[A-Z0-9a-z_]\{1,\}_syscall_[A-Z0-9a-z_]\{1,\}.*\)$$/\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 \
) > $@
printf '\43define linux_%s_syscalls_table\n' $(SUPPORTED_LINUX_ARCHES) \
| sed -n 's/ linux_\(.*\)_[LB]E_syscalls_table/& linux_\1_syscalls_table/p' >> $@