xref: /freebsd/include/termios.h (revision 448f5f73dcc7efe69df16b6a875b0cf0c6f41ae3)
1f14ad5faSEd Schouten /*-
2f14ad5faSEd Schouten  * Copyright (c) 1988, 1989, 1993, 1994
3f14ad5faSEd Schouten  *	The Regents of the University of California.  All rights reserved.
4f14ad5faSEd Schouten  *
5f14ad5faSEd Schouten  * Redistribution and use in source and binary forms, with or without
6f14ad5faSEd Schouten  * modification, are permitted provided that the following conditions
7f14ad5faSEd Schouten  * are met:
8f14ad5faSEd Schouten  * 1. Redistributions of source code must retain the above copyright
9f14ad5faSEd Schouten  *    notice, this list of conditions and the following disclaimer.
10f14ad5faSEd Schouten  * 2. Redistributions in binary form must reproduce the above copyright
11f14ad5faSEd Schouten  *    notice, this list of conditions and the following disclaimer in the
12f14ad5faSEd Schouten  *    documentation and/or other materials provided with the distribution.
13f2556687SWarner Losh  * 3. Neither the name of the University nor the names of its contributors
14f14ad5faSEd Schouten  *    may be used to endorse or promote products derived from this software
15f14ad5faSEd Schouten  *    without specific prior written permission.
16f14ad5faSEd Schouten  *
17f14ad5faSEd Schouten  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18f14ad5faSEd Schouten  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19f14ad5faSEd Schouten  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20f14ad5faSEd Schouten  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21f14ad5faSEd Schouten  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22f14ad5faSEd Schouten  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23f14ad5faSEd Schouten  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24f14ad5faSEd Schouten  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25f14ad5faSEd Schouten  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26f14ad5faSEd Schouten  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27f14ad5faSEd Schouten  * SUCH DAMAGE.
28f14ad5faSEd Schouten  *
29f14ad5faSEd Schouten  *	@(#)termios.h	8.3 (Berkeley) 3/28/94
30f14ad5faSEd Schouten  * $FreeBSD$
31f14ad5faSEd Schouten  */
32f14ad5faSEd Schouten 
33f14ad5faSEd Schouten #ifndef _TERMIOS_H_
34f14ad5faSEd Schouten #define	_TERMIOS_H_
35f14ad5faSEd Schouten 
36f14ad5faSEd Schouten #include <sys/cdefs.h>
37f14ad5faSEd Schouten #include <sys/_termios.h>
38f14ad5faSEd Schouten #include <sys/_types.h>
39f14ad5faSEd Schouten 
40f14ad5faSEd Schouten #ifndef _PID_T_DECLARED
41f14ad5faSEd Schouten typedef	__pid_t		pid_t;
42f14ad5faSEd Schouten #define	_PID_T_DECLARED
43f14ad5faSEd Schouten #endif
44f14ad5faSEd Schouten 
45f14ad5faSEd Schouten #ifndef _POSIX_SOURCE
46f14ad5faSEd Schouten #define	OXTABS		TAB3
47f14ad5faSEd Schouten #define	MDMBUF		CCAR_OFLOW
48f14ad5faSEd Schouten #endif
49f14ad5faSEd Schouten 
50f14ad5faSEd Schouten #ifndef _POSIX_SOURCE
51f14ad5faSEd Schouten #define	CCEQ(val, c)	((c) == (val) && (val) != _POSIX_VDISABLE)
52f14ad5faSEd Schouten #endif
53f14ad5faSEd Schouten 
54f14ad5faSEd Schouten /*
55f14ad5faSEd Schouten  * Commands passed to tcsetattr() for setting the termios structure.
56f14ad5faSEd Schouten  */
57f14ad5faSEd Schouten #define	TCSANOW		0		/* make change immediate */
58f14ad5faSEd Schouten #define	TCSADRAIN	1		/* drain output, then change */
59f14ad5faSEd Schouten #define	TCSAFLUSH	2		/* drain output, flush input */
60f14ad5faSEd Schouten #ifndef _POSIX_SOURCE
61f14ad5faSEd Schouten #define	TCSASOFT	0x10		/* flag - don't alter h.w. state */
62f14ad5faSEd Schouten #endif
63f14ad5faSEd Schouten 
64f14ad5faSEd Schouten #define	TCIFLUSH	1
65f14ad5faSEd Schouten #define	TCOFLUSH	2
66f14ad5faSEd Schouten #define	TCIOFLUSH	3
67f14ad5faSEd Schouten #define	TCOOFF		1
68f14ad5faSEd Schouten #define	TCOON		2
69f14ad5faSEd Schouten #define	TCIOFF		3
70f14ad5faSEd Schouten #define	TCION		4
71f14ad5faSEd Schouten 
72f14ad5faSEd Schouten __BEGIN_DECLS
73f14ad5faSEd Schouten speed_t	cfgetispeed(const struct termios *);
74f14ad5faSEd Schouten speed_t	cfgetospeed(const struct termios *);
75f14ad5faSEd Schouten int	cfsetispeed(struct termios *, speed_t);
76f14ad5faSEd Schouten int	cfsetospeed(struct termios *, speed_t);
77f14ad5faSEd Schouten int	tcgetattr(int, struct termios *);
78f14ad5faSEd Schouten int	tcsetattr(int, int, const struct termios *);
79f14ad5faSEd Schouten int	tcdrain(int);
80f14ad5faSEd Schouten int	tcflow(int, int);
81f14ad5faSEd Schouten int	tcflush(int, int);
82f14ad5faSEd Schouten int	tcsendbreak(int, int);
83f14ad5faSEd Schouten 
84*448f5f73SJilles Tjoelker #if __POSIX_VISIBLE >= 200112
85f14ad5faSEd Schouten pid_t	tcgetsid(int);
86f14ad5faSEd Schouten #endif
87f14ad5faSEd Schouten #if __BSD_VISIBLE
88f14ad5faSEd Schouten int	tcsetsid(int, pid_t);
89f14ad5faSEd Schouten 
90f14ad5faSEd Schouten void	cfmakeraw(struct termios *);
91736fc286SEd Schouten void	cfmakesane(struct termios *);
92f14ad5faSEd Schouten int	cfsetspeed(struct termios *, speed_t);
93f14ad5faSEd Schouten #endif
94f14ad5faSEd Schouten __END_DECLS
95f14ad5faSEd Schouten 
96f14ad5faSEd Schouten #endif /* !_TERMIOS_H_ */
97f14ad5faSEd Schouten 
98f14ad5faSEd Schouten #ifndef _POSIX_SOURCE
99f14ad5faSEd Schouten #include <sys/ttycom.h>
100f14ad5faSEd Schouten #include <sys/ttydefaults.h>
101f14ad5faSEd Schouten #endif
102