Annotation of Net2/sys/ioctl.h, revision 1.1.1.2

1.1       root        1: /*-
                      2:  * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
                      3:  * All rights reserved.
                      4:  *
                      5:  * Redistribution and use in source and binary forms, with or without
                      6:  * modification, are permitted provided that the following conditions
                      7:  * are met:
                      8:  * 1. Redistributions of source code must retain the above copyright
                      9:  *    notice, this list of conditions and the following disclaimer.
                     10:  * 2. Redistributions in binary form must reproduce the above copyright
                     11:  *    notice, this list of conditions and the following disclaimer in the
                     12:  *    documentation and/or other materials provided with the distribution.
                     13:  * 3. All advertising materials mentioning features or use of this software
                     14:  *    must display the following acknowledgement:
                     15:  *     This product includes software developed by the University of
                     16:  *     California, Berkeley and its contributors.
                     17:  * 4. Neither the name of the University nor the names of its contributors
                     18:  *    may be used to endorse or promote products derived from this software
                     19:  *    without specific prior written permission.
                     20:  *
                     21:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     22:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     23:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     24:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     25:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     26:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     27:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     28:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     29:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     30:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     31:  * SUCH DAMAGE.
                     32:  *
                     33:  *     @(#)ioctl.h     7.19 (Berkeley) 6/26/91
1.1.1.2 ! root       34:  *
        !            35:  * PATCHES MAGIC                LEVEL   PATCH THAT GOT US HERE
        !            36:  * --------------------         -----   ----------------------
        !            37:  * CURRENT PATCH LEVEL:         1       00059
        !            38:  * --------------------         -----   ----------------------
        !            39:  *
        !            40:  * 27 Nov 1992 Scott Reynolds          Completed V7 ioctl compatablity
1.1       root       41:  */
                     42: 
                     43: #ifndef        _IOCTL_H_
                     44: #define        _IOCTL_H_
                     45: 
                     46: /*
                     47:  * Window/terminal size structure.  This information is stored by the kernel
                     48:  * in order to provide a consistent interface, but is not used by the kernel.
                     49:  */
                     50: struct winsize {
                     51:        unsigned short  ws_row;         /* rows, in characters */
                     52:        unsigned short  ws_col;         /* columns, in characters */
                     53:        unsigned short  ws_xpixel;      /* horizontal size, pixels */
                     54:        unsigned short  ws_ypixel;      /* vertical size, pixels */
                     55: };
                     56: 
                     57: /*
                     58:  * Pun for SUN.
                     59:  */
                     60: struct ttysize {
                     61:        unsigned short  ts_lines;
                     62:        unsigned short  ts_cols;
                     63:        unsigned short  ts_xxx;
                     64:        unsigned short  ts_yyy;
                     65: };
                     66: #define        TIOCGSIZE       TIOCGWINSZ
                     67: #define        TIOCSSIZE       TIOCSWINSZ
                     68: 
                     69: /*
                     70:  * Ioctl's have the command encoded in the lower word, and the size of
                     71:  * any in or out parameters in the upper word.  The high 3 bits of the
                     72:  * upper word are used to encode the in/out status of the parameter.
                     73:  */
                     74: #define        IOCPARM_MASK    0x1fff          /* parameter length, at most 13 bits */
                     75: #define        IOCPARM_LEN(x)  (((x) >> 16) & IOCPARM_MASK)
                     76: #define        IOCBASECMD(x)   ((x) & ~IOCPARM_MASK)
                     77: #define        IOCGROUP(x)     (((x) >> 8) & 0xff)
                     78: 
                     79: #define        IOCPARM_MAX     NBPG            /* max size of ioctl, mult. of NBPG */
                     80: #define        IOC_VOID        0x20000000      /* no parameters */
                     81: #define        IOC_OUT         0x40000000      /* copy out parameters */
                     82: #define        IOC_IN          0x80000000      /* copy in parameters */
                     83: #define        IOC_INOUT       (IOC_IN|IOC_OUT)
                     84: #define        IOC_DIRMASK     0xe0000000      /* mask for IN/OUT/VOID */
                     85: 
                     86: #define _IOC(inout,group,num,len) \
                     87:        (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num))
                     88: #define        _IO(g,n)        _IOC(IOC_VOID,  (g), (n), 0)
                     89: #define        _IOR(g,n,t)     _IOC(IOC_OUT,   (g), (n), sizeof(t))
                     90: #define        _IOW(g,n,t)     _IOC(IOC_IN,    (g), (n), sizeof(t))
                     91: /* this should be _IORW, but stdio got there first */
                     92: #define        _IOWR(g,n,t)    _IOC(IOC_INOUT, (g), (n), sizeof(t))
                     93: 
                     94: #define        TIOCMODG        _IOR('t', 3, int)       /* get modem control state */
                     95: #define        TIOCMODS        _IOW('t', 4, int)       /* set modem control state */
                     96: #define                TIOCM_LE        0001            /* line enable */
                     97: #define                TIOCM_DTR       0002            /* data terminal ready */
                     98: #define                TIOCM_RTS       0004            /* request to send */
                     99: #define                TIOCM_ST        0010            /* secondary transmit */
                    100: #define                TIOCM_SR        0020            /* secondary receive */
                    101: #define                TIOCM_CTS       0040            /* clear to send */
                    102: #define                TIOCM_CAR       0100            /* carrier detect */
                    103: #define                TIOCM_CD        TIOCM_CAR
                    104: #define                TIOCM_RNG       0200            /* ring */
                    105: #define                TIOCM_RI        TIOCM_RNG
                    106: #define                TIOCM_DSR       0400            /* data set ready */
                    107:                                                /* 8-10 compat */
                    108: #define        TIOCEXCL        _IO('t', 13)            /* set exclusive use of tty */
                    109: #define        TIOCNXCL        _IO('t', 14)            /* reset exclusive use of tty */
                    110:                                                /* 15 unused */
                    111: #define        TIOCFLUSH       _IOW('t', 16, int)      /* flush buffers */
                    112:                                                /* 17-18 compat */
                    113: #define        TIOCGETA        _IOR('t', 19, struct termios) /* get termios struct */
                    114: #define        TIOCSETA        _IOW('t', 20, struct termios) /* set termios struct */
                    115: #define        TIOCSETAW       _IOW('t', 21, struct termios) /* drain output, set */
                    116: #define        TIOCSETAF       _IOW('t', 22, struct termios) /* drn out, fls in, set */
                    117: #define        TIOCGETD        _IOR('t', 26, int)      /* get line discipline */
                    118: #define        TIOCSETD        _IOW('t', 27, int)      /* set line discipline */
                    119:                                                /* 127-124 compat */
                    120: #define        TIOCSBRK        _IO('t', 123)           /* set break bit */
                    121: #define        TIOCCBRK        _IO('t', 122)           /* clear break bit */
                    122: #define        TIOCSDTR        _IO('t', 121)           /* set data terminal ready */
                    123: #define        TIOCCDTR        _IO('t', 120)           /* clear data terminal ready */
                    124: #define        TIOCGPGRP       _IOR('t', 119, int)     /* get pgrp of tty */
                    125: #define        TIOCSPGRP       _IOW('t', 118, int)     /* set pgrp of tty */
                    126:                                                /* 117-116 compat */
                    127: #define        TIOCOUTQ        _IOR('t', 115, int)     /* output queue size */
                    128: #define        TIOCSTI         _IOW('t', 114, char)    /* simulate terminal input */
                    129: #define        TIOCNOTTY       _IO('t', 113)           /* void tty association */
                    130: #define        TIOCPKT         _IOW('t', 112, int)     /* pty: set/clear packet mode */
                    131: #define                TIOCPKT_DATA            0x00    /* data packet */
                    132: #define                TIOCPKT_FLUSHREAD       0x01    /* flush packet */
                    133: #define                TIOCPKT_FLUSHWRITE      0x02    /* flush packet */
                    134: #define                TIOCPKT_STOP            0x04    /* stop output */
                    135: #define                TIOCPKT_START           0x08    /* start output */
                    136: #define                TIOCPKT_NOSTOP          0x10    /* no more ^S, ^Q */
                    137: #define                TIOCPKT_DOSTOP          0x20    /* now do ^S ^Q */
                    138: #define                TIOCPKT_IOCTL           0x40    /* state change of pty driver */
                    139: #define        TIOCSTOP        _IO('t', 111)           /* stop output, like ^S */
                    140: #define        TIOCSTART       _IO('t', 110)           /* start output, like ^Q */
                    141: #define        TIOCMSET        _IOW('t', 109, int)     /* set all modem bits */
                    142: #define        TIOCMBIS        _IOW('t', 108, int)     /* bis modem bits */
                    143: #define        TIOCMBIC        _IOW('t', 107, int)     /* bic modem bits */
                    144: #define        TIOCMGET        _IOR('t', 106, int)     /* get all modem bits */
                    145: #define        TIOCREMOTE      _IOW('t', 105, int)     /* remote input editing */
                    146: #define        TIOCGWINSZ      _IOR('t', 104, struct winsize)  /* get window size */
                    147: #define        TIOCSWINSZ      _IOW('t', 103, struct winsize)  /* set window size */
                    148: #define        TIOCUCNTL       _IOW('t', 102, int)     /* pty: set/clr usr cntl mode */
                    149: #define                UIOCCMD(n)      _IO('u', n)             /* usr cntl op "n" */
1.1.1.2 ! root      150: #define TIOCSTAT       _IOW('t', 101, int)     /* generate status message */
1.1       root      151: #define        TIOCCONS        _IOW('t', 98, int)              /* become virtual console */
                    152: #define        TIOCSCTTY       _IO('t', 97)            /* become controlling tty */
                    153: #define        TIOCEXT         _IOW('t', 96, int)      /* pty: external processing */
                    154: #define        TIOCSIG         _IO('t', 95)            /* pty: generate signal */
                    155: #define TIOCDRAIN      _IO('t', 94)            /* wait till output drained */
                    156: 
                    157: #define TTYDISC                0               /* termios tty line discipline */
                    158: #define        TABLDISC        3               /* tablet discipline */
                    159: #define        SLIPDISC        4               /* serial IP discipline */
                    160: 
                    161: 
                    162: #define        FIOCLEX         _IO('f', 1)             /* set close on exec on fd */
                    163: #define        FIONCLEX        _IO('f', 2)             /* remove close on exec */
                    164: #define        FIONREAD        _IOR('f', 127, int)     /* get # bytes to read */
                    165: #define        FIONBIO         _IOW('f', 126, int)     /* set/clear non-blocking i/o */
                    166: #define        FIOASYNC        _IOW('f', 125, int)     /* set/clear async i/o */
                    167: #define        FIOSETOWN       _IOW('f', 124, int)     /* set owner */
                    168: #define        FIOGETOWN       _IOR('f', 123, int)     /* get owner */
                    169: 
                    170: /* socket i/o controls */
                    171: #define        SIOCSHIWAT      _IOW('s',  0, int)              /* set high watermark */
                    172: #define        SIOCGHIWAT      _IOR('s',  1, int)              /* get high watermark */
                    173: #define        SIOCSLOWAT      _IOW('s',  2, int)              /* set low watermark */
                    174: #define        SIOCGLOWAT      _IOR('s',  3, int)              /* get low watermark */
                    175: #define        SIOCATMARK      _IOR('s',  7, int)              /* at oob mark? */
                    176: #define        SIOCSPGRP       _IOW('s',  8, int)              /* set process group */
                    177: #define        SIOCGPGRP       _IOR('s',  9, int)              /* get process group */
                    178: 
                    179: #define        SIOCADDRT       _IOW('r', 10, struct ortentry)  /* add route */
                    180: #define        SIOCDELRT       _IOW('r', 11, struct ortentry)  /* delete route */
                    181: 
                    182: #define        SIOCSIFADDR     _IOW('i', 12, struct ifreq)     /* set ifnet address */
                    183: #define        OSIOCGIFADDR    _IOWR('i',13, struct ifreq)     /* get ifnet address */
                    184: #define        SIOCGIFADDR     _IOWR('i',33, struct ifreq)     /* get ifnet address */
                    185: #define        SIOCSIFDSTADDR  _IOW('i', 14, struct ifreq)     /* set p-p address */
                    186: #define        OSIOCGIFDSTADDR _IOWR('i',15, struct ifreq)     /* get p-p address */
                    187: #define        SIOCGIFDSTADDR  _IOWR('i',34, struct ifreq)     /* get p-p address */
                    188: #define        SIOCSIFFLAGS    _IOW('i', 16, struct ifreq)     /* set ifnet flags */
                    189: #define        SIOCGIFFLAGS    _IOWR('i',17, struct ifreq)     /* get ifnet flags */
                    190: #define        OSIOCGIFBRDADDR _IOWR('i',18, struct ifreq)     /* get broadcast addr */
                    191: #define        SIOCGIFBRDADDR  _IOWR('i',35, struct ifreq)     /* get broadcast addr */
                    192: #define        SIOCSIFBRDADDR  _IOW('i',19, struct ifreq)      /* set broadcast addr */
                    193: #define        OSIOCGIFCONF    _IOWR('i',20, struct ifconf)    /* get ifnet list */
                    194: #define        SIOCGIFCONF     _IOWR('i',36, struct ifconf)    /* get ifnet list */
                    195: #define        OSIOCGIFNETMASK _IOWR('i',21, struct ifreq)     /* get net addr mask */
                    196: #define        SIOCGIFNETMASK  _IOWR('i',37, struct ifreq)     /* get net addr mask */
                    197: #define        SIOCSIFNETMASK  _IOW('i',22, struct ifreq)      /* set net addr mask */
                    198: #define        SIOCGIFMETRIC   _IOWR('i',23, struct ifreq)     /* get IF metric */
                    199: #define        SIOCSIFMETRIC   _IOW('i',24, struct ifreq)      /* set IF metric */
                    200: #define        SIOCDIFADDR     _IOW('i',25, struct ifreq)      /* delete IF addr */
                    201: #define        SIOCAIFADDR     _IOW('i',26, struct ifaliasreq) /* add/chg IF alias */
                    202: 
                    203: #define        SIOCSARP        _IOW('i', 30, struct arpreq)    /* set arp entry */
                    204: #define        OSIOCGARP       _IOWR('i',31, struct arpreq)    /* get arp entry */
                    205: #define        SIOCGARP        _IOWR('i',38, struct arpreq)    /* get arp entry */
                    206: #define        SIOCDARP        _IOW('i', 32, struct arpreq)    /* delete arp entry */
                    207: 
                    208: #ifndef KERNEL
                    209: 
                    210: #include <sys/cdefs.h>
                    211: 
                    212: __BEGIN_DECLS
                    213: int    ioctl __P((int, unsigned long, ...));
                    214: __END_DECLS
                    215: 
                    216: #endif /* !KERNEL */
                    217: 
                    218: #endif /* !_IOCTL_H_ */
                    219: 
                    220: /* - note: keep outside _IOCTL_H_
                    221:  * Compatability with old terminal driver
                    222:  *
                    223:  * Source level -> #define USE_OLD_TTY
                    224:  * Kernel level -> options COMPAT_43
                    225:  */
                    226: #if defined(USE_OLD_TTY) || defined(COMPAT_43)
                    227: #ifdef KERNEL
                    228: #include "ioctl_compat.h"
                    229: #else
                    230: #include <sys/ioctl_compat.h>
                    231: #endif
                    232: #endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.