Sha256: 8d109742d4616a7840786d8c3840a68d760354d3066cf8a12c55be2fe068027f

Contents?: true

Size: 874 Bytes

Versions: 3

Compression:

Stored size: 874 Bytes

Contents

#!/bin/bash

# NOTE: changes to the arch_syscall_table struct in syscalls.h will affect
#       this script/gperf - BEWARE!

###
# helper functions

function exit_usage() {
	echo "usage: $0 <syscall_csv_file> <gperf_template>"
	exit 1
}

###
# main

# sanity check
[[ ! -r "$1" || ! -r "$2" ]] && exit_usage
sys_csv=$1
gperf_tmpl=$2

sys_csv_tmp=$(mktemp -t generate_syscalls_XXXXXX)

# filter and prepare the syscall csv file
cat $sys_csv | grep -v '^#' | nl -ba -s, -v0 | \
    sed -e 's/^[[:space:]]\+\([0-9]\+\),\([^,]\+\),\(.*\)/\2,\1,\3/' \
        -e ':repeat; {s|\([^,]\+\)\(.*\)[^_]PNR|\1\2,__PNR_\1|g;}; t repeat' \
         > $sys_csv_tmp
[[ $? -ne 0 ]] && exit 1

# create the gperf file
sed -e "/@@SYSCALLS_TABLE@@/r $sys_csv_tmp" \
    -e '/@@SYSCALLS_TABLE@@/d' \
    $gperf_tmpl > syscalls.perf
[[ $? -ne 0 ]] && exit 1

# cleanup
rm -f $sys_csv_tmp

exit 0

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
script_core-0.3.2 ext/enterprise_script_service/libseccomp/src/arch-gperf-generate
script_core-0.3.0 ext/enterprise_script_service/libseccomp/src/arch-gperf-generate
script_core-0.2.7 ext/enterprise_script_service/libseccomp/src/arch-gperf-generate