aboutsummaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2020-12-24 23:05:31 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2020-12-25 18:43:09 +0000
commit7d7fad7bd969fb464f64d34932234060cee112af (patch)
tree930ebe736b57aa1b82d854f9a352de871e9e4623 /lib/libc
parentf7cd7fe51c4140960ebea00410ed62894f5625d1 (diff)
downloadsrc-7d7fad7bd969fb464f64d34932234060cee112af.tar.gz
src-7d7fad7bd969fb464f64d34932234060cee112af.zip
Add tcgetwinsize(3) and tcsetwinsize(3) to termios
These functions get/set tty winsize respectively, and are trivial wrappers around corresponding termio ioctls. The functions are expected to be a part of POSIX.1 issue 8: https://www.austingroupbugs.net/view.php?id=1151#c3856. They are currently available in NetBSD and in musl libc. PR: 251868 Submitted by: Soumendra Ganguly <soumendraganguly@gmail.com> MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27650
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/gen/Symbol.map2
-rw-r--r--lib/libc/gen/termios.c14
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/libc/gen/Symbol.map b/lib/libc/gen/Symbol.map
index df9ac2227ace..2fb8e080de6a 100644
--- a/lib/libc/gen/Symbol.map
+++ b/lib/libc/gen/Symbol.map
@@ -428,6 +428,8 @@ FBSD_1.6 {
sigandset;
sigisemptyset;
sigorset;
+ tcgetwinsize;
+ tcsetwinsize;
};
FBSDprivate_1.0 {
diff --git a/lib/libc/gen/termios.c b/lib/libc/gen/termios.c
index 7b98c486f472..f072b2f045d9 100644
--- a/lib/libc/gen/termios.c
+++ b/lib/libc/gen/termios.c
@@ -275,3 +275,17 @@ tcflow(int fd, int action)
}
/* NOTREACHED */
}
+
+int
+tcgetwinsize(int fd, struct winsize *w)
+{
+
+ return (_ioctl(fd, TIOCGWINSZ, w));
+}
+
+int
+tcsetwinsize(int fd, const struct winsize *w)
+{
+
+ return (_ioctl(fd, TIOCSWINSZ, w));
+}