mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-25 05:55:13 +00:00
Kernel: Fix futex
syscall return values
We were returning `int`s from two functions that caused `ErrorOr` to not recognize the error codes as a special case. For example, `ETIMEDOUT` was returned as the positive number 66 resulting in all kinds of defective behavior. As a result, SDL2's timer subsystem was not working at all, since the `SDL_MUTEX_TIMEDOUT` value was never returned.
This commit is contained in:
parent
30580ed7e4
commit
46ad5f2a17
Notes:
sideshowbarker
2024-07-18 00:42:45 +09:00
Author: https://github.com/gmta Commit: https://github.com/SerenityOS/serenity/commit/46ad5f2a171 Pull-request: https://github.com/SerenityOS/serenity/pull/11063
1 changed files with 3 additions and 3 deletions
|
@ -99,7 +99,7 @@ ErrorOr<FlatPtr> Process::sys$futex(Userspace<const Syscall::SC_futex_params*> u
|
|||
auto user_address = FlatPtr(params.userspace_address);
|
||||
auto user_address2 = FlatPtr(params.userspace_address2);
|
||||
|
||||
auto do_wait = [&](u32 bitset) -> int {
|
||||
auto do_wait = [&](u32 bitset) -> ErrorOr<FlatPtr> {
|
||||
bool did_create;
|
||||
RefPtr<FutexQueue> futex_queue;
|
||||
do {
|
||||
|
@ -136,7 +136,7 @@ ErrorOr<FlatPtr> Process::sys$futex(Userspace<const Syscall::SC_futex_params*> u
|
|||
return 0;
|
||||
};
|
||||
|
||||
auto do_requeue = [&](Optional<u32> val3) -> int {
|
||||
auto do_requeue = [&](Optional<u32> val3) -> ErrorOr<FlatPtr> {
|
||||
auto user_value = user_atomic_load_relaxed(params.userspace_address);
|
||||
if (!user_value.has_value())
|
||||
return EFAULT;
|
||||
|
@ -204,7 +204,7 @@ ErrorOr<FlatPtr> Process::sys$futex(Userspace<const Syscall::SC_futex_params*> u
|
|||
if (!oldval.has_value())
|
||||
return EFAULT;
|
||||
atomic_thread_fence(AK::MemoryOrder::memory_order_acquire);
|
||||
int result = do_wake(user_address, params.val, {});
|
||||
auto result = do_wake(user_address, params.val, {});
|
||||
if (params.val2 > 0) {
|
||||
bool compare_result;
|
||||
switch (_FUTEX_CMP(params.val3)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue