This comes somewhat as a "part 2" to https://mail-index.netbsd.org/tech-kern/2023/06/21/msg028926.html
Given the responses to that thread, I decided to add native stubs for epoll (the fact epoll is widespread alone justifies it, but it has already had some negative side effects, see: https://mail-index.netbsd.org/source-changes-d/2023/07/30/msg013999.html). However, there are other syscalls, namely inotify, where it can't really be justified, but the code still deserves tests. As such I'm looking for a way to test emulation syscalls with ATF. One idea (mentioned in the original thread) would be to introduce a syscall along the lines of int emul_syscall(const char *emul_name, int number, ...) which executes a single syscall. The flaw with this idea is that state may need to be stored across syscalls in struct linux_emuldata, but I don't know how this interface could accommodate this. Another idea would be to introduce a syscall along the lines of int setemul(const char *emul_name) which would switch the syscall table dynamically so that the test case could be run under emulation (preserving emuldata state) and then switch back to report the result. (And then individual syscalls would be called via __syscall(2).) Both of these ideas have security security implications. So they should be limited to root (or perhaps a new kauth capability). A third idea would be to figure out a way to compile ATF tests directly as Linux binaries. That way no new syscall would be needed, but this will likely cause pain when trying to distribute the tests. Once again... thoughts? Theo(dore)