]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
makesyscalls.lua: improve syscall ordering validation
authorkevans <kevans@FreeBSD.org>
Tue, 4 Aug 2020 21:49:13 +0000 (21:49 +0000)
committerkevans <kevans@FreeBSD.org>
Tue, 4 Aug 2020 21:49:13 +0000 (21:49 +0000)
commit7d3feaaa814d69703d4e13f71e2d6102c1aa1b59
tree818c4c8ba9dba3dfdc8f5b7b12d36f2b3a95b602
parent8e71b01ec3ee9e5ca22b9dad239e1879c9b5e07a
makesyscalls.lua: improve syscall ordering validation

There were two separate issues here:

1.) #if/#else wasn't taken into account at all for maxsyscall figures, but
2.) We didn't validate contiguous syscall numbers anyways...

This kind of inconsistency is bad as we don't currently ensure explicit
indexing of, e.g., the sysent array if one syscall is unimplemented/missing.
This could be fixed and might be more robust, but it's also good to have the
"documentation" that comes from being explicit as to what the missing
syscalls are.

The new version looks much like the awk version; stash off the current
'last highest syscall seen' if we hit an #if, restore to that if we hit an
#else, and make sure that we're explicitly always defining the next syscall.

The logic at the tail end of process_syscall_def that moves maxsyscall has
been 'cleaned up' a little since we're now ensuring that it's monotonically
increasing earlier in the function. At the moment I think it's unlikely we'd
see range-definitions that are not UNIMPL, but there's no reason to
specifically handle that case for bumping maxsyscall there.

This change was provoked by reading the commit message for r363832 and
realizing that this validation hadn't been included in the initial rewrite
to lua.

Reviewed by: brooks
Differential Revision: https://reviews.freebsd.org/D25945
sys/tools/makesyscalls.lua