diff options
author | Robert Morris <[email protected]> | 2019-06-13 10:29:27 -0400 |
---|---|---|
committer | Robert Morris <[email protected]> | 2019-06-13 10:29:27 -0400 |
commit | a8305b7318e66eb33e7789072e8b91dffa0e4b93 (patch) | |
tree | 080bae6010159b083d86411fcd05438e19ca5515 /kernel/console.c | |
parent | 46744c4a13ec21e0818a49f31dbc3ad6ad592eed (diff) | |
download | xv6-labs-a8305b7318e66eb33e7789072e8b91dffa0e4b93.tar.gz xv6-labs-a8305b7318e66eb33e7789072e8b91dffa0e4b93.tar.bz2 xv6-labs-a8305b7318e66eb33e7789072e8b91dffa0e4b93.zip |
FD_DEVICE
Diffstat (limited to 'kernel/console.c')
-rw-r--r-- | kernel/console.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/kernel/console.c b/kernel/console.c index b20d4a9..736d96a 100644 --- a/kernel/console.c +++ b/kernel/console.c @@ -156,20 +156,18 @@ struct { #define C(x) ((x)-'@') // Contro int -consoleread(struct inode *ip, int user_dst, uint64 dst, int n) +consoleread(int user_dst, uint64 dst, int n) { uint target; int c; char buf[1]; - iunlock(ip); target = n; acquire(&cons.lock); while(n > 0){ while(input.r == input.w){ if(myproc()->killed){ release(&cons.lock); - ilock(ip); return -1; } sleep(&input.r, &cons.lock); @@ -192,17 +190,15 @@ consoleread(struct inode *ip, int user_dst, uint64 dst, int n) break; } release(&cons.lock); - ilock(ip); return target - n; } int -consolewrite(struct inode *ip, int user_src, uint64 src, int n) +consolewrite(int user_src, uint64 src, int n) { int i; - iunlock(ip); acquire(&cons.lock); for(i = 0; i < n; i++){ char c; @@ -211,7 +207,6 @@ consolewrite(struct inode *ip, int user_src, uint64 src, int n) consputc(c); } release(&cons.lock); - ilock(ip); return n; } |