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

Function SysClose

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

Source from the content-addressed store, hash-verified

367}
368
369long SysClose(regs64_t* r){
370 int fd = SC_ARG0(r);
371
372 process_t* currentProcess = Scheduler::GetCurrentProcess();
373 if(fd >= static_cast<int>(currentProcess->fileDescriptors.get_length())){
374 Log::Warning("SysClose: Invalid File Descriptor, %d", fd);
375 return -EBADF;
376 }
377
378 fs_fd_t* handle;
379 if((handle = currentProcess->fileDescriptors.at(fd))){
380 fs::Close(handle);
381
382 handle->node = nullptr;
383
384 Scheduler::GetCurrentProcess()->fileDescriptors.at(fd) = nullptr;
385 }
386 return 0;
387}
388
389long SysSleep(regs64_t* r){
390 return 0;

Callers

nothing calls this directly

Calls 4

GetCurrentProcessFunction · 0.85
WarningFunction · 0.85
CloseFunction · 0.50
get_lengthMethod · 0.45

Tested by

no test coverage detected