# HG changeset patch # User Takahiro SHIMIZU # Date 1547721802 -32400 # Node ID a146855e16eb6930051db0c2bf0c9bcb12983d59 # Parent a5ccbc210ff8bfd8b7b8a50aebf7e657f7187a3e bugfix diff -r a5ccbc210ff8 -r a146855e16eb src/console.c --- 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) { diff -r a5ccbc210ff8 -r a146855e16eb src/proc.h --- 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 diff -r a5ccbc210ff8 -r a146855e16eb src/typedefData.h --- /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;