added watt32 headers and brought the DOS version up to parity with UNIX
[oftp] / libs / watt32 / sys / ioctl.h
1 /*!\file sys/ioctl.h
2  * BSD socket I/O control.
3  */
4
5 /*-
6  * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  * 3. All advertising materials mentioning features or use of this software
18  *    must display the following acknowledgement:
19  *      This product includes software developed by the University of
20  *      California, Berkeley and its contributors.
21  * 4. Neither the name of the University nor the names of its contributors
22  *    may be used to endorse or promote products derived from this software
23  *    without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35  * SUCH DAMAGE.
36  *
37  *      @(#)ioctl.h     7.19 (Berkeley) 6/26/91
38  */
39
40 #ifndef __SYS_IOCTL_H
41 #define __SYS_IOCTL_H
42
43 /*
44  * Commands for ioctlsocket(),  taken from the BSD file fcntl.h.
45  *
46  *
47  * Ioctl's have the command encoded in the lower word,
48  * and the size of any in or out parameters in the upper
49  * word.  The high 2 bits of the upper word are used
50  * to encode the in/out status of the parameter; for now
51  * we restrict parameters to at most 128 bytes.
52  */
53
54 #define IOCPARM_MASK 0x7f               /* parameters must be < 128 bytes */
55
56 #define IOCPARM_LEN(x)  (((x) >> 16) & IOCPARM_MASK)
57 #define IOCBASECMD(x)   ((x) & ~IOCPARM_MASK)
58 #define IOCGROUP(x)     (((x) >> 8) & 0xff)
59
60 #define IOCPARM_MAX     4096            /* max size of ioctl */
61 #define IOC_VOID        0x20000000      /* no parameters */
62 #define IOC_OUT         0x40000000      /* copy out parameters */
63 #define IOC_IN          0x80000000      /* copy in parameters */
64 #define IOC_INOUT       (IOC_IN|IOC_OUT)  /* 0x20000000 distinguishes new &
65                                              old ioctl's */
66 #define IOC_DIRMASK     0xe0000000      /* mask for IN/OUT/VOID */
67
68 #define _IO(x,y)    (IOC_VOID|(x<<8)|y)
69 #define _IOR(x,y,t) (IOC_OUT|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y)
70 #define _IOW(x,y,t) (IOC_IN|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y)
71 /* this should be _IORW, but stdio got there first */
72 #define _IOWR(x,y,t) (IOC_INOUT|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y)
73
74 /* 
75  * file i/o controls
76  */
77 #define FIOCLEX         _IO('f', 1)            /* set close on exec on fd */
78 #define FIONCLEX        _IO('f', 2)            /* remove close on exec */
79 #define FIONREAD        _IOR('f', 127, int)    /* get # bytes to read */
80 #define FIONBIO         _IOW('f', 126, int)    /* set/clear non-blocking i/o */
81 #define FIOASYNC        _IOW('f', 125, int)    /* set/clear async i/o */
82 #define FIOSETOWN       _IOW('f', 124, int)    /* set owner (struct Task *) */
83 #define FIOGETOWN       _IOR('f', 123, int)    /* get owner (struct Task *) */
84
85 /* 
86  * socket i/o controls
87  *
88  * SIOCSPGRP and SIOCGPGRP are identical to the FIOSETOWN and FIOGETOWN,
89  * respectively.
90  */
91 #define SIOCSPGRP       _IOW('s',  8, int)    /* set process group */
92 #define SIOCGPGRP       _IOR('s',  9, int)    /* get process group */
93
94 /* #ifdef BSD */
95 #define SIOCADDRT       _IOW('r', 10, struct ortentry) /* add route */
96 #define SIOCDELRT       _IOW('r', 11, struct ortentry) /* delete route */
97
98 #define SIOCSIFADDR     _IOW('I', 12, struct ifreq)    /* set ifnet address */
99 #define OSIOCGIFADDR    _IOWR('I',13, struct ifreq)    /* get ifnet address */
100 #define SIOCGIFADDR     _IOWR('I',33, struct ifreq)    /* get ifnet address */
101 #define SIOCSIFDSTADDR  _IOW('I', 14, struct ifreq)    /* set p-p address */
102 #define OSIOCGIFDSTADDR _IOWR('I',15, struct ifreq)    /* get p-p address */
103 #define SIOCGIFDSTADDR  _IOWR('I',34, struct ifreq)    /* get p-p address */
104 #define SIOCSIFFLAGS    _IOW('I', 16, struct ifreq)    /* set ifnet flags */
105 #define SIOCGIFFLAGS    _IOWR('I',17, struct ifreq)    /* get ifnet flags */
106 #define OSIOCGIFBRDADDR _IOWR('I',18, struct ifreq)    /* get broadcast addr */
107 #define SIOCGIFBRDADDR  _IOWR('I',35, struct ifreq)    /* get broadcast addr */
108 #define SIOCSIFBRDADDR  _IOW('I',19, struct ifreq)     /* set broadcast addr */
109 #define OSIOCGIFCONF    _IOWR('I',20, struct ifconf)   /* get ifnet list */
110 #define SIOCGIFCONF     _IOWR('I',36, struct ifconf)   /* get ifnet list */
111 #define OSIOCGIFNETMASK _IOWR('I',21, struct ifreq)    /* get net addr mask */
112 #define SIOCGIFNETMASK  _IOWR('I',37, struct ifreq)    /* get net addr mask */
113 #define SIOCSIFNETMASK  _IOW('I',22, struct ifreq)     /* set net addr mask */
114 #define SIOCGIFMETRIC   _IOWR('I',23, struct ifreq)    /* get IF metric */
115 #define SIOCSIFMETRIC   _IOW('I',24, struct ifreq)     /* set IF metric */
116 #define SIOCDIFADDR     _IOW('I',25, struct ifreq)     /* delete IF addr */
117 #define SIOCAIFADDR     _IOW('I',26, struct ifaliasreq) /* add/chg IF alias */
118 #define SIOCGIFMTU      _IOWR('I',27, struct ifreq)    /* get IF mtu */
119 #define SIOCGIFHWADDR   _IOWR('I',28, struct ifconf)   /* get hardware addr */
120 #define OSIOCGIFHWADDR  SIOCGIFHWADDR
121
122 #define SIOCSARP        _IOW('I', 30, struct arpreq)   /* set arp entry */
123 #define OSIOCGARP       _IOWR('I',31, struct arpreq)   /* get arp entry */
124 #define SIOCGARP        _IOWR('I',38, struct arpreq)   /* get arp entry */
125 #define SIOCDARP        _IOW('I', 32, struct arpreq)   /* delete arp entry */
126 /* #endif */ /* BSD */
127
128 /* MS-DOS */
129 #define SIOCSHIWAT  _IOW('s',  0, int)    /* set high watermark */
130 #define SIOCGHIWAT  _IOR('s',  1, int)    /* get high watermark */
131 #define SIOCSLOWAT  _IOW('s',  2, int)    /* set low watermark */
132 #define SIOCGLOWAT  _IOR('s',  3, int)    /* get low watermark */
133 #define SIOCATMARK  _IOR('s',  7, int)    /* at oob mark? */
134
135 /* Since this file shadows the normal djgpp <sys/ioctl.h>, we provide
136  * this prototype here.
137  */
138 #if defined(DJGPP)
139   int ioctl (int __fd, int __cmd, ...);
140 #endif
141
142 #endif /* !SYS_IOCTL_H */