termios.h 3.6 KB

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