1: /*
   2:  * Copyright (c) 1986 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  *
   6:  *	@(#)ioctl.h	1.4 (2.11BSD GTE) 1997/3/28
   7:  */
   8: 
   9: /*
  10:  * Ioctl definitions
  11:  */
  12: #ifndef _IOCTL_
  13: #define _IOCTL_
  14: #ifdef KERNEL
  15: #include "ttychars.h"
  16: #include "ttydev.h"
  17: #else
  18: #include <sys/ttychars.h>
  19: #include <sys/ttydev.h>
  20: #endif
  21: 
  22: struct tchars {
  23:     char    t_intrc;    /* interrupt */
  24:     char    t_quitc;    /* quit */
  25:     char    t_startc;   /* start output */
  26:     char    t_stopc;    /* stop output */
  27:     char    t_eofc;     /* end-of-file */
  28:     char    t_brkc;     /* input delimiter (like nl) */
  29: };
  30: struct ltchars {
  31:     char    t_suspc;    /* stop process signal */
  32:     char    t_dsuspc;   /* delayed stop process signal */
  33:     char    t_rprntc;   /* reprint line */
  34:     char    t_flushc;   /* flush output (toggles) */
  35:     char    t_werasc;   /* word erase */
  36:     char    t_lnextc;   /* literal next character */
  37: };
  38: 
  39: /*
  40:  * Structure for TIOCGETP and TIOCSETP ioctls.
  41:  */
  42: 
  43: #ifndef _SGTTYB_
  44: #define _SGTTYB_
  45: struct sgttyb {
  46:     char    sg_ispeed;      /* input speed */
  47:     char    sg_ospeed;      /* output speed */
  48:     char    sg_erase;       /* erase character */
  49:     char    sg_kill;        /* kill character */
  50:     short   sg_flags;       /* mode flags */
  51: };
  52: #endif
  53: 
  54: /*
  55:  * Window/terminal size structure.
  56:  * This information is stored by the kernel
  57:  * in order to provide a consistent interface,
  58:  * but is not used by the kernel.
  59:  *
  60:  * Type must be "unsigned short" so that types.h not required.
  61:  */
  62: struct winsize {
  63:     unsigned short  ws_row;         /* rows, in characters */
  64:     unsigned short  ws_col;         /* columns, in characters */
  65:     unsigned short  ws_xpixel;      /* horizontal size, pixels */
  66:     unsigned short  ws_ypixel;      /* vertical size, pixels */
  67: };
  68: 
  69: /*
  70:  * Pun for SUN.
  71:  */
  72: struct ttysize {
  73:     unsigned short  ts_lines;
  74:     unsigned short  ts_cols;
  75:     unsigned short  ts_xxx;
  76:     unsigned short  ts_yyy;
  77: };
  78: #define TIOCGSIZE   TIOCGWINSZ
  79: #define TIOCSSIZE   TIOCSWINSZ
  80: 
  81: #ifndef _IO
  82: /*
  83:  * Ioctl's have the command encoded in the lower word,
  84:  * and the size of any in or out parameters in the upper
  85:  * word.  The high 2 bits of the upper word are used
  86:  * to encode the in/out status of the parameter; for now
  87:  * we restrict parameters to at most 256 bytes (disklabels are 216 bytes).
  88:  */
  89: #define IOCPARM_MASK    0xff        /* parameters must be < 256 bytes */
  90: #define IOC_VOID    0x20000000  /* no parameters */
  91: #define IOC_OUT     0x40000000  /* copy out parameters */
  92: #define IOC_IN      0x80000000  /* copy in parameters */
  93: #define IOC_INOUT   (IOC_IN|IOC_OUT)
  94: /* the 0x20000000 is so we can distinguish new ioctl's from old */
  95: #ifdef KERNEL
  96: #define _IO(x,y)    (('x'<<8)|y)
  97: #define _IOR(x,y,t) (('x'<<8)|y)
  98: #define _IOW(x,y,t) (('x'<<8)|y)
  99: /* this should be _IORW, but stdio got there first */
 100: #define _IOWR(x,y,t)    (('x'<<8)|y)
 101: #else
 102: #define _IO(x,y)    (IOC_VOID|('x'<<8)|y)
 103: #define _IOR(x,y,t) (IOC_OUT|((long)(sizeof(t)&IOCPARM_MASK)<<16)|('x'<<8)|y)
 104: #define _IOW(x,y,t) (IOC_IN|((long)(sizeof(t)&IOCPARM_MASK)<<16)|('x'<<8)|y)
 105: /* this should be _IORW, but stdio got there first */
 106: #define _IOWR(x,y,t)    (IOC_INOUT|((long)(sizeof(t)&IOCPARM_MASK)<<16)|('x'<<8)|y)
 107: #endif
 108: #endif
 109: 
 110: /*
 111:  * tty ioctl commands
 112:  */
 113: #define TIOCGETD    _IOR(t, 0, int)     /* get line discipline */
 114: #define TIOCSETD    _IOW(t, 1, int)     /* set line discipline */
 115: #define TIOCHPCL    _IO(t, 2)       /* hang up on last close */
 116: #define TIOCMODG    _IOR(t, 3, int)     /* get modem control state */
 117: #define TIOCMODS    _IOW(t, 4, int)     /* set modem control state */
 118: #define     TIOCM_LE    0001        /* line enable */
 119: #define     TIOCM_DTR   0002        /* data terminal ready */
 120: #define     TIOCM_RTS   0004        /* request to send */
 121: #define     TIOCM_ST    0010        /* secondary transmit */
 122: #define     TIOCM_SR    0020        /* secondary receive */
 123: #define     TIOCM_CTS   0040        /* clear to send */
 124: #define     TIOCM_CAR   0100        /* carrier detect */
 125: #define     TIOCM_CD    TIOCM_CAR
 126: #define     TIOCM_RNG   0200        /* ring */
 127: #define     TIOCM_RI    TIOCM_RNG
 128: #define     TIOCM_DSR   0400        /* data set ready */
 129: #define TIOCGETP    _IOR(t, 8,struct sgttyb)/* get parameters -- gtty */
 130: #define TIOCSETP    _IOW(t, 9,struct sgttyb)/* set parameters -- stty */
 131: #define TIOCSETN    _IOW(t,10,struct sgttyb)/* as above, but no flushtty */
 132: #define TIOCEXCL    _IO(t, 13)      /* set exclusive use of tty */
 133: #define TIOCNXCL    _IO(t, 14)      /* reset exclusive use of tty */
 134: #define TIOCFLUSH   _IOW(t, 16, int)    /* flush buffers */
 135: #define TIOCSETC    _IOW(t,17,struct tchars)/* set special characters */
 136: #define TIOCGETC    _IOR(t,18,struct tchars)/* get special characters */
 137: #define     TANDEM      0x00000001  /* send stopc on out q full */
 138: #define     CBREAK      0x00000002  /* half-cooked mode */
 139:                         /* 0x4 (old LCASE) */
 140: #define     ECHO        0x00000008  /* echo input */
 141: #define     CRMOD       0x00000010  /* map \r to \r\n on output */
 142: #define     RAW     0x00000020  /* no i/o processing */
 143: #define     ODDP        0x00000040  /* get/send odd parity */
 144: #define     EVENP       0x00000080  /* get/send even parity */
 145: #define     ANYP        0x000000c0  /* get any parity/send none */
 146:                         /* 0x100 (old NLDELAY) */
 147:                         /* 0x200 */
 148: #define     XTABS       0x00000400  /* expand tabs on output */
 149:                         /* 0x0800 (part of old XTABS) */
 150:                         /* 0x1000 (old CRDELAY) */
 151:                         /* 0x2000 */
 152:                         /* 0x4000 (old VTDELAY) */
 153:                         /* 0x8000 (old BSDELAY) */
 154: #define     CRTBS       0x00010000  /* do backspacing for crt */
 155: #define     PRTERA      0x00020000  /* \ ... / erase */
 156: #define     CRTERA      0x00040000  /* " \b " to wipe out char */
 157:                         /* 0x00080000 (old TILDE) */
 158: #define     MDMBUF      0x00100000  /* start/stop output on carrier intr */
 159: #define     LITOUT      0x00200000  /* literal output */
 160: #define     TOSTOP      0x00400000  /* SIGSTOP on background output */
 161: #define     FLUSHO      0x00800000  /* flush output to terminal */
 162: #define     NOHANG      0x01000000  /* no SIGHUP on carrier drop */
 163: #define     RTSCTS      0x02000000  /* use RTS/CTS flow control */
 164: #define     CRTKIL      0x04000000  /* kill line with " \b " */
 165: #define     PASS8       0x08000000
 166: #define     CTLECH      0x10000000  /* echo control chars as ^X */
 167: #define     PENDIN      0x20000000  /* tp->t_rawq needs reread */
 168: #define     DECCTQ      0x40000000  /* only ^Q starts after ^S */
 169: #define     NOFLSH      0x80000000  /* no output flush on signal */
 170: /* locals, from 127 down */
 171: #define TIOCLBIS    _IOW(t, 127, int)   /* bis local mode bits */
 172: #define TIOCLBIC    _IOW(t, 126, int)   /* bic local mode bits */
 173: #define TIOCLSET    _IOW(t, 125, int)   /* set entire local mode word */
 174: #define TIOCLGET    _IOR(t, 124, int)   /* get local modes */
 175: #define     LCRTBS      ((int)(CRTBS>>16))
 176: #define     LPRTERA     ((int)(PRTERA>>16))
 177: #define     LCRTERA     ((int)(CRTERA>>16))
 178: #define     LMDMBUF     ((int)(MDMBUF>>16))
 179: #define     LLITOUT     ((int)(LITOUT>>16))
 180: #define     LTOSTOP     ((int)(TOSTOP>>16))
 181: #define     LFLUSHO     ((int)(FLUSHO>>16))
 182: #define     LNOHANG     ((int)(NOHANG>>16))
 183: #define     LRTSCTS     ((int)(RTSCTS>>16))
 184: #define     LCRTKIL     ((int)(CRTKIL>>16))
 185: #define     LPASS8      ((int)(PASS8>>16))
 186: #define     LCTLECH     ((int)(CTLECH>>16))
 187: #define     LPENDIN     ((int)(PENDIN>>16))
 188: #define     LDECCTQ     ((int)(DECCTQ>>16))
 189: #define     LNOFLSH     ((int)(NOFLSH>>16))
 190: #define TIOCSBRK    _IO(t, 123)     /* set break bit */
 191: #define TIOCCBRK    _IO(t, 122)     /* clear break bit */
 192: #define TIOCSDTR    _IO(t, 121)     /* set data terminal ready */
 193: #define TIOCCDTR    _IO(t, 120)     /* clear data terminal ready */
 194: #define TIOCGPGRP   _IOR(t, 119, int)   /* get pgrp of tty */
 195: #define TIOCSPGRP   _IOW(t, 118, int)   /* set pgrp of tty */
 196: #define TIOCSLTC    _IOW(t,117,struct ltchars)/* set local special chars */
 197: #define TIOCGLTC    _IOR(t,116,struct ltchars)/* get local special chars */
 198: #define TIOCOUTQ    _IOR(t, 115, int)   /* output queue size */
 199: #define TIOCSTI     _IOW(t, 114, char)  /* simulate terminal input */
 200: #define TIOCNOTTY   _IO(t, 113)     /* void tty association */
 201: #define TIOCPKT     _IOW(t, 112, int)   /* pty: set/clear packet mode */
 202: #define     TIOCPKT_DATA        0x00    /* data packet */
 203: #define     TIOCPKT_FLUSHREAD   0x01    /* flush packet */
 204: #define     TIOCPKT_FLUSHWRITE  0x02    /* flush packet */
 205: #define     TIOCPKT_STOP        0x04    /* stop output */
 206: #define     TIOCPKT_START       0x08    /* start output */
 207: #define     TIOCPKT_NOSTOP      0x10    /* no more ^S, ^Q */
 208: #define     TIOCPKT_DOSTOP      0x20    /* now do ^S ^Q */
 209: #define TIOCSTOP    _IO(t, 111)     /* stop output, like ^S */
 210: #define TIOCSTART   _IO(t, 110)     /* start output, like ^Q */
 211: #define TIOCMSET    _IOW(t, 109, int)   /* set all modem bits */
 212: #define TIOCMBIS    _IOW(t, 108, int)   /* bis modem bits */
 213: #define TIOCMBIC    _IOW(t, 107, int)   /* bic modem bits */
 214: #define TIOCMGET    _IOR(t, 106, int)   /* get all modem bits */
 215: #define TIOCREMOTE  _IOW(t, 105, int)   /* remote input editing */
 216: #define TIOCGWINSZ  _IOR(t, 104, struct winsize)    /* get window size */
 217: #define TIOCSWINSZ  _IOW(t, 103, struct winsize)    /* set window size */
 218: #define TIOCUCNTL   _IOW(t, 102, int)   /* pty: set/clr usr cntl mode */
 219: #define     UIOCCMD(n)  _IO(u, n)       /* usr cntl op "n" */
 220: 
 221: #define OTTYDISC    0       /* old, v7 std tty driver */
 222: #define NETLDISC    1       /* line discip for berk net */
 223: #define NTTYDISC    2       /* new tty discipline */
 224: #define TABLDISC    3       /* tablet discipline */
 225: #define SLIPDISC    4       /* serial IP discipline */
 226: 
 227: #define FIOCLEX     _IO(f, 1)       /* set exclusive use on fd */
 228: #define FIONCLEX    _IO(f, 2)       /* remove exclusive use */
 229: /* another local */
 230: /* should use off_t for FIONREAD but that would require types.h */
 231: #define FIONREAD    _IOR(f, 127, long)  /* get # bytes to read */
 232: #define FIONBIO     _IOW(f, 126, int)   /* set/clear non-blocking i/o */
 233: #define FIOASYNC    _IOW(f, 125, int)   /* set/clear async i/o */
 234: #define FIOSETOWN   _IOW(f, 124, int)   /* set owner */
 235: #define FIOGETOWN   _IOR(f, 123, int)   /* get owner */
 236: 
 237: /* socket i/o controls */
 238: #define SIOCSHIWAT  _IOW(s,  0, int)        /* set high watermark */
 239: #define SIOCGHIWAT  _IOR(s,  1, int)        /* get high watermark */
 240: #define SIOCSLOWAT  _IOW(s,  2, int)        /* set low watermark */
 241: #define SIOCGLOWAT  _IOR(s,  3, int)        /* get low watermark */
 242: #define SIOCATMARK  _IOR(s,  7, int)        /* at oob mark? */
 243: #define SIOCSPGRP   _IOW(s,  8, int)        /* set process group */
 244: #define SIOCGPGRP   _IOR(s,  9, int)        /* get process group */
 245: 
 246: #define SIOCADDRT   _IOW(r, 10, struct rtentry) /* add route */
 247: #define SIOCDELRT   _IOW(r, 11, struct rtentry) /* delete route */
 248: 
 249: #define SIOCSIFADDR _IOW(i, 12, struct ifreq)   /* set ifnet address */
 250: #define SIOCGIFADDR _IOWR(i,13, struct ifreq)   /* get ifnet address */
 251: #define SIOCSIFDSTADDR  _IOW(i, 14, struct ifreq)   /* set p-p address */
 252: #define SIOCGIFDSTADDR  _IOWR(i,15, struct ifreq)   /* get p-p address */
 253: #define SIOCSIFFLAGS    _IOW(i, 16, struct ifreq)   /* set ifnet flags */
 254: #define SIOCGIFFLAGS    _IOWR(i,17, struct ifreq)   /* get ifnet flags */
 255: #define SIOCGIFBRDADDR  _IOWR(i,18, struct ifreq)   /* get broadcast addr */
 256: #define SIOCSIFBRDADDR  _IOW(i,19, struct ifreq)    /* set broadcast addr */
 257: #define SIOCGIFCONF _IOWR(i,20, struct ifconf)  /* get ifnet list */
 258: #define SIOCGIFNETMASK  _IOWR(i,21, struct ifreq)   /* get net addr mask */
 259: #define SIOCSIFNETMASK  _IOW(i,22, struct ifreq)    /* set net addr mask */
 260: #define SIOCGIFMETRIC   _IOWR(i,23, struct ifreq)   /* get IF metric */
 261: #define SIOCSIFMETRIC   _IOW(i,24, struct ifreq)    /* set IF metric */
 262: 
 263: #define SIOCSARP    _IOW(i, 30, struct arpreq)  /* set arp entry */
 264: #define SIOCGARP    _IOWR(i,31, struct arpreq)  /* get arp entry */
 265: #define SIOCDARP    _IOW(i, 32, struct arpreq)  /* delete arp entry */
 266: 
 267: #endif

Defined struct's

sgttyb defined in line 45; used 340 times
ttysize defined in line 72; used 6 times

Defined macros

CBREAK defined in line 138; used 94 times
CRMOD defined in line 141; used 80 times
CRTBS defined in line 154; used 3 times
CRTERA defined in line 156; used 3 times
CRTKIL defined in line 164; used 3 times
CTLECH defined in line 166; used 4 times
DECCTQ defined in line 168; used 3 times
ECHO defined in line 140; used 112 times
FIOGETOWN defined in line 235; never used
FIONCLEX defined in line 228; used 4 times
FIOSETOWN defined in line 234; never used
FLUSHO defined in line 161; used 23 times
IOCPARM_MASK defined in line 89; used 4 times
IOC_IN defined in line 92; used 3 times
IOC_INOUT defined in line 93; used 2 times
IOC_OUT defined in line 91; used 4 times
IOC_VOID defined in line 90; used 3 times
LCRTBS defined in line 175; used 14 times
LDECCTQ defined in line 188; used 6 times
LMDMBUF defined in line 178; used 4 times
LNOFLSH defined in line 189; used 5 times
LNOHANG defined in line 182; used 4 times
LPENDIN defined in line 187; used 5 times
LPRTERA defined in line 176; used 14 times
LRTSCTS defined in line 183; used 3 times
LTOSTOP defined in line 180; used 3 times
MDMBUF defined in line 158; used 4 times
NOFLSH defined in line 169; used 9 times
NOHANG defined in line 162; used 2 times
PENDIN defined in line 167; used 9 times
PRTERA defined in line 155; used 3 times
RAW defined in line 142; used 97 times
SIOCDARP defined in line 265; used 1 times
SIOCGARP defined in line 264; used 1 times
SIOCGHIWAT defined in line 239; never used
SIOCGLOWAT defined in line 241; never used
SIOCGPGRP defined in line 244; never used
SIOCSARP defined in line 263; used 2 times
SIOCSHIWAT defined in line 238; never used
SIOCSIFBRDADDR defined in line 256; used 1 times
SIOCSIFFLAGS defined in line 253; used 1 times
SIOCSIFMETRIC defined in line 261; used 1 times
SIOCSIFNETMASK defined in line 259; used 1 times
SIOCSLOWAT defined in line 240; never used
TABLDISC defined in line 224; used 1 times
TIOCGETP defined in line 129; used 64 times
TIOCGSIZE defined in line 78; used 4 times
TIOCMBIC defined in line 213; used 3 times
TIOCMBIS defined in line 212; used 3 times
TIOCMODG defined in line 116; used 1 times
TIOCMODS defined in line 117; used 1 times
TIOCMSET defined in line 211; used 1 times
TIOCM_CD defined in line 125; used 3 times
TIOCM_RI defined in line 127; never used
TIOCM_SR defined in line 122; never used
TIOCM_ST defined in line 121; never used
TIOCOUTQ defined in line 198; used 2 times
TIOCPKT_DATA defined in line 202; used 1 times
TIOCPKT_FLUSHREAD defined in line 203; never used
TIOCPKT_START defined in line 206; used 2 times
TIOCPKT_STOP defined in line 205; used 2 times
TIOCREMOTE defined in line 215; never used
TIOCSETP defined in line 130; used 65 times
TIOCSSIZE defined in line 79; never used
TIOCSTART defined in line 210; used 5 times
TIOCSTOP defined in line 209; used 1 times
TIOCUCNTL defined in line 218; never used
TOSTOP defined in line 160; used 3 times
UIOCCMD defined in line 219; used 1 times
_IO defined in line 102; used 14 times
_IOCTL_ defined in line 13; used 4 times
_IOR defined in line 103; used 20 times
_IOW defined in line 104; used 39 times
_IOWR defined in line 106; used 8 times
_SGTTYB_ defined in line 44; used 1 times
  • in line 43

Usage of this include

ioctl.h used 140 times
Last modified: 1997-03-29
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 336
Valid CSS Valid XHTML 1.0 Strict