summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-14 19:22:57 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-14 19:22:57 +0000
commitce95875445c67808caa5d4fb0e6f80dbdaef0cb7 (patch)
tree6da8cbc66ef15086c9d295e4abe733b24818551e /tools
parentAdding upstream version 2.40. (diff)
downloadutil-linux-upstream.tar.xz
util-linux-upstream.zip
Adding upstream version 2.40.1.upstream/2.40.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/all_syscalls7
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/all_syscalls b/tools/all_syscalls
index 9c14778..eccb0d0 100755
--- a/tools/all_syscalls
+++ b/tools/all_syscalls
@@ -1,15 +1,18 @@
#!/bin/bash
set -e
+set -o pipefail
+SED="$1"
+shift
OUTPUT=syscalls.h
SYSCALL_INCLUDES="
#include <sys/syscall.h>
"
-trap 'rm $OUTPUT $OUTPUT.deps' ERR
+trap 'rm -f $OUTPUT $OUTPUT.deps' ERR
"$@" -MD -MF "$OUTPUT.deps" <<< "$SYSCALL_INCLUDES" -dM -E - \
- | gawk 'match($0, /^#define __NR_([^ ]+)/, res) { print "UL_SYSCALL(\"" res[1] "\", __NR_" res[1] ")" }' \
+ | "$SED" -n -e 's/^#define __NR_\([^ ]*\).*$/UL_SYSCALL("\1", __NR_\1)/p' \
| sort \
> "$OUTPUT"