aboutsummaryrefslogtreecommitdiff
path: root/src/termios/tcgetwinsize.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2020-08-24 12:29:30 -0400
committerRich Felker <dalias@aerifal.cx>2020-08-24 21:31:18 -0400
commit4d5786544bb52c62fc1ae84d91684ef2268afa05 (patch)
tree4d511ec96569212a52676dc363091f3cf4a76821 /src/termios/tcgetwinsize.c
parent9d4b25b4738dbabf628055601d96ba0609c2b4a8 (diff)
downloadmusl-4d5786544bb52c62fc1ae84d91684ef2268afa05.zip
musl-4d5786544bb52c62fc1ae84d91684ef2268afa05.tar.gz
musl-4d5786544bb52c62fc1ae84d91684ef2268afa05.tar.bz2
add tcgetwinsize and tcsetwinsize functions, move struct winsize
these have been adopted for future issue of POSIX as the outcome of Austin Group issue 1151, and are simply functions performing the roles of the historical ioctls. since struct winsize is being standardized along with them, its definition is moved to the appropriate header. there is some chance this will break source files that expect struct winsize to be defined by sys/ioctl.h without including termios.h. if this happens, further changes will be needed to have sys/ioctl.h expose it too.
Diffstat (limited to 'src/termios/tcgetwinsize.c')
-rw-r--r--src/termios/tcgetwinsize.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/termios/tcgetwinsize.c b/src/termios/tcgetwinsize.c
new file mode 100644
index 0000000..9b3a65a
--- /dev/null
+++ b/src/termios/tcgetwinsize.c
@@ -0,0 +1,8 @@
+#include <termios.h>
+#include <sys/ioctl.h>
+#include "syscall.h"
+
+int tcgetwinsize(int fd, struct winsize *wsz)
+{
+ return syscall(SYS_ioctl, fd, TIOCGWINSZ, wsz);
+}