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

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:  *
1.1.1.3 ! root       33:  *     from: @(#)ioctl.h       7.19 (Berkeley) 6/26/91
        !            34:  *     ioctl.h,v 1.5 1993/06/27 05:59:03 andrew Exp
1.1       root       35:  */
                     36: 
1.1.1.3 ! root       37: #ifndef        _SYS_IOCTL_H_
        !            38: #define        _SYS_IOCTL_H_
1.1       root       39: 
                     40: /*
                     41:  * Window/terminal size structure.  This information is stored by the kernel
                     42:  * in order to provide a consistent interface, but is not used by the kernel.
                     43:  */
                     44: struct winsize {
                     45:        unsigned short  ws_row;         /* rows, in characters */
                     46:        unsigned short  ws_col;         /* columns, in characters */
                     47:        unsigned short  ws_xpixel;      /* horizontal size, pixels */
                     48:        unsigned short  ws_ypixel;      /* vertical size, pixels */
                     49: };
                     50: 
                     51: /*
                     52:  * Pun for SUN.
                     53:  */
                     54: struct ttysize {
                     55:        unsigned short  ts_lines;
                     56:        unsigned short  ts_cols;
                     57:        unsigned short  ts_xxx;
                     58:        unsigned short  ts_yyy;
                     59: };
                     60: #define        TIOCGSIZE       TIOCGWINSZ
                     61: #define        TIOCSSIZE       TIOCSWINSZ
                     62: 
                     63: /*
                     64:  * Ioctl's have the command encoded in the lower word, and the size of
                     65:  * any in or out parameters in the upper word.  The high 3 bits of the
                     66:  * upper word are used to encode the in/out status of the parameter.
                     67:  */
                     68: #define        IOCPARM_MASK    0x1fff          /* parameter length, at most 13 bits */
                     69: #define        IOCPARM_LEN(x)  (((x) >> 16) & IOCPARM_MASK)
                     70: #define        IOCBASECMD(x)   ((x) & ~IOCPARM_MASK)
                     71: #define        IOCGROUP(x)     (((x) >> 8) & 0xff)
                     72: 
                     73: #define        IOCPARM_MAX     NBPG            /* max size of ioctl, mult. of NBPG */
                     74: #define        IOC_VOID        0x20000000      /* no parameters */
                     75: #define        IOC_OUT         0x40000000      /* copy out parameters */
                     76: #define        IOC_IN          0x80000000      /* copy in parameters */
                     77: #define        IOC_INOUT       (IOC_IN|IOC_OUT)
                     78: #define        IOC_DIRMASK     0xe0000000      /* mask for IN/OUT/VOID */
                     79: 
                     80: #define _IOC(inout,group,num,len) \
                     81:        (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num))
                     82: #define        _IO(g,n)        _IOC(IOC_VOID,  (g), (n), 0)
                     83: #define        _IOR(g,n,t)     _IOC(IOC_OUT,   (g), (n), sizeof(t))
                     84: #define        _IOW(g,n,t)     _IOC(IOC_IN,    (g), (n), sizeof(t))
                     85: /* this should be _IORW, but stdio got there first */
                     86: #define        _IOWR(g,n,t)    _IOC(IOC_INOUT, (g), (n), sizeof(t))
                     87: 
                     88: #define        TIOCMODG        _IOR('t', 3, int)       /* get modem control state */
                     89: #define        TIOCMODS        _IOW('t', 4, int)       /* set modem control state */
                     90: #define                TIOCM_LE        0001            /* line enable */
                     91: #define                TIOCM_DTR       0002            /* data terminal ready */
                     92: #define                TIOCM_RTS       0004            /* request to send */
                     93: #define                TIOCM_ST        0010            /* secondary transmit */
                     94: #define                TIOCM_SR        0020            /* secondary receive */
                     95: #define                TIOCM_CTS       0040            /* clear to send */
                     96: #define                TIOCM_CAR       0100            /* carrier detect */
                     97: #define                TIOCM_CD        TIOCM_CAR
                     98: #define                TIOCM_RNG       0200            /* ring */
                     99: #define                TIOCM_RI        TIOCM_RNG
                    100: #define                TIOCM_DSR       0400            /* data set ready */
                    101:                                                /* 8-10 compat */
                    102: #define        TIOCEXCL        _IO('t', 13)            /* set exclusive use of tty */
                    103: #define        TIOCNXCL        _IO('t', 14)            /* reset exclusive use of tty */
                    104:                                                /* 15 unused */
                    105: #define        TIOCFLUSH       _IOW('t', 16, int)      /* flush buffers */
                    106:                                                /* 17-18 compat */
                    107: #define        TIOCGETA        _IOR('t', 19, struct termios) /* get termios struct */
                    108: #define        TIOCSETA        _IOW('t', 20, struct termios) /* set termios struct */
                    109: #define        TIOCSETAW       _IOW('t', 21, struct termios) /* drain output, set */
                    110: #define        TIOCSETAF       _IOW('t', 22, struct termios) /* drn out, fls in, set */
                    111: #define        TIOCGETD        _IOR('t', 26, int)      /* get line discipline */
                    112: #define        TIOCSETD        _IOW('t', 27, int)      /* set line discipline */
                    113:                                                /* 127-124 compat */
                    114: #define        TIOCSBRK        _IO('t', 123)           /* set break bit */
                    115: #define        TIOCCBRK        _IO('t', 122)           /* clear break bit */
                    116: #define        TIOCSDTR        _IO('t', 121)           /* set data terminal ready */
                    117: #define        TIOCCDTR        _IO('t', 120)           /* clear data terminal ready */
                    118: #define        TIOCGPGRP       _IOR('t', 119, int)     /* get pgrp of tty */
                    119: #define        TIOCSPGRP       _IOW('t', 118, int)     /* set pgrp of tty */
                    120:                                                /* 117-116 compat */
                    121: #define        TIOCOUTQ        _IOR('t', 115, int)     /* output queue size */
                    122: #define        TIOCSTI         _IOW('t', 114, char)    /* simulate terminal input */
                    123: #define        TIOCNOTTY       _IO('t', 113)           /* void tty association */
                    124: #define        TIOCPKT         _IOW('t', 112, int)     /* pty: set/clear packet mode */
                    125: #define                TIOCPKT_DATA            0x00    /* data packet */
                    126: #define                TIOCPKT_FLUSHREAD       0x01    /* flush packet */
                    127: #define                TIOCPKT_FLUSHWRITE      0x02    /* flush packet */
                    128: #define                TIOCPKT_STOP            0x04    /* stop output */
                    129: #define                TIOCPKT_START           0x08    /* start output */
                    130: #define                TIOCPKT_NOSTOP          0x10    /* no more ^S, ^Q */
                    131: #define                TIOCPKT_DOSTOP          0x20    /* now do ^S ^Q */
                    132: #define                TIOCPKT_IOCTL           0x40    /* state change of pty driver */
                    133: #define        TIOCSTOP        _IO('t', 111)           /* stop output, like ^S */
                    134: #define        TIOCSTART       _IO('t', 110)           /* start output, like ^Q */
                    135: #define        TIOCMSET        _IOW('t', 109, int)     /* set all modem bits */
                    136: #define        TIOCMBIS        _IOW('t', 108, int)     /* bis modem bits */
                    137: #define        TIOCMBIC        _IOW('t', 107, int)     /* bic modem bits */
                    138: #define        TIOCMGET        _IOR('t', 106, int)     /* get all modem bits */
                    139: #define        TIOCREMOTE      _IOW('t', 105, int)     /* remote input editing */
                    140: #define        TIOCGWINSZ      _IOR('t', 104, struct winsize)  /* get window size */
                    141: #define        TIOCSWINSZ      _IOW('t', 103, struct winsize)  /* set window size */
                    142: #define        TIOCUCNTL       _IOW('t', 102, int)     /* pty: set/clr usr cntl mode */
                    143: #define                UIOCCMD(n)      _IO('u', n)             /* usr cntl op "n" */
1.1.1.2   root      144: #define TIOCSTAT       _IOW('t', 101, int)     /* generate status message */
1.1       root      145: #define        TIOCCONS        _IOW('t', 98, int)              /* become virtual console */
                    146: #define        TIOCSCTTY       _IO('t', 97)            /* become controlling tty */
                    147: #define        TIOCEXT         _IOW('t', 96, int)      /* pty: external processing */
                    148: #define        TIOCSIG         _IO('t', 95)            /* pty: generate signal */
                    149: #define TIOCDRAIN      _IO('t', 94)            /* wait till output drained */
                    150: 
1.1.1.3 ! root      151: 
1.1       root      152: #define TTYDISC                0               /* termios tty line discipline */
                    153: #define        TABLDISC        3               /* tablet discipline */
                    154: #define        SLIPDISC        4               /* serial IP discipline */
                    155: 
                    156: 
                    157: #define        FIOCLEX         _IO('f', 1)             /* set close on exec on fd */
                    158: #define        FIONCLEX        _IO('f', 2)             /* remove close on exec */
                    159: #define        FIONREAD        _IOR('f', 127, int)     /* get # bytes to read */
                    160: #define        FIONBIO         _IOW('f', 126, int)     /* set/clear non-blocking i/o */
                    161: #define        FIOASYNC        _IOW('f', 125, int)     /* set/clear async i/o */
                    162: #define        FIOSETOWN       _IOW('f', 124, int)     /* set owner */
                    163: #define        FIOGETOWN       _IOR('f', 123, int)     /* get owner */
                    164: 
                    165: /* socket i/o controls */
                    166: #define        SIOCSHIWAT      _IOW('s',  0, int)              /* set high watermark */
                    167: #define        SIOCGHIWAT      _IOR('s',  1, int)              /* get high watermark */
                    168: #define        SIOCSLOWAT      _IOW('s',  2, int)              /* set low watermark */
                    169: #define        SIOCGLOWAT      _IOR('s',  3, int)              /* get low watermark */
                    170: #define        SIOCATMARK      _IOR('s',  7, int)              /* at oob mark? */
                    171: #define        SIOCSPGRP       _IOW('s',  8, int)              /* set process group */
                    172: #define        SIOCGPGRP       _IOR('s',  9, int)              /* get process group */
                    173: 
                    174: #define        SIOCADDRT       _IOW('r', 10, struct ortentry)  /* add route */
                    175: #define        SIOCDELRT       _IOW('r', 11, struct ortentry)  /* delete route */
                    176: 
                    177: #define        SIOCSIFADDR     _IOW('i', 12, struct ifreq)     /* set ifnet address */
                    178: #define        OSIOCGIFADDR    _IOWR('i',13, struct ifreq)     /* get ifnet address */
                    179: #define        SIOCGIFADDR     _IOWR('i',33, struct ifreq)     /* get ifnet address */
                    180: #define        SIOCSIFDSTADDR  _IOW('i', 14, struct ifreq)     /* set p-p address */
                    181: #define        OSIOCGIFDSTADDR _IOWR('i',15, struct ifreq)     /* get p-p address */
                    182: #define        SIOCGIFDSTADDR  _IOWR('i',34, struct ifreq)     /* get p-p address */
                    183: #define        SIOCSIFFLAGS    _IOW('i', 16, struct ifreq)     /* set ifnet flags */
                    184: #define        SIOCGIFFLAGS    _IOWR('i',17, struct ifreq)     /* get ifnet flags */
                    185: #define        OSIOCGIFBRDADDR _IOWR('i',18, struct ifreq)     /* get broadcast addr */
                    186: #define        SIOCGIFBRDADDR  _IOWR('i',35, struct ifreq)     /* get broadcast addr */
                    187: #define        SIOCSIFBRDADDR  _IOW('i',19, struct ifreq)      /* set broadcast addr */
                    188: #define        OSIOCGIFCONF    _IOWR('i',20, struct ifconf)    /* get ifnet list */
                    189: #define        SIOCGIFCONF     _IOWR('i',36, struct ifconf)    /* get ifnet list */
                    190: #define        OSIOCGIFNETMASK _IOWR('i',21, struct ifreq)     /* get net addr mask */
                    191: #define        SIOCGIFNETMASK  _IOWR('i',37, struct ifreq)     /* get net addr mask */
                    192: #define        SIOCSIFNETMASK  _IOW('i',22, struct ifreq)      /* set net addr mask */
                    193: #define        SIOCGIFMETRIC   _IOWR('i',23, struct ifreq)     /* get IF metric */
                    194: #define        SIOCSIFMETRIC   _IOW('i',24, struct ifreq)      /* set IF metric */
                    195: #define        SIOCDIFADDR     _IOW('i',25, struct ifreq)      /* delete IF addr */
                    196: #define        SIOCAIFADDR     _IOW('i',26, struct ifaliasreq) /* add/chg IF alias */
                    197: 
                    198: #define        SIOCSARP        _IOW('i', 30, struct arpreq)    /* set arp entry */
                    199: #define        OSIOCGARP       _IOWR('i',31, struct arpreq)    /* get arp entry */
                    200: #define        SIOCGARP        _IOWR('i',38, struct arpreq)    /* get arp entry */
                    201: #define        SIOCDARP        _IOW('i', 32, struct arpreq)    /* delete arp entry */
                    202: 
                    203: #ifndef KERNEL
                    204: 
                    205: #include <sys/cdefs.h>
                    206: 
                    207: __BEGIN_DECLS
                    208: int    ioctl __P((int, unsigned long, ...));
                    209: __END_DECLS
                    210: 
                    211: #endif /* !KERNEL */
                    212: 
                    213: #endif /* !_IOCTL_H_ */
                    214: 
                    215: /* - note: keep outside _IOCTL_H_
                    216:  * Compatability with old terminal driver
                    217:  *
                    218:  * Source level -> #define USE_OLD_TTY
                    219:  * Kernel level -> options COMPAT_43
                    220:  */
                    221: #if defined(USE_OLD_TTY) || defined(COMPAT_43)
                    222: #ifdef KERNEL
                    223: #include "ioctl_compat.h"
                    224: #else
                    225: #include <sys/ioctl_compat.h>
                    226: #endif
1.1.1.3 ! root      227: 
        !           228: #endif /* !_SYS_IOCTL_H_ */

unix.superglobalmegacorp.com

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