home *** CD-ROM | disk | FTP | other *** search
/ RISCWORLD 7 / RISCWORLD_VOL7.iso / Software / Issue2 / SDL.ARC / !unixlib / source / clib / sys / h / ioctl < prev    next >
Encoding:
Text File  |  2004-09-05  |  23.8 KB  |  484 lines

  1. /****************************************************************************
  2.  *
  3.  * $Source: /usr/local/cvsroot/gccsdk/unixlib/source/clib/sys/ioctl.h,v $
  4.  * $Date: 2004/04/17 10:51:15 $
  5.  * $Revision: 1.6 $
  6.  * $State: Exp $
  7.  * $Author: nick $
  8.  *
  9.  ***************************************************************************/
  10.  
  11. /*-
  12.  * Copyright (c) 1982, 1986, 1990, 1993, 1994
  13.  *      The Regents of the University of California.  All rights reserved.
  14.  * (c) UNIX System Laboratories, Inc.
  15.  * All or some portions of this file are derived from material licensed
  16.  * to the University of California by American Telephone and Telegraph
  17.  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
  18.  * the permission of UNIX System Laboratories, Inc.
  19.  *
  20.  * Redistribution and use in source and binary forms, with or without
  21.  * modification, are permitted provided that the following conditions
  22.  * are met:
  23.  * 1. Redistributions of source code must retain the above copyright
  24.  *    notice, this list of conditions and the following disclaimer.
  25.  * 2. Redistributions in binary form must reproduce the above copyright
  26.  *    notice, this list of conditions and the following disclaimer in the
  27.  *    documentation and/or other materials provided with the distribution.
  28.  * 3. All advertising materials mentioning features or use of this software
  29.  *    must display the following acknowledgement:
  30.  *      This product includes software developed by the University of
  31.  *      California, Berkeley and its contributors.
  32.  * 4. Neither the name of the University nor the names of its contributors
  33.  *    may be used to endorse or promote products derived from this software
  34.  *    without specific prior written permission.
  35.  *
  36.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  37.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  38.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  39.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  40.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  41.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  42.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  43.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  44.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  45.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  46.  * SUCH DAMAGE.
  47.  *
  48.  */
  49.  
  50. #ifndef __SYS_IOCTL_H
  51. #define __SYS_IOCTL_H
  52.  
  53. #ifndef __UNIXLIB_FEATURES_H
  54. #include <unixlib/features.h>
  55. #endif
  56.  
  57. __BEGIN_DECLS
  58.  
  59. /* These macros are also defined in some ioctls.h files (with numerically
  60.    identical values), but this serves to shut up cpp's complaining. */
  61. #ifdef MDMBUF
  62. #undef MDMBUF
  63. #endif
  64. #ifdef FLUSHO
  65. #undef FLUSHO
  66. #endif
  67. #ifdef PENDIN
  68. #undef PENDIN
  69. #endif
  70.  
  71.  
  72. #ifdef ECHO
  73. #undef ECHO
  74. #endif
  75. #ifdef TOSTOP
  76. #undef TOSTOP
  77. #endif
  78. #ifdef NOFLSH
  79. #undef NOFLSH
  80. #endif
  81.  
  82. /*
  83.  * Ioctl's have the command encoded in the lower word, and the size of
  84.  * any in or out parameters in the upper word.  The high 3 bits of the
  85.  * upper word are used to encode the in/out status of the parameter.
  86.  */
  87. #define IOCPARM_MASK    0x1fff          /* parameter length, at most 13 bits */
  88. #define IOCPARM_LEN(x)  (((x) >> 16) & IOCPARM_MASK)
  89. #define IOCBASECMD(x)   ((x) & ~(IOCPARM_MASK << 16))
  90. #define IOCGROUP(x)     (((x) >> 8) & 0xff)
  91.  
  92. #define IOCPARM_MAX     PAGE_SIZE               /* max size of ioctl, mult. of PAGE_SIZE */
  93. #define IOC_VOID        0x20000000      /* no parameters */
  94. #define IOC_OUT         0x40000000      /* copy out parameters */
  95. #define IOC_IN          0x80000000      /* copy in parameters */
  96. #define IOC_INOUT       (IOC_IN|IOC_OUT)
  97. #define IOC_DIRMASK     0xe0000000      /* mask for IN/OUT/VOID */
  98.  
  99. #define _IOC(inout,group,num,len) \
  100.         ((unsigned long)(inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num)))
  101. #define _IO(g,n)        _IOC(IOC_VOID,  (g), (n), 0)
  102. #define _IOR(g,n,t)     _IOC(IOC_OUT,   (g), (n), sizeof(t))
  103. #define _IOW(g,n,t)     _IOC(IOC_IN,    (g), (n), sizeof(t))
  104. /* this should be _IORW, but stdio got there first */
  105. #define _IOWR(g,n,t)    _IOC(IOC_INOUT, (g), (n), sizeof(t))
  106.  
  107.  
  108.  
  109. /*
  110.  * Tty ioctl's except for those supported only for backwards compatibility
  111.  * with the old tty driver.
  112.  */
  113.  
  114. /*
  115.  * Window/terminal size structure.  This information is stored by the kernel
  116.  * in order to provide a consistent interface, but is not used by the kernel.
  117.  */
  118. struct winsize
  119. {
  120.   unsigned short  ws_row;         /* rows, in characters */
  121.   unsigned short  ws_col;         /* columns, in characters */
  122.   unsigned short  ws_xpixel;      /* horizontal size, pixels */
  123.   unsigned short  ws_ypixel;      /* vertical size, pixels */
  124. };
  125.  
  126. #define TIOCMODG        _IOR('t', 3, int)       /* get modem control state */
  127. #define TIOCMODS        _IOW('t', 4, int)       /* set modem control state */
  128. #define         TIOCM_LE        0001            /* line enable */
  129. #define         TIOCM_DTR       0002            /* data terminal ready */
  130. #define         TIOCM_RTS       0004            /* request to send */
  131. #define         TIOCM_ST        0010            /* secondary transmit */
  132. #define         TIOCM_SR        0020            /* secondary receive */
  133. #define         TIOCM_CTS       0040            /* clear to send */
  134. #define         TIOCM_CAR       0100            /* carrier detect */
  135. #define         TIOCM_CD        TIOCM_CAR
  136. #define         TIOCM_RNG       0200            /* ring */
  137. #define         TIOCM_RI        TIOCM_RNG
  138. #define         TIOCM_DSR       0400            /* data set ready */
  139.                                                 /* 8-10 compat */
  140. #define TIOCEXCL         _IO('t', 13)           /* set exclusive use of tty */
  141. #define TIOCNXCL         _IO('t', 14)           /* reset exclusive use of tty */
  142.                                                 /* 15 unused */
  143. #define TIOCFLUSH       _IOW('t', 16, int)      /* flush buffers */
  144.                                                 /* 17-18 compat */
  145. #define TIOCGETA        _IOR('t', 19, struct termios) /* get termios struct */
  146. #define TIOCSETA        _IOW('t', 20, struct termios) /* set termios struct */
  147. #define TIOCSETAW       _IOW('t', 21, struct termios) /* drain output, set */
  148. #define TIOCSETAF       _IOW('t', 22, struct termios) /* drn out, fls in, set */
  149. #define TIOCGETD        _IOR('t', 26, int)      /* get line discipline */
  150. #define TIOCSETD        _IOW('t', 27, int)      /* set line discipline */
  151.                                                 /* 127-124 compat */
  152. #define TIOCSBRK         _IO('t', 123)          /* set break bit */
  153. #define TIOCCBRK         _IO('t', 122)          /* clear break bit */
  154. #define TIOCSDTR         _IO('t', 121)          /* set data terminal ready */
  155. #define TIOCCDTR         _IO('t', 120)          /* clear data terminal ready */
  156. #define TIOCGPGRP       _IOR('t', 119, int)     /* get pgrp of tty */
  157. #define TIOCSPGRP       _IOW('t', 118, int)     /* set pgrp of tty */
  158.                                                 /* 117-116 compat */
  159. #define TIOCOUTQ        _IOR('t', 115, int)     /* output queue size */
  160. #define TIOCSTI         _IOW('t', 114, char)    /* simulate terminal input */
  161. #define TIOCNOTTY        _IO('t', 113)          /* void tty association */
  162. #define TIOCPKT         _IOW('t', 112, int)     /* pty: set/clear packet mode */
  163. #define         TIOCPKT_DATA            0x00    /* data packet */
  164. #define         TIOCPKT_FLUSHREAD       0x01    /* flush packet */
  165. #define         TIOCPKT_FLUSHWRITE      0x02    /* flush packet */
  166. #define         TIOCPKT_STOP            0x04    /* stop output */
  167. #define         TIOCPKT_START           0x08    /* start output */
  168. #define         TIOCPKT_NOSTOP          0x10    /* no more ^S, ^Q */
  169. #define         TIOCPKT_DOSTOP          0x20    /* now do ^S ^Q */
  170. #define         TIOCPKT_IOCTL           0x40    /* state change of pty driver */
  171. #define TIOCSTOP         _IO('t', 111)          /* stop output, like ^S */
  172. #define TIOCSTART        _IO('t', 110)          /* start output, like ^Q */
  173. #define TIOCMSET        _IOW('t', 109, int)     /* set all modem bits */
  174. #define TIOCMBIS        _IOW('t', 108, int)     /* bis modem bits */
  175. #define TIOCMBIC        _IOW('t', 107, int)     /* bic modem bits */
  176. #define TIOCMGET        _IOR('t', 106, int)     /* get all modem bits */
  177. #define TIOCREMOTE      _IOW('t', 105, int)     /* remote input editing */
  178. #define TIOCGWINSZ      _IOR('t', 104, struct winsize)  /* get window size */
  179. #define TIOCSWINSZ      _IOW('t', 103, struct winsize)  /* set window size */
  180. #define TIOCUCNTL       _IOW('t', 102, int)     /* pty: set/clr usr cntl mode */
  181. #define TIOCSTAT         _IO('t', 101)          /* simulate ^T status message */
  182. #define         UIOCCMD(n)      _IO('u', n)     /* usr cntl op "n" */
  183. #define TIOCCONS        _IOW('t', 98, int)      /* become virtual console */
  184. #define TIOCSCTTY        _IO('t', 97)           /* become controlling tty */
  185. #define TIOCEXT         _IOW('t', 96, int)      /* pty: external processing */
  186. #define TIOCSIG          _IO('t', 95)           /* pty: generate signal */
  187. #define TIOCDRAIN        _IO('t', 94)           /* wait till output drained */
  188. #define TIOCMSDTRWAIT   _IOW('t', 91, int)      /* modem: set wait on close */
  189. #define TIOCMGDTRWAIT   _IOR('t', 90, int)      /* modem: get wait on close */
  190. #define TIOCTIMESTAMP   _IOR('t', 89, struct timeval)   /* enable/get timestamp
  191.                                                  * of last input event */
  192. #define TIOCDCDTIMESTAMP _IOR('t', 88, struct timeval)  /* enable/get timestamp
  193.                                                  * of last DCd rise */
  194. #define TIOCSDRAINWAIT  _IOW('t', 87, int)      /* set ttywait timeout */
  195. #define TIOCGDRAINWAIT  _IOR('t', 86, int)      /* get ttywait timeout */
  196.  
  197. #define TTYDISC         0               /* termios tty line discipline */
  198. #define SLIPDISC        4               /* serial IP discipline */
  199. #define PPPDISC         5               /* PPP discipline */
  200. #define NETGRAPHDISC    6               /* Netgraph tty node discipline */
  201.  
  202.  
  203.  
  204.  
  205. /*
  206.  * Pun for SunOS prior to 3.2.  SunOS 3.2 and later support TIOCGWINSZ
  207.  * and TIOCSWINSZ (yes, even 3.2-3.5, the fact that it wasn't documented
  208.  * notwithstanding).
  209.  */
  210. struct ttysize
  211. {
  212.   unsigned short  ts_lines;
  213.   unsigned short  ts_cols;
  214.   unsigned short  ts_xxx;
  215.   unsigned short  ts_yyy;
  216. };
  217. #define TIOCGSIZE       TIOCGWINSZ
  218. #define TIOCSSIZE       TIOCSWINSZ
  219.  
  220.  
  221. /* Generic file-descriptor ioctl's. */
  222. #define FIOCLEX          _IO('f', 1)            /* set close on exec on fd */
  223. #define FIONCLEX         _IO('f', 2)            /* remove close on exec */
  224. #define FIONREAD        _IOR('f', 127, int)     /* get # bytes to read */
  225. #define FIONBIO         _IOW('f', 126, int)     /* set/clear non-blocking i/o */
  226. #define FIOASYNC        _IOW('f', 125, int)     /* set/clear async i/o */
  227. #define FIOSETOWN       _IOW('f', 124, int)     /* set owner */
  228. #define FIOGETOWN       _IOR('f', 123, int)     /* get owner */
  229. #define FIODTYPE        _IOR('f', 122, int)     /* get d_flags type part */
  230. #define FIOGETLBA       _IOR('f', 121, int)     /* get start blk # */
  231. #define FIOSLEEPTW      _IOW('f', 121, int)     /* Set/clear OS_Upcall 6 use */
  232.  
  233.  
  234.  
  235. /* Socket ioctl's. */
  236. #define SIOCSHIWAT       _IOW('s',  0, int)             /* set high watermark */
  237. #define SIOCGHIWAT       _IOR('s',  1, int)             /* get high watermark */
  238. #define SIOCSLOWAT       _IOW('s',  2, int)             /* set low watermark */
  239. #define SIOCGLOWAT       _IOR('s',  3, int)             /* get low watermark */
  240. #define SIOCATMARK       _IOR('s',  7, int)             /* at oob mark? */
  241. #define SIOCSPGRP        _IOW('s',  8, int)             /* set process group */
  242. #define SIOCGPGRP        _IOR('s',  9, int)             /* get process group */
  243.  
  244. #define SIOCADDRT        _IOW('r', 10, struct ortentry) /* add route */
  245. #define SIOCDELRT        _IOW('r', 11, struct ortentry) /* delete route */
  246. #define SIOCSETRTINFO   _IOWR('r', 12, struct fullrtentry) /* change aux info */
  247. #define SIOCGETRTINFO   _IOWR('r', 13, struct fullrtentry) /* read aux info */
  248. #define SIOCGETVIFINF   _IOWR('r', 14, struct vif_conf)   /* read m/c vifs  */
  249. #define SIOCGETVIFCNT   _IOWR('r', 15, struct sioc_vif_req)/* get vif pkt cnt */
  250. #define SIOCGETSGCNT    _IOWR('r', 16, struct sioc_sg_req) /* get s,g pkt cnt */
  251.  
  252. #define SIOCSIFADDR      _IOW('i', 12, struct ifreq)    /* set ifnet address */
  253. #ifdef COMPAT_INET4
  254. #define SIOCGIFADDR     _IOWR('i', 13, struct ifreq)    /* get ifnet address */
  255. #define NSIOCGIFADDR    _IOWR('i', 99, struct nifreq)   /* get ifnet address */
  256. #else
  257. #define OSIOCGIFADDR    _IOWR('i', 13, struct oifreq)   /* get ifnet address */
  258. #define SIOCGIFADDR     _IOWR('i', 99, struct ifreq)    /* get ifnet address */
  259. #endif
  260. #define SIOCSIFDSTADDR   _IOW('i', 14, struct ifreq)    /* set p-p address */
  261. #ifdef COMPAT_INET4
  262. #define SIOCGIFDSTADDR  _IOWR('i', 15, struct ifreq)    /* get p-p address */
  263. #define NSIOCGIFDSTADDR _IOWR('i', 98, struct nifreq)   /* get p-p address */
  264. #else
  265. #define OSIOCGIFDSTADDR _IOWR('i', 15, struct oifreq)   /* get p-p address */
  266. #define SIOCGIFDSTADDR  _IOWR('i', 98, struct ifreq)    /* get p-p address */
  267. #endif
  268. #define SIOCSIFFLAGS     _IOW('i', 16, struct ifreq)    /* set ifnet flags */
  269. #define SIOCGIFFLAGS    _IOWR('i', 17, struct ifreq)    /* get ifnet flags */
  270. #ifdef COMPAT_INET4
  271. #define SIOCGIFBRDADDR  _IOWR('i', 18, struct ifreq)    /* get broadcast addr */
  272. #define NSIOCGIFBRDADDR _IOWR('i', 97, struct nifreq)   /* get broadcast addr */
  273. #else
  274. #define OSIOCGIFBRDADDR _IOWR('i', 18, struct oifreq)   /* get broadcast addr */
  275. #define SIOCGIFBRDADDR  _IOWR('i', 97, struct ifreq)    /* get broadcast addr */
  276. #endif
  277. #define SIOCSIFBRDADDR   _IOW('i', 19, struct ifreq)    /* set broadcast addr */
  278. #ifdef COMPAT_INET4
  279. #define SIOCGIFCONF     _IOWR('i', 20, struct ifconf)   /* get ifnet list */
  280. #define NSIOCGIFCONF    _IOWR('i', 96, struct nifconf)  /* get ifnet list */
  281. #define SIOCGIFNETMASK  _IOWR('i', 21, struct ifreq)    /* get net addr mask */
  282. #define NSIOCGIFNETMASK _IOWR('i', 95, struct nifreq)   /* get net addr mask */
  283. #else
  284. #define OSIOCGIFCONF    _IOWR('i', 20, struct oifconf)  /* get ifnet list */
  285. #define SIOCGIFCONF     _IOWR('i', 96, struct ifconf)   /* get ifnet list */
  286. #define OSIOCGIFNETMASK _IOWR('i', 21, struct oifreq)   /* get net addr mask */
  287. #define SIOCGIFNETMASK  _IOWR('i', 95, struct ifreq)    /* get net addr mask */
  288. #endif
  289. #define SIOCSIFNETMASK   _IOW('i', 22, struct ifreq)    /* set net addr mask */
  290. #define SIOCGIFMETRIC   _IOWR('i', 23, struct ifreq)    /* get IF metric */
  291. #define SIOCSIFMETRIC    _IOW('i', 24, struct ifreq)    /* set IF metric */
  292. #define SIOCDIFADDR      _IOW('i', 94, struct ifreq)    /* delete IF addr */
  293. #define SIOCAIFADDR      _IOW('i', 93, struct ifaliasreq)/* add/chg IF alias */
  294.  
  295. #ifdef __riscos
  296. #define SIOCGWHOIAMR    _IOWR('i', 25, struct ifreq)    /* get IP adr via REVARP */
  297. #define SIOCGWHOIAMB    _IOWR('i', 26, struct ifreq)    /* get IP adr via BOOTP */
  298. #define SIOCGWHOIAMRB   _IOWR('i', 27, struct ifreq)    /* get IP adr via REVARP or BOOTP */
  299. #define SIOCGWHOIAMM    _IOWR('i', 28, struct ifreq)    /* get net addr mask via ICMP */
  300. #define SIOCGWHOIAMMNS  _IOWR('i', 29, struct ifreq)    /* get net addr via MNS Rarp */
  301. #define SIOCSWHOTHEYARE  _IOW('i', 34, struct ifreq)    /* broadcast MNS Rarp replies */
  302. #define SIOCGTCPIDLE     _IOR('i', 35, int)             /* get tcp_keepidle */
  303. #define SIOCSTCPIDLE     _IOW('i', 36, int)             /* set tcp_keepidle */
  304. #define SIOCGTCPCNT      _IOR('i', 37, int)             /* get tcp_keepcnt */
  305. #define SIOCSTCPCNT      _IOW('i', 38, int)             /* set tcp_keepcnt */
  306. #define SIOCGWHOIAMD    _IOWR('i', 41, struct ifdhcpreq)/* send DHCP messages */
  307. #endif
  308.  
  309. #define SIOCADDMULTI     _IOW('i', 49, struct ifreq)    /* add m'cast addr */
  310. #define SIOCDELMULTI     _IOW('i', 50, struct ifreq)    /* del m'cast addr */
  311. #define SIOCGIFMTU      _IOWR('i', 39, struct ifreq)    /* get IF mtu */
  312. #define SIOCSIFMTU       _IOW('i', 40, struct ifreq)    /* set IF mtu */
  313. #define SIOCGIFPHYS     _IOWR('i', 53, struct ifreq)    /* get IF wire */
  314. #define SIOCSIFPHYS      _IOW('i', 54, struct ifreq)    /* set IF wire */
  315. #define SIOCSIFMEDIA    _IOWR('i', 55, struct ifreq)    /* set net media */
  316. #define SIOCGIFMEDIA    _IOWR('i', 56, struct ifmediareq) /* get net media */
  317.  
  318. #define SIOCSIFPHYADDR   _IOW('i', 70, struct ifaliasreq) /* set gif addres */
  319. #define SIOCGIFPSRCADDR _IOWR('i', 71, struct ifreq)    /* get gif psrc addr */
  320. #define SIOCGIFPDSTADDR _IOWR('i', 72, struct ifreq)    /* get gif pdst addr */
  321. #define SIOCDIFPHYADDR   _IOW('i', 73, struct ifreq)    /* delete gif addrs */
  322.  
  323. #define SIOCSIFGENERIC   _IOW('i', 57, struct ifreq)    /* generic IF set op */
  324. #define SIOCGIFGENERIC  _IOWR('i', 58, struct ifreq)    /* generic IF get op */
  325.  
  326. #define SIOCGIFSTATUS   _IOWR('i', 59, struct ifstat)   /* get IF status */
  327. #define SIOCSIFLLADDR   _IOW('i', 60, struct ifreq)     /* set link level addr */
  328.  
  329.  
  330. /*
  331.  * User visible structures and constants related to terminal handling.
  332.  */
  333.  
  334. struct ttychars
  335. {
  336.   char    tc_erase;       /* erase last character */
  337.   char    tc_kill;        /* erase entire line */
  338.   char    tc_intrc;       /* interrupt */
  339.   char    tc_quitc;       /* quit */
  340.   char    tc_startc;      /* start output */
  341.   char    tc_stopc;       /* stop output */
  342.   char    tc_eofc;        /* end-of-file */
  343.   char    tc_brkc;        /* input delimiter (like nl) */
  344.   char    tc_suspc;       /* stop process signal */
  345.   char    tc_dsuspc;      /* delayed stop process signal */
  346.   char    tc_rprntc;      /* reprint line */
  347.   char    tc_flushc;      /* flush output (toggles) */
  348.   char    tc_werasc;      /* word erase */
  349.   char    tc_lnextc;      /* literal next character */
  350. };
  351.  
  352. struct tchars
  353. {
  354.   char    t_intrc;        /* interrupt */
  355.   char    t_quitc;        /* quit */
  356.   char    t_startc;       /* start output */
  357.   char    t_stopc;        /* stop output */
  358.   char    t_eofc;         /* end-of-file */
  359.   char    t_brkc;         /* input delimiter (like nl) */
  360. };
  361.  
  362. struct ltchars
  363. {
  364.   char    t_suspc;        /* stop process signal */
  365.   char    t_dsuspc;       /* delayed stop process signal */
  366.   char    t_rprntc;       /* reprint line */
  367.   char    t_flushc;       /* flush output (toggles) */
  368.   char    t_werasc;       /* word erase */
  369.   char    t_lnextc;       /* literal next character */
  370. };
  371.  
  372. /*
  373.  * Structure for TIOCGETP and TIOCSETP ioctls.
  374.  */
  375. struct sgttyb
  376. {
  377.   char    sg_ispeed;              /* input speed */
  378.   char    sg_ospeed;              /* output speed */
  379.   char    sg_erase;               /* erase character */
  380.   char    sg_kill;                /* kill character */
  381.   short   sg_flags;               /* mode flags */
  382. };
  383.  
  384. #define OTIOCGETD      _IOR('t', 0, int)       /* get line discipline */
  385. #define OTIOCSETD      _IOW('t', 1, int)       /* set line discipline */
  386. #define TIOCHPCL        _IO('t', 2)             /* hang up on last close */
  387. #define TIOCGETP        _IOR('t', 8,struct sgttyb)/* get parameters -- gtty */
  388. #define TIOCSETP        _IOW('t', 9,struct sgttyb)/* set parameters -- stty */
  389. #define TIOCSETN        _IOW('t',10,struct sgttyb)/* as above, but no flushtty*/
  390. #define TIOCSETC        _IOW('t',17,struct tchars)/* set special characters */
  391. #define TIOCGETC        _IOR('t',18,struct tchars)/* get special characters */
  392. #define         TANDEM          0x00000001      /* send stopc on out q full */
  393. #define         CBREAK          0x00000002      /* half-cooked mode */
  394. #define         LCASE           0x00000004      /* simulate lower case */
  395. #define         ECHO            0x00000008      /* echo input */
  396. #define         CRMOD           0x00000010      /* map \r to \r\n on output */
  397. #define         RAW             0x00000020      /* no i/o processing */
  398. #define         ODDP            0x00000040      /* get/send odd parity */
  399. #define         EVENP           0x00000080      /* get/send even parity */
  400. #define         ANYP            0x000000c0      /* get any parity/send none */
  401. #define         NLDELAY         0x00000300      /* \n delay */
  402. #define                 NL0     0x00000000
  403. #define                 NL1     0x00000100      /* tty 37 */
  404. #define                 NL2     0x00000200      /* vt05 */
  405. #define                 NL3     0x00000300
  406. #define         TBDELAY         0x00000c00      /* horizontal tab delay */
  407. #define                 TAB0    0x00000000
  408. #define                 TAB1    0x00000400      /* tty 37 */
  409. #define                 TAB2    0x00000800
  410. #define         XTABS           0x00000c00      /* expand tabs on output */
  411. #define         CRDELAY         0x00003000      /* \r delay */
  412. #define                 CR0     0x00000000
  413. #define                 CR1     0x00001000      /* tn 300 */
  414. #define                 CR2     0x00002000      /* tty 37 */
  415. #define                 CR3     0x00003000      /* concept 100 */
  416. #define         VTDELAY         0x00004000      /* vertical tab delay */
  417. #define                 FF0     0x00000000
  418. #define                 FF1     0x00004000      /* tty 37 */
  419. #define         BSDELAY         0x00008000      /* \b delay */
  420. #define                 BS0     0x00000000
  421. #define                 BS1     0x00008000
  422. #define         ALLDELAY        (NLDELAY|TBDELAY|CRDELAY|VTDELAY|BSDELAY)
  423. #define         CRTBS           0x00010000      /* do backspacing for crt */
  424. #define         PRTERA          0x00020000      /* \ ... / erase */
  425. #define         CRTERA          0x00040000      /* " \b " to wipe out char */
  426. #define         TILDE           0x00080000      /* hazeltine tilde kludge */
  427. #define         MDMBUF          0x00100000      /*start/stop output on carrier*/
  428. #define         LITOUT          0x00200000      /* literal output */
  429. #define         TOSTOP          0x00400000      /*SIGSTOP on background output*/
  430. #define         FLUSHO          0x00800000      /* flush output to terminal */
  431. #define         NOHANG          0x01000000      /* (no-op) was no SIGHUP on carrier drop */
  432. #define         L001000         0x02000000
  433. #define         CRTKIL          0x04000000      /* kill line with " \b " */
  434. #define         PASS8           0x08000000
  435. #define         CTLECH          0x10000000      /* echo control chars as ^X */
  436. #define         PENDIN          0x20000000      /* tp->t_rawq needs reread */
  437. #define         DECCTQ          0x40000000      /* only ^Q starts after ^S */
  438. #define         NOFLSH          0x80000000      /* no output flush on signal */
  439. #define TIOCLBIS        _IOW('t', 127, int)     /* bis local mode bits */
  440. #define TIOCLBIC        _IOW('t', 126, int)     /* bic local mode bits */
  441. #define TIOCLSET        _IOW('t', 125, int)     /* set entire local mode word */
  442. #define TIOCLGET        _IOR('t', 124, int)     /* get local modes */
  443. #define         LCRTBS          (CRTBS>>16)
  444. #define         LPRTERA         (PRTERA>>16)
  445. #define         LCRTERA         (CRTERA>>16)
  446. #define         LTILDE          (TILDE>>16)
  447. #define         LMDMBUF         (MDMBUF>>16)
  448. #define         LLITOUT         (LITOUT>>16)
  449. #define         LTOSTOP         (TOSTOP>>16)
  450. #define         LFLUSHO         (FLUSHO>>16)
  451. #define         LNOHANG         (NOHANG>>16)
  452. #define         LCRTKIL         (CRTKIL>>16)
  453. #define         LPASS8          (PASS8>>16)
  454. #define         LCTLECH         (CTLECH>>16)
  455. #define         LPENDIN         (PENDIN>>16)
  456. #define         LDECCTQ         (DECCTQ>>16)
  457. #define         LNOFLSH         (NOFLSH>>16)
  458. #define TIOCSLTC        _IOW('t',117,struct ltchars)/* set local special chars*/
  459. #define TIOCGLTC        _IOR('t',116,struct ltchars)/* get local special chars*/
  460. #define OTIOCCONS       _IO('t', 98)    /* for hp300 -- sans int arg */
  461. #define OTTYDISC        0
  462. #define NETLDISC        1
  463. #define NTTYDISC        2
  464.  
  465.  
  466. /* Union for generic ioctl() argument handling.  */
  467. union ioctl_arg
  468. {
  469.   char *cparg;          /* Pointer to character */
  470.   char carg;            /* Character */
  471.   int  *iparg;          /* Pointer to integer */
  472.   int  iarg;            /* Integer */
  473.   long *lparg;          /* Pointer to long */
  474.   long larg;            /* Long */
  475. };
  476.  
  477. /* Perform the I/O control operation specified by 'request' on 'fd'.
  478.    -1 usually indicates an error.  */
  479. extern int ioctl (int __fd, unsigned long __request, void *arg) __THROW;
  480.  
  481. __END_DECLS
  482.  
  483. #endif
  484.