diff options
author | rtm <rtm> | 2006-06-27 14:35:53 +0000 |
---|---|---|
committer | rtm <rtm> | 2006-06-27 14:35:53 +0000 |
commit | c41f1de5d41a527a3fa2d1e94215766130eac456 (patch) | |
tree | 86f6a467be8b42aec42a05299789f39ace9cc5e2 /usertests.c | |
parent | b61c2547b8b489cab16984c0940a1cb6593a2a3d (diff) | |
download | xv6-labs-c41f1de5d41a527a3fa2d1e94215766130eac456.tar.gz xv6-labs-c41f1de5d41a527a3fa2d1e94215766130eac456.tar.bz2 xv6-labs-c41f1de5d41a527a3fa2d1e94215766130eac456.zip |
file descriptors
pipes
Diffstat (limited to 'usertests.c')
-rw-r--r-- | usertests.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/usertests.c b/usertests.c new file mode 100644 index 0000000..62eefda --- /dev/null +++ b/usertests.c @@ -0,0 +1,30 @@ +// simple fork and pipe read/write + +char buf[32]; + +void +pipe1() +{ + int fds[2], pid; + + pipe(fds); + pid = pipe(); + if(pid == 0){ + write(fds[1], "xyz", 4); + } else { + read(fds[0], buf, sizeof(buf)); + if(buf[0] != 'x' || buf[1] != 'y'){ + puts("pipe1 oops\n"); + return; + } + } + puts("pipe1 ok\n"); +} + +main() +{ + pipe1(); + + while(1) + ; +} |