1 /* ioctl.h 4.34 83/06/13 */ 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 #include <sgtty.h> 16 struct tchars { 17 char t_intrc; /* interrupt */ 18 char t_quitc; /* quit */ 19 char t_startc; /* start output */ 20 char t_stopc; /* stop output */ 21 char t_eofc; /* end-of-file */ 22 char t_brkc; /* input delimiter (like nl) */ 23 }; 24 struct ltchars { 25 char t_suspc; /* stop process signal */ 26 char t_dsuspc; /* delayed stop process signal */ 27 char t_rprntc; /* reprint line */ 28 char t_flushc; /* flush output (toggles) */ 29 char t_werasc; /* word erase */ 30 char t_lnextc; /* literal next character */ 31 }; 32 33 #ifndef _IO 34 /* 35 * Ioctl's have the command encoded in the lower word, 36 * and the size of any in or out parameters in the upper 37 * word. The high 2 bits of the upper word are used 38 * to encode the in/out status of the parameter; for now 39 * we restrict parameters to at most 128 bytes. 40 */ 41 #define IOCPARM_MASK 0x7f /* parameters must be < 128 bytes */ 42 #define IOC_VOID 0x20000000 /* no parameters */ 43 #define IOC_OUT 0x40000000 /* copy out parameters */ 44 #define IOC_IN 0x80000000 /* copy in parameters */ 45 #define IOC_INOUT (IOC_IN|IOC_OUT) 46 /* the 0x20000000 is so we can distinguish new ioctl's from old */ 47 #define _IO(x,y) (IOC_VOID|('x'<<8)|y) 48 #define _IOR(x,y,t) (IOC_OUT|((sizeof(t)&IOCPARM_MASK)<<16)|('x'<<8)|y) 49 #define _IOW(x,y,t) (IOC_IN|((sizeof(t)&IOCPARM_MASK)<<16)|('x'<<8)|y) 50 /* this should be _IORW, but stdio got there first */ 51 #define _IOWR(x,y,t) (IOC_INOUT|((sizeof(t)&IOCPARM_MASK)<<16)|('x'<<8)|y) 52 #endif 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 TANDEM 0x00000001 /* send stopc on out q full */ 82 #define CBREAK 0x00000002 /* half-cooked mode */ 83 #define LCASE 0x00000004 /* simulate lower case */ 84 #define ECHO 0x00000008 /* echo input */ 85 #define CRMOD 0x00000010 /* map \r to \r\n on output */ 86 #define RAW 0x00000020 /* no i/o processing */ 87 #define ODDP 0x00000040 /* get/send odd parity */ 88 #define EVENP 0x00000080 /* get/send even parity */ 89 #define ANYP 0x000000c0 /* get any parity/send none */ 90 #define NLDELAY 0x00000300 /* \n delay */ 91 #define NL0 0x00000000 92 #define NL1 0x00000100 /* tty 37 */ 93 #define NL2 0x00000200 /* vt05 */ 94 #define NL3 0x00000300 95 #define TBDELAY 0x00000c00 /* horizontal tab delay */ 96 #define TAB0 0x00000000 97 #define TAB1 0x00000400 /* tty 37 */ 98 #define TAB2 0x00000800 99 #define XTABS 0x00000c00 /* expand tabs on output */ 100 #define CRDELAY 0x00003000 /* \r delay */ 101 #define CR0 0x00000000 102 #define CR1 0x00001000 /* tn 300 */ 103 #define CR2 0x00002000 /* tty 37 */ 104 #define CR3 0x00003000 /* concept 100 */ 105 #define VTDELAY 0x00004000 /* vertical tab delay */ 106 #define FF0 0x00000000 107 #define FF1 0x00004000 /* tty 37 */ 108 #define BSDELAY 0x00008000 /* \b delay */ 109 #define BS0 0x00000000 110 #define BS1 0x00008000 111 #define ALLDELAY (NLDELAY|TBDELAY|CRDELAY|VTDELAY|BSDELAY) 112 #define CRTBS 0x00010000 /* do backspacing for crt */ 113 #define PRTERA 0x00020000 /* \ ... / erase */ 114 #define CRTERA 0x00040000 /* " \b " to wipe out char */ 115 #define TILDE 0x00080000 /* hazeltine tilde kludge */ 116 #define MDMBUF 0x00100000 /* start/stop output on carrier intr */ 117 #define LITOUT 0x00200000 /* literal output */ 118 #define TOSTOP 0x00400000 /* SIGSTOP on background output */ 119 #define FLUSHO 0x00800000 /* flush output to terminal */ 120 #define NOHANG 0x01000000 /* no SIGHUP on carrier drop */ 121 #define L001000 0x02000000 122 #define CRTKIL 0x04000000 /* kill line with " \b " */ 123 #define L004000 0x08000000 124 #define CTLECH 0x10000000 /* echo control chars as ^X */ 125 #define PENDIN 0x20000000 /* tp->t_rawq needs reread */ 126 #define DECCTQ 0x40000000 /* only ^Q starts after ^S */ 127 #define NOFLSH 0x80000000 /* no output flush on signal */ 128 /* locals, from 127 down */ 129 #define TIOCLBIS _IOW(t, 127, int) /* bis local mode bits */ 130 #define TIOCLBIC _IOW(t, 126, int) /* bic local mode bits */ 131 #define TIOCLSET _IOW(t, 125, int) /* set entire local mode word */ 132 #define TIOCLGET _IOR(t, 124, int) /* get local modes */ 133 #define LCRTBS (CRTBS>>16) 134 #define LPRTERA (PRTERA>>16) 135 #define LCRTERA (CRTERA>>16) 136 #define LTILDE (TILDE>>16) 137 #define LMDMBUF (MDMBUF>>16) 138 #define LLITOUT (LITOUT>>16) 139 #define LTOSTOP (TOSTOP>>16) 140 #define LFLUSHO (FLUSHO>>16) 141 #define LNOHANG (NOHANG>>16) 142 #define LCRTKIL (CRTKIL>>16) 143 #define LCTLECH (CTLECH>>16) 144 #define LPENDIN (PENDIN>>16) 145 #define LDECCTQ (DECCTQ>>16) 146 #define LNOFLSH (NOFLSH>>16) 147 #define TIOCSBRK _IO(t, 123) /* set break bit */ 148 #define TIOCCBRK _IO(t, 122) /* clear break bit */ 149 #define TIOCSDTR _IO(t, 121) /* set data terminal ready */ 150 #define TIOCCDTR _IO(t, 120) /* clear data terminal ready */ 151 #define TIOCGPGRP _IOR(t, 119, int) /* get pgrp of tty */ 152 #define TIOCSPGRP _IOW(t, 118, int) /* set pgrp of tty */ 153 #define TIOCSLTC _IOW(t,117,struct ltchars)/* set local special chars */ 154 #define TIOCGLTC _IOR(t,116,struct ltchars)/* get local special chars */ 155 #define TIOCOUTQ _IOR(t, 115, int) /* output queue size */ 156 #define TIOCSTI _IOW(t, 114, char) /* simulate terminal input */ 157 #define TIOCNOTTY _IO(t, 113) /* void tty association */ 158 #define TIOCPKT _IOW(t, 112, int) /* pty: set/clear packet mode */ 159 #define TIOCPKT_DATA 0x00 /* data packet */ 160 #define TIOCPKT_FLUSHREAD 0x01 /* flush packet */ 161 #define TIOCPKT_FLUSHWRITE 0x02 /* flush packet */ 162 #define TIOCPKT_STOP 0x04 /* stop output */ 163 #define TIOCPKT_START 0x08 /* start output */ 164 #define TIOCPKT_NOSTOP 0x10 /* no more ^S, ^Q */ 165 #define TIOCPKT_DOSTOP 0x20 /* now do ^S ^Q */ 166 #define TIOCSTOP _IO(t, 111) /* stop output, like ^S */ 167 #define TIOCSTART _IO(t, 110) /* start output, like ^Q */ 168 #define TIOCMSET _IOW(t, 109, int) /* set all modem bits */ 169 #define TIOCMBIS _IOW(t, 108, int) /* bis modem bits */ 170 #define TIOCMBIC _IOW(t, 107, int) /* bic modem bits */ 171 #define TIOCMGET _IOR(t, 106, int) /* get all modem bits */ 172 #define TIOCREMOTE _IO(t, 105) /* remote input editing */ 173 174 #define OTTYDISC 0 /* old, v7 std tty driver */ 175 #define NETLDISC 1 /* line discip for berk net */ 176 #define NTTYDISC 2 /* new tty discipline */ 177 #define TABLDISC 3 /* hitachi tablet discipline */ 178 #define NTABLDISC 4 /* gtco tablet discipline */ 179 180 #define FIOCLEX _IO(f, 1) /* set exclusive use on fd */ 181 #define FIONCLEX _IO(f, 2) /* remove exclusive use */ 182 /* another local */ 183 #define FIONREAD _IOR(f, 127, int) /* get # bytes to read */ 184 #define FIONBIO _IOW(f, 126, int) /* set/clear non-blocking i/o */ 185 #define FIOASYNC _IOW(f, 125, int) /* set/clear async i/o */ 186 #define FIOSETOWN _IOW(f, 124, int) /* set owner */ 187 #define FIOGETOWN _IOR(f, 123, int) /* get owner */ 188 189 /* socket i/o controls */ 190 #define SIOCSHIWAT _IOW(s, 0, int) /* set high watermark */ 191 #define SIOCGHIWAT _IOR(s, 1, int) /* get high watermark */ 192 #define SIOCSLOWAT _IOW(s, 2, int) /* set low watermark */ 193 #define SIOCGLOWAT _IOR(s, 3, int) /* get low watermark */ 194 #define SIOCATMARK _IOR(s, 7, int) /* at oob mark? */ 195 #define SIOCSPGRP _IOW(s, 8, int) /* set process group */ 196 #define SIOCGPGRP _IOR(s, 9, int) /* get process group */ 197 198 #define SIOCADDRT _IOW(r, 10, struct rtentry) /* add route */ 199 #define SIOCDELRT _IOW(r, 11, struct rtentry) /* delete route */ 200 201 #define SIOCSIFADDR _IOW(i, 12, struct ifreq) /* set ifnet address */ 202 #define SIOCGIFADDR _IOWR(i,13, struct ifreq) /* get ifnet address */ 203 #define SIOCSIFDSTADDR _IOW(i, 14, struct ifreq) /* set p-p address */ 204 #define SIOCGIFDSTADDR _IOWR(i,15, struct ifreq) /* get p-p address */ 205 #define SIOCSIFFLAGS _IOW(i, 16, struct ifreq) /* set ifnet flags */ 206 #define SIOCGIFFLAGS _IOWR(i,17, struct ifreq) /* get ifnet flags */ 207 #define SIOCGIFCONF _IOWR(i,20, struct ifconf) /* get ifnet list */ 208 #endif 209