changeset 162:e47eaee4e8c1

struct pipe is not generated in context.h
author tobaru
date Sun, 22 Dec 2019 19:41:35 +0900
parents c8965bb0f84c
children 620a6abe2259
files src/file.cbc src/interface/pipe.dg
diffstat 2 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/file.cbc	Sun Dec 22 19:14:07 2019 +0900
+++ b/src/file.cbc	Sun Dec 22 19:41:35 2019 +0900
@@ -113,6 +113,8 @@
     goto next(r);
 }
 
+extern __code cbc_piperead(struct pipe *p, char *addr, int n, __code (*next)(int ret));
+
 __ncode cbc_fileread (struct file *f, char *addr, int n, __code (*next)(int ret))
 {
     if (f->readable == 0) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/interface/pipe.dg	Sun Dec 22 19:41:35 2019 +0900
@@ -0,0 +1,10 @@
+#define PIPESIZE 512
+
+typedef struct pipe <Impl> {
+    struct spinlock lock;
+    char data[PIPESIZE];
+    uint nread;     // number of bytes read
+    uint nwrite;    // number of bytes written
+    int readopen;   // read fd is still open
+    int writeopen;  // write fd is still open
+} pipe;