summaryrefslogtreecommitdiff
path: root/kernel/syscalls.h
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2018-09-20 20:51:57 +0200
committerMiguel <m.i@gmx.at>2018-09-20 20:51:57 +0200
commitaeefdb37d1fc1c0eb7953b9c196cab09460bc167 (patch)
tree513789d7fd28b65afb594e9605975bd10ea06f74 /kernel/syscalls.h
parent763f85c55fdb5a2c4f5bf98e4989a69d27da6e4f (diff)
we are now prepared for piping with _pipe and _dup2
Diffstat (limited to 'kernel/syscalls.h')
-rw-r--r--kernel/syscalls.h40
1 files changed, 29 insertions, 11 deletions
diff --git a/kernel/syscalls.h b/kernel/syscalls.h
index b7422af..d90e314 100644
--- a/kernel/syscalls.h
+++ b/kernel/syscalls.h
@@ -1,3 +1,17 @@
+/**
+ * @file
+ *
+ * Fool OS - System Call Interface
+ * ===============================
+ *
+ * Most of the syscalls are loosely based on a very small subset of the
+ * linux system calls.
+ *
+ * They seem enough to back a small C Library as newlib in this case.
+ *
+ *
+ */
+
#define SYSCALL_EXIT 60
#define SYSCALL_EXECVE 64
#define SYSCALL_FORK 72
@@ -10,28 +24,32 @@
#define SYSCALL_LINK 82
#define SYSCALL_LSEEK 69
#define SYSCALL_READ 62
-#define SYSCALL_SBRK 70 // linux??
-#define SYSCALL_STAT 74
-#define SYSCALL_FSTAT 67
-#define SYSCALL_LSTAT 79
+#define SYSCALL_SBRK 70
+#define SYSCALL_STAT 74 // need all?
+#define SYSCALL_FSTAT 67 // need all?
+#define SYSCALL_LSTAT 79 // need all?
#define SYSCALL_TIMES 75
#define SYSCALL_UNLINK 76
#define SYSCALL_WAIT 77
#define SYSCALL_WRITE 61
#define SYSCALL_GETTIMEOFDAY 71
-#define SYSCALL_READDIR 63 // getdents?
+#define SYSCALL_READDIR 63 // linux has getdents
#define SYSCALL_KILL 73
-#define SYSCALL_POLL 80 //shit!?
#define SYSCALL_CLONE 83
#define SYSCALL_PIPE 84
-// TODO! SYSCALL_MKNOD?
+#define SYSCALL_DUP2 86
+
+/** Todo move somewhere else and init per process , think how to make thread safe */
+void fd_init_std_streams(uint32_t pid);
+
+/** returns string representation of the syscall from its number */
+char* syscall_get_name(uint32_t num);
-char* syscall_get_name(uint32_t num);
+/** invoke a syscall from kernel */
uint32_t syscall_generic(uint32_t nr,uint32_t p1, uint32_t p2, uint32_t p3, uint32_t pid);
-uint32_t syscall_generic_test(uint32_t nr,uint32_t p1, uint32_t p2, uint32_t p3, uint32_t pid);
-int syscall_open(char *name, int flags, int mode);
-int syscall_write(int file, char *buf, int len);
+/** test if a specific syscall is ready to be processed */
+uint32_t syscall_generic_test(uint32_t nr,uint32_t p1, uint32_t p2, uint32_t p3, uint32_t pid);
// new planned syscalls for graphx
// TODO: split ncurses and our syscalls??