FreeBSD/Linux Kernel Cross Reference
sys/sys/ttycom.h
1 /* $NetBSD: ttycom.h,v 1.22 2022/12/21 19:08:22 chs Exp $ */
2
3 /*-
4 * Copyright (c) 1982, 1986, 1990, 1993, 1994
5 * The Regents of the University of California. All rights reserved.
6 * (c) UNIX System Laboratories, Inc.
7 * All or some portions of this file are derived from material licensed
8 * to the University of California by American Telephone and Telegraph
9 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
10 * the permission of UNIX System Laboratories, Inc.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * @(#)ttycom.h 8.1 (Berkeley) 3/28/94
37 */
38
39 #ifndef _POSIX_SYS_TTYCOM_H_
40 #define _POSIX_SYS_TTYCOM_H_
41
42 #include <sys/syslimits.h>
43 #include <sys/ioccom.h>
44
45 /*
46 * Tty ioctl's except for those supported only for backwards compatibility
47 * with the old tty driver.
48 */
49
50 /*
51 * Window/terminal size structure. This information is stored by the kernel
52 * in order to provide a consistent interface, but is not used by the kernel.
53 */
54 struct winsize {
55 unsigned short ws_row; /* rows, in characters */
56 unsigned short ws_col; /* columns, in characters */
57 unsigned short ws_xpixel; /* horizontal size, pixels */
58 unsigned short ws_ypixel; /* vertical size, pixels */
59 };
60 #endif /* !_POSIX_SYS_TTYCOM_H_ */
61
62 #if defined(_NETBSD_SOURCE) || defined(_SYS_IOCTL_H_)
63
64 #ifndef _NETBSD_SYS_TTYCOM_H_
65 #define _NETBSD_SYS_TTYCOM_H_
66
67 /*
68 * The following are not exposed when imported via <termios.h>
69 * when _POSIX_SOURCE (et.al.) is defined (and hence _NETBSD_SOURCE
70 * is not, unless that is added manually.)
71 */
72
73 /* ptmget, for /dev/ptm pty getting ioctl TIOCPTMGET, and for TIOCPTSNAME */
74 struct ptmget {
75 int cfd;
76 int sfd;
77 char cn[PATH_MAX];
78 char sn[PATH_MAX];
79 };
80
81 #define _PATH_PTMDEV "/dev/ptm"
82
83 #define TIOCM_LE 0001 /* line enable */
84 #define TIOCM_DTR 0002 /* data terminal ready */
85 #define TIOCM_RTS 0004 /* request to send */
86 #define TIOCM_ST 0010 /* secondary transmit */
87 #define TIOCM_SR 0020 /* secondary receive */
88 #define TIOCM_CTS 0040 /* clear to send */
89 #define TIOCM_CAR 0100 /* carrier detect */
90 #define TIOCM_CD TIOCM_CAR
91 #define TIOCM_RNG 0200 /* ring */
92 #define TIOCM_RI TIOCM_RNG
93 #define TIOCM_DSR 0400 /* data set ready */
94 /* 8-10 compat */
95 #define TIOCEXCL _IO('t', 13) /* set exclusive use of tty */
96 #define TIOCNXCL _IO('t', 14) /* reset exclusive use of tty */
97 /* 15 unused */
98 #define TIOCFLUSH _IOW('t', 16, int) /* flush buffers */
99 /* 17-18 compat */
100 #define TIOCGETA _IOR('t', 19, struct termios) /* get termios struct */
101 #define TIOCSETA _IOW('t', 20, struct termios) /* set termios struct */
102 #define TIOCSETAW _IOW('t', 21, struct termios) /* drain output, set */
103 #define TIOCSETAF _IOW('t', 22, struct termios) /* drn out, fls in, set */
104 #define TIOCGETD _IOR('t', 26, int) /* get line discipline (deprecated) */
105 #define TIOCSETD _IOW('t', 27, int) /* set line discipline (deprecated) */
106
107 /*
108 * This is the maximum length of a line discipline's name.
109 */
110 #define TTLINEDNAMELEN 32
111 typedef char linedn_t[TTLINEDNAMELEN];
112 #define TIOCGLINED _IOR('t', 66, linedn_t) /* get line discipline (new) */
113 #define TIOCSLINED _IOW('t', 67, linedn_t) /* set line discipline (new) */
114 /* 127-124 compat */
115 #define TIOCSBRK _IO('t', 123) /* set break bit */
116 #define TIOCCBRK _IO('t', 122) /* clear break bit */
117 #define TIOCSDTR _IO('t', 121) /* set data terminal ready */
118 #define TIOCCDTR _IO('t', 120) /* clear data terminal ready */
119 #define TIOCGPGRP _IOR('t', 119, int) /* get pgrp of tty */
120 #define TIOCSPGRP _IOW('t', 118, int) /* set pgrp of tty */
121 /* 117-116 compat */
122 #define TIOCOUTQ _IOR('t', 115, int) /* output queue size */
123 #define TIOCSTI _IOW('t', 114, char) /* simulate terminal input */
124 #define TIOCNOTTY _IO('t', 113) /* void tty association */
125 #define TIOCPKT _IOW('t', 112, int) /* pty: set/clear packet mode */
126 #define TIOCPKT_DATA 0x00 /* data packet */
127 #define TIOCPKT_FLUSHREAD 0x01 /* flush packet */
128 #define TIOCPKT_FLUSHWRITE 0x02 /* flush packet */
129 #define TIOCPKT_STOP 0x04 /* stop output */
130 #define TIOCPKT_START 0x08 /* start output */
131 #define TIOCPKT_NOSTOP 0x10 /* no more ^S, ^Q */
132 #define TIOCPKT_DOSTOP 0x20 /* now do ^S ^Q */
133 #define TIOCPKT_IOCTL 0x40 /* state change of pty driver */
134 #define TIOCSTOP _IO('t', 111) /* stop output, like ^S */
135 #define TIOCSTART _IO('t', 110) /* start output, like ^Q */
136 #define TIOCMSET _IOW('t', 109, int) /* set all modem bits */
137 #define TIOCMBIS _IOW('t', 108, int) /* bis modem bits */
138 #define TIOCMBIC _IOW('t', 107, int) /* bic modem bits */
139 #define TIOCMGET _IOR('t', 106, int) /* get all modem bits */
140 #define TIOCREMOTE _IOW('t', 105, int) /* remote input editing */
141 #define TIOCGWINSZ _IOR('t', 104, struct winsize) /* get window size */
142 #define TIOCSWINSZ _IOW('t', 103, struct winsize) /* set window size */
143 #define TIOCUCNTL _IOW('t', 102, int) /* pty: set/clr usr cntl mode */
144 #define TIOCSTAT _IOW('t', 101, int) /* generate status message */
145 #define UIOCCMD(n) _IO('u', n) /* usr cntl op "n" */
146 #define TIOCGSID _IOR('t', 99, int) /* get session id */
147 #define TIOCCONS _IOW('t', 98, int) /* become virtual console */
148 #define TIOCSCTTY _IO('t', 97) /* become controlling tty */
149 #define TIOCEXT _IOW('t', 96, int) /* pty: external processing */
150 #define TIOCSIG _IO('t', 95) /* pty: generate signal */
151 #define TIOCDRAIN _IO('t', 94) /* wait till output drained */
152 #define TIOCGFLAGS _IOR('t', 93, int) /* get device flags */
153 #define TIOCSFLAGS _IOW('t', 92, int) /* set device flags */
154 #define TIOCFLAG_SOFTCAR 0x01 /* ignore hardware carrier */
155 #define TIOCFLAG_CLOCAL 0x02 /* set clocal on open */
156 #define TIOCFLAG_CRTSCTS 0x04 /* set crtscts on open */
157 #define TIOCFLAG_MDMBUF 0x08 /* set mdmbuf on open */
158 #define TIOCFLAG_CDTRCTS 0x10 /* set cdtrcts on open */
159 #define TIOCDCDTIMESTAMP _IOR('t', 88, struct timeval) /* get timestamp of last
160 * Cd rise, stamp next rise */
161
162 #define TIOCPTMGET _IOR('t', 70, struct ptmget) /* get ptys */
163 #define TIOCGRANTPT _IO('t', 71) /* grantpt(3) */
164 #define TIOCPTSNAME _IOR('t', 72, struct ptmget) /* ptsname(3) */
165
166 #define TIOCSQSIZE _IOW('t', 128, int) /* set queue size */
167 #define TIOCGQSIZE _IOR('t', 129, int) /* get queue size */
168
169 #define TTYDISC 0 /* termios tty line discipline */
170 #define TABLDISC 3 /* tablet discipline */
171 #define SLIPDISC 4 /* serial IP discipline */
172 #define PPPDISC 5 /* ppp discipline */
173 #define STRIPDISC 6 /* metricom wireless IP discipline */
174 #define HDLCDISC 9 /* HDLC discipline */
175
176 #endif /* !_NETBSD_SYS_TTYCOM_H_ */
177 #endif /* _NETBSD_SOURCE || _IOCTL_H */
Cache object: 8b89399642e413048358f593171aa654
|