mirror of
https://codeberg.org/kiss-community/repo
synced 2024-11-19 21:20:07 -07:00
29 lines
867 B
Diff
29 lines
867 B
Diff
diff --git a/tools/all_syscalls b/tools/all_syscalls
|
|
index 9c14778..8f0d582 100755
|
|
--- a/tools/all_syscalls
|
|
+++ b/tools/all_syscalls
|
|
@@ -1,4 +1,4 @@
|
|
-#!/bin/bash
|
|
+#!/bin/sh
|
|
|
|
set -e
|
|
|
|
@@ -7,9 +7,14 @@ SYSCALL_INCLUDES="
|
|
#include <sys/syscall.h>
|
|
"
|
|
|
|
-trap 'rm $OUTPUT $OUTPUT.deps' ERR
|
|
+trap '[ $? -eq 0 ] || rm $OUTPUT $OUTPUT.deps' EXIT
|
|
|
|
-"$@" -MD -MF "$OUTPUT.deps" <<< "$SYSCALL_INCLUDES" -dM -E - \
|
|
- | gawk 'match($0, /^#define __NR_([^ ]+)/, res) { print "UL_SYSCALL(\"" res[1] "\", __NR_" res[1] ")" }' \
|
|
+echo "$SYSCALL_INCLUDES" | "$@" -MD -MF "$OUTPUT.deps" -dM -E - \
|
|
+ | awk 'match($0, /^#define __NR_([^ ]+)/) {
|
|
+ split(substr($0, RSTART + 1, RLENGTH - 1), syscall_split)
|
|
+ syscall_nr_def = syscall_split[2]
|
|
+ syscall_name = substr(syscall_nr_def, 6)
|
|
+ print "UL_SYSCALL(\"" syscall_name "\", " syscall_nr_def ")"
|
|
+ }' \
|
|
| sort \
|
|
> "$OUTPUT"
|