kore

Kore is a web application platform for writing scalable, concurrent web based processes in C or Python.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

linux-platform.sh (1024B)



      1 #!/bin/sh
      2 #
      3 # Linux specific defines and system call maps.
      4 
      5 if [ -z "$TARGET_PLATFORM" ]; then
      6 	PLATFORM=$(uname -m)
      7 else
      8 	PLATFORM=$TARGET_PLATFORM
      9 fi
     10 
     11 BASE=$(dirname $0)
     12 
     13 case "$PLATFORM" in
     14 	x86_64*)
     15 		seccomp_audit_arch=AUDIT_ARCH_X86_64
     16 		syscall_file=$BASE/linux/x86_64_syscall.h.in
     17 		;;
     18 	i386)
     19 		seccomp_audit_arch=AUDIT_ARCH_I386
     20 		syscall_file=$BASE/linux/i386_syscall.h.in
     21 		;;
     22 	arm*)
     23 		seccomp_audit_arch=AUDIT_ARCH_ARM
     24 		syscall_file=$BASE/linux/arm_syscall.h.in
     25 		;;
     26 	aarch64*)
     27 		seccomp_audit_arch=AUDIT_ARCH_AARCH64
     28 		syscall_file=$BASE/linux/aarch64_syscall.h.in
     29 		;;
     30 	*)
     31 		>&2 echo "$PLATFORM not supported"
     32 		exit 1
     33 		;;
     34 esac
     35 
     36 cat << __EOF
     37 /* Auto generated by linux-platform.sh - DO NOT EDIT */
     38 
     39 #include <sys/syscall.h>
     40 
     41 #define SECCOMP_AUDIT_ARCH $seccomp_audit_arch
     42 
     43 struct {
     44   const char *name;
     45   int  nr;
     46 } kore_syscall_map [] = {
     47 __EOF
     48 
     49 sed 's/__NR_//' $syscall_file | awk '/#define/ { syscall = $2; number = $3; printf "  { \"%s\", %d },\n", syscall, number }'
     50 
     51 cat << __EOF
     52   { NULL, 0 }
     53 };
     54 __EOF