summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2018-09-13 14:32:28 +0200
committerMiguel <m.i@gmx.at>2018-09-13 14:32:28 +0200
commitf844fafd324fbf4c7a986df2f0814f2e2d93bcd8 (patch)
tree30253b4757630124b23b29e8f09c3c77da07b423 /kernel
parentb9f10c8a65a24db1c6a52d9df67230b75fa38d1a (diff)
thinking about syscalls and pipes
Diffstat (limited to 'kernel')
-rw-r--r--kernel/syscalls.c10
-rw-r--r--kernel/syscalls.h9
2 files changed, 9 insertions, 10 deletions
diff --git a/kernel/syscalls.c b/kernel/syscalls.c
index 8246df8..6707ec3 100644
--- a/kernel/syscalls.c
+++ b/kernel/syscalls.c
@@ -128,12 +128,10 @@ int syscall_write(int file, char *buf, int len)
return len;
}
-int chk_syscall_read(int file, char *buf, int len)
-{
- if(len> fifo_data_len[file])return 0;
- return 1;
-}
-
+/**
+ * __read()__ attemts to read up to _len_ bytes from file descriptor _file_
+ * into the buffer starting at _buf_.
+ */
int syscall_read(int file, char *buf, int len)
{
//file 0 = stdin , file 1 = stdout , file 2 = stderr
diff --git a/kernel/syscalls.h b/kernel/syscalls.h
index 8b88e6a..b31d32c 100644
--- a/kernel/syscalls.h
+++ b/kernel/syscalls.h
@@ -6,11 +6,11 @@
#define SYSCALL_OPEN 65
#define SYSCALL_GETPID 78
-#define SYSCALL_ISATTY 68
+#define SYSCALL_ISATTY 68 // linux??
#define SYSCALL_LINK 82
#define SYSCALL_LSEEK 69
#define SYSCALL_READ 62
-#define SYSCALL_SBRK 70
+#define SYSCALL_SBRK 70 // linux??
#define SYSCALL_STAT 74
#define SYSCALL_FSTAT 67
#define SYSCALL_LSTAT 79
@@ -19,14 +19,15 @@
#define SYSCALL_WAIT 77
#define SYSCALL_WRITE 61
#define SYSCALL_GETTIMEOFDAY 71
-#define SYSCALL_READDIR 63
+#define SYSCALL_READDIR 63 // getdents?
#define SYSCALL_KILL 73
#define SYSCALL_POLL 80 //shit!?
#define SYSCALL_CLONE 83
+#define SYSCALL_PIPE 84 // TODO! unnamed and named pipes (fifos) SYSCALL_MKNOD
char* syscall_get_name(uint32_t num);
uint32_t syscall_generic(uint32_t nr,uint32_t p1, uint32_t p2, uint32_t p3, uint32_t pid);
-int chk_syscall_read(int file, char *buf, int len);
+
int syscall_open(char *name, int flags, int mode);
int syscall_write(int file, char *buf, int len);