aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/user/syscall.c
diff options
context:
space:
mode:
authorAlex Auvolat <alex.auvolat@ens.fr>2015-02-19 20:18:39 +0100
committerAlex Auvolat <alex.auvolat@ens.fr>2015-02-19 20:18:39 +0100
commitf876e66e717c4dd853da12892048262afe47ffdf (patch)
treebc7aa8ebfbb86bfa0a443fda718569a6c9e51e82 /src/kernel/user/syscall.c
parent7b27ab493b56f9e77d805c4f44a1717f3a79231e (diff)
downloadkogata-f876e66e717c4dd853da12892048262afe47ffdf.tar.gz
kogata-f876e66e717c4dd853da12892048262afe47ffdf.zip
Add syscall for ioctl on open handle
Diffstat (limited to 'src/kernel/user/syscall.c')
-rw-r--r--src/kernel/user/syscall.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/kernel/user/syscall.c b/src/kernel/user/syscall.c
index 8a2cf18..6fdd633 100644
--- a/src/kernel/user/syscall.c
+++ b/src/kernel/user/syscall.c
@@ -263,6 +263,15 @@ static uint32_t stat_open_sc(sc_args_t args) {
return file_stat(h, o);
}
+static uint32_t ioctl_open_sc(sc_args_t args) {
+ fs_handle_t *h = proc_read_fd(current_process(), args.a);
+ if (h == 0) return -1;
+
+ void* data = (void*)args.c;
+ if (data >= (void*)K_HIGHHALF_ADDR) return -1;
+ return file_ioctl(h, args.b, data);
+}
+
static uint32_t get_mode_sc(sc_args_t args) {
fs_handle_t *h = proc_read_fd(current_process(), args.a);
if (h == 0) return 0;
@@ -296,6 +305,7 @@ void setup_syscall_table() {
sc_handlers[SC_WRITE] = write_sc;
sc_handlers[SC_READDIR] = readdir_sc;
sc_handlers[SC_STAT_OPEN] = stat_open_sc;
+ sc_handlers[SC_IOCTL_OPEN] = ioctl_open_sc;
sc_handlers[SC_GET_MODE] = get_mode_sc;
}