changeset 26:a146855e16eb

bugfix
author Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Thu, 17 Jan 2019 19:43:22 +0900
parents a5ccbc210ff8
children 1a64b5645cdd
files src/console.c src/proc.h src/typedefData.h
diffstat 3 files changed, 13 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/console.c	Thu Jan 17 19:22:48 2019 +0900
+++ b/src/console.c	Thu Jan 17 19:43:22 2019 +0900
@@ -218,7 +218,6 @@
 __code cbc_consoleread (struct inode *ip, char *dst, int n, __code(*next)(int ret))
 {
     uint target;
-    int c;
 
     iunlock(ip);
 
@@ -234,21 +233,24 @@
             }
 
             proc->cbc_arg.cbc_console_arg.n = n;
+            proc->cbc_arg.cbc_console_arg.target = target;
 	    proc->cbc_arg.cbc_console_arg.dst = dst;
 	    proc->cbc_arg.cbc_console_arg.ip = ip;
 	    proc->cbc_arg.cbc_console_arg.next = next;
             goto cbc_sleep(&input.r, &input.lock, cbc_consoleread1);
         }
+    }
 }
 
 __code cbc_consoleread1 (__code(*next)(int ret))
 {
     int cont = 1;
-    proc->cbc_arg.cbc_console_arg.n = n;
-    proc->cbc_arg.cbc_console_arg.dst = dst;
-    proc->cbc_arg.cbc_console_arg.ip = ip;
+    int n = proc->cbc_arg.cbc_console_arg.n;
+    int target = proc->cbc_arg.cbc_console_arg.target;
+    char* dst = proc->cbc_arg.cbc_console_arg.dst;
+    struct inode *ip = proc->cbc_arg.cbc_console_arg.ip;
     
-    c = input.buf[input.r++ % INPUT_BUF];
+    int c = input.buf[input.r++ % INPUT_BUF];
 
         if (c == C('D')) {  // EOF
             if (n < target) {
--- a/src/proc.h	Thu Jan 17 19:22:48 2019 +0900
+++ b/src/proc.h	Thu Jan 17 19:43:22 2019 +0900
@@ -1,3 +1,4 @@
+#include "typedefData.h"
 #ifndef PROC_INCLUDE_
 #define PROC_INCLUDE_
 
@@ -70,10 +71,11 @@
     union cbc_arg {
         struct cbc_console_arg {
 	    int n;
+        int target;
 	    char* dst;
 	    struct inode *ip;
-	    __code (*next)(int ret);     
-        } 
+	    __code (*next)(int ret);
+        } cbc_console_arg;
     } cbc_arg;
     __code (*cbc_next)();
     struct spinlock *lk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/typedefData.h	Thu Jan 17 19:43:22 2019 +0900
@@ -0,0 +1,2 @@
+typedef struct cbc_console_arg cbc_console_arg;
+typedef union cbc_arg cbc_arg;