diff options
author | kaashoek <kaashoek> | 2006-08-09 16:04:04 +0000 |
---|---|---|
committer | kaashoek <kaashoek> | 2006-08-09 16:04:04 +0000 |
commit | 6fa5ffb56ffdbe5a37bfc04d063fbff2bf929c27 (patch) | |
tree | 7a06e4e145812109fcec97aec32c135632481edf /console.c | |
parent | 6c0e444fcdf7ba21442513acbc69c7fca9def06b (diff) | |
download | xv6-labs-6fa5ffb56ffdbe5a37bfc04d063fbff2bf929c27.tar.gz xv6-labs-6fa5ffb56ffdbe5a37bfc04d063fbff2bf929c27.tar.bz2 xv6-labs-6fa5ffb56ffdbe5a37bfc04d063fbff2bf929c27.zip |
devsw
checkpoint: write(fd,"hello\n",6) where fd is a console dev almost works
Diffstat (limited to 'console.c')
-rw-r--r-- | console.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -2,6 +2,7 @@ #include "x86.h" #include "defs.h" #include "spinlock.h" +#include "dev.h" struct spinlock console_lock = { "console" }; int panicked = 0; @@ -155,3 +156,24 @@ panic(char *s) for(;;) ; } + +int +console_write (int minor, void *buf, int n) +{ + int i; + uchar *b = buf; + + cprintf ("print character to console\n"); + + for (i = 0; i < n; i++) { + cons_putc((int) b[i]); + } + + return n; +} + +void +console_init () +{ + devsw[CONSOLE].d_write = console_write; +} |