xref: /netbsd-src/sys/sys/ioctl_compat.h (revision 1fbab01a9353563bcc435f692ca5268e5626005a)
1*1fbab01aSdholland /*	$NetBSD: ioctl_compat.h,v 1.17 2015/09/06 06:01:02 dholland Exp $	*/
2fccfa11aScgd 
391cf0fbaScgd /*
4e71a7afcScgd  * Copyright (c) 1990, 1993
5e71a7afcScgd  *	The Regents of the University of California.  All rights reserved.
691cf0fbaScgd  * (c) UNIX System Laboratories, Inc.
791cf0fbaScgd  * All or some portions of this file are derived from material licensed
891cf0fbaScgd  * to the University of California by American Telephone and Telegraph
991cf0fbaScgd  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
1091cf0fbaScgd  * the permission of UNIX System Laboratories, Inc.
1191cf0fbaScgd  *
1291cf0fbaScgd  * Redistribution and use in source and binary forms, with or without
1391cf0fbaScgd  * modification, are permitted provided that the following conditions
1491cf0fbaScgd  * are met:
1591cf0fbaScgd  * 1. Redistributions of source code must retain the above copyright
1691cf0fbaScgd  *    notice, this list of conditions and the following disclaimer.
1791cf0fbaScgd  * 2. Redistributions in binary form must reproduce the above copyright
1891cf0fbaScgd  *    notice, this list of conditions and the following disclaimer in the
1991cf0fbaScgd  *    documentation and/or other materials provided with the distribution.
20aad01611Sagc  * 3. Neither the name of the University nor the names of its contributors
2191cf0fbaScgd  *    may be used to endorse or promote products derived from this software
2291cf0fbaScgd  *    without specific prior written permission.
2391cf0fbaScgd  *
2491cf0fbaScgd  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2591cf0fbaScgd  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2691cf0fbaScgd  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2791cf0fbaScgd  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2891cf0fbaScgd  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2991cf0fbaScgd  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3091cf0fbaScgd  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3191cf0fbaScgd  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3291cf0fbaScgd  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3391cf0fbaScgd  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3491cf0fbaScgd  * SUCH DAMAGE.
3591cf0fbaScgd  *
36f2125498Scgd  *	@(#)ioctl_compat.h	8.4 (Berkeley) 1/21/94
3791cf0fbaScgd  */
3891cf0fbaScgd 
39e164bfcbSmatt #ifndef _SYS_IOCTL_COMPAT_H_
40e164bfcbSmatt #define	_SYS_IOCTL_COMPAT_H_
41e164bfcbSmatt 
42*1fbab01aSdholland #include <sys/ioccom.h>
43a563f6baSchristos #include <sys/ttychars.h>
44a563f6baSchristos #include <sys/ttydev.h>
45a563f6baSchristos 
4691cf0fbaScgd struct tchars {
4791cf0fbaScgd 	char	t_intrc;	/* interrupt */
4891cf0fbaScgd 	char	t_quitc;	/* quit */
4991cf0fbaScgd 	char	t_startc;	/* start output */
5091cf0fbaScgd 	char	t_stopc;	/* stop output */
5191cf0fbaScgd 	char	t_eofc;		/* end-of-file */
5291cf0fbaScgd 	char	t_brkc;		/* input delimiter (like nl) */
5391cf0fbaScgd };
5491cf0fbaScgd 
5591cf0fbaScgd struct ltchars {
5691cf0fbaScgd 	char	t_suspc;	/* stop process signal */
5791cf0fbaScgd 	char	t_dsuspc;	/* delayed stop process signal */
5891cf0fbaScgd 	char	t_rprntc;	/* reprint line */
5991cf0fbaScgd 	char	t_flushc;	/* flush output (toggles) */
6091cf0fbaScgd 	char	t_werasc;	/* word erase */
6191cf0fbaScgd 	char	t_lnextc;	/* literal next character */
6291cf0fbaScgd };
6391cf0fbaScgd 
6491cf0fbaScgd /*
6591cf0fbaScgd  * Structure for TIOCGETP and TIOCSETP ioctls.
6691cf0fbaScgd  */
6791cf0fbaScgd #ifndef _SGTTYB_
6891cf0fbaScgd #define	_SGTTYB_
6991cf0fbaScgd struct sgttyb {
7091cf0fbaScgd 	char	sg_ispeed;		/* input speed */
7191cf0fbaScgd 	char	sg_ospeed;		/* output speed */
7291cf0fbaScgd 	char	sg_erase;		/* erase character */
7391cf0fbaScgd 	char	sg_kill;		/* kill character */
7491cf0fbaScgd 	short	sg_flags;		/* mode flags */
7591cf0fbaScgd };
7691cf0fbaScgd #endif
7791cf0fbaScgd 
7891cf0fbaScgd #ifdef USE_OLD_TTY
7991cf0fbaScgd # undef  TIOCGETD
8091cf0fbaScgd # define TIOCGETD	_IOR('t', 0, int)	/* get line discipline */
8191cf0fbaScgd # undef  TIOCSETD
8291cf0fbaScgd # define TIOCSETD	_IOW('t', 1, int)	/* set line discipline */
8391cf0fbaScgd #else
8491cf0fbaScgd # define OTIOCGETD	_IOR('t', 0, int)	/* get line discipline */
8591cf0fbaScgd # define OTIOCSETD	_IOW('t', 1, int)	/* set line discipline */
8691cf0fbaScgd #endif
8791cf0fbaScgd #define	TIOCHPCL	_IO('t', 2)		/* hang up on last close */
8891cf0fbaScgd #define	TIOCGETP	_IOR('t', 8,struct sgttyb)/* get parameters -- gtty */
8991cf0fbaScgd #define	TIOCSETP	_IOW('t', 9,struct sgttyb)/* set parameters -- stty */
9091cf0fbaScgd #define	TIOCSETN	_IOW('t',10,struct sgttyb)/* as above, but no flushtty*/
9191cf0fbaScgd #define	TIOCSETC	_IOW('t',17,struct tchars)/* set special characters */
9291cf0fbaScgd #define	TIOCGETC	_IOR('t',18,struct tchars)/* get special characters */
93c7ba776dSchristos /*
94c7ba776dSchristos  * The entries marked as termios below, are common and should have the
95c7ba776dSchristos  * same values.
96c7ba776dSchristos  */
9791cf0fbaScgd #define		TANDEM		0x00000001	/* send stopc on out q full */
9891cf0fbaScgd #define		CBREAK		0x00000002	/* half-cooked mode */
9991cf0fbaScgd #define		LCASE		0x00000004	/* simulate lower case */
100c7ba776dSchristos /* termios	ECHO		0x00000008	   enable echoing */
10191cf0fbaScgd #define		CRMOD		0x00000010	/* map \r to \r\n on output */
10291cf0fbaScgd #define		RAW		0x00000020	/* no i/o processing */
10391cf0fbaScgd #define		ODDP		0x00000040	/* get/send odd parity */
10491cf0fbaScgd #define		EVENP		0x00000080	/* get/send even parity */
10591cf0fbaScgd #define		ANYP		0x000000c0	/* get any parity/send none */
10691cf0fbaScgd #define		NLDELAY		0x00000300	/* \n delay */
10791cf0fbaScgd #define			NL0	0x00000000
10891cf0fbaScgd #define			NL1	0x00000100	/* tty 37 */
10991cf0fbaScgd #define			NL2	0x00000200	/* vt05 */
11091cf0fbaScgd #define			NL3	0x00000300
11191cf0fbaScgd #define		TBDELAY		0x00000c00	/* horizontal tab delay */
11291cf0fbaScgd #define			TAB0	0x00000000
11391cf0fbaScgd #define			TAB1	0x00000400	/* tty 37 */
11491cf0fbaScgd #define			TAB2	0x00000800
11591cf0fbaScgd #define		XTABS		0x00000c00	/* expand tabs on output */
11691cf0fbaScgd #define		CRDELAY		0x00003000	/* \r delay */
11791cf0fbaScgd #define			CR0	0x00000000
11891cf0fbaScgd #define			CR1	0x00001000	/* tn 300 */
11991cf0fbaScgd #define			CR2	0x00002000	/* tty 37 */
12091cf0fbaScgd #define			CR3	0x00003000	/* concept 100 */
12191cf0fbaScgd #define		VTDELAY		0x00004000	/* vertical tab delay */
12291cf0fbaScgd #define			FF0	0x00000000
12391cf0fbaScgd #define			FF1	0x00004000	/* tty 37 */
12491cf0fbaScgd #define		BSDELAY		0x00008000	/* \b delay */
12591cf0fbaScgd #define			BS0	0x00000000
12691cf0fbaScgd #define			BS1	0x00008000
12791cf0fbaScgd #define		ALLDELAY	(NLDELAY|TBDELAY|CRDELAY|VTDELAY|BSDELAY)
12891cf0fbaScgd #define		CRTBS		0x00010000	/* do backspacing for crt */
12991cf0fbaScgd #define		PRTERA		0x00020000	/* \ ... / erase */
13091cf0fbaScgd #define		CRTERA		0x00040000	/* " \b " to wipe out char */
13191cf0fbaScgd #define		TILDE		0x00080000	/* hazeltine tilde kludge */
132c7ba776dSchristos /* termios	MDMBUF		0x00100000	   DTR/DCD hardware flow control */
13391cf0fbaScgd #define		LITOUT		0x00200000	/* literal output */
134c7ba776dSchristos /* termios	TOSTOP		0x00400000	   stop background jobs on output */
135c7ba776dSchristos /* termios	FLUSHO		0x00800000	   output being flushed (state) */
13691cf0fbaScgd #define		NOHANG		0x01000000	/* (no-op) was no SIGHUP on carrier drop */
13791cf0fbaScgd #define		L001000		0x02000000
13891cf0fbaScgd #define		CRTKIL		0x04000000	/* kill line with " \b " */
13991cf0fbaScgd #define		PASS8		0x08000000
14091cf0fbaScgd #define		CTLECH		0x10000000	/* echo control chars as ^X */
141c7ba776dSchristos /* termios	PENDIN		0x20000000	   re-echo input buffer at next read */
14291cf0fbaScgd #define		DECCTQ		0x40000000	/* only ^Q starts after ^S */
143c7ba776dSchristos /* termios 	NOFLSH		0x80000000	   don't flush output on signal */
14491cf0fbaScgd #define	TIOCLBIS	_IOW('t', 127, int)	/* bis local mode bits */
14591cf0fbaScgd #define	TIOCLBIC	_IOW('t', 126, int)	/* bic local mode bits */
14691cf0fbaScgd #define	TIOCLSET	_IOW('t', 125, int)	/* set entire local mode word */
14791cf0fbaScgd #define	TIOCLGET	_IOR('t', 124, int)	/* get local modes */
14891cf0fbaScgd #define		LCRTBS		(CRTBS>>16)
14991cf0fbaScgd #define		LPRTERA		(PRTERA>>16)
15091cf0fbaScgd #define		LCRTERA		(CRTERA>>16)
15191cf0fbaScgd #define		LTILDE		(TILDE>>16)
15291cf0fbaScgd #define		LMDMBUF		(MDMBUF>>16)
15391cf0fbaScgd #define		LLITOUT		(LITOUT>>16)
15491cf0fbaScgd #define		LTOSTOP		(TOSTOP>>16)
15591cf0fbaScgd #define		LFLUSHO		(FLUSHO>>16)
15691cf0fbaScgd #define		LNOHANG		(NOHANG>>16)
15791cf0fbaScgd #define		LCRTKIL		(CRTKIL>>16)
15891cf0fbaScgd #define		LPASS8		(PASS8>>16)
15991cf0fbaScgd #define		LCTLECH		(CTLECH>>16)
16091cf0fbaScgd #define		LPENDIN		(PENDIN>>16)
16191cf0fbaScgd #define		LDECCTQ		(DECCTQ>>16)
16291cf0fbaScgd #define		LNOFLSH		(NOFLSH>>16)
16391cf0fbaScgd #define	TIOCSLTC	_IOW('t',117,struct ltchars)/* set local special chars*/
16491cf0fbaScgd #define	TIOCGLTC	_IOR('t',116,struct ltchars)/* get local special chars*/
16591cf0fbaScgd #define OTIOCCONS	_IO('t', 98)	/* for hp300 -- sans int arg */
16691cf0fbaScgd #define	OTTYDISC	0
16791cf0fbaScgd #define	NETLDISC	1
16891cf0fbaScgd #define	NTTYDISC	2
16991cf0fbaScgd 
17091cf0fbaScgd #endif /* !_SYS_IOCTL_COMPAT_H_ */
171