kore

An easy to use, scalable and secure web application framework for writing web APIs in C.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

linux-platform.sh (929B)



      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 	i*86*)
     19 		>&2 echo "i386 not supported"
     20 		exit 1
     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 esac
     31 
     32 cat << __EOF
     33 /* Auto generated by linux-platform.sh - DO NOT EDIT */
     34 
     35 #include <sys/syscall.h>
     36 
     37 #define SECCOMP_AUDIT_ARCH $seccomp_audit_arch
     38 
     39 struct {
     40   const char *name;
     41   int  nr;
     42 } kore_syscall_map [] = {
     43 __EOF
     44 
     45 sed 's/__NR_//' $syscall_file | awk '/#define/ { syscall = $2; number = $3; printf "  { \"%s\", %d },\n", syscall, number }'
     46 
     47 cat << __EOF
     48   { NULL, 0 }
     49 };
     50 __EOF