OpenOrbis / musl

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

Sleep is broken #4

Closed Cryptogenic closed 4 years ago

Cryptogenic commented 4 years ago

Originally reported by LM in the discord:

Apparently sleep() does not function properly, calling it is effectively a no-op.

ChendoChap commented 4 years ago

https://github.com/OpenOrbis/musl/blob/55b65f01d9c27a143474482a5678eccf938044c1/src/include/time.h#L7 nanosleep will end up calling this, this does not match freebsd's nanosleep syscall signature

sleirsgoevy commented 4 years ago

FreeBSD version matches the userspace nanosleep(const struct timespec, struct timespec), doesn't it?

By the way, why not just use the real libc?

Cryptogenic commented 4 years ago

FreeBSD version matches the userspace nanosleep(const struct timespec, struct timespec), doesn't it?

By the way, why not just use the real libc?

The wrapper currently ifdef's out the implementation for ps4 because it uses syscalls that aren't present on FreeBSD 9 (such as sys_clock_nanosleep), I'll fix this today.

Regarding real libc, libc is loaded by applications from the package. We do not own the rights to redistribute PS4's libc, so we either have to use sceLibcInternal (not great, misses stuff that's important) or port an open source libc.

Even if we used sceLibcInternal for applications though, we still need an open source libc regardless for portability reasons, because anything that depends on libc (libc++ for example) needs to be able to build against it, so that's why we use musl.