termios.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. /* Set the input baud rate stored in *TERMIOS_P to SPEED. */
  45. extern int cfsetispeed (struct termios *__termios_p, speed_t __speed) __THROW;
  46. #ifdef __USE_BSD
  47. /* Set both the input and output baud rates in *TERMIOS_OP to SPEED. */
  48. extern int cfsetspeed (struct termios *__termios_p, speed_t __speed) __THROW;
  49. #endif
  50. /* Put the state of FD into *TERMIOS_P. */
  51. extern int tcgetattr (int __fd, struct termios *__termios_p) __THROW;
  52. /* Set the state of FD to *TERMIOS_P.
  53. Values for OPTIONAL_ACTIONS (TCSA*) are in <bits/termios.h>. */
  54. extern int tcsetattr (int __fd, int __optional_actions,
  55. __const struct termios *__termios_p) __THROW;
  56. #ifdef __USE_BSD
  57. /* Set *TERMIOS_P to indicate raw mode. */
  58. extern void cfmakeraw (struct termios *__termios_p) __THROW;
  59. #endif
  60. /* Send zero bits on FD. */
  61. extern int tcsendbreak (int __fd, int __duration) __THROW;
  62. /* Wait for pending output to be written on FD.
  63. This function is a cancellation point and therefore not marked with
  64. __THROW. */
  65. extern int tcdrain (int __fd);
  66. /* Flush pending data on FD.
  67. Values for QUEUE_SELECTOR (TC{I,O,IO}FLUSH) are in <bits/termios.h>. */
  68. extern int tcflush (int __fd, int __queue_selector) __THROW;
  69. /* Suspend or restart transmission on FD.
  70. Values for ACTION (TC[IO]{OFF,ON}) are in <bits/termios.h>. */
  71. extern int tcflow (int __fd, int __action) __THROW;
  72. #ifdef __USE_UNIX98
  73. /* Get process group ID for session leader for controlling terminal FD. */
  74. extern __pid_t tcgetsid (int __fd) __THROW;
  75. #endif
  76. #ifdef __USE_BSD
  77. # include <sys/ttydefaults.h>
  78. #endif
  79. __END_DECLS
  80. #endif /* termios.h */