summaryrefslogtreecommitdiff
path: root/usertests.c
diff options
context:
space:
mode:
Diffstat (limited to 'usertests.c')
-rw-r--r--usertests.c30
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)
+ ;
+}