mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-24 15:56:41 +00:00
libc_terminal: Support for dup2 and TIOCGWINSZ
This commit is contained in:
parent
d1c2a7126a
commit
fbd4b5f6df
@ -142,8 +142,7 @@ namespace {
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Plugin()
|
||||
{ }
|
||||
Plugin() { }
|
||||
|
||||
bool supports_stat(const char *path)
|
||||
{
|
||||
@ -298,7 +297,7 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
int ioctl(Libc::File_descriptor *, int request, char *argp)
|
||||
int ioctl(Libc::File_descriptor *fd, int request, char *argp)
|
||||
{
|
||||
struct termios *t = (struct termios*)argp;
|
||||
switch (request) {
|
||||
@ -310,9 +309,23 @@ namespace {
|
||||
return 0;
|
||||
case TIOCSETAF:
|
||||
return 0;
|
||||
case TIOCGWINSZ:
|
||||
{
|
||||
::winsize *winsize = (::winsize *)argp;
|
||||
Terminal::Session::Size terminal_size = context(fd)->size();
|
||||
winsize->ws_row = terminal_size.lines();
|
||||
winsize->ws_col = terminal_size.columns();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int dup2(Libc::File_descriptor *fd, Libc::File_descriptor *new_fd)
|
||||
{
|
||||
new_fd->context = fd->context;
|
||||
return new_fd->libc_fd;
|
||||
}
|
||||
};
|
||||
|
||||
} /* unnamed namespace */
|
||||
|
Loading…
Reference in New Issue
Block a user