mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-23 13:30:06 +00:00
5a82c74822
Also, change sources.redhat.com to sourceware.org. This patch was automatically generated by running the following shell script, which uses GNU sed, and which avoids modifying files imported from upstream: sed -ri ' s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g ' \ $(find $(git ls-files) -prune -type f \ ! -name '*.po' \ ! -name 'ChangeLog*' \ ! -path COPYING ! -path COPYING.LIB \ ! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \ ! -path manual/texinfo.tex ! -path scripts/config.guess \ ! -path scripts/config.sub ! -path scripts/install-sh \ ! -path scripts/mkinstalldirs ! -path scripts/move-if-change \ ! -path INSTALL ! -path locale/programs/charmap-kw.h \ ! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \ ! '(' -name configure \ -execdir test -f configure.ac -o -f configure.in ';' ')' \ ! '(' -name preconfigure \ -execdir test -f preconfigure.ac ';' ')' \ -print) and then by running 'make dist-prepare' to regenerate files built from the altered files, and then executing the following to cleanup: chmod a+x sysdeps/unix/sysv/linux/riscv/configure # Omit irrelevant whitespace and comment-only changes, # perhaps from a slightly-different Autoconf version. git checkout -f \ sysdeps/csky/configure \ sysdeps/hppa/configure \ sysdeps/riscv/configure \ sysdeps/unix/sysv/linux/csky/configure # Omit changes that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines git checkout -f \ sysdeps/powerpc/powerpc64/ppc-mcount.S \ sysdeps/unix/sysv/linux/s390/s390-64/syscall.S # Omit change that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
162 lines
3.0 KiB
C
162 lines
3.0 KiB
C
/* Copyright (C) 1992-2019 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
|
|
<https://www.gnu.org/licenses/>. */
|
|
|
|
#include <termios.h>
|
|
#include <errno.h>
|
|
#include <stddef.h>
|
|
|
|
struct speed_struct
|
|
{
|
|
speed_t value;
|
|
speed_t internal;
|
|
};
|
|
|
|
static const struct speed_struct speeds[] =
|
|
{
|
|
#ifdef B0
|
|
{ 0, B0 },
|
|
#endif
|
|
#ifdef B50
|
|
{ 50, B50 },
|
|
#endif
|
|
#ifdef B75
|
|
{ 75, B75 },
|
|
#endif
|
|
#ifdef B110
|
|
{ 110, B110 },
|
|
#endif
|
|
#ifdef B134
|
|
{ 134, B134 },
|
|
#endif
|
|
#ifdef B150
|
|
{ 150, B150 },
|
|
#endif
|
|
#ifdef B200
|
|
{ 200, B200 },
|
|
#endif
|
|
#ifdef B300
|
|
{ 300, B300 },
|
|
#endif
|
|
#ifdef B600
|
|
{ 600, B600 },
|
|
#endif
|
|
#ifdef B1200
|
|
{ 1200, B1200 },
|
|
#endif
|
|
#ifdef B1200
|
|
{ 1200, B1200 },
|
|
#endif
|
|
#ifdef B1800
|
|
{ 1800, B1800 },
|
|
#endif
|
|
#ifdef B2400
|
|
{ 2400, B2400 },
|
|
#endif
|
|
#ifdef B4800
|
|
{ 4800, B4800 },
|
|
#endif
|
|
#ifdef B9600
|
|
{ 9600, B9600 },
|
|
#endif
|
|
#ifdef B19200
|
|
{ 19200, B19200 },
|
|
#endif
|
|
#ifdef B38400
|
|
{ 38400, B38400 },
|
|
#endif
|
|
#ifdef B57600
|
|
{ 57600, B57600 },
|
|
#endif
|
|
#ifdef B76800
|
|
{ 76800, B76800 },
|
|
#endif
|
|
#ifdef B115200
|
|
{ 115200, B115200 },
|
|
#endif
|
|
#ifdef B153600
|
|
{ 153600, B153600 },
|
|
#endif
|
|
#ifdef B230400
|
|
{ 230400, B230400 },
|
|
#endif
|
|
#ifdef B307200
|
|
{ 307200, B307200 },
|
|
#endif
|
|
#ifdef B460800
|
|
{ 460800, B460800 },
|
|
#endif
|
|
#ifdef B500000
|
|
{ 500000, B500000 },
|
|
#endif
|
|
#ifdef B576000
|
|
{ 576000, B576000 },
|
|
#endif
|
|
#ifdef B921600
|
|
{ 921600, B921600 },
|
|
#endif
|
|
#ifdef B1000000
|
|
{ 1000000, B1000000 },
|
|
#endif
|
|
#ifdef B1152000
|
|
{ 1152000, B1152000 },
|
|
#endif
|
|
#ifdef B1500000
|
|
{ 1500000, B1500000 },
|
|
#endif
|
|
#ifdef B2000000
|
|
{ 2000000, B2000000 },
|
|
#endif
|
|
#ifdef B2500000
|
|
{ 2500000, B2500000 },
|
|
#endif
|
|
#ifdef B3000000
|
|
{ 3000000, B3000000 },
|
|
#endif
|
|
#ifdef B3500000
|
|
{ 3500000, B3500000 },
|
|
#endif
|
|
#ifdef B4000000
|
|
{ 4000000, B4000000 },
|
|
#endif
|
|
};
|
|
|
|
|
|
/* Set both the input and output baud rates stored in *TERMIOS_P to SPEED. */
|
|
int
|
|
cfsetspeed (struct termios *termios_p, speed_t speed)
|
|
{
|
|
size_t cnt;
|
|
|
|
for (cnt = 0; cnt < sizeof (speeds) / sizeof (speeds[0]); ++cnt)
|
|
if (speed == speeds[cnt].internal)
|
|
{
|
|
cfsetispeed (termios_p, speed);
|
|
cfsetospeed (termios_p, speed);
|
|
return 0;
|
|
}
|
|
else if (speed == speeds[cnt].value)
|
|
{
|
|
cfsetispeed (termios_p, speeds[cnt].internal);
|
|
cfsetospeed (termios_p, speeds[cnt].internal);
|
|
return 0;
|
|
}
|
|
|
|
__set_errno (EINVAL);
|
|
|
|
return -1;
|
|
}
|