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

Function SysGetFileStatusFlags

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

//////////////////////// \brief SysGetFileStatusFlags(fd) Get a file handle's mode/status flags \param fd (int) file descriptor \return flags on success, negative error code on failure ////////////////////////

Source from the content-addressed store, hash-verified

2040/// \return flags on success, negative error code on failure
2041/////////////////////////////
2042long SysGetFileStatusFlags(regs64_t* r){
2043 int fd = static_cast<int>(SC_ARG0(r));
2044 fs_fd_t* handle;
2045
2046 process_t* currentProcess = Scheduler::GetCurrentProcess();
2047 if(static_cast<unsigned>(fd) > currentProcess->fileDescriptors.get_length() || !(handle = currentProcess->fileDescriptors[fd])){
2048 return -EBADF;
2049 }
2050
2051 return handle->mode;
2052}
2053
2054/////////////////////////////
2055/// \brief SysSetFileStatusFlags(fd, flags) Set a file handle's mode/status flags

Callers

nothing calls this directly

Calls 2

GetCurrentProcessFunction · 0.85
get_lengthMethod · 0.45

Tested by

no test coverage detected