X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/270869139db617e29a35bb9ded41087bb702f9ac..34f6af4f61e0eec9c96113e07f140b609b4113c8:/lunaix-os/kernel/process/sched.c diff --git a/lunaix-os/kernel/process/sched.c b/lunaix-os/kernel/process/sched.c index 574d593..31775bf 100644 --- a/lunaix-os/kernel/process/sched.c +++ b/lunaix-os/kernel/process/sched.c @@ -1,7 +1,7 @@ -#include -#include +#include +#include -#include +#include #include #include @@ -20,7 +20,7 @@ #include #include -#include +#include #include @@ -73,10 +73,9 @@ run(struct thread* thread) clean-up on these thread, in the preemptible kernel thread. */ -void _preemptible -cleanup_detached_threads() { - ensure_preempt_caller(); - +void +cleanup_detached_threads() +{ // XXX may be a lock on sched_context will ben the most appropriate? cpu_disable_interrupt(); @@ -347,7 +346,7 @@ get_free_pid() { ; if (unlikely(i == MAX_PROCESS)) { - panick("Panic in Ponyville shimmer!"); + fail("Panic in Ponyville shimmer!"); } return i; @@ -550,7 +549,7 @@ delete_process(struct proc_info* proc) pid_t destroy_process(pid_t pid) -{ +{ int index = pid; if (index <= 0 || index > sched_ctx.ptable_len) { syscall_result(EINVAL); @@ -565,6 +564,8 @@ destroy_process(pid_t pid) static void terminate_proc_only(struct proc_info* proc, int exit_code) { + assert(proc->pid != 0); + proc->state = PS_TERMNAT; proc->exit_code = exit_code; @@ -592,13 +593,13 @@ terminate_proccess(struct proc_info* proc, int exit_code) { assert(!kernel_process(proc)); if (proc->pid == 1) { - panick("Attempt to kill init"); + fail("Attempt to kill init"); } terminate_proc_only(proc, exit_code); struct thread *pos, *n; - llist_for_each(pos, n, &__current->threads, proc_sibs) { + llist_for_each(pos, n, &proc->threads, proc_sibs) { pos->state = PS_TERMNAT; } }