diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-07-09 22:12:27 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-07-09 22:12:27 +0300 |
| commit | e8a1df103cc28419dd7d4439c0b1d1739d110f78 (patch) | |
| tree | 2b4646f262a9008d80ca58fb2ecab2b5bf897873 /src/uapi/proc.c | |
| parent | 89d7cf197b2cae130565467bdfad5d5ef5fed2dd (diff) | |
| download | kmi-e8a1df103cc28419dd7d4439c0b1d1739d110f78.tar.gz kmi-e8a1df103cc28419dd7d4439c0b1d1739d110f78.zip | |
start working on tests
+ Current setup will likely not last long, just a stopgap until I figure
out how I want to build each testcase etc.
Probably dir based, but I'll probably add some scripts that generate
the build rules for each test case (or binary?). Also, should probably
put ouput files in a build directory and keep the source clean, but
again, good enough for now.
Will have to start implementing more extensive tests, and probably
come up with some way to compare textual output etc.
Diffstat (limited to 'src/uapi/proc.c')
| -rw-r--r-- | src/uapi/proc.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/uapi/proc.c b/src/uapi/proc.c index eddbab8..74f211c 100644 --- a/src/uapi/proc.c +++ b/src/uapi/proc.c @@ -47,7 +47,7 @@ SYSCALL_DEFINE5(create)(struct tcb *t, sys_arg_t func, set_return(c, func); c->notify_id = t->notify_id; - return_args2(t, OK, c->tid); + return_args1(t, c->tid); } /** @@ -78,10 +78,10 @@ SYSCALL_DEFINE0(fork)(struct tcb *t) /* prepare args for when we eventually swap to the new proc, giving * parent ID as third return value */ - set_args3(n, OK, 0, get_eproc(t)->pid); + set_args2(n, 0, get_eproc(t)->pid); n->notify_id = c->notify_id; - return_args2(t, OK, n->pid); + return_args1(t, n->pid); } /** @@ -161,8 +161,17 @@ SYSCALL_DEFINE2(spawn)(struct tcb *t, sys_arg_t bin, sys_arg_t interp) if (!n) return_args1(t, ERR_OOMEM); + /** @todo copy over bin and interp into new process, this is not enough */ n->notify_id = c->notify_id; - return_args2(t, prepare_proc(n, bin, interp), n->pid); + stat_t ret = OK; + if ((ret = prepare_proc(n, bin, interp))) { + /* this kills the thread */ + orphanize(t); + unorphanize(t); + return_args1(t, ret); + } + + return_args1(t, n->pid); } /** |
