diff options
Diffstat (limited to 'src/kernel')
-rw-r--r-- | src/kernel/arch/amd64/driver/fsroot.c | 4 | ||||
-rw-r--r-- | src/kernel/syscalls.c | 16 |
2 files changed, 18 insertions, 2 deletions
diff --git a/src/kernel/arch/amd64/driver/fsroot.c b/src/kernel/arch/amd64/driver/fsroot.c index 41fe136..0970d0b 100644 --- a/src/kernel/arch/amd64/driver/fsroot.c +++ b/src/kernel/arch/amd64/driver/fsroot.c @@ -76,8 +76,8 @@ static int handle(struct vfs_request *req) { default: panic_invalid_state(); } - case VFSOP_CLOSE: - return 0; + case VFSOP_CLOSE: return 0; + case VFSOP_GETSIZE: return -ENOSYS; default: panic_invalid_state(); } diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c index 3096c42..07e2e36 100644 --- a/src/kernel/syscalls.c +++ b/src/kernel/syscalls.c @@ -263,6 +263,19 @@ long _syscall_write(handle_t handle_num, const void __user *buf, size_t len, lon return -1; // dummy } +long _syscall_getsize(handle_t hid) { + struct handle *h = process_handle_get(process_current, hid); + if (!h) SYSCALL_RETURN(-1); + if (h->type != HANDLE_FILE) SYSCALL_RETURN(-2); + vfsreq_create((struct vfs_request) { + .type = VFSOP_GETSIZE, + .id = h->file_id, + .caller = process_current, + .backend = h->backend, + }); + return -1; // dummy +} + long _syscall_close(handle_t hid) { if (hid < 0 || hid >= HANDLE_MAX) return -1; struct handle **h = &process_current->handles[hid]; @@ -424,6 +437,9 @@ long _syscall(long num, long a, long b, long c, long d, long e) { case _SYSCALL_WRITE: _syscall_write(a, (userptr_t)b, c, d, e); break; + case _SYSCALL_GETSIZE: + _syscall_getsize(a); + break; case _SYSCALL_CLOSE: _syscall_close(a); break; |