diff options
author | kvik <kvik@a-b.xyz> | 2020-09-23 17:17:52 +0200 |
---|---|---|
committer | kvik <kvik@a-b.xyz> | 2020-09-23 17:17:52 +0200 |
commit | 2968225196d6078203e88d26572a51216f545c1d (patch) | |
tree | d2e074d4d65dd9c030a5731cb0839d38d3db09f2 | |
parent | 23de6808f70552beeb4b3a3374543f7aaf31c4c8 (diff) |
syscall: fix build problem caused by stale tab.h
Recently the script which generates tab.h and the code including it got
incompatibly changed. People reported problems involving syntax errors
when trying to rebuild the system following a sysupdate.
The problem was with the script being embedded within a mkfile rule,
meaning that mk didn't notice it changing and therefore didn't rebuild
the target file. For people who were rebuilding the system this meant
that the old tab.h got included, causing syntax errors.
This patch moves the codegen script into a file and tells mk about this
new dependency, so that tab.h will get rebuilt for everyone. I also
took an opportunity to rewrite the script, hopefuly making it easier to
follow.
-rw-r--r-- | sys/src/cmd/syscall/mkfile | 21 | ||||
-rwxr-xr-x | sys/src/cmd/syscall/mktab.awk | 14 |
2 files changed, 16 insertions, 19 deletions
diff --git a/sys/src/cmd/syscall/mkfile b/sys/src/cmd/syscall/mkfile index 18985a0ec..73af87d0b 100644 --- a/sys/src/cmd/syscall/mkfile +++ b/sys/src/cmd/syscall/mkfile @@ -16,25 +16,8 @@ UPDATE=\ SYSCALL=/sys/src/libc/9syscall/sys.h -tab.h: $SYSCALL - awk ' - BEGIN{ print "enum{" } - { printf "%s, ", $2 } - END{ - print "READ, WRITE, NTAB" - print "};" - }' <$SYSCALL >$target - awk ' - BEGIN{ print "struct Call tab[] = {" } - { printf "[%s] \"%s\", (int(*)(...))%s,\n", - $2, tolower($2), tolower($2) - } - END{ - print "[READ] \"read\", (int(*)(...))read," - print "[WRITE] \"write\", (int(*)(...))write," - print "[NTAB] nil, 0" - print "};" - }' <$SYSCALL >>$target +tab.h: $SYSCALL mktab.awk + mktab.awk $SYSCALL >$target clean:V: rm -f *.[$OS] [$OS].out $TARG $HFILES diff --git a/sys/src/cmd/syscall/mktab.awk b/sys/src/cmd/syscall/mktab.awk new file mode 100755 index 000000000..ab8708022 --- /dev/null +++ b/sys/src/cmd/syscall/mktab.awk @@ -0,0 +1,14 @@ +#!/bin/awk -f +{ e = e $2 ", " + s = s sprintf("[%s] \"%s\", (int(*)(...))%s,\n", + $2, tolower($2), tolower($2)) +} +END{ + e = e "READ, WRITE, NTAB" + s = s "[READ] \"read\", (int(*)(...))read,\n" + s = s "[WRITE] \"write\", (int(*)(...))write,\n" + s = s "[NTAB] nil, 0\n" + + print "enum{", e, "};" + print "struct Call tab[] = {\n", s, "};" +} |