summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorMiguel <m.i@gmx.at>2018-09-20 10:46:00 +0200
committerMiguel <m.i@gmx.at>2018-09-20 10:46:00 +0200
commit763f85c55fdb5a2c4f5bf98e4989a69d27da6e4f (patch)
treeb9be12d5c20ee1c5cc006b09a6a1584880c15928 /kernel
parent631fdbefc89a6202c5b8e2bf0e15a6ca7df809ef (diff)
pipes do not work :(
Diffstat (limited to 'kernel')
-rw-r--r--kernel/syscalls.c32
-rw-r--r--kernel/syscalls.h3
2 files changed, 29 insertions, 6 deletions
diff --git a/kernel/syscalls.c b/kernel/syscalls.c
index 3b599c0..b5dd6df 100644
--- a/kernel/syscalls.c
+++ b/kernel/syscalls.c
@@ -21,6 +21,7 @@
#include "reent.h"
#include "errno.h"
+/** errno helper */
void set_errno(int no)
{
struct _reent *impure_ptr=VMEM_USER_NEWLIB;
@@ -85,9 +86,9 @@ char* syscall_get_name(uint32_t num)
case 73:
return "SYSCALL_KILL";
case 80:
- return "SYSCALL_POLL";
- case 83:
return "SYSCALL_CLONE";
+ case 84:
+ return "SYSCALL_PIPE";
}
return "UNKNOWN SYSCALL NUM";
}
@@ -392,6 +393,27 @@ uint32_t syscall_generic_test(uint32_t nr,uint32_t p1, uint32_t p2, uint32_t p3,
return 1;
}
+uint32_t syscall_pipe(uint32_t *addr)
+{
+ if( next_fifo>=MAX_FIFOS || next_fd>=MAX_FD)kpanic("we ran out of fd's or fifo's");
+ fd pipfds[2];
+ int ret=fds_from_pipe(pipfds);
+
+ fds[next_fd]=pipfds[0] ;
+ *addr=next_fd;
+ addr++;
+
+ next_fd++;
+ if( next_fifo>=MAX_FIFOS || next_fd>=MAX_FD)kpanic("we ran out of fd's or fifo's");
+
+ fds[next_fd]=pipfds[1] ;
+ *addr=next_fd;
+ next_fd++;
+
+ return ret;
+
+}
+
uint32_t syscall_generic(uint32_t nr,uint32_t p1, uint32_t p2, uint32_t p3, uint32_t pid)
{
switch(nr){
@@ -444,8 +466,8 @@ uint32_t syscall_generic(uint32_t nr,uint32_t p1, uint32_t p2, uint32_t p3, uint
case SYSCALL_KILL :
// return task_kill(p1,p2,p3);
return -1;
- case SYSCALL_POLL :
- return syscall_poll(p1);
+ case SYSCALL_PIPE :
+ return syscall_pipe(p1);
}
- return -1;
+ kpanic("unknown syscall");
}
diff --git a/kernel/syscalls.h b/kernel/syscalls.h
index b736519..b7422af 100644
--- a/kernel/syscalls.h
+++ b/kernel/syscalls.h
@@ -23,7 +23,8 @@
#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
+#define SYSCALL_PIPE 84
+// TODO! 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);