//////////////////////// \brief SysKernelObjectWait (objects, count) Wait on one KernelObject \param objects (handle_t*) Pointer to array of handles to wait on \param count (size_t) Amount of objects to wait on \return negative error code on failure ////////////////////////
| 2568 | /// \return negative error code on failure |
| 2569 | ///////////////////////////// |
| 2570 | long SysKernelObjectWait(regs64_t* r){ |
| 2571 | process_t* currentProcess = Scheduler::GetCurrentProcess(); |
| 2572 | unsigned count = SC_ARG1(r); |
| 2573 | |
| 2574 | if(!Memory::CheckUsermodePointer(SC_ARG0(r), count * sizeof(handle_id_t), currentProcess->addressSpace)){ |
| 2575 | return -EFAULT; |
| 2576 | } |
| 2577 | |
| 2578 | Handle* handles[count]; |
| 2579 | |
| 2580 | KernelObjectWatcher watcher; |
| 2581 | for(unsigned i = 0; i < count; i++){ |
| 2582 | if(Scheduler::FindHandle(currentProcess, reinterpret_cast<handle_id_t*>(SC_ARG0(r))[i], &handles[i])){ |
| 2583 | IF_DEBUG(debugLevelSyscalls >= DebugLevelNormal, { |
| 2584 | Log::Warning("SysKernelObjectWait: Invalid handle ID %d", SC_ARG0(r)); |
| 2585 | }); |
| 2586 | return -EINVAL; |
| 2587 | } |
| 2588 | |
| 2589 | watcher.WatchObject(handles[i]->ko, 0); |
| 2590 | } |
| 2591 | watcher.Wait(); |
| 2592 | |
| 2593 | return 0; |
| 2594 | } |
| 2595 | |
| 2596 | |
| 2597 | ///////////////////////////// |
nothing calls this directly
no test coverage detected