summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/init/main.c10
-rw-r--r--src/init/syscalls.c20
-rw-r--r--src/kernel/syscalls.c30
-rw-r--r--src/shared/syscalls.h20
4 files changed, 40 insertions, 40 deletions
diff --git a/src/init/main.c b/src/init/main.c
index 71732cd..939f15f 100644
--- a/src/init/main.c
+++ b/src/init/main.c
@@ -3,7 +3,7 @@
#include <stdint.h>
#define argify(str) str, sizeof(str) - 1
-#define log(str) _syscall_fd_write(tty_fd, argify(str))
+#define log(str) _syscall_write(tty_fd, argify(str))
__attribute__((section("text")))
int tty_fd;
@@ -12,10 +12,10 @@ void misc_tests(void);
// takes a cstring and copies it right before a page boundary
const char *multipageify(const char *str);
-#define mount(fd, path) _syscall_fd_mount(fd, path, sizeof(path)-1)
+#define mount(fd, path) _syscall_mount(fd, path, sizeof(path)-1)
int main(void) {
- tty_fd = _syscall_fs_open("/tty", sizeof("/tty") - 1);
+ tty_fd = _syscall_open("/tty", sizeof("/tty") - 1);
if (tty_fd < 0)
_syscall_exit(argify("couldn't open tty"));
log(" opened /tty ");
@@ -27,9 +27,9 @@ int main(void) {
void misc_tests(void) {
int res;
- res = _syscall_fs_open(argify("/tty/nonexistant"));
+ res = _syscall_open(argify("/tty/nonexistant"));
if (res >= 0) log("test failed ");
- res = _syscall_fs_open(argify("/ttynonexistant"));
+ res = _syscall_open(argify("/ttynonexistant"));
if (res >= 0) log("test failed ");
log("the \"tests\" went ok");
}
diff --git a/src/init/syscalls.c b/src/init/syscalls.c
index ebf174e..730a243 100644
--- a/src/init/syscalls.c
+++ b/src/init/syscalls.c
@@ -17,22 +17,22 @@ int _syscall_await(user_ptr buf, int len) {
return _syscall(_SYSCALL_AWAIT, (int)buf, (int)len, 0);
}
-handle_t _syscall_fs_open(const user_ptr path, int len) {
- return _syscall(_SYSCALL_FS_OPEN, (int)path, len, 0);
+handle_t _syscall_open(const user_ptr path, int len) {
+ return _syscall(_SYSCALL_OPEN, (int)path, len, 0);
}
-int _syscall_fd_mount(handle_t handle, const user_ptr path, int len) {
- return _syscall(_SYSCALL_FD_MOUNT, handle, (int)path, len);
+int _syscall_mount(handle_t handle, const user_ptr path, int len) {
+ return _syscall(_SYSCALL_MOUNT, handle, (int)path, len);
}
-int _syscall_fd_read(handle_t handle, user_ptr buf, int len) {
- return _syscall(_SYSCALL_FD_READ, handle, (int)buf, len);
+int _syscall_read(handle_t handle, user_ptr buf, int len) {
+ return _syscall(_SYSCALL_READ, handle, (int)buf, len);
}
-int _syscall_fd_write(handle_t handle, user_ptr buf, int len) {
- return _syscall(_SYSCALL_FD_WRITE, handle, (int)buf, len);
+int _syscall_write(handle_t handle, user_ptr buf, int len) {
+ return _syscall(_SYSCALL_WRITE, handle, (int)buf, len);
}
-int _syscall_fd_close(handle_t handle) {
- return _syscall(_SYSCALL_FD_CLOSE, handle, 0, 0);
+int _syscall_close(handle_t handle) {
+ return _syscall(_SYSCALL_CLOSE, handle, 0, 0);
}
diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c
index 7c67423..0a53a00 100644
--- a/src/kernel/syscalls.c
+++ b/src/kernel/syscalls.c
@@ -66,7 +66,7 @@ int _syscall_fork(void) {
return 1;
}
-handle_t _syscall_fs_open(const user_ptr path, int len) {
+handle_t _syscall_open(const user_ptr path, int len) {
struct virt_iter iter;
struct vfs_mount *mount;
static char buffer[PATH_MAX]; // holds the path
@@ -99,7 +99,7 @@ handle_t _syscall_fs_open(const user_ptr path, int len) {
// doesn't return. TODO mark as noreturn
}
-int _syscall_fd_mount(handle_t handle, const user_ptr path, int len) {
+int _syscall_mount(handle_t handle, const user_ptr path, int len) {
struct virt_iter iter;
struct vfs_mount *mount = NULL;
char *path_buf;
@@ -136,12 +136,12 @@ fail:
return -1;
}
-int _syscall_fd_read(handle_t handle, user_ptr buf, int len) {
+int _syscall_read(handle_t handle, user_ptr buf, int len) {
if (handle < 0 || handle >= HANDLE_MAX) return -1;
return -1;
}
-int _syscall_fd_write(handle_t handle_num, user_ptr buf, int len) {
+int _syscall_write(handle_t handle_num, user_ptr buf, int len) {
struct handle *handle = &process_current->handles[handle_num];
if (handle_num < 0 || handle_num >= HANDLE_MAX) return -1;
if (handle->type != HANDLE_FILE) return -1;
@@ -156,7 +156,7 @@ int _syscall_fd_write(handle_t handle_num, user_ptr buf, int len) {
return -1;
}
-int _syscall_fd_close(handle_t handle) {
+int _syscall_close(handle_t handle) {
if (handle < 0 || handle >= HANDLE_MAX) return -1;
return -1;
}
@@ -169,16 +169,16 @@ int syscall_handler(int num, int a, int b, int c) {
return _syscall_await(a, b);
case _SYSCALL_FORK:
return _syscall_fork();
- case _SYSCALL_FS_OPEN:
- return _syscall_fs_open(a, b);
- case _SYSCALL_FD_MOUNT:
- return _syscall_fd_mount(a, b, c);
- case _SYSCALL_FD_READ:
- return _syscall_fd_read(a, b, c);
- case _SYSCALL_FD_WRITE:
- return _syscall_fd_write(a, b, c);
- case _SYSCALL_FD_CLOSE:
- return _syscall_fd_close(a);
+ case _SYSCALL_OPEN:
+ return _syscall_open(a, b);
+ case _SYSCALL_MOUNT:
+ return _syscall_mount(a, b, c);
+ case _SYSCALL_READ:
+ return _syscall_read(a, b, c);
+ case _SYSCALL_WRITE:
+ return _syscall_write(a, b, c);
+ case _SYSCALL_CLOSE:
+ return _syscall_close(a);
default:
tty_const("unknown syscall ");
panic();
diff --git a/src/shared/syscalls.h b/src/shared/syscalls.h
index d65723d..7a1acaf 100644
--- a/src/shared/syscalls.h
+++ b/src/shared/syscalls.h
@@ -11,12 +11,12 @@ enum {
_SYSCALL_AWAIT,
_SYSCALL_FORK,
- _SYSCALL_FS_OPEN,
- _SYSCALL_FD_MOUNT,
+ _SYSCALL_OPEN,
+ _SYSCALL_MOUNT,
- _SYSCALL_FD_READ,
- _SYSCALL_FD_WRITE,
- _SYSCALL_FD_CLOSE,
+ _SYSCALL_READ,
+ _SYSCALL_WRITE,
+ _SYSCALL_CLOSE,
};
/** Kills the current process.
@@ -35,9 +35,9 @@ int _syscall_await(user_ptr buf, int len);
*/
int _syscall_fork(void);
-handle_t _syscall_fs_open(const user_ptr path, int len);
+handle_t _syscall_open(const user_ptr path, int len);
-int _syscall_fd_mount(handle_t, const user_ptr path, int len);
-int _syscall_fd_read(handle_t, user_ptr buf, int len);
-int _syscall_fd_write(handle_t, user_ptr buf, int len);
-int _syscall_fd_close(handle_t);
+int _syscall_mount(handle_t, const user_ptr path, int len);
+int _syscall_read(handle_t, user_ptr buf, int len);
+int _syscall_write(handle_t, user_ptr buf, int len);
+int _syscall_close(handle_t);