MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / SysKernelObjectWait

Function SysKernelObjectWait

Kernel/src/arch/x86_64/syscalls.cpp:2570–2594  ·  view source on GitHub ↗

//////////////////////// \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 ////////////////////////

Source from the content-addressed store, hash-verified

2568/// \return negative error code on failure
2569/////////////////////////////
2570long 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/////////////////////////////

Callers

nothing calls this directly

Calls 6

GetCurrentProcessFunction · 0.85
CheckUsermodePointerFunction · 0.85
FindHandleFunction · 0.85
WarningFunction · 0.85
WatchObjectMethod · 0.80
WaitMethod · 0.45

Tested by

no test coverage detected