termios.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /* Copyright (C) 1991, 92, 93, 94, 96, 97, 98 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 Library General Public License as
  5. published by the Free Software Foundation; either version 2 of the
  6. 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. Library General Public License for more details.
  11. You should have received a copy of the GNU Library General Public
  12. License along with the GNU C Library; see the file COPYING.LIB. If not,
  13. write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  14. Boston, MA 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
  25. typedef __pid_t pid_t;
  26. # define pid_t pid_t
  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 __P ((__const struct termios *__termios_p));
  40. /* Return the input baud rate stored in *TERMIOS_P. */
  41. extern speed_t cfgetispeed __P ((__const struct termios *__termios_p));
  42. /* Set the output baud rate stored in *TERMIOS_P to SPEED. */
  43. extern int cfsetospeed __P ((struct termios *__termios_p, speed_t __speed));
  44. /* Set the input baud rate stored in *TERMIOS_P to SPEED. */
  45. extern int cfsetispeed __P ((struct termios *__termios_p, speed_t __speed));
  46. #ifdef __USE_BSD
  47. /* Set both the input and output baud rates in *TERMIOS_OP to SPEED. */
  48. extern int cfsetspeed __P ((struct termios *__termios_p, speed_t __speed));
  49. #endif
  50. /* Put the state of FD into *TERMIOS_P. */
  51. extern int tcgetattr __P ((int __fd, struct termios *__termios_p));
  52. /* Set the state of FD to *TERMIOS_P.
  53. Values for OPTIONAL_ACTIONS (TCSA*) are in <bits/termios.h>. */
  54. extern int tcsetattr __P ((int __fd, int __optional_actions,
  55. __const struct termios *__termios_p));
  56. #ifdef __USE_BSD
  57. /* Set *TERMIOS_P to indicate raw mode. */
  58. extern void cfmakeraw __P ((struct termios *__termios_p));
  59. #endif
  60. /* Send zero bits on FD. */
  61. extern int tcsendbreak __P ((int __fd, int __duration));
  62. /* Wait for pending output to be written on FD. */
  63. extern int tcdrain __P ((int __fd));
  64. /* Flush pending data on FD.
  65. Values for QUEUE_SELECTOR (TC{I,O,IO}FLUSH) are in <bits/termios.h>. */
  66. extern int tcflush __P ((int __fd, int __queue_selector));
  67. /* Suspend or restart transmission on FD.
  68. Values for ACTION (TC[IO]{OFF,ON}) are in <bits/termios.h>. */
  69. extern int tcflow __P ((int __fd, int __action));
  70. #ifdef __USE_UNIX98
  71. /* Get process group ID for session leader for controlling terminal FD. */
  72. extern __pid_t tcgetsid __P ((int __fd));
  73. #endif
  74. #ifdef __USE_BSD
  75. # include <sys/ttydefaults.h>
  76. #endif
  77. __END_DECLS
  78. #endif /* termios.h */