From 27bbaf75ba9afdfd53dd967ff5ada6bf983197c6 Mon Sep 17 00:00:00 2001 From: Taru Karttunen Date: Sat, 1 Sep 2012 10:43:49 +0300 Subject: [PATCH] libc_terminal: add fstat and fake some ioctls, fix #344 --- libports/src/lib/libc_terminal/plugin.cc | 26 ++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/libports/src/lib/libc_terminal/plugin.cc b/libports/src/lib/libc_terminal/plugin.cc index ba7ba8d4fa..34cedaf617 100644 --- a/libports/src/lib/libc_terminal/plugin.cc +++ b/libports/src/lib/libc_terminal/plugin.cc @@ -18,6 +18,7 @@ /* libc includes */ #include #include +#include /* Genode includes */ #include @@ -165,6 +166,16 @@ namespace { return 0; } + int fstat(Libc::File_descriptor *fd, struct stat *buf) + { + if (buf) { + Genode::memset(buf, 0, sizeof(struct stat)); + buf->st_mode = S_IFCHR; + } + return 0; + } + + bool supports_select(int nfds, fd_set *readfds, fd_set *writefds, @@ -257,6 +268,21 @@ namespace { * Suppress dummy message of the default plugin function */ int fcntl(Libc::File_descriptor *, int cmd, long arg) { return -1; } + + int ioctl(Libc::File_descriptor *, int request, char *argp) + { + struct termios *t = (struct termios*)argp; + switch (request) { + case TIOCGETA: + Genode::memset(t,0,sizeof(struct termios)); + return 0; + case TIOCSETAW: + return 0; + case TIOCSETAF: + return 0; + } + return -1; + } }; } /* unnamed namespace */