initd: use patch_stdio() for kmodloader stdio redirection
[project/procd.git] / make_syscall_h.sh
1 #!/bin/sh
2 # syscall reporting example for seccomp
3 #
4 # Copyright (c) 2012 The Chromium OS Authors <chromium-os-dev@chromium.org>
5 # Authors:
6 #  Kees Cook <keescook@chromium.org>
7 #
8 # Use of this source code is governed by a BSD-style license that can be
9 # found in the LICENSE file.
10
11 CC=$1
12 [ -n "$TARGET_CC_NOCACHE" ] && CC=$TARGET_CC_NOCACHE
13
14 echo "#include <asm/unistd.h>"
15 echo "static const char *syscall_names[] = {"
16 echo "#include <sys/syscall.h>" | ${CC} -E -dM - | grep '^#define __NR_' | \
17         LC_ALL=C sed -r -n -e 's/^\#define[ \t]+__NR_([a-z0-9_]+)[ \t]+([ ()+0-9a-zNR_Linux]+)(.*)/ [\2] = "\1",/p'
18 echo "};"