Kernel: Rename blocking_wait_info's wait_pid to pid

This commit is contained in:
apio 2022-10-30 19:28:43 +01:00
parent 9c3792718c
commit 29c59abf7d
2 changed files with 9 additions and 9 deletions

View File

@ -92,7 +92,7 @@ struct Task
} blocking_read_info;
struct
{
int64_t wait_pid;
int64_t pid;
int* wstatus;
} blocking_wait_info;
};

View File

@ -498,7 +498,7 @@ void sys_waitpid(Context* context, long pid, int* wstatus,
kdbgln("blocking wait on any child");
sched_current_task->state = sched_current_task->Blocking;
sched_current_task->block_reason = BlockReason::Waiting;
sched_current_task->blocking_wait_info.wait_pid = -1;
sched_current_task->blocking_wait_info.pid = -1;
if (wstatus) sched_current_task->blocking_wait_info.wstatus = kwstatus;
else
sched_current_task->blocking_wait_info.wstatus = nullptr;
@ -539,7 +539,7 @@ void sys_waitpid(Context* context, long pid, int* wstatus,
}
sched_current_task->state = sched_current_task->Blocking;
sched_current_task->block_reason = BlockReason::Waiting;
sched_current_task->blocking_wait_info.wait_pid = pid;
sched_current_task->blocking_wait_info.pid = pid;
if (wstatus) sched_current_task->blocking_wait_info.wstatus = kwstatus;
else
sched_current_task->blocking_wait_info.wstatus = nullptr;
@ -568,7 +568,7 @@ void sys_waitpid(Context* context, long pid, int* wstatus,
bool Task::is_wait_still_blocking()
{
Task* child = nullptr;
if (blocking_wait_info.wait_pid == -1)
if (blocking_wait_info.pid == -1)
{
sched_for_each_child(sched_current_task, [&](Task* task) {
if (task->state == task->Dying)
@ -581,13 +581,13 @@ bool Task::is_wait_still_blocking()
if (!child) return true;
else
{
blocking_wait_info.wait_pid = child->id; // We're committed to this child now.
blocking_wait_info.pid = child->id; // We're committed to this child now.
return false;
}
}
else
{
child = Scheduler::find_by_pid(blocking_wait_info.wait_pid);
child = Scheduler::find_by_pid(blocking_wait_info.pid);
ASSERT(child); // since sys_waitpid should have validated this child, and the only way for it to disappear from
// the process list is for someone to wait for it, this should be pretty safe.
if (child->state != child->Dying) return true;
@ -598,9 +598,9 @@ bool Task::is_wait_still_blocking()
void Task::resume_wait()
{
ASSERT(blocking_wait_info.wait_pid != -1); // is_wait_still_blocking should have chosen a child for us if the user
// process told us to wait for any child.
Task* child = Scheduler::find_by_pid(blocking_wait_info.wait_pid);
ASSERT(blocking_wait_info.pid != -1); // is_wait_still_blocking should have chosen a child for us if the user
// process told us to wait for any child.
Task* child = Scheduler::find_by_pid(blocking_wait_info.pid);
ASSERT(child); // This should also already have been validated.
if (blocking_wait_info.wstatus)