aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/user/syscall.c
diff options
context:
space:
mode:
authorAlex Auvolat <alex.auvolat@ens.fr>2015-02-20 15:00:51 +0100
committerAlex Auvolat <alex.auvolat@ens.fr>2015-02-20 15:00:51 +0100
commit2d4d64189501c253ed6a5b5ff5e27da1cb34407a (patch)
tree488ed008de322f0ffbfd1efdaec2041811b41a1c /src/kernel/user/syscall.c
parent13db03fcc4a476c8881ccafe0852e72410c67b3a (diff)
downloadkogata-2d4d64189501c253ed6a5b5ff5e27da1cb34407a.tar.gz
kogata-2d4d64189501c253ed6a5b5ff5e27da1cb34407a.zip
Think a bit ; ioctls only on open file descriptors.
Diffstat (limited to 'src/kernel/user/syscall.c')
-rw-r--r--src/kernel/user/syscall.c29
1 files changed, 2 insertions, 27 deletions
diff --git a/src/kernel/user/syscall.c b/src/kernel/user/syscall.c
index f1f5f86..bcf6ef4 100644
--- a/src/kernel/user/syscall.c
+++ b/src/kernel/user/syscall.c
@@ -175,30 +175,6 @@ end_stat:
return ret;
}
-static uint32_t ioctl_sc(sc_args_t args) {
- int ret = -1;
-
- char* fn = sc_copy_string(args.a, args.b);
- if (fn == 0) goto end_ioctl;
-
- char* sep = strchr(fn, ':');
- if (sep == 0) goto end_ioctl;
-
- *sep = 0;
- char* file = sep + 1;
-
- fs_t *fs = proc_find_fs(current_process(), fn);
- if (fs == 0) goto end_ioctl;
-
- void* data = (void*)args.d;
- if (data >= (void*)K_HIGHHALF_ADDR) goto end_ioctl;
- ret = fs_ioctl(fs, file, args.c, data);
-
-end_ioctl:
- if (fn) free(fn);
- return ret;
-}
-
static uint32_t open_sc(sc_args_t args) {
int ret = 0;
@@ -268,7 +244,7 @@ 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) {
+static uint32_t ioctl_sc(sc_args_t args) {
fs_handle_t *h = proc_read_fd(current_process(), args.a);
if (h == 0) return -1;
@@ -303,7 +279,6 @@ void setup_syscall_table() {
sc_handlers[SC_DELETE] = delete_sc;
sc_handlers[SC_MOVE] = move_sc;
sc_handlers[SC_STAT] = stat_sc;
- sc_handlers[SC_IOCTL] = ioctl_sc;
sc_handlers[SC_OPEN] = open_sc;
sc_handlers[SC_CLOSE] = close_sc;
@@ -311,7 +286,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_IOCTL] = ioctl_sc;
sc_handlers[SC_GET_MODE] = get_mode_sc;
}