Mercurial > hg > Members > tobaru > CbC_xv6
diff src/console.c @ 29:a672d603ccb2
fix
author | mir3636 |
---|---|
date | Fri, 18 Jan 2019 10:04:37 +0900 |
parents | 1a64b5645cdd |
children | 6a7ab1d7001c |
line wrap: on
line diff
--- a/src/console.c Fri Jan 18 09:40:22 2019 +0900 +++ b/src/console.c Fri Jan 18 10:04:37 2019 +0900 @@ -215,33 +215,6 @@ release(&input.lock); } -__code cbc_consoleread (struct inode *ip, char *dst, int n, __code(*next)(int ret)) -{ - uint target; - - iunlock(ip); - - target = n; - acquire(&input.lock); - - while (n > 0) { - while (input.r == input.w) { - if (proc->killed) { - release(&input.lock); - ilock(ip); - goto next(-1); - } - - 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; @@ -283,6 +256,33 @@ goto next(target - n); } +__code cbc_consoleread (struct inode *ip, char *dst, int n, __code(*next)(int ret)) +{ + uint target; + + iunlock(ip); + + target = n; + acquire(&input.lock); + + while (n > 0) { + while (input.r == input.w) { + if (proc->killed) { + release(&input.lock); + ilock(ip); + goto next(-1); + } + + 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); + } + } +} + int consoleread (struct inode *ip, char *dst, int n) { uint target;