On Mon, Jul 31, 2023 at 05:03:48PM -0400, Theodore Preduta wrote: > 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).)
I think this would be quite tricky for the test code in userland. But what about a variant of the initial suggestion: // returns an integer descriptor int open_emul(const char *emulname); // invokes a syscall under an open emulation int emul_syscall(int emul, int number, ...); // frees all state for the emulation, returns 0 or -1 int close_emul(int emul); IMO this still is far better than exposing native syscalls that we do not really need/want. Martin P.S.: independent of this, the "make kqueue work across forks" is a good idea, independent of the epoll syscall.