feat: add cwd tracking to kernel, remove shell hack, update system utilities to use getcwd, fix tcc libc stub, fix nonexistent directory issue
This commit is contained in:
@@ -91,6 +91,7 @@ namespace Sched {
|
||||
processTable[i].heapNext = 0;
|
||||
processTable[i].args[0] = '\0';
|
||||
processTable[i].user[0] = '\0';
|
||||
processTable[i].cwd[0] = '\0';
|
||||
processTable[i].runningOnCpu = -1;
|
||||
processTable[i].killPending = false;
|
||||
processTable[i].waitingForPid = -1;
|
||||
@@ -301,6 +302,23 @@ namespace Sched {
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
auto* cpu = Smp::GetCurrentCpuData();
|
||||
int parentSlot = cpu->currentSlot;
|
||||
if (parentSlot >= 0 && processTable[parentSlot].cwd[0]) {
|
||||
int i = 0;
|
||||
for (; i < 255 && processTable[parentSlot].cwd[i]; i++) {
|
||||
proc.cwd[i] = processTable[parentSlot].cwd[i];
|
||||
}
|
||||
proc.cwd[i] = '\0';
|
||||
} else {
|
||||
proc.cwd[0] = '0';
|
||||
proc.cwd[1] = ':';
|
||||
proc.cwd[2] = '/';
|
||||
proc.cwd[3] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
proc.redirected = false;
|
||||
proc.parentPid = -1;
|
||||
proc.outBuf = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user