17c478bdstevel@tonic-gate/*
27c478bdstevel@tonic-gate * CDDL HEADER START
37c478bdstevel@tonic-gate *
47c478bdstevel@tonic-gate * The contents of this file are subject to the terms of the
59acbbeann * Common Development and Distribution License (the "License").
69acbbeann * You may not use this file except in compliance with the License.
77c478bdstevel@tonic-gate *
87c478bdstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bdstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
107c478bdstevel@tonic-gate * See the License for the specific language governing permissions
117c478bdstevel@tonic-gate * and limitations under the License.
127c478bdstevel@tonic-gate *
137c478bdstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
147c478bdstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bdstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
167c478bdstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
177c478bdstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bdstevel@tonic-gate *
197c478bdstevel@tonic-gate * CDDL HEADER END
207c478bdstevel@tonic-gate */
217c478bdstevel@tonic-gate/*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
22b4203d7Marcel Telka/*	  All Rights Reserved	*/
237c478bdstevel@tonic-gate
247c478bdstevel@tonic-gate
257c478bdstevel@tonic-gate/*
26ba3594bGarrett D'Amore * Copyright 2014 Garrett D'Amore <garrett@damore.org>
27ba3594bGarrett D'Amore *
28eb5a5c7Surya Prakki * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
297c478bdstevel@tonic-gate */
307c478bdstevel@tonic-gate
317c478bdstevel@tonic-gate#ifndef _SYS_TERMIOS_H
327c478bdstevel@tonic-gate#define	_SYS_TERMIOS_H
337c478bdstevel@tonic-gate
347c478bdstevel@tonic-gate#include <sys/feature_tests.h>
357c478bdstevel@tonic-gate
367c478bdstevel@tonic-gate#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
377c478bdstevel@tonic-gate#include <sys/ttydev.h>
387c478bdstevel@tonic-gate#include <sys/time.h>
397c478bdstevel@tonic-gate#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
407c478bdstevel@tonic-gate
417c478bdstevel@tonic-gate#include <sys/types.h>
427c478bdstevel@tonic-gate
437c478bdstevel@tonic-gate#ifdef	__cplusplus
447c478bdstevel@tonic-gateextern "C" {
457c478bdstevel@tonic-gate#endif
467c478bdstevel@tonic-gate
477c478bdstevel@tonic-gate/*
487c478bdstevel@tonic-gate * _POSIX_VDISABLE has been defined in <sys/termios.h> since the
497c478bdstevel@tonic-gate * introduction of the header. The POSIX standard, IEEE Std.
507c478bdstevel@tonic-gate * 1003.1-1988 also required  the existence of _POSIX_VDISABLE in
517c478bdstevel@tonic-gate * this header. Subsequent versions of the IEEE Standard as well
527c478bdstevel@tonic-gate * as the X/Open specifications required that _POSIX_VDISABLE be
537c478bdstevel@tonic-gate * defined in <unistd.h> while still allowing for it's existence
547c478bdstevel@tonic-gate * here. With the introduction of XPG6, _POSIX_VDISABLE can only
557c478bdstevel@tonic-gate * be defined in <unistd.h>.
567c478bdstevel@tonic-gate */
577c478bdstevel@tonic-gate#if !defined(_XPG6) || defined(__EXTENSIONS__)
587c478bdstevel@tonic-gate#ifndef _POSIX_VDISABLE
597c478bdstevel@tonic-gate#define	_POSIX_VDISABLE 0 /* Disable special character functions */
607c478bdstevel@tonic-gate#endif
617c478bdstevel@tonic-gate#endif /* !defined(_XPG6) || defined(__EXTENSIONS__) */
627c478bdstevel@tonic-gate
637c478bdstevel@tonic-gate#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
647c478bdstevel@tonic-gate#define	CTRL(c)	((c)&037)
657c478bdstevel@tonic-gate#define	IBSHIFT 16
667c478bdstevel@tonic-gate#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
677c478bdstevel@tonic-gate
687c478bdstevel@tonic-gate/* required by termio.h and VCEOF/VCEOL */
697c478bdstevel@tonic-gate#define	_NCC	8
707c478bdstevel@tonic-gate#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
717c478bdstevel@tonic-gate#define	NCC	_NCC
727c478bdstevel@tonic-gate#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
737c478bdstevel@tonic-gate
747c478bdstevel@tonic-gate/* some defines required by POSIX */
757c478bdstevel@tonic-gate#define	NCCS	19
767c478bdstevel@tonic-gate
777c478bdstevel@tonic-gate/*
787c478bdstevel@tonic-gate * types defined by POSIX. These are better off in types.h, but
797c478bdstevel@tonic-gate * the standard says that they have to be in termios.h.
807c478bdstevel@tonic-gate */
817c478bdstevel@tonic-gatetypedef unsigned int tcflag_t;
827c478bdstevel@tonic-gatetypedef unsigned char cc_t;
837c478bdstevel@tonic-gatetypedef unsigned int speed_t;
847c478bdstevel@tonic-gate
857c478bdstevel@tonic-gate/*
867c478bdstevel@tonic-gate * Ioctl control packet
877c478bdstevel@tonic-gate */
887c478bdstevel@tonic-gatestruct termios {
897c478bdstevel@tonic-gate	tcflag_t	c_iflag;	/* input modes */
907c478bdstevel@tonic-gate	tcflag_t	c_oflag;	/* output modes */
917c478bdstevel@tonic-gate	tcflag_t	c_cflag;	/* control modes */
927c478bdstevel@tonic-gate	tcflag_t	c_lflag;	/* line discipline modes */
937c478bdstevel@tonic-gate	cc_t		c_cc[NCCS];	/* control chars */
947c478bdstevel@tonic-gate};
957c478bdstevel@tonic-gate
967c478bdstevel@tonic-gate/*
977c478bdstevel@tonic-gate * POSIX termios functions
987c478bdstevel@tonic-gate * These functions get mapped into ioctls.
997c478bdstevel@tonic-gate */
1007c478bdstevel@tonic-gate
1017c478bdstevel@tonic-gate#ifndef _KERNEL
1027c478bdstevel@tonic-gate
1037c478bdstevel@tonic-gateextern speed_t cfgetospeed(const struct termios *);
1047c478bdstevel@tonic-gateextern int cfsetospeed(struct termios *, speed_t);
1057c478bdstevel@tonic-gateextern speed_t cfgetispeed(const struct termios *);
1067c478bdstevel@tonic-gateextern int cfsetispeed(struct termios *, speed_t);
1077c478bdstevel@tonic-gateextern int tcgetattr(int, struct termios *);
1087c478bdstevel@tonic-gateextern int tcsetattr(int, int, const struct termios *);
1097c478bdstevel@tonic-gateextern int tcsendbreak(int, int);
1107c478bdstevel@tonic-gateextern int tcdrain(int);
1117c478bdstevel@tonic-gateextern int tcflush(int, int);
1127c478bdstevel@tonic-gateextern int tcflow(int, int);
1137c478bdstevel@tonic-gate
1147c478bdstevel@tonic-gate#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
1157c478bdstevel@tonic-gate
1167c478bdstevel@tonic-gateextern pid_t tcgetsid(int);
1177c478bdstevel@tonic-gate
1187c478bdstevel@tonic-gate#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) ... */
1197c478bdstevel@tonic-gate
1207c478bdstevel@tonic-gate#endif
1217c478bdstevel@tonic-gate
1227c478bdstevel@tonic-gate/* control characters */
1237c478bdstevel@tonic-gate#define	VINTR	0
1247c478bdstevel@tonic-gate#define	VQUIT	1
1257c478bdstevel@tonic-gate#define	VERASE	2
1267c478bdstevel@tonic-gate#define	VKILL	3
1277c478bdstevel@tonic-gate#define	VEOF	4
1287c478bdstevel@tonic-gate#define	VEOL	5
1297c478bdstevel@tonic-gate#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
1307c478bdstevel@tonic-gate#define	VEOL2	6
1317c478bdstevel@tonic-gate#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
1327c478bdstevel@tonic-gate#define	VMIN	4
1337c478bdstevel@tonic-gate#define	VTIME	5
1347c478bdstevel@tonic-gate#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
1357c478bdstevel@tonic-gate#define	VSWTCH	7
1367c478bdstevel@tonic-gate#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
1377c478bdstevel@tonic-gate#define	VSTART		8
1387c478bdstevel@tonic-gate#define	VSTOP		9
1397c478bdstevel@tonic-gate#define	VSUSP		10
1407c478bdstevel@tonic-gate#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
1417c478bdstevel@tonic-gate#define	VDSUSP		11
1427c478bdstevel@tonic-gate#define	VREPRINT	12
1437c478bdstevel@tonic-gate#define	VDISCARD	13
1447c478bdstevel@tonic-gate#define	VWERASE		14
1457c478bdstevel@tonic-gate#define	VLNEXT		15
14619d32b9Robert Mustacchi#define	VSTATUS		16
1479a2c468Toomas Soome#define	VERASE2		17
1489a2c468Toomas Soome/* 18 through 19 reserved for future use */
1497c478bdstevel@tonic-gate
1507c478bdstevel@tonic-gate/*
1517c478bdstevel@tonic-gate * control characters form Xenix termio.h
1527c478bdstevel@tonic-gate */
1537c478bdstevel@tonic-gate#define	VCEOF	NCC		/* RESERVED true EOF char (V7 compatability) */
1547c478bdstevel@tonic-gate#define	VCEOL	(NCC + 1)	/* RESERVED true EOL char */
1557c478bdstevel@tonic-gate
1567c478bdstevel@tonic-gate#define	CNUL	0
1577c478bdstevel@tonic-gate#define	CDEL	0177
1587c478bdstevel@tonic-gate
1597c478bdstevel@tonic-gate/* S5 default control chars */
1607c478bdstevel@tonic-gate/* CINTR, CERASE and CKILL modified to SunOS traditional values */
1617c478bdstevel@tonic-gate#define	CESC	'\\'
1627c478bdstevel@tonic-gate#define	CINTR	CTRL('c')
1637c478bdstevel@tonic-gate#define	CQUIT	034	/* FS, cntl | */
1647c478bdstevel@tonic-gate#define	CERASE	0177	/* DEL */
1659a2c468Toomas Soome#define	CERASE2	CTRL('h')
1667c478bdstevel@tonic-gate#define	CKILL	CTRL('u')
1677c478bdstevel@tonic-gate#define	CEOT	04
1687c478bdstevel@tonic-gate#define	CEOL	0
1697c478bdstevel@tonic-gate#define	CEOL2	0
1707c478bdstevel@tonic-gate#define	CEOF	04	/* cntl d */
1717c478bdstevel@tonic-gate#define	CSTART	021	/* cntl q */
1727c478bdstevel@tonic-gate#define	CSTOP	023	/* cntl s */
1737c478bdstevel@tonic-gate#define	CSWTCH	032	/* cntl z */
1747c478bdstevel@tonic-gate#define	CNSWTCH	0
1757c478bdstevel@tonic-gate#define	CSUSP	CTRL('z')
1767c478bdstevel@tonic-gate#define	CDSUSP	CTRL('y')
1777c478bdstevel@tonic-gate#define	CRPRNT	CTRL('r')
1787c478bdstevel@tonic-gate#define	CFLUSH	CTRL('o')
1797c478bdstevel@tonic-gate#define	CWERASE	CTRL('w')
1807c478bdstevel@tonic-gate#define	CLNEXT	CTRL('v')
18119d32b9Robert Mustacchi#define	CSTATUS	CTRL('t')
1827c478bdstevel@tonic-gate#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
1837c478bdstevel@tonic-gate
1847c478bdstevel@tonic-gate
1857c478bdstevel@tonic-gate/* input modes */
1867c478bdstevel@tonic-gate#define	IGNBRK	0000001
1877c478bdstevel@tonic-gate#define	BRKINT	0000002
1887c478bdstevel@tonic-gate#define	IGNPAR	0000004
1897c478bdstevel@tonic-gate#define	PARMRK	0000010
1907c478bdstevel@tonic-gate#define	INPCK	0000020
1917c478bdstevel@tonic-gate#define	ISTRIP	0000040
1927c478bdstevel@tonic-gate#define	INLCR	0000100
1937c478bdstevel@tonic-gate#define	IGNCR	0000200
1947c478bdstevel@tonic-gate#define	ICRNL	0000400
1957c478bdstevel@tonic-gate#if !defined(_POSIX_C_SOURCE) || \
1967c478bdstevel@tonic-gate	(defined(_XOPEN_SOURCE) && !defined(_XPG6)) || \
1977c478bdstevel@tonic-gate	defined(__EXTENSIONS__)
1987c478bdstevel@tonic-gate#define	IUCLC	0001000
1997c478bdstevel@tonic-gate#endif /* !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)... */
2007c478bdstevel@tonic-gate#define	IXON	0002000
2017c478bdstevel@tonic-gate#if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
2027c478bdstevel@tonic-gate	defined(__EXTENSIONS__)
2037c478bdstevel@tonic-gate#define	IXANY	0004000
2047c478bdstevel@tonic-gate#endif /* !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)... */
2057c478bdstevel@tonic-gate#define	IXOFF	0010000
2067c478bdstevel@tonic-gate#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
2077c478bdstevel@tonic-gate#define	IMAXBEL 0020000
2087c478bdstevel@tonic-gate#define	DOSMODE	0100000  /* for 386 compatibility */
2097c478bdstevel@tonic-gate#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
2107c478bdstevel@tonic-gate
2117c478bdstevel@tonic-gate/* output modes */
2127c478bdstevel@tonic-gate#define	OPOST	0000001
2137c478bdstevel@tonic-gate#if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
2147c478bdstevel@tonic-gate	defined(__EXTENSIONS__)
2157c478bdstevel@tonic-gate#if !defined(_XPG6) || defined(__EXTENSIONS__)
2167c478bdstevel@tonic-gate#define	OLCUC	0000002
2177c478bdstevel@tonic-gate#endif
2187c478bdstevel@tonic-gate#define	ONLCR	0000004
2197c478bdstevel@tonic-gate#define	OCRNL	0000010
2207c478bdstevel@tonic-gate#define	ONOCR	0000020
2217c478bdstevel@tonic-gate#define	ONLRET	0000040
2227c478bdstevel@tonic-gate#define	OFILL	0000100
2237c478bdstevel@tonic-gate#define	OFDEL	0000200
2247c478bdstevel@tonic-gate#define	NLDLY	0000400
2257c478bdstevel@tonic-gate#define	NL0	0
2267c478bdstevel@tonic-gate#define	NL1	0000400
2277c478bdstevel@tonic-gate#define	CRDLY	0003000
2287c478bdstevel@tonic-gate#define	CR0	0
2297c478bdstevel@tonic-gate#define	CR1	0001000
2307c478bdstevel@tonic-gate#define	CR2	0002000
2317c478bdstevel@tonic-gate#define	CR3	0003000
2327c478bdstevel@tonic-gate#define	TABDLY	0014000
2337c478bdstevel@tonic-gate#define	TAB0	0
2347c478bdstevel@tonic-gate#define	TAB1	0004000
2357c478bdstevel@tonic-gate#define	TAB2	0010000
2367c478bdstevel@tonic-gate#define	TAB3	0014000
2377c478bdstevel@tonic-gate#endif /* !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)... */
2387c478bdstevel@tonic-gate#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
2397c478bdstevel@tonic-gate#define	XTABS	0014000
2407c478bdstevel@tonic-gate#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
2417c478bdstevel@tonic-gate#if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
2427c478bdstevel@tonic-gate	defined(__EXTENSIONS__)
2437c478bdstevel@tonic-gate#define	BSDLY	0020000
2447c478bdstevel@tonic-gate#define	BS0	0
2457c478bdstevel@tonic-gate#define	BS1	0020000
2467c478bdstevel@tonic-gate#define	VTDLY	0040000
2477c478bdstevel@tonic-gate#define	VT0	0
2487c478bdstevel@tonic-gate#define	VT1	0040000
2497c478bdstevel@tonic-gate#define	FFDLY	0100000
2507c478bdstevel@tonic-gate#define	FF0	0
2517c478bdstevel@tonic-gate#define	FF1	0100000
2527c478bdstevel@tonic-gate#endif /* !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)... */
2537c478bdstevel@tonic-gate#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
2547c478bdstevel@tonic-gate#define	PAGEOUT 0200000
2557c478bdstevel@tonic-gate#define	WRAP	0400000
2567c478bdstevel@tonic-gate
2577c478bdstevel@tonic-gate/* control modes */
2587c478bdstevel@tonic-gate#define	CBAUD	0000017
2597c478bdstevel@tonic-gate#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
2607c478bdstevel@tonic-gate#define	CSIZE	0000060
2617c478bdstevel@tonic-gate#define	CS5	0
2627c478bdstevel@tonic-gate#define	CS6	0000020
2637c478bdstevel@tonic-gate#define	CS7	0000040
2647c478bdstevel@tonic-gate#define	CS8	0000060
2657c478bdstevel@tonic-gate#define	CSTOPB	0000100
2667c478bdstevel@tonic-gate#define	CREAD	0000200
2677c478bdstevel@tonic-gate#define	PARENB	0000400
2687c478bdstevel@tonic-gate#define	PARODD	0001000
2697c478bdstevel@tonic-gate#define	HUPCL	0002000
2707c478bdstevel@tonic-gate#define	CLOCAL	0004000
2717c478bdstevel@tonic-gate#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
2727c478bdstevel@tonic-gate#define	RCV1EN	0010000
2737c478bdstevel@tonic-gate#define	XMT1EN	0020000
2747c478bdstevel@tonic-gate#define	LOBLK	0040000
2757c478bdstevel@tonic-gate#define	XCLUDE	0100000		/* *V7* exclusive use coming fron XENIX */
2767c478bdstevel@tonic-gate#define	CRTSXOFF 010000000000
2777c478bdstevel@tonic-gate#define	CRTSCTS	020000000000
2787c478bdstevel@tonic-gate#define	CIBAUD	03600000
2797c478bdstevel@tonic-gate#define	PAREXT	04000000
2807c478bdstevel@tonic-gate#define	CBAUDEXT 010000000
2817c478bdstevel@tonic-gate#define	CIBAUDEXT 020000000
2827c478bdstevel@tonic-gate
2837c478bdstevel@tonic-gate/*
2847c478bdstevel@tonic-gate * 4.4BSD hardware flow control flags
2857c478bdstevel@tonic-gate */
2867c478bdstevel@tonic-gate#define	CRTS_IFLOW 010000000000
2877c478bdstevel@tonic-gate#define	CCTS_OFLOW 020000000000
2887c478bdstevel@tonic-gate
2897c478bdstevel@tonic-gate#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
2907c478bdstevel@tonic-gate
2917c478bdstevel@tonic-gate/* line discipline 0 modes */
2927c478bdstevel@tonic-gate#define	ISIG	0000001
2937c478bdstevel@tonic-gate#define	ICANON	0000002
2947c478bdstevel@tonic-gate#if !defined(_POSIX_C_SOURCE) || \
2957c478bdstevel@tonic-gate	(defined(_XOPEN_SOURCE) && !defined(_XPG6)) || \
2967c478bdstevel@tonic-gate	defined(__EXTENSIONS__)
2977c478bdstevel@tonic-gate#define	XCASE	0000004
2987c478bdstevel@tonic-gate#endif /* !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)... */
2997c478bdstevel@tonic-gate#define	ECHO	0000010
3007c478bdstevel@tonic-gate#define	ECHOE	0000020
3017c478bdstevel@tonic-gate#define	ECHOK	0000040
3027c478bdstevel@tonic-gate#define	ECHONL	0000100
3037c478bdstevel@tonic-gate#define	NOFLSH	0000200
3047c478bdstevel@tonic-gate#define	TOSTOP	0000400
3057c478bdstevel@tonic-gate#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
3067c478bdstevel@tonic-gate#define	ECHOCTL	0001000
3077c478bdstevel@tonic-gate#define	ECHOPRT	0002000
3087c478bdstevel@tonic-gate#define	ECHOKE	0004000
3097c478bdstevel@tonic-gate#define	DEFECHO	0010000
3107c478bdstevel@tonic-gate#define	FLUSHO	0020000
3117c478bdstevel@tonic-gate#define	PENDIN	0040000
3127c478bdstevel@tonic-gate#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
3137c478bdstevel@tonic-gate
3147c478bdstevel@tonic-gate#define	IEXTEN	0100000  /* POSIX flag - enable POSIX extensions */
3157c478bdstevel@tonic-gate#define	_TIOC	('T'<<8)
3167c478bdstevel@tonic-gate
3177c478bdstevel@tonic-gate#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
3187c478bdstevel@tonic-gate
3197c478bdstevel@tonic-gate#define	TIOC	_TIOC
3207c478bdstevel@tonic-gate
3217c478bdstevel@tonic-gate#define	TCGETA	(_TIOC|1)
3227c478bdstevel@tonic-gate#define	TCSETA	(_TIOC|2)
3237c478bdstevel@tonic-gate#define	TCSETAW	(_TIOC|3)
3247c478bdstevel@tonic-gate#define	TCSETAF	(_TIOC|4)
3257c478bdstevel@tonic-gate#define	TCSBRK	(_TIOC|5)
3267c478bdstevel@tonic-gate#define	TCXONC	(_TIOC|6)
3277c478bdstevel@tonic-gate#define	TCFLSH	(_TIOC|7)
3287c478bdstevel@tonic-gate
3297c478bdstevel@tonic-gate/* Slots reserved for 386/XENIX compatibility - keyboard control */
3307c478bdstevel@tonic-gate
3317c478bdstevel@tonic-gate#define	TIOCKBON	(_TIOC|8)
3327c478bdstevel@tonic-gate#define	TIOCKBOF 	(_TIOC|9)
3337c478bdstevel@tonic-gate#define	KBENABLED 	(_TIOC|10)
3347c478bdstevel@tonic-gate
3357c478bdstevel@tonic-gate#ifndef IOCTYPE
3367c478bdstevel@tonic-gate#define	IOCTYPE	0xff00
3377c478bdstevel@tonic-gate#endif
3387c478bdstevel@tonic-gate
3397c478bdstevel@tonic-gate#define	TCDSET	(_TIOC|32)
3407c478bdstevel@tonic-gate#define	RTS_TOG	(_TIOC|33)	/* 386 - "RTS" toggle define 8A1 protocol */
3417c478bdstevel@tonic-gate
3427c478bdstevel@tonic-gate#define	TIOCGWINSZ (_TIOC|104)
3437c478bdstevel@tonic-gate#define	TIOCSWINSZ (_TIOC|103)
3447c478bdstevel@tonic-gate
3457c478bdstevel@tonic-gate/*
3467c478bdstevel@tonic-gate * Softcarrier ioctls
3477c478bdstevel@tonic-gate */
3487c478bdstevel@tonic-gate#define	TIOCGSOFTCAR (_TIOC|105)
3497c478bdstevel@tonic-gate#define	TIOCSSOFTCAR (_TIOC|106)
3507c478bdstevel@tonic-gate
3517c478bdstevel@tonic-gate
3527c478bdstevel@tonic-gate/* termios ioctls */
3537c478bdstevel@tonic-gate
3547c478bdstevel@tonic-gate#define	TCGETS		(_TIOC|13)
3557c478bdstevel@tonic-gate#define	TCSETS		(_TIOC|14)
3567c478bdstevel@tonic-gate#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
3577c478bdstevel@tonic-gate#define	TCSANOW		(_TIOC|14) /* same as TCSETS */
3587c478bdstevel@tonic-gate#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
3597c478bdstevel@tonic-gate#define	TCSETSW		(_TIOC|15)
3607c478bdstevel@tonic-gate#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
3617c478bdstevel@tonic-gate#define	TCSADRAIN	(_TIOC|15) /* same as TCSETSW */
3627c478bdstevel@tonic-gate#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
3637c478bdstevel@tonic-gate#define	TCSETSF		(_TIOC|16)
3647c478bdstevel@tonic-gate
3657c478bdstevel@tonic-gate/*
3667c478bdstevel@tonic-gate * NTP PPS ioctls
3677c478bdstevel@tonic-gate */
3687c478bdstevel@tonic-gate#define	TIOCGPPS	(_TIOC|125)
3697c478bdstevel@tonic-gate#define	TIOCSPPS	(_TIOC|126)
3707c478bdstevel@tonic-gate#define	TIOCGPPSEV	(_TIOC|127)
3717c478bdstevel@tonic-gate
3727c478bdstevel@tonic-gate/* Argument filled in by TIOCGPPSEV */
3737c478bdstevel@tonic-gatestruct ppsclockev {
3747c478bdstevel@tonic-gate	struct timeval tv;
3757c478bdstevel@tonic-gate	uint_t serial;
3767c478bdstevel@tonic-gate};
3777c478bdstevel@tonic-gate
3787c478bdstevel@tonic-gate#if defined(_SYSCALL32)
3797c478bdstevel@tonic-gatestruct ppsclockev32 {
3807c478bdstevel@tonic-gate	struct timeval32 tv;
3817c478bdstevel@tonic-gate	uint32_t serial;
3827c478bdstevel@tonic-gate};
3837c478bdstevel@tonic-gate#endif /* _SYSCALL32 */
3847c478bdstevel@tonic-gate
3857c478bdstevel@tonic-gate#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
3867c478bdstevel@tonic-gate
3877c478bdstevel@tonic-gate#define	TCSAFLUSH	(_TIOC|16) /* same as TCSETSF */
3887c478bdstevel@tonic-gate
3897c478bdstevel@tonic-gate/* termios option flags */
3907c478bdstevel@tonic-gate
3917c478bdstevel@tonic-gate#define	TCIFLUSH	0  /* flush data received but not read */
3927c478bdstevel@tonic-gate#define	TCOFLUSH	1  /* flush data written but not transmitted */
3937c478bdstevel@tonic-gate#define	TCIOFLUSH	2  /* flush both data both input and output queues */
3947c478bdstevel@tonic-gate
3957c478bdstevel@tonic-gate#define	TCOOFF		0  /* suspend output */
3967c478bdstevel@tonic-gate#define	TCOON		1  /* restart suspended output */
3977c478bdstevel@tonic-gate#define	TCIOFF		2  /* suspend input */
3987c478bdstevel@tonic-gate#define	TCION		3  /* restart suspended input */
3997c478bdstevel@tonic-gate
4007c478bdstevel@tonic-gate/* TIOC ioctls for BSD, ptys, job control and modem control */
4017c478bdstevel@tonic-gate
4027c478bdstevel@tonic-gate#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
4037c478bdstevel@tonic-gate#define	tIOC	('t'<<8)
4047c478bdstevel@tonic-gate#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
4057c478bdstevel@tonic-gate
4067c478bdstevel@tonic-gate/* Slots for 386/XENIX compatibility */
4077c478bdstevel@tonic-gate/* BSD includes these ioctls in ttold.h */
4087c478bdstevel@tonic-gate
4097c478bdstevel@tonic-gate#ifndef _SYS_TTOLD_H
4107c478bdstevel@tonic-gate
4117c478bdstevel@tonic-gate#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
4127c478bdstevel@tonic-gate#define	TIOCGETD	(tIOC|0)
4137c478bdstevel@tonic-gate#define	TIOCSETD	(tIOC|1)
4147c478bdstevel@tonic-gate#define	TIOCHPCL	(tIOC|2)
4157c478bdstevel@tonic-gate#define	TIOCGETP	(tIOC|8)
4167c478bdstevel@tonic-gate#define	TIOCSETP  	(tIOC|9)
4177c478bdstevel@tonic-gate#define	TIOCSETN	(tIOC|10)
4187c478bdstevel@tonic-gate#define	TIOCEXCL	(tIOC|13)
4197c478bdstevel@tonic-gate#define	TIOCNXCL	(tIOC|14)
4207c478bdstevel@tonic-gate#define	TIOCFLUSH	(tIOC|16)
4217c478bdstevel@tonic-gate#define	TIOCSETC	(tIOC|17)
4227c478bdstevel@tonic-gate#define	TIOCGETC	(tIOC|18)
4237c478bdstevel@tonic-gate/*
4247c478bdstevel@tonic-gate * BSD ioctls that are not the same as XENIX are included here.
4257c478bdstevel@tonic-gate * There are also some relevant ioctls from SUN/BSD sys/ttycom.h
4267c478bdstevel@tonic-gate * BSD pty ioctls like TIOCPKT are not supported in SVR4.
4277c478bdstevel@tonic-gate */
4287c478bdstevel@tonic-gate
4297c478bdstevel@tonic-gate#define	TIOCLBIS	(tIOC|127)	/* bis local mode bits */
4307c478bdstevel@tonic-gate#define	TIOCLBIC	(tIOC|126)	/* bic local mode bits */
4317c478bdstevel@tonic-gate#define	TIOCLSET	(tIOC|125)	/* set entire local mode word */
4327c478bdstevel@tonic-gate#define	TIOCLGET	(tIOC|124)	/* get local modes */
4337c478bdstevel@tonic-gate#define	TIOCSBRK	(tIOC|123)	/* set break bit */
4347c478bdstevel@tonic-gate#define	TIOCCBRK	(tIOC|122)	/* clear break bit */
4357c478bdstevel@tonic-gate#define	TIOCSDTR	(tIOC|121)	/* set data terminal ready */
4367c478bdstevel@tonic-gate#define	TIOCCDTR	(tIOC|120)	/* clear data terminal ready */
4377c478bdstevel@tonic-gate#define	TIOCSLTC	(tIOC|117)	/* set local special chars */
4387c478bdstevel@tonic-gate#define	TIOCGLTC	(tIOC|116)	/* get local special chars */
4397c478bdstevel@tonic-gate#define	TIOCOUTQ	(tIOC|115)	/* driver output queue size */
4407c478bdstevel@tonic-gate#define	TIOCNOTTY	(tIOC|113)	/* void tty association */
4419acbbeann#define	TIOCSCTTY	(tIOC|132)	/* get a ctty */
4427c478bdstevel@tonic-gate#define	TIOCSTOP	(tIOC|111)	/* stop output, like ^S */
4437c478bdstevel@tonic-gate#define	TIOCSTART	(tIOC|110)	/* start output, like ^Q */
4447c478bdstevel@tonic-gate#define	TIOCSILOOP	(tIOC|109)	/* private to Sun; do not use */
445de81e71Tim Marsland#define	TIOCCILOOP	(tIOC|108)	/* private to Sun; do not use */
4467c478bdstevel@tonic-gate
4477c478bdstevel@tonic-gate#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
4487c478bdstevel@tonic-gate
4497c478bdstevel@tonic-gate#endif /* end _SYS_TTOLD_H */
4507c478bdstevel@tonic-gate
4517c478bdstevel@tonic-gate/* POSIX job control ioctls */
4527c478bdstevel@tonic-gate
4537c478bdstevel@tonic-gate#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
4547c478bdstevel@tonic-gate#define	TIOCGPGRP	(tIOC|20)	/* get pgrp of tty */
4557c478bdstevel@tonic-gate#define	TIOCSPGRP	(tIOC|21)	/* set pgrp of tty */
4567c478bdstevel@tonic-gate#define	TIOCGSID	(tIOC|22)	/* get session id on ctty */
4577c478bdstevel@tonic-gate
4587c478bdstevel@tonic-gate/* Miscellaneous */
4597c478bdstevel@tonic-gate#define	TIOCSTI		(tIOC|23)	/* simulate terminal input */
4607c478bdstevel@tonic-gate
4617c478bdstevel@tonic-gate/* Modem control */
4627c478bdstevel@tonic-gate#define	TIOCMSET	(tIOC|26)	/* set all modem bits */
4637c478bdstevel@tonic-gate#define	TIOCMBIS	(tIOC|27)	/* bis modem bits */
4647c478bdstevel@tonic-gate#define	TIOCMBIC	(tIOC|28)	/* bic modem bits */
4657c478bdstevel@tonic-gate#define	TIOCMGET	(tIOC|29)	/* get all modem bits */
4667c478bdstevel@tonic-gate#define		TIOCM_LE	0001		/* line enable */
4677c478bdstevel@tonic-gate#define		TIOCM_DTR	0002		/* data terminal ready */
4687c478bdstevel@tonic-gate#define		TIOCM_RTS	0004		/* request to send */
4697c478bdstevel@tonic-gate#define		TIOCM_ST	0010		/* secondary transmit */
4707c478bdstevel@tonic-gate#define		TIOCM_SR	0020		/* secondary receive */
4717c478bdstevel@tonic-gate#define		TIOCM_CTS	0040		/* clear to send */
4727c478bdstevel@tonic-gate#define		TIOCM_CAR	0100		/* carrier detect */
4737c478bdstevel@tonic-gate#define		TIOCM_CD	TIOCM_CAR
4747c478bdstevel@tonic-gate#define		TIOCM_RNG	0200		/* ring */
4757c478bdstevel@tonic-gate#define		TIOCM_RI	TIOCM_RNG
4767c478bdstevel@tonic-gate#define		TIOCM_DSR	0400		/* data set ready */
4777c478bdstevel@tonic-gate
4787c478bdstevel@tonic-gate/* pseudo-tty */
4797c478bdstevel@tonic-gate
4807c478bdstevel@tonic-gate#define	TIOCREMOTE	(tIOC|30)	/* remote input editing */
4817c478bdstevel@tonic-gate#define	TIOCSIGNAL	(tIOC|31)	/* pty: send signal to slave */
4827c478bdstevel@tonic-gate
4837c478bdstevel@tonic-gate
4847c478bdstevel@tonic-gate/* Some more 386 xenix stuff */
4857c478bdstevel@tonic-gate
4867c478bdstevel@tonic-gate#define	LDIOC	('D'<<8)
4877c478bdstevel@tonic-gate
4887c478bdstevel@tonic-gate#define	LDOPEN	(LDIOC|0)
4897c478bdstevel@tonic-gate#define	LDCLOSE	(LDIOC|1)
4907c478bdstevel@tonic-gate#define	LDCHG	(LDIOC|2)
4917c478bdstevel@tonic-gate#define	LDGETT	(LDIOC|8)
4927c478bdstevel@tonic-gate#define	LDSETT	(LDIOC|9)
4937c478bdstevel@tonic-gate
4947c478bdstevel@tonic-gate/* Slots for 386 compatibility */
4957c478bdstevel@tonic-gate
4967c478bdstevel@tonic-gate#define	LDSMAP	(LDIOC|110)
4977c478bdstevel@tonic-gate#define	LDGMAP	(LDIOC|111)
4987c478bdstevel@tonic-gate#define	LDNMAP	(LDIOC|112)
4997c478bdstevel@tonic-gate#define	LDEMAP	(LDIOC|113)
5007c478bdstevel@tonic-gate#define	LDDMAP	(LDIOC|114)
5017c478bdstevel@tonic-gate
5027c478bdstevel@tonic-gate/*
5037c478bdstevel@tonic-gate * These are retained for 386/XENIX compatibility.
5047c478bdstevel@tonic-gate */
5057c478bdstevel@tonic-gate
5067c478bdstevel@tonic-gate#define	DIOC		('d'<<8)
5077c478bdstevel@tonic-gate#define	DIOCGETP	(DIOC|8)		/* V7 */
5087c478bdstevel@tonic-gate#define	DIOCSETP	(DIOC|9)		/* V7 */
5097c478bdstevel@tonic-gate
5107c478bdstevel@tonic-gate/*
5117c478bdstevel@tonic-gate * Returns a non-zero value if there
5127c478bdstevel@tonic-gate * are characters in the input queue.
5137c478bdstevel@tonic-gate *
5147c478bdstevel@tonic-gate * XXX - somebody is confused here.  V7 had no such "ioctl", although XENIX may
5157c478bdstevel@tonic-gate * have added it; 4BSD had FIONREAD, which returned the number of characters
5167c478bdstevel@tonic-gate * waiting, and was supposed to work on all descriptors (i.e., every driver
5177c478bdstevel@tonic-gate * should make a stab at implementing it).
5187c478bdstevel@tonic-gate */
5197c478bdstevel@tonic-gate#define	FIORDCHK	(('f'<<8)|3)		/* V7 */
5207c478bdstevel@tonic-gate#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
5217c478bdstevel@tonic-gate
5227c478bdstevel@tonic-gate/*
5237c478bdstevel@tonic-gate * Speeds
5247c478bdstevel@tonic-gate */
5257c478bdstevel@tonic-gate#define	B0	0
5267c478bdstevel@tonic-gate#define	B50	1
5277c478bdstevel@tonic-gate#define	B75	2
5287c478bdstevel@tonic-gate#define	B110	3
5297c478bdstevel@tonic-gate#define	B134	4
5307c478bdstevel@tonic-gate#define	B150	5
5317c478bdstevel@tonic-gate#define	B200	6
5327c478bdstevel@tonic-gate#define	B300	7
5337c478bdstevel@tonic-gate#define	B600	8
5347c478bdstevel@tonic-gate#define	B1200	9
5357c478bdstevel@tonic-gate#define	B1800	10
5367c478bdstevel@tonic-gate#define	B2400	11
5377c478bdstevel@tonic-gate#define	B4800	12
5387c478bdstevel@tonic-gate#define	B9600	13
5397c478bdstevel@tonic-gate#define	B19200	14
5407c478bdstevel@tonic-gate#define	B38400	15
5417c478bdstevel@tonic-gate#define	B57600	16
5427c478bdstevel@tonic-gate#define	B76800	17
5437c478bdstevel@tonic-gate#define	B115200	18
5447c478bdstevel@tonic-gate#define	B153600	19
5457c478bdstevel@tonic-gate#define	B230400	20
5467c478bdstevel@tonic-gate#define	B307200	21
5477c478bdstevel@tonic-gate#define	B460800	22
548de81e71Tim Marsland#define	B921600	23
5497c478bdstevel@tonic-gate
5507c478bdstevel@tonic-gate#ifndef _SYS_TTOLD_H
5517c478bdstevel@tonic-gate
5527c478bdstevel@tonic-gate#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
5537c478bdstevel@tonic-gate/* Windowing structure to support JWINSIZE/TIOCSWINSZ/TIOCGWINSZ */
5547c478bdstevel@tonic-gatestruct winsize {
5557c478bdstevel@tonic-gate	unsigned short ws_row;	/* rows, in characters */
5567c478bdstevel@tonic-gate	unsigned short ws_col;	/* columns, in character */
5577c478bdstevel@tonic-gate	unsigned short ws_xpixel;	/* horizontal size, pixels */
5587c478bdstevel@tonic-gate	unsigned short ws_ypixel;	/* vertical size, pixels */
5597c478bdstevel@tonic-gate};
5607c478bdstevel@tonic-gate#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
5617c478bdstevel@tonic-gate
5627c478bdstevel@tonic-gate#endif /* end _SYS_TTOLD_H */
5637c478bdstevel@tonic-gate
5647c478bdstevel@tonic-gate#ifdef	__cplusplus
5657c478bdstevel@tonic-gate}
5667c478bdstevel@tonic-gate#endif
5677c478bdstevel@tonic-gate
5687c478bdstevel@tonic-gate#endif	/* _SYS_TERMIOS_H */
569