49,14 → 49,9 |
#include <async.h> |
#include <sys/types.h> |
|
ssize_t write_stderr(const void *buf, size_t count) |
{ |
return count; |
} |
|
ssize_t read_stdin(void *buf, size_t count) |
{ |
int cons_phone = console_phone_get(false); |
int cons_phone = console_open(false); |
|
if (cons_phone >= 0) { |
kbd_event_t ev; |
72,39 → 67,10 |
((char *) buf)[i++] = ev.c; |
} |
return i; |
} else { |
} else |
return -1; |
} |
} |
|
ssize_t write_stdout(const void *buf, size_t count) |
{ |
int cons_phone = console_phone_get(false); |
int left, rc; |
|
if (cons_phone >= 0) { |
int i; |
|
left = count; |
while (left > 0) { |
rc = console_write(buf, left); |
if (rc < 0) |
break; |
buf += rc; |
left -= rc; |
} |
|
return count; |
} else |
return __SYSCALL3(SYS_KLOG, 1, (sysarg_t) buf, count); |
} |
|
int flush_stdout(void) |
{ |
console_flush(); |
return 0; |
} |
|
void klog_update(void) |
{ |
(void) __SYSCALL3(SYS_KLOG, 1, NULL, 0); |