-#include <sys/abi.h>
-#include <sys/mm/mempart.h>
+#include <asm/abi.h>
+#include <asm/mempart.h>
-#include <sys/cpu.h>
+#include <asm/cpu.h>
#include <lunaix/fs/taskfs.h>
#include <lunaix/mm/cake.h>
#include <lunaix/hart_state.h>
#include <lunaix/kpreempt.h>
-#include <lunaix/generic/isrm.h>
-
#include <klibc/string.h>
struct thread empty_thread_obj;
-volatile struct proc_info* __current;
+volatile struct proc_info* __current = NULL;
volatile struct thread* current_thread = &empty_thread_obj;
struct scheduler sched_ctx;
sched_ctx.procs_index = to_check->process->pid;
done:
- isrm_notify_eos(0);
run(to_check);
fail("unexpected return from scheduler");
}
-__DEFINE_LXSYSCALL1(unsigned int, sleep, unsigned int, seconds)
-{
- if (!seconds) {
- return 0;
- }
-
- time_t systime = clock_systime() / 1000;
- struct haybed* bed = ¤t_thread->sleep;
-
- if (bed->wakeup_time) {
- return (bed->wakeup_time - systime);
- }
-
- bed->wakeup_time = systime + seconds;
-
- if (llist_empty(&bed->sleepers)) {
- llist_append(&sched_ctx.sleepers, &bed->sleepers);
- }
-
- store_retval(seconds);
-
- block_current_thread();
- schedule();
-
- return 0;
-}
-
__DEFINE_LXSYSCALL1(unsigned int, alarm, unsigned int, seconds)
{
struct haybed* bed = ¤t_thread->sleep;
;
if (unlikely(i == MAX_PROCESS)) {
- panick("Panic in Ponyville shimmer!");
+ fail("Panic in Ponyville shimmer!");
}
return i;
proc->created = clock_systime();
proc->pgid = proc->pid;
+ proc->root = vfs_sysroot;
+
proc->sigreg = vzalloc(sizeof(struct sigregistry));
- proc->fdtable = vzalloc(sizeof(struct v_fdtable));
+ proc->fdtable = fdtable_create();
proc->mm = procvm_create(proc);
assert(!kernel_process(proc));
if (proc->pid == 1) {
- panick("Attempt to kill init");
+ fail("Attempt to kill init");
}
terminate_proc_only(proc, exit_code);
// 如果其父进程的状态是terminated 或 destroy中的一种
// 或者其父进程是在该进程之后创建的,那么该进程为孤儿进程
return proc_terminated(parent) || parent->created > proc->created;
-}
\ No newline at end of file
+}
+