From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id E469A385828D; Wed, 3 Aug 2022 14:05:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E469A385828D Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: drop macro and code for CYGWIN_VERSION_DLL_IS_OLD_TERMIOS X-Act-Checkin: newlib-cygwin X-Git-Author: Corinna Vinschen X-Git-Refname: refs/heads/master X-Git-Oldrev: 2902b3a09e0a45c4971b59f78ab175b71b3c755e X-Git-Newrev: 02b273a6880b551a7ca29be244c7653b56cc2c10 Message-Id: <20220803140529.E469A385828D@sourceware.org> Date: Wed, 3 Aug 2022 14:05:29 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Aug 2022 14:05:30 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D02b273a6880= b551a7ca29be244c7653b56cc2c10 commit 02b273a6880b551a7ca29be244c7653b56cc2c10 Author: Corinna Vinschen Date: Wed Aug 3 15:33:58 2022 +0200 Cygwin: drop macro and code for CYGWIN_VERSION_DLL_IS_OLD_TERMIOS =20 Signed-off-by: Corinna Vinschen Diff: --- winsup/cygwin/include/cygwin/version.h | 6 ----- winsup/cygwin/include/sys/termios.h | 47 ------------------------------= ---- winsup/cygwin/termios.cc | 32 ++++++++--------------- 3 files changed, 11 insertions(+), 74 deletions(-) diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include= /cygwin/version.h index a5d38f37a..d32da2856 100644 --- a/winsup/cygwin/include/cygwin/version.h +++ b/winsup/cygwin/include/cygwin/version.h @@ -34,12 +34,6 @@ details. */ #define CYGWIN_VERSION_USER_API_VERSION_COMBINED \ CYGWIN_VERSION_PER_PROCESS_API_VERSION_COMBINED (user_data) =20 -/* API versions <=3D this had a termios structure whose members were too s= mall - to accomodate modern settings. */ -#define CYGWIN_VERSION_DLL_OLD_TERMIOS 5 -#define CYGWIN_VERSION_DLL_IS_OLD_TERMIOS \ - (CYGWIN_VERSION_USER_API_VERSION_COMBINED <=3D CYGWIN_VERSION_DLL_OLD_TE= RMIOS) - #define CYGWIN_VERSION_DLL_MALLOC_ENV 28 =20 /* Old APIs had getc/putc macros that conflict with new CR/LF handling in = the diff --git a/winsup/cygwin/include/sys/termios.h b/winsup/cygwin/include/sy= s/termios.h index e4465fca3..d701e2f72 100644 --- a/winsup/cygwin/include/sys/termios.h +++ b/winsup/cygwin/include/sys/termios.h @@ -282,53 +282,6 @@ struct termios speed_t c_ospeed; }; =20 -#ifdef CYGWIN_VERSION_DLL_IS_OLD_TERMIOS -#ifdef __GNUC__ -# define __tonew_termios(ti) \ - ({ \ - struct termios *__newti; \ - \ - if (!CYGWIN_VERSION_DLL_IS_OLD_TERMIOS) \ - __newti =3D (struct termios *) ti; \ - else \ - { \ - __newti =3D (struct termios *) alloca(sizeof(struct termios)); \ - __newti->c_iflag =3D ((struct __oldtermios *)ti)->c_iflag; \ - __newti->c_oflag =3D ((struct __oldtermios *)ti)->c_oflag; \ - __newti->c_cflag =3D ((struct __oldtermios *)ti)->c_cflag; \ - __newti->c_lflag =3D ((struct __oldtermios *)ti)->c_lflag; \ - __newti->c_line =3D ((struct __oldtermios *)ti)->c_line; \ - __newti->c_ispeed =3D ((struct __oldtermios *)ti)->c_ispeed; \ - __newti->c_ospeed =3D ((struct __oldtermios *)ti)->c_ospeed; \ - memcpy (__newti->c_cc, ((struct __oldtermios *)ti)->c_cc, sizeof(__newti-= >c_cc)); \ - } \ - __newti; \ - }) - -# define __makenew_termios(ti) \ - (CYGWIN_VERSION_DLL_IS_OLD_TERMIOS ? \ - (struct termios *) alloca (sizeof (struct termios)) : (ti)) - -# define __toapp_termios(toti, fromti) \ - ({ \ - if (!CYGWIN_VERSION_DLL_IS_OLD_TERMIOS) \ - toti =3D fromti; \ - else \ - { \ - ((struct __oldtermios *)toti)->c_iflag =3D fromti->c_iflag; \ - ((struct __oldtermios *)toti)->c_oflag =3D fromti->c_oflag; \ - ((struct __oldtermios *)toti)->c_cflag =3D fromti->c_cflag; \ - ((struct __oldtermios *)toti)->c_lflag =3D fromti->c_lflag; \ - ((struct __oldtermios *)toti)->c_line =3D fromti->c_line; \ - ((struct __oldtermios *)toti)->c_ispeed =3D fromti->c_ispeed; \ - ((struct __oldtermios *)toti)->c_ospeed =3D fromti->c_ospeed; \ - memcpy (((struct __oldtermios*)toti)->c_cc, fromti->c_cc, sizeof(fromti->= c_cc)); \ - } \ - toti; \ - }) -#endif /*__GNUC__*/ -#endif - #define termio termios =20 #ifdef __cplusplus diff --git a/winsup/cygwin/termios.cc b/winsup/cygwin/termios.cc index ee9cd23b7..1dfd57079 100644 --- a/winsup/cygwin/termios.cc +++ b/winsup/cygwin/termios.cc @@ -112,7 +112,6 @@ extern "C" int tcsetattr (int fd, int a, const struct termios *t) { int res; - t =3D __tonew_termios (t); int e =3D get_errno (); =20 while (1) @@ -165,21 +164,20 @@ tcsetattr (int fd, int a, const struct termios *t) =20 /* tcgetattr: POSIX 7.2.1.1 */ extern "C" int -tcgetattr (int fd, struct termios *in_t) +tcgetattr (int fd, struct termios *t) { int res =3D -1; - struct termios *t =3D __makenew_termios (in_t); =20 cygheap_fdget cfd (fd); if (cfd < 0) /* saw an error */; else if (!cfd->is_tty ()) set_errno (ENOTTY); - else if ((res =3D cfd->tcgetattr (t)) =3D=3D 0) - __toapp_termios (in_t, t); + else + res =3D cfd->tcgetattr (t); =20 if (res) - termios_printf ("%R =3D tcgetattr(%d, %p)", res, fd, in_t); + termios_printf ("%R =3D tcgetattr(%d, %p)", res, fd, t); else termios_printf ("iflag %y, oflag %y, cflag %y, lflag %y, VMIN %d, VTIM= E %d", t->c_iflag, t->c_oflag, t->c_cflag, t->c_lflag, t->c_cc[VMIN], @@ -247,14 +245,14 @@ tcsetpgrp (int fd, pid_t pgid) extern "C" speed_t cfgetospeed (const struct termios *tp) { - return __tonew_termios (tp)->c_ospeed; + return tp->c_ospeed; } =20 /* cfgetispeed: POSIX96 7.1.3.1 */ extern "C" speed_t cfgetispeed (const struct termios *tp) { - return __tonew_termios (tp)->c_ispeed; + return tp->c_ispeed; } =20 static inline int @@ -307,22 +305,16 @@ setspeed (speed_t &set_speed, speed_t from_speed) =20 /* cfsetospeed: POSIX96 7.1.3.1 */ extern "C" int -cfsetospeed (struct termios *in_tp, speed_t speed) +cfsetospeed (struct termios *tp, speed_t speed) { - struct termios *tp =3D __tonew_termios (in_tp); - int res =3D setspeed (tp->c_ospeed, speed); - __toapp_termios (in_tp, tp); - return res; + return setspeed (tp->c_ospeed, speed); } =20 /* cfsetispeed: POSIX96 7.1.3.1 */ extern "C" int -cfsetispeed (struct termios *in_tp, speed_t speed) +cfsetispeed (struct termios *tp, speed_t speed) { - struct termios *tp =3D __tonew_termios (in_tp); - int res =3D setspeed (tp->c_ispeed, speed); - __toapp_termios (in_tp, tp); - return res; + return setspeed (tp->c_ispeed, speed); } =20 struct speed_struct @@ -384,9 +376,8 @@ convert_speed (speed_t speed) /* cfsetspeed: 4.4BSD */ /* Following Linux (undocumented), allow speed to be a numerical baud rate= . */ extern "C" int -cfsetspeed (struct termios *in_tp, speed_t speed) +cfsetspeed (struct termios *tp, speed_t speed) { - struct termios *tp =3D __tonew_termios (in_tp); int res; =20 speed =3D convert_speed (speed); @@ -394,7 +385,6 @@ cfsetspeed (struct termios *in_tp, speed_t speed) identical results in both calls */ if ((res =3D setspeed (tp->c_ospeed, speed)) =3D=3D 0) setspeed (tp->c_ispeed, speed); - __toapp_termios (in_tp, tp); return res; }