diff options
Diffstat (limited to 'termios')
-rw-r--r-- | termios/Makefile | 33 | ||||
-rw-r--r-- | termios/Versions | 14 | ||||
-rw-r--r-- | termios/cfmakeraw.c | 31 | ||||
-rw-r--r-- | termios/cfsetspeed.c | 161 | ||||
-rw-r--r-- | termios/speed.c | 65 | ||||
-rw-r--r-- | termios/sys/termios.h | 4 | ||||
-rw-r--r-- | termios/sys/ttychars.h | 61 | ||||
-rw-r--r-- | termios/tcdrain.c | 37 | ||||
-rw-r--r-- | termios/tcflow.c | 49 | ||||
-rw-r--r-- | termios/tcflush.c | 42 | ||||
-rw-r--r-- | termios/tcgetattr.c | 42 | ||||
-rw-r--r-- | termios/tcgetpgrp.c | 36 | ||||
-rw-r--r-- | termios/tcgetsid.c | 62 | ||||
-rw-r--r-- | termios/tcsendbrk.c | 36 | ||||
-rw-r--r-- | termios/tcsetattr.c | 106 | ||||
-rw-r--r-- | termios/tcsetpgrp.c | 37 | ||||
-rw-r--r-- | termios/termios.h | 109 |
17 files changed, 0 insertions, 925 deletions
diff --git a/termios/Makefile b/termios/Makefile deleted file mode 100644 index ac14a854df..0000000000 --- a/termios/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright (C) 1991-2017 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/>. - -# -# Makefile for the terminal I/O functions. -# -subdir := termios - -include ../Makeconfig - -headers := termios.h bits/termios.h sys/ttydefaults.h sys/termios.h \ - sys/ttychars.h - -routines := speed cfsetspeed tcsetattr tcgetattr tcgetpgrp tcsetpgrp \ - tcdrain tcflow tcflush tcsendbrk cfmakeraw tcgetsid - -include ../Rules - -CFLAGS-tcdrain.c = -fexceptions -fasynchronous-unwind-tables diff --git a/termios/Versions b/termios/Versions deleted file mode 100644 index 711ed0334b..0000000000 --- a/termios/Versions +++ /dev/null @@ -1,14 +0,0 @@ -libc { - GLIBC_2.0 { - # c* - cfgetispeed; cfgetospeed; cfmakeraw; cfsetispeed; cfsetospeed; cfsetspeed; - - # t* - tcdrain; tcflow; tcflush; tcgetattr; tcgetpgrp; tcsendbreak; tcsetattr; - tcsetpgrp; - } - GLIBC_2.1 { - # t* - tcgetsid; - } -} diff --git a/termios/cfmakeraw.c b/termios/cfmakeraw.c deleted file mode 100644 index 0f97ce66d2..0000000000 --- a/termios/cfmakeraw.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 1992-2017 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/>. */ - -#include <termios.h> - -/* Set *T to indicate raw mode. */ -void -cfmakeraw (struct termios *t) -{ - t->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON); - t->c_oflag &= ~OPOST; - t->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN); - t->c_cflag &= ~(CSIZE|PARENB); - t->c_cflag |= CS8; - t->c_cc[VMIN] = 1; /* read returns when one char is available. */ - t->c_cc[VTIME] = 0; -} diff --git a/termios/cfsetspeed.c b/termios/cfsetspeed.c deleted file mode 100644 index c836e8d3cd..0000000000 --- a/termios/cfsetspeed.c +++ /dev/null @@ -1,161 +0,0 @@ -/* Copyright (C) 1992-2017 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/>. */ - -#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; -} diff --git a/termios/speed.c b/termios/speed.c deleted file mode 100644 index e5e4acaa87..0000000000 --- a/termios/speed.c +++ /dev/null @@ -1,65 +0,0 @@ -/* `struct termios' speed frobnication functions. 4.4 BSD/generic GNU version. - Copyright (C) 1991-2017 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/>. */ - -#include <stddef.h> -#include <errno.h> -#include <termios.h> - -/* Return the output baud rate stored in *TERMIOS_P. */ -speed_t -cfgetospeed (const struct termios *termios_p) -{ - return termios_p->__ospeed; -} - -/* Return the input baud rate stored in *TERMIOS_P. */ -speed_t -cfgetispeed (const struct termios *termios_p) -{ - return termios_p->__ispeed; -} - -/* Set the output baud rate stored in *TERMIOS_P to SPEED. */ -int -cfsetospeed (struct termios *termios_p, speed_t speed) -{ - if (termios_p == NULL) - { - __set_errno (EINVAL); - return -1; - } - - termios_p->__ospeed = speed; - return 0; -} -libc_hidden_def (cfsetospeed) - -/* Set the input baud rate stored in *TERMIOS_P to SPEED. */ -int -cfsetispeed (struct termios *termios_p, speed_t speed) -{ - if (termios_p == NULL) - { - __set_errno (EINVAL); - return -1; - } - - termios_p->__ispeed = speed; - return 0; -} -libc_hidden_def (cfsetispeed) diff --git a/termios/sys/termios.h b/termios/sys/termios.h deleted file mode 100644 index 3e18805ab4..0000000000 --- a/termios/sys/termios.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef _SYS_TERMIOS_H -#define _SYS_TERMIOS_H -#include <termios.h> -#endif diff --git a/termios/sys/ttychars.h b/termios/sys/ttychars.h deleted file mode 100644 index 7043f60f81..0000000000 --- a/termios/sys/ttychars.h +++ /dev/null @@ -1,61 +0,0 @@ -/*- - * Copyright (c) 1982, 1986, 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)ttychars.h 8.2 (Berkeley) 1/4/94 - */ - -/* - * 4.3 COMPATIBILITY FILE - * - * User visible structures and constants related to terminal handling. - */ -#ifndef _SYS_TTYCHARS_H -#define _SYS_TTYCHARS_H 1 - -struct ttychars { - char tc_erase; /* erase last character */ - char tc_kill; /* erase entire line */ - char tc_intrc; /* interrupt */ - char tc_quitc; /* quit */ - char tc_startc; /* start output */ - char tc_stopc; /* stop output */ - char tc_eofc; /* end-of-file */ - char tc_brkc; /* input delimiter (like nl) */ - char tc_suspc; /* stop process signal */ - char tc_dsuspc; /* delayed stop process signal */ - char tc_rprntc; /* reprint line */ - char tc_flushc; /* flush output (toggles) */ - char tc_werasc; /* word erase */ - char tc_lnextc; /* literal next character */ -}; - -#ifdef __USE_OLD_TTY -#include <sys/ttydefaults.h> /* to pick up character defaults */ -#endif - -#endif /* sys/ttychars.h */ diff --git a/termios/tcdrain.c b/termios/tcdrain.c deleted file mode 100644 index edd892decb..0000000000 --- a/termios/tcdrain.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (C) 1991-2017 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/>. */ - -#include <errno.h> -#include <termios.h> - -/* Wait for pending output to be written on FD. */ -int -__libc_tcdrain (int fd) -{ - if (fd < 0) - { - __set_errno (EBADF); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -weak_alias (__libc_tcdrain, tcdrain) - - -stub_warning (tcdrain) diff --git a/termios/tcflow.c b/termios/tcflow.c deleted file mode 100644 index 728112d8e2..0000000000 --- a/termios/tcflow.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright (C) 1991-2017 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/>. */ - -#include <errno.h> -#include <termios.h> - -/* Suspend or restart transmission on FD. */ -int -tcflow (int fd, int action) -{ - if (fd < 0) - { - __set_errno (EBADF); - return -1; - } - - switch (action) - { - case TCOOFF: - case TCOON: - case TCIOFF: - case TCION: - break; - - default: - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} - - -stub_warning (tcflow) diff --git a/termios/tcflush.c b/termios/tcflush.c deleted file mode 100644 index 9d0c1fb912..0000000000 --- a/termios/tcflush.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (C) 1991-2017 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/>. */ - -#include <errno.h> -#include <termios.h> - -/* Flush pending data on FD. */ -int -tcflush (int fd, int queue_selector) -{ - switch (queue_selector) - { - case TCIFLUSH: - case TCOFLUSH: - case TCIOFLUSH: - break; - - default: - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} - - -stub_warning(tcflush); diff --git a/termios/tcgetattr.c b/termios/tcgetattr.c deleted file mode 100644 index a5c076b1b0..0000000000 --- a/termios/tcgetattr.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (C) 1991-2017 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/>. */ - -#include <errno.h> -#include <stddef.h> -#include <termios.h> - -/* Put the state of FD into *TERMIOS_P. */ -int -__tcgetattr (int fd, struct termios *termios_p) -{ - if (fd < 0) - { - __set_errno (EBADF); - return -1; - } - if (termios_p == NULL) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -stub_warning (tcgetattr) - -weak_alias (__tcgetattr, tcgetattr) diff --git a/termios/tcgetpgrp.c b/termios/tcgetpgrp.c deleted file mode 100644 index 94a1c751ec..0000000000 --- a/termios/tcgetpgrp.c +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (C) 1991-2017 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/>. */ - -#include <errno.h> -#include <unistd.h> -#include <sys/types.h> - -/* Return the foreground process group ID of FD. */ -pid_t -tcgetpgrp (int fd) -{ - if (fd < 0) - { - __set_errno (EBADF); - return (pid_t) -1; - } - - __set_errno (ENOSYS); - return (pid_t) -1; -} -libc_hidden_def (tcgetpgrp) -stub_warning (tcgetpgrp) diff --git a/termios/tcgetsid.c b/termios/tcgetsid.c deleted file mode 100644 index e49e6b12dd..0000000000 --- a/termios/tcgetsid.c +++ /dev/null @@ -1,62 +0,0 @@ -/* Copyright (C) 1997-2017 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/>. */ - -#include <errno.h> -#include <termios.h> -#include <sys/ioctl.h> -#include <sys/types.h> -#include <unistd.h> - -/* Return the session ID of FD. */ -pid_t -tcgetsid (int fd) -{ - pid_t pgrp; - pid_t sid; -#ifdef TIOCGSID - static int tiocgsid_does_not_work; - - if (! tiocgsid_does_not_work) - { - int serrno = errno; - int sid; - - if (__ioctl (fd, TIOCGSID, &sid) < 0) - { - if (errno == EINVAL) - { - tiocgsid_does_not_work = 1; - __set_errno (serrno); - } - else - return (pid_t) -1; - } - else - return (pid_t) sid; - } -#endif - - pgrp = tcgetpgrp (fd); - if (pgrp == -1) - return (pid_t) -1; - - sid = getsid (pgrp); - if (sid == -1 && errno == ESRCH) - __set_errno (ENOTTY); - - return sid; -} diff --git a/termios/tcsendbrk.c b/termios/tcsendbrk.c deleted file mode 100644 index 4e8fb3fed4..0000000000 --- a/termios/tcsendbrk.c +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (C) 1991-2017 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/>. */ - -#include <errno.h> -#include <termios.h> - -/* Send zero bits on FD. */ -int -tcsendbreak (int fd, int duration) -{ - if (fd < 0) - { - __set_errno (EBADF); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} - - -stub_warning (tcsendbreak) diff --git a/termios/tcsetattr.c b/termios/tcsetattr.c deleted file mode 100644 index 7dd709046b..0000000000 --- a/termios/tcsetattr.c +++ /dev/null @@ -1,106 +0,0 @@ -/* Copyright (C) 1991-2017 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/>. */ - -#include <errno.h> -#include <stddef.h> -#include <termios.h> - -static int bad_speed (speed_t speed); - -/* Set the state of FD to *TERMIOS_P. */ -int -tcsetattr (int fd, int optional_actions, const struct termios *termios_p) -{ - if (fd < 0) - { - __set_errno (EBADF); - return -1; - } - if (termios_p == NULL) - { - __set_errno (EINVAL); - return -1; - } - switch (optional_actions) - { - case TCSANOW: - case TCSADRAIN: - case TCSAFLUSH: - break; - default: - __set_errno (EINVAL); - return -1; - } - - if (bad_speed(termios_p->__ospeed) || - bad_speed(termios_p->__ispeed == 0 ? - termios_p->__ospeed : termios_p->__ispeed)) - { - __set_errno (EINVAL); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} -libc_hidden_def (tcsetattr) - -/* Strychnine checking. */ -static int -bad_speed (speed_t speed) -{ - switch (speed) - { - case B0: - case B50: - case B75: - case B110: - case B134: - case B150: - case B200: - case B300: - case B600: - case B1200: - case B1800: - case B2400: - case B4800: - case B9600: - case B19200: - case B38400: - case B57600: - case B115200: - case B230400: - case B460800: - case B500000: - case B576000: - case B921600: - case B1000000: - case B1152000: - case B1500000: - case B2000000: - case B2500000: - case B3000000: - case B3500000: - case B4000000: - return 0; - default: - return 1; - } -} - - -stub_warning (tcsetattr) diff --git a/termios/tcsetpgrp.c b/termios/tcsetpgrp.c deleted file mode 100644 index 44e61b2a8a..0000000000 --- a/termios/tcsetpgrp.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (C) 1991-2017 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/>. */ - -#include <errno.h> -#include <unistd.h> -#include <sys/types.h> - -/* Set the foreground process group ID of FD set PGRP_ID. */ -int -tcsetpgrp (int fd, pid_t pgrp_id) -{ - if (fd < 0) - { - __set_errno (EBADF); - return -1; - } - - __set_errno (ENOSYS); - return -1; -} - - -stub_warning (tcsetpgrp) diff --git a/termios/termios.h b/termios/termios.h deleted file mode 100644 index c0f7780cff..0000000000 --- a/termios/termios.h +++ /dev/null @@ -1,109 +0,0 @@ -/* Copyright (C) 1991-2017 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/>. */ - -/* - * POSIX Standard: 7.1-2 General Terminal Interface <termios.h> - */ - -#ifndef _TERMIOS_H -#define _TERMIOS_H 1 - -#include <features.h> -#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 -/* We need `pid_t'. */ -# include <bits/types.h> -# ifndef __pid_t_defined -typedef __pid_t pid_t; -# define __pid_t_defined -# endif -#endif - -__BEGIN_DECLS - -/* Get the system-dependent definitions of `struct termios', `tcflag_t', - `cc_t', `speed_t', and all the macros specifying the flag bits. */ -#include <bits/termios.h> - -#ifdef __USE_MISC -/* Compare a character C to a value VAL from the `c_cc' array in a - `struct termios'. If VAL is _POSIX_VDISABLE, no character can match it. */ -# define CCEQ(val, c) ((c) == (val) && (val) != _POSIX_VDISABLE) -#endif - -/* Return the output baud rate stored in *TERMIOS_P. */ -extern speed_t cfgetospeed (const struct termios *__termios_p) __THROW; - -/* Return the input baud rate stored in *TERMIOS_P. */ -extern speed_t cfgetispeed (const struct termios *__termios_p) __THROW; - -/* Set the output baud rate stored in *TERMIOS_P to SPEED. */ -extern int cfsetospeed (struct termios *__termios_p, speed_t __speed) __THROW; - -/* Set the input baud rate stored in *TERMIOS_P to SPEED. */ -extern int cfsetispeed (struct termios *__termios_p, speed_t __speed) __THROW; - -#ifdef __USE_MISC -/* Set both the input and output baud rates in *TERMIOS_OP to SPEED. */ -extern int cfsetspeed (struct termios *__termios_p, speed_t __speed) __THROW; -#endif - - -/* Put the state of FD into *TERMIOS_P. */ -extern int tcgetattr (int __fd, struct termios *__termios_p) __THROW; - -/* Set the state of FD to *TERMIOS_P. - Values for OPTIONAL_ACTIONS (TCSA*) are in <bits/termios.h>. */ -extern int tcsetattr (int __fd, int __optional_actions, - const struct termios *__termios_p) __THROW; - - -#ifdef __USE_MISC -/* Set *TERMIOS_P to indicate raw mode. */ -extern void cfmakeraw (struct termios *__termios_p) __THROW; -#endif - -/* Send zero bits on FD. */ -extern int tcsendbreak (int __fd, int __duration) __THROW; - -/* Wait for pending output to be written on FD. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern int tcdrain (int __fd); - -/* Flush pending data on FD. - Values for QUEUE_SELECTOR (TC{I,O,IO}FLUSH) are in <bits/termios.h>. */ -extern int tcflush (int __fd, int __queue_selector) __THROW; - -/* Suspend or restart transmission on FD. - Values for ACTION (TC[IO]{OFF,ON}) are in <bits/termios.h>. */ -extern int tcflow (int __fd, int __action) __THROW; - - -#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 -/* Get process group ID for session leader for controlling terminal FD. */ -extern __pid_t tcgetsid (int __fd) __THROW; -#endif - - -#ifdef __USE_MISC -# include <sys/ttydefaults.h> -#endif - -__END_DECLS - -#endif /* termios.h */ |