6b754f2f3cc13ecc475f9b3c5cdbf3e8701ad1d9
[unix-history] / usr / src / sys / sys / ioctl.h
/* ioctl.h 4.23 82/11/22 */
/*
* ioctl definitions, and special character and local tty definitions
*/
#ifndef _IOCTL_
#define _IOCTL_
struct tchars {
char t_intrc; /* interrupt */
char t_quitc; /* quit */
char t_startc; /* start output */
char t_stopc; /* stop output */
char t_eofc; /* end-of-file */
char t_brkc; /* input delimiter (like nl) */
};
struct ltchars {
char t_suspc; /* stop process signal */
char t_dsuspc; /* delayed stop process signal */
char t_rprntc; /* reprint line */
char t_flushc; /* flush output (toggles) */
char t_werasc; /* word erase */
char t_lnextc; /* literal next character */
};
/*
* local mode settings
*/
#define LCRTBS 0000001 /* correct backspacing for crt */
#define LPRTERA 0000002 /* printing terminal \ ... / erase */
#define LCRTERA 0000004 /* do " \b " to wipe out character */
#define LTILDE 0000010 /* IIASA - hazeltine tilde kludge */
#define LMDMBUF 0000020 /* IIASA - start/stop output on carrier intr */
#define LLITOUT 0000040 /* IIASA - suppress any output translations */
#define LTOSTOP 0000100 /* send stop for any background tty output */
#define LFLUSHO 0000200 /* flush output sent to terminal */
#define LNOHANG 0000400 /* IIASA - don't send hangup on carrier drop */
#define LETXACK 0001000 /* IIASA - diablo style buffer hacking */
#define LCRTKIL 0002000 /* erase whole line on kill with " \b " */
#define L004000 0004000
#define LCTLECH 0010000 /* echo control characters as ^X */
#define LPENDIN 0020000 /* tp->t_rawq is waiting to be reread */
#define LDECCTQ 0040000 /* only ^Q starts after ^S */
#define LNOFLSH 0100000 /* dont flush output on signals */
/* local state */
#define LSBKSL 01 /* state bit for lowercase backslash work */
#define LSQUOT 02 /* last character input was \ */
#define LSERASE 04 /* within a \.../ for LPRTRUB */
#define LSLNCH 010 /* next character is literal */
#define LSTYPEN 020 /* retyping suspended input (LPENDIN) */
#define LSCNTTB 040 /* counting width of tab; leave LFLUSHO alone */
/* modem control */
#define MLE 0001 /* line enable */
#define MDTR 0002 /* data terminal ready */
#define MRTS 0004 /* request to send */
#define MST 0010 /* secondary transmit */
#define MSR 0020 /* secondary receive */
#define MCTS 0040 /* clear to send */
#define MCAR 0100 /* carrier detect */
#define MCD MCAR
#define MRNG 0200 /* ring */
#define MRI MRNG
#define MDSR 0400 /* data set ready */
/*
* Ioctl's have the command encoded in the lower word,
* and the size of any in or out parameters in the upper
* word. The high 2 bits of the upper word are used
* to encode the in/out status of the parameter; for now
* we restrict parameters to at most 128 bytes.
*/
#define IOCPARM_MASK 0x7f /* parameters must be < 128 bytes */
#define IOC_VOID 0x20000000 /* no parameters */
#define IOC_OUT 0x40000000 /* copy out parameters */
#define IOC_IN 0x80000000 /* copy in parameters */
#define IOC_INOUT (IOC_IN|IOC_OUT)
/* the 0x20000000 is so we can distinguish new ioctl's from old */
#define _IO(x,y) (IOC_VOID|('x'<<8)|y)
#define _IOR(x,y,t) (IOC_OUT|((sizeof(t)&IOCPARM_MASK)<<16)|('x'<<8)|y)
#define _IOW(x,y,t) (IOC_IN|((sizeof(t)&IOCPARM_MASK)<<16)|('x'<<8)|y)
/* this should be _IORW, but stdio got there first */
#define _IOWR(x,y,t) (IOC_INOUT|((sizeof(t)&IOCPARM_MASK)<<16)|('x'<<8)|y)
/*
* tty ioctl commands
*/
#define TIOCGETD _IOR(t, 0, int) /* get line discipline */
#define TIOCSETD _IOW(t, 1, int) /* set line discipline */
#define TIOCHPCL _IO(t, 2) /* hang up on last close */
#define TIOCMODG _IOR(t, 3, int) /* get modem control state */
#define TIOCMODS _IOW(t, 4, int) /* set modem control state */
#define TIOCGETP _IOR(t, 8,struct sgttyb)/* get parameters -- gtty */
#define TIOCSETP _IOW(t, 9,struct sgttyb)/* set parameters -- stty */
#define TIOCSETN _IOW(t,10,struct sgttyb)/* as above, but no flushtty */
#define TIOCEXCL _IO(t, 13) /* set exclusive use of tty */
#define TIOCNXCL _IO(t, 14) /* reset exclusive use of tty */
#define TIOCFLUSH _IOW(t, 16, int) /* flush buffers */
#define TIOCSETC _IOW(t,17,struct tchars)/* set special characters */
#define TIOCGETC _IOR(t,18,struct tchars)/* get special characters */
/* locals, from 127 down */
#define TIOCLBIS _IOW(t, 127, int) /* bis local mode bits */
#define TIOCLBIC _IOW(t, 126, int) /* bic local mode bits */
#define TIOCLSET _IOW(t, 125, int) /* set entire local mode word */
#define TIOCLGET _IOR(t, 124, int) /* get local modes */
#define TIOCSBRK _IO(t, 123) /* set break bit */
#define TIOCCBRK _IO(t, 122) /* clear break bit */
#define TIOCSDTR _IO(t, 121) /* set data terminal ready */
#define TIOCCDTR _IO(t, 120) /* clear data terminal ready */
#define TIOCGPGRP _IOR(t, 119, int) /* get pgrp of tty */
#define TIOCSPGRP _IOW(t, 118, int) /* set pgrp of tty */
#define TIOCSLTC _IOW(t,117,struct ltchars)/* set local special chars */
#define TIOCGLTC _IOR(t,116,struct ltchars)/* get local special chars */
#define TIOCSTI _IOW(t, 114, char) /* simulate terminal input */
#define TIOCNOTTY _IO(t, 113) /* void tty association */
#define TIOCPKT _IOW(t, 112, int) /* pty: set/clear packet mode */
#define TIOCPKT_DATA 0x00 /* data packet */
#define TIOCPKT_FLUSHREAD 0x01 /* flush packet */
#define TIOCPKT_FLUSHWRITE 0x02 /* flush packet */
#define TIOCPKT_STOP 0x04 /* stop output */
#define TIOCPKT_START 0x08 /* start output */
#define TIOCPKT_NOSTOP 0x10 /* no more ^S, ^Q */
#define TIOCPKT_DOSTOP 0x20 /* now do ^S ^Q */
#define TIOCSTOP _IO(t, 111) /* stop output, like ^S */
#define TIOCSTART _IO(t, 110) /* start output, like ^Q */
#define TIOCMSET _IOW(t, 109, int) /* set all modem bits */
#define TIOCMBIS _IOW(t, 108, int) /* bis modem bits */
#define TIOCMBIC _IOW(t, 107, int) /* bic modem bits */
#define TIOCMGET _IOR(t, 106, int) /* get all modem bits */
#define TIOCREMOTE _IO(t, 105) /* remote input editing */
#define OTTYDISC 0 /* old, v7 std tty driver */
#define NETLDISC 1 /* line discip for berk net */
#define NTTYDISC 2 /* new tty discipline */
#define TABLDISC 3 /* hitachi tablet discipline */
#define NTABLDISC 4 /* gtco tablet discipline */
#define FIOCLEX _IO(f, 1) /* set exclusive use on fd */
#define FIONCLEX _IO(f, 2) /* remove exclusive use */
/* another local */
#define FIONREAD _IOR(f, 127, int) /* get # bytes to read */
#define FIONBIO _IOW(f, 126, int) /* set/clear non-blocking i/o */
#define FIOASYNC _IOW(f, 125, int) /* set/clear async i/o */
/* socket i/o controls */
#define SIOCDONE _IOW(s, 0, int) /* shutdown read/write */
#define SIOCSKEEP _IOW(s, 1, int) /* set keep alive */
#define SIOCGKEEP _IOR(s, 2, int) /* inspect keep alive */
#define SIOCSLINGER _IOW(s, 3, int) /* set linger time */
#define SIOCGLINGER _IOR(s, 4, int) /* get linger time */
/* these are really variable length */
#define SIOCSENDOOB _IOW(s, 5, char) /* send out of band */
#define SIOCRCVOOB _IOR(s, 6, char) /* get out of band */
#define SIOCATMARK _IOR(s, 7, int) /* at out of band mark? */
#define SIOCSPGRP _IOW(s, 8, int) /* set process group */
#define SIOCGPGRP _IOR(s, 9, int) /* get process group */
#define SIOCADDRT _IOW(s,10, struct rtentry)/* add route */
#define SIOCDELRT _IOW(s,11, struct rtentry)/* delete route */
#define KIOCTRANS _IOW(k,0, int) /* set keyboard translation */
#define MIOCGPOS _IOR(m,0, XXX) /* get mouse info */
#define MIOCGBUFS _IOR(m,1, int) /* get mouse buffer size */
#define MIOCWBUFS _IOW(m,1, int) /* set mouse buffer size */
#endif