X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/eb251af8672e033f29322253f136e09c76f2b0a3..90129c6876c9bac2e468ab82c8264352d1952b4d:/lunaix-os/kernel/sched.c diff --git a/lunaix-os/kernel/sched.c b/lunaix-os/kernel/sched.c index 8e089d6..d1ee39d 100644 --- a/lunaix-os/kernel/sched.c +++ b/lunaix-os/kernel/sched.c @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -202,6 +203,11 @@ __DEFINE_LXSYSCALL3(pid_t, waitpid, pid_t, pid, int*, status, int, options) return _wait(pid, status, options); } +__DEFINE_LXSYSCALL(int, geterrno) +{ + return __current->k_status; +} + pid_t _wait(pid_t wpid, int* status, int options) { @@ -267,6 +273,7 @@ alloc_process() proc->pid = i; proc->created = clock_systime(); proc->pgid = proc->pid; + proc->fdtable = vzalloc(sizeof(struct v_fdtable)); llist_init_head(&proc->mm.regions); llist_init_head(&proc->children); @@ -282,7 +289,7 @@ commit_process(struct proc_info* process) assert(process == &sched_ctx._procs[process->pid]); if (process->state != PS_CREATED) { - __current->k_status = LXINVL; + __current->k_status = EINVAL; return; } @@ -305,7 +312,7 @@ destroy_process(pid_t pid) { int index = pid; if (index <= 0 || index > sched_ctx.ptable_len) { - __current->k_status = LXINVLDPID; + __current->k_status = EINVAL; return; } struct proc_info* proc = &sched_ctx._procs[index];