1 /* ioctl.h 4.26 82/12/17 */ 2 /* 3 * Ioctl definitions 4 */ 5 #ifndef _IOCTL_ 6 #define _IOCTL_ 7 #ifdef KERNEL 8 #include "../h/ttychars.h" 9 #include "../h/ttydev.h" 10 #else 11 #include <sys/ttychars.h> 12 #include <sys/ttydev.h> 13 #endif 14 15 #ifndef NOCOMPAT 16 #include <sgtty.h> 17 struct tchars { 18 char t_intrc; /* interrupt */ 19 char t_quitc; /* quit */ 20 char t_startc; /* start output */ 21 char t_stopc; /* stop output */ 22 char t_eofc; /* end-of-file */ 23 char t_brkc; /* input delimiter (like nl) */ 24 }; 25 struct ltchars { 26 char t_suspc; /* stop process signal */ 27 char t_dsuspc; /* delayed stop process signal */ 28 char t_rprntc; /* reprint line */ 29 char t_flushc; /* flush output (toggles) */ 30 char t_werasc; /* word erase */ 31 char t_lnextc; /* literal next character */ 32 }; 33 #endif 34 35 /* 36 * Ioctl's have the command encoded in the lower word, 37 * and the size of any in or out parameters in the upper 38 * word. The high 2 bits of the upper word are used 39 * to encode the in/out status of the parameter; for now 40 * we restrict parameters to at most 128 bytes. 41 */ 42 #define IOCPARM_MASK 0x7f /* parameters must be < 128 bytes */ 43 #define IOC_VOID 0x20000000 /* no parameters */ 44 #define IOC_OUT 0x40000000 /* copy out parameters */ 45 #define IOC_IN 0x80000000 /* copy in parameters */ 46 #define IOC_INOUT (IOC_IN|IOC_OUT) 47 /* the 0x20000000 is so we can distinguish new ioctl's from old */ 48 #define _IO(x,y) (IOC_VOID|('x'<<8)|y) 49 #define _IOR(x,y,t) (IOC_OUT|((sizeof(t)&IOCPARM_MASK)<<16)|('x'<<8)|y) 50 #define _IOW(x,y,t) (IOC_IN|((sizeof(t)&IOCPARM_MASK)<<16)|('x'<<8)|y) 51 /* this should be _IORW, but stdio got there first */ 52 #define _IOWR(x,y,t) (IOC_INOUT|((sizeof(t)&IOCPARM_MASK)<<16)|('x'<<8)|y) 53 54 /* 55 * tty ioctl commands 56 */ 57 #define TIOCGETD _IOR(t, 0, int) /* get line discipline */ 58 #define TIOCSETD _IOW(t, 1, int) /* set line discipline */ 59 #define TIOCHPCL _IO(t, 2) /* hang up on last close */ 60 #define TIOCMODG _IOR(t, 3, int) /* get modem control state */ 61 #define TIOCMODS _IOW(t, 4, int) /* set modem control state */ 62 #define TIOCM_LE 0001 /* line enable */ 63 #define TIOCM_DTR 0002 /* data terminal ready */ 64 #define TIOCM_RTS 0004 /* request to send */ 65 #define TIOCM_ST 0010 /* secondary transmit */ 66 #define TIOCM_SR 0020 /* secondary receive */ 67 #define TIOCM_CTS 0040 /* clear to send */ 68 #define TIOCM_CAR 0100 /* carrier detect */ 69 #define TIOCM_CD TIOCM_CAR 70 #define TIOCM_RNG 0200 /* ring */ 71 #define TIOCM_RI TIOCM_RNG 72 #define TIOCM_DSR 0400 /* data set ready */ 73 #define TIOCGETP _IOR(t, 8,struct sgttyb)/* get parameters -- gtty */ 74 #define TIOCSETP _IOW(t, 9,struct sgttyb)/* set parameters -- stty */ 75 #define TIOCSETN _IOW(t,10,struct sgttyb)/* as above, but no flushtty */ 76 #define TIOCEXCL _IO(t, 13) /* set exclusive use of tty */ 77 #define TIOCNXCL _IO(t, 14) /* reset exclusive use of tty */ 78 #define TIOCFLUSH _IOW(t, 16, int) /* flush buffers */ 79 #define TIOCSETC _IOW(t,17,struct tchars)/* set special characters */ 80 #define TIOCGETC _IOR(t,18,struct tchars)/* get special characters */ 81 #define TIOCSET _IOW(t, 19, long) /* set tty flags */ 82 #define TIOCBIS _IOW(t, 20, long) /* bis tty flags */ 83 #define TIOCBIC _IOW(t, 21, long) /* bic tty flags */ 84 #define TIOCGET _IOR(t, 22, long) /* get all tty flags */ 85 #define TANDEM 0x00000001 /* send stopc on out q full */ 86 #define CBREAK 0x00000002 /* half-cooked mode */ 87 #define LCASE 0x00000004 /* simulate lower case */ 88 #define ECHO 0x00000008 /* echo input */ 89 #define CRMOD 0x00000010 /* map \r to \r\n on output */ 90 #define RAW 0x00000020 /* no i/o processing */ 91 #define ODDP 0x00000040 /* get/send odd parity */ 92 #define EVENP 0x00000080 /* get/send even parity */ 93 #define ANYP 0x000000c0 /* get any parity/send none */ 94 #define NLDELAY 0x00000300 /* \n delay */ 95 #define NL0 0x00000000 96 #define NL1 0x00000100 /* tty 37 */ 97 #define NL2 0x00000200 /* vt05 */ 98 #define NL3 0x00000300 99 #define TBDELAY 0x00000c00 /* horizontal tab delay */ 100 #define TAB0 0x00000000 101 #define TAB1 0x00000400 /* tty 37 */ 102 #define TAB2 0x00000800 103 #define XTABS 0x00000c00 /* expand tabs on output */ 104 #define CRDELAY 0x00003000 /* \r delay */ 105 #define CR0 0x00000000 106 #define CR1 0x00001000 /* tn 300 */ 107 #define CR2 0x00002000 /* tty 37 */ 108 #define CR3 0x00003000 /* concept 100 */ 109 #define VTDELAY 0x00004000 /* vertical tab delay */ 110 #define FF0 0x00000000 111 #define FF1 0x00004000 /* tty 37 */ 112 #define BSDELAY 0x00008000 /* \b delay */ 113 #define BS0 0x00000000 114 #define BS1 0x00008000 115 #define ALLDELAY (NLDELAY|TBDELAY|CRDELAY|VTDELAY|BSDELAY) 116 #define CRTBS 0x00010000 /* do backspacing for crt */ 117 #define PRTERA 0x00020000 /* \ ... / erase */ 118 #define CRTERA 0x00040000 /* " \b " to wipe out char */ 119 #define TILDE 0x00080000 /* hazeltine tilde kludge */ 120 #define MDMBUF 0x00100000 /* start/stop output on carrier intr */ 121 #define LITOUT 0x00200000 /* literal output */ 122 #define TOSTOP 0x00400000 /* SIGSTOP on background output */ 123 #define FLUSHO 0x00800000 /* flush output to terminal */ 124 #define NOHANG 0x01000000 /* no SIGHUP on carrier drop */ 125 #define L001000 0x02000000 126 #define CRTKIL 0x04000000 /* kill line with " \b " */ 127 #define L004000 0x08000000 128 #define CTLECH 0x10000000 /* echo control chars as ^X */ 129 #define PENDIN 0x20000000 /* tp->t_rawq needs reread */ 130 #define DECCTQ 0x40000000 /* only ^Q starts after ^S */ 131 #define NOFLSH 0x80000000 /* no output flush on signal */ 132 #define TIOCCSET _IOW(t,23,struct ttychars)/* set special characters */ 133 #define TIOCCGET _IOR(t,24,struct ttychars)/* get special characters */ 134 /* locals, from 127 down */ 135 #ifndef NOCOMPAT 136 #define TIOCLBIS _IOW(t, 127, int) /* bis local mode bits */ 137 #define TIOCLBIC _IOW(t, 126, int) /* bic local mode bits */ 138 #define TIOCLSET _IOW(t, 125, int) /* set entire local mode word */ 139 #define TIOCLGET _IOR(t, 124, int) /* get local modes */ 140 #define LCRTBS (CRTBS>>16) 141 #define LPRTERA (PRTERA>>16) 142 #define LCRTERA (CRTERA>>16) 143 #define LTILDE (TILDE>>16) 144 #define LMDMBUF (MDMBUF>>16) 145 #define LLITOUT (LITOUT>>16) 146 #define LTOSTOP (TOSTOP>>16) 147 #define LFLUSHO (FLUSHO>>16) 148 #define LNOHANG (NOHANG>>16) 149 #define LCRTKIL (CRTKIL>>16) 150 #define LCTLECH (CTLECH>>16) 151 #define LPENDIN (PENDIN>>16) 152 #define LDECCTQ (DECCTQ>>16) 153 #define LNOFLSH (NOFLSH>>16) 154 #endif 155 #define TIOCSBRK _IO(t, 123) /* set break bit */ 156 #define TIOCCBRK _IO(t, 122) /* clear break bit */ 157 #define TIOCSDTR _IO(t, 121) /* set data terminal ready */ 158 #define TIOCCDTR _IO(t, 120) /* clear data terminal ready */ 159 #define TIOCGPGRP _IOR(t, 119, int) /* get pgrp of tty */ 160 #define TIOCSPGRP _IOW(t, 118, int) /* set pgrp of tty */ 161 #define TIOCSLTC _IOW(t,117,struct ltchars)/* set local special chars */ 162 #define TIOCGLTC _IOR(t,116,struct ltchars)/* get local special chars */ 163 #define TIOCSTI _IOW(t, 114, char) /* simulate terminal input */ 164 #define TIOCNOTTY _IO(t, 113) /* void tty association */ 165 #define TIOCPKT _IOW(t, 112, int) /* pty: set/clear packet mode */ 166 #define TIOCPKT_DATA 0x00 /* data packet */ 167 #define TIOCPKT_FLUSHREAD 0x01 /* flush packet */ 168 #define TIOCPKT_FLUSHWRITE 0x02 /* flush packet */ 169 #define TIOCPKT_STOP 0x04 /* stop output */ 170 #define TIOCPKT_START 0x08 /* start output */ 171 #define TIOCPKT_NOSTOP 0x10 /* no more ^S, ^Q */ 172 #define TIOCPKT_DOSTOP 0x20 /* now do ^S ^Q */ 173 #define TIOCSTOP _IO(t, 111) /* stop output, like ^S */ 174 #define TIOCSTART _IO(t, 110) /* start output, like ^Q */ 175 #define TIOCMSET _IOW(t, 109, int) /* set all modem bits */ 176 #define TIOCMBIS _IOW(t, 108, int) /* bis modem bits */ 177 #define TIOCMBIC _IOW(t, 107, int) /* bic modem bits */ 178 #define TIOCMGET _IOR(t, 106, int) /* get all modem bits */ 179 #define TIOCREMOTE _IO(t, 105) /* remote input editing */ 180 181 #define OTTYDISC 0 /* old, v7 std tty driver */ 182 #define NETLDISC 1 /* line discip for berk net */ 183 #define NTTYDISC 2 /* new tty discipline */ 184 #define TABLDISC 3 /* hitachi tablet discipline */ 185 #define NTABLDISC 4 /* gtco tablet discipline */ 186 187 #define FIOCLEX _IO(f, 1) /* set exclusive use on fd */ 188 #define FIONCLEX _IO(f, 2) /* remove exclusive use */ 189 /* another local */ 190 #define FIONREAD _IOR(f, 127, int) /* get # bytes to read */ 191 #define FIONBIO _IOW(f, 126, int) /* set/clear non-blocking i/o */ 192 #define FIOASYNC _IOW(f, 125, int) /* set/clear async i/o */ 193 194 /* socket i/o controls */ 195 #define SIOCDONE _IOW(s, 0, int) /* shutdown read/write */ 196 #define SIOCSKEEP _IOW(s, 1, int) /* set keep alive */ 197 #define SIOCGKEEP _IOR(s, 2, int) /* inspect keep alive */ 198 #define SIOCSLINGER _IOW(s, 3, int) /* set linger time */ 199 #define SIOCGLINGER _IOR(s, 4, int) /* get linger time */ 200 #define SIOCSENDOOB _IOW(s, 5, char) /* send oob data */ 201 #define SIOCRCVOOB _IOR(s, 6, char) /* recv oob data */ 202 #define SIOCATMARK _IOR(s, 7, int) /* at out of band mark? */ 203 #define SIOCSPGRP _IOW(s, 8, int) /* set process group */ 204 #define SIOCGPGRP _IOR(s, 9, int) /* get process group */ 205 #define SIOCADDRT _IOW(s,10, struct rtentry)/* add route */ 206 #define SIOCDELRT _IOW(s,11, struct rtentry)/* delete route */ 207 #endif 208