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
feat: implement rmdir(2), unlink(2), unlinkat(2)
[lunaix-os.git]
/
lunaix-os
/
kernel
/
sched.c
diff --git
a/lunaix-os/kernel/sched.c
b/lunaix-os/kernel/sched.c
index 8e089d64b976be61ddf22fb77259caf9dea54f5b..d1ee39d21bc3424ce5399d2c60f71d53cea58dca 100644
(file)
--- a/
lunaix-os/kernel/sched.c
+++ b/
lunaix-os/kernel/sched.c
@@
-6,6
+6,7
@@
#include <lunaix/mm/kalloc.h>
#include <lunaix/mm/pmm.h>
#include <lunaix/mm/kalloc.h>
#include <lunaix/mm/pmm.h>
+#include <lunaix/mm/valloc.h>
#include <lunaix/mm/vmm.h>
#include <lunaix/process.h>
#include <lunaix/sched.h>
#include <lunaix/mm/vmm.h>
#include <lunaix/process.h>
#include <lunaix/sched.h>
@@
-202,6
+203,11
@@
__DEFINE_LXSYSCALL3(pid_t, waitpid, pid_t, pid, int*, status, int, options)
return _wait(pid, status, options);
}
return _wait(pid, status, options);
}
+__DEFINE_LXSYSCALL(int, geterrno)
+{
+ return __current->k_status;
+}
+
pid_t
_wait(pid_t wpid, int* status, int options)
{
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->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);
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) {
assert(process == &sched_ctx._procs[process->pid]);
if (process->state != PS_CREATED) {
- __current->k_status =
LXINV
L;
+ __current->k_status =
EINVA
L;
return;
}
return;
}
@@
-305,7
+312,7
@@
destroy_process(pid_t pid)
{
int index = pid;
if (index <= 0 || index > sched_ctx.ptable_len) {
{
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];
return;
}
struct proc_info* proc = &sched_ctx._procs[index];