summaryrefslogtreecommitdiff
path: root/src/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel')
-rw-r--r--src/kernel/proc.h1
-rw-r--r--src/kernel/syscalls.c5
-rw-r--r--src/kernel/vfs/request.c4
3 files changed, 8 insertions, 2 deletions
diff --git a/src/kernel/proc.h b/src/kernel/proc.h
index 73a6651..bd7a843 100644
--- a/src/kernel/proc.h
+++ b/src/kernel/proc.h
@@ -34,6 +34,7 @@ struct process {
struct {
char __user *buf;
int __user *len;
+ int __user *id;
} awaited_req; // PS_WAITS4REQUEST
};
struct vfs_request *handled_req;
diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c
index 3ed4877..48e67db 100644
--- a/src/kernel/syscalls.c
+++ b/src/kernel/syscalls.c
@@ -195,7 +195,7 @@ fail:
return -1;
}
-int _syscall_fs_wait(handle_t back, char __user *buf, int __user *len) {
+int _syscall_fs_wait(handle_t back, char __user *buf, int __user *len, int __user *id) {
struct handle *back_handle;
if (back < 0 || back >= HANDLE_MAX) return -1;
@@ -209,6 +209,7 @@ int _syscall_fs_wait(handle_t back, char __user *buf, int __user *len) {
* vfs_request_pass2handler simpler. TODO? */
process_current->awaited_req.buf = buf;
process_current->awaited_req.len = len;
+ process_current->awaited_req.id = id;
if (back_handle->fs.backend->queue) {
// handle queued requests
@@ -271,7 +272,7 @@ int _syscall(int num, int a, int b, int c, int d) {
case _SYSCALL_FS_CREATE:
return _syscall_fs_create((userptr_t)a);
case _SYSCALL_FS_WAIT:
- return _syscall_fs_wait(a, (userptr_t)b, (userptr_t)c);
+ return _syscall_fs_wait(a, (userptr_t)b, (userptr_t)c, (userptr_t)d);
case _SYSCALL_FS_RESPOND:
return _syscall_fs_respond((userptr_t)a, b);
case _SYSCALL_MEMFLAG:
diff --git a/src/kernel/vfs/request.c b/src/kernel/vfs/request.c
index 5836b94..9a51688 100644
--- a/src/kernel/vfs/request.c
+++ b/src/kernel/vfs/request.c
@@ -66,6 +66,10 @@ _Noreturn void vfs_request_pass2handler(struct vfs_request *req) {
handler->awaited_req.len, &len, sizeof len))
goto fail; // can't copy new length
+ if (!virt_cpy_to(handler->pages,
+ handler->awaited_req.id, &req->id, sizeof req->id))
+ goto fail; // can't copy id
+
regs_savereturn(&handler->regs, req->type);
process_switch(handler);
fail: