changeset 190:e2b0a3e0c97a

fix file_impl_none.cbc
author menikon <e165723@ie.u-ryukyu.ac.jp>
date Tue, 21 Jan 2020 17:02:11 +0900
parents 648247c08bbd
children a961a3378174
files src/impl/file_impl_none.cbc
diffstat 1 files changed, 19 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/impl/file_impl_none.cbc	Tue Jan 21 15:53:36 2020 +0900
+++ b/src/impl/file_impl_none.cbc	Tue Jan 21 17:02:11 2020 +0900
@@ -42,5 +42,23 @@
 
 __code closenone(struct none* file,int fd, __code next(...)) {
 
-    goto next(...);
+    goto file->noneclose(file->file, next);
 }
+
+__code noneclose(struct none* none, struct file* file, __code next(...){
+  struct file ff;
+  acquire(*ftable.loc)
+
+  if (f->ref < 1) {
+     goto cbc_context->kernel_error->panic("file close");
+  }
+  goto pipe->cbc_noneclose2(f,ff,next);
+}
+
+__code noneclose2(struct none* none,struct file* file, struct file* ff,__code next(...)){
+  if (--f->ref > 0) {
+     release(&ftable.lock);
+     goto cbc_context->return();
+  }
+  goto pipe->cbc_pipeclose3(f,ff,next);
+}