home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / os / bsdss4.tz / bsdss4 / bsdss / server / sys / ioctl.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-04-22  |  11.2 KB  |  259 lines

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