diff options
author | Christopher Faylor <me@cgf.cx> | 2003-04-16 03:03:45 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2003-04-16 03:03:45 +0000 |
commit | c448f78fd56ef8d34474adc2678d6394a4d088ec (patch) | |
tree | 8b0177d10bddf05d3648e296b07ab13e218115e8 /winsup/cygwin/termios.cc | |
parent | 9eed5df6392240b46c2506dcb37227ee73f5a806 (diff) | |
download | cygnal-c448f78fd56ef8d34474adc2678d6394a4d088ec.tar.gz cygnal-c448f78fd56ef8d34474adc2678d6394a4d088ec.tar.bz2 cygnal-c448f78fd56ef8d34474adc2678d6394a4d088ec.zip |
* termios.cc (setspeed): New function.
(cfsetospeed): Use setspeed to set speed.
(cfsetispeed): Use setspeed to set speed.
* autoload.cc: Add load statement for UuidCreate, and UuidCreateSequential.
* cpuid.h: New file.
* cygwin.din: Export gethostid.
* fhandler_proc.cc (cpuid): Move to cpuid.h.
(can_set_flag): Move to cpuid.h.
* syscalls.cc (gethostid): New function.
* version.h: Bump DLL minor version number to 83.
Diffstat (limited to 'winsup/cygwin/termios.cc')
-rw-r--r-- | winsup/cygwin/termios.cc | 46 |
1 files changed, 42 insertions, 4 deletions
diff --git a/winsup/cygwin/termios.cc b/winsup/cygwin/termios.cc index ac1c89bf0..c7dd20d60 100644 --- a/winsup/cygwin/termios.cc +++ b/winsup/cygwin/termios.cc @@ -247,14 +247,52 @@ cfgetispeed (struct termios *tp) return __tonew_termios (tp)->c_ispeed; } +static inline int +setspeed (speed_t &set_speed, speed_t from_speed) +{ + int res; + switch (from_speed) + { + case B0: + case B50: + case B75: + case B110: + case B134: + case B150: + case B200: + case B300: + case B600: + case B1200: + case B1800: + case B2400: + case B4800: + case B9600: + case B19200: + case B38400: + case B57600: + case B115200: + case B128000: + case B230400: + case B256000: + set_speed = from_speed; + res = 0; + break; + default: + set_errno (EINVAL); + res = -1; + break; + } + return res; +} + /* cfsetospeed: POSIX96 7.1.3.1 */ extern "C" int cfsetospeed (struct termios *in_tp, speed_t speed) { struct termios *tp = __tonew_termios (in_tp); - tp->c_ospeed = speed; + int res = setspeed (tp->c_ospeed, speed); (void) __toapp_termios (in_tp, tp); - return 0; + return res; } /* cfsetispeed: POSIX96 7.1.3.1 */ @@ -262,7 +300,7 @@ extern "C" int cfsetispeed (struct termios *in_tp, speed_t speed) { struct termios *tp = __tonew_termios (in_tp); - tp->c_ispeed = speed; + int res = setspeed (tp->c_ispeed, speed); (void) __toapp_termios (in_tp, tp); - return 0; + return res; } |