Mercurial > hg > Members > menikon > CbC_xv6
comparison src/impl/file_impl_pipe.cbc @ 170:9b0f4b421288
tweak
author | anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 16 Jan 2020 20:34:18 +0900 |
parents | e0255e66e646 |
children | da4c83ae7ada |
comparison
equal
deleted
inserted
replaced
169:e0255e66e646 | 170:9b0f4b421288 |
---|---|
34 file->close = C_closepipe; | 34 file->close = C_closepipe; |
35 return file; | 35 return file; |
36 } | 36 } |
37 __code statpipe(struct pipe* file, struct stat* st, __code next(...)) { | 37 __code statpipe(struct pipe* file, struct stat* st, __code next(...)) { |
38 | 38 |
39 goto next(...); | 39 goto next(...); |
40 } | 40 } |
41 | 41 |
42 __code readpipe(struct pipe* file, char* addr, int n, __code next(...)) { | 42 __code readpipe(struct pipe* file, char* addr, int n, __code next(...)) { |
43 acquire(&p->lock); | 43 acquire(&p->lock); |
44 goto cbc_piperead1(file,addr,n,next); | 44 goto cbc_piperead1(file,addr,n,next); |
83 | 83 |
84 goto next(...); | 84 goto next(...); |
85 } | 85 } |
86 | 86 |
87 __code closepipe(struct pipe* file,int fd,__code next(...)) { | 87 __code closepipe(struct pipe* file,int fd,__code next(...)) { |
88 proc->ofile[fd] = 0; | 88 proc->ofile[fd] = 0; |
89 goto cbc_fileclose(f,next); | 89 goto cbc_fileclose(f,next); |
90 } | 90 } |
91 | 91 |
92 | 92 |
93 __code cbc_fileclose(struct file* file, __code next(...)) { | 93 __code cbc_fileclose(struct file* file, __code next(...)) { |
94 goto next(); | 94 struct file ff; |
95 acquire(*ftable.loc) | |
96 | |
97 if (f->ref < 1) { | |
98 goto cbc_context->kernel_error->panic("file close"); | |
99 } | |
100 goto cbc_fileclose2(f,ff,next); | |
95 } | 101 } |
102 | |
103 __code cbc_fileclose2(struct file* file, struct file* ff,__code next(...)) { | |
104 if (--f->ref > 0) { | |
105 release(&ftable.lock); | |
106 goto cbc_context->return(); | |
107 } | |
108 goto cbc_fileclose3(f,ff,next); | |
109 } | |
110 | |
111 __code cbc_fileclose3(struct file* file, struct file* ff,__code next(...)) { | |
112 if (--f->ref > 0) { | |
113 release(&ftable.lock); | |
114 goto cbc_context->return(); | |
115 } | |
116 goto cbc_fileclose3(f,ff,next); | |
117 } |