[PATCH 02/12] termios: Consolidate struct termios
Gabriel F. T. Gomes
gabriel@inconstante.eti.br
Fri Nov 9 13:43:00 GMT 2018
Hi, Adhemerval. Could you help me with a doubt (below)?
On Mon, 15 Oct 2018, Adhemerval Zanella wrote:
>--- /dev/null
>+++ b/sysdeps/unix/sysv/linux/bits/termios-struct.h
> [...]
>+#define NCCS 32
>+struct termios
>+ {
>+ tcflag_t c_iflag; /* input mode flags */
>+ tcflag_t c_oflag; /* output mode flags */
>+ tcflag_t c_cflag; /* control mode flags */
>+ tcflag_t c_lflag; /* local mode flags */
>+ cc_t c_line; /* line discipline */
>+ cc_t c_cc[NCCS]; /* control characters */
>+ speed_t c_ispeed; /* input speed */
>+ speed_t c_ospeed; /* output speed */
>+#define _HAVE_STRUCT_TERMIOS_C_ISPEED 1
>+#define _HAVE_STRUCT_TERMIOS_C_OSPEED 1
>+ };
The generic header will have c_line before c_cc.
>--- a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
>+++ b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
> [...]
>-#define NCCS 32
>-struct termios {
>- tcflag_t c_iflag; /* input mode flags */
>- tcflag_t c_oflag; /* output mode flags */
>- tcflag_t c_cflag; /* control mode flags */
>- tcflag_t c_lflag; /* local mode flags */
>- cc_t c_line; /* line discipline (== c_cc[19]) */
>- cc_t c_cc[NCCS]; /* control characters */
>- speed_t c_ispeed; /* input speed */
>- speed_t c_ospeed; /* output speed */
>-#define _HAVE_STRUCT_TERMIOS_C_ISPEED 1
>-#define _HAVE_STRUCT_TERMIOS_C_OSPEED 1
>-};
>+#include <bits/termios-struct.h>
So does the powerpc-specific header.
As far as I can tell, your patch is doing the right thing, because it's
not modifying what we currently have in glibc.
On the other hand, I just checked the source code for Linux [1] and these
two lines are flipped. This inconsistency between kernel and glibc looks
weird... Is this a bug in current glibc?
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/powerpc/include/uapi/asm/termbits.h#n16
More information about the Libc-alpha
mailing list