diff --git a/options/linux/generic/pty-stubs.cpp b/options/linux/generic/pty-stubs.cpp index d42aac66fb..c83d31a4bd 100644 --- a/options/linux/generic/pty-stubs.cpp +++ b/options/linux/generic/pty-stubs.cpp @@ -15,10 +15,6 @@ int openpty(int *mfd, int *sfd, char *name, const struct termios *ios, const struct winsize *win) { __ensure(!ios); - if (win) { - mlibc::infoLogger() << "mlibc: openpty ignores win argument" << frg::endlog; - } - int ptmx_fd; if(int e = mlibc::sys_open("/dev/ptmx", O_RDWR | O_NOCTTY, 0, &ptmx_fd); e) { errno = e; @@ -38,6 +34,13 @@ int openpty(int *mfd, int *sfd, char *name, const struct termios *ios, const str goto fail; } + if(win) { + if(int ioctl_e, e = mlibc::sys_ioctl(ptmx_fd, TIOCSWINSZ, (void*)win, &ioctl_e); e || ioctl_e) { + errno = e; + goto fail; + } + } + *mfd = ptmx_fd; *sfd = pts_fd; return 0; diff --git a/options/linux/include/mlibc/linux-sysdeps.hpp b/options/linux/include/mlibc/linux-sysdeps.hpp index 36b20e1a82..903744c723 100644 --- a/options/linux/include/mlibc/linux-sysdeps.hpp +++ b/options/linux/include/mlibc/linux-sysdeps.hpp @@ -17,6 +17,7 @@ int sys_open(const char *pathname, int flags, mode_t mode, int *fd); int sys_close(int fd); int sys_read(int fd, void *buf, size_t count, ssize_t *bytes_read); int sys_write(int fd, const void *buf, size_t count, ssize_t *bytes_written); +int sys_ioctl(int fd, unsigned long request, void *arg, int *result); [[gnu::weak]] int sys_dup2(int fd, int flags, int newfd); [[gnu::weak]] int sys_fork(pid_t *child);