diff options
author | Rich Felker <dalias@aerifal.cx> | 2020-08-24 12:29:30 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2020-08-24 21:31:18 -0400 |
commit | 4d5786544bb52c62fc1ae84d91684ef2268afa05 (patch) | |
tree | 4d511ec96569212a52676dc363091f3cf4a76821 /src | |
parent | 9d4b25b4738dbabf628055601d96ba0609c2b4a8 (diff) | |
download | musl-4d5786544bb52c62fc1ae84d91684ef2268afa05.tar.gz musl-4d5786544bb52c62fc1ae84d91684ef2268afa05.tar.bz2 musl-4d5786544bb52c62fc1ae84d91684ef2268afa05.tar.xz musl-4d5786544bb52c62fc1ae84d91684ef2268afa05.zip |
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')
-rw-r--r-- | src/stdio/__fdopen.c | 1 | ||||
-rw-r--r-- | src/stdio/__stdout_write.c | 1 | ||||
-rw-r--r-- | src/termios/tcgetwinsize.c | 8 | ||||
-rw-r--r-- | src/termios/tcsetwinsize.c | 8 | ||||
-rw-r--r-- | src/unistd/isatty.c | 1 |
5 files changed, 19 insertions, 0 deletions
diff --git a/src/stdio/__fdopen.c b/src/stdio/__fdopen.c index 116e78e5..616f4f99 100644 --- a/src/stdio/__fdopen.c +++ b/src/stdio/__fdopen.c @@ -1,6 +1,7 @@ #include "stdio_impl.h" #include <stdlib.h> #include <sys/ioctl.h> +#include <termios.h> #include <fcntl.h> #include <errno.h> #include <string.h> diff --git a/src/stdio/__stdout_write.c b/src/stdio/__stdout_write.c index dd1ec60f..5b413c79 100644 --- a/src/stdio/__stdout_write.c +++ b/src/stdio/__stdout_write.c @@ -1,5 +1,6 @@ #include "stdio_impl.h" #include <sys/ioctl.h> +#include <termios.h> size_t __stdout_write(FILE *f, const unsigned char *buf, size_t len) { diff --git a/src/termios/tcgetwinsize.c b/src/termios/tcgetwinsize.c new file mode 100644 index 00000000..9b3a65a4 --- /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); +} diff --git a/src/termios/tcsetwinsize.c b/src/termios/tcsetwinsize.c new file mode 100644 index 00000000..e01d0e25 --- /dev/null +++ b/src/termios/tcsetwinsize.c @@ -0,0 +1,8 @@ +#include <termios.h> +#include <sys/ioctl.h> +#include "syscall.h" + +int tcsetwinsize(int fd, const struct winsize *wsz) +{ + return syscall(SYS_ioctl, fd, TIOCSWINSZ, wsz); +} diff --git a/src/unistd/isatty.c b/src/unistd/isatty.c index 75a9c186..bc220c00 100644 --- a/src/unistd/isatty.c +++ b/src/unistd/isatty.c @@ -1,6 +1,7 @@ #include <unistd.h> #include <errno.h> #include <sys/ioctl.h> +#include <termios.h> #include "syscall.h" int isatty(int fd) |