[newlib-cygwin] Cygwin: Add new APIs tc[gs]etwinsize()
Takashi Yano
tyan0@sourceware.org
Thu Jan 23 18:23:27 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=0eef1b6c96848b93147b96a91692ae5413cfc455
commit 0eef1b6c96848b93147b96a91692ae5413cfc455
Author: Takashi Yano <takashi.yano@nifty.ne.jp>
Date: Thu Jan 23 15:33:31 2025 +0900
Cygwin: Add new APIs tc[gs]etwinsize()
New APIs tcgetwinsize/tcsetwinsize are added, which is added in
POSIX.1-2024.
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Diff:
---
winsup/cygwin/cygwin.din | 2 ++
winsup/cygwin/fhandler/base.cc | 2 ++
winsup/cygwin/include/sys/termios.h | 2 ++
winsup/cygwin/release/3.6.0 | 2 ++
winsup/cygwin/termios.cc | 12 ++++++++++++
winsup/doc/new-features.xml | 12 ++++++++++++
winsup/doc/posix.xml | 2 ++
7 files changed, 34 insertions(+)
diff --git a/winsup/cygwin/cygwin.din b/winsup/cygwin/cygwin.din
index efc750e83..95a21378b 100644
--- a/winsup/cygwin/cygwin.din
+++ b/winsup/cygwin/cygwin.din
@@ -1530,9 +1530,11 @@ tcflush SIGFE
tcgetattr SIGFE
tcgetpgrp SIGFE
tcgetsid SIGFE
+tcgetwinsize SIGFE
tcsendbreak SIGFE
tcsetattr SIGFE
tcsetpgrp SIGFE
+tcsetwinsize SIGFE
tdelete SIGFE
tdestroy NOSIGFE
telldir SIGFE
diff --git a/winsup/cygwin/fhandler/base.cc b/winsup/cygwin/fhandler/base.cc
index e5e9f2325..0902bf0c2 100644
--- a/winsup/cygwin/fhandler/base.cc
+++ b/winsup/cygwin/fhandler/base.cc
@@ -1333,6 +1333,8 @@ fhandler_base::ioctl (unsigned int cmd, void *buf)
break;
case FIONREAD:
case TIOCSCTTY:
+ case TIOCGWINSZ:
+ case TIOCSWINSZ:
set_errno (ENOTTY);
res = -1;
break;
diff --git a/winsup/cygwin/include/sys/termios.h b/winsup/cygwin/include/sys/termios.h
index d701e2f72..687fb92af 100644
--- a/winsup/cygwin/include/sys/termios.h
+++ b/winsup/cygwin/include/sys/termios.h
@@ -301,6 +301,8 @@ speed_t cfgetospeed(const struct termios *);
int cfsetispeed (struct termios *, speed_t);
int cfsetospeed (struct termios *, speed_t);
int cfsetspeed (struct termios *, speed_t);
+int tcgetwinsize(int fd, const struct winsize *winsz);
+int tcsetwinsize(int fd, const struct winsize *winsz);
#ifdef __cplusplus
}
diff --git a/winsup/cygwin/release/3.6.0 b/winsup/cygwin/release/3.6.0
index 74a6f780c..e193a20c0 100644
--- a/winsup/cygwin/release/3.6.0
+++ b/winsup/cygwin/release/3.6.0
@@ -9,6 +9,8 @@ What's new:
- New API call: timespec_get.
+- New API calls: tcgetwinsize, tcsetwinsize.
+
- New POSIX-defined entry points posix_spawn_file_actions_addchdir and
posix_spawn_file_actions_addfchdir. These are the same as the already
exported posix_spawn_file_actions_addchdir_np and
diff --git a/winsup/cygwin/termios.cc b/winsup/cygwin/termios.cc
index 1dfd57079..6adf47497 100644
--- a/winsup/cygwin/termios.cc
+++ b/winsup/cygwin/termios.cc
@@ -398,3 +398,15 @@ cfmakeraw(struct termios *tp)
tp->c_cflag &= ~(CSIZE | PARENB);
tp->c_cflag |= CS8;
}
+
+extern "C" int
+tcgetwinsize (int fd, const struct winsize *winsz)
+{
+ return ioctl (fd, TIOCGWINSZ, winsz);
+}
+
+extern "C" int
+tcsetwinsize (int fd, const struct winsize *winsz)
+{
+ return ioctl (fd, TIOCSWINSZ, winsz);
+}
diff --git a/winsup/doc/new-features.xml b/winsup/doc/new-features.xml
index 17c688f89..b3daabd50 100644
--- a/winsup/doc/new-features.xml
+++ b/winsup/doc/new-features.xml
@@ -4,6 +4,18 @@
<sect1 id="ov-new"><title>What's new and what changed in Cygwin</title>
+<sect2 id="ov-new3.6"><title>What's new and what changed in 3.6</title>
+
+<itemizedlist mark="bullet">
+
+<listitem><para>
+New API calls: tcgetwinsize, tcsetwinsize.
+</para></listitem>
+
+</itemizedlist>
+
+</sect2>
+
<sect2 id="ov-new3.5"><title>What's new and what changed in 3.5</title>
<itemizedlist mark="bullet">
diff --git a/winsup/doc/posix.xml b/winsup/doc/posix.xml
index eb5835c50..26d4fcfa4 100644
--- a/winsup/doc/posix.xml
+++ b/winsup/doc/posix.xml
@@ -990,9 +990,11 @@ also IEEE Std 1003.1-2017 (POSIX.1-2017).</para>
tcgetattr
tcgetpgrp
tcgetsid
+ tcgetwinsize
tcsendbreak
tcsetattr
tcsetpgrp
+ tcsetwinsize
tdelete
telldir
tempnam
More information about the Cygwin-cvs
mailing list