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

Function SysPWrite

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

Source from the content-addressed store, hash-verified

977}
978
979long SysPWrite(regs64_t* r){
980 if(SC_ARG0(r) > Scheduler::GetCurrentProcess()->fileDescriptors.get_length()){
981 return -EBADF;
982 }
983 FsNode* node;
984 if(Scheduler::GetCurrentProcess()->fileDescriptors.get_at(SC_ARG0(r)) || !(node = Scheduler::GetCurrentProcess()->fileDescriptors.get_at(SC_ARG0(r))->node)){
985 Log::Warning("sys_pwrite: Invalid file descriptor: %d", SC_ARG0(r));
986 return -EBADF;
987 }
988
989 if(!Memory::CheckUsermodePointer(SC_ARG1(r), SC_ARG2(r), Scheduler::GetCurrentProcess()->addressSpace)) {
990 return -EFAULT;
991 }
992
993 uint64_t off = SC_ARG4(r);
994
995 return fs::Write(node, off, SC_ARG2(r), (uint8_t*)SC_ARG1(r));
996}
997
998long SysIoctl(regs64_t* r){
999 int fd = SC_ARG0(r);

Callers

nothing calls this directly

Calls 6

GetCurrentProcessFunction · 0.85
WarningFunction · 0.85
CheckUsermodePointerFunction · 0.85
get_atMethod · 0.80
WriteFunction · 0.70
get_lengthMethod · 0.45

Tested by

no test coverage detected