termios.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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, see
  13. <http://www.gnu.org/licenses/>. */
  14. /*
  15. * POSIX Standard: 7.1-2 General Terminal Interface <termios.h>
  16. */
  17. #ifndef _TERMIOS_H
  18. #define _TERMIOS_H 1
  19. #include <features.h>
  20. #ifdef __USE_UNIX98
  21. /* We need `pid_t'. */
  22. # include <bits/types.h>
  23. # ifndef __pid_t_defined
  24. typedef __pid_t pid_t;
  25. # define __pid_t_defined
  26. # endif
  27. #endif
  28. __BEGIN_DECLS
  29. /* Get the system-dependent definitions of `struct termios', `tcflag_t',
  30. `cc_t', `speed_t', and all the macros specifying the flag bits. */
  31. #include <bits/termios.h>
  32. #ifdef __USE_BSD
  33. /* Compare a character C to a value VAL from the `c_cc' array in a
  34. `struct termios'. If VAL is _POSIX_VDISABLE, no character can match it. */
  35. # define CCEQ(val, c) ((c) == (val) && (val) != _POSIX_VDISABLE)
  36. #endif
  37. /* Return the output baud rate stored in *TERMIOS_P. */
  38. extern speed_t cfgetospeed (const struct termios *__termios_p) __THROW;
  39. /* Return the input baud rate stored in *TERMIOS_P. */
  40. extern speed_t cfgetispeed (const struct termios *__termios_p) __THROW;
  41. /* Set the output baud rate stored in *TERMIOS_P to SPEED. */
  42. extern int cfsetospeed (struct termios *__termios_p, speed_t __speed) __THROW;
  43. libc_hidden_proto(cfsetospeed)
  44. /* Set the input baud rate stored in *TERMIOS_P to SPEED. */
  45. extern int cfsetispeed (struct termios *__termios_p, speed_t __speed) __THROW;
  46. libc_hidden_proto(cfsetispeed)
  47. #ifdef __USE_BSD
  48. /* Set both the input and output baud rates in *TERMIOS_OP to SPEED. */
  49. extern int cfsetspeed (struct termios *__termios_p, speed_t __speed) __THROW;
  50. #endif
  51. /* Put the state of FD into *TERMIOS_P. */
  52. extern int tcgetattr (int __fd, struct termios *__termios_p) __THROW;
  53. libc_hidden_proto(tcgetattr)
  54. /* Set the state of FD to *TERMIOS_P.
  55. Values for OPTIONAL_ACTIONS (TCSA*) are in <bits/termios.h>. */
  56. extern int tcsetattr (int __fd, int __optional_actions,
  57. const struct termios *__termios_p) __THROW;
  58. libc_hidden_proto(tcsetattr)
  59. #ifdef __USE_BSD
  60. /* Set *TERMIOS_P to indicate raw mode. */
  61. extern void cfmakeraw (struct termios *__termios_p) __THROW;
  62. #endif
  63. /* Send zero bits on FD. */
  64. extern int tcsendbreak (int __fd, int __duration) __THROW;
  65. /* Wait for pending output to be written on FD.
  66. This function is a cancellation point and therefore not marked with
  67. __THROW. */
  68. extern int tcdrain (int __fd);
  69. /* Flush pending data on FD.
  70. Values for QUEUE_SELECTOR (TC{I,O,IO}FLUSH) are in <bits/termios.h>. */
  71. extern int tcflush (int __fd, int __queue_selector) __THROW;
  72. /* Suspend or restart transmission on FD.
  73. Values for ACTION (TC[IO]{OFF,ON}) are in <bits/termios.h>. */
  74. extern int tcflow (int __fd, int __action) __THROW;
  75. #ifdef __USE_UNIX98
  76. /* Get process group ID for session leader for controlling terminal FD. */
  77. extern __pid_t tcgetsid (int __fd) __THROW;
  78. #endif
  79. #ifdef __USE_BSD
  80. # include <sys/ttydefaults.h>
  81. #endif
  82. __END_DECLS
  83. #endif /* termios.h */