]> git.ipfire.org Git - thirdparty/systemd.git/commit
missing_syscall: verify our fallback numbers when possible
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 18 Aug 2020 07:22:20 +0000 (09:22 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 24 Aug 2020 17:22:05 +0000 (19:22 +0200)
commit5134e18eedc30bfe5397ed31f94903d984a60cfc
tree0829aea9f14764bca8253e020bcfb555ecc0791d
parenteea63c03b91c5feae702dca571b65f39327c4109
missing_syscall: verify our fallback numbers when possible

Instead of defining the numbers only as fallback, always define our fallback
number, and if we have the real __NR_foo define, assert that our number matches
the real one.

This will result in warnings when our fallback number is not defined, even if
the kernel headers are new enough to define __NR_foo. This will probably annoy
people compiling for seldom-used architectures, but hopefully it'll provide
motivation to add the missing fallback defines.

The upside is that we have a higher chance of catching the cases where we got
the number wrong. Calling the wrong syscall is quite problematic, and with some
back luck, it might take us a long time to notice that we got the number wrong
on some rarely used architecture.

Also, rework some of the fallback wrappers to not call the syscall with a
negative number (that'd fail, but we'd got to the kernel and back). It seems
nicer to let the compiler know that this can never succeed.
src/basic/missing_syscall.h