From beaf1df02c4666f53180847da8d214e25711b4dd Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Wed, 21 Nov 2012 20:13:07 +0000 Subject: [PATCH] * termios.cc (cfsetspeed): New function. * cygwin.din (cfsetspeed): Export. * posix.sgml (std-bsd): Add cfsetspeed. * include/sys/termios.h (cfsetspeed): Declare. * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump. --- winsup/cygwin/ChangeLog | 8 ++++++++ winsup/cygwin/cygwin.din | 1 + winsup/cygwin/include/cygwin/version.h | 3 ++- winsup/cygwin/include/sys/termios.h | 1 + winsup/cygwin/posix.sgml | 1 + winsup/cygwin/termios.cc | 14 ++++++++++++++ 6 files changed, 27 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 18b110dda..3bca04222 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,11 @@ +2012-11-21 Yaakov Selkowitz + + * termios.cc (cfsetspeed): New function. + * cygwin.din (cfsetspeed): Export. + * posix.sgml (std-bsd): Add cfsetspeed. + * include/sys/termios.h (cfsetspeed): Declare. + * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump. + 2012-11-16 Corinna Vinschen * include/mntent.h: Only include paths.h when building for Cygwin. diff --git a/winsup/cygwin/cygwin.din b/winsup/cygwin/cygwin.din index acd043b30..c1e2e9ac0 100644 --- a/winsup/cygwin/cygwin.din +++ b/winsup/cygwin/cygwin.din @@ -208,6 +208,7 @@ cfgetospeed NOSIGFE cfmakeraw NOSIGFE cfsetispeed SIGFE cfsetospeed SIGFE +cfsetspeed SIGFE chdir SIGFE _chdir = chdir SIGFE chmod SIGFE diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h index 3b8434d4a..5b80a39e2 100644 --- a/winsup/cygwin/include/cygwin/version.h +++ b/winsup/cygwin/include/cygwin/version.h @@ -431,12 +431,13 @@ details. */ 260: Export scandirat. 261: Export memrchr. 262: Export getmntent_r. + 263: Export cfsetspeed. */ /* Note that we forgot to bump the api for ualarm, strtoll, strtoull */ #define CYGWIN_VERSION_API_MAJOR 0 -#define CYGWIN_VERSION_API_MINOR 262 +#define CYGWIN_VERSION_API_MINOR 263 /* There is also a compatibity version number associated with the shared memory regions. It is incremented when incompatible diff --git a/winsup/cygwin/include/sys/termios.h b/winsup/cygwin/include/sys/termios.h index 5c20cb95d..f2255420e 100644 --- a/winsup/cygwin/include/sys/termios.h +++ b/winsup/cygwin/include/sys/termios.h @@ -345,6 +345,7 @@ speed_t cfgetispeed(const struct termios *); speed_t cfgetospeed(const struct termios *); int cfsetispeed (struct termios *, speed_t); int cfsetospeed (struct termios *, speed_t); +int cfsetspeed (struct termios *, speed_t); #ifdef __cplusplus } diff --git a/winsup/cygwin/posix.sgml b/winsup/cygwin/posix.sgml index 0c6f6e502..b532e6e5c 100644 --- a/winsup/cygwin/posix.sgml +++ b/winsup/cygwin/posix.sgml @@ -957,6 +957,7 @@ also IEEE Std 1003.1-2008 (POSIX.1-2008). bindresvport bindresvport_sa cfmakeraw + cfsetspeed daemon dn_comp dn_expand diff --git a/winsup/cygwin/termios.cc b/winsup/cygwin/termios.cc index 0fb0de2ad..80c686952 100644 --- a/winsup/cygwin/termios.cc +++ b/winsup/cygwin/termios.cc @@ -328,6 +328,20 @@ cfsetispeed (struct termios *in_tp, speed_t speed) return res; } +/* cfsetspeed: 4.4BSD */ +extern "C" int +cfsetspeed (struct termios *in_tp, speed_t speed) +{ + struct termios *tp = __tonew_termios (in_tp); + int res; + /* errors come only from unsupported baud rates, so setspeed() would return + identical results in both calls */ + if ((res = setspeed (tp->c_ospeed, speed)) == 0) + setspeed (tp->c_ispeed, speed); + __toapp_termios (in_tp, tp); + return res; +} + extern "C" void cfmakeraw(struct termios *tp) {