lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | /* Copyright (C) 1991,92,93,94,96,97,98,99, 2003 Free Software Foundation, Inc. |
| 2 | This file is part of the GNU C Library. |
| 3 | |
| 4 | The GNU C Library is free software; you can redistribute it and/or |
| 5 | modify it under the terms of the GNU Lesser General Public |
| 6 | License as published by the Free Software Foundation; either |
| 7 | version 2.1 of the License, or (at your option) any later version. |
| 8 | |
| 9 | The GNU C Library is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | Lesser General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU Lesser General Public |
| 15 | License along with the GNU C Library; if not, write to the Free |
| 16 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
| 17 | 02111-1307 USA. */ |
| 18 | |
| 19 | /* |
| 20 | * POSIX Standard: 7.1-2 General Terminal Interface <termios.h> |
| 21 | */ |
| 22 | |
| 23 | #ifndef _TERMIOS_H |
| 24 | #define _TERMIOS_H 1 |
| 25 | |
| 26 | #include <features.h> |
| 27 | #ifdef __USE_UNIX98 |
| 28 | /* We need `pid_t'. */ |
| 29 | # include <bits/types.h> |
| 30 | # ifndef __pid_t_defined |
| 31 | typedef __pid_t pid_t; |
| 32 | # define __pid_t_defined |
| 33 | # endif |
| 34 | #endif |
| 35 | |
| 36 | __BEGIN_DECLS |
| 37 | |
| 38 | /* Get the system-dependent definitions of `struct termios', `tcflag_t', |
| 39 | `cc_t', `speed_t', and all the macros specifying the flag bits. */ |
| 40 | #include <bits/termios.h> |
| 41 | |
| 42 | #ifdef __USE_BSD |
| 43 | /* Compare a character C to a value VAL from the `c_cc' array in a |
| 44 | `struct termios'. If VAL is _POSIX_VDISABLE, no character can match it. */ |
| 45 | # define CCEQ(val, c) ((c) == (val) && (val) != _POSIX_VDISABLE) |
| 46 | #endif |
| 47 | |
| 48 | /* Return the output baud rate stored in *TERMIOS_P. */ |
| 49 | extern speed_t cfgetospeed (__const struct termios *__termios_p) __THROW; |
| 50 | |
| 51 | /* Return the input baud rate stored in *TERMIOS_P. */ |
| 52 | extern speed_t cfgetispeed (__const struct termios *__termios_p) __THROW; |
| 53 | |
| 54 | /* Set the output baud rate stored in *TERMIOS_P to SPEED. */ |
| 55 | extern int cfsetospeed (struct termios *__termios_p, speed_t __speed) __THROW; |
| 56 | libc_hidden_proto(cfsetospeed) |
| 57 | |
| 58 | /* Set the input baud rate stored in *TERMIOS_P to SPEED. */ |
| 59 | extern int cfsetispeed (struct termios *__termios_p, speed_t __speed) __THROW; |
| 60 | libc_hidden_proto(cfsetispeed) |
| 61 | |
| 62 | #ifdef __USE_BSD |
| 63 | /* Set both the input and output baud rates in *TERMIOS_OP to SPEED. */ |
| 64 | extern int cfsetspeed (struct termios *__termios_p, speed_t __speed) __THROW; |
| 65 | #endif |
| 66 | |
| 67 | |
| 68 | /* Put the state of FD into *TERMIOS_P. */ |
| 69 | extern int tcgetattr (int __fd, struct termios *__termios_p) __THROW; |
| 70 | libc_hidden_proto(tcgetattr) |
| 71 | |
| 72 | /* Set the state of FD to *TERMIOS_P. |
| 73 | Values for OPTIONAL_ACTIONS (TCSA*) are in <bits/termios.h>. */ |
| 74 | extern int tcsetattr (int __fd, int __optional_actions, |
| 75 | __const struct termios *__termios_p) __THROW; |
| 76 | libc_hidden_proto(tcsetattr) |
| 77 | |
| 78 | |
| 79 | #ifdef __USE_BSD |
| 80 | /* Set *TERMIOS_P to indicate raw mode. */ |
| 81 | extern void cfmakeraw (struct termios *__termios_p) __THROW; |
| 82 | #endif |
| 83 | |
| 84 | /* Send zero bits on FD. */ |
| 85 | extern int tcsendbreak (int __fd, int __duration) __THROW; |
| 86 | |
| 87 | /* Wait for pending output to be written on FD. |
| 88 | |
| 89 | This function is a cancellation point and therefore not marked with |
| 90 | __THROW. */ |
| 91 | extern int tcdrain (int __fd); |
| 92 | |
| 93 | /* Flush pending data on FD. |
| 94 | Values for QUEUE_SELECTOR (TC{I,O,IO}FLUSH) are in <bits/termios.h>. */ |
| 95 | extern int tcflush (int __fd, int __queue_selector) __THROW; |
| 96 | |
| 97 | /* Suspend or restart transmission on FD. |
| 98 | Values for ACTION (TC[IO]{OFF,ON}) are in <bits/termios.h>. */ |
| 99 | extern int tcflow (int __fd, int __action) __THROW; |
| 100 | |
| 101 | |
| 102 | #ifdef __USE_UNIX98 |
| 103 | /* Get process group ID for session leader for controlling terminal FD. */ |
| 104 | extern __pid_t tcgetsid (int __fd) __THROW; |
| 105 | #endif |
| 106 | |
| 107 | |
| 108 | #ifdef __USE_BSD |
| 109 | # include <sys/ttydefaults.h> |
| 110 | #endif |
| 111 | |
| 112 | __END_DECLS |
| 113 | |
| 114 | #endif /* termios.h */ |