Skip to content
Snippets Groups Projects
Commit de2343d2 authored by Christoph Hellwig's avatar Christoph Hellwig
Browse files

fix writes to stdout and stderr

We want these in line buffered mode, but to get that we need to query the
console driver if it is a tty, and we can only do that after the VFS has
been brought up.
parent 82363a35
No related branches found
No related tags found
No related merge requests found
......@@ -1033,6 +1033,8 @@ void mount_rootfs(void)
int console_init(void);
int vfs_initialized;
void
vfs_init(void)
{
......@@ -1060,6 +1062,7 @@ vfs_init(void)
printf("failed to dup console (1)\n");
if (dup(0) != 2)
printf("failed to dup console (2)\n");
vfs_initialized = 1;
}
void sys_panic(const char *str)
......
......@@ -2,9 +2,15 @@
#include <termios.h>
#include <sys/ioctl.h>
extern int vfs_initialized;
size_t __stdout_write(FILE *f, const unsigned char *buf, size_t len)
{
struct termios tio;
if (!vfs_initialized)
return 0;
f->write = __stdio_write;
if (!(f->flags & F_SVB) && ioctl(f->fd, TCGETS, &tio))
f->lbf = -1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment