mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-23 07:12:46 +01:00
kernel/svc: Correct behavior of svcResetSignal()
While partially correct, this service call allows the retrieved event to be null, as it also uses the same handle to check if it was referring to a Process instance. The previous two changes put the necessary machinery in place to allow for this, so we can simply call those member functions here and be done with it.
This commit is contained in:
parent
c7462ce712
commit
2f253986df
1 changed files with 11 additions and 4 deletions
|
@ -1433,17 +1433,24 @@ static ResultCode CloseHandle(Handle handle) {
|
|||
return handle_table.Close(handle);
|
||||
}
|
||||
|
||||
/// Reset an event
|
||||
/// Clears the signaled state of an event or process.
|
||||
static ResultCode ResetSignal(Handle handle) {
|
||||
LOG_DEBUG(Kernel_SVC, "called handle 0x{:08X}", handle);
|
||||
|
||||
const auto& handle_table = Core::CurrentProcess()->GetHandleTable();
|
||||
|
||||
auto event = handle_table.Get<ReadableEvent>(handle);
|
||||
if (event) {
|
||||
return event->Reset();
|
||||
}
|
||||
|
||||
ASSERT(event != nullptr);
|
||||
auto process = handle_table.Get<Process>(handle);
|
||||
if (process) {
|
||||
return process->ClearSignalState();
|
||||
}
|
||||
|
||||
event->Clear();
|
||||
return RESULT_SUCCESS;
|
||||
LOG_ERROR(Kernel_SVC, "Invalid handle (0x{:08X})", handle);
|
||||
return ERR_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
/// Creates a TransferMemory object
|
||||
|
|
Loading…
Reference in a new issue