xref: /xnu-11215.1.10/bsd/sys/ttycom.h (revision 8d741a5de7ff4191bf97d57b9f54c2f6d4a15585)
1*8d741a5dSApple OSS Distributions /*
2*8d741a5dSApple OSS Distributions  * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
3*8d741a5dSApple OSS Distributions  *
4*8d741a5dSApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5*8d741a5dSApple OSS Distributions  *
6*8d741a5dSApple OSS Distributions  * This file contains Original Code and/or Modifications of Original Code
7*8d741a5dSApple OSS Distributions  * as defined in and that are subject to the Apple Public Source License
8*8d741a5dSApple OSS Distributions  * Version 2.0 (the 'License'). You may not use this file except in
9*8d741a5dSApple OSS Distributions  * compliance with the License. The rights granted to you under the License
10*8d741a5dSApple OSS Distributions  * may not be used to create, or enable the creation or redistribution of,
11*8d741a5dSApple OSS Distributions  * unlawful or unlicensed copies of an Apple operating system, or to
12*8d741a5dSApple OSS Distributions  * circumvent, violate, or enable the circumvention or violation of, any
13*8d741a5dSApple OSS Distributions  * terms of an Apple operating system software license agreement.
14*8d741a5dSApple OSS Distributions  *
15*8d741a5dSApple OSS Distributions  * Please obtain a copy of the License at
16*8d741a5dSApple OSS Distributions  * http://www.opensource.apple.com/apsl/ and read it before using this file.
17*8d741a5dSApple OSS Distributions  *
18*8d741a5dSApple OSS Distributions  * The Original Code and all software distributed under the License are
19*8d741a5dSApple OSS Distributions  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20*8d741a5dSApple OSS Distributions  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21*8d741a5dSApple OSS Distributions  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22*8d741a5dSApple OSS Distributions  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23*8d741a5dSApple OSS Distributions  * Please see the License for the specific language governing rights and
24*8d741a5dSApple OSS Distributions  * limitations under the License.
25*8d741a5dSApple OSS Distributions  *
26*8d741a5dSApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27*8d741a5dSApple OSS Distributions  */
28*8d741a5dSApple OSS Distributions /* Copyright (c) 1997 Apple Computer, Inc. All Rights Reserved */
29*8d741a5dSApple OSS Distributions /*-
30*8d741a5dSApple OSS Distributions  * Copyright (c) 1982, 1986, 1990, 1993, 1994
31*8d741a5dSApple OSS Distributions  *	The Regents of the University of California.  All rights reserved.
32*8d741a5dSApple OSS Distributions  * (c) UNIX System Laboratories, Inc.
33*8d741a5dSApple OSS Distributions  * All or some portions of this file are derived from material licensed
34*8d741a5dSApple OSS Distributions  * to the University of California by American Telephone and Telegraph
35*8d741a5dSApple OSS Distributions  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
36*8d741a5dSApple OSS Distributions  * the permission of UNIX System Laboratories, Inc.
37*8d741a5dSApple OSS Distributions  *
38*8d741a5dSApple OSS Distributions  * Redistribution and use in source and binary forms, with or without
39*8d741a5dSApple OSS Distributions  * modification, are permitted provided that the following conditions
40*8d741a5dSApple OSS Distributions  * are met:
41*8d741a5dSApple OSS Distributions  * 1. Redistributions of source code must retain the above copyright
42*8d741a5dSApple OSS Distributions  *    notice, this list of conditions and the following disclaimer.
43*8d741a5dSApple OSS Distributions  * 2. Redistributions in binary form must reproduce the above copyright
44*8d741a5dSApple OSS Distributions  *    notice, this list of conditions and the following disclaimer in the
45*8d741a5dSApple OSS Distributions  *    documentation and/or other materials provided with the distribution.
46*8d741a5dSApple OSS Distributions  * 3. All advertising materials mentioning features or use of this software
47*8d741a5dSApple OSS Distributions  *    must display the following acknowledgement:
48*8d741a5dSApple OSS Distributions  *      This product includes software developed by the University of
49*8d741a5dSApple OSS Distributions  *      California, Berkeley and its contributors.
50*8d741a5dSApple OSS Distributions  * 4. Neither the name of the University nor the names of its contributors
51*8d741a5dSApple OSS Distributions  *    may be used to endorse or promote products derived from this software
52*8d741a5dSApple OSS Distributions  *    without specific prior written permission.
53*8d741a5dSApple OSS Distributions  *
54*8d741a5dSApple OSS Distributions  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
55*8d741a5dSApple OSS Distributions  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
56*8d741a5dSApple OSS Distributions  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
57*8d741a5dSApple OSS Distributions  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
58*8d741a5dSApple OSS Distributions  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
59*8d741a5dSApple OSS Distributions  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
60*8d741a5dSApple OSS Distributions  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
61*8d741a5dSApple OSS Distributions  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
62*8d741a5dSApple OSS Distributions  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
63*8d741a5dSApple OSS Distributions  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
64*8d741a5dSApple OSS Distributions  * SUCH DAMAGE.
65*8d741a5dSApple OSS Distributions  *
66*8d741a5dSApple OSS Distributions  *	@(#)ttycom.h	8.1 (Berkeley) 3/28/94
67*8d741a5dSApple OSS Distributions  */
68*8d741a5dSApple OSS Distributions 
69*8d741a5dSApple OSS Distributions #ifndef _SYS_TTYCOM_H_
70*8d741a5dSApple OSS Distributions #define _SYS_TTYCOM_H_
71*8d741a5dSApple OSS Distributions 
72*8d741a5dSApple OSS Distributions #include <sys/ioccom.h>
73*8d741a5dSApple OSS Distributions /*
74*8d741a5dSApple OSS Distributions  * Tty ioctl's except for those supported only for backwards compatibility
75*8d741a5dSApple OSS Distributions  * with the old tty driver.
76*8d741a5dSApple OSS Distributions  */
77*8d741a5dSApple OSS Distributions 
78*8d741a5dSApple OSS Distributions /*
79*8d741a5dSApple OSS Distributions  * Window/terminal size structure.  This information is stored by the kernel
80*8d741a5dSApple OSS Distributions  * in order to provide a consistent interface, but is not used by the kernel.
81*8d741a5dSApple OSS Distributions  */
82*8d741a5dSApple OSS Distributions struct winsize {
83*8d741a5dSApple OSS Distributions 	unsigned short  ws_row;         /* rows, in characters */
84*8d741a5dSApple OSS Distributions 	unsigned short  ws_col;         /* columns, in characters */
85*8d741a5dSApple OSS Distributions 	unsigned short  ws_xpixel;      /* horizontal size, pixels */
86*8d741a5dSApple OSS Distributions 	unsigned short  ws_ypixel;      /* vertical size, pixels */
87*8d741a5dSApple OSS Distributions };
88*8d741a5dSApple OSS Distributions 
89*8d741a5dSApple OSS Distributions #define TIOCMODG        _IOR('t', 3, int)       /* get modem control state */
90*8d741a5dSApple OSS Distributions #define TIOCMODS        _IOW('t', 4, int)       /* set modem control state */
91*8d741a5dSApple OSS Distributions #define         TIOCM_LE        0001            /* line enable */
92*8d741a5dSApple OSS Distributions #define         TIOCM_DTR       0002            /* data terminal ready */
93*8d741a5dSApple OSS Distributions #define         TIOCM_RTS       0004            /* request to send */
94*8d741a5dSApple OSS Distributions #define         TIOCM_ST        0010            /* secondary transmit */
95*8d741a5dSApple OSS Distributions #define         TIOCM_SR        0020            /* secondary receive */
96*8d741a5dSApple OSS Distributions #define         TIOCM_CTS       0040            /* clear to send */
97*8d741a5dSApple OSS Distributions #define         TIOCM_CAR       0100            /* carrier detect */
98*8d741a5dSApple OSS Distributions #define         TIOCM_CD        TIOCM_CAR
99*8d741a5dSApple OSS Distributions #define         TIOCM_RNG       0200            /* ring */
100*8d741a5dSApple OSS Distributions #define         TIOCM_RI        TIOCM_RNG
101*8d741a5dSApple OSS Distributions #define         TIOCM_DSR       0400            /* data set ready */
102*8d741a5dSApple OSS Distributions                                                 /* 8-10 compat */
103*8d741a5dSApple OSS Distributions #define TIOCEXCL         _IO('t', 13)           /* set exclusive use of tty */
104*8d741a5dSApple OSS Distributions #define TIOCNXCL         _IO('t', 14)           /* reset exclusive use of tty */
105*8d741a5dSApple OSS Distributions                                                 /* 15 unused */
106*8d741a5dSApple OSS Distributions #define TIOCFLUSH       _IOW('t', 16, int)      /* flush buffers */
107*8d741a5dSApple OSS Distributions                                                 /* 17-18 compat */
108*8d741a5dSApple OSS Distributions #define TIOCGETA        _IOR('t', 19, struct termios) /* get termios struct */
109*8d741a5dSApple OSS Distributions #define TIOCSETA        _IOW('t', 20, struct termios) /* set termios struct */
110*8d741a5dSApple OSS Distributions #define TIOCSETAW       _IOW('t', 21, struct termios) /* drain output, set */
111*8d741a5dSApple OSS Distributions #define TIOCSETAF       _IOW('t', 22, struct termios) /* drn out, fls in, set */
112*8d741a5dSApple OSS Distributions #ifdef KERNEL
113*8d741a5dSApple OSS Distributions #define TIOCGETA_32     _IOR('t', 19, struct termios32) /* get termios struct */
114*8d741a5dSApple OSS Distributions #define TIOCSETA_32     _IOW('t', 20, struct termios32) /* set termios struct */
115*8d741a5dSApple OSS Distributions #define TIOCSETAW_32    _IOW('t', 21, struct termios32) /* drain output, set */
116*8d741a5dSApple OSS Distributions #define TIOCSETAF_32    _IOW('t', 22, struct termios32) /* drn out, fls in, set */
117*8d741a5dSApple OSS Distributions #define TIOCGETA_64     _IOR('t', 19, struct user_termios)
118*8d741a5dSApple OSS Distributions #define TIOCSETA_64     _IOW('t', 20, struct user_termios)
119*8d741a5dSApple OSS Distributions #define TIOCSETAW_64    _IOW('t', 21, struct user_termios)
120*8d741a5dSApple OSS Distributions #define TIOCSETAF_64    _IOW('t', 22, struct user_termios)
121*8d741a5dSApple OSS Distributions #endif  /* KERNEL */
122*8d741a5dSApple OSS Distributions #define TIOCGETD        _IOR('t', 26, int)      /* get line discipline */
123*8d741a5dSApple OSS Distributions #define TIOCSETD        _IOW('t', 27, int)      /* set line discipline */
124*8d741a5dSApple OSS Distributions #define TIOCIXON         _IO('t', 129)          /* internal input VSTART */
125*8d741a5dSApple OSS Distributions #define TIOCIXOFF        _IO('t', 128)          /* internal input VSTOP */
126*8d741a5dSApple OSS Distributions                                                 /* 127-124 compat */
127*8d741a5dSApple OSS Distributions #define TIOCSBRK         _IO('t', 123)          /* set break bit */
128*8d741a5dSApple OSS Distributions #define TIOCCBRK         _IO('t', 122)          /* clear break bit */
129*8d741a5dSApple OSS Distributions #define TIOCSDTR         _IO('t', 121)          /* set data terminal ready */
130*8d741a5dSApple OSS Distributions #define TIOCCDTR         _IO('t', 120)          /* clear data terminal ready */
131*8d741a5dSApple OSS Distributions #define TIOCGPGRP       _IOR('t', 119, int)     /* get pgrp of tty */
132*8d741a5dSApple OSS Distributions #define TIOCSPGRP       _IOW('t', 118, int)     /* set pgrp of tty */
133*8d741a5dSApple OSS Distributions                                                 /* 117-116 compat */
134*8d741a5dSApple OSS Distributions #define TIOCOUTQ        _IOR('t', 115, int)     /* output queue size */
135*8d741a5dSApple OSS Distributions #define TIOCSTI         _IOW('t', 114, char)    /* simulate terminal input */
136*8d741a5dSApple OSS Distributions #define TIOCNOTTY        _IO('t', 113)          /* void tty association */
137*8d741a5dSApple OSS Distributions #define TIOCPKT         _IOW('t', 112, int)     /* pty: set/clear packet mode */
138*8d741a5dSApple OSS Distributions #define         TIOCPKT_DATA            0x00    /* data packet */
139*8d741a5dSApple OSS Distributions #define         TIOCPKT_FLUSHREAD       0x01    /* flush packet */
140*8d741a5dSApple OSS Distributions #define         TIOCPKT_FLUSHWRITE      0x02    /* flush packet */
141*8d741a5dSApple OSS Distributions #define         TIOCPKT_STOP            0x04    /* stop output */
142*8d741a5dSApple OSS Distributions #define         TIOCPKT_START           0x08    /* start output */
143*8d741a5dSApple OSS Distributions #define         TIOCPKT_NOSTOP          0x10    /* no more ^S, ^Q */
144*8d741a5dSApple OSS Distributions #define         TIOCPKT_DOSTOP          0x20    /* now do ^S ^Q */
145*8d741a5dSApple OSS Distributions #define         TIOCPKT_IOCTL           0x40    /* state change of pty driver */
146*8d741a5dSApple OSS Distributions #define TIOCSTOP         _IO('t', 111)          /* stop output, like ^S */
147*8d741a5dSApple OSS Distributions #define TIOCSTART        _IO('t', 110)          /* start output, like ^Q */
148*8d741a5dSApple OSS Distributions #define TIOCMSET        _IOW('t', 109, int)     /* set all modem bits */
149*8d741a5dSApple OSS Distributions #define TIOCMBIS        _IOW('t', 108, int)     /* bis modem bits */
150*8d741a5dSApple OSS Distributions #define TIOCMBIC        _IOW('t', 107, int)     /* bic modem bits */
151*8d741a5dSApple OSS Distributions #define TIOCMGET        _IOR('t', 106, int)     /* get all modem bits */
152*8d741a5dSApple OSS Distributions                                                 /* 105 unused */
153*8d741a5dSApple OSS Distributions #define TIOCGWINSZ      _IOR('t', 104, struct winsize)  /* get window size */
154*8d741a5dSApple OSS Distributions #define TIOCSWINSZ      _IOW('t', 103, struct winsize)  /* set window size */
155*8d741a5dSApple OSS Distributions #define TIOCUCNTL       _IOW('t', 102, int)     /* pty: set/clr usr cntl mode */
156*8d741a5dSApple OSS Distributions #define TIOCSTAT         _IO('t', 101)          /* simulate ^T status message */
157*8d741a5dSApple OSS Distributions #define         UIOCCMD(n)      _IO('u', n)     /* usr cntl op "n" */
158*8d741a5dSApple OSS Distributions #define TIOCSCONS       _IO('t', 99)            /* 4.2 compatibility */
159*8d741a5dSApple OSS Distributions #define TIOCCONS        _IOW('t', 98, int)      /* become virtual console */
160*8d741a5dSApple OSS Distributions #define TIOCSCTTY        _IO('t', 97)           /* become controlling tty */
161*8d741a5dSApple OSS Distributions #define TIOCEXT         _IOW('t', 96, int)      /* pty: external processing */
162*8d741a5dSApple OSS Distributions #define TIOCSIG          _IO('t', 95)           /* pty: generate signal */
163*8d741a5dSApple OSS Distributions #define TIOCDRAIN        _IO('t', 94)           /* wait till output drained */
164*8d741a5dSApple OSS Distributions #define TIOCMSDTRWAIT   _IOW('t', 91, int)      /* modem: set wait on close */
165*8d741a5dSApple OSS Distributions #define TIOCMGDTRWAIT   _IOR('t', 90, int)      /* modem: get wait on close */
166*8d741a5dSApple OSS Distributions #define TIOCTIMESTAMP   _IOR('t', 89, struct timeval)   /* enable/get timestamp
167*8d741a5dSApple OSS Distributions 	                                                 * of last input event */
168*8d741a5dSApple OSS Distributions #define TIOCDCDTIMESTAMP _IOR('t', 88, struct timeval)  /* enable/get timestamp
169*8d741a5dSApple OSS Distributions 	                                                 * of last DCd rise */
170*8d741a5dSApple OSS Distributions #ifdef KERNEL
171*8d741a5dSApple OSS Distributions #define TIOCTIMESTAMP_32        _IOR('t', 89, struct user32_timeval)
172*8d741a5dSApple OSS Distributions #define TIOCDCDTIMESTAMP_32     _IOR('t', 88, struct user32_timeval)
173*8d741a5dSApple OSS Distributions #define TIOCTIMESTAMP_64        _IOR('t', 89, struct user64_timeval)
174*8d741a5dSApple OSS Distributions #define TIOCDCDTIMESTAMP_64     _IOR('t', 88, struct user64_timeval)
175*8d741a5dSApple OSS Distributions #endif
176*8d741a5dSApple OSS Distributions #define TIOCSDRAINWAIT  _IOW('t', 87, int)      /* set ttywait timeout */
177*8d741a5dSApple OSS Distributions #define TIOCGDRAINWAIT  _IOR('t', 86, int)      /* get ttywait timeout */
178*8d741a5dSApple OSS Distributions #define TIOCDSIMICROCODE _IO('t', 85)           /* download microcode to
179*8d741a5dSApple OSS Distributions 	                                         * DSI Softmodem */
180*8d741a5dSApple OSS Distributions #define TIOCPTYGRANT    _IO('t', 84)            /* grantpt(3) */
181*8d741a5dSApple OSS Distributions #define TIOCPTYGNAME    _IOC(IOC_OUT, 't', 83, 128)     /* ptsname(3) */
182*8d741a5dSApple OSS Distributions #define TIOCPTYUNLK     _IO('t', 82)            /* unlockpt(3) */
183*8d741a5dSApple OSS Distributions #ifdef KERNEL
184*8d741a5dSApple OSS Distributions #define TIOCREVOKE       _IO('t', 81)
185*8d741a5dSApple OSS Distributions #define TIOCREVOKECLEAR  _IO('t', 80)
186*8d741a5dSApple OSS Distributions #endif
187*8d741a5dSApple OSS Distributions 
188*8d741a5dSApple OSS Distributions #define TTYDISC         0               /* termios tty line discipline */
189*8d741a5dSApple OSS Distributions #define TABLDISC        3               /* tablet discipline */
190*8d741a5dSApple OSS Distributions #define SLIPDISC        4               /* serial IP discipline */
191*8d741a5dSApple OSS Distributions #define PPPDISC         5               /* PPP discipline */
192*8d741a5dSApple OSS Distributions 
193*8d741a5dSApple OSS Distributions #endif /* !_SYS_TTYCOM_H_ */
194