fix: properly record PIDs
This commit is contained in:
@@ -367,6 +367,9 @@ namespace Sched {
|
|||||||
proc.sleepUntilTick = 0;
|
proc.sleepUntilTick = 0;
|
||||||
proc.waitingOnObject = nullptr;
|
proc.waitingOnObject = nullptr;
|
||||||
|
|
||||||
|
auto* currentCpu = Smp::GetCurrentCpuData();
|
||||||
|
int parentSlot = currentCpu ? currentCpu->currentSlot : -1;
|
||||||
|
|
||||||
// Copy arguments string into process
|
// Copy arguments string into process
|
||||||
proc.args[0] = '\0';
|
proc.args[0] = '\0';
|
||||||
if (args != nullptr) {
|
if (args != nullptr) {
|
||||||
@@ -379,8 +382,6 @@ namespace Sched {
|
|||||||
|
|
||||||
// Inherit user string from parent, or default to "system" if no parent
|
// Inherit user string from parent, or default to "system" if no parent
|
||||||
{
|
{
|
||||||
auto* cpu = Smp::GetCurrentCpuData();
|
|
||||||
int parentSlot = cpu->currentSlot;
|
|
||||||
if (parentSlot >= 0) {
|
if (parentSlot >= 0) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (; i < 31 && processTable[parentSlot].user[i]; i++)
|
for (; i < 31 && processTable[parentSlot].user[i]; i++)
|
||||||
@@ -395,8 +396,6 @@ namespace Sched {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
auto* cpu = Smp::GetCurrentCpuData();
|
|
||||||
int parentSlot = cpu->currentSlot;
|
|
||||||
if (parentSlot >= 0 && processTable[parentSlot].cwd[0]) {
|
if (parentSlot >= 0 && processTable[parentSlot].cwd[0]) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (; i < 255 && processTable[parentSlot].cwd[i]; i++) {
|
for (; i < 255 && processTable[parentSlot].cwd[i]; i++) {
|
||||||
@@ -412,7 +411,7 @@ namespace Sched {
|
|||||||
}
|
}
|
||||||
|
|
||||||
proc.redirected = false;
|
proc.redirected = false;
|
||||||
proc.parentPid = -1;
|
proc.parentPid = (parentSlot >= 0) ? processTable[parentSlot].pid : -1;
|
||||||
proc.outBuf = nullptr;
|
proc.outBuf = nullptr;
|
||||||
proc.outHead = 0;
|
proc.outHead = 0;
|
||||||
proc.outTail = 0;
|
proc.outTail = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user