1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#include <camellia/syscalls.h>
#include <stdio.h>
#include <camellia/compat.h>
static hid_t h = -1;
long c0_fs_wait(char *buf, long len, struct ufs_request *res) {
if (h != -1) {
fprintf(stderr, "c0_fs_wait: proc didn't respond to request\n");
c0_fs_respond(NULL, -1, 0);
}
h = _sys_fs_wait(buf, len, res);
return h >= 0 ? 0 : -1;
}
long c0_fs_respond(const void *buf, long ret, int flags) {
ret = _sys_fs_respond(h, buf, ret, flags);
h = -1;
return ret;
}
long _sys_await(void) {
struct sys_wait2 res;
if (_sys_wait2(-1, 0, &res) < 0) {
return ~0;
}
return res.status;
}
void _sys_filicide(void) {
_sys_intr("kill", 4);
}
|