summaryrefslogtreecommitdiff
path: root/userspace/piper.c
diff options
context:
space:
mode:
Diffstat (limited to 'userspace/piper.c')
-rw-r--r--userspace/piper.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/userspace/piper.c b/userspace/piper.c
new file mode 100644
index 0000000..2272f96
--- /dev/null
+++ b/userspace/piper.c
@@ -0,0 +1,21 @@
+#include <stdio.h>
+int main()
+{
+ int pid=_fork();
+ FILE *f=fopen("~testpipe","rw");
+
+ setvbuf(f,NULL,_IONBF,0);
+
+ if(pid==0)
+ {
+ char buf[2];
+ fread(f,buf,1,1);
+ printf("[%c]\n",buf[0]);
+ }
+ else
+ {
+ char buf="666";
+ fwrite(f,buf,1,1);
+ printf("written\n");
+ }
+}