[PATCH 01/12] termios: Define TIOCSER_TEMT with __USE_MISC (BZ#17783)

classic Classic list List threaded Threaded
26 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[PATCH 01/12] termios: Define TIOCSER_TEMT with __USE_MISC (BZ#17783)

Adhemerval Zanella-2
This patch defines TIOCSER_TEMT on all architectures using the __USE_MISC
guards similar to BZ#17782 fix.  Latest Linux UAPI defines TIOCSER_TEMT
with the same value for all architectures, so it is safe to use the value
as default for all ABIs.

Checked on x86_64linux-gnu and build against sparc64-linux-gnu and
powerpc64le-linux-gnu.

        * sysdeps/unix/sysv/linux/bits/termios.h [__USE_MISC] (TIOCSER_TEMT):
        Define.
        * sysdeps/unix/sysv/linux/powerpc/bits/termios.h [__USE_MISC]
        (TIOCSER_TEMT): Likewise.
        * sysdeps/unix/sysv/linux/sparc/bits/termios.h [__USE_MISC]
        (TEOCSER_TEMT): Likewise.
---
 sysdeps/unix/sysv/linux/bits/termios.h         | 5 +++++
 sysdeps/unix/sysv/linux/powerpc/bits/termios.h | 4 +++-
 sysdeps/unix/sysv/linux/sparc/bits/termios.h   | 4 ++--
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/bits/termios.h b/sysdeps/unix/sysv/linux/bits/termios.h
index 35efa97576..1e567affc3 100644
--- a/sysdeps/unix/sysv/linux/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/bits/termios.h
@@ -198,6 +198,11 @@ struct termios
 # define EXTPROC 0200000
 #endif
 
+#ifdef __USE_MISC
+/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
+# define TIOCSER_TEMT    0x01   /* Transmitter physically empty */
+#endif
+
 /* tcflow() and TCXONC use these */
 #define TCOOFF 0
 #define TCOON 1
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
index 1362cce551..afe592d5e4 100644
--- a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
@@ -273,7 +273,9 @@ struct ltchars {
 #define _VEOL2 8
 #define _VSWTC 9
 
+#ifdef __USE_MISC
 /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
-#define TIOCSER_TEMT    0x01 /* Transmitter physically empty */
+# define TIOCSER_TEMT    0x01 /* Transmitter physically empty */
+#endif
 
 #endif /* __USE_MISC  */
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/termios.h b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
index 4489b6c2fd..ffe8483694 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
@@ -203,9 +203,9 @@ struct termios
 # define EXTPROC 0x00010000
 #endif
 
-# if defined __USE_GNU
+#ifdef __USE_MISC
 /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
-#define TIOCSER_TEMT    0x01 /* Transmitter physically empty */
+# define TIOCSER_TEMT    0x01 /* Transmitter physically empty */
 #endif
 
 /* tcflow() and TCXONC use these */
--
2.17.1

Reply | Threaded
Open this post in threaded view
|

[PATCH 02/12] termios: Consolidate struct termios

Adhemerval Zanella-2
This patch consolidates the struct termios definition on its own header
and adds arch-defined ones for ABIs that deviate from generic
implementation. They are:

  - alpha which has a slight different layout than generic one (c_cc
    field is defined prior c_line).

  - sparc and mips which do not have the c_ispeed/c_ospeed fields.

No semantic change is expected, checked on a build against x86_64-linux-gnu,
alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.

        * sysdeps/unix/sysv/linux/alpha/bits/termios-struct.h: New file.
        * sysdeps/unix/sysv/linux/bits/termios-struct.h: Likewise.
        * sysdeps/unix/sysv/linux/mips/bits/termios-struct.h: Likewise.
        * sysdeps/unix/sysv/linux/sparc/bits/termios-struct.h: Likewise.
        * sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
        termios-struct.h.
        * sysdeps/unix/sysv/linux/bits/termios.h (struct termios): Move to
        termios-struct.h.
        * sysdeps/unix/sysv/linux/alpha/bits/termios.h (struct termios):
        Likewise.
        * sysdeps/unix/sysv/linux/mips/bits/termios.h (struct termios):
        Likewise.
        * sysdeps/unix/sysv/linux/powerpc/bits/termios.h (struct termios):
        Likewise.
        * sysdeps/unix/sysv/linux/sparc/bits/termios.h (struct termios):
        Likewise.
        * sysdeps/unix/sysv/linux/kernel_termios.h (_HAVE_C_ISPEED,
        _HAVE_C_OSPEED): Define.
        * sysdeps/unix/sysv/linux/mips/kernel_termios.h (_HAVE_C_ISPEED,
        _HAVE_C_OSPEED): Likewise.
        * sysdeps/unix/sysv/linux/sparc/kernel_termios.h (_HAVE_C_ISPEED,
        _HAVE_C_OSPEED): Likewise.
        * sysdeps/unix/sysv/linux/speed.c [_HAVE_STRUCT_TERMIOS_C_OSPEED]
        (cfsetospeed): Check for define value instead of existence.
        [_HAVE_STRUCT_TERMIOS_C_ISPEED] (cfsetispeed): Likewise.
        * sysdeps/unix/sysv/linux/tcgetattr.c [_HAVE_STRUCT_TERMIOS_C_ISPEED
        && _HAVE_C_ISPEED] (__tcgetattr): Likewise.
        * sysdeps/unix/sysv/linux/tcsetattr.c [_HAVE_STRUCT_TERMIOS_C_ISPEED
        && _HAVE_C_ISPEED] (__tcsetattr): Likewise.
---
 sysdeps/unix/sysv/linux/Makefile              |  2 +-
 .../sysv/linux/alpha/bits/termios-struct.h    | 37 +++++++++++++++++++
 sysdeps/unix/sysv/linux/alpha/bits/termios.h  | 15 +-------
 sysdeps/unix/sysv/linux/bits/termios-struct.h | 36 ++++++++++++++++++
 sysdeps/unix/sysv/linux/bits/termios.h        | 15 +-------
 sysdeps/unix/sysv/linux/kernel_termios.h      |  3 ++
 .../sysv/linux/mips/bits/termios-struct.h     | 34 +++++++++++++++++
 sysdeps/unix/sysv/linux/mips/bits/termios.h   | 11 +-----
 sysdeps/unix/sysv/linux/mips/kernel_termios.h |  3 ++
 .../unix/sysv/linux/powerpc/bits/termios.h    | 20 +---------
 .../sysv/linux/sparc/bits/termios-struct.h    | 34 +++++++++++++++++
 sysdeps/unix/sysv/linux/sparc/bits/termios.h  | 11 +-----
 .../unix/sysv/linux/sparc/kernel_termios.h    |  3 ++
 sysdeps/unix/sysv/linux/speed.c               |  4 +-
 sysdeps/unix/sysv/linux/tcgetattr.c           |  8 ++--
 sysdeps/unix/sysv/linux/tcsetattr.c           |  4 +-
 16 files changed, 164 insertions(+), 76 deletions(-)
 create mode 100644 sysdeps/unix/sysv/linux/alpha/bits/termios-struct.h
 create mode 100644 sysdeps/unix/sysv/linux/bits/termios-struct.h
 create mode 100644 sysdeps/unix/sysv/linux/mips/bits/termios-struct.h
 create mode 100644 sysdeps/unix/sysv/linux/sparc/bits/termios-struct.h

diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index ff4535cdca..184a5b19e1 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -43,7 +43,7 @@ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
   bits/siginfo-arch.h bits/siginfo-consts-arch.h \
   bits/procfs.h bits/procfs-id.h bits/procfs-extra.h \
   bits/procfs-prregset.h bits/mman-map-flags-generic.h \
-  bits/msq-pad.h
+  bits/msq-pad.h bits/termios-struct.h
 
 tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \
  tst-quota tst-sync_file_range tst-sysconf-iov_max tst-ttyname \
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/termios-struct.h b/sysdeps/unix/sysv/linux/alpha/bits/termios-struct.h
new file mode 100644
index 0000000000..268988c1a4
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/bits/termios-struct.h
@@ -0,0 +1,37 @@
+/* struct termios definition.  Linux/alpha version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios-struct.h> directly; use <termios.h> instead."
+#endif
+
+/* Alpha has C_CC before C_LINE compare to Linux generic definition.  */
+#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_cc[NCCS]; /* control characters */
+    cc_t c_line; /* line discipline (== c_cc[33]) */
+    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
+  };
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/termios.h b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
index 24423e8fc9..fe358dd8f5 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
@@ -24,20 +24,7 @@ typedef unsigned char cc_t;
 typedef unsigned int speed_t;
 typedef unsigned int tcflag_t;
 
-#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_cc[NCCS]; /* control characters */
-    cc_t c_line; /* line discipline (== c_cc[33]) */
-    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>
 
 /* c_cc characters */
 #define VEOF 0
diff --git a/sysdeps/unix/sysv/linux/bits/termios-struct.h b/sysdeps/unix/sysv/linux/bits/termios-struct.h
new file mode 100644
index 0000000000..ba56a547c1
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/bits/termios-struct.h
@@ -0,0 +1,36 @@
+/* struct termios definition.  Linux/generic version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios-struct.h> directly; use <termios.h> instead."
+#endif
+
+#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
+  };
diff --git a/sysdeps/unix/sysv/linux/bits/termios.h b/sysdeps/unix/sysv/linux/bits/termios.h
index 1e567affc3..93536130aa 100644
--- a/sysdeps/unix/sysv/linux/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/bits/termios.h
@@ -24,20 +24,7 @@ typedef unsigned char cc_t;
 typedef unsigned int speed_t;
 typedef unsigned int tcflag_t;
 
-#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
-  };
+#include <bits/termios-struct.h>
 
 /* c_cc characters */
 #define VINTR 0
diff --git a/sysdeps/unix/sysv/linux/kernel_termios.h b/sysdeps/unix/sysv/linux/kernel_termios.h
index 6f505c7b61..cd000af833 100644
--- a/sysdeps/unix/sysv/linux/kernel_termios.h
+++ b/sysdeps/unix/sysv/linux/kernel_termios.h
@@ -31,4 +31,7 @@ struct __kernel_termios
     cc_t c_cc[__KERNEL_NCCS]; /* control characters */
   };
 
+#define _HAVE_C_ISPEED 0
+#define _HAVE_C_OSPEED 0
+
 #endif /* kernel_termios.h */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/termios-struct.h b/sysdeps/unix/sysv/linux/mips/bits/termios-struct.h
new file mode 100644
index 0000000000..f7684e51f1
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/bits/termios-struct.h
@@ -0,0 +1,34 @@
+/* struct termios definition.  Linux/mips version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios-struct.h> directly; use <termios.h> instead."
+#endif
+
+#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 */
+#define _HAVE_STRUCT_TERMIOS_C_ISPEED 0
+#define _HAVE_STRUCT_TERMIOS_C_OSPEED 0
+  };
diff --git a/sysdeps/unix/sysv/linux/mips/bits/termios.h b/sysdeps/unix/sysv/linux/mips/bits/termios.h
index 7969144633..2b2f873f35 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/termios.h
@@ -24,16 +24,7 @@ typedef unsigned char cc_t;
 typedef unsigned int speed_t;
 typedef unsigned int tcflag_t;
 
-#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 */
-  };
+#include <bits/termios-struct.h>
 
 /* c_cc characters */
 #define VINTR 0 /* Interrupt character [ISIG].  */
diff --git a/sysdeps/unix/sysv/linux/mips/kernel_termios.h b/sysdeps/unix/sysv/linux/mips/kernel_termios.h
index 1c54b19428..5f88c745a0 100644
--- a/sysdeps/unix/sysv/linux/mips/kernel_termios.h
+++ b/sysdeps/unix/sysv/linux/mips/kernel_termios.h
@@ -31,4 +31,7 @@ struct __kernel_termios
     cc_t c_cc[__KERNEL_NCCS]; /* control characters */
   };
 
+#define _HAVE_C_ISPEED 0
+#define _HAVE_C_OSPEED 0
+
 #endif /* kernel_termios.h */
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
index afe592d5e4..ddb32bd7e5 100644
--- a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
@@ -23,25 +23,7 @@ typedef unsigned char cc_t;
 typedef unsigned int speed_t;
 typedef unsigned int tcflag_t;
 
-/*
- * termios type and macro definitions.  Be careful about adding stuff
- * to this file since it's used in GNU libc and there are strict rules
- * concerning namespace pollution.
- */
-
-#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>
 
 /* c_cc characters */
 #define VINTR 0
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/termios-struct.h b/sysdeps/unix/sysv/linux/sparc/bits/termios-struct.h
new file mode 100644
index 0000000000..7c3489e1b9
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/bits/termios-struct.h
@@ -0,0 +1,34 @@
+/* struct termios definition.  Linux/sparc version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios-struct.h> directly; use <termios.h> instead."
+#endif
+
+#define NCCS 17
+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 */
+#define _HAVE_STRUCT_TERMIOS_C_ISPEED 0
+#define _HAVE_STRUCT_TERMIOS_C_OSPEED 0
+  };
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/termios.h b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
index ffe8483694..5fd6055c8e 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
@@ -24,16 +24,7 @@ typedef unsigned char cc_t;
 typedef unsigned int speed_t;
 typedef unsigned int tcflag_t;
 
-#define NCCS 17
-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 */
-  };
+#include <bits/termios-struct.h>
 
 /* c_cc characters */
 #define VINTR    0
diff --git a/sysdeps/unix/sysv/linux/sparc/kernel_termios.h b/sysdeps/unix/sysv/linux/sparc/kernel_termios.h
index 31c717ea9d..3a27382d36 100644
--- a/sysdeps/unix/sysv/linux/sparc/kernel_termios.h
+++ b/sysdeps/unix/sysv/linux/sparc/kernel_termios.h
@@ -34,4 +34,7 @@ struct __kernel_termios
     cc_t c_cc[__KERNEL_NCCS]; /* control characters */
   };
 
+#define _HAVE_C_ISPEED 0
+#define _HAVE_C_OSPEED 0
+
 #endif /* kernel_termios.h */
diff --git a/sysdeps/unix/sysv/linux/speed.c b/sysdeps/unix/sysv/linux/speed.c
index 7db9e998c3..23834c10b5 100644
--- a/sysdeps/unix/sysv/linux/speed.c
+++ b/sysdeps/unix/sysv/linux/speed.c
@@ -58,7 +58,7 @@ cfsetospeed (struct termios *termios_p, speed_t speed)
       && (speed < B57600 || speed > __MAX_BAUD))
     return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL);
 
-#ifdef _HAVE_STRUCT_TERMIOS_C_OSPEED
+#if _HAVE_STRUCT_TERMIOS_C_OSPEED
   termios_p->c_ospeed = speed;
 #endif
   termios_p->c_cflag &= ~(CBAUD | CBAUDEX);
@@ -80,7 +80,7 @@ cfsetispeed (struct termios *termios_p, speed_t speed)
       && (speed < B57600 || speed > __MAX_BAUD))
     return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL);
 
-#ifdef _HAVE_STRUCT_TERMIOS_C_ISPEED
+#if _HAVE_STRUCT_TERMIOS_C_ISPEED
   termios_p->c_ispeed = speed;
 #endif
   if (speed == 0)
diff --git a/sysdeps/unix/sysv/linux/tcgetattr.c b/sysdeps/unix/sysv/linux/tcgetattr.c
index 9748bc8cc4..b79d9f1462 100644
--- a/sysdeps/unix/sysv/linux/tcgetattr.c
+++ b/sysdeps/unix/sysv/linux/tcgetattr.c
@@ -44,15 +44,15 @@ __tcgetattr (int fd, struct termios *termios_p)
       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
+#if _HAVE_STRUCT_TERMIOS_C_ISPEED
+# if _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
+#if _HAVE_STRUCT_TERMIOS_C_OSPEED
+# if _HAVE_C_OSPEED
       termios_p->c_ospeed = k_termios.c_ospeed;
 # else
       termios_p->c_ospeed = k_termios.c_cflag & (CBAUD | CBAUDEX);
diff --git a/sysdeps/unix/sysv/linux/tcsetattr.c b/sysdeps/unix/sysv/linux/tcsetattr.c
index a916e70253..f8025a0473 100644
--- a/sysdeps/unix/sysv/linux/tcsetattr.c
+++ b/sysdeps/unix/sysv/linux/tcsetattr.c
@@ -66,10 +66,10 @@ __tcsetattr (int fd, int optional_actions, const struct termios *termios_p)
   k_termios.c_cflag = termios_p->c_cflag;
   k_termios.c_lflag = termios_p->c_lflag;
   k_termios.c_line = termios_p->c_line;
-#if defined _HAVE_C_ISPEED && defined _HAVE_STRUCT_TERMIOS_C_ISPEED
+#if _HAVE_C_ISPEED && _HAVE_STRUCT_TERMIOS_C_ISPEED
   k_termios.c_ispeed = termios_p->c_ispeed;
 #endif
-#if defined _HAVE_C_OSPEED && defined _HAVE_STRUCT_TERMIOS_C_OSPEED
+#if _HAVE_C_OSPEED && _HAVE_STRUCT_TERMIOS_C_OSPEED
   k_termios.c_ospeed = termios_p->c_ospeed;
 #endif
   memcpy (&k_termios.c_cc[0], &termios_p->c_cc[0],
--
2.17.1

Reply | Threaded
Open this post in threaded view
|

[PATCH 03/12] termios: Consolidate termios c_cc symbolic constants

Adhemerval Zanella-2
In reply to this post by Adhemerval Zanella-2
This patch consolidates the termios symbolic constants used as subscript
for the array c_cc on its own header.  The Linux generic implementation
values match the kernel UAPI and each architecture with deviate values
have their own implementation (in this case alpha, mips64, and sparc64).

No semantic change is expected, checked on a build against x86_64-linux-gnu,
alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.

        * sysdeps/unix/sysv/linux/Makefile (sysdeps_headers): Add
        termios-cc.h.
        * sysdeps/unix/sysv/linux/bits/termios-c_cc.h: Likewise.
        * sysdeps/unix/sysv/linux/alpha/bits/termios-c_cc.h: New file.
        * sysdeps/unix/sysv/linux/mips/bits/termios-c_cc.h: Likewise.
        * sysdeps/unix/sysv/linux/powerpc/bits/termios-c_cc.h: Likewise.
        * sysdeps/unix/sysv/linux/sparc/bits/termios-c_cc.h: Likewise.
        * sysdeps/unix/sysv/linux/bits/termios.h (VINTR, VQUIT, VERASE,
        VKILL, VEOF, VTIME, VMIN, VSWTC, VSTART, VSTOP, VSUSP, VEOL,
        VREPRINT, VDISCARD, VWERASE, VLNEXT, VEOLF2): Move to termios-cc.h.
        * sysdeps/unix/sysv/linux/alpha/bits/termios.h: Likewise.
        * sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise.
        * sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise.
        * sysdeps/unix/sysv/linux/sparc/bits/termios.h: Likewise.
---
 sysdeps/unix/sysv/linux/Makefile              |  2 +-
 .../unix/sysv/linux/alpha/bits/termios-c_cc.h | 40 +++++++++++++++++
 sysdeps/unix/sysv/linux/alpha/bits/termios.h  | 20 +--------
 sysdeps/unix/sysv/linux/bits/termios-c_cc.h   | 40 +++++++++++++++++
 sysdeps/unix/sysv/linux/bits/termios.h        | 20 +--------
 .../unix/sysv/linux/mips/bits/termios-c_cc.h  | 43 +++++++++++++++++++
 sysdeps/unix/sysv/linux/mips/bits/termios.h   | 23 +---------
 .../sysv/linux/powerpc/bits/termios-c_cc.h    | 41 ++++++++++++++++++
 .../unix/sysv/linux/powerpc/bits/termios.h    | 21 +--------
 .../unix/sysv/linux/sparc/bits/termios-c_cc.h | 43 +++++++++++++++++++
 sysdeps/unix/sysv/linux/sparc/bits/termios.h  | 23 +---------
 11 files changed, 213 insertions(+), 103 deletions(-)
 create mode 100644 sysdeps/unix/sysv/linux/alpha/bits/termios-c_cc.h
 create mode 100644 sysdeps/unix/sysv/linux/bits/termios-c_cc.h
 create mode 100644 sysdeps/unix/sysv/linux/mips/bits/termios-c_cc.h
 create mode 100644 sysdeps/unix/sysv/linux/powerpc/bits/termios-c_cc.h
 create mode 100644 sysdeps/unix/sysv/linux/sparc/bits/termios-c_cc.h

diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 184a5b19e1..ace8dcb631 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -43,7 +43,7 @@ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
   bits/siginfo-arch.h bits/siginfo-consts-arch.h \
   bits/procfs.h bits/procfs-id.h bits/procfs-extra.h \
   bits/procfs-prregset.h bits/mman-map-flags-generic.h \
-  bits/msq-pad.h bits/termios-struct.h
+  bits/msq-pad.h bits/termios-struct.h bits/termios-c_cc.h
 
 tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \
  tst-quota tst-sync_file_range tst-sysconf-iov_max tst-ttyname \
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/termios-c_cc.h b/sysdeps/unix/sysv/linux/alpha/bits/termios-c_cc.h
new file mode 100644
index 0000000000..9ad1336ef6
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/bits/termios-c_cc.h
@@ -0,0 +1,40 @@
+/* termios c_cc symbolic constant definitions.  Linux/alpha version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios-c_cc.h> directly; use <termios.h> instead."
+#endif
+
+/* c_cc characters */
+#define VEOF 0
+#define VEOL 1
+#define VEOL2 2
+#define VERASE 3
+#define VWERASE 4
+#define VKILL 5
+#define VREPRINT 6
+#define VSWTC 7
+#define VINTR 8
+#define VQUIT 9
+#define VSUSP 10
+#define VSTART 12
+#define VSTOP 13
+#define VLNEXT 14
+#define VDISCARD 15
+#define VMIN 16
+#define VTIME 17
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/termios.h b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
index fe358dd8f5..25159890b5 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
@@ -25,25 +25,7 @@ typedef unsigned int speed_t;
 typedef unsigned int tcflag_t;
 
 #include <bits/termios-struct.h>
-
-/* c_cc characters */
-#define VEOF 0
-#define VEOL 1
-#define VEOL2 2
-#define VERASE 3
-#define VWERASE 4
-#define VKILL 5
-#define VREPRINT 6
-#define VSWTC 7
-#define VINTR 8
-#define VQUIT 9
-#define VSUSP 10
-#define VSTART 12
-#define VSTOP 13
-#define VLNEXT 14
-#define VDISCARD 15
-#define VMIN 16
-#define VTIME 17
+#include <bits/termios-c_cc.h>
 
 /* c_iflag bits */
 #define IGNBRK 0000001
diff --git a/sysdeps/unix/sysv/linux/bits/termios-c_cc.h b/sysdeps/unix/sysv/linux/bits/termios-c_cc.h
new file mode 100644
index 0000000000..80d5e6d2ce
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/bits/termios-c_cc.h
@@ -0,0 +1,40 @@
+/* termios c_cc symbolic constant definitions.  Linux/generic version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios_c_cc.h> directly; use <termios.h> instead."
+#endif
+
+/* c_cc characters */
+#define VINTR 0
+#define VQUIT 1
+#define VERASE 2
+#define VKILL 3
+#define VEOF 4
+#define VTIME 5
+#define VMIN 6
+#define VSWTC 7
+#define VSTART 8
+#define VSTOP 9
+#define VSUSP 10
+#define VEOL 11
+#define VREPRINT 12
+#define VDISCARD 13
+#define VWERASE 14
+#define VLNEXT 15
+#define VEOL2 16
diff --git a/sysdeps/unix/sysv/linux/bits/termios.h b/sysdeps/unix/sysv/linux/bits/termios.h
index 93536130aa..1fba973734 100644
--- a/sysdeps/unix/sysv/linux/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/bits/termios.h
@@ -25,25 +25,7 @@ typedef unsigned int speed_t;
 typedef unsigned int tcflag_t;
 
 #include <bits/termios-struct.h>
-
-/* c_cc characters */
-#define VINTR 0
-#define VQUIT 1
-#define VERASE 2
-#define VKILL 3
-#define VEOF 4
-#define VTIME 5
-#define VMIN 6
-#define VSWTC 7
-#define VSTART 8
-#define VSTOP 9
-#define VSUSP 10
-#define VEOL 11
-#define VREPRINT 12
-#define VDISCARD 13
-#define VWERASE 14
-#define VLNEXT 15
-#define VEOL2 16
+#include <bits/termios-c_cc.h>
 
 /* c_iflag bits */
 #define IGNBRK 0000001
diff --git a/sysdeps/unix/sysv/linux/mips/bits/termios-c_cc.h b/sysdeps/unix/sysv/linux/mips/bits/termios-c_cc.h
new file mode 100644
index 0000000000..573efbc9d3
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/bits/termios-c_cc.h
@@ -0,0 +1,43 @@
+/* termios c_cc symbolic constant definitions.  Linux/mips version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios-c_cc.h> directly; use <termios.h> instead."
+#endif
+
+/* c_cc characters */
+#define VINTR 0 /* Interrupt character [ISIG].  */
+#define VQUIT 1 /* Quit character [ISIG].  */
+#define VERASE 2 /* Erase character [ICANON].  */
+#define VKILL 3 /* Kill-line character [ICANON].  */
+#define VMIN 4 /* Minimum number of bytes read at once [!ICANON].  */
+#define VTIME 5 /* Time-out value (tenths of a second) [!ICANON].  */
+#define VEOL2 6 /* Second EOL character [ICANON].  */
+#define VSWTC 7
+#define VSWTCH VSWTC
+#define VSTART 8 /* Start (X-ON) character [IXON, IXOFF].  */
+#define VSTOP 9 /* Stop (X-OFF) character [IXON, IXOFF].  */
+#define VSUSP 10 /* Suspend character [ISIG].  */
+ /* VDSUSP is not supported on Linux. */
+/* #define VDSUSP 11 / * Delayed suspend character [ISIG].  */
+#define VREPRINT 12 /* Reprint-line character [ICANON].  */
+#define VDISCARD 13 /* Discard character [IEXTEN].  */
+#define VWERASE 14 /* Word-erase character [ICANON].  */
+#define VLNEXT 15 /* Literal-next character [IEXTEN].  */
+#define VEOF 16 /* End-of-file character [ICANON].  */
+#define VEOL 17 /* End-of-line character [ICANON].  */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/termios.h b/sysdeps/unix/sysv/linux/mips/bits/termios.h
index 2b2f873f35..1153763ae8 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/termios.h
@@ -25,28 +25,7 @@ typedef unsigned int speed_t;
 typedef unsigned int tcflag_t;
 
 #include <bits/termios-struct.h>
-
-/* c_cc characters */
-#define VINTR 0 /* Interrupt character [ISIG].  */
-#define VQUIT 1 /* Quit character [ISIG].  */
-#define VERASE 2 /* Erase character [ICANON].  */
-#define VKILL 3 /* Kill-line character [ICANON].  */
-#define VMIN 4 /* Minimum number of bytes read at once [!ICANON].  */
-#define VTIME 5 /* Time-out value (tenths of a second) [!ICANON].  */
-#define VEOL2 6 /* Second EOL character [ICANON].  */
-#define VSWTC 7
-#define VSWTCH VSWTC
-#define VSTART 8 /* Start (X-ON) character [IXON, IXOFF].  */
-#define VSTOP 9 /* Stop (X-OFF) character [IXON, IXOFF].  */
-#define VSUSP 10 /* Suspend character [ISIG].  */
- /* VDSUSP is not supported on Linux. */
-/* #define VDSUSP 11 / * Delayed suspend character [ISIG].  */
-#define VREPRINT 12 /* Reprint-line character [ICANON].  */
-#define VDISCARD 13 /* Discard character [IEXTEN].  */
-#define VWERASE 14 /* Word-erase character [ICANON].  */
-#define VLNEXT 15 /* Literal-next character [IEXTEN].  */
-#define VEOF 16 /* End-of-file character [ICANON].  */
-#define VEOL 17 /* End-of-line character [ICANON].  */
+#include <bits/termios-c_cc.h>
 
 /* c_iflag bits */
 #define IGNBRK 0000001 /* Ignore break condition.  */
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/termios-c_cc.h b/sysdeps/unix/sysv/linux/powerpc/bits/termios-c_cc.h
new file mode 100644
index 0000000000..8c75e25339
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/termios-c_cc.h
@@ -0,0 +1,41 @@
+/* termios c_cc symbolic constant definitions.  Linux/powerpc version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios-c_cc.h> directly; use <termios.h> instead."
+#endif
+
+/* c_cc characters */
+#define VINTR 0
+#define VQUIT 1
+#define VERASE 2
+#define VKILL 3
+#define VEOF 4
+#define VMIN 5
+#define VEOL 6
+#define VTIME 7
+#define VEOL2 8
+#define VSWTC 9
+
+#define VWERASE 10
+#define VREPRINT 11
+#define VSUSP 12
+#define VSTART 13
+#define VSTOP 14
+#define VLNEXT 15
+#define VDISCARD 16
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
index ddb32bd7e5..2253143734 100644
--- a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
@@ -24,26 +24,7 @@ typedef unsigned int speed_t;
 typedef unsigned int tcflag_t;
 
 #include <bits/termios-struct.h>
-
-/* c_cc characters */
-#define VINTR 0
-#define VQUIT 1
-#define VERASE 2
-#define VKILL 3
-#define VEOF 4
-#define VMIN 5
-#define VEOL 6
-#define VTIME 7
-#define VEOL2 8
-#define VSWTC 9
-
-#define VWERASE 10
-#define VREPRINT 11
-#define VSUSP 12
-#define VSTART 13
-#define VSTOP 14
-#define VLNEXT 15
-#define VDISCARD 16
+#include <bits/termios-c_cc.h>
 
 /* c_iflag bits */
 #define IGNBRK 0000001
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/termios-c_cc.h b/sysdeps/unix/sysv/linux/sparc/bits/termios-c_cc.h
new file mode 100644
index 0000000000..09b504273b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/bits/termios-c_cc.h
@@ -0,0 +1,43 @@
+/* termios c_cc symbolic constant definitions.  Linux/sparc version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios-c_cc.h> directly; use <termios.h> instead."
+#endif
+
+/* c_cc characters */
+#define VINTR    0
+#define VQUIT    1
+#define VERASE   2
+#define VKILL    3
+#define VEOF     4
+#define VEOL     5
+#define VEOL2    6
+#define VSWTC    7
+#define VSTART   8
+#define VSTOP    9
+#define VSUSP    10
+#define VDSUSP   11 /* SunOS POSIX nicety I do believe... */
+#define VREPRINT 12
+#define VDISCARD 13
+#define VWERASE  14
+#define VLNEXT   15
+
+/* User apps assume vmin/vtime is shared with eof/eol */
+#define VMIN     VEOF
+#define VTIME    VEOL
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/termios.h b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
index 5fd6055c8e..a2588c2158 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
@@ -25,28 +25,7 @@ typedef unsigned int speed_t;
 typedef unsigned int tcflag_t;
 
 #include <bits/termios-struct.h>
-
-/* c_cc characters */
-#define VINTR    0
-#define VQUIT    1
-#define VERASE   2
-#define VKILL    3
-#define VEOF     4
-#define VEOL     5
-#define VEOL2    6
-#define VSWTC    7
-#define VSTART   8
-#define VSTOP    9
-#define VSUSP    10
-#define VDSUSP   11 /* SunOS POSIX nicety I do believe... */
-#define VREPRINT 12
-#define VDISCARD 13
-#define VWERASE  14
-#define VLNEXT   15
-
-/* User apps assume vmin/vtime is shared with eof/eol */
-#define VMIN     VEOF
-#define VTIME    VEOL
+#include <bits/termios-c_cc.h>
 
 /* c_iflag bits */
 #define IGNBRK 0x00000001
--
2.17.1

Reply | Threaded
Open this post in threaded view
|

[PATCH 04/12] termios: Consolidate Input Modes definitions.

Adhemerval Zanella-2
In reply to this post by Adhemerval Zanella-2
This patch consolidates the termios symbolic constants used for input
modes with c_iflag member on its own header.  The Linux generic implementation
values match the kernel UAPI and each architecture with deviate values
have their own implementation (in this case alpha and powerpc).

No semantic change is expected, checked on a build against x86_64-linux-gnu,
alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.

        * sysdeps/unix/sysv/linux/Makefile (sysdeps_headers): Add termios-c_iflag.h.
        * sysdeps/unix/sysv/linux/bits/termios-c_iflag.h: New file.
        * sysdeps/unix/sysv/linux/alpha/bits/termios-c_iflag.h: Likewise.
        * sysdeps/unix/sysv/linux/powerpc/bits/termios-c_iflag.h: Likewise.
        * sysdeps/unix/sysv/linux/bits/termios.h (IGNBRK, BRKINT, IGNPAR, PARMRK,
        INPCK, ISTRIP, INLCR, IGNCR, ICRNL, IXON, IXOFF, IXANY, IUCLC, IMAXBEL,
        IUTF8): Move to termios-c_iflag.h.
        * sysdeps/unix/sysv/linux/alpha/bits/termios.h: Likewise.
        * sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise.
        * sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise.
        * sysdeps/unix/sysv/linux/sparc/bits/termios.h: Likewise.
---
 sysdeps/unix/sysv/linux/Makefile              |  3 +-
 .../sysv/linux/alpha/bits/termios-c_iflag.h   | 38 ++++++++++++++++++
 sysdeps/unix/sysv/linux/alpha/bits/termios.h  | 18 +--------
 .../unix/sysv/linux/bits/termios-c_iflag.h    | 40 +++++++++++++++++++
 sysdeps/unix/sysv/linux/bits/termios.h        | 18 +--------
 sysdeps/unix/sysv/linux/mips/bits/termios.h   | 18 +--------
 .../sysv/linux/powerpc/bits/termios-c_iflag.h | 38 ++++++++++++++++++
 .../unix/sysv/linux/powerpc/bits/termios.h    | 18 +--------
 sysdeps/unix/sysv/linux/sparc/bits/termios.h  | 18 +--------
 9 files changed, 123 insertions(+), 86 deletions(-)
 create mode 100644 sysdeps/unix/sysv/linux/alpha/bits/termios-c_iflag.h
 create mode 100644 sysdeps/unix/sysv/linux/bits/termios-c_iflag.h
 create mode 100644 sysdeps/unix/sysv/linux/powerpc/bits/termios-c_iflag.h

diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index ace8dcb631..2f5a59cb11 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -43,7 +43,8 @@ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
   bits/siginfo-arch.h bits/siginfo-consts-arch.h \
   bits/procfs.h bits/procfs-id.h bits/procfs-extra.h \
   bits/procfs-prregset.h bits/mman-map-flags-generic.h \
-  bits/msq-pad.h bits/termios-struct.h bits/termios-c_cc.h
+  bits/msq-pad.h bits/termios-struct.h bits/termios-c_cc.h \
+  bits/termios-c_iflag.h
 
 tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \
  tst-quota tst-sync_file_range tst-sysconf-iov_max tst-ttyname \
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/termios-c_iflag.h b/sysdeps/unix/sysv/linux/alpha/bits/termios-c_iflag.h
new file mode 100644
index 0000000000..11584250d5
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/bits/termios-c_iflag.h
@@ -0,0 +1,38 @@
+/* termios input mode definitions.  Linux/alpha version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios-c_iflags.h> directly; use <termios.h> instead."
+#endif
+
+/* c_iflag bits */
+#define IGNBRK 0000001
+#define BRKINT 0000002
+#define IGNPAR 0000004
+#define PARMRK 0000010
+#define INPCK 0000020
+#define ISTRIP 0000040
+#define INLCR 0000100
+#define IGNCR 0000200
+#define ICRNL 0000400
+#define IXON 0001000
+#define IXOFF 0002000
+#define IXANY 0004000
+#define IUCLC 0010000
+#define IMAXBEL 0020000
+#define IUTF8 0040000
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/termios.h b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
index 25159890b5..4d49c66aa8 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
@@ -26,23 +26,7 @@ typedef unsigned int tcflag_t;
 
 #include <bits/termios-struct.h>
 #include <bits/termios-c_cc.h>
-
-/* c_iflag bits */
-#define IGNBRK 0000001
-#define BRKINT 0000002
-#define IGNPAR 0000004
-#define PARMRK 0000010
-#define INPCK 0000020
-#define ISTRIP 0000040
-#define INLCR 0000100
-#define IGNCR 0000200
-#define ICRNL 0000400
-#define IXON 0001000
-#define IXOFF 0002000
-#define IXANY 0004000
-#define IUCLC 0010000
-#define IMAXBEL 0020000
-#define IUTF8 0040000
+#include <bits/termios-c_iflag.h>
 
 /* c_oflag bits */
 #define OPOST 0000001
diff --git a/sysdeps/unix/sysv/linux/bits/termios-c_iflag.h b/sysdeps/unix/sysv/linux/bits/termios-c_iflag.h
new file mode 100644
index 0000000000..c365b82262
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/bits/termios-c_iflag.h
@@ -0,0 +1,40 @@
+/* termios input mode definitions.  Linux/generic version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios-ciflags.h> directly; use <termios.h> instead."
+#endif
+
+/* c_iflag bits */
+#define IGNBRK 0000001  /* Ignore break condition.  */
+#define BRKINT 0000002  /* Signal interrupt on break.  */
+#define IGNPAR 0000004  /* Ignore characters with parity errors.  */
+#define PARMRK 0000010  /* Mark parity and framing errors.  */
+#define INPCK 0000020  /* Enable input parity check.  */
+#define ISTRIP 0000040  /* Strip 8th bit off characters.  */
+#define INLCR 0000100  /* Map NL to CR on input.  */
+#define IGNCR 0000200  /* Ignore CR.  */
+#define ICRNL 0000400  /* Map CR to NL on input.  */
+#define IUCLC 0001000  /* Map uppercase characters to lowercase on input
+    (not in POSIX).  */
+#define IXON 0002000  /* Enable start/stop output control.  */
+#define IXANY 0004000  /* Enable any character to restart output.  */
+#define IXOFF 0010000  /* Enable start/stop input control.  */
+#define IMAXBEL 0020000  /* Ring bell when input queue is full
+    (not in POSIX).  */
+#define IUTF8 0040000  /* Input is UTF8 (not in POSIX).  */
diff --git a/sysdeps/unix/sysv/linux/bits/termios.h b/sysdeps/unix/sysv/linux/bits/termios.h
index 1fba973734..6ce5c56049 100644
--- a/sysdeps/unix/sysv/linux/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/bits/termios.h
@@ -26,23 +26,7 @@ typedef unsigned int tcflag_t;
 
 #include <bits/termios-struct.h>
 #include <bits/termios-c_cc.h>
-
-/* c_iflag bits */
-#define IGNBRK 0000001
-#define BRKINT 0000002
-#define IGNPAR 0000004
-#define PARMRK 0000010
-#define INPCK 0000020
-#define ISTRIP 0000040
-#define INLCR 0000100
-#define IGNCR 0000200
-#define ICRNL 0000400
-#define IUCLC 0001000
-#define IXON 0002000
-#define IXANY 0004000
-#define IXOFF 0010000
-#define IMAXBEL 0020000
-#define IUTF8 0040000
+#include <bits/termios-c_iflag.h>
 
 /* c_oflag bits */
 #define OPOST 0000001
diff --git a/sysdeps/unix/sysv/linux/mips/bits/termios.h b/sysdeps/unix/sysv/linux/mips/bits/termios.h
index 1153763ae8..a8a37ff176 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/termios.h
@@ -26,23 +26,7 @@ typedef unsigned int tcflag_t;
 
 #include <bits/termios-struct.h>
 #include <bits/termios-c_cc.h>
-
-/* c_iflag bits */
-#define IGNBRK 0000001 /* Ignore break condition.  */
-#define BRKINT 0000002 /* Signal interrupt on break.  */
-#define IGNPAR 0000004 /* Ignore characters with parity errors.  */
-#define PARMRK 0000010 /* Mark parity and framing errors.  */
-#define INPCK 0000020 /* Enable input parity check.  */
-#define ISTRIP 0000040 /* Strip 8th bit off characters.  */
-#define INLCR 0000100 /* Map NL to CR on input.  */
-#define IGNCR 0000200 /* Ignore CR.  */
-#define ICRNL 0000400 /* Map CR to NL on input.  */
-#define IUCLC 0001000 /* Map upper case to lower case on input.  */
-#define IXON 0002000 /* Enable start/stop output control.  */
-#define IXANY 0004000 /* Any character will restart after stop.  */
-#define IXOFF 0010000 /* Enable start/stop input control.  */
-#define IMAXBEL 0020000 /* Ring bell when input queue is full.  */
-#define IUTF8 0040000 /* Input is UTF8.  */
+#include <bits/termios-c_iflag.h>
 
 /* c_oflag bits */
 #define OPOST 0000001 /* Perform output processing.  */
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/termios-c_iflag.h b/sysdeps/unix/sysv/linux/powerpc/bits/termios-c_iflag.h
new file mode 100644
index 0000000000..c728b4d110
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/termios-c_iflag.h
@@ -0,0 +1,38 @@
+/* termios input mode definitions.  Linux/powerpc version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios-c_iflags.h> directly; use <termios.h> instead."
+#endif
+
+/* c_iflag bits */
+#define IGNBRK 0000001
+#define BRKINT 0000002
+#define IGNPAR 0000004
+#define PARMRK 0000010
+#define INPCK 0000020
+#define ISTRIP 0000040
+#define INLCR 0000100
+#define IGNCR 0000200
+#define ICRNL 0000400
+#define IXON 0001000
+#define IXOFF 0002000
+#define IXANY 0004000
+#define IUCLC 0010000
+#define IMAXBEL 0020000
+#define IUTF8 0040000
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
index 2253143734..4ccabd7095 100644
--- a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
@@ -25,23 +25,7 @@ typedef unsigned int tcflag_t;
 
 #include <bits/termios-struct.h>
 #include <bits/termios-c_cc.h>
-
-/* c_iflag bits */
-#define IGNBRK 0000001
-#define BRKINT 0000002
-#define IGNPAR 0000004
-#define PARMRK 0000010
-#define INPCK 0000020
-#define ISTRIP 0000040
-#define INLCR 0000100
-#define IGNCR 0000200
-#define ICRNL 0000400
-#define IXON 0001000
-#define IXOFF 0002000
-#define IXANY 0004000
-#define IUCLC 0010000
-#define IMAXBEL 0020000
-#define IUTF8 0040000
+#include <bits/termios-c_iflag.h>
 
 /* c_oflag bits */
 #define OPOST 0000001
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/termios.h b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
index a2588c2158..4123ed7aaa 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
@@ -26,23 +26,7 @@ typedef unsigned int tcflag_t;
 
 #include <bits/termios-struct.h>
 #include <bits/termios-c_cc.h>
-
-/* c_iflag bits */
-#define IGNBRK 0x00000001
-#define BRKINT 0x00000002
-#define IGNPAR 0x00000004
-#define PARMRK 0x00000008
-#define INPCK 0x00000010
-#define ISTRIP 0x00000020
-#define INLCR 0x00000040
-#define IGNCR 0x00000080
-#define ICRNL 0x00000100
-#define IUCLC 0x00000200
-#define IXON 0x00000400
-#define IXANY 0x00000800
-#define IXOFF 0x00001000
-#define IMAXBEL 0x00002000
-#define IUTF8 0x00004000
+#include <bits/termios-c_iflag.h>
 
 /* c_oflag bits */
 #define OPOST 0x00000001
--
2.17.1

Reply | Threaded
Open this post in threaded view
|

[PATCH 05/12] termios: Consolidate Output Modes definitions

Adhemerval Zanella-2
In reply to this post by Adhemerval Zanella-2
This patch consolidates the termios symbolic constants used for ouput
modes with c_oflag member on its own header.  The Linux generic implementation
values match the kernel UAPI and each architecture with deviate values
have their own implementation (in this case alpha, powerpc, and sparc).

No semantic change is expected, checked on a build against x86_64-linux-gnu,
alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.

        * sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Add
        termios-c_oflag.h.
        * sysdeps/unix/sysv/linux/bits/termios-c_oflag.h: New file.
        * sysdeps/unix/sysv/linux/alpha/bits/termios-c_oflag.h: Likewise.
        * sysdeps/unix/sysv/linux/powerpc/bits/termios-c_oflag.h: Likewise.
        * sysdeps/unix/sysv/linux/sparc/bits/termios-c_oflag.h: Likewise.
        * sysdeps/unix/sysv/linux/bits/termios.h (OPOST, OLCUC, ONLCR, OCRNL,
        ONOCR, ONLRET, OFILL, OFDEL, VTDLY, VT0, VT1):  Move to
        termios-c_oflag.h.
        [__USE_MISC || __USE_XOPEN] (NLDLY, NL0, NL1, CRDLY, CR0, CR1, CR2,
        CR3, TABDLY, TAB0, TAB1, TAB2, TAB3, BSDLY, BS0, BS1, FFDLY, FF0,
        FFR1): Likewise.
        [USE_MISC] (XTABS): Likewise.
        * sysdeps/unix/sysv/linux/alpha/bits/termios.h: Likewise.
        * sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise.
        * sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise.
        * sysdeps/unix/sysv/linux/sparc/bits/termios.h Likewise.
---
 sysdeps/unix/sysv/linux/Makefile              |  2 +-
 .../sysv/linux/alpha/bits/termios-c_oflag.h   | 66 +++++++++++++++++++
 sysdeps/unix/sysv/linux/alpha/bits/termios.h  | 46 +------------
 .../unix/sysv/linux/bits/termios-c_oflag.h    | 61 +++++++++++++++++
 sysdeps/unix/sysv/linux/bits/termios.h        | 40 +----------
 sysdeps/unix/sysv/linux/mips/bits/termios.h   | 40 +----------
 .../sysv/linux/powerpc/bits/termios-c_oflag.h | 65 ++++++++++++++++++
 .../unix/sysv/linux/powerpc/bits/termios.h    | 45 +------------
 .../sysv/linux/sparc/bits/termios-c_oflag.h   | 64 ++++++++++++++++++
 sysdeps/unix/sysv/linux/sparc/bits/termios.h  | 44 +------------
 10 files changed, 262 insertions(+), 211 deletions(-)
 create mode 100644 sysdeps/unix/sysv/linux/alpha/bits/termios-c_oflag.h
 create mode 100644 sysdeps/unix/sysv/linux/bits/termios-c_oflag.h
 create mode 100644 sysdeps/unix/sysv/linux/powerpc/bits/termios-c_oflag.h
 create mode 100644 sysdeps/unix/sysv/linux/sparc/bits/termios-c_oflag.h

diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 2f5a59cb11..097107c82c 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -44,7 +44,7 @@ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
   bits/procfs.h bits/procfs-id.h bits/procfs-extra.h \
   bits/procfs-prregset.h bits/mman-map-flags-generic.h \
   bits/msq-pad.h bits/termios-struct.h bits/termios-c_cc.h \
-  bits/termios-c_iflag.h
+  bits/termios-c_iflag.h bits/termios-c_oflag.h
 
 tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \
  tst-quota tst-sync_file_range tst-sysconf-iov_max tst-ttyname \
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/termios-c_oflag.h b/sysdeps/unix/sysv/linux/alpha/bits/termios-c_oflag.h
new file mode 100644
index 0000000000..6458f6556b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/bits/termios-c_oflag.h
@@ -0,0 +1,66 @@
+/* termios output mode definitions.  Linux/alpha version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios-c_oflag.h> directly; use <termios.h> instead."
+#endif
+
+/* c_oflag bits */
+#define OPOST 0000001
+#define ONLCR 0000002
+#define OLCUC 0000004
+
+#define OCRNL 0000010
+#define ONOCR 0000020
+#define ONLRET 0000040
+
+#define OFILL 00000100
+#define OFDEL 00000200
+#if defined __USE_MISC || defined __USE_XOPEN
+# define NLDLY 00001400
+# define   NL0 00000000
+# define   NL1 00000400
+# if defined __USE_MISC
+#  define   NL2 00001000
+#  define   NL3 00001400
+# endif
+# define TABDLY 00006000
+# define   TAB0 00000000
+# define   TAB1 00002000
+# define   TAB2 00004000
+# define   TAB3 00006000
+# define CRDLY 00030000
+# define   CR0 00000000
+# define   CR1 00010000
+# define   CR2 00020000
+# define   CR3 00030000
+# define FFDLY 00040000
+# define   FF0 00000000
+# define   FF1 00040000
+# define BSDLY 00100000
+# define   BS0 00000000
+# define   BS1 00100000
+#endif
+
+#define VTDLY 00200000
+#define   VT0 00000000
+#define   VT1 00200000
+
+#ifdef __USE_MISC
+# define XTABS TAB3
+#endif
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/termios.h b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
index 4d49c66aa8..7259c1dd30 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
@@ -27,51 +27,7 @@ typedef unsigned int tcflag_t;
 #include <bits/termios-struct.h>
 #include <bits/termios-c_cc.h>
 #include <bits/termios-c_iflag.h>
-
-/* c_oflag bits */
-#define OPOST 0000001
-#define ONLCR 0000002
-#define OLCUC 0000004
-
-#define OCRNL 0000010
-#define ONOCR 0000020
-#define ONLRET 0000040
-
-#define OFILL 00000100
-#define OFDEL 00000200
-#if defined __USE_MISC || defined __USE_XOPEN
-# define NLDLY 00001400
-# define   NL0 00000000
-# define   NL1 00000400
-# if defined __USE_MISC
-#  define   NL2 00001000
-#  define   NL3 00001400
-# endif
-# define TABDLY 00006000
-# define   TAB0 00000000
-# define   TAB1 00002000
-# define   TAB2 00004000
-# define   TAB3 00006000
-# define CRDLY 00030000
-# define   CR0 00000000
-# define   CR1 00010000
-# define   CR2 00020000
-# define   CR3 00030000
-# define FFDLY 00040000
-# define   FF0 00000000
-# define   FF1 00040000
-# define BSDLY 00100000
-# define   BS0 00000000
-# define   BS1 00100000
-#endif
-
-#define VTDLY 00200000
-#define   VT0 00000000
-#define   VT1 00200000
-
-#ifdef __USE_MISC
-# define XTABS TAB3
-#endif
+#include <bits/termios-c_oflag.h>
 
 /* c_cflag bit meaning */
 #ifdef __USE_MISC
diff --git a/sysdeps/unix/sysv/linux/bits/termios-c_oflag.h b/sysdeps/unix/sysv/linux/bits/termios-c_oflag.h
new file mode 100644
index 0000000000..038005b1cb
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/bits/termios-c_oflag.h
@@ -0,0 +1,61 @@
+/* termios output mode definitions.  Linux/generic version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios-c_oflag.h> directly; use <termios.h> instead."
+#endif
+
+/* c_oflag bits */
+#define OPOST 0000001  /* Post-process output.  */
+#define OLCUC 0000002  /* Map lowercase characters to uppercase on output.
+    (not in POSIX).  */
+#define ONLCR 0000004  /* Map NL to CR-NL on output.  */
+#define OCRNL 0000010  /* Map CR to NL on output.  */
+#define ONOCR 0000020  /* No CR output at column 0.  */
+#define ONLRET 0000040  /* NL performs CR function.  */
+#define OFILL 0000100  /* Use fill characters for delay.  */
+#define OFDEL 0000200  /* Fill is DEL.  */
+#if defined __USE_MISC || defined __USE_XOPEN
+# define NLDLY 0000400  /* Select newline delays:  */
+# define   NL0 0000000  /* Newline type 0.  */
+# define   NL1 0000400  /* Newline type 1.  */
+# define CRDLY 0003000  /* Select carriage-return delays:  */
+# define   CR0 0000000  /* Carriage-return delay type 0.  */
+# define   CR1 0001000  /* Carriage-return delay type 1.  */
+# define   CR2 0002000  /* Carriage-return delay type 2.  */
+# define   CR3 0003000  /* Carriage-return delay type 3.  */
+# define TABDLY 0014000  /* Select horizontal-tab delays:  */
+# define   TAB0 0000000  /* Horizontal-tab delay type 0.  */
+# define   TAB1 0004000  /* Horizontal-tab delay type 1.  */
+# define   TAB2 0010000  /* Horizontal-tab delay type 2.  */
+# define   TAB3 0014000  /* Expand tabs to spaces.  */
+# define BSDLY 0020000  /* Select backspace delays:  */
+# define   BS0 0000000  /* Backspace-delay type 0.  */
+# define   BS1 0020000  /* Backspace-delay type 1.  */
+# define FFDLY 0100000  /* Select form-feed delays:  */
+# define   FF0 0000000  /* Form-feed delay type 0.  */
+# define   FF1 0100000  /* Form-feed delay type 1.  */
+#endif
+
+#define VTDLY 0040000  /* Select vertical-tab delays:  */
+#define   VT0 0000000  /* Vertical-tab delay type 0.  */
+#define   VT1 0040000  /* Vertical-tab delay type 1.  */
+
+#ifdef __USE_MISC
+# define XTABS 0014000
+#endif
diff --git a/sysdeps/unix/sysv/linux/bits/termios.h b/sysdeps/unix/sysv/linux/bits/termios.h
index 6ce5c56049..15b279b01e 100644
--- a/sysdeps/unix/sysv/linux/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/bits/termios.h
@@ -27,45 +27,7 @@ typedef unsigned int tcflag_t;
 #include <bits/termios-struct.h>
 #include <bits/termios-c_cc.h>
 #include <bits/termios-c_iflag.h>
-
-/* c_oflag bits */
-#define OPOST 0000001
-#define OLCUC 0000002
-#define ONLCR 0000004
-#define OCRNL 0000010
-#define ONOCR 0000020
-#define ONLRET 0000040
-#define OFILL 0000100
-#define OFDEL 0000200
-#if defined __USE_MISC || defined __USE_XOPEN
-# define NLDLY 0000400
-# define   NL0 0000000
-# define   NL1 0000400
-# define CRDLY 0003000
-# define   CR0 0000000
-# define   CR1 0001000
-# define   CR2 0002000
-# define   CR3 0003000
-# define TABDLY 0014000
-# define   TAB0 0000000
-# define   TAB1 0004000
-# define   TAB2 0010000
-# define   TAB3 0014000
-# define BSDLY 0020000
-# define   BS0 0000000
-# define   BS1 0020000
-# define FFDLY 0100000
-# define   FF0 0000000
-# define   FF1 0100000
-#endif
-
-#define VTDLY 0040000
-#define   VT0 0000000
-#define   VT1 0040000
-
-#ifdef __USE_MISC
-# define XTABS 0014000
-#endif
+#include <bits/termios-c_oflag.h>
 
 /* c_cflag bit meaning */
 #ifdef __USE_MISC
diff --git a/sysdeps/unix/sysv/linux/mips/bits/termios.h b/sysdeps/unix/sysv/linux/mips/bits/termios.h
index a8a37ff176..f851adbfe1 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/termios.h
@@ -27,45 +27,7 @@ typedef unsigned int tcflag_t;
 #include <bits/termios-struct.h>
 #include <bits/termios-c_cc.h>
 #include <bits/termios-c_iflag.h>
-
-/* c_oflag bits */
-#define OPOST 0000001 /* Perform output processing.  */
-#define OLCUC 0000002 /* Map lower case to upper case on output.  */
-#define ONLCR 0000004 /* Map NL to CR-NL on output.  */
-#define OCRNL 0000010
-#define ONOCR 0000020
-#define ONLRET 0000040
-#define OFILL 0000100
-#define OFDEL 0000200
-#if defined __USE_MISC || defined __USE_XOPEN
-# define NLDLY 0000400
-# define   NL0 0000000
-# define   NL1 0000400
-# define CRDLY 0003000
-# define   CR0 0000000
-# define   CR1 0001000
-# define   CR2 0002000
-# define   CR3 0003000
-# define TABDLY 0014000
-# define   TAB0 0000000
-# define   TAB1 0004000
-# define   TAB2 0010000
-# define   TAB3 0014000
-# define BSDLY 0020000
-# define   BS0 0000000
-# define   BS1 0020000
-# define FFDLY 0100000
-# define   FF0 0000000
-# define   FF1 0100000
-#endif
-
-#define VTDLY 0040000
-#define   VT0 0000000
-#define   VT1 0040000
-
-#ifdef __USE_MISC
-# define XTABS  0014000
-#endif
+#include <bits/termios-c_oflag.h>
 
 /* c_cflag bit meaning */
 #ifdef __USE_MISC
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/termios-c_oflag.h b/sysdeps/unix/sysv/linux/powerpc/bits/termios-c_oflag.h
new file mode 100644
index 0000000000..5e944df7cc
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/termios-c_oflag.h
@@ -0,0 +1,65 @@
+/* termios output mode definitions.  Linux/powerpc version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios-c_oflag.h> directly; use <termios.h> instead."
+#endif
+
+/* c_oflag bits */
+#define OPOST 0000001
+#define ONLCR 0000002
+#define OLCUC 0000004
+
+#define OCRNL 0000010
+#define ONOCR 0000020
+#define ONLRET 0000040
+
+#define OFILL 00000100
+#define OFDEL 00000200
+#if defined __USE_MISC || defined __USE_XOPEN
+# define NLDLY 00001400
+# define   NL0 00000000
+# define   NL1 00000400
+# if defined __USE_MISC
+#  define   NL2 00001000
+#  define   NL3 00001400
+# endif
+# define TABDLY 00006000
+# define   TAB0 00000000
+# define   TAB1 00002000
+# define   TAB2 00004000
+# define   TAB3 00006000
+# define CRDLY 00030000
+# define   CR0 00000000
+# define   CR1 00010000
+# define   CR2 00020000
+# define   CR3 00030000
+# define FFDLY 00040000
+# define   FF0 00000000
+# define   FF1 00040000
+# define BSDLY 00100000
+# define   BS0 00000000
+# define   BS1 00100000
+#endif
+#define VTDLY 00200000
+#define   VT0 00000000
+#define   VT1 00200000
+
+#ifdef __USE_MISC
+# define XTABS 00006000
+#endif
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
index 4ccabd7095..4045274af9 100644
--- a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
@@ -26,50 +26,7 @@ typedef unsigned int tcflag_t;
 #include <bits/termios-struct.h>
 #include <bits/termios-c_cc.h>
 #include <bits/termios-c_iflag.h>
-
-/* c_oflag bits */
-#define OPOST 0000001
-#define ONLCR 0000002
-#define OLCUC 0000004
-
-#define OCRNL 0000010
-#define ONOCR 0000020
-#define ONLRET 0000040
-
-#define OFILL 00000100
-#define OFDEL 00000200
-#if defined __USE_MISC || defined __USE_XOPEN
-# define NLDLY 00001400
-# define   NL0 00000000
-# define   NL1 00000400
-# if defined __USE_MISC
-#  define   NL2 00001000
-#  define   NL3 00001400
-# endif
-# define TABDLY 00006000
-# define   TAB0 00000000
-# define   TAB1 00002000
-# define   TAB2 00004000
-# define   TAB3 00006000
-# define CRDLY 00030000
-# define   CR0 00000000
-# define   CR1 00010000
-# define   CR2 00020000
-# define   CR3 00030000
-# define FFDLY 00040000
-# define   FF0 00000000
-# define   FF1 00040000
-# define BSDLY 00100000
-# define   BS0 00000000
-# define   BS1 00100000
-#endif
-#define VTDLY 00200000
-#define   VT0 00000000
-#define   VT1 00200000
-
-#ifdef __USE_MISC
-# define XTABS 00006000
-#endif
+#include <bits/termios-c_oflag.h>
 
 /* c_cflag bit meaning */
 #ifdef __USE_MISC
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/termios-c_oflag.h b/sysdeps/unix/sysv/linux/sparc/bits/termios-c_oflag.h
new file mode 100644
index 0000000000..fab3072782
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/bits/termios-c_oflag.h
@@ -0,0 +1,64 @@
+/* termios output mode definitions.  Linux/sparc version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios-c_oflag.h> directly; use <termios.h> instead."
+#endif
+
+/* c_oflag bits */
+#define OPOST 0x00000001
+#define OLCUC 0x00000002
+#define ONLCR 0x00000004
+#define OCRNL 0x00000008
+#define ONOCR 0x00000010
+#define ONLRET 0x00000020
+#define OFILL 0x00000040
+#define OFDEL 0x00000080
+#if defined __USE_MISC || defined __USE_XOPEN
+# define NLDLY 0x00000100
+# define   NL0 0x00000000
+# define   NL1 0x00000100
+# define CRDLY 0x00000600
+# define   CR0 0x00000000
+# define   CR1 0x00000200
+# define   CR2 0x00000400
+# define   CR3 0x00000600
+# define TABDLY 0x00001800
+# define   TAB0 0x00000000
+# define   TAB1 0x00000800
+# define   TAB2 0x00001000
+# define   TAB3 0x00001800
+# define BSDLY 0x00002000
+# define   BS0 0x00000000
+# define   BS1 0x00002000
+#define FFDLY 0x00008000
+#define   FF0 0x00000000
+#define   FF1 0x00008000
+#endif
+#define VTDLY 0x00004000
+#define   VT0 0x00000000
+#define   VT1 0x00004000
+
+# if defined __USE_GNU
+#define PAGEOUT 0x00010000 /* SUNOS specific */
+#define WRAP    0x00020000 /* SUNOS specific */
+# endif
+
+#ifdef __USE_MISC
+# define   XTABS 0x00001800
+#endif
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/termios.h b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
index 4123ed7aaa..9c884eb791 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
@@ -27,49 +27,7 @@ typedef unsigned int tcflag_t;
 #include <bits/termios-struct.h>
 #include <bits/termios-c_cc.h>
 #include <bits/termios-c_iflag.h>
-
-/* c_oflag bits */
-#define OPOST 0x00000001
-#define OLCUC 0x00000002
-#define ONLCR 0x00000004
-#define OCRNL 0x00000008
-#define ONOCR 0x00000010
-#define ONLRET 0x00000020
-#define OFILL 0x00000040
-#define OFDEL 0x00000080
-#if defined __USE_MISC || defined __USE_XOPEN
-# define NLDLY 0x00000100
-# define   NL0 0x00000000
-# define   NL1 0x00000100
-# define CRDLY 0x00000600
-# define   CR0 0x00000000
-# define   CR1 0x00000200
-# define   CR2 0x00000400
-# define   CR3 0x00000600
-# define TABDLY 0x00001800
-# define   TAB0 0x00000000
-# define   TAB1 0x00000800
-# define   TAB2 0x00001000
-# define   TAB3 0x00001800
-# define BSDLY 0x00002000
-# define   BS0 0x00000000
-# define   BS1 0x00002000
-#define FFDLY 0x00008000
-#define   FF0 0x00000000
-#define   FF1 0x00008000
-#endif
-#define VTDLY 0x00004000
-#define   VT0 0x00000000
-#define   VT1 0x00004000
-
-# if defined __USE_GNU
-#define PAGEOUT 0x00010000 /* SUNOS specific */
-#define WRAP    0x00020000 /* SUNOS specific */
-# endif
-
-#ifdef __USE_MISC
-# define   XTABS 0x00001800
-#endif
+#include <bits/termios-c_oflag.h>
 
 /* c_cflag bit meaning */
 #ifdef __USE_MISC
--
2.17.1

Reply | Threaded
Open this post in threaded view
|

[PATCH 06/12] termios: Consolidate Baud Rate Selection definitions

Adhemerval Zanella-2
In reply to this post by Adhemerval Zanella-2
This patch consolidates the termios symbolic constants used for baud rates
selection used along with speed_t on its own header.  The Linux generic
implementation values match the kernel UAPI and each architecture with
deviate values have their own implementation (in this case alpha and
powerpc).

No semantic change is expected, checked on a build against x86_64-linux-gnu,
alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.

        * sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
        termios-baud.h.
        * sysdeps/unix/sysv/linux/bits/termios-baud.h: New file.
        * sysdeps/unix/sysv/linux/alpha/bits/termios-baud.h: Likewise.
        * sysdeps/unix/sysv/linux/powerpc/bits/termios-baud.h: Likewise.
        * sysdeps/unix/sysv/linux/alpha/bits/termios.h (B57600, B115200,
        B230400, B460800, B500000, B576000, B921600, B1000000, B1152000,
        B1500000, B2000000, B2500000, B3000000, B3500000, B4000000,
        __MAX_BAUD): Move to termios-baud.h.
        [__USE_MISC] (CBAUD, CBAUDEX): Likewise.
        * sysdeps/unix/sysv/linux/bits/termios.h: Likewise.
        * sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise.
        * sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise.
        * sysdeps/unix/sysv/linux/sparc/bits/termios.h: Likewise.
---
 sysdeps/unix/sysv/linux/Makefile              |  3 +-
 .../unix/sysv/linux/alpha/bits/termios-baud.h | 46 ++++++++++++++++++
 sysdeps/unix/sysv/linux/alpha/bits/termios.h  | 26 +---------
 sysdeps/unix/sysv/linux/bits/termios-baud.h   | 48 +++++++++++++++++++
 sysdeps/unix/sysv/linux/bits/termios.h        | 29 +----------
 sysdeps/unix/sysv/linux/mips/bits/termios.h   | 28 +----------
 .../sysv/linux/powerpc/bits/termios-baud.h    | 45 +++++++++++++++++
 .../unix/sysv/linux/powerpc/bits/termios.h    | 25 +---------
 sysdeps/unix/sysv/linux/sparc/bits/termios.h  | 30 +-----------
 9 files changed, 149 insertions(+), 131 deletions(-)
 create mode 100644 sysdeps/unix/sysv/linux/alpha/bits/termios-baud.h
 create mode 100644 sysdeps/unix/sysv/linux/bits/termios-baud.h
 create mode 100644 sysdeps/unix/sysv/linux/powerpc/bits/termios-baud.h

diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 097107c82c..1af8145b13 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -44,7 +44,8 @@ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
   bits/procfs.h bits/procfs-id.h bits/procfs-extra.h \
   bits/procfs-prregset.h bits/mman-map-flags-generic.h \
   bits/msq-pad.h bits/termios-struct.h bits/termios-c_cc.h \
-  bits/termios-c_iflag.h bits/termios-c_oflag.h
+  bits/termios-c_iflag.h bits/termios-c_oflag.h \
+  bits/termios-baud.h
 
 tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \
  tst-quota tst-sync_file_range tst-sysconf-iov_max tst-ttyname \
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/termios-baud.h b/sysdeps/unix/sysv/linux/alpha/bits/termios-baud.h
new file mode 100644
index 0000000000..eba263a67d
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/bits/termios-baud.h
@@ -0,0 +1,46 @@
+/* termios baud rate selection definitions.  Linux/alpha version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios-baud.h> directly; use <termios.h> instead."
+#endif
+
+#ifdef __USE_MISC
+# define CBAUD 0000037
+# define CBAUDEX 0000000
+# define CMSPAR  010000000000 /* mark or space (stick) parity */
+# define CRTSCTS  020000000000 /* flow control */
+#endif
+
+#define  B57600   00020
+#define  B115200  00021
+#define  B230400  00022
+#define  B460800  00023
+#define  B500000  00024
+#define  B576000  00025
+#define  B921600  00026
+#define  B1000000 00027
+#define  B1152000 00030
+#define  B1500000 00031
+#define  B2000000 00032
+#define  B2500000 00033
+#define  B3000000 00034
+#define  B3500000 00035
+#define  B4000000 00036
+
+#define __MAX_BAUD B4000000
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/termios.h b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
index 7259c1dd30..530dd48410 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
@@ -30,9 +30,6 @@ typedef unsigned int tcflag_t;
 #include <bits/termios-c_oflag.h>
 
 /* c_cflag bit meaning */
-#ifdef __USE_MISC
-# define CBAUD 0000037
-#endif
 #define  B0 0000000 /* hang up */
 #define  B50 0000001
 #define  B75 0000002
@@ -52,25 +49,8 @@ typedef unsigned int tcflag_t;
 #ifdef __USE_MISC
 # define EXTA B19200
 # define EXTB B38400
-# define CBAUDEX 0000000
 #endif
-#define  B57600   00020
-#define  B115200  00021
-#define  B230400  00022
-#define  B460800  00023
-#define  B500000  00024
-#define  B576000  00025
-#define  B921600  00026
-#define  B1000000 00027
-#define  B1152000 00030
-#define  B1500000 00031
-#define  B2000000 00032
-#define  B2500000 00033
-#define  B3000000 00034
-#define  B3500000 00035
-#define  B4000000 00036
-
-#define __MAX_BAUD B4000000
+#include <bits/termios-baud.h>
 
 #define CSIZE 00001400
 #define   CS5 00000000
@@ -85,10 +65,6 @@ typedef unsigned int tcflag_t;
 #define HUPCL 00040000
 
 #define CLOCAL 00100000
-#ifdef __USE_MISC
-# define CMSPAR  010000000000 /* mark or space (stick) parity */
-# define CRTSCTS  020000000000 /* flow control */
-#endif
 
 /* c_lflag bits */
 #define ISIG 0x00000080
diff --git a/sysdeps/unix/sysv/linux/bits/termios-baud.h b/sysdeps/unix/sysv/linux/bits/termios-baud.h
new file mode 100644
index 0000000000..7f7f9c511c
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/bits/termios-baud.h
@@ -0,0 +1,48 @@
+/* termios baud rate selection definitions.  Linux/generic version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios-baud.h> directly; use <termios.h> instead."
+#endif
+
+#ifdef __USE_MISC
+# define CBAUD 000000010017 /* Baud speed mask (not in POSIX).  */
+# define CBAUDEX 000000010000 /* Extra baud speed mask, included in CBAUD.
+ (not in POSIX).  */
+# define CIBAUD 002003600000 /* Input baud rate (not used).  */
+# define CMSPAR  010000000000 /* Mark or space (stick) parity.  */
+# define CRTSCTS 020000000000 /* Flow control.  */
+#endif
+
+/* Extra output baud rates (not in POSIX).  */
+#define  B57600    0010001
+#define  B115200   0010002
+#define  B230400   0010003
+#define  B460800   0010004
+#define  B500000   0010005
+#define  B576000   0010006
+#define  B921600   0010007
+#define  B1000000  0010010
+#define  B1152000  0010011
+#define  B1500000  0010012
+#define  B2000000  0010013
+#define  B2500000  0010014
+#define  B3000000  0010015
+#define  B3500000  0010016
+#define  B4000000  0010017
+#define __MAX_BAUD B4000000
diff --git a/sysdeps/unix/sysv/linux/bits/termios.h b/sysdeps/unix/sysv/linux/bits/termios.h
index 15b279b01e..07ffdf9779 100644
--- a/sysdeps/unix/sysv/linux/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/bits/termios.h
@@ -30,9 +30,6 @@ typedef unsigned int tcflag_t;
 #include <bits/termios-c_oflag.h>
 
 /* c_cflag bit meaning */
-#ifdef __USE_MISC
-# define CBAUD 0010017
-#endif
 #define  B0 0000000 /* hang up */
 #define  B50 0000001
 #define  B75 0000002
@@ -53,6 +50,8 @@ typedef unsigned int tcflag_t;
 # define EXTA B19200
 # define EXTB B38400
 #endif
+#include <bits/termios-baud.h>
+
 #define CSIZE 0000060
 #define   CS5 0000000
 #define   CS6 0000020
@@ -64,30 +63,6 @@ typedef unsigned int tcflag_t;
 #define PARODD 0001000
 #define HUPCL 0002000
 #define CLOCAL 0004000
-#ifdef __USE_MISC
-# define CBAUDEX 0010000
-#endif
-#define  B57600   0010001
-#define  B115200  0010002
-#define  B230400  0010003
-#define  B460800  0010004
-#define  B500000  0010005
-#define  B576000  0010006
-#define  B921600  0010007
-#define  B1000000 0010010
-#define  B1152000 0010011
-#define  B1500000 0010012
-#define  B2000000 0010013
-#define  B2500000 0010014
-#define  B3000000 0010015
-#define  B3500000 0010016
-#define  B4000000 0010017
-#define __MAX_BAUD B4000000
-#ifdef __USE_MISC
-# define CIBAUD  002003600000 /* input baud rate (not used) */
-# define CMSPAR   010000000000 /* mark or space (stick) parity */
-# define CRTSCTS  020000000000 /* flow control */
-#endif
 
 /* c_lflag bits */
 #define ISIG 0000001
diff --git a/sysdeps/unix/sysv/linux/mips/bits/termios.h b/sysdeps/unix/sysv/linux/mips/bits/termios.h
index f851adbfe1..008527577f 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/termios.h
@@ -30,9 +30,6 @@ typedef unsigned int tcflag_t;
 #include <bits/termios-c_oflag.h>
 
 /* c_cflag bit meaning */
-#ifdef __USE_MISC
-# define CBAUD 0010017
-#endif
 #define  B0 0000000 /* hang up */
 #define  B50 0000001
 #define  B75 0000002
@@ -53,6 +50,8 @@ typedef unsigned int tcflag_t;
 # define EXTA B19200
 # define EXTB B38400
 #endif
+#include <bits/termios-baud.h>
+
 #define CSIZE 0000060 /* Number of bits per byte (mask).  */
 #define   CS5 0000000 /* 5 bits per byte.  */
 #define   CS6 0000020 /* 6 bits per byte.  */
@@ -64,29 +63,6 @@ typedef unsigned int tcflag_t;
 #define PARODD 0001000 /* Odd parity instead of even.  */
 #define HUPCL 0002000 /* Hang up on last close.  */
 #define CLOCAL 0004000 /* Ignore modem status lines.  */
-#ifdef __USE_MISC
-# define CBAUDEX   0010000
-#endif
-#define  B57600   0010001
-#define  B115200  0010002
-#define  B230400  0010003
-#define  B460800  0010004
-#define  B500000  0010005
-#define  B576000  0010006
-#define  B921600  0010007
-#define  B1000000 0010010
-#define  B1152000 0010011
-#define  B1500000 0010012
-#define  B2000000 0010013
-#define  B2500000 0010014
-#define  B3000000 0010015
-#define  B3500000 0010016
-#define  B4000000 0010017
-#define __MAX_BAUD B4000000
-#ifdef __USE_MISC
-# define CIBAUD  002003600000 /* input baud rate (not used) */
-# define CRTSCTS  020000000000 /* flow control */
-#endif
 
 /* c_lflag bits */
 #define ISIG 0000001 /* Enable signals.  */
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/termios-baud.h b/sysdeps/unix/sysv/linux/powerpc/bits/termios-baud.h
new file mode 100644
index 0000000000..4f490a929f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/termios-baud.h
@@ -0,0 +1,45 @@
+/* termios baud rate selection definitions.  Linux/powerpc version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios-baud.h> directly; use <termios.h> instead."
+#endif
+
+#ifdef __USE_MISC
+# define CBAUD 0000377
+# define CBAUDEX 0000020
+# define CMSPAR   010000000000 /* mark or space (stick) parity */
+# define CRTSCTS  020000000000 /* flow control */
+#endif
+
+#define  B57600   00020
+#define  B115200  00021
+#define  B230400  00022
+#define  B460800  00023
+#define  B500000  00024
+#define  B576000  00025
+#define  B921600  00026
+#define  B1000000 00027
+#define  B1152000 00030
+#define  B1500000 00031
+#define  B2000000 00032
+#define  B2500000 00033
+#define  B3000000 00034
+#define  B3500000 00035
+#define  B4000000 00036
+#define __MAX_BAUD B4000000
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
index 4045274af9..2f928d5217 100644
--- a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
@@ -29,9 +29,6 @@ typedef unsigned int tcflag_t;
 #include <bits/termios-c_oflag.h>
 
 /* c_cflag bit meaning */
-#ifdef __USE_MISC
-# define CBAUD 0000377
-#endif
 #define  B0 0000000 /* hang up */
 #define  B50 0000001
 #define  B75 0000002
@@ -51,24 +48,8 @@ typedef unsigned int tcflag_t;
 #ifdef __USE_MISC
 # define EXTA B19200
 # define EXTB B38400
-# define CBAUDEX 0000020
 #endif
-#define  B57600   00020
-#define  B115200  00021
-#define  B230400  00022
-#define  B460800  00023
-#define  B500000  00024
-#define  B576000  00025
-#define  B921600  00026
-#define  B1000000 00027
-#define  B1152000 00030
-#define  B1500000 00031
-#define  B2000000 00032
-#define  B2500000 00033
-#define  B3000000 00034
-#define  B3500000 00035
-#define  B4000000 00036
-#define __MAX_BAUD B4000000
+#include <bits/termios-baud.h>
 
 #define CSIZE 00001400
 #define   CS5 00000000
@@ -83,10 +64,6 @@ typedef unsigned int tcflag_t;
 #define HUPCL 00040000
 
 #define CLOCAL 00100000
-#ifdef __USE_MISC
-# define CMSPAR   010000000000 /* mark or space (stick) parity */
-# define CRTSCTS  020000000000 /* flow control */
-#endif
 
 /* c_lflag bits */
 #define ISIG 0x00000080
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/termios.h b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
index 9c884eb791..d612080754 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
@@ -30,9 +30,6 @@ typedef unsigned int tcflag_t;
 #include <bits/termios-c_oflag.h>
 
 /* c_cflag bit meaning */
-#ifdef __USE_MISC
-# define CBAUD 0x0000100f
-#endif
 #define  B0 0x00000000 /* hang up */
 #define  B50 0x00000001
 #define  B75 0x00000002
@@ -53,6 +50,8 @@ typedef unsigned int tcflag_t;
 # define EXTA    B19200
 # define EXTB    B38400
 #endif
+#include <bits/termios-baud.h>
+
 #define  CSIZE  0x00000030
 #define   CS5 0x00000000
 #define   CS6 0x00000010
@@ -64,31 +63,6 @@ typedef unsigned int tcflag_t;
 #define PARODD 0x00000200
 #define HUPCL 0x00000400
 #define CLOCAL 0x00000800
-#ifdef __USE_MISC
-# define CBAUDEX 0x00001000
-#endif
-#define  B57600  0x00001001
-#define  B115200 0x00001002
-#define  B230400 0x00001003
-#define  B460800 0x00001004
-#define  B76800  0x00001005
-#define  B153600 0x00001006
-#define  B307200 0x00001007
-#define  B614400 0x00001008
-#define  B921600 0x00001009
-#define  B500000 0x0000100a
-#define  B576000 0x0000100b
-#define B1000000 0x0000100c
-#define B1152000 0x0000100d
-#define B1500000 0x0000100e
-#define B2000000 0x0000100f
-#define __MAX_BAUD B2000000
-
-#ifdef __USE_MISC
-# define CIBAUD 0x100f0000 /* input baud rate (not used) */
-# define CMSPAR 0x40000000 /* mark or space (stick) parity */
-# define CRTSCTS 0x80000000 /* flow control */
-#endif
 
 /* c_lflag bits */
 #define ISIG 0x00000001
--
2.17.1

Reply | Threaded
Open this post in threaded view
|

[PATCH 07/12] termios: Consolidate control mode definitions

Adhemerval Zanella-2
In reply to this post by Adhemerval Zanella-2
This patch consolidates the termios symbolic constants used for output
mode with c_oflag memver on its own header.  The Linux generic
implementation values match the kernel UAPI and each architecture with
deviate values have their own implementation (in this case alpha and
powerpc).

No semantic change is expected, checked on a build against x86_64-linux-gnu,
alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.

        * sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
        termios-c_cflag.h.
        * sysdeps/unix/sysv/linux/bits/termios-c_cflag.h: New file.
        * sysdeps/unix/sysv/linux/alpha/bits/termios-c_cflag.h: Likewise.
        * sysdeps/unix/sysv/linux/powerpc/bits/termios-c_cflag.h: Likewise.
        * sysdeps/unix/sysv/linux/bits/termios.h (CSIZE, CS5, CS6, CS7, CS8,
        CSTOPB, CREAD, PARENB, PARODD, HUPCL, CLOCAL): Move to
        termios-c_cflag.h.
        * sysdeps/unix/sysv/linux/alpha/bits/termios.h: Likewise.
        * sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise.
        * sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise.
        * sysdeps/unix/sysv/linux/sparc/bits/termios.h: Likewise.
---
 sysdeps/unix/sysv/linux/Makefile              |  2 +-
 .../sysv/linux/alpha/bits/termios-c_cflag.h   | 35 +++++++++++++++++++
 sysdeps/unix/sysv/linux/alpha/bits/termios.h  | 14 +-------
 .../unix/sysv/linux/bits/termios-c_cflag.h    | 34 ++++++++++++++++++
 sysdeps/unix/sysv/linux/bits/termios.h        | 12 +------
 sysdeps/unix/sysv/linux/mips/bits/termios.h   | 12 +------
 .../sysv/linux/powerpc/bits/termios-c_cflag.h | 35 +++++++++++++++++++
 .../unix/sysv/linux/powerpc/bits/termios.h    | 14 +-------
 sysdeps/unix/sysv/linux/sparc/bits/termios.h  | 12 +------
 9 files changed, 110 insertions(+), 60 deletions(-)
 create mode 100644 sysdeps/unix/sysv/linux/alpha/bits/termios-c_cflag.h
 create mode 100644 sysdeps/unix/sysv/linux/bits/termios-c_cflag.h
 create mode 100644 sysdeps/unix/sysv/linux/powerpc/bits/termios-c_cflag.h

diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 1af8145b13..11a497e8e9 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -45,7 +45,7 @@ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
   bits/procfs-prregset.h bits/mman-map-flags-generic.h \
   bits/msq-pad.h bits/termios-struct.h bits/termios-c_cc.h \
   bits/termios-c_iflag.h bits/termios-c_oflag.h \
-  bits/termios-baud.h
+  bits/termios-baud.h bits/termios-c_cflag.h
 
 tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \
  tst-quota tst-sync_file_range tst-sysconf-iov_max tst-ttyname \
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/termios-c_cflag.h b/sysdeps/unix/sysv/linux/alpha/bits/termios-c_cflag.h
new file mode 100644
index 0000000000..f0948a9019
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/bits/termios-c_cflag.h
@@ -0,0 +1,35 @@
+/* termios control mode definitions.  Linux/alpha version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios-c_cflag.h> directly; use <termios.h> instead."
+#endif
+
+#define CSIZE 00001400
+#define   CS5 00000000
+#define   CS6 00000400
+#define   CS7 00001000
+#define   CS8 00001400
+
+#define CSTOPB 00002000
+#define CREAD 00004000
+#define PARENB 00010000
+#define PARODD 00020000
+#define HUPCL 00040000
+
+#define CLOCAL 00100000
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/termios.h b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
index 530dd48410..e0963df7fa 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
@@ -52,19 +52,7 @@ typedef unsigned int tcflag_t;
 #endif
 #include <bits/termios-baud.h>
 
-#define CSIZE 00001400
-#define   CS5 00000000
-#define   CS6 00000400
-#define   CS7 00001000
-#define   CS8 00001400
-
-#define CSTOPB 00002000
-#define CREAD 00004000
-#define PARENB 00010000
-#define PARODD 00020000
-#define HUPCL 00040000
-
-#define CLOCAL 00100000
+#include <bits/termios-c_cflag.h>
 
 /* c_lflag bits */
 #define ISIG 0x00000080
diff --git a/sysdeps/unix/sysv/linux/bits/termios-c_cflag.h b/sysdeps/unix/sysv/linux/bits/termios-c_cflag.h
new file mode 100644
index 0000000000..605a830498
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/bits/termios-c_cflag.h
@@ -0,0 +1,34 @@
+/* termios control mode definitions.  Linux/generic version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios-c_cflag.h> directly; use <termios.h> instead."
+#endif
+
+/* c_cflag bits.  */
+#define CSIZE 0000060
+#define   CS5 0000000
+#define   CS6 0000020
+#define   CS7 0000040
+#define   CS8 0000060
+#define CSTOPB 0000100
+#define CREAD 0000200
+#define PARENB 0000400
+#define PARODD 0001000
+#define HUPCL 0002000
+#define CLOCAL 0004000
diff --git a/sysdeps/unix/sysv/linux/bits/termios.h b/sysdeps/unix/sysv/linux/bits/termios.h
index 07ffdf9779..8ead02e00a 100644
--- a/sysdeps/unix/sysv/linux/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/bits/termios.h
@@ -52,17 +52,7 @@ typedef unsigned int tcflag_t;
 #endif
 #include <bits/termios-baud.h>
 
-#define CSIZE 0000060
-#define   CS5 0000000
-#define   CS6 0000020
-#define   CS7 0000040
-#define   CS8 0000060
-#define CSTOPB 0000100
-#define CREAD 0000200
-#define PARENB 0000400
-#define PARODD 0001000
-#define HUPCL 0002000
-#define CLOCAL 0004000
+#include <bits/termios-c_cflag.h>
 
 /* c_lflag bits */
 #define ISIG 0000001
diff --git a/sysdeps/unix/sysv/linux/mips/bits/termios.h b/sysdeps/unix/sysv/linux/mips/bits/termios.h
index 008527577f..b846099b09 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/termios.h
@@ -52,17 +52,7 @@ typedef unsigned int tcflag_t;
 #endif
 #include <bits/termios-baud.h>
 
-#define CSIZE 0000060 /* Number of bits per byte (mask).  */
-#define   CS5 0000000 /* 5 bits per byte.  */
-#define   CS6 0000020 /* 6 bits per byte.  */
-#define   CS7 0000040 /* 7 bits per byte.  */
-#define   CS8 0000060 /* 8 bits per byte.  */
-#define CSTOPB 0000100 /* Two stop bits instead of one.  */
-#define CREAD 0000200 /* Enable receiver.  */
-#define PARENB 0000400 /* Parity enable.  */
-#define PARODD 0001000 /* Odd parity instead of even.  */
-#define HUPCL 0002000 /* Hang up on last close.  */
-#define CLOCAL 0004000 /* Ignore modem status lines.  */
+#include <bits/termios-c_cflag.h>
 
 /* c_lflag bits */
 #define ISIG 0000001 /* Enable signals.  */
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/termios-c_cflag.h b/sysdeps/unix/sysv/linux/powerpc/bits/termios-c_cflag.h
new file mode 100644
index 0000000000..0f33de096e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/termios-c_cflag.h
@@ -0,0 +1,35 @@
+/* termios control mode definitions.  Linux/powerpc version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios-c_cflag.h> directly; use <termios.h> instead."
+#endif
+
+#define CSIZE 00001400
+#define   CS5 00000000
+#define   CS6 00000400
+#define   CS7 00001000
+#define   CS8 00001400
+
+#define CSTOPB 00002000
+#define CREAD 00004000
+#define PARENB 00010000
+#define PARODD 00020000
+#define HUPCL 00040000
+
+#define CLOCAL 00100000
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
index 2f928d5217..d49a882ed9 100644
--- a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
@@ -51,19 +51,7 @@ typedef unsigned int tcflag_t;
 #endif
 #include <bits/termios-baud.h>
 
-#define CSIZE 00001400
-#define   CS5 00000000
-#define   CS6 00000400
-#define   CS7 00001000
-#define   CS8 00001400
-
-#define CSTOPB 00002000
-#define CREAD 00004000
-#define PARENB 00010000
-#define PARODD 00020000
-#define HUPCL 00040000
-
-#define CLOCAL 00100000
+#include <bits/termios-c_cflag.h>
 
 /* c_lflag bits */
 #define ISIG 0x00000080
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/termios.h b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
index d612080754..31d588caeb 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
@@ -52,17 +52,7 @@ typedef unsigned int tcflag_t;
 #endif
 #include <bits/termios-baud.h>
 
-#define  CSIZE  0x00000030
-#define   CS5 0x00000000
-#define   CS6 0x00000010
-#define   CS7 0x00000020
-#define   CS8 0x00000030
-#define CSTOPB 0x00000040
-#define CREAD 0x00000080
-#define PARENB 0x00000100
-#define PARODD 0x00000200
-#define HUPCL 0x00000400
-#define CLOCAL 0x00000800
+#include <bits/termios-c_cflag.h>
 
 /* c_lflag bits */
 #define ISIG 0x00000001
--
2.17.1

Reply | Threaded
Open this post in threaded view
|

[PATCH 08/12] termios: Consolidate local mode definitions

Adhemerval Zanella-2
In reply to this post by Adhemerval Zanella-2
This patch consolidates the termios symbolic constants used for local
mode with c_lflag member on its own header.  The Linux generic implementation
values match the kernel UAPI and each architecture with deviate values
have their own implementation (in this case alpha, mips, and powerpc).

No semantic change is expected, checked on a build against x86_64-linux-gnu,
alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.

        * sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
        termios-c_lflag.h.
        * sysdeps/unix/sysv/linux/bits/termios-c_lflag.h: New file.
        * sysdeps/unix/sysv/linux/alpha/bits/termios-c_lflag.h: Likewise.
        * sysdeps/unix/sysv/linux/mips/bits/termios-c_lflag.h: Likewise.
        * sysdeps/unix/sysv/linux/powerpc/bits/termios-c_lflag.h: Likewise.
        * sysdeps/unix/sysv/linux/bits/termios.h (ISIG, ISCANON, ECHO, ECHOE,
        ECHOK, ECHONL, NOFLSH, TOSTOP, IEXTEN): Move to termios-c_lflag.h.
        [__USE_MISC || (__USE_XOPEN && !__USE_XOPEN2K)] (XCASE): Likewise.
        [__USE_MISC] (ECHOCTL, ECHOPRT, ECHOKE, FLUSHO, PENDIN, EXTPROC):
        Likewise.
        * sysdeps/unix/sysv/linux/alpha/bits/termios.h: Likewise.
        * sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise.
        * sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise.
        * sysdeps/unix/sysv/linux/sparc/bits/termios.h: Likewise.
---
 sysdeps/unix/sysv/linux/Makefile              |  3 +-
 .../sysv/linux/alpha/bits/termios-c_lflag.h   | 42 ++++++++++++++
 sysdeps/unix/sysv/linux/alpha/bits/termios.h  | 22 +------
 .../unix/sysv/linux/bits/termios-c_lflag.h    | 58 +++++++++++++++++++
 sysdeps/unix/sysv/linux/bits/termios.h        | 25 +-------
 .../sysv/linux/mips/bits/termios-c_lflag.h    | 46 +++++++++++++++
 sysdeps/unix/sysv/linux/mips/bits/termios.h   | 26 +--------
 .../sysv/linux/powerpc/bits/termios-c_lflag.h | 45 ++++++++++++++
 .../unix/sysv/linux/powerpc/bits/termios.h    | 25 +-------
 sysdeps/unix/sysv/linux/sparc/bits/termios.h  | 26 +--------
 10 files changed, 198 insertions(+), 120 deletions(-)
 create mode 100644 sysdeps/unix/sysv/linux/alpha/bits/termios-c_lflag.h
 create mode 100644 sysdeps/unix/sysv/linux/bits/termios-c_lflag.h
 create mode 100644 sysdeps/unix/sysv/linux/mips/bits/termios-c_lflag.h
 create mode 100644 sysdeps/unix/sysv/linux/powerpc/bits/termios-c_lflag.h

diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 11a497e8e9..52a2e1aaf8 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -45,7 +45,8 @@ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
   bits/procfs-prregset.h bits/mman-map-flags-generic.h \
   bits/msq-pad.h bits/termios-struct.h bits/termios-c_cc.h \
   bits/termios-c_iflag.h bits/termios-c_oflag.h \
-  bits/termios-baud.h bits/termios-c_cflag.h
+  bits/termios-baud.h bits/termios-c_cflag.h \
+  bits/termios-c_lflag.h
 
 tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \
  tst-quota tst-sync_file_range tst-sysconf-iov_max tst-ttyname \
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/termios-c_lflag.h b/sysdeps/unix/sysv/linux/alpha/bits/termios-c_lflag.h
new file mode 100644
index 0000000000..c1424bb317
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/bits/termios-c_lflag.h
@@ -0,0 +1,42 @@
+/* termios local mode definitions.  Linux/alpha version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios-c_lflag.h> directly; use <termios.h> instead."
+#endif
+
+/* c_lflag bits */
+#define ISIG 0x00000080
+#define ICANON 0x00000100
+#if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
+# define XCASE 0x00004000
+#endif
+#define ECHO 0x00000008
+#define ECHOE 0x00000002
+#define ECHOK 0x00000004
+#define ECHONL 0x00000010
+#define NOFLSH 0x80000000
+#define TOSTOP 0x00400000
+#ifdef __USE_MISC
+# define ECHOCTL 0x00000040
+# define ECHOPRT 0x00000020
+# define ECHOKE 0x00000001
+# define FLUSHO 0x00800000
+# define PENDIN 0x20000000
+#endif
+#define IEXTEN 0x00000400
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/termios.h b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
index e0963df7fa..0d92853b9a 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
@@ -53,27 +53,7 @@ typedef unsigned int tcflag_t;
 #include <bits/termios-baud.h>
 
 #include <bits/termios-c_cflag.h>
-
-/* c_lflag bits */
-#define ISIG 0x00000080
-#define ICANON 0x00000100
-#if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
-# define XCASE 0x00004000
-#endif
-#define ECHO 0x00000008
-#define ECHOE 0x00000002
-#define ECHOK 0x00000004
-#define ECHONL 0x00000010
-#define NOFLSH 0x80000000
-#define TOSTOP 0x00400000
-#ifdef __USE_MISC
-# define ECHOCTL 0x00000040
-# define ECHOPRT 0x00000020
-# define ECHOKE 0x00000001
-# define FLUSHO 0x00800000
-# define PENDIN 0x20000000
-#endif
-#define IEXTEN 0x00000400
+#include <bits/termios-c_lflag.h>
 
 /* Values for the ACTION argument to `tcflow'.  */
 #define TCOOFF 0
diff --git a/sysdeps/unix/sysv/linux/bits/termios-c_lflag.h b/sysdeps/unix/sysv/linux/bits/termios-c_lflag.h
new file mode 100644
index 0000000000..64f9272893
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/bits/termios-c_lflag.h
@@ -0,0 +1,58 @@
+/* termios local mode definitions.  Linux/generic version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios-c_lflag.h> directly; use <termios.h> instead."
+#endif
+
+/* c_lflag bits */
+#define ISIG 0000001   /* Enable signals.  */
+#define ICANON 0000002   /* Canonical input (erase and kill processing).  */
+#if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
+# define XCASE 0000004
+#endif
+#define ECHO 0000010   /* Enable echo.  */
+#define ECHOE 0000020   /* Echo erase character as error-correcting
+     backspace.  */
+#define ECHOK 0000040   /* Echo KILL.  */
+#define ECHONL 0000100   /* Echo NL.  */
+#define NOFLSH 0000200   /* Disable flush after interrupt or quit.  */
+#define TOSTOP 0000400   /* Send SIGTTOU for background output.  */
+#ifdef __USE_MISC
+# define ECHOCTL 0001000  /* If ECHO is also set, terminal special characters
+     other than TAB, NL, START, and STOP are echoed as
+     ^X, where X is the character with ASCII code 0x40
+     greater than the special character
+     (not in POSIX).  */
+# define ECHOPRT 0002000  /* If ICANON and ECHO are also set, characters are
+     printed as they are being erased
+     (not in POSIX).  */
+# define ECHOKE 0004000  /* If ICANON is also set, KILL is echoed by erasing
+     each character on the line, as specified by ECHOE
+     and ECHOPRT (not in POSIX).  */
+# define FLUSHO 0010000  /* Output is being flushed.  This flag is toggled by
+     typing the DISCARD character (not in POSIX).  */
+# define PENDIN 0040000  /* All characters in the input queue are reprinted
+     when the next character is read
+     (not in POSIX).  */
+#endif
+#define IEXTEN 0100000   /* Enable implementation-defined input
+     processing.  */
+#ifdef __USE_MISC
+# define EXTPROC 0200000
+#endif
diff --git a/sysdeps/unix/sysv/linux/bits/termios.h b/sysdeps/unix/sysv/linux/bits/termios.h
index 8ead02e00a..5664069de9 100644
--- a/sysdeps/unix/sysv/linux/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/bits/termios.h
@@ -53,30 +53,7 @@ typedef unsigned int tcflag_t;
 #include <bits/termios-baud.h>
 
 #include <bits/termios-c_cflag.h>
-
-/* c_lflag bits */
-#define ISIG 0000001
-#define ICANON 0000002
-#if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
-# define XCASE 0000004
-#endif
-#define ECHO 0000010
-#define ECHOE 0000020
-#define ECHOK 0000040
-#define ECHONL 0000100
-#define NOFLSH 0000200
-#define TOSTOP 0000400
-#ifdef __USE_MISC
-# define ECHOCTL 0001000
-# define ECHOPRT 0002000
-# define ECHOKE 0004000
-# define FLUSHO 0010000
-# define PENDIN 0040000
-#endif
-#define IEXTEN 0100000
-#ifdef __USE_MISC
-# define EXTPROC 0200000
-#endif
+#include <bits/termios-c_lflag.h>
 
 #ifdef __USE_MISC
 /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/termios-c_lflag.h b/sysdeps/unix/sysv/linux/mips/bits/termios-c_lflag.h
new file mode 100644
index 0000000000..5a3b3db410
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/bits/termios-c_lflag.h
@@ -0,0 +1,46 @@
+/* termios local mode definitions.  Linux/mips version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios-c_lflag.h> directly; use <termios.h> instead."
+#endif
+
+/* c_lflag bits */
+#define ISIG 0000001 /* Enable signals.  */
+#define ICANON 0000002 /* Do erase and kill processing.  */
+#if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
+# define XCASE 0000004
+#endif
+#define ECHO 0000010 /* Enable echo.  */
+#define ECHOE 0000020 /* Visual erase for ERASE.  */
+#define ECHOK 0000040 /* Echo NL after KILL.  */
+#define ECHONL 0000100 /* Echo NL even if ECHO is off.  */
+#define NOFLSH 0000200 /* Disable flush after interrupt.  */
+#define IEXTEN 0000400 /* Enable DISCARD and LNEXT.  */
+#ifdef __USE_MISC
+# define ECHOCTL 0001000 /* Echo control characters as ^X.  */
+# define ECHOPRT 0002000 /* Hardcopy visual erase.  */
+# define ECHOKE 0004000 /* Visual erase for KILL.  */
+# define FLUSHO 0020000
+# define PENDIN 0040000 /* Retype pending input (state).  */
+#endif
+#define TOSTOP 0100000 /* Send SIGTTOU for background output.  */
+#define ITOSTOP TOSTOP
+#ifdef __USE_MISC
+# define EXTPROC 0200000
+#endif
diff --git a/sysdeps/unix/sysv/linux/mips/bits/termios.h b/sysdeps/unix/sysv/linux/mips/bits/termios.h
index b846099b09..26535090b3 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/termios.h
@@ -53,31 +53,7 @@ typedef unsigned int tcflag_t;
 #include <bits/termios-baud.h>
 
 #include <bits/termios-c_cflag.h>
-
-/* c_lflag bits */
-#define ISIG 0000001 /* Enable signals.  */
-#define ICANON 0000002 /* Do erase and kill processing.  */
-#if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
-# define XCASE 0000004
-#endif
-#define ECHO 0000010 /* Enable echo.  */
-#define ECHOE 0000020 /* Visual erase for ERASE.  */
-#define ECHOK 0000040 /* Echo NL after KILL.  */
-#define ECHONL 0000100 /* Echo NL even if ECHO is off.  */
-#define NOFLSH 0000200 /* Disable flush after interrupt.  */
-#define IEXTEN 0000400 /* Enable DISCARD and LNEXT.  */
-#ifdef __USE_MISC
-# define ECHOCTL 0001000 /* Echo control characters as ^X.  */
-# define ECHOPRT 0002000 /* Hardcopy visual erase.  */
-# define ECHOKE 0004000 /* Visual erase for KILL.  */
-# define FLUSHO 0020000
-# define PENDIN 0040000 /* Retype pending input (state).  */
-#endif
-#define TOSTOP 0100000 /* Send SIGTTOU for background output.  */
-#define ITOSTOP TOSTOP
-#ifdef __USE_MISC
-# define EXTPROC 0200000
-#endif
+#include <bits/termios-c_lflag.h>
 
 #ifdef __USE_MISC
 /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/termios-c_lflag.h b/sysdeps/unix/sysv/linux/powerpc/bits/termios-c_lflag.h
new file mode 100644
index 0000000000..a0ceae04f0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/termios-c_lflag.h
@@ -0,0 +1,45 @@
+/* termios local mode definitions.  Linux/powerpc version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios-c_lflag.h> directly; use <termios.h> instead."
+#endif
+
+/* c_lflag bits */
+#define ISIG 0x00000080
+#define ICANON 0x00000100
+#if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
+# define XCASE 0x00004000
+#endif
+#define ECHO 0x00000008
+#define ECHOE 0x00000002
+#define ECHOK 0x00000004
+#define ECHONL 0x00000010
+#define NOFLSH 0x80000000
+#define TOSTOP 0x00400000
+#ifdef __USE_MISC
+# define ECHOCTL 0x00000040
+# define ECHOPRT 0x00000020
+# define ECHOKE 0x00000001
+# define FLUSHO 0x00800000
+# define PENDIN 0x20000000
+#endif
+#define IEXTEN 0x00000400
+#ifdef __USE_MISC
+# define EXTPROC 0x10000000
+#endif
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
index d49a882ed9..74c6bf8352 100644
--- a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
@@ -52,30 +52,7 @@ typedef unsigned int tcflag_t;
 #include <bits/termios-baud.h>
 
 #include <bits/termios-c_cflag.h>
-
-/* c_lflag bits */
-#define ISIG 0x00000080
-#define ICANON 0x00000100
-#if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
-# define XCASE 0x00004000
-#endif
-#define ECHO 0x00000008
-#define ECHOE 0x00000002
-#define ECHOK 0x00000004
-#define ECHONL 0x00000010
-#define NOFLSH 0x80000000
-#define TOSTOP 0x00400000
-#ifdef __USE_MISC
-# define ECHOCTL 0x00000040
-# define ECHOPRT 0x00000020
-# define ECHOKE 0x00000001
-# define FLUSHO 0x00800000
-# define PENDIN 0x20000000
-#endif
-#define IEXTEN 0x00000400
-#ifdef __USE_MISC
-# define EXTPROC 0x10000000
-#endif
+#include <bits/termios-c_lflag.h>
 
 /* Values for the ACTION argument to `tcflow'.  */
 #define TCOOFF 0
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/termios.h b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
index 31d588caeb..04408ae60c 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
@@ -53,31 +53,7 @@ typedef unsigned int tcflag_t;
 #include <bits/termios-baud.h>
 
 #include <bits/termios-c_cflag.h>
-
-/* c_lflag bits */
-#define ISIG 0x00000001
-#define ICANON 0x00000002
-#if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
-# define XCASE 0x00000004
-#endif
-#define ECHO 0x00000008
-#define ECHOE 0x00000010
-#define ECHOK 0x00000020
-#define ECHONL 0x00000040
-#define NOFLSH 0x00000080
-#define TOSTOP 0x00000100
-#ifdef __USE_MISC
-# define ECHOCTL 0x00000200
-# define ECHOPRT 0x00000400
-# define ECHOKE 0x00000800
-# define DEFECHO 0x00001000 /* SUNOS thing, what is it? */
-# define FLUSHO 0x00002000
-# define PENDIN 0x00004000
-#endif
-#define IEXTEN 0x00008000
-#ifdef __USE_MISC
-# define EXTPROC 0x00010000
-#endif
+#include <bits/termios-c_lflag.h>
 
 #ifdef __USE_MISC
 /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
--
2.17.1

Reply | Threaded
Open this post in threaded view
|

[PATCH 09/12] termios: Consolidate tcflow symbolic constants

Adhemerval Zanella-2
In reply to this post by Adhemerval Zanella-2
This patch consolidates the termios symbolic constants for use with tcflow
on a its own header.  The Linux generic implementation values match the
kernel UAPI and each architecture with deviate values have their own
implementation (currently only mips).

No semantic change is expected, checked on a build against x86_64-linux-gnu,
alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.

        * sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
        termios-tcflow.h.
        * sysdeps/unix/sysv/linux/bits/termios-tcflow.h: New file.
        * sysdeps/unix/sysv/linux/mips/bits/termios-tcflow.h: Likewise.
        * sysdeps/unix/sysv/linux/bits/termios.h (TCSANOW, TCSADRAIN,
        TCSAFLUSH): Move to termios-tcflow.h.
        * sysdeps/unix/sysv/linux/alpha/bits/termios.h: Likewise.
        * sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise.
        * sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise.
        * sysdeps/unix/sysv/linux/sparc/bits/termios.h: Likewise.
---
 sysdeps/unix/sysv/linux/Makefile              |  2 +-
 sysdeps/unix/sysv/linux/alpha/bits/termios.h  |  6 +----
 sysdeps/unix/sysv/linux/bits/termios-tcflow.h | 26 +++++++++++++++++++
 sysdeps/unix/sysv/linux/bits/termios.h        |  6 +----
 .../sysv/linux/mips/bits/termios-tcflow.h     | 26 +++++++++++++++++++
 sysdeps/unix/sysv/linux/mips/bits/termios.h   |  5 +---
 .../unix/sysv/linux/powerpc/bits/termios.h    |  5 +---
 sysdeps/unix/sysv/linux/sparc/bits/termios.h  |  5 +---
 8 files changed, 58 insertions(+), 23 deletions(-)
 create mode 100644 sysdeps/unix/sysv/linux/bits/termios-tcflow.h
 create mode 100644 sysdeps/unix/sysv/linux/mips/bits/termios-tcflow.h

diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 52a2e1aaf8..e3035250c9 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -46,7 +46,7 @@ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
   bits/msq-pad.h bits/termios-struct.h bits/termios-c_cc.h \
   bits/termios-c_iflag.h bits/termios-c_oflag.h \
   bits/termios-baud.h bits/termios-c_cflag.h \
-  bits/termios-c_lflag.h
+  bits/termios-c_lflag.h bits/termios-tcflow.h
 
 tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \
  tst-quota tst-sync_file_range tst-sysconf-iov_max tst-ttyname \
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/termios.h b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
index 0d92853b9a..66b84f26c7 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
@@ -66,11 +66,7 @@ typedef unsigned int tcflag_t;
 #define TCOFLUSH 1
 #define TCIOFLUSH 2
 
-/* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'.  */
-#define TCSANOW 0
-#define TCSADRAIN 1
-#define TCSAFLUSH 2
-
+#include <bits/termios-tcflow.h>
 
 #define _IOT_termios /* Hurd ioctl type field.  */ \
   _IOT (_IOTS (cflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2)
diff --git a/sysdeps/unix/sysv/linux/bits/termios-tcflow.h b/sysdeps/unix/sysv/linux/bits/termios-tcflow.h
new file mode 100644
index 0000000000..8b7489b79b
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/bits/termios-tcflow.h
@@ -0,0 +1,26 @@
+/* termios tcflag symbolic contants definitions.  Linux/generic version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios-tcflow.h> directly; use <termios.h> instead."
+#endif
+
+/* tcsetattr uses these.  */
+#define TCSANOW 0
+#define TCSADRAIN 1
+#define TCSAFLUSH 2
diff --git a/sysdeps/unix/sysv/linux/bits/termios.h b/sysdeps/unix/sysv/linux/bits/termios.h
index 5664069de9..b0263dfa71 100644
--- a/sysdeps/unix/sysv/linux/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/bits/termios.h
@@ -71,11 +71,7 @@ typedef unsigned int tcflag_t;
 #define TCOFLUSH 1
 #define TCIOFLUSH 2
 
-/* tcsetattr uses these */
-#define TCSANOW 0
-#define TCSADRAIN 1
-#define TCSAFLUSH 2
-
+#include <bits/termios-tcflow.h>
 
 #define _IOT_termios /* Hurd ioctl type field.  */ \
   _IOT (_IOTS (cflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2)
diff --git a/sysdeps/unix/sysv/linux/mips/bits/termios-tcflow.h b/sysdeps/unix/sysv/linux/mips/bits/termios-tcflow.h
new file mode 100644
index 0000000000..c0a69b4ef7
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/mips/bits/termios-tcflow.h
@@ -0,0 +1,26 @@
+/* termios local mode definitions.  Linux/mips version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios-tcflow.h> directly; use <termios.h> instead."
+#endif
+
+/* tcsetattr uses these */
+#define TCSANOW 0x540e /* Same as TCSETS; change immediately.  */
+#define TCSADRAIN 0x540f /* Same as TCSETSW; change when pending output is written.  */
+#define TCSAFLUSH 0x5410 /* Same as TCSETSF; flush pending input before changing.  */
diff --git a/sysdeps/unix/sysv/linux/mips/bits/termios.h b/sysdeps/unix/sysv/linux/mips/bits/termios.h
index 26535090b3..ca4f106855 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/termios.h
@@ -71,10 +71,7 @@ typedef unsigned int tcflag_t;
 #define TCOFLUSH 1 /* Discard data written but not yet sent.  */
 #define TCIOFLUSH 2 /* Discard all pending data.  */
 
-/* tcsetattr uses these */
-#define TCSANOW 0x540e /* Same as TCSETS; change immediately.  */
-#define TCSADRAIN 0x540f /* Same as TCSETSW; change when pending output is written.  */
-#define TCSAFLUSH 0x5410 /* Same as TCSETSF; flush pending input before changing.  */
+#include <bits/termios-tcflow.h>
 
 #define _IOT_termios /* Hurd ioctl type field.  */ \
   _IOT (_IOTS (cflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2)
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
index 74c6bf8352..885bf952bd 100644
--- a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
@@ -65,10 +65,7 @@ typedef unsigned int tcflag_t;
 #define TCOFLUSH 1
 #define TCIOFLUSH 2
 
-/* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'.  */
-#define TCSANOW 0
-#define TCSADRAIN 1
-#define TCSAFLUSH 2
+#include <bits/termios-tcflow.h>
 
 #ifdef __USE_MISC
 
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/termios.h b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
index 04408ae60c..fbf4df4335 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
@@ -71,7 +71,4 @@ typedef unsigned int tcflag_t;
 #define TCOFLUSH 1
 #define TCIOFLUSH 2
 
-/* tcsetattr uses these */
-#define TCSANOW 0
-#define TCSADRAIN 1
-#define TCSAFLUSH 2
+#include <bits/termios-tcflow.h>
--
2.17.1

Reply | Threaded
Open this post in threaded view
|

[PATCH 10/12] termios: Remove Linux _IOT_termios

Adhemerval Zanella-2
In reply to this post by Adhemerval Zanella-2
It is used only on hurd.

No semantic change is expected, checked on a build against x86_64-linux-gnu,
alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.

        * sysdeps/unix/sysv/linux/bits/termios.h (_IOT_termios): Remove.
        * sysdeps/unix/sysv/linux/alpha/bits/termios.h: Likewise.
        * sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise.
---
 sysdeps/unix/sysv/linux/alpha/bits/termios.h | 3 ---
 sysdeps/unix/sysv/linux/bits/termios.h       | 3 ---
 sysdeps/unix/sysv/linux/mips/bits/termios.h  | 3 ---
 3 files changed, 9 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/alpha/bits/termios.h b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
index 66b84f26c7..1824b3d8e7 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
@@ -67,6 +67,3 @@ typedef unsigned int tcflag_t;
 #define TCIOFLUSH 2
 
 #include <bits/termios-tcflow.h>
-
-#define _IOT_termios /* Hurd ioctl type field.  */ \
-  _IOT (_IOTS (cflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2)
diff --git a/sysdeps/unix/sysv/linux/bits/termios.h b/sysdeps/unix/sysv/linux/bits/termios.h
index b0263dfa71..1d47729945 100644
--- a/sysdeps/unix/sysv/linux/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/bits/termios.h
@@ -72,6 +72,3 @@ typedef unsigned int tcflag_t;
 #define TCIOFLUSH 2
 
 #include <bits/termios-tcflow.h>
-
-#define _IOT_termios /* Hurd ioctl type field.  */ \
-  _IOT (_IOTS (cflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2)
diff --git a/sysdeps/unix/sysv/linux/mips/bits/termios.h b/sysdeps/unix/sysv/linux/mips/bits/termios.h
index ca4f106855..3b015432c0 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/termios.h
@@ -72,6 +72,3 @@ typedef unsigned int tcflag_t;
 #define TCIOFLUSH 2 /* Discard all pending data.  */
 
 #include <bits/termios-tcflow.h>
-
-#define _IOT_termios /* Hurd ioctl type field.  */ \
-  _IOT (_IOTS (cflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2)
--
2.17.1

Reply | Threaded
Open this post in threaded view
|

[PATCH 11/12] termios: Add powerpc termios-misc

Adhemerval Zanella-2
In reply to this post by Adhemerval Zanella-2
PowerPC termios.h header contains additional BSD terminal mode definitions
(sgttyb, tchars, ltchars, and associated TIOCPKT_* symbolic constants).
This patch moves all powerpc termios specific definition to its own header.

No semantic change is expected, checked on a build against a
powerpc64le-linux-gnu build.

        * sysdeps/unix/sysv/linux/powerpc/bits/termios-misc.h: New file.
        * sysdeps/unix/sysv/linux/powerpc/bits/termios.h [__USE_MISC]
        (struct sgtty, struct tchars, struct ltchars, TIOCPKT_DATA,
        TIOCPKT_FLUSHREAD, TIOCPKT_FLUSHWRITE, TIOCPKT_STOP, TIOCPKT_START,
        TIOCPKT_NOSTOP, TIOCPKT_DOSTOP, _VINTR, _VQUIT, _VERASE, _VKILL,
        _VEOF, _VMIN, _VEOL, _VTIME, _VEOL2, _VSWTC): Move to
        termios-misc.h.
        * sysdeps/unix/sysv/linux/powerpc/Makefile [$subdir == misc]
        (sysdep_headers): Add termios-misc.h.
---
 sysdeps/unix/sysv/linux/powerpc/Makefile      |  2 +-
 .../sysv/linux/powerpc/bits/termios-misc.h    | 72 +++++++++++++++++++
 .../unix/sysv/linux/powerpc/bits/termios.h    | 50 +------------
 3 files changed, 74 insertions(+), 50 deletions(-)
 create mode 100644 sysdeps/unix/sysv/linux/powerpc/bits/termios-misc.h

diff --git a/sysdeps/unix/sysv/linux/powerpc/Makefile b/sysdeps/unix/sysv/linux/powerpc/Makefile
index 19ac59d862..7712428e10 100644
--- a/sysdeps/unix/sysv/linux/powerpc/Makefile
+++ b/sysdeps/unix/sysv/linux/powerpc/Makefile
@@ -23,7 +23,7 @@ LDFLAGS-tst-tlsmod2.so += -Wl,--no-tls-get-addr-optimize
 endif
 
 ifeq ($(subdir),misc)
-sysdep_headers += bits/ppc.h
+sysdep_headers += bits/ppc.h bits/termios-misc.h
 sysdep_routines += get_timebase_freq
 tests += test-gettimebasefreq
 tests += test-powerpc-linux-sysconf
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/termios-misc.h b/sysdeps/unix/sysv/linux/powerpc/bits/termios-misc.h
new file mode 100644
index 0000000000..2e7fc2f7ae
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/termios-misc.h
@@ -0,0 +1,72 @@
+/* termios baud platform specific definitions.  Linux/powerpc version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios-misc.h> directly; use <termios.h> instead."
+#endif
+
+#ifdef __USE_MISC
+
+struct sgttyb {
+ char sg_ispeed;
+ char sg_ospeed;
+ char sg_erase;
+ char sg_kill;
+ short sg_flags;
+};
+
+struct tchars {
+ char t_intrc;
+ char t_quitc;
+ char t_startc;
+ char t_stopc;
+ char t_eofc;
+ char t_brkc;
+};
+
+struct ltchars {
+ char t_suspc;
+ char t_dsuspc;
+ char t_rprntc;
+ char t_flushc;
+ char t_werasc;
+ char t_lnextc;
+};
+
+/* Used for packet mode */
+#define TIOCPKT_DATA 0
+#define TIOCPKT_FLUSHREAD 1
+#define TIOCPKT_FLUSHWRITE 2
+#define TIOCPKT_STOP 4
+#define TIOCPKT_START 8
+#define TIOCPKT_NOSTOP 16
+#define TIOCPKT_DOSTOP 32
+
+/* c_cc characters */
+#define _VINTR 0
+#define _VQUIT 1
+#define _VERASE 2
+#define _VKILL 3
+#define _VEOF 4
+#define _VMIN 5
+#define _VEOL 6
+#define _VTIME 7
+#define _VEOL2 8
+#define _VSWTC 9
+
+#endif /* __USE_MISC  */
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
index 885bf952bd..4f00b4fe0c 100644
--- a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
@@ -67,58 +67,10 @@ typedef unsigned int tcflag_t;
 
 #include <bits/termios-tcflow.h>
 
-#ifdef __USE_MISC
-
-struct sgttyb {
- char sg_ispeed;
- char sg_ospeed;
- char sg_erase;
- char sg_kill;
- short sg_flags;
-};
-
-struct tchars {
- char t_intrc;
- char t_quitc;
- char t_startc;
- char t_stopc;
- char t_eofc;
- char t_brkc;
-};
-
-struct ltchars {
- char t_suspc;
- char t_dsuspc;
- char t_rprntc;
- char t_flushc;
- char t_werasc;
- char t_lnextc;
-};
-
-/* Used for packet mode */
-#define TIOCPKT_DATA 0
-#define TIOCPKT_FLUSHREAD 1
-#define TIOCPKT_FLUSHWRITE 2
-#define TIOCPKT_STOP 4
-#define TIOCPKT_START 8
-#define TIOCPKT_NOSTOP 16
-#define TIOCPKT_DOSTOP 32
-
-/* c_cc characters */
-#define _VINTR 0
-#define _VQUIT 1
-#define _VERASE 2
-#define _VKILL 3
-#define _VEOF 4
-#define _VMIN 5
-#define _VEOL 6
-#define _VTIME 7
-#define _VEOL2 8
-#define _VSWTC 9
+#include <bits/termios-misc.h>
 
 #ifdef __USE_MISC
 /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
 # define TIOCSER_TEMT    0x01 /* Transmitter physically empty */
 #endif
 
-#endif /* __USE_MISC  */
--
2.17.1

Reply | Threaded
Open this post in threaded view
|

[PATCH 12/12] termios: Consolidate termios.h

Adhemerval Zanella-2
In reply to this post by Adhemerval Zanella-2
This patch consolidates the Linux termios.h by removing the arch-specific
one.

No semantic change is expected, checked on a build against x86_64-linux-gnu,
alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.

        * sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
        bits/termios-misc.h.
        * sysdeps/unix/sysv/linux/alpha/bits/termios.h: Remove file.
        * sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise.
        * sysdeps/unix/sysv/linux/sparc/bits/termios.h: Likewise.
        * sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise.
        * sysdeps/unix/sysv/linux/bits/termios-misc.h: New file.
        * sysdeps/unix/sysv/linux/bits/termios.h: Include termios-misc.h.
---
 sysdeps/unix/sysv/linux/Makefile              |  3 +-
 sysdeps/unix/sysv/linux/alpha/bits/termios.h  | 69 -----------------
 sysdeps/unix/sysv/linux/bits/termios-misc.h   | 21 +++++
 sysdeps/unix/sysv/linux/bits/termios.h        |  2 +
 sysdeps/unix/sysv/linux/mips/bits/termios.h   | 74 ------------------
 sysdeps/unix/sysv/linux/powerpc/Makefile      |  2 +-
 .../unix/sysv/linux/powerpc/bits/termios.h    | 76 -------------------
 sysdeps/unix/sysv/linux/sparc/bits/termios.h  | 74 ------------------
 8 files changed, 26 insertions(+), 295 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/alpha/bits/termios.h
 create mode 100644 sysdeps/unix/sysv/linux/bits/termios-misc.h
 delete mode 100644 sysdeps/unix/sysv/linux/mips/bits/termios.h
 delete mode 100644 sysdeps/unix/sysv/linux/powerpc/bits/termios.h
 delete mode 100644 sysdeps/unix/sysv/linux/sparc/bits/termios.h

diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index e3035250c9..08fd74479b 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -46,7 +46,8 @@ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
   bits/msq-pad.h bits/termios-struct.h bits/termios-c_cc.h \
   bits/termios-c_iflag.h bits/termios-c_oflag.h \
   bits/termios-baud.h bits/termios-c_cflag.h \
-  bits/termios-c_lflag.h bits/termios-tcflow.h
+  bits/termios-c_lflag.h bits/termios-tcflow.h \
+  bits/termios-misc.h
 
 tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \
  tst-quota tst-sync_file_range tst-sysconf-iov_max tst-ttyname \
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/termios.h b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
deleted file mode 100644
index 1824b3d8e7..0000000000
--- a/sysdeps/unix/sysv/linux/alpha/bits/termios.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* termios type and macro definitions.  Linux version.
-   Copyright (C) 1993-2018 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library.  If not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#ifndef _TERMIOS_H
-# error "Never include <bits/termios.h> directly; use <termios.h> instead."
-#endif
-
-typedef unsigned char cc_t;
-typedef unsigned int speed_t;
-typedef unsigned int tcflag_t;
-
-#include <bits/termios-struct.h>
-#include <bits/termios-c_cc.h>
-#include <bits/termios-c_iflag.h>
-#include <bits/termios-c_oflag.h>
-
-/* c_cflag bit meaning */
-#define  B0 0000000 /* hang up */
-#define  B50 0000001
-#define  B75 0000002
-#define  B110 0000003
-#define  B134 0000004
-#define  B150 0000005
-#define  B200 0000006
-#define  B300 0000007
-#define  B600 0000010
-#define  B1200 0000011
-#define  B1800 0000012
-#define  B2400 0000013
-#define  B4800 0000014
-#define  B9600 0000015
-#define  B19200 0000016
-#define  B38400 0000017
-#ifdef __USE_MISC
-# define EXTA B19200
-# define EXTB B38400
-#endif
-#include <bits/termios-baud.h>
-
-#include <bits/termios-c_cflag.h>
-#include <bits/termios-c_lflag.h>
-
-/* Values for the ACTION argument to `tcflow'.  */
-#define TCOOFF 0
-#define TCOON 1
-#define TCIOFF 2
-#define TCION 3
-
-/* Values for the QUEUE_SELECTOR argument to `tcflush'.  */
-#define TCIFLUSH 0
-#define TCOFLUSH 1
-#define TCIOFLUSH 2
-
-#include <bits/termios-tcflow.h>
diff --git a/sysdeps/unix/sysv/linux/bits/termios-misc.h b/sysdeps/unix/sysv/linux/bits/termios-misc.h
new file mode 100644
index 0000000000..83bdec342e
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/bits/termios-misc.h
@@ -0,0 +1,21 @@
+/* termios baud platform specific definitions.  Linux/generic version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library.  If not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _TERMIOS_H
+# error "Never include <bits/termios-misc.h> directly; use <termios.h> instead."
+#endif
diff --git a/sysdeps/unix/sysv/linux/bits/termios.h b/sysdeps/unix/sysv/linux/bits/termios.h
index 1d47729945..41a7c53322 100644
--- a/sysdeps/unix/sysv/linux/bits/termios.h
+++ b/sysdeps/unix/sysv/linux/bits/termios.h
@@ -72,3 +72,5 @@ typedef unsigned int tcflag_t;
 #define TCIOFLUSH 2
 
 #include <bits/termios-tcflow.h>
+
+#include <bits/termios-misc.h>
diff --git a/sysdeps/unix/sysv/linux/mips/bits/termios.h b/sysdeps/unix/sysv/linux/mips/bits/termios.h
deleted file mode 100644
index 3b015432c0..0000000000
--- a/sysdeps/unix/sysv/linux/mips/bits/termios.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* termios type and macro definitions.  Linux/MIPS version.
-   Copyright (C) 1993-2018 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library.  If not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#ifndef _TERMIOS_H
-# error "Never include <bits/termios.h> directly; use <termios.h> instead."
-#endif
-
-typedef unsigned char cc_t;
-typedef unsigned int speed_t;
-typedef unsigned int tcflag_t;
-
-#include <bits/termios-struct.h>
-#include <bits/termios-c_cc.h>
-#include <bits/termios-c_iflag.h>
-#include <bits/termios-c_oflag.h>
-
-/* c_cflag bit meaning */
-#define  B0 0000000 /* hang up */
-#define  B50 0000001
-#define  B75 0000002
-#define  B110 0000003
-#define  B134 0000004
-#define  B150 0000005
-#define  B200 0000006
-#define  B300 0000007
-#define  B600 0000010
-#define  B1200 0000011
-#define  B1800 0000012
-#define  B2400 0000013
-#define  B4800 0000014
-#define  B9600 0000015
-#define  B19200 0000016
-#define  B38400 0000017
-#ifdef __USE_MISC
-# define EXTA B19200
-# define EXTB B38400
-#endif
-#include <bits/termios-baud.h>
-
-#include <bits/termios-c_cflag.h>
-#include <bits/termios-c_lflag.h>
-
-#ifdef __USE_MISC
-/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
-# define TIOCSER_TEMT    0x01 /* Transmitter physically empty */
-#endif
-
-/* tcflow() and TCXONC use these */
-#define TCOOFF 0 /* Suspend output.  */
-#define TCOON 1 /* Restart suspended output.  */
-#define TCIOFF 2 /* Send a STOP character.  */
-#define TCION 3 /* Send a START character.  */
-
-/* tcflush() and TCFLSH use these */
-#define TCIFLUSH 0 /* Discard data received but not yet read.  */
-#define TCOFLUSH 1 /* Discard data written but not yet sent.  */
-#define TCIOFLUSH 2 /* Discard all pending data.  */
-
-#include <bits/termios-tcflow.h>
diff --git a/sysdeps/unix/sysv/linux/powerpc/Makefile b/sysdeps/unix/sysv/linux/powerpc/Makefile
index 7712428e10..19ac59d862 100644
--- a/sysdeps/unix/sysv/linux/powerpc/Makefile
+++ b/sysdeps/unix/sysv/linux/powerpc/Makefile
@@ -23,7 +23,7 @@ LDFLAGS-tst-tlsmod2.so += -Wl,--no-tls-get-addr-optimize
 endif
 
 ifeq ($(subdir),misc)
-sysdep_headers += bits/ppc.h bits/termios-misc.h
+sysdep_headers += bits/ppc.h
 sysdep_routines += get_timebase_freq
 tests += test-gettimebasefreq
 tests += test-powerpc-linux-sysconf
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
deleted file mode 100644
index 4f00b4fe0c..0000000000
--- a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Copyright (C) 1997-2018 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#ifndef _TERMIOS_H
-# error "Never include <bits/termios.h> directly; use <termios.h> instead."
-#endif
-
-typedef unsigned char cc_t;
-typedef unsigned int speed_t;
-typedef unsigned int tcflag_t;
-
-#include <bits/termios-struct.h>
-#include <bits/termios-c_cc.h>
-#include <bits/termios-c_iflag.h>
-#include <bits/termios-c_oflag.h>
-
-/* c_cflag bit meaning */
-#define  B0 0000000 /* hang up */
-#define  B50 0000001
-#define  B75 0000002
-#define  B110 0000003
-#define  B134 0000004
-#define  B150 0000005
-#define  B200 0000006
-#define  B300 0000007
-#define  B600 0000010
-#define  B1200 0000011
-#define  B1800 0000012
-#define  B2400 0000013
-#define  B4800 0000014
-#define  B9600 0000015
-#define  B19200 0000016
-#define  B38400 0000017
-#ifdef __USE_MISC
-# define EXTA B19200
-# define EXTB B38400
-#endif
-#include <bits/termios-baud.h>
-
-#include <bits/termios-c_cflag.h>
-#include <bits/termios-c_lflag.h>
-
-/* Values for the ACTION argument to `tcflow'.  */
-#define TCOOFF 0
-#define TCOON 1
-#define TCIOFF 2
-#define TCION 3
-
-/* Values for the QUEUE_SELECTOR argument to `tcflush'.  */
-#define TCIFLUSH 0
-#define TCOFLUSH 1
-#define TCIOFLUSH 2
-
-#include <bits/termios-tcflow.h>
-
-#include <bits/termios-misc.h>
-
-#ifdef __USE_MISC
-/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
-# define TIOCSER_TEMT    0x01 /* Transmitter physically empty */
-#endif
-
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/termios.h b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
deleted file mode 100644
index fbf4df4335..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/bits/termios.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* termios type and macro definitions.  Linux/SPARC version.
-   Copyright (C) 1993-2018 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#ifndef _TERMIOS_H
-# error "Never include <bits/termios.h> directly; use <termios.h> instead."
-#endif
-
-typedef unsigned char cc_t;
-typedef unsigned int speed_t;
-typedef unsigned int tcflag_t;
-
-#include <bits/termios-struct.h>
-#include <bits/termios-c_cc.h>
-#include <bits/termios-c_iflag.h>
-#include <bits/termios-c_oflag.h>
-
-/* c_cflag bit meaning */
-#define  B0 0x00000000 /* hang up */
-#define  B50 0x00000001
-#define  B75 0x00000002
-#define  B110 0x00000003
-#define  B134 0x00000004
-#define  B150 0x00000005
-#define  B200 0x00000006
-#define  B300 0x00000007
-#define  B600 0x00000008
-#define  B1200 0x00000009
-#define  B1800 0x0000000a
-#define  B2400 0x0000000b
-#define  B4800 0x0000000c
-#define  B9600 0x0000000d
-#define  B19200 0x0000000e
-#define  B38400 0x0000000f
-#ifdef __USE_MISC
-# define EXTA    B19200
-# define EXTB    B38400
-#endif
-#include <bits/termios-baud.h>
-
-#include <bits/termios-c_cflag.h>
-#include <bits/termios-c_lflag.h>
-
-#ifdef __USE_MISC
-/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
-# define TIOCSER_TEMT    0x01 /* Transmitter physically empty */
-#endif
-
-/* tcflow() and TCXONC use these */
-#define TCOOFF 0
-#define TCOON 1
-#define TCIOFF 2
-#define TCION 3
-
-/* tcflush() and TCFLSH use these */
-#define TCIFLUSH 0
-#define TCOFLUSH 1
-#define TCIOFLUSH 2
-
-#include <bits/termios-tcflow.h>
--
2.17.1

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 06/12] termios: Consolidate Baud Rate Selection definitions

Adhemerval Zanella-2
In reply to this post by Adhemerval Zanella-2
On 15/10/2018 17:49, Adhemerval Zanella wrote:

> This patch consolidates the termios symbolic constants used for baud rates
> selection used along with speed_t on its own header.  The Linux generic
> implementation values match the kernel UAPI and each architecture with
> deviate values have their own implementation (in this case alpha and
> powerpc).
>
> No semantic change is expected, checked on a build against x86_64-linux-gnu,
> alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.
>
> * sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
> termios-baud.h.
> * sysdeps/unix/sysv/linux/bits/termios-baud.h: New file.
> * sysdeps/unix/sysv/linux/alpha/bits/termios-baud.h: Likewise.
> * sysdeps/unix/sysv/linux/powerpc/bits/termios-baud.h: Likewise.
> * sysdeps/unix/sysv/linux/alpha/bits/termios.h (B57600, B115200,
> B230400, B460800, B500000, B576000, B921600, B1000000, B1152000,
> B1500000, B2000000, B2500000, B3000000, B3500000, B4000000,
> __MAX_BAUD): Move to termios-baud.h.
> [__USE_MISC] (CBAUD, CBAUDEX): Likewise.
> * sysdeps/unix/sysv/linux/bits/termios.h: Likewise.
> * sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise.
> * sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise.
> * sysdeps/unix/sysv/linux/sparc/bits/termios.h: Likewise.

Now that CMSPAR is defined in Linux generic termios-baud, it also
fixes BZ#23783.
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 01/12] termios: Define TIOCSER_TEMT with __USE_MISC (BZ#17783)

Adhemerval Zanella-2
In reply to this post by Adhemerval Zanella-2
Ping.

On 15/10/2018 17:49, Adhemerval Zanella wrote:

> This patch defines TIOCSER_TEMT on all architectures using the __USE_MISC
> guards similar to BZ#17782 fix.  Latest Linux UAPI defines TIOCSER_TEMT
> with the same value for all architectures, so it is safe to use the value
> as default for all ABIs.
>
> Checked on x86_64linux-gnu and build against sparc64-linux-gnu and
> powerpc64le-linux-gnu.
>
> * sysdeps/unix/sysv/linux/bits/termios.h [__USE_MISC] (TIOCSER_TEMT):
> Define.
> * sysdeps/unix/sysv/linux/powerpc/bits/termios.h [__USE_MISC]
> (TIOCSER_TEMT): Likewise.
> * sysdeps/unix/sysv/linux/sparc/bits/termios.h [__USE_MISC]
> (TEOCSER_TEMT): Likewise.
> ---
>  sysdeps/unix/sysv/linux/bits/termios.h         | 5 +++++
>  sysdeps/unix/sysv/linux/powerpc/bits/termios.h | 4 +++-
>  sysdeps/unix/sysv/linux/sparc/bits/termios.h   | 4 ++--
>  3 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/sysdeps/unix/sysv/linux/bits/termios.h b/sysdeps/unix/sysv/linux/bits/termios.h
> index 35efa97576..1e567affc3 100644
> --- a/sysdeps/unix/sysv/linux/bits/termios.h
> +++ b/sysdeps/unix/sysv/linux/bits/termios.h
> @@ -198,6 +198,11 @@ struct termios
>  # define EXTPROC 0200000
>  #endif
>  
> +#ifdef __USE_MISC
> +/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
> +# define TIOCSER_TEMT    0x01   /* Transmitter physically empty */
> +#endif
> +
>  /* tcflow() and TCXONC use these */
>  #define TCOOFF 0
>  #define TCOON 1
> diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
> index 1362cce551..afe592d5e4 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
> +++ b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
> @@ -273,7 +273,9 @@ struct ltchars {
>  #define _VEOL2 8
>  #define _VSWTC 9
>  
> +#ifdef __USE_MISC
>  /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
> -#define TIOCSER_TEMT    0x01 /* Transmitter physically empty */
> +# define TIOCSER_TEMT    0x01 /* Transmitter physically empty */
> +#endif
>  
>  #endif /* __USE_MISC  */
> diff --git a/sysdeps/unix/sysv/linux/sparc/bits/termios.h b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
> index 4489b6c2fd..ffe8483694 100644
> --- a/sysdeps/unix/sysv/linux/sparc/bits/termios.h
> +++ b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
> @@ -203,9 +203,9 @@ struct termios
>  # define EXTPROC 0x00010000
>  #endif
>  
> -# if defined __USE_GNU
> +#ifdef __USE_MISC
>  /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
> -#define TIOCSER_TEMT    0x01 /* Transmitter physically empty */
> +# define TIOCSER_TEMT    0x01 /* Transmitter physically empty */
>  #endif
>  
>  /* tcflow() and TCXONC use these */
>
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 02/12] termios: Consolidate struct termios

Adhemerval Zanella-2
In reply to this post by Adhemerval Zanella-2
Ping.


On 15/10/2018 17:49, Adhemerval Zanella wrote:

> This patch consolidates the struct termios definition on its own header
> and adds arch-defined ones for ABIs that deviate from generic
> implementation. They are:
>
>   - alpha which has a slight different layout than generic one (c_cc
>     field is defined prior c_line).
>
>   - sparc and mips which do not have the c_ispeed/c_ospeed fields.
>
> No semantic change is expected, checked on a build against x86_64-linux-gnu,
> alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.
>
> * sysdeps/unix/sysv/linux/alpha/bits/termios-struct.h: New file.
> * sysdeps/unix/sysv/linux/bits/termios-struct.h: Likewise.
> * sysdeps/unix/sysv/linux/mips/bits/termios-struct.h: Likewise.
> * sysdeps/unix/sysv/linux/sparc/bits/termios-struct.h: Likewise.
> * sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
> termios-struct.h.
> * sysdeps/unix/sysv/linux/bits/termios.h (struct termios): Move to
> termios-struct.h.
> * sysdeps/unix/sysv/linux/alpha/bits/termios.h (struct termios):
> Likewise.
> * sysdeps/unix/sysv/linux/mips/bits/termios.h (struct termios):
> Likewise.
> * sysdeps/unix/sysv/linux/powerpc/bits/termios.h (struct termios):
> Likewise.
> * sysdeps/unix/sysv/linux/sparc/bits/termios.h (struct termios):
> Likewise.
> * sysdeps/unix/sysv/linux/kernel_termios.h (_HAVE_C_ISPEED,
> _HAVE_C_OSPEED): Define.
> * sysdeps/unix/sysv/linux/mips/kernel_termios.h (_HAVE_C_ISPEED,
> _HAVE_C_OSPEED): Likewise.
> * sysdeps/unix/sysv/linux/sparc/kernel_termios.h (_HAVE_C_ISPEED,
> _HAVE_C_OSPEED): Likewise.
> * sysdeps/unix/sysv/linux/speed.c [_HAVE_STRUCT_TERMIOS_C_OSPEED]
> (cfsetospeed): Check for define value instead of existence.
> [_HAVE_STRUCT_TERMIOS_C_ISPEED] (cfsetispeed): Likewise.
> * sysdeps/unix/sysv/linux/tcgetattr.c [_HAVE_STRUCT_TERMIOS_C_ISPEED
> && _HAVE_C_ISPEED] (__tcgetattr): Likewise.
> * sysdeps/unix/sysv/linux/tcsetattr.c [_HAVE_STRUCT_TERMIOS_C_ISPEED
> && _HAVE_C_ISPEED] (__tcsetattr): Likewise.
> ---
>  sysdeps/unix/sysv/linux/Makefile              |  2 +-
>  .../sysv/linux/alpha/bits/termios-struct.h    | 37 +++++++++++++++++++
>  sysdeps/unix/sysv/linux/alpha/bits/termios.h  | 15 +-------
>  sysdeps/unix/sysv/linux/bits/termios-struct.h | 36 ++++++++++++++++++
>  sysdeps/unix/sysv/linux/bits/termios.h        | 15 +-------
>  sysdeps/unix/sysv/linux/kernel_termios.h      |  3 ++
>  .../sysv/linux/mips/bits/termios-struct.h     | 34 +++++++++++++++++
>  sysdeps/unix/sysv/linux/mips/bits/termios.h   | 11 +-----
>  sysdeps/unix/sysv/linux/mips/kernel_termios.h |  3 ++
>  .../unix/sysv/linux/powerpc/bits/termios.h    | 20 +---------
>  .../sysv/linux/sparc/bits/termios-struct.h    | 34 +++++++++++++++++
>  sysdeps/unix/sysv/linux/sparc/bits/termios.h  | 11 +-----
>  .../unix/sysv/linux/sparc/kernel_termios.h    |  3 ++
>  sysdeps/unix/sysv/linux/speed.c               |  4 +-
>  sysdeps/unix/sysv/linux/tcgetattr.c           |  8 ++--
>  sysdeps/unix/sysv/linux/tcsetattr.c           |  4 +-
>  16 files changed, 164 insertions(+), 76 deletions(-)
>  create mode 100644 sysdeps/unix/sysv/linux/alpha/bits/termios-struct.h
>  create mode 100644 sysdeps/unix/sysv/linux/bits/termios-struct.h
>  create mode 100644 sysdeps/unix/sysv/linux/mips/bits/termios-struct.h
>  create mode 100644 sysdeps/unix/sysv/linux/sparc/bits/termios-struct.h
>
> diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
> index ff4535cdca..184a5b19e1 100644
> --- a/sysdeps/unix/sysv/linux/Makefile
> +++ b/sysdeps/unix/sysv/linux/Makefile
> @@ -43,7 +43,7 @@ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
>    bits/siginfo-arch.h bits/siginfo-consts-arch.h \
>    bits/procfs.h bits/procfs-id.h bits/procfs-extra.h \
>    bits/procfs-prregset.h bits/mman-map-flags-generic.h \
> -  bits/msq-pad.h
> +  bits/msq-pad.h bits/termios-struct.h
>  
>  tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \
>   tst-quota tst-sync_file_range tst-sysconf-iov_max tst-ttyname \
> diff --git a/sysdeps/unix/sysv/linux/alpha/bits/termios-struct.h b/sysdeps/unix/sysv/linux/alpha/bits/termios-struct.h
> new file mode 100644
> index 0000000000..268988c1a4
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/alpha/bits/termios-struct.h
> @@ -0,0 +1,37 @@
> +/* struct termios definition.  Linux/alpha version.
> +   Copyright (C) 2018 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library.  If not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +#ifndef _TERMIOS_H
> +# error "Never include <bits/termios-struct.h> directly; use <termios.h> instead."
> +#endif
> +
> +/* Alpha has C_CC before C_LINE compare to Linux generic definition.  */
> +#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_cc[NCCS]; /* control characters */
> +    cc_t c_line; /* line discipline (== c_cc[33]) */
> +    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
> +  };
> diff --git a/sysdeps/unix/sysv/linux/alpha/bits/termios.h b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
> index 24423e8fc9..fe358dd8f5 100644
> --- a/sysdeps/unix/sysv/linux/alpha/bits/termios.h
> +++ b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
> @@ -24,20 +24,7 @@ typedef unsigned char cc_t;
>  typedef unsigned int speed_t;
>  typedef unsigned int tcflag_t;
>  
> -#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_cc[NCCS]; /* control characters */
> -    cc_t c_line; /* line discipline (== c_cc[33]) */
> -    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>
>  
>  /* c_cc characters */
>  #define VEOF 0
> diff --git a/sysdeps/unix/sysv/linux/bits/termios-struct.h b/sysdeps/unix/sysv/linux/bits/termios-struct.h
> new file mode 100644
> index 0000000000..ba56a547c1
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/bits/termios-struct.h
> @@ -0,0 +1,36 @@
> +/* struct termios definition.  Linux/generic version.
> +   Copyright (C) 2018 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library.  If not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +#ifndef _TERMIOS_H
> +# error "Never include <bits/termios-struct.h> directly; use <termios.h> instead."
> +#endif
> +
> +#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
> +  };
> diff --git a/sysdeps/unix/sysv/linux/bits/termios.h b/sysdeps/unix/sysv/linux/bits/termios.h
> index 1e567affc3..93536130aa 100644
> --- a/sysdeps/unix/sysv/linux/bits/termios.h
> +++ b/sysdeps/unix/sysv/linux/bits/termios.h
> @@ -24,20 +24,7 @@ typedef unsigned char cc_t;
>  typedef unsigned int speed_t;
>  typedef unsigned int tcflag_t;
>  
> -#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
> -  };
> +#include <bits/termios-struct.h>
>  
>  /* c_cc characters */
>  #define VINTR 0
> diff --git a/sysdeps/unix/sysv/linux/kernel_termios.h b/sysdeps/unix/sysv/linux/kernel_termios.h
> index 6f505c7b61..cd000af833 100644
> --- a/sysdeps/unix/sysv/linux/kernel_termios.h
> +++ b/sysdeps/unix/sysv/linux/kernel_termios.h
> @@ -31,4 +31,7 @@ struct __kernel_termios
>      cc_t c_cc[__KERNEL_NCCS]; /* control characters */
>    };
>  
> +#define _HAVE_C_ISPEED 0
> +#define _HAVE_C_OSPEED 0
> +
>  #endif /* kernel_termios.h */
> diff --git a/sysdeps/unix/sysv/linux/mips/bits/termios-struct.h b/sysdeps/unix/sysv/linux/mips/bits/termios-struct.h
> new file mode 100644
> index 0000000000..f7684e51f1
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/mips/bits/termios-struct.h
> @@ -0,0 +1,34 @@
> +/* struct termios definition.  Linux/mips version.
> +   Copyright (C) 2018 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library.  If not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +#ifndef _TERMIOS_H
> +# error "Never include <bits/termios-struct.h> directly; use <termios.h> instead."
> +#endif
> +
> +#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 */
> +#define _HAVE_STRUCT_TERMIOS_C_ISPEED 0
> +#define _HAVE_STRUCT_TERMIOS_C_OSPEED 0
> +  };
> diff --git a/sysdeps/unix/sysv/linux/mips/bits/termios.h b/sysdeps/unix/sysv/linux/mips/bits/termios.h
> index 7969144633..2b2f873f35 100644
> --- a/sysdeps/unix/sysv/linux/mips/bits/termios.h
> +++ b/sysdeps/unix/sysv/linux/mips/bits/termios.h
> @@ -24,16 +24,7 @@ typedef unsigned char cc_t;
>  typedef unsigned int speed_t;
>  typedef unsigned int tcflag_t;
>  
> -#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 */
> -  };
> +#include <bits/termios-struct.h>
>  
>  /* c_cc characters */
>  #define VINTR 0 /* Interrupt character [ISIG].  */
> diff --git a/sysdeps/unix/sysv/linux/mips/kernel_termios.h b/sysdeps/unix/sysv/linux/mips/kernel_termios.h
> index 1c54b19428..5f88c745a0 100644
> --- a/sysdeps/unix/sysv/linux/mips/kernel_termios.h
> +++ b/sysdeps/unix/sysv/linux/mips/kernel_termios.h
> @@ -31,4 +31,7 @@ struct __kernel_termios
>      cc_t c_cc[__KERNEL_NCCS]; /* control characters */
>    };
>  
> +#define _HAVE_C_ISPEED 0
> +#define _HAVE_C_OSPEED 0
> +
>  #endif /* kernel_termios.h */
> diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
> index afe592d5e4..ddb32bd7e5 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
> +++ b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
> @@ -23,25 +23,7 @@ typedef unsigned char cc_t;
>  typedef unsigned int speed_t;
>  typedef unsigned int tcflag_t;
>  
> -/*
> - * termios type and macro definitions.  Be careful about adding stuff
> - * to this file since it's used in GNU libc and there are strict rules
> - * concerning namespace pollution.
> - */
> -
> -#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>
>  
>  /* c_cc characters */
>  #define VINTR 0
> diff --git a/sysdeps/unix/sysv/linux/sparc/bits/termios-struct.h b/sysdeps/unix/sysv/linux/sparc/bits/termios-struct.h
> new file mode 100644
> index 0000000000..7c3489e1b9
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/sparc/bits/termios-struct.h
> @@ -0,0 +1,34 @@
> +/* struct termios definition.  Linux/sparc version.
> +   Copyright (C) 2018 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library.  If not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +#ifndef _TERMIOS_H
> +# error "Never include <bits/termios-struct.h> directly; use <termios.h> instead."
> +#endif
> +
> +#define NCCS 17
> +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 */
> +#define _HAVE_STRUCT_TERMIOS_C_ISPEED 0
> +#define _HAVE_STRUCT_TERMIOS_C_OSPEED 0
> +  };
> diff --git a/sysdeps/unix/sysv/linux/sparc/bits/termios.h b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
> index ffe8483694..5fd6055c8e 100644
> --- a/sysdeps/unix/sysv/linux/sparc/bits/termios.h
> +++ b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
> @@ -24,16 +24,7 @@ typedef unsigned char cc_t;
>  typedef unsigned int speed_t;
>  typedef unsigned int tcflag_t;
>  
> -#define NCCS 17
> -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 */
> -  };
> +#include <bits/termios-struct.h>
>  
>  /* c_cc characters */
>  #define VINTR    0
> diff --git a/sysdeps/unix/sysv/linux/sparc/kernel_termios.h b/sysdeps/unix/sysv/linux/sparc/kernel_termios.h
> index 31c717ea9d..3a27382d36 100644
> --- a/sysdeps/unix/sysv/linux/sparc/kernel_termios.h
> +++ b/sysdeps/unix/sysv/linux/sparc/kernel_termios.h
> @@ -34,4 +34,7 @@ struct __kernel_termios
>      cc_t c_cc[__KERNEL_NCCS]; /* control characters */
>    };
>  
> +#define _HAVE_C_ISPEED 0
> +#define _HAVE_C_OSPEED 0
> +
>  #endif /* kernel_termios.h */
> diff --git a/sysdeps/unix/sysv/linux/speed.c b/sysdeps/unix/sysv/linux/speed.c
> index 7db9e998c3..23834c10b5 100644
> --- a/sysdeps/unix/sysv/linux/speed.c
> +++ b/sysdeps/unix/sysv/linux/speed.c
> @@ -58,7 +58,7 @@ cfsetospeed (struct termios *termios_p, speed_t speed)
>        && (speed < B57600 || speed > __MAX_BAUD))
>      return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL);
>  
> -#ifdef _HAVE_STRUCT_TERMIOS_C_OSPEED
> +#if _HAVE_STRUCT_TERMIOS_C_OSPEED
>    termios_p->c_ospeed = speed;
>  #endif
>    termios_p->c_cflag &= ~(CBAUD | CBAUDEX);
> @@ -80,7 +80,7 @@ cfsetispeed (struct termios *termios_p, speed_t speed)
>        && (speed < B57600 || speed > __MAX_BAUD))
>      return INLINE_SYSCALL_ERROR_RETURN_VALUE (EINVAL);
>  
> -#ifdef _HAVE_STRUCT_TERMIOS_C_ISPEED
> +#if _HAVE_STRUCT_TERMIOS_C_ISPEED
>    termios_p->c_ispeed = speed;
>  #endif
>    if (speed == 0)
> diff --git a/sysdeps/unix/sysv/linux/tcgetattr.c b/sysdeps/unix/sysv/linux/tcgetattr.c
> index 9748bc8cc4..b79d9f1462 100644
> --- a/sysdeps/unix/sysv/linux/tcgetattr.c
> +++ b/sysdeps/unix/sysv/linux/tcgetattr.c
> @@ -44,15 +44,15 @@ __tcgetattr (int fd, struct termios *termios_p)
>        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
> +#if _HAVE_STRUCT_TERMIOS_C_ISPEED
> +# if _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
> +#if _HAVE_STRUCT_TERMIOS_C_OSPEED
> +# if _HAVE_C_OSPEED
>        termios_p->c_ospeed = k_termios.c_ospeed;
>  # else
>        termios_p->c_ospeed = k_termios.c_cflag & (CBAUD | CBAUDEX);
> diff --git a/sysdeps/unix/sysv/linux/tcsetattr.c b/sysdeps/unix/sysv/linux/tcsetattr.c
> index a916e70253..f8025a0473 100644
> --- a/sysdeps/unix/sysv/linux/tcsetattr.c
> +++ b/sysdeps/unix/sysv/linux/tcsetattr.c
> @@ -66,10 +66,10 @@ __tcsetattr (int fd, int optional_actions, const struct termios *termios_p)
>    k_termios.c_cflag = termios_p->c_cflag;
>    k_termios.c_lflag = termios_p->c_lflag;
>    k_termios.c_line = termios_p->c_line;
> -#if defined _HAVE_C_ISPEED && defined _HAVE_STRUCT_TERMIOS_C_ISPEED
> +#if _HAVE_C_ISPEED && _HAVE_STRUCT_TERMIOS_C_ISPEED
>    k_termios.c_ispeed = termios_p->c_ispeed;
>  #endif
> -#if defined _HAVE_C_OSPEED && defined _HAVE_STRUCT_TERMIOS_C_OSPEED
> +#if _HAVE_C_OSPEED && _HAVE_STRUCT_TERMIOS_C_OSPEED
>    k_termios.c_ospeed = termios_p->c_ospeed;
>  #endif
>    memcpy (&k_termios.c_cc[0], &termios_p->c_cc[0],
>
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 03/12] termios: Consolidate termios c_cc symbolic constants

Adhemerval Zanella-2
In reply to this post by Adhemerval Zanella-2
Ping.

On 15/10/2018 17:49, Adhemerval Zanella wrote:

> This patch consolidates the termios symbolic constants used as subscript
> for the array c_cc on its own header.  The Linux generic implementation
> values match the kernel UAPI and each architecture with deviate values
> have their own implementation (in this case alpha, mips64, and sparc64).
>
> No semantic change is expected, checked on a build against x86_64-linux-gnu,
> alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.
>
> * sysdeps/unix/sysv/linux/Makefile (sysdeps_headers): Add
> termios-cc.h.
> * sysdeps/unix/sysv/linux/bits/termios-c_cc.h: Likewise.
> * sysdeps/unix/sysv/linux/alpha/bits/termios-c_cc.h: New file.
> * sysdeps/unix/sysv/linux/mips/bits/termios-c_cc.h: Likewise.
> * sysdeps/unix/sysv/linux/powerpc/bits/termios-c_cc.h: Likewise.
> * sysdeps/unix/sysv/linux/sparc/bits/termios-c_cc.h: Likewise.
> * sysdeps/unix/sysv/linux/bits/termios.h (VINTR, VQUIT, VERASE,
> VKILL, VEOF, VTIME, VMIN, VSWTC, VSTART, VSTOP, VSUSP, VEOL,
> VREPRINT, VDISCARD, VWERASE, VLNEXT, VEOLF2): Move to termios-cc.h.
> * sysdeps/unix/sysv/linux/alpha/bits/termios.h: Likewise.
> * sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise.
> * sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise.
> * sysdeps/unix/sysv/linux/sparc/bits/termios.h: Likewise.
> ---
>  sysdeps/unix/sysv/linux/Makefile              |  2 +-
>  .../unix/sysv/linux/alpha/bits/termios-c_cc.h | 40 +++++++++++++++++
>  sysdeps/unix/sysv/linux/alpha/bits/termios.h  | 20 +--------
>  sysdeps/unix/sysv/linux/bits/termios-c_cc.h   | 40 +++++++++++++++++
>  sysdeps/unix/sysv/linux/bits/termios.h        | 20 +--------
>  .../unix/sysv/linux/mips/bits/termios-c_cc.h  | 43 +++++++++++++++++++
>  sysdeps/unix/sysv/linux/mips/bits/termios.h   | 23 +---------
>  .../sysv/linux/powerpc/bits/termios-c_cc.h    | 41 ++++++++++++++++++
>  .../unix/sysv/linux/powerpc/bits/termios.h    | 21 +--------
>  .../unix/sysv/linux/sparc/bits/termios-c_cc.h | 43 +++++++++++++++++++
>  sysdeps/unix/sysv/linux/sparc/bits/termios.h  | 23 +---------
>  11 files changed, 213 insertions(+), 103 deletions(-)
>  create mode 100644 sysdeps/unix/sysv/linux/alpha/bits/termios-c_cc.h
>  create mode 100644 sysdeps/unix/sysv/linux/bits/termios-c_cc.h
>  create mode 100644 sysdeps/unix/sysv/linux/mips/bits/termios-c_cc.h
>  create mode 100644 sysdeps/unix/sysv/linux/powerpc/bits/termios-c_cc.h
>  create mode 100644 sysdeps/unix/sysv/linux/sparc/bits/termios-c_cc.h
>
> diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
> index 184a5b19e1..ace8dcb631 100644
> --- a/sysdeps/unix/sysv/linux/Makefile
> +++ b/sysdeps/unix/sysv/linux/Makefile
> @@ -43,7 +43,7 @@ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
>    bits/siginfo-arch.h bits/siginfo-consts-arch.h \
>    bits/procfs.h bits/procfs-id.h bits/procfs-extra.h \
>    bits/procfs-prregset.h bits/mman-map-flags-generic.h \
> -  bits/msq-pad.h bits/termios-struct.h
> +  bits/msq-pad.h bits/termios-struct.h bits/termios-c_cc.h
>  
>  tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \
>   tst-quota tst-sync_file_range tst-sysconf-iov_max tst-ttyname \
> diff --git a/sysdeps/unix/sysv/linux/alpha/bits/termios-c_cc.h b/sysdeps/unix/sysv/linux/alpha/bits/termios-c_cc.h
> new file mode 100644
> index 0000000000..9ad1336ef6
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/alpha/bits/termios-c_cc.h
> @@ -0,0 +1,40 @@
> +/* termios c_cc symbolic constant definitions.  Linux/alpha version.
> +   Copyright (C) 2018 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library.  If not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +#ifndef _TERMIOS_H
> +# error "Never include <bits/termios-c_cc.h> directly; use <termios.h> instead."
> +#endif
> +
> +/* c_cc characters */
> +#define VEOF 0
> +#define VEOL 1
> +#define VEOL2 2
> +#define VERASE 3
> +#define VWERASE 4
> +#define VKILL 5
> +#define VREPRINT 6
> +#define VSWTC 7
> +#define VINTR 8
> +#define VQUIT 9
> +#define VSUSP 10
> +#define VSTART 12
> +#define VSTOP 13
> +#define VLNEXT 14
> +#define VDISCARD 15
> +#define VMIN 16
> +#define VTIME 17
> diff --git a/sysdeps/unix/sysv/linux/alpha/bits/termios.h b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
> index fe358dd8f5..25159890b5 100644
> --- a/sysdeps/unix/sysv/linux/alpha/bits/termios.h
> +++ b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
> @@ -25,25 +25,7 @@ typedef unsigned int speed_t;
>  typedef unsigned int tcflag_t;
>  
>  #include <bits/termios-struct.h>
> -
> -/* c_cc characters */
> -#define VEOF 0
> -#define VEOL 1
> -#define VEOL2 2
> -#define VERASE 3
> -#define VWERASE 4
> -#define VKILL 5
> -#define VREPRINT 6
> -#define VSWTC 7
> -#define VINTR 8
> -#define VQUIT 9
> -#define VSUSP 10
> -#define VSTART 12
> -#define VSTOP 13
> -#define VLNEXT 14
> -#define VDISCARD 15
> -#define VMIN 16
> -#define VTIME 17
> +#include <bits/termios-c_cc.h>
>  
>  /* c_iflag bits */
>  #define IGNBRK 0000001
> diff --git a/sysdeps/unix/sysv/linux/bits/termios-c_cc.h b/sysdeps/unix/sysv/linux/bits/termios-c_cc.h
> new file mode 100644
> index 0000000000..80d5e6d2ce
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/bits/termios-c_cc.h
> @@ -0,0 +1,40 @@
> +/* termios c_cc symbolic constant definitions.  Linux/generic version.
> +   Copyright (C) 2018 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library.  If not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +#ifndef _TERMIOS_H
> +# error "Never include <bits/termios_c_cc.h> directly; use <termios.h> instead."
> +#endif
> +
> +/* c_cc characters */
> +#define VINTR 0
> +#define VQUIT 1
> +#define VERASE 2
> +#define VKILL 3
> +#define VEOF 4
> +#define VTIME 5
> +#define VMIN 6
> +#define VSWTC 7
> +#define VSTART 8
> +#define VSTOP 9
> +#define VSUSP 10
> +#define VEOL 11
> +#define VREPRINT 12
> +#define VDISCARD 13
> +#define VWERASE 14
> +#define VLNEXT 15
> +#define VEOL2 16
> diff --git a/sysdeps/unix/sysv/linux/bits/termios.h b/sysdeps/unix/sysv/linux/bits/termios.h
> index 93536130aa..1fba973734 100644
> --- a/sysdeps/unix/sysv/linux/bits/termios.h
> +++ b/sysdeps/unix/sysv/linux/bits/termios.h
> @@ -25,25 +25,7 @@ typedef unsigned int speed_t;
>  typedef unsigned int tcflag_t;
>  
>  #include <bits/termios-struct.h>
> -
> -/* c_cc characters */
> -#define VINTR 0
> -#define VQUIT 1
> -#define VERASE 2
> -#define VKILL 3
> -#define VEOF 4
> -#define VTIME 5
> -#define VMIN 6
> -#define VSWTC 7
> -#define VSTART 8
> -#define VSTOP 9
> -#define VSUSP 10
> -#define VEOL 11
> -#define VREPRINT 12
> -#define VDISCARD 13
> -#define VWERASE 14
> -#define VLNEXT 15
> -#define VEOL2 16
> +#include <bits/termios-c_cc.h>
>  
>  /* c_iflag bits */
>  #define IGNBRK 0000001
> diff --git a/sysdeps/unix/sysv/linux/mips/bits/termios-c_cc.h b/sysdeps/unix/sysv/linux/mips/bits/termios-c_cc.h
> new file mode 100644
> index 0000000000..573efbc9d3
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/mips/bits/termios-c_cc.h
> @@ -0,0 +1,43 @@
> +/* termios c_cc symbolic constant definitions.  Linux/mips version.
> +   Copyright (C) 2018 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library.  If not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +#ifndef _TERMIOS_H
> +# error "Never include <bits/termios-c_cc.h> directly; use <termios.h> instead."
> +#endif
> +
> +/* c_cc characters */
> +#define VINTR 0 /* Interrupt character [ISIG].  */
> +#define VQUIT 1 /* Quit character [ISIG].  */
> +#define VERASE 2 /* Erase character [ICANON].  */
> +#define VKILL 3 /* Kill-line character [ICANON].  */
> +#define VMIN 4 /* Minimum number of bytes read at once [!ICANON].  */
> +#define VTIME 5 /* Time-out value (tenths of a second) [!ICANON].  */
> +#define VEOL2 6 /* Second EOL character [ICANON].  */
> +#define VSWTC 7
> +#define VSWTCH VSWTC
> +#define VSTART 8 /* Start (X-ON) character [IXON, IXOFF].  */
> +#define VSTOP 9 /* Stop (X-OFF) character [IXON, IXOFF].  */
> +#define VSUSP 10 /* Suspend character [ISIG].  */
> + /* VDSUSP is not supported on Linux. */
> +/* #define VDSUSP 11 / * Delayed suspend character [ISIG].  */
> +#define VREPRINT 12 /* Reprint-line character [ICANON].  */
> +#define VDISCARD 13 /* Discard character [IEXTEN].  */
> +#define VWERASE 14 /* Word-erase character [ICANON].  */
> +#define VLNEXT 15 /* Literal-next character [IEXTEN].  */
> +#define VEOF 16 /* End-of-file character [ICANON].  */
> +#define VEOL 17 /* End-of-line character [ICANON].  */
> diff --git a/sysdeps/unix/sysv/linux/mips/bits/termios.h b/sysdeps/unix/sysv/linux/mips/bits/termios.h
> index 2b2f873f35..1153763ae8 100644
> --- a/sysdeps/unix/sysv/linux/mips/bits/termios.h
> +++ b/sysdeps/unix/sysv/linux/mips/bits/termios.h
> @@ -25,28 +25,7 @@ typedef unsigned int speed_t;
>  typedef unsigned int tcflag_t;
>  
>  #include <bits/termios-struct.h>
> -
> -/* c_cc characters */
> -#define VINTR 0 /* Interrupt character [ISIG].  */
> -#define VQUIT 1 /* Quit character [ISIG].  */
> -#define VERASE 2 /* Erase character [ICANON].  */
> -#define VKILL 3 /* Kill-line character [ICANON].  */
> -#define VMIN 4 /* Minimum number of bytes read at once [!ICANON].  */
> -#define VTIME 5 /* Time-out value (tenths of a second) [!ICANON].  */
> -#define VEOL2 6 /* Second EOL character [ICANON].  */
> -#define VSWTC 7
> -#define VSWTCH VSWTC
> -#define VSTART 8 /* Start (X-ON) character [IXON, IXOFF].  */
> -#define VSTOP 9 /* Stop (X-OFF) character [IXON, IXOFF].  */
> -#define VSUSP 10 /* Suspend character [ISIG].  */
> - /* VDSUSP is not supported on Linux. */
> -/* #define VDSUSP 11 / * Delayed suspend character [ISIG].  */
> -#define VREPRINT 12 /* Reprint-line character [ICANON].  */
> -#define VDISCARD 13 /* Discard character [IEXTEN].  */
> -#define VWERASE 14 /* Word-erase character [ICANON].  */
> -#define VLNEXT 15 /* Literal-next character [IEXTEN].  */
> -#define VEOF 16 /* End-of-file character [ICANON].  */
> -#define VEOL 17 /* End-of-line character [ICANON].  */
> +#include <bits/termios-c_cc.h>
>  
>  /* c_iflag bits */
>  #define IGNBRK 0000001 /* Ignore break condition.  */
> diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/termios-c_cc.h b/sysdeps/unix/sysv/linux/powerpc/bits/termios-c_cc.h
> new file mode 100644
> index 0000000000..8c75e25339
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/powerpc/bits/termios-c_cc.h
> @@ -0,0 +1,41 @@
> +/* termios c_cc symbolic constant definitions.  Linux/powerpc version.
> +   Copyright (C) 2018 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library.  If not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +#ifndef _TERMIOS_H
> +# error "Never include <bits/termios-c_cc.h> directly; use <termios.h> instead."
> +#endif
> +
> +/* c_cc characters */
> +#define VINTR 0
> +#define VQUIT 1
> +#define VERASE 2
> +#define VKILL 3
> +#define VEOF 4
> +#define VMIN 5
> +#define VEOL 6
> +#define VTIME 7
> +#define VEOL2 8
> +#define VSWTC 9
> +
> +#define VWERASE 10
> +#define VREPRINT 11
> +#define VSUSP 12
> +#define VSTART 13
> +#define VSTOP 14
> +#define VLNEXT 15
> +#define VDISCARD 16
> diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
> index ddb32bd7e5..2253143734 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
> +++ b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
> @@ -24,26 +24,7 @@ typedef unsigned int speed_t;
>  typedef unsigned int tcflag_t;
>  
>  #include <bits/termios-struct.h>
> -
> -/* c_cc characters */
> -#define VINTR 0
> -#define VQUIT 1
> -#define VERASE 2
> -#define VKILL 3
> -#define VEOF 4
> -#define VMIN 5
> -#define VEOL 6
> -#define VTIME 7
> -#define VEOL2 8
> -#define VSWTC 9
> -
> -#define VWERASE 10
> -#define VREPRINT 11
> -#define VSUSP 12
> -#define VSTART 13
> -#define VSTOP 14
> -#define VLNEXT 15
> -#define VDISCARD 16
> +#include <bits/termios-c_cc.h>
>  
>  /* c_iflag bits */
>  #define IGNBRK 0000001
> diff --git a/sysdeps/unix/sysv/linux/sparc/bits/termios-c_cc.h b/sysdeps/unix/sysv/linux/sparc/bits/termios-c_cc.h
> new file mode 100644
> index 0000000000..09b504273b
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/sparc/bits/termios-c_cc.h
> @@ -0,0 +1,43 @@
> +/* termios c_cc symbolic constant definitions.  Linux/sparc version.
> +   Copyright (C) 2018 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library.  If not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +#ifndef _TERMIOS_H
> +# error "Never include <bits/termios-c_cc.h> directly; use <termios.h> instead."
> +#endif
> +
> +/* c_cc characters */
> +#define VINTR    0
> +#define VQUIT    1
> +#define VERASE   2
> +#define VKILL    3
> +#define VEOF     4
> +#define VEOL     5
> +#define VEOL2    6
> +#define VSWTC    7
> +#define VSTART   8
> +#define VSTOP    9
> +#define VSUSP    10
> +#define VDSUSP   11 /* SunOS POSIX nicety I do believe... */
> +#define VREPRINT 12
> +#define VDISCARD 13
> +#define VWERASE  14
> +#define VLNEXT   15
> +
> +/* User apps assume vmin/vtime is shared with eof/eol */
> +#define VMIN     VEOF
> +#define VTIME    VEOL
> diff --git a/sysdeps/unix/sysv/linux/sparc/bits/termios.h b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
> index 5fd6055c8e..a2588c2158 100644
> --- a/sysdeps/unix/sysv/linux/sparc/bits/termios.h
> +++ b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
> @@ -25,28 +25,7 @@ typedef unsigned int speed_t;
>  typedef unsigned int tcflag_t;
>  
>  #include <bits/termios-struct.h>
> -
> -/* c_cc characters */
> -#define VINTR    0
> -#define VQUIT    1
> -#define VERASE   2
> -#define VKILL    3
> -#define VEOF     4
> -#define VEOL     5
> -#define VEOL2    6
> -#define VSWTC    7
> -#define VSTART   8
> -#define VSTOP    9
> -#define VSUSP    10
> -#define VDSUSP   11 /* SunOS POSIX nicety I do believe... */
> -#define VREPRINT 12
> -#define VDISCARD 13
> -#define VWERASE  14
> -#define VLNEXT   15
> -
> -/* User apps assume vmin/vtime is shared with eof/eol */
> -#define VMIN     VEOF
> -#define VTIME    VEOL
> +#include <bits/termios-c_cc.h>
>  
>  /* c_iflag bits */
>  #define IGNBRK 0x00000001
>
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 04/12] termios: Consolidate Input Modes definitions.

Adhemerval Zanella-2
In reply to this post by Adhemerval Zanella-2
Ping.

On 15/10/2018 17:49, Adhemerval Zanella wrote:

> This patch consolidates the termios symbolic constants used for input
> modes with c_iflag member on its own header.  The Linux generic implementation
> values match the kernel UAPI and each architecture with deviate values
> have their own implementation (in this case alpha and powerpc).
>
> No semantic change is expected, checked on a build against x86_64-linux-gnu,
> alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.
>
> * sysdeps/unix/sysv/linux/Makefile (sysdeps_headers): Add termios-c_iflag.h.
> * sysdeps/unix/sysv/linux/bits/termios-c_iflag.h: New file.
> * sysdeps/unix/sysv/linux/alpha/bits/termios-c_iflag.h: Likewise.
> * sysdeps/unix/sysv/linux/powerpc/bits/termios-c_iflag.h: Likewise.
> * sysdeps/unix/sysv/linux/bits/termios.h (IGNBRK, BRKINT, IGNPAR, PARMRK,
> INPCK, ISTRIP, INLCR, IGNCR, ICRNL, IXON, IXOFF, IXANY, IUCLC, IMAXBEL,
> IUTF8): Move to termios-c_iflag.h.
> * sysdeps/unix/sysv/linux/alpha/bits/termios.h: Likewise.
> * sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise.
> * sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise.
> * sysdeps/unix/sysv/linux/sparc/bits/termios.h: Likewise.
> ---
>  sysdeps/unix/sysv/linux/Makefile              |  3 +-
>  .../sysv/linux/alpha/bits/termios-c_iflag.h   | 38 ++++++++++++++++++
>  sysdeps/unix/sysv/linux/alpha/bits/termios.h  | 18 +--------
>  .../unix/sysv/linux/bits/termios-c_iflag.h    | 40 +++++++++++++++++++
>  sysdeps/unix/sysv/linux/bits/termios.h        | 18 +--------
>  sysdeps/unix/sysv/linux/mips/bits/termios.h   | 18 +--------
>  .../sysv/linux/powerpc/bits/termios-c_iflag.h | 38 ++++++++++++++++++
>  .../unix/sysv/linux/powerpc/bits/termios.h    | 18 +--------
>  sysdeps/unix/sysv/linux/sparc/bits/termios.h  | 18 +--------
>  9 files changed, 123 insertions(+), 86 deletions(-)
>  create mode 100644 sysdeps/unix/sysv/linux/alpha/bits/termios-c_iflag.h
>  create mode 100644 sysdeps/unix/sysv/linux/bits/termios-c_iflag.h
>  create mode 100644 sysdeps/unix/sysv/linux/powerpc/bits/termios-c_iflag.h
>
> diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
> index ace8dcb631..2f5a59cb11 100644
> --- a/sysdeps/unix/sysv/linux/Makefile
> +++ b/sysdeps/unix/sysv/linux/Makefile
> @@ -43,7 +43,8 @@ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
>    bits/siginfo-arch.h bits/siginfo-consts-arch.h \
>    bits/procfs.h bits/procfs-id.h bits/procfs-extra.h \
>    bits/procfs-prregset.h bits/mman-map-flags-generic.h \
> -  bits/msq-pad.h bits/termios-struct.h bits/termios-c_cc.h
> +  bits/msq-pad.h bits/termios-struct.h bits/termios-c_cc.h \
> +  bits/termios-c_iflag.h
>  
>  tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \
>   tst-quota tst-sync_file_range tst-sysconf-iov_max tst-ttyname \
> diff --git a/sysdeps/unix/sysv/linux/alpha/bits/termios-c_iflag.h b/sysdeps/unix/sysv/linux/alpha/bits/termios-c_iflag.h
> new file mode 100644
> index 0000000000..11584250d5
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/alpha/bits/termios-c_iflag.h
> @@ -0,0 +1,38 @@
> +/* termios input mode definitions.  Linux/alpha version.
> +   Copyright (C) 2018 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library.  If not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +#ifndef _TERMIOS_H
> +# error "Never include <bits/termios-c_iflags.h> directly; use <termios.h> instead."
> +#endif
> +
> +/* c_iflag bits */
> +#define IGNBRK 0000001
> +#define BRKINT 0000002
> +#define IGNPAR 0000004
> +#define PARMRK 0000010
> +#define INPCK 0000020
> +#define ISTRIP 0000040
> +#define INLCR 0000100
> +#define IGNCR 0000200
> +#define ICRNL 0000400
> +#define IXON 0001000
> +#define IXOFF 0002000
> +#define IXANY 0004000
> +#define IUCLC 0010000
> +#define IMAXBEL 0020000
> +#define IUTF8 0040000
> diff --git a/sysdeps/unix/sysv/linux/alpha/bits/termios.h b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
> index 25159890b5..4d49c66aa8 100644
> --- a/sysdeps/unix/sysv/linux/alpha/bits/termios.h
> +++ b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
> @@ -26,23 +26,7 @@ typedef unsigned int tcflag_t;
>  
>  #include <bits/termios-struct.h>
>  #include <bits/termios-c_cc.h>
> -
> -/* c_iflag bits */
> -#define IGNBRK 0000001
> -#define BRKINT 0000002
> -#define IGNPAR 0000004
> -#define PARMRK 0000010
> -#define INPCK 0000020
> -#define ISTRIP 0000040
> -#define INLCR 0000100
> -#define IGNCR 0000200
> -#define ICRNL 0000400
> -#define IXON 0001000
> -#define IXOFF 0002000
> -#define IXANY 0004000
> -#define IUCLC 0010000
> -#define IMAXBEL 0020000
> -#define IUTF8 0040000
> +#include <bits/termios-c_iflag.h>
>  
>  /* c_oflag bits */
>  #define OPOST 0000001
> diff --git a/sysdeps/unix/sysv/linux/bits/termios-c_iflag.h b/sysdeps/unix/sysv/linux/bits/termios-c_iflag.h
> new file mode 100644
> index 0000000000..c365b82262
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/bits/termios-c_iflag.h
> @@ -0,0 +1,40 @@
> +/* termios input mode definitions.  Linux/generic version.
> +   Copyright (C) 2018 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library.  If not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +#ifndef _TERMIOS_H
> +# error "Never include <bits/termios-ciflags.h> directly; use <termios.h> instead."
> +#endif
> +
> +/* c_iflag bits */
> +#define IGNBRK 0000001  /* Ignore break condition.  */
> +#define BRKINT 0000002  /* Signal interrupt on break.  */
> +#define IGNPAR 0000004  /* Ignore characters with parity errors.  */
> +#define PARMRK 0000010  /* Mark parity and framing errors.  */
> +#define INPCK 0000020  /* Enable input parity check.  */
> +#define ISTRIP 0000040  /* Strip 8th bit off characters.  */
> +#define INLCR 0000100  /* Map NL to CR on input.  */
> +#define IGNCR 0000200  /* Ignore CR.  */
> +#define ICRNL 0000400  /* Map CR to NL on input.  */
> +#define IUCLC 0001000  /* Map uppercase characters to lowercase on input
> +    (not in POSIX).  */
> +#define IXON 0002000  /* Enable start/stop output control.  */
> +#define IXANY 0004000  /* Enable any character to restart output.  */
> +#define IXOFF 0010000  /* Enable start/stop input control.  */
> +#define IMAXBEL 0020000  /* Ring bell when input queue is full
> +    (not in POSIX).  */
> +#define IUTF8 0040000  /* Input is UTF8 (not in POSIX).  */
> diff --git a/sysdeps/unix/sysv/linux/bits/termios.h b/sysdeps/unix/sysv/linux/bits/termios.h
> index 1fba973734..6ce5c56049 100644
> --- a/sysdeps/unix/sysv/linux/bits/termios.h
> +++ b/sysdeps/unix/sysv/linux/bits/termios.h
> @@ -26,23 +26,7 @@ typedef unsigned int tcflag_t;
>  
>  #include <bits/termios-struct.h>
>  #include <bits/termios-c_cc.h>
> -
> -/* c_iflag bits */
> -#define IGNBRK 0000001
> -#define BRKINT 0000002
> -#define IGNPAR 0000004
> -#define PARMRK 0000010
> -#define INPCK 0000020
> -#define ISTRIP 0000040
> -#define INLCR 0000100
> -#define IGNCR 0000200
> -#define ICRNL 0000400
> -#define IUCLC 0001000
> -#define IXON 0002000
> -#define IXANY 0004000
> -#define IXOFF 0010000
> -#define IMAXBEL 0020000
> -#define IUTF8 0040000
> +#include <bits/termios-c_iflag.h>
>  
>  /* c_oflag bits */
>  #define OPOST 0000001
> diff --git a/sysdeps/unix/sysv/linux/mips/bits/termios.h b/sysdeps/unix/sysv/linux/mips/bits/termios.h
> index 1153763ae8..a8a37ff176 100644
> --- a/sysdeps/unix/sysv/linux/mips/bits/termios.h
> +++ b/sysdeps/unix/sysv/linux/mips/bits/termios.h
> @@ -26,23 +26,7 @@ typedef unsigned int tcflag_t;
>  
>  #include <bits/termios-struct.h>
>  #include <bits/termios-c_cc.h>
> -
> -/* c_iflag bits */
> -#define IGNBRK 0000001 /* Ignore break condition.  */
> -#define BRKINT 0000002 /* Signal interrupt on break.  */
> -#define IGNPAR 0000004 /* Ignore characters with parity errors.  */
> -#define PARMRK 0000010 /* Mark parity and framing errors.  */
> -#define INPCK 0000020 /* Enable input parity check.  */
> -#define ISTRIP 0000040 /* Strip 8th bit off characters.  */
> -#define INLCR 0000100 /* Map NL to CR on input.  */
> -#define IGNCR 0000200 /* Ignore CR.  */
> -#define ICRNL 0000400 /* Map CR to NL on input.  */
> -#define IUCLC 0001000 /* Map upper case to lower case on input.  */
> -#define IXON 0002000 /* Enable start/stop output control.  */
> -#define IXANY 0004000 /* Any character will restart after stop.  */
> -#define IXOFF 0010000 /* Enable start/stop input control.  */
> -#define IMAXBEL 0020000 /* Ring bell when input queue is full.  */
> -#define IUTF8 0040000 /* Input is UTF8.  */
> +#include <bits/termios-c_iflag.h>
>  
>  /* c_oflag bits */
>  #define OPOST 0000001 /* Perform output processing.  */
> diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/termios-c_iflag.h b/sysdeps/unix/sysv/linux/powerpc/bits/termios-c_iflag.h
> new file mode 100644
> index 0000000000..c728b4d110
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/powerpc/bits/termios-c_iflag.h
> @@ -0,0 +1,38 @@
> +/* termios input mode definitions.  Linux/powerpc version.
> +   Copyright (C) 2018 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library.  If not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +#ifndef _TERMIOS_H
> +# error "Never include <bits/termios-c_iflags.h> directly; use <termios.h> instead."
> +#endif
> +
> +/* c_iflag bits */
> +#define IGNBRK 0000001
> +#define BRKINT 0000002
> +#define IGNPAR 0000004
> +#define PARMRK 0000010
> +#define INPCK 0000020
> +#define ISTRIP 0000040
> +#define INLCR 0000100
> +#define IGNCR 0000200
> +#define ICRNL 0000400
> +#define IXON 0001000
> +#define IXOFF 0002000
> +#define IXANY 0004000
> +#define IUCLC 0010000
> +#define IMAXBEL 0020000
> +#define IUTF8 0040000
> diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
> index 2253143734..4ccabd7095 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
> +++ b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
> @@ -25,23 +25,7 @@ typedef unsigned int tcflag_t;
>  
>  #include <bits/termios-struct.h>
>  #include <bits/termios-c_cc.h>
> -
> -/* c_iflag bits */
> -#define IGNBRK 0000001
> -#define BRKINT 0000002
> -#define IGNPAR 0000004
> -#define PARMRK 0000010
> -#define INPCK 0000020
> -#define ISTRIP 0000040
> -#define INLCR 0000100
> -#define IGNCR 0000200
> -#define ICRNL 0000400
> -#define IXON 0001000
> -#define IXOFF 0002000
> -#define IXANY 0004000
> -#define IUCLC 0010000
> -#define IMAXBEL 0020000
> -#define IUTF8 0040000
> +#include <bits/termios-c_iflag.h>
>  
>  /* c_oflag bits */
>  #define OPOST 0000001
> diff --git a/sysdeps/unix/sysv/linux/sparc/bits/termios.h b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
> index a2588c2158..4123ed7aaa 100644
> --- a/sysdeps/unix/sysv/linux/sparc/bits/termios.h
> +++ b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
> @@ -26,23 +26,7 @@ typedef unsigned int tcflag_t;
>  
>  #include <bits/termios-struct.h>
>  #include <bits/termios-c_cc.h>
> -
> -/* c_iflag bits */
> -#define IGNBRK 0x00000001
> -#define BRKINT 0x00000002
> -#define IGNPAR 0x00000004
> -#define PARMRK 0x00000008
> -#define INPCK 0x00000010
> -#define ISTRIP 0x00000020
> -#define INLCR 0x00000040
> -#define IGNCR 0x00000080
> -#define ICRNL 0x00000100
> -#define IUCLC 0x00000200
> -#define IXON 0x00000400
> -#define IXANY 0x00000800
> -#define IXOFF 0x00001000
> -#define IMAXBEL 0x00002000
> -#define IUTF8 0x00004000
> +#include <bits/termios-c_iflag.h>
>  
>  /* c_oflag bits */
>  #define OPOST 0x00000001
>
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 05/12] termios: Consolidate Output Modes definitions

Adhemerval Zanella-2
In reply to this post by Adhemerval Zanella-2
Ping.

On 15/10/2018 17:49, Adhemerval Zanella wrote:

> This patch consolidates the termios symbolic constants used for ouput
> modes with c_oflag member on its own header.  The Linux generic implementation
> values match the kernel UAPI and each architecture with deviate values
> have their own implementation (in this case alpha, powerpc, and sparc).
>
> No semantic change is expected, checked on a build against x86_64-linux-gnu,
> alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.
>
> * sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Add
> termios-c_oflag.h.
> * sysdeps/unix/sysv/linux/bits/termios-c_oflag.h: New file.
> * sysdeps/unix/sysv/linux/alpha/bits/termios-c_oflag.h: Likewise.
> * sysdeps/unix/sysv/linux/powerpc/bits/termios-c_oflag.h: Likewise.
> * sysdeps/unix/sysv/linux/sparc/bits/termios-c_oflag.h: Likewise.
> * sysdeps/unix/sysv/linux/bits/termios.h (OPOST, OLCUC, ONLCR, OCRNL,
> ONOCR, ONLRET, OFILL, OFDEL, VTDLY, VT0, VT1):  Move to
> termios-c_oflag.h.
> [__USE_MISC || __USE_XOPEN] (NLDLY, NL0, NL1, CRDLY, CR0, CR1, CR2,
> CR3, TABDLY, TAB0, TAB1, TAB2, TAB3, BSDLY, BS0, BS1, FFDLY, FF0,
> FFR1): Likewise.
> [USE_MISC] (XTABS): Likewise.
> * sysdeps/unix/sysv/linux/alpha/bits/termios.h: Likewise.
> * sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise.
> * sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise.
> * sysdeps/unix/sysv/linux/sparc/bits/termios.h Likewise.
> ---
>  sysdeps/unix/sysv/linux/Makefile              |  2 +-
>  .../sysv/linux/alpha/bits/termios-c_oflag.h   | 66 +++++++++++++++++++
>  sysdeps/unix/sysv/linux/alpha/bits/termios.h  | 46 +------------
>  .../unix/sysv/linux/bits/termios-c_oflag.h    | 61 +++++++++++++++++
>  sysdeps/unix/sysv/linux/bits/termios.h        | 40 +----------
>  sysdeps/unix/sysv/linux/mips/bits/termios.h   | 40 +----------
>  .../sysv/linux/powerpc/bits/termios-c_oflag.h | 65 ++++++++++++++++++
>  .../unix/sysv/linux/powerpc/bits/termios.h    | 45 +------------
>  .../sysv/linux/sparc/bits/termios-c_oflag.h   | 64 ++++++++++++++++++
>  sysdeps/unix/sysv/linux/sparc/bits/termios.h  | 44 +------------
>  10 files changed, 262 insertions(+), 211 deletions(-)
>  create mode 100644 sysdeps/unix/sysv/linux/alpha/bits/termios-c_oflag.h
>  create mode 100644 sysdeps/unix/sysv/linux/bits/termios-c_oflag.h
>  create mode 100644 sysdeps/unix/sysv/linux/powerpc/bits/termios-c_oflag.h
>  create mode 100644 sysdeps/unix/sysv/linux/sparc/bits/termios-c_oflag.h
>
> diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
> index 2f5a59cb11..097107c82c 100644
> --- a/sysdeps/unix/sysv/linux/Makefile
> +++ b/sysdeps/unix/sysv/linux/Makefile
> @@ -44,7 +44,7 @@ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
>    bits/procfs.h bits/procfs-id.h bits/procfs-extra.h \
>    bits/procfs-prregset.h bits/mman-map-flags-generic.h \
>    bits/msq-pad.h bits/termios-struct.h bits/termios-c_cc.h \
> -  bits/termios-c_iflag.h
> +  bits/termios-c_iflag.h bits/termios-c_oflag.h
>  
>  tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \
>   tst-quota tst-sync_file_range tst-sysconf-iov_max tst-ttyname \
> diff --git a/sysdeps/unix/sysv/linux/alpha/bits/termios-c_oflag.h b/sysdeps/unix/sysv/linux/alpha/bits/termios-c_oflag.h
> new file mode 100644
> index 0000000000..6458f6556b
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/alpha/bits/termios-c_oflag.h
> @@ -0,0 +1,66 @@
> +/* termios output mode definitions.  Linux/alpha version.
> +   Copyright (C) 2018 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library.  If not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +#ifndef _TERMIOS_H
> +# error "Never include <bits/termios-c_oflag.h> directly; use <termios.h> instead."
> +#endif
> +
> +/* c_oflag bits */
> +#define OPOST 0000001
> +#define ONLCR 0000002
> +#define OLCUC 0000004
> +
> +#define OCRNL 0000010
> +#define ONOCR 0000020
> +#define ONLRET 0000040
> +
> +#define OFILL 00000100
> +#define OFDEL 00000200
> +#if defined __USE_MISC || defined __USE_XOPEN
> +# define NLDLY 00001400
> +# define   NL0 00000000
> +# define   NL1 00000400
> +# if defined __USE_MISC
> +#  define   NL2 00001000
> +#  define   NL3 00001400
> +# endif
> +# define TABDLY 00006000
> +# define   TAB0 00000000
> +# define   TAB1 00002000
> +# define   TAB2 00004000
> +# define   TAB3 00006000
> +# define CRDLY 00030000
> +# define   CR0 00000000
> +# define   CR1 00010000
> +# define   CR2 00020000
> +# define   CR3 00030000
> +# define FFDLY 00040000
> +# define   FF0 00000000
> +# define   FF1 00040000
> +# define BSDLY 00100000
> +# define   BS0 00000000
> +# define   BS1 00100000
> +#endif
> +
> +#define VTDLY 00200000
> +#define   VT0 00000000
> +#define   VT1 00200000
> +
> +#ifdef __USE_MISC
> +# define XTABS TAB3
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/alpha/bits/termios.h b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
> index 4d49c66aa8..7259c1dd30 100644
> --- a/sysdeps/unix/sysv/linux/alpha/bits/termios.h
> +++ b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
> @@ -27,51 +27,7 @@ typedef unsigned int tcflag_t;
>  #include <bits/termios-struct.h>
>  #include <bits/termios-c_cc.h>
>  #include <bits/termios-c_iflag.h>
> -
> -/* c_oflag bits */
> -#define OPOST 0000001
> -#define ONLCR 0000002
> -#define OLCUC 0000004
> -
> -#define OCRNL 0000010
> -#define ONOCR 0000020
> -#define ONLRET 0000040
> -
> -#define OFILL 00000100
> -#define OFDEL 00000200
> -#if defined __USE_MISC || defined __USE_XOPEN
> -# define NLDLY 00001400
> -# define   NL0 00000000
> -# define   NL1 00000400
> -# if defined __USE_MISC
> -#  define   NL2 00001000
> -#  define   NL3 00001400
> -# endif
> -# define TABDLY 00006000
> -# define   TAB0 00000000
> -# define   TAB1 00002000
> -# define   TAB2 00004000
> -# define   TAB3 00006000
> -# define CRDLY 00030000
> -# define   CR0 00000000
> -# define   CR1 00010000
> -# define   CR2 00020000
> -# define   CR3 00030000
> -# define FFDLY 00040000
> -# define   FF0 00000000
> -# define   FF1 00040000
> -# define BSDLY 00100000
> -# define   BS0 00000000
> -# define   BS1 00100000
> -#endif
> -
> -#define VTDLY 00200000
> -#define   VT0 00000000
> -#define   VT1 00200000
> -
> -#ifdef __USE_MISC
> -# define XTABS TAB3
> -#endif
> +#include <bits/termios-c_oflag.h>
>  
>  /* c_cflag bit meaning */
>  #ifdef __USE_MISC
> diff --git a/sysdeps/unix/sysv/linux/bits/termios-c_oflag.h b/sysdeps/unix/sysv/linux/bits/termios-c_oflag.h
> new file mode 100644
> index 0000000000..038005b1cb
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/bits/termios-c_oflag.h
> @@ -0,0 +1,61 @@
> +/* termios output mode definitions.  Linux/generic version.
> +   Copyright (C) 2018 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library.  If not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +#ifndef _TERMIOS_H
> +# error "Never include <bits/termios-c_oflag.h> directly; use <termios.h> instead."
> +#endif
> +
> +/* c_oflag bits */
> +#define OPOST 0000001  /* Post-process output.  */
> +#define OLCUC 0000002  /* Map lowercase characters to uppercase on output.
> +    (not in POSIX).  */
> +#define ONLCR 0000004  /* Map NL to CR-NL on output.  */
> +#define OCRNL 0000010  /* Map CR to NL on output.  */
> +#define ONOCR 0000020  /* No CR output at column 0.  */
> +#define ONLRET 0000040  /* NL performs CR function.  */
> +#define OFILL 0000100  /* Use fill characters for delay.  */
> +#define OFDEL 0000200  /* Fill is DEL.  */
> +#if defined __USE_MISC || defined __USE_XOPEN
> +# define NLDLY 0000400  /* Select newline delays:  */
> +# define   NL0 0000000  /* Newline type 0.  */
> +# define   NL1 0000400  /* Newline type 1.  */
> +# define CRDLY 0003000  /* Select carriage-return delays:  */
> +# define   CR0 0000000  /* Carriage-return delay type 0.  */
> +# define   CR1 0001000  /* Carriage-return delay type 1.  */
> +# define   CR2 0002000  /* Carriage-return delay type 2.  */
> +# define   CR3 0003000  /* Carriage-return delay type 3.  */
> +# define TABDLY 0014000  /* Select horizontal-tab delays:  */
> +# define   TAB0 0000000  /* Horizontal-tab delay type 0.  */
> +# define   TAB1 0004000  /* Horizontal-tab delay type 1.  */
> +# define   TAB2 0010000  /* Horizontal-tab delay type 2.  */
> +# define   TAB3 0014000  /* Expand tabs to spaces.  */
> +# define BSDLY 0020000  /* Select backspace delays:  */
> +# define   BS0 0000000  /* Backspace-delay type 0.  */
> +# define   BS1 0020000  /* Backspace-delay type 1.  */
> +# define FFDLY 0100000  /* Select form-feed delays:  */
> +# define   FF0 0000000  /* Form-feed delay type 0.  */
> +# define   FF1 0100000  /* Form-feed delay type 1.  */
> +#endif
> +
> +#define VTDLY 0040000  /* Select vertical-tab delays:  */
> +#define   VT0 0000000  /* Vertical-tab delay type 0.  */
> +#define   VT1 0040000  /* Vertical-tab delay type 1.  */
> +
> +#ifdef __USE_MISC
> +# define XTABS 0014000
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/bits/termios.h b/sysdeps/unix/sysv/linux/bits/termios.h
> index 6ce5c56049..15b279b01e 100644
> --- a/sysdeps/unix/sysv/linux/bits/termios.h
> +++ b/sysdeps/unix/sysv/linux/bits/termios.h
> @@ -27,45 +27,7 @@ typedef unsigned int tcflag_t;
>  #include <bits/termios-struct.h>
>  #include <bits/termios-c_cc.h>
>  #include <bits/termios-c_iflag.h>
> -
> -/* c_oflag bits */
> -#define OPOST 0000001
> -#define OLCUC 0000002
> -#define ONLCR 0000004
> -#define OCRNL 0000010
> -#define ONOCR 0000020
> -#define ONLRET 0000040
> -#define OFILL 0000100
> -#define OFDEL 0000200
> -#if defined __USE_MISC || defined __USE_XOPEN
> -# define NLDLY 0000400
> -# define   NL0 0000000
> -# define   NL1 0000400
> -# define CRDLY 0003000
> -# define   CR0 0000000
> -# define   CR1 0001000
> -# define   CR2 0002000
> -# define   CR3 0003000
> -# define TABDLY 0014000
> -# define   TAB0 0000000
> -# define   TAB1 0004000
> -# define   TAB2 0010000
> -# define   TAB3 0014000
> -# define BSDLY 0020000
> -# define   BS0 0000000
> -# define   BS1 0020000
> -# define FFDLY 0100000
> -# define   FF0 0000000
> -# define   FF1 0100000
> -#endif
> -
> -#define VTDLY 0040000
> -#define   VT0 0000000
> -#define   VT1 0040000
> -
> -#ifdef __USE_MISC
> -# define XTABS 0014000
> -#endif
> +#include <bits/termios-c_oflag.h>
>  
>  /* c_cflag bit meaning */
>  #ifdef __USE_MISC
> diff --git a/sysdeps/unix/sysv/linux/mips/bits/termios.h b/sysdeps/unix/sysv/linux/mips/bits/termios.h
> index a8a37ff176..f851adbfe1 100644
> --- a/sysdeps/unix/sysv/linux/mips/bits/termios.h
> +++ b/sysdeps/unix/sysv/linux/mips/bits/termios.h
> @@ -27,45 +27,7 @@ typedef unsigned int tcflag_t;
>  #include <bits/termios-struct.h>
>  #include <bits/termios-c_cc.h>
>  #include <bits/termios-c_iflag.h>
> -
> -/* c_oflag bits */
> -#define OPOST 0000001 /* Perform output processing.  */
> -#define OLCUC 0000002 /* Map lower case to upper case on output.  */
> -#define ONLCR 0000004 /* Map NL to CR-NL on output.  */
> -#define OCRNL 0000010
> -#define ONOCR 0000020
> -#define ONLRET 0000040
> -#define OFILL 0000100
> -#define OFDEL 0000200
> -#if defined __USE_MISC || defined __USE_XOPEN
> -# define NLDLY 0000400
> -# define   NL0 0000000
> -# define   NL1 0000400
> -# define CRDLY 0003000
> -# define   CR0 0000000
> -# define   CR1 0001000
> -# define   CR2 0002000
> -# define   CR3 0003000
> -# define TABDLY 0014000
> -# define   TAB0 0000000
> -# define   TAB1 0004000
> -# define   TAB2 0010000
> -# define   TAB3 0014000
> -# define BSDLY 0020000
> -# define   BS0 0000000
> -# define   BS1 0020000
> -# define FFDLY 0100000
> -# define   FF0 0000000
> -# define   FF1 0100000
> -#endif
> -
> -#define VTDLY 0040000
> -#define   VT0 0000000
> -#define   VT1 0040000
> -
> -#ifdef __USE_MISC
> -# define XTABS  0014000
> -#endif
> +#include <bits/termios-c_oflag.h>
>  
>  /* c_cflag bit meaning */
>  #ifdef __USE_MISC
> diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/termios-c_oflag.h b/sysdeps/unix/sysv/linux/powerpc/bits/termios-c_oflag.h
> new file mode 100644
> index 0000000000..5e944df7cc
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/powerpc/bits/termios-c_oflag.h
> @@ -0,0 +1,65 @@
> +/* termios output mode definitions.  Linux/powerpc version.
> +   Copyright (C) 2018 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library.  If not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +#ifndef _TERMIOS_H
> +# error "Never include <bits/termios-c_oflag.h> directly; use <termios.h> instead."
> +#endif
> +
> +/* c_oflag bits */
> +#define OPOST 0000001
> +#define ONLCR 0000002
> +#define OLCUC 0000004
> +
> +#define OCRNL 0000010
> +#define ONOCR 0000020
> +#define ONLRET 0000040
> +
> +#define OFILL 00000100
> +#define OFDEL 00000200
> +#if defined __USE_MISC || defined __USE_XOPEN
> +# define NLDLY 00001400
> +# define   NL0 00000000
> +# define   NL1 00000400
> +# if defined __USE_MISC
> +#  define   NL2 00001000
> +#  define   NL3 00001400
> +# endif
> +# define TABDLY 00006000
> +# define   TAB0 00000000
> +# define   TAB1 00002000
> +# define   TAB2 00004000
> +# define   TAB3 00006000
> +# define CRDLY 00030000
> +# define   CR0 00000000
> +# define   CR1 00010000
> +# define   CR2 00020000
> +# define   CR3 00030000
> +# define FFDLY 00040000
> +# define   FF0 00000000
> +# define   FF1 00040000
> +# define BSDLY 00100000
> +# define   BS0 00000000
> +# define   BS1 00100000
> +#endif
> +#define VTDLY 00200000
> +#define   VT0 00000000
> +#define   VT1 00200000
> +
> +#ifdef __USE_MISC
> +# define XTABS 00006000
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
> index 4ccabd7095..4045274af9 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
> +++ b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
> @@ -26,50 +26,7 @@ typedef unsigned int tcflag_t;
>  #include <bits/termios-struct.h>
>  #include <bits/termios-c_cc.h>
>  #include <bits/termios-c_iflag.h>
> -
> -/* c_oflag bits */
> -#define OPOST 0000001
> -#define ONLCR 0000002
> -#define OLCUC 0000004
> -
> -#define OCRNL 0000010
> -#define ONOCR 0000020
> -#define ONLRET 0000040
> -
> -#define OFILL 00000100
> -#define OFDEL 00000200
> -#if defined __USE_MISC || defined __USE_XOPEN
> -# define NLDLY 00001400
> -# define   NL0 00000000
> -# define   NL1 00000400
> -# if defined __USE_MISC
> -#  define   NL2 00001000
> -#  define   NL3 00001400
> -# endif
> -# define TABDLY 00006000
> -# define   TAB0 00000000
> -# define   TAB1 00002000
> -# define   TAB2 00004000
> -# define   TAB3 00006000
> -# define CRDLY 00030000
> -# define   CR0 00000000
> -# define   CR1 00010000
> -# define   CR2 00020000
> -# define   CR3 00030000
> -# define FFDLY 00040000
> -# define   FF0 00000000
> -# define   FF1 00040000
> -# define BSDLY 00100000
> -# define   BS0 00000000
> -# define   BS1 00100000
> -#endif
> -#define VTDLY 00200000
> -#define   VT0 00000000
> -#define   VT1 00200000
> -
> -#ifdef __USE_MISC
> -# define XTABS 00006000
> -#endif
> +#include <bits/termios-c_oflag.h>
>  
>  /* c_cflag bit meaning */
>  #ifdef __USE_MISC
> diff --git a/sysdeps/unix/sysv/linux/sparc/bits/termios-c_oflag.h b/sysdeps/unix/sysv/linux/sparc/bits/termios-c_oflag.h
> new file mode 100644
> index 0000000000..fab3072782
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/sparc/bits/termios-c_oflag.h
> @@ -0,0 +1,64 @@
> +/* termios output mode definitions.  Linux/sparc version.
> +   Copyright (C) 2018 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library.  If not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +#ifndef _TERMIOS_H
> +# error "Never include <bits/termios-c_oflag.h> directly; use <termios.h> instead."
> +#endif
> +
> +/* c_oflag bits */
> +#define OPOST 0x00000001
> +#define OLCUC 0x00000002
> +#define ONLCR 0x00000004
> +#define OCRNL 0x00000008
> +#define ONOCR 0x00000010
> +#define ONLRET 0x00000020
> +#define OFILL 0x00000040
> +#define OFDEL 0x00000080
> +#if defined __USE_MISC || defined __USE_XOPEN
> +# define NLDLY 0x00000100
> +# define   NL0 0x00000000
> +# define   NL1 0x00000100
> +# define CRDLY 0x00000600
> +# define   CR0 0x00000000
> +# define   CR1 0x00000200
> +# define   CR2 0x00000400
> +# define   CR3 0x00000600
> +# define TABDLY 0x00001800
> +# define   TAB0 0x00000000
> +# define   TAB1 0x00000800
> +# define   TAB2 0x00001000
> +# define   TAB3 0x00001800
> +# define BSDLY 0x00002000
> +# define   BS0 0x00000000
> +# define   BS1 0x00002000
> +#define FFDLY 0x00008000
> +#define   FF0 0x00000000
> +#define   FF1 0x00008000
> +#endif
> +#define VTDLY 0x00004000
> +#define   VT0 0x00000000
> +#define   VT1 0x00004000
> +
> +# if defined __USE_GNU
> +#define PAGEOUT 0x00010000 /* SUNOS specific */
> +#define WRAP    0x00020000 /* SUNOS specific */
> +# endif
> +
> +#ifdef __USE_MISC
> +# define   XTABS 0x00001800
> +#endif
> diff --git a/sysdeps/unix/sysv/linux/sparc/bits/termios.h b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
> index 4123ed7aaa..9c884eb791 100644
> --- a/sysdeps/unix/sysv/linux/sparc/bits/termios.h
> +++ b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
> @@ -27,49 +27,7 @@ typedef unsigned int tcflag_t;
>  #include <bits/termios-struct.h>
>  #include <bits/termios-c_cc.h>
>  #include <bits/termios-c_iflag.h>
> -
> -/* c_oflag bits */
> -#define OPOST 0x00000001
> -#define OLCUC 0x00000002
> -#define ONLCR 0x00000004
> -#define OCRNL 0x00000008
> -#define ONOCR 0x00000010
> -#define ONLRET 0x00000020
> -#define OFILL 0x00000040
> -#define OFDEL 0x00000080
> -#if defined __USE_MISC || defined __USE_XOPEN
> -# define NLDLY 0x00000100
> -# define   NL0 0x00000000
> -# define   NL1 0x00000100
> -# define CRDLY 0x00000600
> -# define   CR0 0x00000000
> -# define   CR1 0x00000200
> -# define   CR2 0x00000400
> -# define   CR3 0x00000600
> -# define TABDLY 0x00001800
> -# define   TAB0 0x00000000
> -# define   TAB1 0x00000800
> -# define   TAB2 0x00001000
> -# define   TAB3 0x00001800
> -# define BSDLY 0x00002000
> -# define   BS0 0x00000000
> -# define   BS1 0x00002000
> -#define FFDLY 0x00008000
> -#define   FF0 0x00000000
> -#define   FF1 0x00008000
> -#endif
> -#define VTDLY 0x00004000
> -#define   VT0 0x00000000
> -#define   VT1 0x00004000
> -
> -# if defined __USE_GNU
> -#define PAGEOUT 0x00010000 /* SUNOS specific */
> -#define WRAP    0x00020000 /* SUNOS specific */
> -# endif
> -
> -#ifdef __USE_MISC
> -# define   XTABS 0x00001800
> -#endif
> +#include <bits/termios-c_oflag.h>
>  
>  /* c_cflag bit meaning */
>  #ifdef __USE_MISC
>
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 06/12] termios: Consolidate Baud Rate Selection definitions

Adhemerval Zanella-2
In reply to this post by Adhemerval Zanella-2
Ping.

On 15/10/2018 17:49, Adhemerval Zanella wrote:

> This patch consolidates the termios symbolic constants used for baud rates
> selection used along with speed_t on its own header.  The Linux generic
> implementation values match the kernel UAPI and each architecture with
> deviate values have their own implementation (in this case alpha and
> powerpc).
>
> No semantic change is expected, checked on a build against x86_64-linux-gnu,
> alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.
>
> * sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Add
> termios-baud.h.
> * sysdeps/unix/sysv/linux/bits/termios-baud.h: New file.
> * sysdeps/unix/sysv/linux/alpha/bits/termios-baud.h: Likewise.
> * sysdeps/unix/sysv/linux/powerpc/bits/termios-baud.h: Likewise.
> * sysdeps/unix/sysv/linux/alpha/bits/termios.h (B57600, B115200,
> B230400, B460800, B500000, B576000, B921600, B1000000, B1152000,
> B1500000, B2000000, B2500000, B3000000, B3500000, B4000000,
> __MAX_BAUD): Move to termios-baud.h.
> [__USE_MISC] (CBAUD, CBAUDEX): Likewise.
> * sysdeps/unix/sysv/linux/bits/termios.h: Likewise.
> * sysdeps/unix/sysv/linux/mips/bits/termios.h: Likewise.
> * sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise.
> * sysdeps/unix/sysv/linux/sparc/bits/termios.h: Likewise.
> ---
>  sysdeps/unix/sysv/linux/Makefile              |  3 +-
>  .../unix/sysv/linux/alpha/bits/termios-baud.h | 46 ++++++++++++++++++
>  sysdeps/unix/sysv/linux/alpha/bits/termios.h  | 26 +---------
>  sysdeps/unix/sysv/linux/bits/termios-baud.h   | 48 +++++++++++++++++++
>  sysdeps/unix/sysv/linux/bits/termios.h        | 29 +----------
>  sysdeps/unix/sysv/linux/mips/bits/termios.h   | 28 +----------
>  .../sysv/linux/powerpc/bits/termios-baud.h    | 45 +++++++++++++++++
>  .../unix/sysv/linux/powerpc/bits/termios.h    | 25 +---------
>  sysdeps/unix/sysv/linux/sparc/bits/termios.h  | 30 +-----------
>  9 files changed, 149 insertions(+), 131 deletions(-)
>  create mode 100644 sysdeps/unix/sysv/linux/alpha/bits/termios-baud.h
>  create mode 100644 sysdeps/unix/sysv/linux/bits/termios-baud.h
>  create mode 100644 sysdeps/unix/sysv/linux/powerpc/bits/termios-baud.h
>
> diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
> index 097107c82c..1af8145b13 100644
> --- a/sysdeps/unix/sysv/linux/Makefile
> +++ b/sysdeps/unix/sysv/linux/Makefile
> @@ -44,7 +44,8 @@ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
>    bits/procfs.h bits/procfs-id.h bits/procfs-extra.h \
>    bits/procfs-prregset.h bits/mman-map-flags-generic.h \
>    bits/msq-pad.h bits/termios-struct.h bits/termios-c_cc.h \
> -  bits/termios-c_iflag.h bits/termios-c_oflag.h
> +  bits/termios-c_iflag.h bits/termios-c_oflag.h \
> +  bits/termios-baud.h
>  
>  tests += tst-clone tst-clone2 tst-clone3 tst-fanotify tst-personality \
>   tst-quota tst-sync_file_range tst-sysconf-iov_max tst-ttyname \
> diff --git a/sysdeps/unix/sysv/linux/alpha/bits/termios-baud.h b/sysdeps/unix/sysv/linux/alpha/bits/termios-baud.h
> new file mode 100644
> index 0000000000..eba263a67d
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/alpha/bits/termios-baud.h
> @@ -0,0 +1,46 @@
> +/* termios baud rate selection definitions.  Linux/alpha version.
> +   Copyright (C) 2018 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library.  If not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +#ifndef _TERMIOS_H
> +# error "Never include <bits/termios-baud.h> directly; use <termios.h> instead."
> +#endif
> +
> +#ifdef __USE_MISC
> +# define CBAUD 0000037
> +# define CBAUDEX 0000000
> +# define CMSPAR  010000000000 /* mark or space (stick) parity */
> +# define CRTSCTS  020000000000 /* flow control */
> +#endif
> +
> +#define  B57600   00020
> +#define  B115200  00021
> +#define  B230400  00022
> +#define  B460800  00023
> +#define  B500000  00024
> +#define  B576000  00025
> +#define  B921600  00026
> +#define  B1000000 00027
> +#define  B1152000 00030
> +#define  B1500000 00031
> +#define  B2000000 00032
> +#define  B2500000 00033
> +#define  B3000000 00034
> +#define  B3500000 00035
> +#define  B4000000 00036
> +
> +#define __MAX_BAUD B4000000
> diff --git a/sysdeps/unix/sysv/linux/alpha/bits/termios.h b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
> index 7259c1dd30..530dd48410 100644
> --- a/sysdeps/unix/sysv/linux/alpha/bits/termios.h
> +++ b/sysdeps/unix/sysv/linux/alpha/bits/termios.h
> @@ -30,9 +30,6 @@ typedef unsigned int tcflag_t;
>  #include <bits/termios-c_oflag.h>
>  
>  /* c_cflag bit meaning */
> -#ifdef __USE_MISC
> -# define CBAUD 0000037
> -#endif
>  #define  B0 0000000 /* hang up */
>  #define  B50 0000001
>  #define  B75 0000002
> @@ -52,25 +49,8 @@ typedef unsigned int tcflag_t;
>  #ifdef __USE_MISC
>  # define EXTA B19200
>  # define EXTB B38400
> -# define CBAUDEX 0000000
>  #endif
> -#define  B57600   00020
> -#define  B115200  00021
> -#define  B230400  00022
> -#define  B460800  00023
> -#define  B500000  00024
> -#define  B576000  00025
> -#define  B921600  00026
> -#define  B1000000 00027
> -#define  B1152000 00030
> -#define  B1500000 00031
> -#define  B2000000 00032
> -#define  B2500000 00033
> -#define  B3000000 00034
> -#define  B3500000 00035
> -#define  B4000000 00036
> -
> -#define __MAX_BAUD B4000000
> +#include <bits/termios-baud.h>
>  
>  #define CSIZE 00001400
>  #define   CS5 00000000
> @@ -85,10 +65,6 @@ typedef unsigned int tcflag_t;
>  #define HUPCL 00040000
>  
>  #define CLOCAL 00100000
> -#ifdef __USE_MISC
> -# define CMSPAR  010000000000 /* mark or space (stick) parity */
> -# define CRTSCTS  020000000000 /* flow control */
> -#endif
>  
>  /* c_lflag bits */
>  #define ISIG 0x00000080
> diff --git a/sysdeps/unix/sysv/linux/bits/termios-baud.h b/sysdeps/unix/sysv/linux/bits/termios-baud.h
> new file mode 100644
> index 0000000000..7f7f9c511c
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/bits/termios-baud.h
> @@ -0,0 +1,48 @@
> +/* termios baud rate selection definitions.  Linux/generic version.
> +   Copyright (C) 2018 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library.  If not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +#ifndef _TERMIOS_H
> +# error "Never include <bits/termios-baud.h> directly; use <termios.h> instead."
> +#endif
> +
> +#ifdef __USE_MISC
> +# define CBAUD 000000010017 /* Baud speed mask (not in POSIX).  */
> +# define CBAUDEX 000000010000 /* Extra baud speed mask, included in CBAUD.
> + (not in POSIX).  */
> +# define CIBAUD 002003600000 /* Input baud rate (not used).  */
> +# define CMSPAR  010000000000 /* Mark or space (stick) parity.  */
> +# define CRTSCTS 020000000000 /* Flow control.  */
> +#endif
> +
> +/* Extra output baud rates (not in POSIX).  */
> +#define  B57600    0010001
> +#define  B115200   0010002
> +#define  B230400   0010003
> +#define  B460800   0010004
> +#define  B500000   0010005
> +#define  B576000   0010006
> +#define  B921600   0010007
> +#define  B1000000  0010010
> +#define  B1152000  0010011
> +#define  B1500000  0010012
> +#define  B2000000  0010013
> +#define  B2500000  0010014
> +#define  B3000000  0010015
> +#define  B3500000  0010016
> +#define  B4000000  0010017
> +#define __MAX_BAUD B4000000
> diff --git a/sysdeps/unix/sysv/linux/bits/termios.h b/sysdeps/unix/sysv/linux/bits/termios.h
> index 15b279b01e..07ffdf9779 100644
> --- a/sysdeps/unix/sysv/linux/bits/termios.h
> +++ b/sysdeps/unix/sysv/linux/bits/termios.h
> @@ -30,9 +30,6 @@ typedef unsigned int tcflag_t;
>  #include <bits/termios-c_oflag.h>
>  
>  /* c_cflag bit meaning */
> -#ifdef __USE_MISC
> -# define CBAUD 0010017
> -#endif
>  #define  B0 0000000 /* hang up */
>  #define  B50 0000001
>  #define  B75 0000002
> @@ -53,6 +50,8 @@ typedef unsigned int tcflag_t;
>  # define EXTA B19200
>  # define EXTB B38400
>  #endif
> +#include <bits/termios-baud.h>
> +
>  #define CSIZE 0000060
>  #define   CS5 0000000
>  #define   CS6 0000020
> @@ -64,30 +63,6 @@ typedef unsigned int tcflag_t;
>  #define PARODD 0001000
>  #define HUPCL 0002000
>  #define CLOCAL 0004000
> -#ifdef __USE_MISC
> -# define CBAUDEX 0010000
> -#endif
> -#define  B57600   0010001
> -#define  B115200  0010002
> -#define  B230400  0010003
> -#define  B460800  0010004
> -#define  B500000  0010005
> -#define  B576000  0010006
> -#define  B921600  0010007
> -#define  B1000000 0010010
> -#define  B1152000 0010011
> -#define  B1500000 0010012
> -#define  B2000000 0010013
> -#define  B2500000 0010014
> -#define  B3000000 0010015
> -#define  B3500000 0010016
> -#define  B4000000 0010017
> -#define __MAX_BAUD B4000000
> -#ifdef __USE_MISC
> -# define CIBAUD  002003600000 /* input baud rate (not used) */
> -# define CMSPAR   010000000000 /* mark or space (stick) parity */
> -# define CRTSCTS  020000000000 /* flow control */
> -#endif
>  
>  /* c_lflag bits */
>  #define ISIG 0000001
> diff --git a/sysdeps/unix/sysv/linux/mips/bits/termios.h b/sysdeps/unix/sysv/linux/mips/bits/termios.h
> index f851adbfe1..008527577f 100644
> --- a/sysdeps/unix/sysv/linux/mips/bits/termios.h
> +++ b/sysdeps/unix/sysv/linux/mips/bits/termios.h
> @@ -30,9 +30,6 @@ typedef unsigned int tcflag_t;
>  #include <bits/termios-c_oflag.h>
>  
>  /* c_cflag bit meaning */
> -#ifdef __USE_MISC
> -# define CBAUD 0010017
> -#endif
>  #define  B0 0000000 /* hang up */
>  #define  B50 0000001
>  #define  B75 0000002
> @@ -53,6 +50,8 @@ typedef unsigned int tcflag_t;
>  # define EXTA B19200
>  # define EXTB B38400
>  #endif
> +#include <bits/termios-baud.h>
> +
>  #define CSIZE 0000060 /* Number of bits per byte (mask).  */
>  #define   CS5 0000000 /* 5 bits per byte.  */
>  #define   CS6 0000020 /* 6 bits per byte.  */
> @@ -64,29 +63,6 @@ typedef unsigned int tcflag_t;
>  #define PARODD 0001000 /* Odd parity instead of even.  */
>  #define HUPCL 0002000 /* Hang up on last close.  */
>  #define CLOCAL 0004000 /* Ignore modem status lines.  */
> -#ifdef __USE_MISC
> -# define CBAUDEX   0010000
> -#endif
> -#define  B57600   0010001
> -#define  B115200  0010002
> -#define  B230400  0010003
> -#define  B460800  0010004
> -#define  B500000  0010005
> -#define  B576000  0010006
> -#define  B921600  0010007
> -#define  B1000000 0010010
> -#define  B1152000 0010011
> -#define  B1500000 0010012
> -#define  B2000000 0010013
> -#define  B2500000 0010014
> -#define  B3000000 0010015
> -#define  B3500000 0010016
> -#define  B4000000 0010017
> -#define __MAX_BAUD B4000000
> -#ifdef __USE_MISC
> -# define CIBAUD  002003600000 /* input baud rate (not used) */
> -# define CRTSCTS  020000000000 /* flow control */
> -#endif
>  
>  /* c_lflag bits */
>  #define ISIG 0000001 /* Enable signals.  */
> diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/termios-baud.h b/sysdeps/unix/sysv/linux/powerpc/bits/termios-baud.h
> new file mode 100644
> index 0000000000..4f490a929f
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/powerpc/bits/termios-baud.h
> @@ -0,0 +1,45 @@
> +/* termios baud rate selection definitions.  Linux/powerpc version.
> +   Copyright (C) 2018 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library.  If not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +#ifndef _TERMIOS_H
> +# error "Never include <bits/termios-baud.h> directly; use <termios.h> instead."
> +#endif
> +
> +#ifdef __USE_MISC
> +# define CBAUD 0000377
> +# define CBAUDEX 0000020
> +# define CMSPAR   010000000000 /* mark or space (stick) parity */
> +# define CRTSCTS  020000000000 /* flow control */
> +#endif
> +
> +#define  B57600   00020
> +#define  B115200  00021
> +#define  B230400  00022
> +#define  B460800  00023
> +#define  B500000  00024
> +#define  B576000  00025
> +#define  B921600  00026
> +#define  B1000000 00027
> +#define  B1152000 00030
> +#define  B1500000 00031
> +#define  B2000000 00032
> +#define  B2500000 00033
> +#define  B3000000 00034
> +#define  B3500000 00035
> +#define  B4000000 00036
> +#define __MAX_BAUD B4000000
> diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
> index 4045274af9..2f928d5217 100644
> --- a/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
> +++ b/sysdeps/unix/sysv/linux/powerpc/bits/termios.h
> @@ -29,9 +29,6 @@ typedef unsigned int tcflag_t;
>  #include <bits/termios-c_oflag.h>
>  
>  /* c_cflag bit meaning */
> -#ifdef __USE_MISC
> -# define CBAUD 0000377
> -#endif
>  #define  B0 0000000 /* hang up */
>  #define  B50 0000001
>  #define  B75 0000002
> @@ -51,24 +48,8 @@ typedef unsigned int tcflag_t;
>  #ifdef __USE_MISC
>  # define EXTA B19200
>  # define EXTB B38400
> -# define CBAUDEX 0000020
>  #endif
> -#define  B57600   00020
> -#define  B115200  00021
> -#define  B230400  00022
> -#define  B460800  00023
> -#define  B500000  00024
> -#define  B576000  00025
> -#define  B921600  00026
> -#define  B1000000 00027
> -#define  B1152000 00030
> -#define  B1500000 00031
> -#define  B2000000 00032
> -#define  B2500000 00033
> -#define  B3000000 00034
> -#define  B3500000 00035
> -#define  B4000000 00036
> -#define __MAX_BAUD B4000000
> +#include <bits/termios-baud.h>
>  
>  #define CSIZE 00001400
>  #define   CS5 00000000
> @@ -83,10 +64,6 @@ typedef unsigned int tcflag_t;
>  #define HUPCL 00040000
>  
>  #define CLOCAL 00100000
> -#ifdef __USE_MISC
> -# define CMSPAR   010000000000 /* mark or space (stick) parity */
> -# define CRTSCTS  020000000000 /* flow control */
> -#endif
>  
>  /* c_lflag bits */
>  #define ISIG 0x00000080
> diff --git a/sysdeps/unix/sysv/linux/sparc/bits/termios.h b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
> index 9c884eb791..d612080754 100644
> --- a/sysdeps/unix/sysv/linux/sparc/bits/termios.h
> +++ b/sysdeps/unix/sysv/linux/sparc/bits/termios.h
> @@ -30,9 +30,6 @@ typedef unsigned int tcflag_t;
>  #include <bits/termios-c_oflag.h>
>  
>  /* c_cflag bit meaning */
> -#ifdef __USE_MISC
> -# define CBAUD 0x0000100f
> -#endif
>  #define  B0 0x00000000 /* hang up */
>  #define  B50 0x00000001
>  #define  B75 0x00000002
> @@ -53,6 +50,8 @@ typedef unsigned int tcflag_t;
>  # define EXTA    B19200
>  # define EXTB    B38400
>  #endif
> +#include <bits/termios-baud.h>
> +
>  #define  CSIZE  0x00000030
>  #define   CS5 0x00000000
>  #define   CS6 0x00000010
> @@ -64,31 +63,6 @@ typedef unsigned int tcflag_t;
>  #define PARODD 0x00000200
>  #define HUPCL 0x00000400
>  #define CLOCAL 0x00000800
> -#ifdef __USE_MISC
> -# define CBAUDEX 0x00001000
> -#endif
> -#define  B57600  0x00001001
> -#define  B115200 0x00001002
> -#define  B230400 0x00001003
> -#define  B460800 0x00001004
> -#define  B76800  0x00001005
> -#define  B153600 0x00001006
> -#define  B307200 0x00001007
> -#define  B614400 0x00001008
> -#define  B921600 0x00001009
> -#define  B500000 0x0000100a
> -#define  B576000 0x0000100b
> -#define B1000000 0x0000100c
> -#define B1152000 0x0000100d
> -#define B1500000 0x0000100e
> -#define B2000000 0x0000100f
> -#define __MAX_BAUD B2000000
> -
> -#ifdef __USE_MISC
> -# define CIBAUD 0x100f0000 /* input baud rate (not used) */
> -# define CMSPAR 0x40000000 /* mark or space (stick) parity */
> -# define CRTSCTS 0x80000000 /* flow control */
> -#endif
>  
>  /* c_lflag bits */
>  #define ISIG 0x00000001
>
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 03/12] termios: Consolidate termios c_cc symbolic constants

Gabriel F. T. Gomes-2
In reply to this post by Adhemerval Zanella-2
>On 15/10/2018 17:49, Adhemerval Zanella wrote:
>> This patch consolidates the termios symbolic constants used as subscript
>> for the array c_cc on its own header.  The Linux generic implementation
>> values match the kernel UAPI and each architecture with deviate values
>> have their own implementation (in this case alpha, mips64, and sparc64).

Although I don't feel very qualified to review this patch set, one detail
caught my attention here.  You mentioned that alpha, mips64, and sparc64
have their own implementation, however, it looks like powerpc also does
(and you have carefully taken care of it, as I can see in the patch).

So, is the message missing a mention to powerpc, or is there something
else going on?

>> No semantic change is expected, checked on a build against x86_64-linux-gnu,
>> alpha-linux-gnu, mips64-linux-gnu, and sparc64-linux-gnu.

I started a build on a powerpc64 machine.

Other than the message not mentioning powerpc, the patch looks good, but,
as I mentioned previously, I don't think I'm qualified to review it.
12