This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
c_ispeed fix for tcgetattr/tcsetattr
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: libc-alpha at sources dot redhat dot com
- Date: Wed, 10 Sep 2003 13:04:14 -0400
- Subject: c_ispeed fix for tcgetattr/tcsetattr
New problem in the CVS sources - tcgetattr/tcsetattr check c_ispeed and
c_ospeed unconditionally, but at least MIPS doesn't provide them.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
2003-09-10 Daniel Jacobowitz <drow@mvista.com>
* sysdeps/unix/sysv/linux/tcgetattr.c (__tcgetattr): Check
_HAVE_STRUCT_TERMIOS_C_ISPEED and _HAVE_STRUCT_TERMIOS_C_OSPEED.
* sysdeps/unix/sysv/linux/tcsetattr.c (tcsetattr): Likewise.
diff -ur -x objdir glibc-2.3.2/sysdeps/unix/sysv/linux/tcgetattr.c glibc-2.3.2.work/sysdeps/unix/sysv/linux/tcgetattr.c
--- glibc-2.3.2/sysdeps/unix/sysv/linux/tcgetattr.c 2003-09-10 12:41:08.000000000 -0400
+++ glibc-2.3.2.work/sysdeps/unix/sysv/linux/tcgetattr.c 2003-09-10 11:56:37.000000000 -0400
@@ -45,16 +45,20 @@
termios_p->c_cflag = k_termios.c_cflag;
termios_p->c_lflag = k_termios.c_lflag;
termios_p->c_line = k_termios.c_line;
+#ifdef _HAVE_STRUCT_TERMIOS_C_ISPEED
#ifdef _HAVE_C_ISPEED
termios_p->c_ispeed = k_termios.c_ispeed;
#else
termios_p->c_ispeed = k_termios.c_cflag & (CBAUD | CBAUDEX);
#endif
+#endif
+#ifdef _HAVE_STRUCT_TERMIOS_C_OSPEED
#ifdef _HAVE_C_OSPEED
termios_p->c_ospeed = k_termios.c_ospeed;
#else
termios_p->c_ospeed = k_termios.c_cflag & (CBAUD | CBAUDEX);
#endif
+#endif
if (sizeof (cc_t) == 1 || _POSIX_VDISABLE == 0
|| (unsigned char) _POSIX_VDISABLE == (unsigned char) -1)
memset (__mempcpy (&termios_p->c_cc[0], &k_termios.c_cc[0],
diff -ur -x objdir glibc-2.3.2/sysdeps/unix/sysv/linux/tcsetattr.c glibc-2.3.2.work/sysdeps/unix/sysv/linux/tcsetattr.c
--- glibc-2.3.2/sysdeps/unix/sysv/linux/tcsetattr.c 2003-09-10 12:41:08.000000000 -0400
+++ glibc-2.3.2.work/sysdeps/unix/sysv/linux/tcsetattr.c 2003-09-10 11:56:42.000000000 -0400
@@ -71,12 +71,16 @@
k_termios.c_cflag = termios_p->c_cflag;
k_termios.c_lflag = termios_p->c_lflag;
k_termios.c_line = termios_p->c_line;
+#ifdef _HAVE_STRUCT_TERMIOS_C_ISPEED
#ifdef _HAVE_C_ISPEED
k_termios.c_ispeed = termios_p->c_ispeed;
#endif
+#endif
+#ifdef _HAVE_STRUCT_TERMIOS_C_OSPEED
#ifdef _HAVE_C_OSPEED
k_termios.c_ospeed = termios_p->c_ospeed;
#endif
+#endif
memcpy (&k_termios.c_cc[0], &termios_p->c_cc[0],
__KERNEL_NCCS * sizeof (cc_t));