xref: /aosp_15_r20/external/ltp/include/lapi/syscalls/strip_syscall.awk (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1*49cdfc7eSAndroid Build Coastguard Worker#!/usr/bin/awk -f
2*49cdfc7eSAndroid Build Coastguard Worker#
3*49cdfc7eSAndroid Build Coastguard Worker# Dumb script that can be used to strip all of the syscall information from
4*49cdfc7eSAndroid Build Coastguard Worker# the arch-respective unistd*.h.
5*49cdfc7eSAndroid Build Coastguard Worker#
6*49cdfc7eSAndroid Build Coastguard Worker# Examples:
7*49cdfc7eSAndroid Build Coastguard Worker#
8*49cdfc7eSAndroid Build Coastguard Worker# 1. Grab the i386 32-bit syscalls from unistd_32.h and put them in i386.in
9*49cdfc7eSAndroid Build Coastguard Worker# strip_syscall.awk arch/x86/include/asm/unistd_32.h > i386.in
10*49cdfc7eSAndroid Build Coastguard Worker#
11*49cdfc7eSAndroid Build Coastguard Worker
12*49cdfc7eSAndroid Build Coastguard Worker/^#define[[:space:]]+__NR_[0-9a-z]+/ {
13*49cdfc7eSAndroid Build Coastguard Worker
14*49cdfc7eSAndroid Build Coastguard Worker	sub (/#define[[:space:]]+__NR_/, "", $0);
15*49cdfc7eSAndroid Build Coastguard Worker	sub (/[[:space:]]*(\/\*.*)/, "", $0);
16*49cdfc7eSAndroid Build Coastguard Worker	sub (/[[:space:]]+/, " ", $0);
17*49cdfc7eSAndroid Build Coastguard Worker
18*49cdfc7eSAndroid Build Coastguard Worker	print
19*49cdfc7eSAndroid Build Coastguard Worker}
20