summaryrefslogtreecommitdiff
path: root/src/kernel/syscalls.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/syscalls.c')
-rw-r--r--src/kernel/syscalls.c16
1 files changed, 16 insertions, 0 deletions
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;