changeset 186:7fc3c3da2159

bump pipe.h
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Tue, 21 Jan 2020 14:50:15 +0900
parents 00e5213ebabe
children 312f86884606
files src/impl/file_impl_pipe.cbc src/impl/pipe.h
diffstat 2 files changed, 24 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/impl/file_impl_pipe.cbc	Tue Jan 21 13:07:05 2020 +0900
+++ b/src/impl/file_impl_pipe.cbc	Tue Jan 21 14:50:15 2020 +0900
@@ -17,6 +17,7 @@
     struct file* file  = new file();
     struct pipe* pipe = new pipe();
     file->file = (union Data*)pipe;
+    pipe->file = NULL;
     pipe->lock = 0;
     pipe->spinlock  = 0;
     pipe->data  = 0;
@@ -24,10 +25,24 @@
     pipe->nwrite  = 0;
     pipe->readopen  = 0;
     pipe->writeopen  = 0;
+    pipe->n  = 0;
+    pipe->addr = NULL;
+    file->remoe  = 0;
     file->off = 0;
     file->st = NULL;
     file->addr = NULL;
+    file->pipe  = 0;
+    file->inode  = 0;
     file->n  = 0;
+    file->fd  = 0;
+    pipe->piperead1 = C_piperead1pipe;
+    pipe->piperead2 = C_piperead2pipe;
+    pipe->cbc_fileclose = C_cbc_fileclosepipe;
+    pipe->cbc_fileclose2 = C_cbc_fileclose2pipe;
+    pipe->cbc_fileclose3 = C_cbc_fileclose3pipe;
+    pipe->cbc_pipe_close = C_cbc_pipe_closepipe;
+    pipe->cbc_pipe_close_writeopen = C_cbc_pipe_close_writeopenpipe;
+    pipe->cbc_pipe_close_readopen = C_cbc_pipe_close_readopenpipe;
     file->stat = C_statpipe;
     file->read = C_readpipe;
     file->write = C_writepipe;
@@ -138,7 +153,7 @@
 }
 
 __code cbc_pipe_close_readopen(struct pipe* p, __code next(...)) {
-    p->writeopen = 0;
-    goto cbc_->wakeup(&p->nwrite,p,cbc_pipe_release,next);
+    p->readopen = 0;
+    goto cbc_context->wakeup(&p->nwrite,p,cbc_pipe_release,next);
 }
 
--- a/src/impl/pipe.h	Tue Jan 21 13:07:05 2020 +0900
+++ b/src/impl/pipe.h	Tue Jan 21 14:50:15 2020 +0900
@@ -1,5 +1,6 @@
 typedef struct pipe<Impl, Isa> impl file {
     #define PIPESIZE 512
+    union Data* file;
     struct spinlock lock;
     char data[PIPESIZE];
     uint nread;     // number of bytes read
@@ -14,4 +15,10 @@
     // private code gear
     __code piperead1(Impl* pipe, char* addr, int n, __code next(...));
     __code piperead2(Impl* pipe, char* addr, int n, __code next(...));
+    __code cbc_fileclose(Impl* pipe, Isa* file, __code next(...));
+    __code cbc_fileclose2(Impl* pipe, Isa* file,struct file* ff,  __code next(...));
+    __code cbc_fileclose3(Impl* pipe, Isa* file,struct file* ff,  __code next(...));
+    __code cbc_pipe_close(Impl* p, int writable, __code next(...));
+    __code cbc_pipe_close_writeopen(Impl* p, __code next(...));
+    __code cbc_pipe_close_readopen(Impl* p, __code next(...));
 } pipe;