summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/init/driver/ansiterm.c8
-rw-r--r--src/init/driver/ps2.c8
-rw-r--r--src/init/driver/tmpfs.c8
-rw-r--r--src/init/fs/misc.c24
-rw-r--r--src/init/syscalls.c4
-rw-r--r--src/init/tar.c14
-rw-r--r--src/kernel/syscalls.c4
-rw-r--r--src/shared/syscalls.h2
8 files changed, 36 insertions, 36 deletions
diff --git a/src/init/driver/ansiterm.c b/src/init/driver/ansiterm.c
index 2d8ef1f..4d98972 100644
--- a/src/init/driver/ansiterm.c
+++ b/src/init/driver/ansiterm.c
@@ -79,22 +79,22 @@ void ansiterm_drv(void) {
switch (res.op) {
case VFSOP_OPEN:
if (res.flags & OPEN_CREATE) {
- _syscall_fs_respond(NULL, -1);
+ _syscall_fs_respond(NULL, -1, 0);
break;
}
// TODO check path
- _syscall_fs_respond(NULL, 1);
+ _syscall_fs_respond(NULL, 1, 0);
break;
case VFSOP_WRITE:
for (size_t i = 0; i < res.len; i++)
in_char(buf[i]);
/* if (pendingFlush) */ flush();
- _syscall_fs_respond(NULL, res.len);
+ _syscall_fs_respond(NULL, res.len, 0);
break;
default:
- _syscall_fs_respond(NULL, -1);
+ _syscall_fs_respond(NULL, -1, 0);
break;
}
}
diff --git a/src/init/driver/ps2.c b/src/init/driver/ps2.c
index 5623b98..d01c522 100644
--- a/src/init/driver/ps2.c
+++ b/src/init/driver/ps2.c
@@ -56,10 +56,10 @@ static void main_loop(void) {
switch (res.op) {
case VFSOP_OPEN:
if (res.flags & OPEN_CREATE) {
- _syscall_fs_respond(NULL, -1);
+ _syscall_fs_respond(NULL, -1, 0);
break;
}
- _syscall_fs_respond(NULL, 1);
+ _syscall_fs_respond(NULL, 1, 0);
break;
case VFSOP_READ:
@@ -71,11 +71,11 @@ static void main_loop(void) {
parse_scancode(buf[i]);
}
ret = ring_get((void*)&backlog, buf, res.capacity);
- _syscall_fs_respond(buf, ret);
+ _syscall_fs_respond(buf, ret, 0);
break;
default:
- _syscall_fs_respond(NULL, -1);
+ _syscall_fs_respond(NULL, -1, 0);
break;
}
}
diff --git a/src/init/driver/tmpfs.c b/src/init/driver/tmpfs.c
index 17b5b9b..4b639da 100644
--- a/src/init/driver/tmpfs.c
+++ b/src/init/driver/tmpfs.c
@@ -51,13 +51,13 @@ void tmpfs_drv(void) {
while (!_syscall_fs_wait(buf, sizeof buf, &res)) {
switch (res.op) {
case VFSOP_OPEN:
- _syscall_fs_respond(NULL, tmpfs_open(buf, &res));
+ _syscall_fs_respond(NULL, tmpfs_open(buf, &res), 0);
break;
case VFSOP_READ:
if (res.id != 0) {
// rw unimplemented
- _syscall_fs_respond(NULL, -1);
+ _syscall_fs_respond(NULL, -1, 0);
break;
}
size_t buf_pos = 0;
@@ -79,11 +79,11 @@ void tmpfs_drv(void) {
buf[buf_pos++] = '\0';
to_skip = 0;
}
- _syscall_fs_respond(buf, buf_pos);
+ _syscall_fs_respond(buf, buf_pos, 0);
break;
default:
- _syscall_fs_respond(NULL, -1);
+ _syscall_fs_respond(NULL, -1, 0);
break;
}
}
diff --git a/src/init/fs/misc.c b/src/init/fs/misc.c
index f406ee2..7f0c1fb 100644
--- a/src/init/fs/misc.c
+++ b/src/init/fs/misc.c
@@ -65,26 +65,26 @@ static void fs_respond_delegate(struct fs_wait_response *res, handle_t delegate,
// TODO instead of truncating the size, allocate a bigger buffer
size = res->capacity < sizeof(buf) ? res->capacity : sizeof(buf);
ret = _syscall_read(delegate, buf, size, res->offset);
- _syscall_fs_respond(buf, ret);
+ _syscall_fs_respond(buf, ret, 0);
_syscall_exit(0);
break;
// TODO proper writing (see above)
case VFSOP_WRITE:
ret = _syscall_write(delegate, og_buf, res->len, res->offset);
- _syscall_fs_respond(NULL, ret);
+ _syscall_fs_respond(NULL, ret, 0);
break;
case VFSOP_CLOSE:
_syscall_close(delegate);
// isn't it kinda weird that i even have to respond to close()s?
// i suppose it makes the API more consistent
- _syscall_fs_respond(NULL, 0);
+ _syscall_fs_respond(NULL, 0, 0);
break;
default:
/* unsupported / unexpected */
- _syscall_fs_respond(NULL, -1);
+ _syscall_fs_respond(NULL, -1, 0);
break;
}
}
@@ -111,7 +111,7 @@ void fs_passthru(const char *prefix) {
} else {
ret = _syscall_open(buf, res.len, res.flags);
}
- _syscall_fs_respond(NULL, ret);
+ _syscall_fs_respond(NULL, ret, 0);
break;
default:
@@ -139,7 +139,7 @@ void fs_whitelist(const char **list) {
break;
}
}
- _syscall_fs_respond(NULL, allow ? _syscall_open(buf, res.len, res.flags) : -1);
+ _syscall_fs_respond(NULL, allow ? _syscall_open(buf, res.len, res.flags) : -1, 0);
break;
default:
@@ -174,7 +174,7 @@ void fs_dir_inject(const char *path) {
break;
}
}
- if (hid < 0) _syscall_fs_respond(NULL, -2); // we ran out of handles
+ if (hid < 0) _syscall_fs_respond(NULL, -2, 0); // we ran out of handles
ret = _syscall_open(buf, res.len, res.flags); /* errors handled in inject handler */
handles[hid].delegate = ret;
@@ -191,19 +191,19 @@ void fs_dir_inject(const char *path) {
/* not injecting, don't allow opening nonexistent stuff */
if (ret < 0) hid = ret;
}
- _syscall_fs_respond(NULL, hid);
+ _syscall_fs_respond(NULL, hid, 0);
break;
case VFSOP_CLOSE:
if (handles[res.id].delegate >= 0)
_syscall_close(handles[res.id].delegate);
handles[res.id].taken = false;
- _syscall_fs_respond(NULL, 0);
+ _syscall_fs_respond(NULL, 0, 0);
break;
case VFSOP_READ:
if (handles[res.id].inject) {
- if (res.offset > 0) _syscall_fs_respond(NULL, 0); // TODO working offsets
+ if (res.offset > 0) _syscall_fs_respond(NULL, 0, 0); // TODO working offsets
struct fs_dir_handle h = handles[res.id];
int out_len = 0;
@@ -222,7 +222,7 @@ void fs_dir_inject(const char *path) {
// TODO deduplicate entries
}
- _syscall_fs_respond(buf, out_len);
+ _syscall_fs_respond(buf, out_len, 0);
break;
}
@@ -231,7 +231,7 @@ void fs_dir_inject(const char *path) {
default: {
struct fs_dir_handle h = handles[res.id];
if (h.delegate < 0)
- _syscall_fs_respond(NULL, -1);
+ _syscall_fs_respond(NULL, -1, 0);
else
fs_respond_delegate(&res, h.delegate, buf);
break;
diff --git a/src/init/syscalls.c b/src/init/syscalls.c
index 54ea715..f7e540f 100644
--- a/src/init/syscalls.c
+++ b/src/init/syscalls.c
@@ -42,8 +42,8 @@ int _syscall_fs_wait(char __user *buf, int max_len, struct fs_wait_response __us
return _syscall(_SYSCALL_FS_WAIT, (int)buf, max_len, (int)res, 0);
}
-int _syscall_fs_respond(char __user *buf, int ret) {
- return _syscall(_SYSCALL_FS_RESPOND, (int)buf, ret, 0, 0);
+int _syscall_fs_respond(char __user *buf, int ret, int flags) {
+ return _syscall(_SYSCALL_FS_RESPOND, (int)buf, ret, flags, 0);
}
void __user *_syscall_memflag(void __user *addr, size_t len, int flags) {
diff --git a/src/init/tar.c b/src/init/tar.c
index 0b8c7f6..dfb0396 100644
--- a/src/init/tar.c
+++ b/src/init/tar.c
@@ -22,10 +22,10 @@ void tar_driver(void *base) {
switch (res.op) {
case VFSOP_OPEN:
if (res.flags & OPEN_CREATE) {
- _syscall_fs_respond(NULL, -1);
+ _syscall_fs_respond(NULL, -1, 0);
break;
}
- _syscall_fs_respond(NULL, tar_open(buf, res.len, base, ~0));
+ _syscall_fs_respond(NULL, tar_open(buf, res.len, base, ~0), 0);
break;
case VFSOP_READ:
@@ -33,7 +33,7 @@ void tar_driver(void *base) {
break;
default:
- _syscall_fs_respond(NULL, -1); // unsupported
+ _syscall_fs_respond(NULL, -1, 0); // unsupported
break;
}
}
@@ -76,9 +76,9 @@ static void tar_read(struct fs_wait_response *res, void *base, size_t base_len)
size = tar_size(meta);
if (res->offset < 0 || res->offset > size) {
// TODO support negative offsets
- _syscall_fs_respond(NULL, -1);
+ _syscall_fs_respond(NULL, -1, 0);
} else {
- _syscall_fs_respond(meta + 512 + res->offset, size - res->offset);
+ _syscall_fs_respond(meta + 512 + res->offset, size - res->offset, 0);
}
break;
@@ -124,11 +124,11 @@ static void tar_read(struct fs_wait_response *res, void *base, size_t base_len)
off += (size + 511) & ~511; // skip the data sectors
}
- _syscall_fs_respond(buf, buf_pos);
+ _syscall_fs_respond(buf, buf_pos, 0);
break;
default:
- _syscall_fs_respond(NULL, -1);
+ _syscall_fs_respond(NULL, -1, 0);
break;
}
}
diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c
index ae8b0e5..d703b52 100644
--- a/src/kernel/syscalls.c
+++ b/src/kernel/syscalls.c
@@ -246,7 +246,7 @@ int _syscall_fs_wait(char __user *buf, int max_len, struct fs_wait_response __us
return -1; // dummy
}
-int _syscall_fs_respond(char __user *buf, int ret) {
+int _syscall_fs_respond(char __user *buf, int ret, int flags) {
struct vfs_request *req = process_current->handled_req;
if (!req) SYSCALL_RETURN(-1);
@@ -353,7 +353,7 @@ int _syscall(int num, int a, int b, int c, int d) {
_syscall_fs_wait((userptr_t)a, b, (userptr_t)c);
break;
case _SYSCALL_FS_RESPOND:
- _syscall_fs_respond((userptr_t)a, b);
+ _syscall_fs_respond((userptr_t)a, b, c);
break;
case _SYSCALL_MEMFLAG:
_syscall_memflag((userptr_t)a, b, c);
diff --git a/src/shared/syscalls.h b/src/shared/syscalls.h
index 31f6d73..bd26b43 100644
--- a/src/shared/syscalls.h
+++ b/src/shared/syscalls.h
@@ -69,7 +69,7 @@ struct fs_wait_response {
/** Blocks until an fs request is made.
* @return 0 if everything was successful */
int _syscall_fs_wait(char __user *buf, int max_len, struct fs_wait_response __user *res);
-int _syscall_fs_respond(char __user *buf, int ret);
+int _syscall_fs_respond(char __user *buf, int ret, int flags);
/** Modifies the virtual address space.
*