OpenOrbis / musl

A PS4 port of musl for the OpenOrbis PS4 Toolchain.
Other
34 stars 9 forks source link

Better handling of unavailable syscalls #3

Open josephcsible opened 4 years ago

josephcsible commented 4 years ago

For syscalls that the PS4 doesn't have available, we currently punt by always returning -1. There seems to be two broad categories for how we can usually do this better, though:

  1. Syscalls that really have no equivalent at all, like fanotify_init, should set errno to ENOSYS, so that the caller will have a clue about why it actually failed, instead of getting a random unrelated error.
  2. Syscalls that can be emulated in userspace with only slight degradation, like pipe2, should do that instead of failing entirely. In fact, in that case it looks like the code to do that is already there; we just #ifdef'ed out a bit too much.
Cryptogenic commented 4 years ago

For point #2, I handled the pipe2 instance, however I'll try to take another pass to see which other syscalls can be done this way. If you can think of any other ones, feel free to mention them :)