fix regression from a745c4bfc8a9b5db4e48387170da0dc1d39e3abe
[uclibc-ng.git] / include / termios.h
blob7f11fd28c7d6a9f2409b9b3f5981781424ca5e32
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.
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.
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.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
19 * POSIX Standard: 7.1-2 General Terminal Interface <termios.h>
22 #ifndef _TERMIOS_H
23 #define _TERMIOS_H 1
25 #include <features.h>
26 #ifdef __USE_UNIX98
27 /* We need `pid_t'. */
28 # include <bits/types.h>
29 # ifndef __pid_t_defined
30 typedef __pid_t pid_t;
31 # define __pid_t_defined
32 # endif
33 #endif
35 __BEGIN_DECLS
37 /* Get the system-dependent definitions of `struct termios', `tcflag_t',
38 `cc_t', `speed_t', and all the macros specifying the flag bits. */
39 #include <bits/termios.h>
41 #ifdef __USE_BSD
42 /* Compare a character C to a value VAL from the `c_cc' array in a
43 `struct termios'. If VAL is _POSIX_VDISABLE, no character can match it. */
44 # define CCEQ(val, c) ((c) == (val) && (val) != _POSIX_VDISABLE)
45 #endif
47 /* Return the output baud rate stored in *TERMIOS_P. */
48 extern speed_t cfgetospeed (const struct termios *__termios_p) __THROW;
50 /* Return the input baud rate stored in *TERMIOS_P. */
51 extern speed_t cfgetispeed (const struct termios *__termios_p) __THROW;
53 /* Set the output baud rate stored in *TERMIOS_P to SPEED. */
54 extern int cfsetospeed (struct termios *__termios_p, speed_t __speed) __THROW;
55 libc_hidden_proto(cfsetospeed)
57 /* Set the input baud rate stored in *TERMIOS_P to SPEED. */
58 extern int cfsetispeed (struct termios *__termios_p, speed_t __speed) __THROW;
59 libc_hidden_proto(cfsetispeed)
61 #ifdef __USE_BSD
62 /* Set both the input and output baud rates in *TERMIOS_OP to SPEED. */
63 extern int cfsetspeed (struct termios *__termios_p, speed_t __speed) __THROW;
64 #endif
67 /* Put the state of FD into *TERMIOS_P. */
68 extern int tcgetattr (int __fd, struct termios *__termios_p) __THROW;
69 libc_hidden_proto(tcgetattr)
71 /* Set the state of FD to *TERMIOS_P.
72 Values for OPTIONAL_ACTIONS (TCSA*) are in <bits/termios.h>. */
73 extern int tcsetattr (int __fd, int __optional_actions,
74 const struct termios *__termios_p) __THROW;
75 libc_hidden_proto(tcsetattr)
78 #ifdef __USE_BSD
79 /* Set *TERMIOS_P to indicate raw mode. */
80 extern void cfmakeraw (struct termios *__termios_p) __THROW;
81 #endif
83 /* Send zero bits on FD. */
84 extern int tcsendbreak (int __fd, int __duration) __THROW;
86 /* Wait for pending output to be written on FD.
88 This function is a cancellation point and therefore not marked with
89 __THROW. */
90 extern int tcdrain (int __fd);
92 /* Flush pending data on FD.
93 Values for QUEUE_SELECTOR (TC{I,O,IO}FLUSH) are in <bits/termios.h>. */
94 extern int tcflush (int __fd, int __queue_selector) __THROW;
96 /* Suspend or restart transmission on FD.
97 Values for ACTION (TC[IO]{OFF,ON}) are in <bits/termios.h>. */
98 extern int tcflow (int __fd, int __action) __THROW;
101 #ifdef __USE_UNIX98
102 /* Get process group ID for session leader for controlling terminal FD. */
103 extern __pid_t tcgetsid (int __fd) __THROW;
104 #endif
107 #ifdef __USE_BSD
108 # include <sys/ttydefaults.h>
109 #endif
111 __END_DECLS
113 #endif /* termios.h */