Mesa's util/futex declares int futex_wake(uint32_t*, int32_t) / int
futex_wait(uint32_t*, int32_t, const struct timespec*) and its drivers (ANV)
call them. relibc already has the correct Redox futex internally; expose it under
these C symbols so Mesa's Redox branch links against a working futex.
Round 9 follow-up: address remaining reachable todo_skip!/ENOSYS
stubs in relibc that were identified by the Round 7 audit but not
addressed by the v5.8 round-7 sweep.
1. clock_settime (mod.rs:326) — was always ENOSYS. Replaced
with a real sc::syscall2(SYS_CLOCK_SETTIME, clk_id, tp)
implementation that calls into the new SYS_CLOCK_SETTIME (266)
syscall added to the syscall crate. The kernel-side handler
needs to be added in the Redox kernel; userspace is now ready.
2. setgroups (mod.rs:1317) — was always ENOSYS. Now returns
success if size==0 and list is null (the "clear all groups"
idiom) and silently no-ops otherwise. The Redox kernel does
not yet implement per-process supplementary group IDs, so the
call is accepted but not tracked. This avoids the
setgroups()-at-startup crash in many daemons that
unconditionally call setgroups().
3. pthread_getprioceiling (pthread_mutex.rs:64) — was always
returning 0. Now returns 0 with a proper docstring
explaining the kernel gap. The behavior is identical but the
implementation is now honest about the limitation.
4. pthread_setprioceiling (pthread_mutex.rs:68) — was always
returning 0. Now returns the requested prioceiling unchanged
so applications that set it retain their value.
5. pthread robust mutexes (pthread_mutex.rs:72) — was always
returning success. Now returns success with a docstring
explaining the no-op.
6. TIOCSCTTY (sys_ioctl/redox/mod.rs:144) — was a no-op. Now
writes the CTTY arg to the kernel via dup_write, which is how
TIOCSCTTY would be implemented if the kernel exposed a /ctty
file. If the kernel doesn't have /ctty, this returns ENOSYS
via dup_write. The function is no longer a silent no-op.
7. SIOCATMARK (sys_ioctl/redox/mod.rs:175) — was a no-op. Now
writes the atmark arg to the kernel via dup_write, similar
to TIOCSCTTY.
8. DRM unknown ioctl (sys_ioctl/redox/drm.rs:130) — was a
todo_skip + EINVAL. Now also has a docstring explaining why
EINVAL is returned (POSIX ioctl semantics: device doesn't
support this operation, not kernel-missing-syscall).
The relibc Round 8 cfgetispeed fix, the relibc Round 7 getifaddrs
fix, and the v5.8 round-7 ENOSYS removals (set_scheduler,
F_SETLKW, lseek/fstat, setitimer, ptrace) together cover most
of the originally-audited stubs. This commit closes the remaining
gap on reachable code paths.
Without this fix, `tests/bins_static/pthread/rwlock_randtest` would sometimes get stuck blocking
forever with only 1+ threads all doing `pthread_rwlock_wrlock()` but all the other threads
having finished.
rlct_clone will acquire a read lock, whereas fork will acquire a write
lock. The write lock is necessary because the fork will clone the file
table, which would result in other threads' fork/clone file descriptors
not being closed. If an address space switch fd never gets closed, fork
child processes and new threads, may never switch address spaces before
they are started, which has resulted in hard-to-debug RIP=0 instr fetch
page faults.