diff --git a/sysdeps/unix/sysv/linux/bits/termios-baud.h b/bits/termios-baud.h similarity index 51% rename from sysdeps/unix/sysv/linux/bits/termios-baud.h rename to bits/termios-baud.h index 1e41338b57..bafde1a650 100644 --- a/sysdeps/unix/sysv/linux/bits/termios-baud.h +++ b/bits/termios-baud.h @@ -1,4 +1,4 @@ -/* termios baud rate selection definitions. Linux/generic version. +/* termios baud rate selection definitions. Universal version for sane speed_t. Copyright (C) 2019-2025 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -20,37 +20,44 @@ # error "Never include directly; use instead." #endif -#define B0 0U -#define B50 50U -#define B75 75U -#define B110 110U -#define B134 134U -#define B150 150U -#define B200 200U -#define B300 300U -#define B600 600U -#define B1200 1200U -#define B1800 1800U -#define B2400 2400U -#define B4800 4800U -#define B7200 7200U -#define B9600 9600U -#define B14400 14400U -#define B19200 19200U -#define B28800 28800U -#define B33600 33600U -#define B38400 38400U -#define B57600 57600U -#define B76800 76800U -#define B115200 115200U -#define B153600 153600U -#define B230400 230400U -#define B307200 307200U -#define B460800 460800U -#define B500000 500000U -#define B576000 576000U -#define B614400 614400U -#define B921600 921600U +/* POSIX required baud rates */ +#define B0 0U /* Hang up or ispeed == ospeed */ +#define B50 50U +#define B75 75U +#define B110 110U +#define B134 134U /* Really 134.5 baud by POSIX spec */ +#define B150 150U +#define B200 200U +#define B300 300U +#define B600 600U +#define B1200 1200U +#define B1800 1800U +#define B2400 2400U +#define B4800 4800U +#define B9600 9600U +#define B19200 19200U +#define B38400 38400U +#ifdef __USE_MISC +# define EXTA B19200 +# define EXTB B38400 +#endif + +/* Other baud rates, "nonstandard" but known to be used */ +#define B7200 7200U +#define B14400 14400U +#define B28800 28800U +#define B33600 33600U +#define B57600 57600U +#define B76800 76800U +#define B115200 115200U +#define B153600 153600U +#define B230400 230400U +#define B307200 307200U +#define B460800 460800U +#define B500000 500000U +#define B576000 576000U +#define B614400 614400U +#define B921600 921600U #define B1000000 1000000U #define B1152000 1152000U #define B1500000 1500000U @@ -59,5 +66,7 @@ #define B3000000 3000000U #define B3500000 3500000U #define B4000000 4000000U +#define B5000000 5000000U +#define B10000000 10000000U #define __MAX_BAUD 4294967295U diff --git a/bits/termios.h b/bits/termios.h index 398efa5ddd..8f0b817dbf 100644 --- a/bits/termios.h +++ b/bits/termios.h @@ -20,6 +20,8 @@ # error "Never include directly; use instead." #endif +#include + /* These macros are also defined in some files (with numerically identical values), but this serves to shut up cpp's complaining. */ @@ -285,45 +287,6 @@ struct termios /* Input and output baud rates. */ speed_t __ispeed, __ospeed; -#define B0 0 /* Hang up. */ -#define B50 50 /* 50 baud. */ -#define B75 75 /* 75 baud. */ -#define B110 110 /* 110 baud. */ -#define B134 134 /* 134.5 baud. */ -#define B150 150 /* 150 baud. */ -#define B200 200 /* 200 baud. */ -#define B300 300 /* 300 baud. */ -#define B600 600 /* 600 baud. */ -#define B1200 1200 /* 1200 baud. */ -#define B1800 1800 /* 1800 baud. */ -#define B2400 2400 /* 2400 baud. */ -#define B4800 4800 /* 4800 baud. */ -#define B9600 9600 /* 9600 baud. */ -#define B7200 7200 /* 7200 baud. */ -#define B14400 14400 /* 14400 baud. */ -#define B19200 19200 /* 19200 baud. */ -#define B28800 28800 /* 28800 baud. */ -#define B38400 38400 /* 38400 baud. */ -#ifdef __USE_MISC -# define EXTA 19200 -# define EXTB 38400 -#endif -#define B57600 57600 -#define B76800 76800 -#define B115200 115200 -#define B230400 230400 -#define B460800 460800 -#define B500000 500000 -#define B576000 576000 -#define B921600 921600 -#define B1000000 1000000 -#define B1152000 1152000 -#define B1500000 1500000 -#define B2000000 2000000 -#define B2500000 2500000 -#define B3000000 3000000 -#define B3500000 3500000 -#define B4000000 4000000 }; #define _IOT_termios /* Hurd ioctl type field. */ \ diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index ebcf820403..a14b8c1f61 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -151,7 +151,6 @@ sysdep_headers += \ bits/struct_stat.h \ bits/struct_stat_time64_helper.h \ bits/syscall.h \ - bits/termios-baud.h \ bits/termios-c_cc.h \ bits/termios-c_cflag.h \ bits/termios-c_iflag.h \ diff --git a/sysdeps/unix/sysv/linux/bits/termios.h b/sysdeps/unix/sysv/linux/bits/termios.h index 14de3fcb55..20746a0727 100644 --- a/sysdeps/unix/sysv/linux/bits/termios.h +++ b/sysdeps/unix/sysv/linux/bits/termios.h @@ -35,6 +35,7 @@ typedef unsigned int tcflag_t; /* c_cflag bit meaning */ #include +#ifdef __USE_MISC #define __B0 0000000 /* hang up */ #define __B50 0000001 #define __B75 0000002 @@ -53,9 +54,8 @@ typedef unsigned int tcflag_t; #define __B38400 0000017 #include -#ifdef __USE_MISC -# define EXTA __B19200 -# define EXTB __B38400 +# define __EXTA __B19200 +# define __EXTB __B38400 # define BOTHER __BOTHER #endif diff --git a/termios/Makefile b/termios/Makefile index 08075424cb..43235346f2 100644 --- a/termios/Makefile +++ b/termios/Makefile @@ -22,8 +22,8 @@ subdir := termios include ../Makeconfig -headers := termios.h bits/termios.h sys/ttydefaults.h sys/termios.h \ - sys/ttychars.h +headers := termios.h bits/termios.h bits/termios-baud.h \ + sys/ttydefaults.h sys/termios.h sys/ttychars.h routines := speed cfsetspeed tcsetattr tcgetattr tcgetpgrp tcsetpgrp \ tcdrain tcflow tcflush tcsendbrk cfmakeraw tcgetsid