diff options
author | Mattias Andrée <maandree@kth.se> | 2023-12-07 22:51:52 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2023-12-07 22:51:52 +0100 |
commit | 9f449569df9c94670f51fd8cd5558b66884cd877 (patch) | |
tree | 21d3c31e22b2cd0544351584c8614e70b66826e4 | |
parent | Fourth commit (diff) | |
download | libsyscalls-9f449569df9c94670f51fd8cd5558b66884cd877.tar.gz libsyscalls-9f449569df9c94670f51fd8cd5558b66884cd877.tar.bz2 libsyscalls-9f449569df9c94670f51fd8cd5558b66884cd877.tar.xz |
Improve portability
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | config-figure-this-out-for-me.mk | 3 | ||||
-rwxr-xr-x | devtools/find-type-definition | 19 | ||||
-rw-r--r-- | linux/errors.mk | 6 | ||||
-rw-r--r-- | linux/signals.mk | 18 | ||||
-rw-r--r-- | linux/symbols.mk | 18 | ||||
-rw-r--r-- | linux/syscall-table.mk | 8 | ||||
-rw-r--r-- | linux/syscalls.h | 8 | ||||
-rw-r--r-- | linux/syscalls.mk | 146 | ||||
-rw-r--r-- | mk/generate.mk | 8 | ||||
-rw-r--r-- | tests/enums | 2 | ||||
-rw-r--r-- | tests/errors | 6 | ||||
-rw-r--r-- | tests/fundamental-primitives | 2 | ||||
-rw-r--r-- | tests/load-archinfo | 6 | ||||
-rw-r--r-- | tests/load-functions | 2 | ||||
-rw-r--r-- | tests/signals | 12 | ||||
-rw-r--r-- | tests/split-register-types | 2 | ||||
-rw-r--r-- | tests/syscall-errors | 12 | ||||
-rwxr-xr-x | util/getdefs | 12 | ||||
-rwxr-xr-x | util/getenum | 4 |
20 files changed, 159 insertions, 140 deletions
@@ -48,6 +48,11 @@ include $(CONFIGFILE) # Reloading the user's config in case it limits supported architectures +#this not modify, this is a help variable to get the # symbol into sed scripts +h = '"$$(printf '\43\n')"' +#this not modify, this is a help variable to make [[:space:]] shorter +s = [[:space:]] + #extended for each support operating system with the operating system's name as appropriate for filenames OPERATING_SYSTEMS = diff --git a/config-figure-this-out-for-me.mk b/config-figure-this-out-for-me.mk index 8da5ff9..60a24de 100644 --- a/config-figure-this-out-for-me.mk +++ b/config-figure-this-out-for-me.mk @@ -6,7 +6,8 @@ BASECONFIG !=\ else \ rm -f -- .config.mk.tmp; \ (set -e; \ - sed 's/^\s*DOWNLOAD\s*=/\x23&/' < config.mk; \ + e="$$(printf '\033\n')"; \ + sed 's/^[[:space:]]*DOWNLOAD[[:space:]]*=/'"$$e"'&/' < config.mk; \ for testscript in */what-architecture-am-i-using; do \ if test "$$testscript" = "util/what-architecture-am-i-using"; then \ continue; \ diff --git a/devtools/find-type-definition b/devtools/find-type-definition index 9523e7c..2a99b78 100755 --- a/devtools/find-type-definition +++ b/devtools/find-type-definition @@ -4,6 +4,19 @@ type="$1" shift 1 -grep -r '\(define\s\+\(__kernel_\)\?'"$type"'\s\|typedef\s.*\s\(__kernel_\)\?'"$type"'\b\)' "$@" \ -| sed 's/^\([^:]*\):/\x1b[35m\1\x1b[m /' \ -| sed 's/\(__kernel_\)\?'"$type"'/\x1b[1;31m&\x1b[m/g' +e="$(printf '\033\n')" + +pattern1='define[[:space:]]\{1,\}\(__kernel_\)\{0,1\}'"$type"'[[:space:]]' +pattern2='typedef[[:space:]].*[[:space:]]\(__kernel_\)\{0,1\}'"$type"'\([^A-Za-z0-9_]\|$\)' + +pattern='\('"${pattern1}"'\|'"${pattern2}"'\)' + +find "$@" | while read f; do + if test -L "$f" || test -d "$f"; then + continue + fi + fe="$(printf '%s\n' "$f" | sed 's/\([\[*.]\|\/\|\]\)/\\&/g')" + sed -n '/^.*'"$pattern.*"'$/p' < "$f" \ + | sed 's/\(__kernel_\)\{0,1\}'"$type/$e"'[1;31m&'"$e"'[m/g' \ + | sed "s/^/$e[35m$fe$e[m /" +done diff --git a/linux/errors.mk b/linux/errors.mk index f69bf73..b34258a 100644 --- a/linux/errors.mk +++ b/linux/errors.mk @@ -17,7 +17,7 @@ generated/linux-errors.tbl: $(LINUX_SOURCE) linux/errors.mk printf '%s\n' "$$file"; \ done \ done \ - ) | grep '/\(gcc\|clang\)\(-[0-9.]\+\)\?$$'; \ + ) | grep '/\(gcc\|clang\)\(-[0-9.]\{1,\}\)\{0,1\}$$'; \ printf '%s\n' gcc; \ ) | sed 1q; \ }; \ @@ -27,7 +27,7 @@ generated/linux-errors.tbl: $(LINUX_SOURCE) linux/errors.mk { \ ($$extract "-I$$toolsdir/include/uapi" "$$2" && \ cat -- "linux-src/linux-$(LINUX_VERSION)/include/linux/errno.h") \ - | sed -n 's/^\s*\x23\s*define\s\+\(E[^\s]\+\)\s\+\([0-9]\+\)\s*\(\/.*\)\?$$/'"$$1"' \2 \1/p' \ + | sed -n 's/^$(s)*$(h)$(s)*define$(s)\{1,\}\(E[^[:space:]]\{1,\}\)$(s)\{1,\}\([0-9]\{1,\}\)$(s)*\(\/.*\)\{0,1\}$$/'"$$1"' \2 \1/p' \ | sort -k 2 -nu; \ }; \ for arch in $$(printf '%s\n' "$$toolsdir/arch"/*/ | sed 's:^.*/\([^/]*\)/$$:\1:'); do \ @@ -43,7 +43,7 @@ generated/linux-errors.h: generated/linux-errors.tbl linux/errors.mk for arch in $$(cut -d ' ' -f 1 < generated/linux-errors.tbl | uniq); do \ ARCH="$$(printf '%s\n' "$$arch" | tr '[a-z]' '[A-Z]')"; \ printf '#define LIST_LINUX_ERRORS_FOR_%s(X, D)\\\n' "$$ARCH"; \ - sed -n 's/^'"$$arch"' \([0-9]\+\) \(.*\)$$/\tX(\1, "\2") D\\/p' \ + sed -n 's/^'"$$arch"' \([0-9]\{1,\}\) \(.*\)$$/\tX(\1, "\2") D\\/p' \ < generated/linux-errors.tbl \ | sed '$$s/ D\\//'; \ printf 'static struct libsyscalls_named_number linux_errors_for_%s[] = {\n' "$$arch"; \ diff --git a/linux/signals.mk b/linux/signals.mk index 8fb9f07..4bb8812 100644 --- a/linux/signals.mk +++ b/linux/signals.mk @@ -17,7 +17,7 @@ generated/linux-signals.tbl: $(LINUX_SOURCE) linux/signals.mk printf '%s\n' "$$file"; \ done \ done \ - ) | grep '/\(gcc\|clang\)\(-[0-9.]\+\)\?$$'; \ + ) | grep '/\(gcc\|clang\)\(-[0-9.]\{1,\}\)\{0,1\}$$'; \ printf '%s\n' gcc; \ ) | sed 1q; \ }; \ @@ -40,17 +40,17 @@ generated/linux-signals.tbl: $(LINUX_SOURCE) linux/signals.mk set -e; \ signals="$$( \ $$extract "-I$$srcdir/tools/include" $$fixes "$$2" \ - | sed -n 's/^\s*\x23\s*define\s\+\(SIG[^\s]\+\)\s\+\([0-9]\+\)\s*\(\/.*\)\?$$/'"$$1"' \2 \1/p' \ + | sed -n 's/^$(s)*$(h)$(s)*define$(s)\{1,\}\(SIG[^[:space:]]\{1,\}\)$(s)\{1,\}\([0-9]\{1,\}\)$(s)*\(\/.*\)\{0,1\}$$/'"$$1"' \2 \1/p' \ | grep -v ' SIG_' \ | grep -v ' SIGSTKSZ' \ | sort -k 2 -nu; \ )"; \ if test "$$1" = arm; then \ - signals="$$(printf "%s\n" "$$signals" | sed 's/\bSIGSWI\b/SIGRTMIN/')"; \ + signals="$$(printf "%s\n" "$$signals" | sed 's/\(^\|[^A-Z0-9a-z_]\)SIGSWI\([^A-Z0-9a-z_]\|$$\)/\1SIGRTMIN\2/')"; \ fi; \ printf "%s\n" "$$signals"; \ - sigrtmin="$$(printf "%s\n" "$$signals" | sed -n 's/^.* \([0-9]\+\) SIGRTMIN$$/\1/p')"; \ - maxnamed="$$(printf "%s\n" "$$signals" | sed -n '$$s/^.* \([0-9]\+\) .*$$/\1/p')"; \ + sigrtmin="$$(printf "%s\n" "$$signals" | sed -n 's/^.* \([0-9]\{1,\}\) SIGRTMIN$$/\1/p')"; \ + maxnamed="$$(printf "%s\n" "$$signals" | sed -n '$$s/^.* \([0-9]\{1,\}\) .*$$/\1/p')"; \ test "$$sigrtmin" = "$$maxnamed"; \ maxsig=_NSIG; \ depth=0; \ @@ -58,7 +58,7 @@ generated/linux-signals.tbl: $(LINUX_SOURCE) linux/signals.mk printf '%s: looking for %s\n' "$$1" "$$maxsig" >&2; \ def="$$maxsig"; \ maxsig="$$($$extract "-I$$srcdir/tools/include" $$fixes "$$2" \ - | sed -n 's/^\s*\x23\s*define\s\+'"$$def"'\s\+\([A-Z0-9_]\+\)\s*\(\/.*\)\?$$/\1/p')"; \ + | sed -n 's/^$(s)*$(h)$(s)*define$(s)\{1,\}'"$$def"'$(s)\{1,\}\([A-Z0-9_]\{1,\}\)$(s)*\(\/.*\)\{0,1\}$$/\1/p')"; \ if test -z "$$maxsig"; then \ maxsig="$$($$extract "-I$$srcdir/tools/include" \ "-I$$srcdir/arch/$$1/include" \ @@ -66,7 +66,7 @@ generated/linux-signals.tbl: $(LINUX_SOURCE) linux/signals.mk "-I$$srcdir" \ $$fixes \ "$$(printf '%s\n' "$$2" | sed 's:/uapi/:/:')" \ - | sed -n 's/^\s*\x23\s*define\s\+'"$$def"'\s\+\([A-Z0-9_]\+\)\s*\(\/.*\)\?$$/\1/p')"; \ + | sed -n 's/^$(s)*$(h)$(s)*define$(s)\{1,\}'"$$def"'$(s)\{1,\}\([A-Z0-9_]\{1,\}\)$(s)*\(\/.*\)\{0,1\}$$/\1/p')"; \ fi; \ printf '%s: found %s\n' "$$1" "$$maxsig" >&2; \ : $$(( depth++ )); \ @@ -80,7 +80,7 @@ generated/linux-signals.tbl: $(LINUX_SOURCE) linux/signals.mk done; \ }; \ getsigs () { \ - process_arch "$$@" | sed 's/\bSIGRTMIN\b/_&/'; \ + process_arch "$$@" | sed 's/\(^\|[^A-Z0-9a-z_]\)\(SIGRTMIN\)\([^A-Z0-9a-z_]\|$$\)/\1_\2\3/'; \ }; \ for arch in $$(printf '%s\n' "$$srcdir/arch"/*/ | sed 's:^.*/\([^/]*\)/$$:\1:'); do \ if test ! "$$arch" = s390 && test -f "$$srcdir/arch/$$arch/include/uapi/asm/signal.h"; then \ @@ -129,7 +129,7 @@ generated/linux-signals.h: generated/linux-signals.tbl linux/signals.mk for arch in $$(cut -d ' ' -f 1 < generated/linux-signals.tbl | uniq); do \ ARCH="$$(printf '%s\n' "$$arch" | tr '[a-z]' '[A-Z]')"; \ printf '#define LIST_LINUX_SIGNALS_FOR_%s(X, D)\\\n' "$$ARCH"; \ - sed -n 's/^'"$$arch"' \([0-9]\+\) \(.*\)$$/\tX(\1, "\2") D\\/p' \ + sed -n 's/^'"$$arch"' \([0-9]\{1,\}\) \(.*\)$$/\tX(\1, "\2") D\\/p' \ < generated/linux-signals.tbl \ | sed '$$s/ D\\//'; \ printf 'static struct libsyscalls_named_number linux_signals_for_%s[] = {\n' "$$arch"; \ diff --git a/linux/symbols.mk b/linux/symbols.mk index 97db4ab..ffdad11 100644 --- a/linux/symbols.mk +++ b/linux/symbols.mk @@ -1,6 +1,6 @@ # See LICENSE file for copyright and license details. -LINUX_SYMBOL_TABLES != sed -n 's/^.*LINUX_SYMBOL_PRINTER_\([A-Z0-9_]\+\)\b.*\$$\$$\$$.*\$$\$$\$$.*$$/\1/p' < linux/syscalls.h +LINUX_SYMBOL_TABLES != sed -n 's/^.*LINUX_SYMBOL_PRINTER_\([A-Z0-9_]\{1,\}\)\([^A-Za-z0-9_].*\)*\$$\$$\$$.*\$$\$$\$$.*$$/\1/p' < linux/syscalls.h LINUX_SYMBOL_TABLE_FILES != printf 'linux-src/symbols-$(LINUX_VERSION)/%s\n' $(LINUX_SYMBOL_TABLES) @@ -28,7 +28,7 @@ libsyscalls_get_syscall_display_info.lo: generated/linux-symbol-extractors.h lin $(LINUX_SYMBOL_TABLE_FILES): $(LINUX_SYMBOL_TABLE_DEPS) mkdir -p -- linux-src/symbols-$(LINUX_VERSION) table="$$(printf '%s\n' "$@" | tr / '\n' | sed -n '$$p')" && \ - command="$$(sed -n 's/^.*LINUX_SYMBOL_PRINTER_'"$$table"'\b.*\$$\$$\$$\s*\(.*\)\s*\$$\$$\$$.*$$/\1/p' < linux/syscalls.h)" && \ + command="$$(sed -n 's/^.*LINUX_SYMBOL_PRINTER_'"$$table"'\([^A-Za-z0-9_].*\)*\$$\$$\$$$(s)*\(.*\)$(s)*\$$\$$\$$.*$$/\2/p' < linux/syscalls.h)" && \ test -n "$$command" && \ printf '%s\n' "$$command" && \ (cd -- linux-src/linux-$(LINUX_VERSION) && env PATH="../../util:$${PATH}" sh -e -c "$$command") > $@ @@ -39,30 +39,30 @@ generated/linux-symbol-extractors.h: $(LINUX_SYMBOL_EXTRACTOR_DEPS) for tablefile in $(LINUX_SYMBOL_TABLE_FILES); do \ tablename="$$(printf '%s\n' "$$tablefile" | cut -d / -f 3)"; \ how="$$(sed -n < linux/syscalls.h \ - 's/^.*LINUX_SYMBOL_PRINTER_'"$$tablename"'\b.*\/\*\s*\(.*\)\s*\$$\$$\$$.*\$$\$$\$$.*$$/\1/p')"; \ + 's/^.*LINUX_SYMBOL_PRINTER_'"$$tablename"'\([^A-Za-z0-9_].*\)*\/\*$(s)*\(.*\)$(s)*\$$\$$\$$.*\$$\$$\$$.*$$/\2/p')"; \ printf '\n'; \ util/make-sym-extractor "$$tablename" "$$how" < "$$tablefile"; \ done > $@.tmp set -e; \ - pattern='\s\+LINUX_SYMBOL_PRINTER_\([A-Z0-9_]\+\)\s*'; \ + pattern='$(s)\{1,\}LINUX_SYMBOL_PRINTER_\([A-Z0-9_]\{1,\}\)$(s)*'; \ funcprefix='extract_linux_symbol_'; \ - sed -n 's/^\s*\x23\s*define'"$$pattern$$pattern"'\(\/.*\)\?$$/\x23define '$$funcprefix'\1 '$$funcprefix'\2/p' \ + sed -n 's/^$(s)*$(h)$(s)*define'"$$pattern$$pattern"'\(\/.*\)\{0,1\}$$/$(h)define '$$funcprefix'\1 '$$funcprefix'\2/p' \ < linux/syscalls.h | tr '[A-Z]' '[a-z]' > $@ storage_and_rettype="$$(sed '/^$$/d' < $@.tmp | sed 1q | sed 's/\*/\\\*/g' | sed 's/[^\*]$$/& /')"; \ sed -n 's/^extract_symbol_.*/'"$${storage_and_rettype}"'&;/p' < $@.tmp | cat - $@.tmp >> $@ -rm -f -- $@.tmp set -e; \ sed 's/, */ /g' < linux/syscalls.h \ - | sed -n 's/^.*LINUX_SYMBOL_PRINTER_\([A-Z0-9_]\+\)\b.*[^$$]\$$\$$\s*SYMBOLS(\(.*\))\s*\$$\$$[^$$].*$$/\1 \2/p' \ + | sed -n 's/^.*LINUX_SYMBOL_PRINTER_\([A-Z0-9_]\{1,\}\)\([^A-Za-z0-9_].*[^$$]\|[^A-Za-z0-9_$$]\)\$$\$$$(s)*SYMBOLS(\(.*\))$(s)*\$$\$$[^$$].*$$/\1 \3/p' \ | while read line; do \ printf '\n'; \ util/make-multiextractor $$line; \ done >> $@ printf '\n\43define LIST_LINUX_EXTRACTORS(X, D)\\\n' >> $@ set -e; \ - phonies="$$(sed -n '/\$$\$$\$$\s*BEGIN\s\+PHONIES\s*\$$\$$\$$/,/\$$\$$\$$\s*END\s\+PHONIES\s*\$$\$$\$$/p' < linux/syscalls.h \ - | sed -n 's/^\s*LINUX_SYMBOL_PRINTER_\([A-Z0-9_]\+\)\b.*$$/\1/p')"; \ - sed -n 's/^extract_symbol_\([^)]*\)(.*)\s*\/\*\s*\([0-9]\+\)\s*\*\/\s*$$/\1 \2/p' < $@ \ + phonies="$$(sed -n '/\$$\$$\$$$(s)*BEGIN$(s)\{1,\}PHONIES$(s)*\$$\$$\$$/,/\$$\$$\$$$(s)*END$(s)\{1,\}PHONIES$(s)*\$$\$$\$$/p' < linux/syscalls.h \ + | sed -n 's/^$(s)*LINUX_SYMBOL_PRINTER_\([A-Z0-9_]\{1,\}\)\([^A-Za-z0-9_].*\)*$$/\1/p')"; \ + sed -n 's/^extract_symbol_\([^)]*\)(.*)$(s)*\/\*$(s)*\([0-9]\{1,\}\)$(s)*\*\/$(s)*$$/\1 \2/p' < $@ \ | while read name n; do \ if ! printf '%s\n' "$$phonies" | grep -i \^"$$name"\$$ > /dev/null; then \ printf '\tX(LINUX_SYMBOL_PRINTER_%s, extract_symbol_%s, %i) D\\\n' \ diff --git a/linux/syscall-table.mk b/linux/syscall-table.mk index 1b993e6..7e6fb1a 100644 --- a/linux/syscall-table.mk +++ b/linux/syscall-table.mk @@ -12,7 +12,7 @@ libsyscalls_get_syscall_range.lo: $(LINUX_SYSCALLS_HDR) generated/linux-syscall-table.h: linux/syscall-table.c common.h linux/linux-support.mk set -e; \ - macros="$$(sed -n 's/^\s*\x23\s*define\s\+MAKE_\([^(]*\)(.*$$/\1/p' < linux/syscall-table.c)"; \ + macros="$$(sed -n 's/^$(s)*$(h)$(s)*define$(s)\{1,\}MAKE_\([^(]*\)(.*$$/\1/p' < linux/syscall-table.c)"; \ for arch in $(SUPPORTED_LINUX_ARCHES); do \ for macro in $$macros; do \ printf '\43define MAKE_%s_%s(...) MAKE_%s(%s, __VA_ARGS__)\n' \ @@ -32,9 +32,9 @@ generated/linux-syscall-ranges.h: $(LINUX_SYSCALLS_ARCH_HDR) printf '%s\n' 'This may take some time ...'; \ set -e; arch=; \ cat -- $(LINUX_SYSCALLS_ARCH_HDR) \ - | sed 's/^\s*X[A-Z_]*(\([^,]*\).*$$/\1/' \ - | sed 's/\x23\s*define\s\+LIST_LINUX_SYSCALLS_FOR_\(.*\)(.*/\1/' \ - | sed '/^\s*$$/d' \ + | sed 's/^$(s)*X[A-Z_]*(\([^,]*\).*$$/\1/' \ + | sed 's/$(h)$(s)*define$(s)\{1,\}LIST_LINUX_SYSCALLS_FOR_\(.*\)(.*/\1/' \ + | sed '/^$(s)*$$/d' \ | (\ while read line; do \ if test -z "$$(printf '%s\n' "$$line" | sed 's/^[A-Z].*$$//')"; then \ diff --git a/linux/syscalls.h b/linux/syscalls.h index e11120f..f55dac5 100644 --- a/linux/syscalls.h +++ b/linux/syscalls.h @@ -39,7 +39,7 @@ enum { /* LIBSYSCALLS_SYMBOL_PRINTER */ LINUX_SYMBOL_PRINTER_SHUT, /* enum $$$ getenum sock_shutdown_cmd < include/linux/net.h $$$ */ LINUX_SYMBOL_PRINTER_FADVISE, /* enum $$$ getdefs FADV POSIX_FADV < include/uapi/linux/fadvise.h $$$ */ LINUX_SYMBOL_PRINTER_ADJTIMEX, /* enum $$$ getdefs TIME < include/uapi/linux/timex.h $$$ */ - LINUX_SYMBOL_PRINTER_IPC_KEY, /* enum $$$ grep IPC_PRIVATE < include/uapi/linux/ipc.h | sed 's/(\s*\(__kernel_\)\?key_t\s*)//g' | getdefs IPC $$$ */ + LINUX_SYMBOL_PRINTER_IPC_KEY, /* enum $$$ grep IPC_PRIVATE < include/uapi/linux/ipc.h | sed 's/([[:space:]]*\(__kernel_\)\{0,1\}key_t[[:space:]]*)//g' | getdefs IPC $$$ */ LINUX_SYMBOL_PRINTER_ATFD, /* enum $$$ getdefs AT < tools/include/uapi/linux/fcntl.h | grep '^AT_FDCWD ' $$$ */ LINUX_SYMBOL_PRINTER_MSGCTL, /* IPCCTL,enum $$$ sed '1,/ctl commands/d;/ctl commands/d;/^\//q' < include/uapi/linux/msg.h | getdefs MSG $$$ */ LINUX_SYMBOL_PRINTER_SHMCTL, /* IPCCTL,enum $$$ sed '1,/ctl commands/d;/ctl commands/d;/^\//q' < include/uapi/linux/shm.h | getdefs SHM $$$ */ @@ -53,8 +53,8 @@ enum { /* LIBSYSCALLS_SYMBOL_PRINTER */ LINUX_SYMBOL_PRINTER_GRND, /* mask $$$ getdefs GRND < include/uapi/linux/random.h $$$ */ LINUX_SYMBOL_PRINTER_CLOSE_RANGE, /* mask $$$ getdefs CLOSE_RANGE < include/uapi/linux/close_range.h $$$ */ LINUX_SYMBOL_PRINTER_FSOPEN, /* mask $$$ getdefs FSOPEN < include/uapi/linux/mount.h $$$ */ - LINUX_SYMBOL_PRINTER_LOCK, /* mask $$$ getdefs LOCK < include/uapi/asm-generic/fcntl.h | grep -v '^LOCK_RW '; ! cat arch'/'*\/include/uapi/asm/fcntl.h | grep \\sLOCK_ > /dev/null $$$ */ - LINUX_SYMBOL_PRINTER_RWF, /* mask $$$ sed 's/(\s*__force\s\+__kernel_rwf_t\s*)//' < include/uapi/linux/fs.h | getdefs RWF $$$ */ + LINUX_SYMBOL_PRINTER_LOCK, /* mask $$$ getdefs LOCK < include/uapi/asm-generic/fcntl.h | grep -v '^LOCK_RW '; ! cat arch'/'*\/include/uapi/asm/fcntl.h | grep \[[:space:]]LOCK_ > /dev/null $$$ */ + LINUX_SYMBOL_PRINTER_RWF, /* mask $$$ sed 's/([[:space:]]*__force[[:space:]]\{1,\}__kernel_rwf_t[[:space:]]*)//' < include/uapi/linux/fs.h | getdefs RWF $$$ */ LINUX_SYMBOL_PRINTER_STATX, /* mask $$$ getdefs STATX < include/uapi/linux/stat.h | grep -v '^STATX_\(BASIC_STATS \|ALL \|ATTR_\)' $$$ */ LINUX_SYMBOL_PRINTER_FALLOC, /* mask $$$ getdefs FALLOC_FL < include/uapi/linux/falloc.h $$$ */ LINUX_SYMBOL_PRINTER_AT, /* mask $$$ grep '\(AT_EMPTY_PATH\|AT_SYMLINK_NOFOLLOW\)' < include/uapi/linux/fcntl.h | getdefs AT $$$ */ @@ -70,7 +70,7 @@ enum { /* LIBSYSCALLS_SYMBOL_PRINTER */ LINUX_SYMBOL_PRINTER_AT_STATX, /* AT_AUTOMOUNT|mask $$$ getdefs AT_STATX < include/uapi/linux/fcntl.h | grep -v '^AT_STATX_SYNC_TYPE ' $$$ */ LINUX_SYMBOL_PRINTER_RECVM, /* RECV|mask $$$ getdefs MSG < include/linux/socket.h | grep '^MSG_WAITFORONE ' $$$ */ LINUX_SYMBOL_PRINTER_SENDM, /* SEND|mask $$$ getdefs MSG < include/linux/socket.h | grep '^MSG_BATCH ' $$$ */ - LINUX_SYMBOL_PRINTER_MSGRCV, /* IPC_NOWAIT|mask $$$ grep '^.*\s0[0-9a-fA-FxulUL]*\s*\(/.*\)\?$' < include/uapi/linux/msg.h | getdefs MSG $$$ */ + LINUX_SYMBOL_PRINTER_MSGRCV, /* IPC_NOWAIT|mask $$$ grep '^.*[[:space:]]0[0-9a-fA-FxulUL]*[[:space:]]*\(/.*\)\{0,1\}$' < include/uapi/linux/msg.h | getdefs MSG $$$ */ LINUX_SYMBOL_PRINTER_SCHEDULER_SET, /* SCHEDULER|mask $$$ grep '0x' < include/uapi/linux/sched.h | getdefs SCHED | grep -v '^SCHED_FLAG_' $$$ */ /* arch dependent (TODO -- don't forget to remove #define from top of symbols.c) */ diff --git a/linux/syscalls.mk b/linux/syscalls.mk index ddd1a63..de748b3 100644 --- a/linux/syscalls.mk +++ b/linux/syscalls.mk @@ -6,7 +6,7 @@ LINUX_SYSCALLS_ARCH_TBL_SPLIT_X64 != printf '$(LINUX_SYSCALL_DIR)/%s.tbl\n' amd6 LINUX_SYSCALLS_ARCH_TBL_SPLIT_MIPS != printf '$(LINUX_SYSCALL_DIR)/%s.tbl\n' mips-n32 mips-o32 mips-n64 LINUX_SYSCALLS_ARCHES_SPLIT != grep '^LINUX_SYSCALLS_ARCH_TBL_SPLIT_' < linux/syscalls.mk | cut -d \% -f 2 | cut -d ' ' -f 2- -LINUX_SYSCALLS_ARCHES_SIMPLE != (sed -n 's/^generated\/linux-syscalls\/\([a-zA-Z0-9_-]\+\)\.h\s*:.*$$/\1/p' && \ +LINUX_SYSCALLS_ARCHES_SIMPLE != (sed -n 's/^generated\/linux-syscalls\/\([a-zA-Z0-9_-]\{1,\}\)\.h$(s)*:.*$$/\1/p' && \ printf '%s\n' $(LINUX_SYSCALLS_ARCHES_SPLIT)) < linux/syscalls.mk | sort | uniq -u LINUX_SYSCALLS_ARCHES = $(LINUX_SYSCALLS_ARCHES_SIMPLE) $(LINUX_SYSCALLS_ARCHES_SPLIT) LINUX_SYSCALLS_ARCH_HDR != printf 'generated/linux-syscalls/%s.h\n' $(LINUX_SYSCALLS_ARCHES) @@ -26,35 +26,35 @@ generated/linux-syscalls/alpha.h: $(LINUX_SYSCALL_DIR)/alpha.tbl linux/syscalls. printf '%i common %s %s\n' \ 320 idle sys_idle \ | cat -- $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) - \ - | sed '/^\s*\(\x23.*\)\?$$/d' \ + | sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \ | awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\"}' \ | sed '$$s/ D\\$$//' >> $@ - test "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \ - "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }' | grep '^common$$')" + test "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \ + "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }' | grep '^common$$')" $(LINUX_SYSCALL_DIR)/amd64.tbl.fixed: $(LINUX_SYSCALL_DIR)/amd64.tbl linux/syscalls.mk cat -- $(@:.fixed=) \ - | sed 's/\s\+\(getpmsg\|putpmsg\|afs_syscall\|tuxcall\|security\|vserver\)\s*$$/& sys_ni_syscall/' \ - | sed 's/^\s*[0-9]\+\s\+[a-z0-9]\+\s\+\([A-Za-z0-9_]\+\)\s*$$/& sys_\1/' \ + | sed 's/$(s)\{1,\}\(getpmsg\|putpmsg\|afs_syscall\|tuxcall\|security\|vserver\)$(s)*$$/& sys_ni_syscall/' \ + | sed 's/^$(s)*[0-9]\{1,\}$(s)\{1,\}[a-z0-9]\{1,\}$(s)\{1,\}\([A-Za-z0-9_]\{1,\}\)$(s)*$$/& sys_\1/' \ > $@ generated/linux-syscalls/amd64.h: $(LINUX_SYSCALL_DIR)/amd64.tbl.fixed linux/syscalls.mk mkdir -p -- generated/linux-syscalls printf '\43define LIST_LINUX_SYSCALLS_FOR_AMD64(X, _X_COMPAT, D)\\\n' > $@ cat -- $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl).fixed \ - | sed '/^\s*\(\x23.*\)\?$$/d' \ + | sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \ | awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\" $$2}' \ | sed -n 's/\\\(common\|64\)$$/\\/p' \ | sed '$$s/ D\\$$//' >> $@ printf '\n\43define LIST_LINUX_SYSCALLS_FOR_AMD64_X32(X, _X_COMPAT, D)\\\n' >> $@ cat -- $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl).fixed \ - | sed '/^\s*\(\x23.*\)\?$$/d' \ + | sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \ | awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\" $$2}' \ | sed -n 's/\\\(common\|x32\)$$/\\/p' \ | sed '$$s/ D\\$$//' >> $@ - test "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl).fixed | awk '{ print $$2 }')" = \ - "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl).fixed | awk '{ print $$2 }' | \ + test "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl).fixed | awk '{ print $$2 }')" = \ + "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl).fixed | awk '{ print $$2 }' | \ grep '^\(common\|64\|x32\)$$')" @@ -88,27 +88,27 @@ $(LINUX_SYSCALL_DIR)/arm.tbl.fixed: $(LINUX_SYSCALL_DIR)/arm.tbl linux/syscalls. 166 vm86 sys_vm86 \ 167 query_module sys_query_module \ | cat -- $(LINUX_SYSCALL_DIR)/$(@F:.fixed=) - \ - | sed 's/\svserver\s*$$/& sys_ni_syscall/' \ - | sed 's/\snfsservctl\s*$$/& sys_nfsservctl/' \ + | sed 's/$(s)vserver$(s)*$$/& sys_ni_syscall/' \ + | sed 's/$(s)nfsservctl$(s)*$$/& sys_nfsservctl/' \ > $@ generated/linux-syscalls/arm.h: $(LINUX_SYSCALL_DIR)/arm.tbl.fixed linux/syscalls.mk mkdir -p -- generated/linux-syscalls printf '\43define LIST_LINUX_SYSCALLS_FOR_ARM_EABI(X, _X_COMPAT, D)\\\n' > $@ cat -- $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl).fixed \ - | sed '/^\s*\(\x23.*\)\?$$/d' \ + | sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \ | awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\" $$2}' \ | sed -n 's/\\\(common\|eabi\)$$/\\/p' \ | sed '$$s/ D\\$$//' >> $@ printf '\n\43define LIST_LINUX_SYSCALLS_FOR_ARM_OABI(X, X_COMPAT, D)\\\n' >> $@ cat -- $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl).fixed \ - | sed '/^\s*\(\x23.*\)\?$$/d' \ + | sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \ | awk '{ print "\tX_COMPAT(" $$1 ", " $$3 ", " $$4 ", " $$5 ") D\\" $$2}' \ | sed -n 's/\\\(common\|oabi\)$$/\\/p' \ | sed 's/X_COMPAT(\(.*\), ) D\\$$/X(\1) D\\/' \ | sed '$$s/ D\\$$//' >> $@ - test "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl).fixed | awk '{ print $$2 }')" = \ - "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl).fixed | awk '{ print $$2 }' | \ + test "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl).fixed | awk '{ print $$2 }')" = \ + "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl).fixed | awk '{ print $$2 }' | \ grep '^\(common\|oabi\|eabi\)$$')" @@ -123,11 +123,11 @@ generated/linux-syscalls/ia64.h: $(LINUX_SYSCALL_DIR)/ia64.tbl linux/syscalls.mk $$(( 1135 - 1024 )) get_kernel_syms sys_get_kernel_syms \ $$(( 1136 - 1024 )) query_module sys_query_module \ | cat -- $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) - \ - | sed '/^\s*\(\x23.*\)\?$$/d' \ + | sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \ | awk '{ print "\tX((" $$1 " + 1024), " $$3 ", " $$4 ") D\\"}' \ | sed '$$s/ D\\$$//' >> $@ - test "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \ - "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }' | grep '^common$$')" + test "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \ + "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }' | grep '^common$$')" generated/linux-syscalls/m68k.h: $(LINUX_SYSCALL_DIR)/m68k.tbl linux/syscalls.mk @@ -152,11 +152,11 @@ generated/linux-syscalls/m68k.h: $(LINUX_SYSCALL_DIR)/m68k.tbl linux/syscalls.mk 137 afs_syscall sys_ni_syscall \ 278 vserver sys_ni_syscall \ | cat -- $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) - \ - | sed '/^\s*\(\x23.*\)\?$$/d' \ + | sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \ | awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\"}' \ | sed '$$s/ D\\$$//' >> $@ - test "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \ - "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }' | grep '^common$$')" + test "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \ + "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }' | grep '^common$$')" generated/linux-syscalls/microblaze.h: $(LINUX_SYSCALL_DIR)/microblaze.tbl linux/syscalls.mk @@ -166,11 +166,11 @@ generated/linux-syscalls/microblaze.h: $(LINUX_SYSCALL_DIR)/microblaze.tbl linux 251 set_zone_reclaim sys_set_zone_reclaim \ 285 setaltroot sys_setaltroot \ | cat -- $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) - \ - | sed '/^\s*\(\x23.*\)\?$$/d' \ + | sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \ | awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\"}' \ | sed '$$s/ D\\$$//' >> $@ - test "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \ - "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }' | grep '^common$$')" + test "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \ + "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }' | grep '^common$$')" generated/linux-syscalls/mips-n32.h: $(LINUX_SYSCALL_DIR)/mips-n32.tbl linux/syscalls.mk @@ -179,11 +179,11 @@ generated/linux-syscalls/mips-n32.h: $(LINUX_SYSCALL_DIR)/mips-n32.tbl linux/sys printf '%i common %s %s\n' \ 242 setaltroot sys_setaltroot \ | cat -- $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) - \ - | sed '/^\s*\(\x23.*\)\?$$/d' \ + | sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \ | awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\"}' \ | sed '$$s/ D\\$$//' >> $@ - test "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \ - "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }' | grep '^n32$$')" + test "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \ + "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }' | grep '^n32$$')" generated/linux-syscalls/mips-n64.h: $(LINUX_SYSCALL_DIR)/mips-n64.tbl linux/syscalls.mk @@ -192,11 +192,11 @@ generated/linux-syscalls/mips-n64.h: $(LINUX_SYSCALL_DIR)/mips-n64.tbl linux/sys printf '%i common %s %s\n' \ 238 setaltroot sys_setaltroot \ | cat -- $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) - \ - | sed '/^\s*\(\x23.*\)\?$$/d' \ + | sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \ | awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\"}' \ | sed '$$s/ D\\$$//' >> $@ - test "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \ - "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }' | \ + test "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \ + "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }' | \ grep '^\(n64\|common\)$$')" @@ -210,13 +210,13 @@ generated/linux-syscalls/mips-o32.h: $(LINUX_SYSCALL_DIR)/mips-o32.tbl linux/sys 84 old_lstat sys_lstat \ 279 setaltroot sys_setaltroot \ | cat -- $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) - \ - | sed '/^\s*\(18\|28\|82\|84\)\s\+o32.*$$/d' \ - | sed '/^\s*\(\x23.*\)\?$$/d' \ + | sed '/^$(s)*\(18\|28\|82\|84\)$(s)\{1,\}o32.*$$/d' \ + | sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \ | awk '{ print "\tX_COMPAT(" $$1 ", " $$3 ", " $$4 ", " $$5 ") D\\"}' \ | sed 's/X_COMPAT(\(.*\), ) D\\$$/X(\1) D\\/' \ | sed '$$s/ D\\$$//' >> $@ - test "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \ - "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }' | grep '^o32$$')" + test "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \ + "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }' | grep '^o32$$')" $(LINUX_SYSCALL_DIR)/parisc.tbl.fixed: $(LINUX_SYSCALL_DIR)/parisc.tbl linux/syscalls.mk @@ -244,19 +244,19 @@ generated/linux-syscalls/parisc.h: $(LINUX_SYSCALL_DIR)/parisc.tbl.fixed linux/s mkdir -p -- generated/linux-syscalls printf '\43define LIST_LINUX_SYSCALLS_FOR_PARISC_64(X, _X_COMPAT, D)\\\n' > $@ cat -- $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl).fixed \ - | sed '/^\s*\(\x23.*\)\?$$/d' \ + | sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \ | awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\" $$2}' \ | sed -n 's/\\\(common\|64\)$$/\\/p' \ | sed '$$s/ D\\$$//' >> $@ printf '\n\43define LIST_LINUX_SYSCALLS_FOR_PARISC_32(X, X_COMPAT, D)\\\n' >> $@ cat -- $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl).fixed \ - | sed '/^\s*\(\x23.*\)\?$$/d' \ + | sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \ | awk '{ print "\tX_COMPAT(" $$1 ", " $$3 ", " $$4 ", " $$5 ") D\\" $$2}' \ | sed -n 's/\\\(common\|32\)$$/\\/p' \ | sed 's/X_COMPAT(\(.*\), ) D\\$$/X(\1) D\\/' \ | sed '$$s/ D\\$$//' >> $@ - test "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl).fixed | awk '{ print $$2 }')" = \ - "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl).fixed | awk '{ print $$2 }' | \ + test "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl).fixed | awk '{ print $$2 }')" = \ + "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl).fixed | awk '{ print $$2 }' | \ grep '^\(common\|64\|32\)$$')" @@ -264,32 +264,32 @@ generated/linux-syscalls/powerpc.h: $(LINUX_SYSCALL_DIR)/powerpc.tbl linux/sysca mkdir -p -- generated/linux-syscalls printf '\43define LIST_LINUX_SYSCALLS_FOR_POWERPC_32(X, X_COMPAT, D)\\\n' > $@ cat -- $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) \ - | sed '/^\s*\(\x23.*\)\?$$/d' \ + | sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \ | awk '{ print "\tX_COMPAT(" $$1 ", " $$3 ", " $$4 ", " $$5 ") D\\" $$2}' \ | sed -n 's/\\\(common\|32\)$$/\\/p' \ | sed 's/X_COMPAT(\(.*\), ) D\\$$/X(\1) D\\/' \ | sed '$$s/ D\\$$//' >> $@ printf '\n\43define LIST_LINUX_SYSCALLS_FOR_POWERPC_NOSPU(X, X_COMPAT, D)\\\n' >> $@ cat -- $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) \ - | sed '/^\s*\(\x23.*\)\?$$/d' \ + | sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \ | awk '{ print "\tX_COMPAT(" $$1 ", " $$3 ", " $$4 ", " $$5 ") D\\" $$2}' \ | sed -n 's/\\\(common\|nospu\)$$/\\/p' \ | sed 's/X_COMPAT(\(.*\), ) D\\$$/X(\1) D\\/' \ | sed '$$s/ D\\$$//' >> $@ printf '\n\43define LIST_LINUX_SYSCALLS_FOR_POWERPC_64(X, _X_COMPAT, D)\\\n' >> $@ cat -- $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) \ - | sed '/^\s*\(\x23.*\)\?$$/d' \ + | sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \ | awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\" $$2}' \ | sed -n 's/\\\(common\|64\)$$/\\/p' \ | sed '$$s/ D\\$$//' >> $@ printf '\n\43define LIST_LINUX_SYSCALLS_FOR_POWERPC_SPU(X, _X_COMPAT, D)\\\n' >> $@ cat -- $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) \ - | sed '/^\s*\(\x23.*\)\?$$/d' \ + | sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \ | awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\" $$2}' \ | sed -n 's/\\\(common\|spu\)$$/\\/p' \ | sed '$$s/ D\\$$//' >> $@ - test "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \ - "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }' | \ + test "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \ + "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }' | \ grep '^\(common\|spu\|nospu\|64\|32\)$$')" @@ -297,21 +297,21 @@ generated/linux-syscalls/s390.h: $(LINUX_SYSCALL_DIR)/s390.tbl linux/syscalls.mk mkdir -p -- generated/linux-syscalls printf '\43define LIST_LINUX_SYSCALLS_FOR_S390_32(X, _X_COMPAT, D)\\\n' > $@ cat -- $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) \ - | sed '/^\s*\(\x23.*\)\?$$/d' \ - | sed 's/^\s*\([0-9]\+\)\s\+\([A-Za-z0-9_]\+\)\s\+\([A-Za-z0-9_]\+\)\s\+-\s\+-\s*$$/\1 \2 \3 sys_\3 sys_\3/' \ + | sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \ + | sed 's/^$(s)*\([0-9]\{1,\}\)$(s)\{1,\}\([A-Za-z0-9_]\{1,\}\)$(s)\{1,\}\([A-Za-z0-9_]\{1,\}\)$(s)\{1,\}-$(s)\{1,\}-$(s)*$$/\1 \2 \3 sys_\3 sys_\3/' \ | awk '{ print "\tX(" $$1 ", " $$3 ", " $$5 ") D\\" $$2}' \ | sed -n 's/\\\(common\|32\)$$/\\/p' \ | sed '$$s/ D\\$$//' >> $@ printf '\n\43define LIST_LINUX_SYSCALLS_FOR_S390_64(X, _X_COMPAT, D)\\\n' >> $@ cat -- $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) \ - | sed '/^\s*\(\x23.*\)\?$$/d' \ - | sed 's/^\s*\([0-9]\+\)\s\+\([A-Za-z0-9_]\+\)\s\+\([A-Za-z0-9_]\+\)\s\+-\s\+-\s*$$/\1 \2 \3 sys_\3 sys_\3/' \ - | sed 's/^\s*\(89\)\s\+\(common\)\s\+\(readdir\)\s\+-\s\+/\1 \2 \3 sys_old_readdir /' \ + | sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \ + | sed 's/^$(s)*\([0-9]\{1,\}\)$(s)\{1,\}\([A-Za-z0-9_]\{1,\}\)$(s)\{1,\}\([A-Za-z0-9_]\{1,\}\)$(s)\{1,\}-$(s)\{1,\}-$(s)*$$/\1 \2 \3 sys_\3 sys_\3/' \ + | sed 's/^$(s)*\(89\)$(s)\{1,\}\(common\)$(s)\{1,\}\(readdir\)$(s)\{1,\}-$(s)\{1,\}/\1 \2 \3 sys_old_readdir /' \ | awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\" $$2}' \ | sed -n 's/\\\(common\|64\)$$/\\/p' \ | sed '$$s/ D\\$$//' >> $@ - test "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \ - "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }' | \ + test "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \ + "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }' | \ grep '^\(common\|32\|64\)$$')" @@ -340,11 +340,11 @@ generated/linux-syscalls/sh.h: $(LINUX_SYSCALL_DIR)/sh.tbl linux/syscalls.mk 166 vm86 sys_vm86 \ 167 query_module sys_query_module \ | cat -- $(LINUX_SYSCALL_DIR)/sh.tbl - \ - | sed '/^\s*\(\x23.*\)\?$$/d' \ + | sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \ | awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\"}' \ | sed '$$s/ D\\$$//' >> $@ - test "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \ - "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }' | grep '^common$$')" + test "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \ + "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }' | grep '^common$$')" generated/linux-syscalls/sparc.h: $(LINUX_SYSCALL_DIR)/sparc.tbl linux/syscalls.mk @@ -354,8 +354,8 @@ generated/linux-syscalls/sparc.h: $(LINUX_SYSCALL_DIR)/sparc.tbl linux/syscalls. 267 vserver sys_vserver \ | cat -- $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) - \ | sed 's/compat_sys_\(truncate64\|ftruncate64\)/sparc___&/g' \ - | sed '/^\s*267\s\+common\s\+vserver\s\+.*$$/d' \ - | sed '/^\s*\(\x23.*\)\?$$/d' \ + | sed '/^$(s)*267$(s)\{1,\}common$(s)\{1,\}vserver$(s)\{1,\}.*$$/d' \ + | sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \ | awk '{ print "\tX_COMPAT(" $$1 ", " $$3 ", " $$4 ", " $$5 ") D\\" $$2}' \ | sed -n 's/\\\(common\|32\)$$/\\/p' \ | sed 's/X_COMPAT(\(.*\), ) D\\$$/X(\1) D\\/' \ @@ -364,13 +364,13 @@ generated/linux-syscalls/sparc.h: $(LINUX_SYSCALL_DIR)/sparc.tbl linux/syscalls. printf '%i common %s %s\n' \ 267 vserver sys_vserver \ | cat -- $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) - \ - | sed '/^\s*267\s\+common\s\+vserver\s\+.*$$/d' \ - | sed '/^\s*\(\x23.*\)\?$$/d' \ + | sed '/^$(s)*267$(s)\{1,\}common$(s)\{1,\}vserver$(s)\{1,\}.*$$/d' \ + | sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \ | awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\" $$2}' \ | sed -n 's/\\\(common\|64\)$$/\\/p' \ | sed '$$s/ D\\$$//' >> $@ - test "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \ - "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }' | \ + test "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \ + "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }' | \ grep '^\(common\|32\|64\)$$')" @@ -381,14 +381,14 @@ generated/linux-syscalls/x86.h: $(LINUX_SYSCALL_DIR)/x86.tbl linux/syscalls.mk 251 set_zone_reclaim sys_set_zone_reclaim \ 285 setaltroot sys_setaltroot \ | cat -- $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) - \ - | sed 's/\s\+\(break\|stty\|gtty\|ftime\|prof\|lock\|mpx\|ulimit\|profil\|idle\|afs_syscall\|getpmsg\|putpmsg\|vserver\)\s*$$/& sys_ni_syscall/' \ - | sed 's/^\s*[0-9]\+\s\+[a-z0-9]\+\s\+\([A-Za-z0-9_]\+\)\s*$$/& sys_\1/' \ - | sed '/^\s*\(\x23.*\)\?$$/d' \ + | sed 's/$(s)\{1,\}\(break\|stty\|gtty\|ftime\|prof\|lock\|mpx\|ulimit\|profil\|idle\|afs_syscall\|getpmsg\|putpmsg\|vserver\)$(s)*$$/& sys_ni_syscall/' \ + | sed 's/^$(s)*[0-9]\{1,\}$(s)\{1,\}[a-z0-9]\{1,\}$(s)\{1,\}\([A-Za-z0-9_]\{1,\}\)$(s)*$$/& sys_\1/' \ + | sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \ | awk '{ print "\tX_COMPAT(" $$1 ", " $$3 ", " $$4 ", " $$5 ") D\\"}' \ | sed 's/X_COMPAT(\(.*\), ) D\\$$/X(\1) D\\/' \ | sed '$$s/ D\\$$//' >> $@ - test "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \ - "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }' | grep '^i386$$')" + test "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \ + "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }' | grep '^i386$$')" generated/linux-syscalls/xtensa.h: $(LINUX_SYSCALL_DIR)/xtensa.tbl linux/syscalls.mk @@ -397,14 +397,14 @@ generated/linux-syscalls/xtensa.h: $(LINUX_SYSCALL_DIR)/xtensa.tbl linux/syscall printf '%i common %s %s\n' \ 305 timerfd sys_timerfd \ | cat -- $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) - \ - | sed 's/reserved152\s\+sys_ni_syscall/set_thread_area sys_set_thread_area/' \ - | sed 's/reserved153\s\+sys_ni_syscall/get_thread_area sys_get_thread_area/' \ - | sed 's/nfsservctl\s\+sys_ni_syscall/nfsservctl sys_nfsservctl/' \ - | sed '/^\s*\(\x23.*\)\?$$/d' \ + | sed 's/reserved152$(s)\{1,\}sys_ni_syscall/set_thread_area sys_set_thread_area/' \ + | sed 's/reserved153$(s)\{1,\}sys_ni_syscall/get_thread_area sys_get_thread_area/' \ + | sed 's/nfsservctl$(s)\{1,\}sys_ni_syscall/nfsservctl sys_nfsservctl/' \ + | sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' \ | awk '{ print "\tX(" $$1 ", " $$3 ", " $$4 ") D\\"}' \ | sed '$$s/ D\\$$//' >> $@ - test "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \ - "$$(sed '/^\s*\(\x23.*\)\?$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }' | grep '^common$$')" + test "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }')" = \ + "$$(sed '/^$(s)*\($(h).*\)\{0,1\}$$/d' < $(LINUX_SYSCALL_DIR)/$(@F:.h=.tbl) | awk '{ print $$2 }' | grep '^common$$')" $(LINUX_SYSCALLS_ARCH_TBL_SIMPLE): $(LINUX_SOURCE) linux/syscalls.mk @@ -436,7 +436,7 @@ generated/linux-syscall-dedup.h: $(HDR) $(LINUX_SYSCALLS_HDR) linux/syscalls.h l cpp -DCREATING_DEDUP_TABLE linux/syscall-table.c \ | grep -v '^#' \ | tr '\n;\t' ' \n ' \ - | sed -n 's/^.* libsyscalls_syscall \+\(linux_[A-Z0-9a-z_]\+_syscall_[A-Z0-9a-z_]\+.*\)$$/\1/p' \ + | sed -n 's/^.* libsyscalls_syscall \{1,\}\(linux_[A-Z0-9a-z_]\{1,\}_syscall_[A-Z0-9a-z_]\{1,\}.*\)$$/\1/p' \ | tr -d ' ' \ | sed 's/=/ /' \ | sort -k 2 \ diff --git a/mk/generate.mk b/mk/generate.mk index 9575c34..f5361c4 100644 --- a/mk/generate.mk +++ b/mk/generate.mk @@ -72,7 +72,7 @@ generated/oses.h: Makefile mk/generate.mk generated/lowercase.h: libsyscalls.h mk/generate.mk mkdir -p -- generated - sed -n 's/^\s*LIBSYSCALLS_CAT_\([A-Z0-9_]\+\).*$$/\1/p' < libsyscalls.h \ + sed -n 's/^$(s)*LIBSYSCALLS_CAT_\([A-Z0-9_]\{1,\}\).*$$/\1/p' < libsyscalls.h \ | grep -v '^\(SUPPORT_PENDING\|NOT_IMPLEMENTED\)$$' \ | while read uppercase; do \ printf '\43define LOWERCASE_%s %s\n' \ @@ -86,7 +86,7 @@ libsyscalls/short-enums.h: libsyscalls.h mk/generate.mk 'ifndef LIBSYSCALLS_H' \ ' error Do not include this header file directly' \ 'endif' - sed -n 's/^.*\b\(enum_libsyscalls_[A-Za-z0-9_]\+\)\([^A-Za-z0-9_].*\|\)$$/\1/p' < libsyscalls.h \ + sed -n 's/^\(.*[^A-Za-z0-9_]\)\{0,1\}\(enum_libsyscalls_[A-Za-z0-9_]\{1,\}\)\([^A-Za-z0-9_].*\|\)$$/\2/p' < libsyscalls.h \ | sort -u \ | xargs printf 'typedef unsigned short int %s;\n' \ >> $@ @@ -95,7 +95,7 @@ libsyscalls/short-enums.h: libsyscalls.h mk/generate.mk generated/macros.h: common.h mk/generate.mk set -e;\ for find in COUNT_ARG_PAIRS PARAMS_BUILD_TYPES; do \ - text="$$(sed -n 's/^\s*\x23\s*define\s\+'"$$find"'_1(/&/p' < common.h)"; \ + text="$$(sed -n 's/^$(s)*$(h)$(s)*define$(s)\{1,\}'"$$find"'_1(/&/p' < common.h)"; \ i=1; while (( i <= $(NPARAMS) )); do \ j=$$(( i + 1 )); \ printf '%s\n' "$$text" | sed -e "s/_2/_$$j/g" -e "s/_1/_$$i/g"; \ @@ -124,7 +124,7 @@ generated/macros.h: common.h mk/generate.mk fi; \ printf '\43define %s%s(X)%s\n' "$$a" "$$b" "$$c"; \ done; done; done; \ - done) | sed 's/_IN_OUT/_BI/' | sed 's/\(\s[A-Z]\+\)(/\1__(/' >> $@ + done) | sed 's/_IN_OUT/_BI/' | sed 's/\($(s)[A-Z]\{1,\}\)(/\1__(/' >> $@ SELF_CHECK_COMMAND = test "$(NPARAMS)" -le 16 diff --git a/tests/enums b/tests/enums index 43afe3d..476c478 100644 --- a/tests/enums +++ b/tests/enums @@ -16,7 +16,7 @@ for cat in $(getnamelist CAT); do continue fi check_enum_good ${cat}_SUBCAT - grep -i "enum.libsyscalls_${cat}_syscall_subcategory"'\s\+'"$cat"\\b < libsyscalls.h >/dev/null + grep -i "enum.libsyscalls_${cat}_syscall_subcategory"'[[:space:]]\{1,\}'"$cat"'\([^A-Za-z0-9_]\|$\)' < libsyscalls.h >/dev/null done check_enum_good SIGN check_enum_good ANNOTATION diff --git a/tests/errors b/tests/errors index f14ddfc..8c74731 100644 --- a/tests/errors +++ b/tests/errors @@ -30,9 +30,9 @@ done strerror-all.tu > $a list-errors.tu > $b (! grep '^-' >/dev/null < $b) -grep '^[0-9]\+ ' >/dev/null < $b -grep '^[0-9]\+ LIBSYSCALLS_E_[A-Z]\+ ' >/dev/null < $b -grep '^[0-9]\+ LIBSYSCALLS_E_[A-Z]\+ [A-Z].*[^.]$' >/dev/null < $b +grep '^[0-9]\{1,\} ' >/dev/null < $b +grep '^[0-9]\{1,\} LIBSYSCALLS_E_[A-Z]\{1,\} ' >/dev/null < $b +grep '^[0-9]\{1,\} LIBSYSCALLS_E_[A-Z]\{1,\} [A-Z].*[^.]$' >/dev/null < $b cut -d ' ' -f 3- < $b | diff -u $a - sed 1q < $b | grep '^0 LIBSYSCALLS_E_OK Success$' >/dev/null test -z "$(cut -d ' ' -f 1 < $b | sort | uniq -d)" diff --git a/tests/fundamental-primitives b/tests/fundamental-primitives index 4068934..1c8a47a 100644 --- a/tests/fundamental-primitives +++ b/tests/fundamental-primitives @@ -77,7 +77,7 @@ for os in $(getnamelist OS); do grep "^is_unsigned = 0"\$ < $a >/dev/null grep "^annotation = ${noannotation}"\$ < $a >/dev/null grep "^section = ${whole}"\$ < $a >/dev/null - grep "^byteorder =\s*"\$ < $a >/dev/null + grep "^byteorder =[[:space:]]*"\$ < $a >/dev/null type=NO_RETURN get-datatype-description.tu $osn $archn $(lookupnum "$types" $type) $os $arch $type | diff -u $a - diff --git a/tests/load-archinfo b/tests/load-archinfo index 4c38f6b..09d472b 100644 --- a/tests/load-archinfo +++ b/tests/load-archinfo @@ -20,9 +20,9 @@ getbyteorder () { sed '1,/LIST_ARCH_SPECS/d' < libsyscalls_get_datatype_description.c \ | sed '/#include/q' \ -| sed 's/\(TO''DO\)\s*([^)]*)/\1/g' \ -| sed -n 's/^\s*[A-Z_]\+(LIBSYSCALLS_ARCH_\([^)]*\)).*$/\1/p' \ -| sed 's/,\s*/ /g' > $b +| sed 's/\(TO''DO\)[[:space:]]*([^)]*)/\1/g' \ +| sed -n 's/^[[:space:]]*[A-Z_]\{1,\}(LIBSYSCALLS_ARCH_\([^)]*\)).*$/\1/p' \ +| sed 's/,[[:space:]]*/ /g' > $b archinfo="$(cat $b)" getbytesize () { printf '%s\n' "$archinfo" | grep "^$1 " | cut -d ' ' -f 2 diff --git a/tests/load-functions b/tests/load-functions index a31f236..2e9ddda 100644 --- a/tests/load-functions +++ b/tests/load-functions @@ -11,7 +11,7 @@ getlist () { if test $# = 0; then set cat; fi "$@" < libsyscalls.h \ | tr , '\n' \ - | sed -n 's/^\s*LIBSYSCALLS_'"${getlist_list}"'_\([A-Z0-9_]\+\(\s*=\s*[ 0-9A-Fa-fxXULul()^&|!*/<>~+-]\+\)\?\)\b.*$/\1/p' \ + | sed -n 's/^[[:space:]]*LIBSYSCALLS_'"${getlist_list}"'_\([A-Z0-9_]\{1,\}\([[:space:]]*=[[:space:]]*[[:space:]0-9A-Fa-fxXULul()^&|!*/<>~+-]\{1,\}\)\{0,1\}\)\([^A-Za-z0-9_].*\)*$/\1/p' \ | tr = ' ' \ | (i=0; while read name value; do if test -n "$value"; then diff --git a/tests/signals b/tests/signals index 7e58621..4052402 100644 --- a/tests/signals +++ b/tests/signals @@ -6,26 +6,26 @@ for os in $(getnamelist OS); do for arch in $(getnamelist ARCH); do archn=$(getnum ARCH $arch) get-signals.tu $osn $archn $os $arch > $a - grep -v '^[0-9]\+ -' >/dev/null < $a + grep -v '^[0-9]\{1,\} -' >/dev/null < $a grep -v '^-' < $a > $b - grep '^\([0-9]\+\) \1 ' < $a | diff -u $a - + grep '^\([0-9]\{1,\}\) \1 ' < $a | diff -u $a - if issupported $os $arch; then (! test "$(cat $a)" = x) if test "$os" = LINUX; then signed=1 - grep '^[0-9]\+ [0-9]\+ [A-Z0-9_+]\+$' >/dev/null < $a - test -z "$(grep -v '^[0-9]\+ [0-9]\+ [A-Z0-9_+]\+$' < $a)" + grep '^[0-9]\{1,\} [0-9]\{1,\} [A-Z0-9_+]\{1,\}$' >/dev/null < $a + test -z "$(grep -v '^[0-9]\{1,\} [0-9]\{1,\} [A-Z0-9_+]\{1,\}$' < $a)" required="SIGKILL SIGTERM SIGCONT SIGSTOP SIGHUP _SIGRTMIN _SIGRTMIN+8" else continue; fi for req in $required; do - grep '^-\?[0-9]\+ [0-9]\+ '"$req"\$ >/dev/null < $a + grep '^-\{0,1\}[0-9]\{1,\} [0-9]\{1,\} '"$req"\$ >/dev/null < $a done cut -d ' ' -f $(( 2 - signed )) < $a > $b && sort -n < $b | diff -u $b - if test -f testcases/signals-$os-$arch; then if ! diff -u testcases/signals-$os-$arch $a; then - printf '\x1b[33m%s\x1b[m\n' "Maybe new signals have been added for $os on $arch" + printf '\033[33m%s\033[m\n' "Maybe new signals have been added for $os on $arch" exit 1 fi fi diff --git a/tests/split-register-types b/tests/split-register-types index 3b3070b..454d836 100644 --- a/tests/split-register-types +++ b/tests/split-register-types @@ -13,7 +13,7 @@ for os in $(getnamelist OS); do for stype in INT64_HIGH_32 INT64_LOW_32 INT64_FRONT_32 INT64_BACK_32; do utype=U$stype - rtype="$(printf '%s\n' "$stype" | sed 's/^\(INT\)[0-9]\+_[A-Z]\+_\([0-9]\+\)$/\1\2/')" + rtype="$(printf '%s\n' "$stype" | sed 's/^\(INT\)[0-9]\{1,\}_[A-Z]\{1,\}_\([0-9]\{1,\}\)$/\1\2/')" test ! "$rtype" = "$stype" rtypen=$(lookupnum "$types" $rtype) stypen=$(lookupnum "$types" $stype) diff --git a/tests/syscall-errors b/tests/syscall-errors index 0d36428..8d85ded 100644 --- a/tests/syscall-errors +++ b/tests/syscall-errors @@ -6,26 +6,26 @@ for os in $(getnamelist OS); do for arch in $(getnamelist ARCH); do archn=$(getnum ARCH $arch) get-syscall-errors.tu $osn $archn $os $arch > $a - grep -v '^[0-9]\+ -' >/dev/null < $a + grep -v '^[0-9]\{1,\} -' >/dev/null < $a grep -v '^-' < $a > $b - grep '^\([0-9]\+\) \1 ' < $a | diff -u $a - + grep '^\([0-9]\{1,\}\) \1 ' < $a | diff -u $a - if issupported $os $arch; then (! test "$(cat $a)" = x) if test "$os" = LINUX; then signed=1 - grep '^[0-9]\+ [0-9]\+ [A-Z0-9_]\+$' >/dev/null < $a - test -z "$(grep -v '^[0-9]\+ [0-9]\+ [A-Z0-9_]\+$' < $a)" + grep '^[0-9]\{1,\} [0-9]\{1,\} [A-Z0-9_]\{1,\}$' >/dev/null < $a + test -z "$(grep -v '^[0-9]\{1,\} [0-9]\{1,\} [A-Z0-9_]\{1,\}$' < $a)" required="ERESTARTSYS ERESTARTNOINTR ERESTARTNOHAND ERESTART_RESTARTBLOCK EPERM ENOENT EDOM ELOOP" else continue; fi for req in $required; do - grep '^-\?[0-9]\+ [0-9]\+ '"$req"\$ >/dev/null < $a + grep '^-\{0,1\}[0-9]\{1,\} [0-9]\{1,\} '"$req"\$ >/dev/null < $a done cut -d ' ' -f $(( 2 - signed )) < $a > $b && sort -n < $b | diff -u $b - if test -f testcases/errors-$os-$arch; then if ! diff -u testcases/errors-$os-$arch $a; then - printf '\x1b[33m%s\x1b[m\n' "Maybe new errors have been added for $os on $arch" + printf '\033[33m%s\033[m\n' "Maybe new errors have been added for $os on $arch" exit 1 fi fi diff --git a/util/getdefs b/util/getdefs index 43c0d0d..aa06947 100755 --- a/util/getdefs +++ b/util/getdefs @@ -5,20 +5,20 @@ set -e text="$(cat)" -expr='\(0x[0-9a-fA-F]\+\|[0-9]\+\)[Ll]*[Uu]*[Ll]*' -expr='\(\*\|\/\|[+~-]\|<<\|>>\)\?\s*'"$expr" +expr='\(0x[0-9a-fA-F]\{1,\}\|[0-9]\{1,\}\)[Ll]*[Uu]*[Ll]*' +expr='\(\*\|\/\|[+~-]\|<<\|>>\)\{0,1\}[[:space:]]*'"$expr" expr='\('"$expr"'\|(\|)\)' -expr='\s*\('"$expr"'\s*\)\+' +expr='[[:space:]]*\('"$expr"'[[:space:]]*\)\{1,\}' filter () { - sed -n 's/^\s*#\s*define\s\+\('"$1"'\)\s\+\('"$expr"'\)\s*\(\/.*\)\?$/\1 \2/p' + sed -n 's/^[[:space:]]*#[[:space:]]*define[[:space:]]\{1,\}\('"$1"'\)[[:space:]]\{1,\}\('"$expr"'\)[[:space:]]*\(\/.*\)\{0,1\}$/\1 \2/p' } if test $# = 0; then - printf '%s\n' "$text" | filter '[A-Z0-9_]\+' + printf '%s\n' "$text" | filter '[A-Z0-9_]\{1,\}' else for prefix; do - printf '%s\n' "$text" | filter "$prefix"'_[A-Z0-9_]\+' + printf '%s\n' "$text" | filter "$prefix"'_[A-Z0-9_]\{1,\}' done fi | \ while read name value; do diff --git a/util/getenum b/util/getenum index 343ce76..b28236a 100755 --- a/util/getenum +++ b/util/getenum @@ -3,9 +3,9 @@ set -e -sed '1,/^\s*enum\s\+'"$1"'\b/d' | \ +sed '1,/^[[:space:]]*enum[[:space:]]\{1,\}'"$1"'\([^A-Za-z0-9_]\|$\)/d' | \ tr '\n' '\0' | cut -d \; -f 1 | tr '\0' '\n' | \ -sed -n 's/^\s*\([A-Z0-9_]\+\)\(\s*=[^,]*\)\?\s*,\?\s*\(\/.*\)\?/\1\2/p' | \ +sed -n 's/^[[:space:]]*\([A-Z0-9_]\{1,\}\)\([[:space:]]*=[^,]*\)\{0,1\}[[:space:]]*,\{0,1\}[[:space:]]*\(\/.*\)\{0,1\}/\1\2/p' | \ sed 's/=/ /g' | \ ( prev=-1 |