Back to index

glibc  2.9
termios.h
Go to the documentation of this file.
00001 /* Copyright (C) 1991,92,93,94,96,97,98,99, 2003 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003 
00004    The GNU C Library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    The GNU C Library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Lesser General Public License for more details.
00013 
00014    You should have received a copy of the GNU Lesser General Public
00015    License along with the GNU C Library; if not, write to the Free
00016    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00017    02111-1307 USA.  */
00018 
00019 /*
00020  *     POSIX Standard: 7.1-2 General Terminal Interface <termios.h>
00021  */
00022 
00023 #ifndef       _TERMIOS_H
00024 #define       _TERMIOS_H    1
00025 
00026 #include <features.h>
00027 #ifdef __USE_UNIX98
00028 /* We need `pid_t'.  */
00029 # include <bits/types.h>
00030 # ifndef __pid_t_defined
00031 typedef __pid_t pid_t;
00032 #  define __pid_t_defined
00033 # endif
00034 #endif
00035 
00036 __BEGIN_DECLS
00037 
00038 /* Get the system-dependent definitions of `struct termios', `tcflag_t',
00039    `cc_t', `speed_t', and all the macros specifying the flag bits.  */
00040 #include <bits/termios.h>
00041 
00042 #ifdef __USE_BSD
00043 /* Compare a character C to a value VAL from the `c_cc' array in a
00044    `struct termios'.  If VAL is _POSIX_VDISABLE, no character can match it.  */
00045 # define CCEQ(val, c)       ((c) == (val) && (val) != _POSIX_VDISABLE)
00046 #endif
00047 
00048 /* Return the output baud rate stored in *TERMIOS_P.  */
00049 extern speed_t cfgetospeed (__const struct termios *__termios_p) __THROW;
00050 
00051 /* Return the input baud rate stored in *TERMIOS_P.  */
00052 extern speed_t cfgetispeed (__const struct termios *__termios_p) __THROW;
00053 
00054 /* Set the output baud rate stored in *TERMIOS_P to SPEED.  */
00055 extern int cfsetospeed (struct termios *__termios_p, speed_t __speed) __THROW;
00056 
00057 /* Set the input baud rate stored in *TERMIOS_P to SPEED.  */
00058 extern int cfsetispeed (struct termios *__termios_p, speed_t __speed) __THROW;
00059 
00060 #ifdef __USE_BSD
00061 /* Set both the input and output baud rates in *TERMIOS_OP to SPEED.  */
00062 extern int cfsetspeed (struct termios *__termios_p, speed_t __speed) __THROW;
00063 #endif
00064 
00065 
00066 /* Put the state of FD into *TERMIOS_P.  */
00067 extern int tcgetattr (int __fd, struct termios *__termios_p) __THROW;
00068 
00069 /* Set the state of FD to *TERMIOS_P.
00070    Values for OPTIONAL_ACTIONS (TCSA*) are in <bits/termios.h>.  */
00071 extern int tcsetattr (int __fd, int __optional_actions,
00072                     __const struct termios *__termios_p) __THROW;
00073 
00074 
00075 #ifdef __USE_BSD
00076 /* Set *TERMIOS_P to indicate raw mode.  */
00077 extern void cfmakeraw (struct termios *__termios_p) __THROW;
00078 #endif
00079 
00080 /* Send zero bits on FD.  */
00081 extern int tcsendbreak (int __fd, int __duration) __THROW;
00082 
00083 /* Wait for pending output to be written on FD.
00084 
00085    This function is a cancellation point and therefore not marked with
00086    __THROW.  */
00087 extern int tcdrain (int __fd);
00088 
00089 /* Flush pending data on FD.
00090    Values for QUEUE_SELECTOR (TC{I,O,IO}FLUSH) are in <bits/termios.h>.  */
00091 extern int tcflush (int __fd, int __queue_selector) __THROW;
00092 
00093 /* Suspend or restart transmission on FD.
00094    Values for ACTION (TC[IO]{OFF,ON}) are in <bits/termios.h>.  */
00095 extern int tcflow (int __fd, int __action) __THROW;
00096 
00097 
00098 #ifdef __USE_UNIX98
00099 /* Get process group ID for session leader for controlling terminal FD.  */
00100 extern __pid_t tcgetsid (int __fd) __THROW;
00101 #endif
00102 
00103 
00104 #ifdef __USE_BSD
00105 # include <sys/ttydefaults.h>
00106 #endif
00107 
00108 __END_DECLS
00109 
00110 #endif /* termios.h  */