File: linux-platform.sh

package info (click to toggle)
kore 4.2.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,912 kB
  • sloc: ansic: 29,227; makefile: 344; sh: 278; python: 149; cpp: 34
file content (50 lines) | stat: -rwxr-xr-x 929 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/sh
#
# Linux specific defines and system call maps.

if [ -z "$TARGET_PLATFORM" ]; then
	PLATFORM=$(uname -m)
else
	PLATFORM=$TARGET_PLATFORM
fi

BASE=$(dirname $0)

case "$PLATFORM" in
	x86_64*)
		seccomp_audit_arch=AUDIT_ARCH_X86_64
		syscall_file=$BASE/linux/x86_64_syscall.h.in
		;;
	i*86*)
		>&2 echo "i386 not supported"
		exit 1
		;;
	arm*)
		seccomp_audit_arch=AUDIT_ARCH_ARM
		syscall_file=$BASE/linux/arm_syscall.h.in
		;;
	aarch64*)
		seccomp_audit_arch=AUDIT_ARCH_AARCH64
		syscall_file=$BASE/linux/aarch64_syscall.h.in
		;;
esac

cat << __EOF
/* Auto generated by linux-platform.sh - DO NOT EDIT */

#include <sys/syscall.h>

#define SECCOMP_AUDIT_ARCH $seccomp_audit_arch

struct {
  const char *name;
  int  nr;
} kore_syscall_map [] = {
__EOF

sed 's/__NR_//' $syscall_file | awk '/#define/ { syscall = $2; number = $3; printf "  { \"%s\", %d },\n", syscall, number }'

cat << __EOF
  { NULL, 0 }
};
__EOF