1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright (c) 2001 by Sun Microsystems, Inc. 24*0Sstevel@tonic-gate * All rights reserved. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #ifndef __SYS_TERMIOS_H 28*0Sstevel@tonic-gate #define __SYS_TERMIOS_H 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate #include <sys/stdtypes.h> 33*0Sstevel@tonic-gate #include <sys/ioccom.h> 34*0Sstevel@tonic-gate #include <sys/ttydev.h> 35*0Sstevel@tonic-gate #include <sys/ttycom.h> 36*0Sstevel@tonic-gate 37*0Sstevel@tonic-gate #ifdef __cplusplus 38*0Sstevel@tonic-gate extern "C" { 39*0Sstevel@tonic-gate #endif 40*0Sstevel@tonic-gate 41*0Sstevel@tonic-gate #define NCCS 17 42*0Sstevel@tonic-gate 43*0Sstevel@tonic-gate /* 44*0Sstevel@tonic-gate * control characters 45*0Sstevel@tonic-gate * the following are not (yet) posix 46*0Sstevel@tonic-gate * VEOL2, VSWTCH, VDSUSP, VREPRINT, VDISCARD, VWERASE, VLNEXT, VSTATUS 47*0Sstevel@tonic-gate */ 48*0Sstevel@tonic-gate #define VINTR 0 49*0Sstevel@tonic-gate #define VQUIT 1 50*0Sstevel@tonic-gate #define VERASE 2 51*0Sstevel@tonic-gate #define VKILL 3 52*0Sstevel@tonic-gate #define VEOF 4 53*0Sstevel@tonic-gate #define VEOL 5 54*0Sstevel@tonic-gate #ifndef _POSIX_SOURCE 55*0Sstevel@tonic-gate #define VEOL2 6 56*0Sstevel@tonic-gate #define VSWTCH 7 57*0Sstevel@tonic-gate #endif 58*0Sstevel@tonic-gate #define VSTART 8 59*0Sstevel@tonic-gate #define VSTOP 9 60*0Sstevel@tonic-gate #define VSUSP 10 61*0Sstevel@tonic-gate #ifndef _POSIX_SOURCE 62*0Sstevel@tonic-gate #define VDSUSP 11 63*0Sstevel@tonic-gate #define VREPRINT 12 64*0Sstevel@tonic-gate #define VDISCARD 13 65*0Sstevel@tonic-gate #define VWERASE 14 66*0Sstevel@tonic-gate #define VLNEXT 15 67*0Sstevel@tonic-gate #define VSTATUS 16 68*0Sstevel@tonic-gate #endif 69*0Sstevel@tonic-gate 70*0Sstevel@tonic-gate #define VMIN VEOF 71*0Sstevel@tonic-gate #define VTIME VEOL 72*0Sstevel@tonic-gate 73*0Sstevel@tonic-gate #ifndef _POSIX_SOURCE 74*0Sstevel@tonic-gate #define _CTRL(c) ('c'&037) 75*0Sstevel@tonic-gate 76*0Sstevel@tonic-gate /* 77*0Sstevel@tonic-gate * default control chars. 78*0Sstevel@tonic-gate * guarded for ttychars.h. 79*0Sstevel@tonic-gate */ 80*0Sstevel@tonic-gate #ifndef CINTR 81*0Sstevel@tonic-gate #define CINTR _CTRL(c) 82*0Sstevel@tonic-gate #define CQUIT 034 /* FS, ^\ */ 83*0Sstevel@tonic-gate #define CERASE 0177 /* DEL, ^? */ 84*0Sstevel@tonic-gate #define CKILL _CTRL(u) 85*0Sstevel@tonic-gate #define CEOF _CTRL(d) 86*0Sstevel@tonic-gate #define CEOT CEOF 87*0Sstevel@tonic-gate #define CEOL 0 88*0Sstevel@tonic-gate #define CEOL2 0 89*0Sstevel@tonic-gate #define CSWTCH 0 90*0Sstevel@tonic-gate #define CNSWTCH 0 91*0Sstevel@tonic-gate #define CSTART _CTRL(q) 92*0Sstevel@tonic-gate #define CSTOP _CTRL(s) 93*0Sstevel@tonic-gate #define CSUSP _CTRL(z) 94*0Sstevel@tonic-gate #define CDSUSP _CTRL(y) 95*0Sstevel@tonic-gate #define CRPRNT _CTRL(r) 96*0Sstevel@tonic-gate #define CFLUSH _CTRL(o) 97*0Sstevel@tonic-gate #define CWERASE _CTRL(w) 98*0Sstevel@tonic-gate #define CLNEXT _CTRL(v) 99*0Sstevel@tonic-gate #endif /* !CINTR */ 100*0Sstevel@tonic-gate 101*0Sstevel@tonic-gate #define CESC '\\' 102*0Sstevel@tonic-gate #define CNUL 0 103*0Sstevel@tonic-gate #define CDEL 0377 104*0Sstevel@tonic-gate #endif /* !_POSIX_SOURCE */ 105*0Sstevel@tonic-gate 106*0Sstevel@tonic-gate /* input modes */ 107*0Sstevel@tonic-gate #define IGNBRK 0x00000001 108*0Sstevel@tonic-gate #define BRKINT 0x00000002 109*0Sstevel@tonic-gate #define IGNPAR 0x00000004 110*0Sstevel@tonic-gate #define PARMRK 0x00000008 111*0Sstevel@tonic-gate #define INPCK 0x00000010 112*0Sstevel@tonic-gate #define ISTRIP 0x00000020 113*0Sstevel@tonic-gate #define INLCR 0x00000040 114*0Sstevel@tonic-gate #define IGNCR 0x00000080 115*0Sstevel@tonic-gate #define ICRNL 0x00000100 116*0Sstevel@tonic-gate /* IUCLC 0x00000200 not posix, defined below */ 117*0Sstevel@tonic-gate #define IXON 0x00000400 118*0Sstevel@tonic-gate /* IXANY 0x00000800 not posix, defined below */ 119*0Sstevel@tonic-gate #define IXOFF 0x00001000 120*0Sstevel@tonic-gate /* IMAXBEL 0x00002000 not posix, defined below */ 121*0Sstevel@tonic-gate 122*0Sstevel@tonic-gate #ifndef _POSIX_SOURCE 123*0Sstevel@tonic-gate #define IUCLC 0x00000200 124*0Sstevel@tonic-gate #define IXANY 0x00000800 125*0Sstevel@tonic-gate #define IMAXBEL 0x00002000 126*0Sstevel@tonic-gate #endif /* !_POSIX_SOURCE */ 127*0Sstevel@tonic-gate 128*0Sstevel@tonic-gate /* output modes */ 129*0Sstevel@tonic-gate #define OPOST 0x00000001 130*0Sstevel@tonic-gate #ifndef _POSIX_SOURCE 131*0Sstevel@tonic-gate #define OLCUC 0x00000002 132*0Sstevel@tonic-gate #define ONLCR 0x00000004 133*0Sstevel@tonic-gate #define OCRNL 0x00000008 134*0Sstevel@tonic-gate #define ONOCR 0x00000010 135*0Sstevel@tonic-gate #define ONLRET 0x00000020 136*0Sstevel@tonic-gate #define OFILL 0x00000040 137*0Sstevel@tonic-gate #define OFDEL 0x00000080 138*0Sstevel@tonic-gate #define NLDLY 0x00000100 139*0Sstevel@tonic-gate #define NL0 0 140*0Sstevel@tonic-gate #define NL1 0x00000100 141*0Sstevel@tonic-gate #define CRDLY 0x00000600 142*0Sstevel@tonic-gate #define CR0 0 143*0Sstevel@tonic-gate #define CR1 0x00000200 144*0Sstevel@tonic-gate #define CR2 0x00000400 145*0Sstevel@tonic-gate #define CR3 0x00000600 146*0Sstevel@tonic-gate #define TABDLY 0x00001800 147*0Sstevel@tonic-gate #define TAB0 0 148*0Sstevel@tonic-gate #define TAB1 0x00000800 149*0Sstevel@tonic-gate #define TAB2 0x00001000 150*0Sstevel@tonic-gate #define XTABS 0x00001800 151*0Sstevel@tonic-gate #define TAB3 XTABS 152*0Sstevel@tonic-gate #define BSDLY 0x00002000 153*0Sstevel@tonic-gate #define BS0 0 154*0Sstevel@tonic-gate #define BS1 0x00002000 155*0Sstevel@tonic-gate #define VTDLY 0x00004000 156*0Sstevel@tonic-gate #define VT0 0 157*0Sstevel@tonic-gate #define VT1 0x00004000 158*0Sstevel@tonic-gate #define FFDLY 0x00008000 159*0Sstevel@tonic-gate #define FF0 0 160*0Sstevel@tonic-gate #define FF1 0x00008000 161*0Sstevel@tonic-gate #define PAGEOUT 0x00010000 162*0Sstevel@tonic-gate #define WRAP 0x00020000 163*0Sstevel@tonic-gate #endif /* !_POSIX_SOURCE */ 164*0Sstevel@tonic-gate 165*0Sstevel@tonic-gate /* control modes */ 166*0Sstevel@tonic-gate #ifndef _POSIX_SOURCE 167*0Sstevel@tonic-gate #define CBAUD 0x0000000f 168*0Sstevel@tonic-gate #endif 169*0Sstevel@tonic-gate #define CSIZE 0x00000030 170*0Sstevel@tonic-gate #define CS5 0 171*0Sstevel@tonic-gate #define CS6 0x00000010 172*0Sstevel@tonic-gate #define CS7 0x00000020 173*0Sstevel@tonic-gate #define CS8 0x00000030 174*0Sstevel@tonic-gate #define CSTOPB 0x00000040 175*0Sstevel@tonic-gate #define CREAD 0x00000080 176*0Sstevel@tonic-gate #define PARENB 0x00000100 177*0Sstevel@tonic-gate #define PARODD 0x00000200 178*0Sstevel@tonic-gate #define HUPCL 0x00000400 179*0Sstevel@tonic-gate #define CLOCAL 0x00000800 180*0Sstevel@tonic-gate #ifndef _POSIX_SOURCE 181*0Sstevel@tonic-gate #define LOBLK 0x00001000 182*0Sstevel@tonic-gate #define CIBAUD 0x000f0000 183*0Sstevel@tonic-gate #define CRTSXOFF 0x40000000 184*0Sstevel@tonic-gate #define CRTSCTS 0x80000000 185*0Sstevel@tonic-gate #define CBAUDEXT 0x200000 186*0Sstevel@tonic-gate #define CIBAUDEXT 0x400000 187*0Sstevel@tonic-gate 188*0Sstevel@tonic-gate /* 189*0Sstevel@tonic-gate * 4.4BSD flags for hardware flow control 190*0Sstevel@tonic-gate */ 191*0Sstevel@tonic-gate #define CRTS_IFLOW 0x40000000 192*0Sstevel@tonic-gate #define CCTS_OFLOW 0x80000000 193*0Sstevel@tonic-gate 194*0Sstevel@tonic-gate #define IBSHIFT 16 195*0Sstevel@tonic-gate #endif /* !_POSIX_SOURCE */ 196*0Sstevel@tonic-gate 197*0Sstevel@tonic-gate /* line discipline 0 modes */ 198*0Sstevel@tonic-gate #define ISIG 0x00000001 199*0Sstevel@tonic-gate #define ICANON 0x00000002 200*0Sstevel@tonic-gate /* XCASE 0x00000004 not posix, defined below */ 201*0Sstevel@tonic-gate #define ECHO 0x00000008 202*0Sstevel@tonic-gate #define ECHOE 0x00000010 203*0Sstevel@tonic-gate #define ECHOK 0x00000020 204*0Sstevel@tonic-gate #define ECHONL 0x00000040 205*0Sstevel@tonic-gate #define NOFLSH 0x00000080 206*0Sstevel@tonic-gate #define TOSTOP 0x00000100 207*0Sstevel@tonic-gate /* ECHOCTL 0x00000200 not posix, defined below */ 208*0Sstevel@tonic-gate /* ECHOPRT 0x00000400 not posix, defined below */ 209*0Sstevel@tonic-gate /* ECHOKE 0x00000800 not posix, defined below */ 210*0Sstevel@tonic-gate /* DEFECHO 0x00001000 not posix, defined below */ 211*0Sstevel@tonic-gate /* FLUSHO 0x00002000 not posix, defined below */ 212*0Sstevel@tonic-gate /* PENDIN 0x00004000 not posix, defined below */ 213*0Sstevel@tonic-gate #define IEXTEN 0x00008000 214*0Sstevel@tonic-gate 215*0Sstevel@tonic-gate #ifndef _POSIX_SOURCE 216*0Sstevel@tonic-gate #define XCASE 0x00000004 217*0Sstevel@tonic-gate #define ECHOCTL 0x00000200 218*0Sstevel@tonic-gate #define ECHOPRT 0x00000400 219*0Sstevel@tonic-gate #define ECHOKE 0x00000800 220*0Sstevel@tonic-gate #define DEFECHO 0x00001000 221*0Sstevel@tonic-gate #define FLUSHO 0x00002000 222*0Sstevel@tonic-gate #define PENDIN 0x00004000 223*0Sstevel@tonic-gate #endif /* !_POSIX_SOURCE */ 224*0Sstevel@tonic-gate 225*0Sstevel@tonic-gate #ifndef _POSIX_SOURCE 226*0Sstevel@tonic-gate /* 227*0Sstevel@tonic-gate * codes 1 through 5, not shown here, are old "termio" calls 228*0Sstevel@tonic-gate */ 229*0Sstevel@tonic-gate #define TCXONC _IO(T, 6) 230*0Sstevel@tonic-gate #define TCFLSH _IO(T, 7) 231*0Sstevel@tonic-gate #define TCGETS _IOR(T, 8, struct termios) 232*0Sstevel@tonic-gate #define TCSETS _IOW(T, 9, struct termios) 233*0Sstevel@tonic-gate #define TCSETSW _IOW(T, 10, struct termios) 234*0Sstevel@tonic-gate #define TCSETSF _IOW(T, 11, struct termios) 235*0Sstevel@tonic-gate #endif /* !_POSIX_SOURCE */ 236*0Sstevel@tonic-gate 237*0Sstevel@tonic-gate #define TCOOFF 0 /* arg to TCXONC & tcflow() */ 238*0Sstevel@tonic-gate #define TCOON 1 /* arg to TCXONC & tcflow() */ 239*0Sstevel@tonic-gate #define TCIOFF 2 /* arg to TCXONC & tcflow() */ 240*0Sstevel@tonic-gate #define TCION 3 /* arg to TCXONC & tcflow() */ 241*0Sstevel@tonic-gate #define TCIFLUSH 0 /* arg to TCFLSH & tcflush() */ 242*0Sstevel@tonic-gate #define TCOFLUSH 1 /* arg to TCFLSH & tcflush() */ 243*0Sstevel@tonic-gate #define TCIOFLUSH 2 /* arg to TCFLSH & tcflush() */ 244*0Sstevel@tonic-gate #define TCSANOW 0 /* arg to tcsetattr() */ 245*0Sstevel@tonic-gate #define TCSADRAIN 1 /* arg to tcsetattr() */ 246*0Sstevel@tonic-gate #define TCSAFLUSH 2 /* arg to tcsetattr() */ 247*0Sstevel@tonic-gate 248*0Sstevel@tonic-gate /* 249*0Sstevel@tonic-gate * Ioctl control packet 250*0Sstevel@tonic-gate */ 251*0Sstevel@tonic-gate struct termios { 252*0Sstevel@tonic-gate tcflag_t c_iflag; /* input modes */ 253*0Sstevel@tonic-gate tcflag_t c_oflag; /* output modes */ 254*0Sstevel@tonic-gate tcflag_t c_cflag; /* control modes */ 255*0Sstevel@tonic-gate tcflag_t c_lflag; /* line discipline modes */ 256*0Sstevel@tonic-gate char c_line; /* line discipline XXX */ 257*0Sstevel@tonic-gate cc_t c_cc[NCCS]; /* control chars */ 258*0Sstevel@tonic-gate }; 259*0Sstevel@tonic-gate 260*0Sstevel@tonic-gate 261*0Sstevel@tonic-gate #ifndef KERNEL 262*0Sstevel@tonic-gate speed_t cfgetispeed(/* struct termios *termios_p */); 263*0Sstevel@tonic-gate speed_t cfgetospeed(/* struct termios *termios_p */); 264*0Sstevel@tonic-gate int cfsetispeed(/* struct termios *termios_p, speed_t speed */); 265*0Sstevel@tonic-gate int cfsetospeed(/* struct termios *termios_p, speed_t speed */); 266*0Sstevel@tonic-gate int tcdrain(/* int fildes */); 267*0Sstevel@tonic-gate int tcflow(/* int fildes, int action */); 268*0Sstevel@tonic-gate int tcflush(/* int fildes, int queue_selector */); 269*0Sstevel@tonic-gate int tcgetattr(/* int fildes, struct termios *termios_p */); 270*0Sstevel@tonic-gate int tcsendbreak(/* int fildes, int duration */); 271*0Sstevel@tonic-gate int tcsetattr(/* int fildes, int optional_actions, struct *termios_p */); 272*0Sstevel@tonic-gate #endif /* !KERNEL */ 273*0Sstevel@tonic-gate 274*0Sstevel@tonic-gate #ifdef __cplusplus 275*0Sstevel@tonic-gate } 276*0Sstevel@tonic-gate #endif 277*0Sstevel@tonic-gate 278*0Sstevel@tonic-gate #endif /* __SYS_TERMIOS_H */ 279