diff --git a/debug/pipe2.c b/debug/pipe2.c new file mode 100644 index 0000000..286bc6c --- /dev/null +++ b/debug/pipe2.c @@ -0,0 +1,39 @@ +#include +#include +#include + +#define MSGSIZE 32 + + +int main(int argc, char **argv) { + int p[2]; + int pid; + int j; + + char inbuf[MSGSIZE]; + + if (pipe(p) == -1) { + printf("pipe call error"); + exit(1); + } + + for (j = 0; j < 2; j++) + printf("p[%i]: %i\n", j, p[j]); + + switch (pid = fork()) { + case 0: + close(p[0]); + write(p[1], "TEST 1", MSGSIZE); + write(p[1], "TEST 2", MSGSIZE); + write(p[1], "TEST 3", MSGSIZE); + break; + default: + close(p[1]); + for (j=0;j<3;j++) { + read(p[0], inbuf, MSGSIZE); + printf("Parent: %s\n", inbuf); + } + } + + return(0); +} diff --git a/sys/kernel/vfs_calls.c b/sys/kernel/vfs_calls.c index cbc479d..e8de753 100644 --- a/sys/kernel/vfs_calls.c +++ b/sys/kernel/vfs_calls.c @@ -302,7 +302,7 @@ } int sys_pipe2(struct thread *thr, struct sys_pipe2_args *args) { - kprintf("P2: %i\n", args->flags) + kprintf("P2: %i\n", args->flags); return (0); }