git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Code-base clean-up and refactoring (#47)
[lunaix-os.git]
/
lunaix-os
/
kernel
/
process
/
sched.c
diff --git
a/lunaix-os/kernel/process/sched.c
b/lunaix-os/kernel/process/sched.c
index 574d593a0db86c0960b5bfd50a830a80206c2c2c..31775bfdf7c36d19c77120c3a67d76da2e11d747 100644
(file)
--- a/
lunaix-os/kernel/process/sched.c
+++ b/
lunaix-os/kernel/process/sched.c
@@
-1,7
+1,7
@@
-#include <
sys
/abi.h>
-#include <
sys/m
m/mempart.h>
+#include <
asm
/abi.h>
+#include <
as
m/mempart.h>
-#include <
sys
/cpu.h>
+#include <
asm
/cpu.h>
#include <lunaix/fs/taskfs.h>
#include <lunaix/mm/cake.h>
#include <lunaix/fs/taskfs.h>
#include <lunaix/mm/cake.h>
@@
-20,7
+20,7
@@
#include <lunaix/hart_state.h>
#include <lunaix/kpreempt.h>
#include <lunaix/hart_state.h>
#include <lunaix/kpreempt.h>
-#include <
lunaix/
generic/isrm.h>
+#include <
asm-
generic/isrm.h>
#include <klibc/string.h>
#include <klibc/string.h>
@@
-73,10
+73,9
@@
run(struct thread* thread)
clean-up on these thread, in the preemptible kernel 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();
// 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)) {
;
if (unlikely(i == MAX_PROCESS)) {
-
panick
("Panic in Ponyville shimmer!");
+
fail
("Panic in Ponyville shimmer!");
}
return i;
}
return i;
@@
-550,7
+549,7
@@
delete_process(struct proc_info* proc)
pid_t
destroy_process(pid_t pid)
pid_t
destroy_process(pid_t pid)
-{
+{
int index = pid;
if (index <= 0 || index > sched_ctx.ptable_len) {
syscall_result(EINVAL);
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) {
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;
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) {
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;
}
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;
}
}
pos->state = PS_TERMNAT;
}
}