Kernel: Rename blocking_wait_info's wait_pid to pid
This commit is contained in:
parent
9c3792718c
commit
29c59abf7d
@ -92,7 +92,7 @@ struct Task
|
|||||||
} blocking_read_info;
|
} blocking_read_info;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
int64_t wait_pid;
|
int64_t pid;
|
||||||
int* wstatus;
|
int* wstatus;
|
||||||
} blocking_wait_info;
|
} blocking_wait_info;
|
||||||
};
|
};
|
||||||
|
@ -498,7 +498,7 @@ void sys_waitpid(Context* context, long pid, int* wstatus,
|
|||||||
kdbgln("blocking wait on any child");
|
kdbgln("blocking wait on any child");
|
||||||
sched_current_task->state = sched_current_task->Blocking;
|
sched_current_task->state = sched_current_task->Blocking;
|
||||||
sched_current_task->block_reason = BlockReason::Waiting;
|
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;
|
if (wstatus) sched_current_task->blocking_wait_info.wstatus = kwstatus;
|
||||||
else
|
else
|
||||||
sched_current_task->blocking_wait_info.wstatus = nullptr;
|
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->state = sched_current_task->Blocking;
|
||||||
sched_current_task->block_reason = BlockReason::Waiting;
|
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;
|
if (wstatus) sched_current_task->blocking_wait_info.wstatus = kwstatus;
|
||||||
else
|
else
|
||||||
sched_current_task->blocking_wait_info.wstatus = nullptr;
|
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()
|
bool Task::is_wait_still_blocking()
|
||||||
{
|
{
|
||||||
Task* child = nullptr;
|
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) {
|
sched_for_each_child(sched_current_task, [&](Task* task) {
|
||||||
if (task->state == task->Dying)
|
if (task->state == task->Dying)
|
||||||
@ -581,13 +581,13 @@ bool Task::is_wait_still_blocking()
|
|||||||
if (!child) return true;
|
if (!child) return true;
|
||||||
else
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
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
|
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.
|
// the process list is for someone to wait for it, this should be pretty safe.
|
||||||
if (child->state != child->Dying) return true;
|
if (child->state != child->Dying) return true;
|
||||||
@ -598,9 +598,9 @@ bool Task::is_wait_still_blocking()
|
|||||||
|
|
||||||
void Task::resume_wait()
|
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
|
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.
|
// process told us to wait for any child.
|
||||||
Task* child = Scheduler::find_by_pid(blocking_wait_info.wait_pid);
|
Task* child = Scheduler::find_by_pid(blocking_wait_info.pid);
|
||||||
ASSERT(child); // This should also already have been validated.
|
ASSERT(child); // This should also already have been validated.
|
||||||
|
|
||||||
if (blocking_wait_info.wstatus)
|
if (blocking_wait_info.wstatus)
|
||||||
|
Loading…
Reference in New Issue
Block a user