aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Kbuild11
-rw-r--r--Makefile1
-rwxr-xr-xscripts/checksyscalls.sh118
3 files changed, 130 insertions, 0 deletions
diff --git a/Kbuild b/Kbuild
index 0451f69353ba..163f8cb020a4 100644
--- a/Kbuild
+++ b/Kbuild
@@ -2,6 +2,7 @@
2# Kbuild for top-level directory of the kernel 2# Kbuild for top-level directory of the kernel
3# This file takes care of the following: 3# This file takes care of the following:
4# 1) Generate asm-offsets.h 4# 1) Generate asm-offsets.h
5# 2) Check for missing system calls
5 6
6##### 7#####
7# 1) Generate asm-offsets.h 8# 1) Generate asm-offsets.h
@@ -46,3 +47,13 @@ $(obj)/$(offsets-file): arch/$(ARCH)/kernel/asm-offsets.s Kbuild
46 $(Q)mkdir -p $(dir $@) 47 $(Q)mkdir -p $(dir $@)
47 $(call cmd,offsets) 48 $(call cmd,offsets)
48 49
50#####
51# 2) Check for missing system calls
52#
53
54quiet_cmd_syscalls = CALL $<
55 cmd_syscalls = $(CONFIG_SHELL) $< $(CC) $(c_flags)
56
57PHONY += missing-syscalls
58missing-syscalls: scripts/checksyscalls.sh FORCE
59 $(call cmd,syscalls)
diff --git a/Makefile b/Makefile
index 92cbc05c31ad..2910c2d5ee9f 100644
--- a/Makefile
+++ b/Makefile
@@ -856,6 +856,7 @@ archprepare: prepare1 scripts_basic
856 856
857prepare0: archprepare FORCE 857prepare0: archprepare FORCE
858 $(Q)$(MAKE) $(build)=. 858 $(Q)$(MAKE) $(build)=.
859 $(Q)$(MAKE) $(build)=. missing-syscalls
859 860
860# All the preparing.. 861# All the preparing..
861prepare: prepare0 862prepare: prepare0
diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh
new file mode 100755
index 000000000000..f98171f5a3df
--- /dev/null
+++ b/scripts/checksyscalls.sh
@@ -0,0 +1,118 @@
1#!/bin/sh
2#
3# Check if current architecture are missing any function calls compared
4# to i386.
5# i386 define a number of legacy system calls that are i386 specific
6# and listed below so they are ignored.
7#
8# Usage:
9# syscallchk gcc gcc-options
10#
11
12ignore_list() {
13cat << EOF
14#include <asm/types.h>
15#include <asm/unistd.h>
16
17/* System calls for 32-bit kernels only */
18#if BITS_PER_LONG == 64
19#define __IGNORE_sendfile64
20#define __IGNORE_ftruncate64
21#define __IGNORE_truncate64
22#define __IGNORE_stat64
23#define __IGNORE_lstat64
24#define __IGNORE_fstat64
25#define __IGNORE_fcntl64
26#define __IGNORE_fadvise64_64
27#define __IGNORE_fstatat64
28#define __IGNORE_fstatfs64
29#define __IGNORE_statfs64
30#endif
31
32/* i386-specific or historical system calls */
33#define __IGNORE_break
34#define __IGNORE_stty
35#define __IGNORE_gtty
36#define __IGNORE_ftime
37#define __IGNORE_prof
38#define __IGNORE_lock
39#define __IGNORE_mpx
40#define __IGNORE_ulimit
41#define __IGNORE_profil
42#define __IGNORE_ioperm
43#define __IGNORE_iopl
44#define __IGNORE_idle
45#define __IGNORE_modify_ldt
46#define __IGNORE_ugetrlimit
47#define __IGNORE_mmap2
48#define __IGNORE_vm86
49#define __IGNORE_vm86old
50#define __IGNORE_set_thread_area
51#define __IGNORE_get_thread_area
52#define __IGNORE_madvise1
53#define __IGNORE_oldstat
54#define __IGNORE_oldfstat
55#define __IGNORE_oldlstat
56#define __IGNORE_oldolduname
57#define __IGNORE_olduname
58#define __IGNORE_umount2
59#define __IGNORE_umount
60#define __IGNORE_waitpid
61#define __IGNORE_stime
62#define __IGNORE_nice
63#define __IGNORE_signal
64#define __IGNORE_sigaction
65#define __IGNORE_sgetmask
66#define __IGNORE_sigsuspend
67#define __IGNORE_sigpending
68#define __IGNORE_ssetmask
69#define __IGNORE_readdir
70#define __IGNORE_socketcall
71#define __IGNORE_ipc
72#define __IGNORE_sigreturn
73#define __IGNORE_sigprocmask
74#define __IGNORE_bdflush
75#define __IGNORE__llseek
76#define __IGNORE__newselect
77#define __IGNORE_create_module
78#define __IGNORE_delete_module
79#define __IGNORE_query_module
80#define __IGNORE_get_kernel_syms
81/* ... including the "new" 32-bit uid syscalls */
82#define __IGNORE_lchown32
83#define __IGNORE_getuid32
84#define __IGNORE_getgid32
85#define __IGNORE_geteuid32
86#define __IGNORE_getegid32
87#define __IGNORE_setreuid32
88#define __IGNORE_setregid32
89#define __IGNORE_getgroups32
90#define __IGNORE_setgroups32
91#define __IGNORE_fchown32
92#define __IGNORE_setresuid32
93#define __IGNORE_getresuid32
94#define __IGNORE_setresgid32
95#define __IGNORE_getresgid32
96#define __IGNORE_chown32
97#define __IGNORE_setuid32
98#define __IGNORE_setgid32
99#define __IGNORE_setfsuid32
100#define __IGNORE_setfsgid32
101
102/* Unmerged syscalls for AFS, STREAMS, etc. */
103#define __IGNORE_afs_syscall
104#define __IGNORE_getpmsg
105#define __IGNORE_putpmsg
106#define __IGNORE_vserver
107EOF
108}
109
110syscall_list() {
111sed -n -e '/^\#define/ { s/[^_]*__NR_\([^[:space:]]*\).*/\
112\#if !defined \(__NR_\1\) \&\& !defined \(__IGNORE_\1\)\
113\#warning syscall \1 not implemented\
114\#endif/p }' $1
115}
116
117(ignore_list && syscall_list ${srctree}/include/asm-i386/unistd.h) | \
118$* -E -x c - > /dev/null