Kernel: refresh task_misbehave()
That function was severely outdated.
This commit is contained in:
parent
ef8ba3dec4
commit
f3af3e252b
@ -174,6 +174,14 @@ int main()
|
||||
}
|
||||
else { printf("Success!! Got PID %ld\n", child); }
|
||||
|
||||
child = fork();
|
||||
if (child < 0)
|
||||
{
|
||||
perror("fork");
|
||||
return 1;
|
||||
}
|
||||
if (child == 0) { *(int*)(0xdeadbeef) = 1234; }
|
||||
|
||||
int status;
|
||||
for (;;)
|
||||
{
|
||||
|
@ -287,8 +287,17 @@ void Scheduler::task_misbehave(Context* context, int64_t status)
|
||||
{
|
||||
ASSERT(Interrupts::is_in_handler());
|
||||
kdbgln("exit: task %ld misbehaved, used %ld ms of cpu time", sched_current_task->id, sched_current_task->cpu_time);
|
||||
sched_current_task->state = sched_current_task->Exited;
|
||||
if (sched_current_task->id == 1) sched_current_task->state = sched_current_task->Exited;
|
||||
else
|
||||
sched_current_task->state = sched_current_task->Dying;
|
||||
sched_current_task->exit_status = status;
|
||||
if (sched_current_task->id != 1)
|
||||
{
|
||||
sched_for_each_child(sched_current_task, [](Task* child) {
|
||||
if (child->state != child->Exited) child->ppid = 1;
|
||||
return true;
|
||||
});
|
||||
}
|
||||
task_yield(context);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user