diff options
| author | Miguel <m.i@gmx.at> | 2018-09-20 10:46:00 +0200 |
|---|---|---|
| committer | Miguel <m.i@gmx.at> | 2018-09-20 10:46:00 +0200 |
| commit | 763f85c55fdb5a2c4f5bf98e4989a69d27da6e4f (patch) | |
| tree | b9be12d5c20ee1c5cc006b09a6a1584880c15928 /kernel/syscalls.c | |
| parent | 631fdbefc89a6202c5b8e2bf0e15a6ca7df809ef (diff) | |
pipes do not work :(
Diffstat (limited to 'kernel/syscalls.c')
| -rw-r--r-- | kernel/syscalls.c | 32 |
1 files changed, 27 insertions, 5 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"); } |
