summaryrefslogtreecommitdiffstats
path: root/tools/all_syscalls
blob: eccb0d0555d15bf0a6772891cb3b921fc79cfa9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash

set -e
set -o pipefail

SED="$1"
shift
OUTPUT=syscalls.h
SYSCALL_INCLUDES="
#include <sys/syscall.h>
"

trap 'rm -f $OUTPUT $OUTPUT.deps' ERR

"$@" -MD -MF "$OUTPUT.deps" <<< "$SYSCALL_INCLUDES" -dM -E - \
	| "$SED" -n -e 's/^#define __NR_\([^ ]*\).*$/UL_SYSCALL("\1", __NR_\1)/p' \
	| sort \
	> "$OUTPUT"