This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 02/12] termios: Consolidate struct termios
- From: "Gabriel F. T. Gomes" <gabriel at inconstante dot eti dot br>
- To: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- Cc: <libc-alpha at sourceware dot org>, <hpa at zytor dot com>
- Date: Fri, 9 Nov 2018 11:43:07 -0200
- Subject: Re: [PATCH 02/12] termios: Consolidate struct termios
- References: <20181015204956.25558-1-adhemerval.zanella@linaro.org> <20181015204956.25558-2-adhemerval.zanella@linaro.org>
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