10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 50Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 60Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 70Sstevel@tonic-gate * with the License. 80Sstevel@tonic-gate * 90Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 100Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 110Sstevel@tonic-gate * See the License for the specific language governing permissions 120Sstevel@tonic-gate * and limitations under the License. 130Sstevel@tonic-gate * 140Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 150Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 160Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 170Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 180Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 190Sstevel@tonic-gate * 200Sstevel@tonic-gate * CDDL HEADER END 210Sstevel@tonic-gate */ 220Sstevel@tonic-gate /* 23*722Smuffin * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24*722Smuffin * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate #ifndef __SYS_TERMIOS_H 280Sstevel@tonic-gate #define __SYS_TERMIOS_H 290Sstevel@tonic-gate 300Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 310Sstevel@tonic-gate 320Sstevel@tonic-gate #include <sys/stdtypes.h> 330Sstevel@tonic-gate #include <sys/ioccom.h> 340Sstevel@tonic-gate #include <sys/ttydev.h> 350Sstevel@tonic-gate #include <sys/ttycom.h> 360Sstevel@tonic-gate 370Sstevel@tonic-gate #ifdef __cplusplus 380Sstevel@tonic-gate extern "C" { 390Sstevel@tonic-gate #endif 400Sstevel@tonic-gate 410Sstevel@tonic-gate #define NCCS 17 420Sstevel@tonic-gate 430Sstevel@tonic-gate /* 440Sstevel@tonic-gate * control characters 450Sstevel@tonic-gate * the following are not (yet) posix 460Sstevel@tonic-gate * VEOL2, VSWTCH, VDSUSP, VREPRINT, VDISCARD, VWERASE, VLNEXT, VSTATUS 470Sstevel@tonic-gate */ 480Sstevel@tonic-gate #define VINTR 0 490Sstevel@tonic-gate #define VQUIT 1 500Sstevel@tonic-gate #define VERASE 2 510Sstevel@tonic-gate #define VKILL 3 520Sstevel@tonic-gate #define VEOF 4 530Sstevel@tonic-gate #define VEOL 5 540Sstevel@tonic-gate #ifndef _POSIX_SOURCE 550Sstevel@tonic-gate #define VEOL2 6 560Sstevel@tonic-gate #define VSWTCH 7 570Sstevel@tonic-gate #endif 580Sstevel@tonic-gate #define VSTART 8 590Sstevel@tonic-gate #define VSTOP 9 600Sstevel@tonic-gate #define VSUSP 10 610Sstevel@tonic-gate #ifndef _POSIX_SOURCE 620Sstevel@tonic-gate #define VDSUSP 11 630Sstevel@tonic-gate #define VREPRINT 12 640Sstevel@tonic-gate #define VDISCARD 13 650Sstevel@tonic-gate #define VWERASE 14 660Sstevel@tonic-gate #define VLNEXT 15 670Sstevel@tonic-gate #define VSTATUS 16 680Sstevel@tonic-gate #endif 690Sstevel@tonic-gate 700Sstevel@tonic-gate #define VMIN VEOF 710Sstevel@tonic-gate #define VTIME VEOL 720Sstevel@tonic-gate 730Sstevel@tonic-gate #ifndef _POSIX_SOURCE 740Sstevel@tonic-gate #define _CTRL(c) ('c'&037) 750Sstevel@tonic-gate 760Sstevel@tonic-gate /* 770Sstevel@tonic-gate * default control chars. 780Sstevel@tonic-gate * guarded for ttychars.h. 790Sstevel@tonic-gate */ 800Sstevel@tonic-gate #ifndef CINTR 810Sstevel@tonic-gate #define CINTR _CTRL(c) 820Sstevel@tonic-gate #define CQUIT 034 /* FS, ^\ */ 830Sstevel@tonic-gate #define CERASE 0177 /* DEL, ^? */ 840Sstevel@tonic-gate #define CKILL _CTRL(u) 850Sstevel@tonic-gate #define CEOF _CTRL(d) 860Sstevel@tonic-gate #define CEOT CEOF 870Sstevel@tonic-gate #define CEOL 0 880Sstevel@tonic-gate #define CEOL2 0 890Sstevel@tonic-gate #define CSWTCH 0 900Sstevel@tonic-gate #define CNSWTCH 0 910Sstevel@tonic-gate #define CSTART _CTRL(q) 920Sstevel@tonic-gate #define CSTOP _CTRL(s) 930Sstevel@tonic-gate #define CSUSP _CTRL(z) 940Sstevel@tonic-gate #define CDSUSP _CTRL(y) 950Sstevel@tonic-gate #define CRPRNT _CTRL(r) 960Sstevel@tonic-gate #define CFLUSH _CTRL(o) 970Sstevel@tonic-gate #define CWERASE _CTRL(w) 980Sstevel@tonic-gate #define CLNEXT _CTRL(v) 990Sstevel@tonic-gate #endif /* !CINTR */ 1000Sstevel@tonic-gate 1010Sstevel@tonic-gate #define CESC '\\' 1020Sstevel@tonic-gate #define CNUL 0 1030Sstevel@tonic-gate #define CDEL 0377 1040Sstevel@tonic-gate #endif /* !_POSIX_SOURCE */ 1050Sstevel@tonic-gate 1060Sstevel@tonic-gate /* input modes */ 1070Sstevel@tonic-gate #define IGNBRK 0x00000001 1080Sstevel@tonic-gate #define BRKINT 0x00000002 1090Sstevel@tonic-gate #define IGNPAR 0x00000004 1100Sstevel@tonic-gate #define PARMRK 0x00000008 1110Sstevel@tonic-gate #define INPCK 0x00000010 1120Sstevel@tonic-gate #define ISTRIP 0x00000020 1130Sstevel@tonic-gate #define INLCR 0x00000040 1140Sstevel@tonic-gate #define IGNCR 0x00000080 1150Sstevel@tonic-gate #define ICRNL 0x00000100 1160Sstevel@tonic-gate /* IUCLC 0x00000200 not posix, defined below */ 1170Sstevel@tonic-gate #define IXON 0x00000400 1180Sstevel@tonic-gate /* IXANY 0x00000800 not posix, defined below */ 1190Sstevel@tonic-gate #define IXOFF 0x00001000 1200Sstevel@tonic-gate /* IMAXBEL 0x00002000 not posix, defined below */ 1210Sstevel@tonic-gate 1220Sstevel@tonic-gate #ifndef _POSIX_SOURCE 1230Sstevel@tonic-gate #define IUCLC 0x00000200 1240Sstevel@tonic-gate #define IXANY 0x00000800 1250Sstevel@tonic-gate #define IMAXBEL 0x00002000 1260Sstevel@tonic-gate #endif /* !_POSIX_SOURCE */ 1270Sstevel@tonic-gate 1280Sstevel@tonic-gate /* output modes */ 1290Sstevel@tonic-gate #define OPOST 0x00000001 1300Sstevel@tonic-gate #ifndef _POSIX_SOURCE 1310Sstevel@tonic-gate #define OLCUC 0x00000002 1320Sstevel@tonic-gate #define ONLCR 0x00000004 1330Sstevel@tonic-gate #define OCRNL 0x00000008 1340Sstevel@tonic-gate #define ONOCR 0x00000010 1350Sstevel@tonic-gate #define ONLRET 0x00000020 1360Sstevel@tonic-gate #define OFILL 0x00000040 1370Sstevel@tonic-gate #define OFDEL 0x00000080 1380Sstevel@tonic-gate #define NLDLY 0x00000100 1390Sstevel@tonic-gate #define NL0 0 1400Sstevel@tonic-gate #define NL1 0x00000100 1410Sstevel@tonic-gate #define CRDLY 0x00000600 1420Sstevel@tonic-gate #define CR0 0 1430Sstevel@tonic-gate #define CR1 0x00000200 1440Sstevel@tonic-gate #define CR2 0x00000400 1450Sstevel@tonic-gate #define CR3 0x00000600 1460Sstevel@tonic-gate #define TABDLY 0x00001800 1470Sstevel@tonic-gate #define TAB0 0 1480Sstevel@tonic-gate #define TAB1 0x00000800 1490Sstevel@tonic-gate #define TAB2 0x00001000 1500Sstevel@tonic-gate #define XTABS 0x00001800 1510Sstevel@tonic-gate #define TAB3 XTABS 1520Sstevel@tonic-gate #define BSDLY 0x00002000 1530Sstevel@tonic-gate #define BS0 0 1540Sstevel@tonic-gate #define BS1 0x00002000 1550Sstevel@tonic-gate #define VTDLY 0x00004000 1560Sstevel@tonic-gate #define VT0 0 1570Sstevel@tonic-gate #define VT1 0x00004000 1580Sstevel@tonic-gate #define FFDLY 0x00008000 1590Sstevel@tonic-gate #define FF0 0 1600Sstevel@tonic-gate #define FF1 0x00008000 1610Sstevel@tonic-gate #define PAGEOUT 0x00010000 1620Sstevel@tonic-gate #define WRAP 0x00020000 1630Sstevel@tonic-gate #endif /* !_POSIX_SOURCE */ 1640Sstevel@tonic-gate 1650Sstevel@tonic-gate /* control modes */ 1660Sstevel@tonic-gate #ifndef _POSIX_SOURCE 1670Sstevel@tonic-gate #define CBAUD 0x0000000f 1680Sstevel@tonic-gate #endif 1690Sstevel@tonic-gate #define CSIZE 0x00000030 1700Sstevel@tonic-gate #define CS5 0 1710Sstevel@tonic-gate #define CS6 0x00000010 1720Sstevel@tonic-gate #define CS7 0x00000020 1730Sstevel@tonic-gate #define CS8 0x00000030 1740Sstevel@tonic-gate #define CSTOPB 0x00000040 1750Sstevel@tonic-gate #define CREAD 0x00000080 1760Sstevel@tonic-gate #define PARENB 0x00000100 1770Sstevel@tonic-gate #define PARODD 0x00000200 1780Sstevel@tonic-gate #define HUPCL 0x00000400 1790Sstevel@tonic-gate #define CLOCAL 0x00000800 1800Sstevel@tonic-gate #ifndef _POSIX_SOURCE 1810Sstevel@tonic-gate #define LOBLK 0x00001000 1820Sstevel@tonic-gate #define CIBAUD 0x000f0000 1830Sstevel@tonic-gate #define CRTSXOFF 0x40000000 1840Sstevel@tonic-gate #define CRTSCTS 0x80000000 1850Sstevel@tonic-gate #define CBAUDEXT 0x200000 1860Sstevel@tonic-gate #define CIBAUDEXT 0x400000 1870Sstevel@tonic-gate 1880Sstevel@tonic-gate /* 1890Sstevel@tonic-gate * 4.4BSD flags for hardware flow control 1900Sstevel@tonic-gate */ 1910Sstevel@tonic-gate #define CRTS_IFLOW 0x40000000 1920Sstevel@tonic-gate #define CCTS_OFLOW 0x80000000 1930Sstevel@tonic-gate 1940Sstevel@tonic-gate #define IBSHIFT 16 1950Sstevel@tonic-gate #endif /* !_POSIX_SOURCE */ 1960Sstevel@tonic-gate 1970Sstevel@tonic-gate /* line discipline 0 modes */ 1980Sstevel@tonic-gate #define ISIG 0x00000001 1990Sstevel@tonic-gate #define ICANON 0x00000002 2000Sstevel@tonic-gate /* XCASE 0x00000004 not posix, defined below */ 2010Sstevel@tonic-gate #define ECHO 0x00000008 2020Sstevel@tonic-gate #define ECHOE 0x00000010 2030Sstevel@tonic-gate #define ECHOK 0x00000020 2040Sstevel@tonic-gate #define ECHONL 0x00000040 2050Sstevel@tonic-gate #define NOFLSH 0x00000080 2060Sstevel@tonic-gate #define TOSTOP 0x00000100 2070Sstevel@tonic-gate /* ECHOCTL 0x00000200 not posix, defined below */ 2080Sstevel@tonic-gate /* ECHOPRT 0x00000400 not posix, defined below */ 2090Sstevel@tonic-gate /* ECHOKE 0x00000800 not posix, defined below */ 2100Sstevel@tonic-gate /* DEFECHO 0x00001000 not posix, defined below */ 2110Sstevel@tonic-gate /* FLUSHO 0x00002000 not posix, defined below */ 2120Sstevel@tonic-gate /* PENDIN 0x00004000 not posix, defined below */ 2130Sstevel@tonic-gate #define IEXTEN 0x00008000 2140Sstevel@tonic-gate 2150Sstevel@tonic-gate #ifndef _POSIX_SOURCE 2160Sstevel@tonic-gate #define XCASE 0x00000004 2170Sstevel@tonic-gate #define ECHOCTL 0x00000200 2180Sstevel@tonic-gate #define ECHOPRT 0x00000400 2190Sstevel@tonic-gate #define ECHOKE 0x00000800 2200Sstevel@tonic-gate #define DEFECHO 0x00001000 2210Sstevel@tonic-gate #define FLUSHO 0x00002000 2220Sstevel@tonic-gate #define PENDIN 0x00004000 2230Sstevel@tonic-gate #endif /* !_POSIX_SOURCE */ 2240Sstevel@tonic-gate 2250Sstevel@tonic-gate #ifndef _POSIX_SOURCE 2260Sstevel@tonic-gate /* 2270Sstevel@tonic-gate * codes 1 through 5, not shown here, are old "termio" calls 2280Sstevel@tonic-gate */ 229*722Smuffin #define TCXONC _IO('T', 6) 230*722Smuffin #define TCFLSH _IO('T', 7) 231*722Smuffin #define TCGETS _IOR('T', 8, struct termios) 232*722Smuffin #define TCSETS _IOW('T', 9, struct termios) 233*722Smuffin #define TCSETSW _IOW('T', 10, struct termios) 234*722Smuffin #define TCSETSF _IOW('T', 11, struct termios) 2350Sstevel@tonic-gate #endif /* !_POSIX_SOURCE */ 2360Sstevel@tonic-gate 2370Sstevel@tonic-gate #define TCOOFF 0 /* arg to TCXONC & tcflow() */ 2380Sstevel@tonic-gate #define TCOON 1 /* arg to TCXONC & tcflow() */ 2390Sstevel@tonic-gate #define TCIOFF 2 /* arg to TCXONC & tcflow() */ 2400Sstevel@tonic-gate #define TCION 3 /* arg to TCXONC & tcflow() */ 2410Sstevel@tonic-gate #define TCIFLUSH 0 /* arg to TCFLSH & tcflush() */ 2420Sstevel@tonic-gate #define TCOFLUSH 1 /* arg to TCFLSH & tcflush() */ 2430Sstevel@tonic-gate #define TCIOFLUSH 2 /* arg to TCFLSH & tcflush() */ 2440Sstevel@tonic-gate #define TCSANOW 0 /* arg to tcsetattr() */ 2450Sstevel@tonic-gate #define TCSADRAIN 1 /* arg to tcsetattr() */ 2460Sstevel@tonic-gate #define TCSAFLUSH 2 /* arg to tcsetattr() */ 2470Sstevel@tonic-gate 2480Sstevel@tonic-gate /* 2490Sstevel@tonic-gate * Ioctl control packet 2500Sstevel@tonic-gate */ 2510Sstevel@tonic-gate struct termios { 2520Sstevel@tonic-gate tcflag_t c_iflag; /* input modes */ 2530Sstevel@tonic-gate tcflag_t c_oflag; /* output modes */ 2540Sstevel@tonic-gate tcflag_t c_cflag; /* control modes */ 2550Sstevel@tonic-gate tcflag_t c_lflag; /* line discipline modes */ 2560Sstevel@tonic-gate char c_line; /* line discipline XXX */ 2570Sstevel@tonic-gate cc_t c_cc[NCCS]; /* control chars */ 2580Sstevel@tonic-gate }; 2590Sstevel@tonic-gate 2600Sstevel@tonic-gate 2610Sstevel@tonic-gate #ifndef KERNEL 2620Sstevel@tonic-gate speed_t cfgetispeed(/* struct termios *termios_p */); 2630Sstevel@tonic-gate speed_t cfgetospeed(/* struct termios *termios_p */); 2640Sstevel@tonic-gate int cfsetispeed(/* struct termios *termios_p, speed_t speed */); 2650Sstevel@tonic-gate int cfsetospeed(/* struct termios *termios_p, speed_t speed */); 2660Sstevel@tonic-gate int tcdrain(/* int fildes */); 2670Sstevel@tonic-gate int tcflow(/* int fildes, int action */); 2680Sstevel@tonic-gate int tcflush(/* int fildes, int queue_selector */); 2690Sstevel@tonic-gate int tcgetattr(/* int fildes, struct termios *termios_p */); 2700Sstevel@tonic-gate int tcsendbreak(/* int fildes, int duration */); 2710Sstevel@tonic-gate int tcsetattr(/* int fildes, int optional_actions, struct *termios_p */); 2720Sstevel@tonic-gate #endif /* !KERNEL */ 2730Sstevel@tonic-gate 2740Sstevel@tonic-gate #ifdef __cplusplus 2750Sstevel@tonic-gate } 2760Sstevel@tonic-gate #endif 2770Sstevel@tonic-gate 2780Sstevel@tonic-gate #endif /* __SYS_TERMIOS_H */ 279