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

Function SysChdir

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

Source from the content-addressed store, hash-verified

460}
461
462long SysChdir(regs64_t* r){
463 if(SC_ARG0(r)){
464 char* path = fs::CanonicalizePath((char*)SC_ARG0(r), Scheduler::GetCurrentProcess()->workingDir);
465 FsNode* n = fs::ResolvePath(path);
466 if(!n) {
467 Log::Warning("chdir: Could not find %s", path);
468 return -1;
469 } else if (n->flags != FS_NODE_DIRECTORY){
470 return -ENOTDIR;
471 }
472 strcpy(Scheduler::GetCurrentProcess()->workingDir, path);
473 } else Log::Warning("chdir: Invalid path string");
474 return 0;
475}
476
477long SysTime(regs64_t* r){
478 return 0;

Callers

nothing calls this directly

Calls 5

CanonicalizePathFunction · 0.85
GetCurrentProcessFunction · 0.85
ResolvePathFunction · 0.85
WarningFunction · 0.85
strcpyFunction · 0.85

Tested by

no test coverage detected