BSD 4_3_Net_2 release
[unix-history] / usr / src / sys / sys / ioctl.h
index d6336f0..4929a84 100644 (file)
@@ -1,30 +1,50 @@
-/*
- * Copyright (c) 1982, 1986 Regents of the University of California.
- * All rights reserved.  The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
+/*-
+ * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
  *
  *
- *     @(#)ioctl.h     7.12 (Berkeley) 5/18/90
+ *     @(#)ioctl.h     7.19 (Berkeley) 6/26/91
  */
 
  */
 
-/*
- * Ioctl definitions
- */
-#ifndef        _IOCTL_
-#define        _IOCTL_
+#ifndef        _IOCTL_H_
+#define        _IOCTL_H_
 
 /*
 
 /*
- * Window/terminal size structure.
- * This information is stored by the kernel
- * in order to provide a consistent interface,
- * but is not used by the kernel.
- *
- * Type must be "unsigned short" so that types.h not required.
+ * Window/terminal size structure.  This information is stored by the kernel
+ * in order to provide a consistent interface, but is not used by the kernel.
  */
 struct winsize {
  */
 struct winsize {
-       unsigned short  ws_row;                 /* rows, in characters */
-       unsigned short  ws_col;                 /* columns, in characters */
-       unsigned short  ws_xpixel;              /* horizontal size, pixels */
-       unsigned short  ws_ypixel;              /* vertical size, pixels */
+       unsigned short  ws_row;         /* rows, in characters */
+       unsigned short  ws_col;         /* columns, in characters */
+       unsigned short  ws_xpixel;      /* horizontal size, pixels */
+       unsigned short  ws_ypixel;      /* vertical size, pixels */
 };
 
 /*
 };
 
 /*
@@ -39,12 +59,10 @@ struct ttysize {
 #define        TIOCGSIZE       TIOCGWINSZ
 #define        TIOCSSIZE       TIOCSWINSZ
 
 #define        TIOCGSIZE       TIOCGWINSZ
 #define        TIOCSSIZE       TIOCSWINSZ
 
-#ifndef _IO
 /*
 /*
- * Ioctl's have the command encoded in the lower word,
- * and the size of any in or out parameters in the upper
- * word.  The high 3 bits of the upper word are used
- * to encode the in/out status of the parameter.
+ * Ioctl's have the command encoded in the lower word, and the size of
+ * any in or out parameters in the upper word.  The high 3 bits of the
+ * upper word are used to encode the in/out status of the parameter.
  */
 #define        IOCPARM_MASK    0x1fff          /* parameter length, at most 13 bits */
 #define        IOCPARM_LEN(x)  (((x) >> 16) & IOCPARM_MASK)
  */
 #define        IOCPARM_MASK    0x1fff          /* parameter length, at most 13 bits */
 #define        IOCPARM_LEN(x)  (((x) >> 16) & IOCPARM_MASK)
@@ -65,13 +83,7 @@ struct ttysize {
 #define        _IOW(g,n,t)     _IOC(IOC_IN,    (g), (n), sizeof(t))
 /* this should be _IORW, but stdio got there first */
 #define        _IOWR(g,n,t)    _IOC(IOC_INOUT, (g), (n), sizeof(t))
 #define        _IOW(g,n,t)     _IOC(IOC_IN,    (g), (n), sizeof(t))
 /* this should be _IORW, but stdio got there first */
 #define        _IOWR(g,n,t)    _IOC(IOC_INOUT, (g), (n), sizeof(t))
-#endif
-
 
 
-/*
- * tty ioctl commands
- */
-                                               /* 0-2 compat */
 #define        TIOCMODG        _IOR('t', 3, int)       /* get modem control state */
 #define        TIOCMODS        _IOW('t', 4, int)       /* set modem control state */
 #define                TIOCM_LE        0001            /* line enable */
 #define        TIOCMODG        _IOR('t', 3, int)       /* get modem control state */
 #define        TIOCMODS        _IOW('t', 4, int)       /* set modem control state */
 #define                TIOCM_LE        0001            /* line enable */
@@ -95,11 +107,6 @@ struct ttysize {
 #define        TIOCSETA        _IOW('t', 20, struct termios) /* set termios struct */
 #define        TIOCSETAW       _IOW('t', 21, struct termios) /* drain output, set */
 #define        TIOCSETAF       _IOW('t', 22, struct termios) /* drn out, fls in, set */
 #define        TIOCSETA        _IOW('t', 20, struct termios) /* set termios struct */
 #define        TIOCSETAW       _IOW('t', 21, struct termios) /* drain output, set */
 #define        TIOCSETAF       _IOW('t', 22, struct termios) /* drn out, fls in, set */
-/*** THESE GO AWAY ***/
-#define        JUNK_TIOCSETAS  _IOW('t', 23, struct termios) /* SETA ign hdw state */
-#define        JUNK_TIOCSETAWS _IOW('t', 24, struct termios) /* SETAW ign hdw state */
-#define        JUNK_TIOCSETAFS _IOW('t', 25, struct termios) /* SETAF ign hdw state */
-/******************/
 #define        TIOCGETD        _IOR('t', 26, int)      /* get line discipline */
 #define        TIOCSETD        _IOW('t', 27, int)      /* set line discipline */
                                                /* 127-124 compat */
 #define        TIOCGETD        _IOR('t', 26, int)      /* get line discipline */
 #define        TIOCSETD        _IOW('t', 27, int)      /* set line discipline */
                                                /* 127-124 compat */
@@ -137,24 +144,12 @@ struct ttysize {
 #define        TIOCSCTTY       _IO('t', 97)            /* become controlling tty */
 #define        TIOCEXT         _IOW('t', 96, int)      /* pty: external processing */
 #define        TIOCSIG         _IO('t', 95)            /* pty: generate signal */
 #define        TIOCSCTTY       _IO('t', 97)            /* become controlling tty */
 #define        TIOCEXT         _IOW('t', 96, int)      /* pty: external processing */
 #define        TIOCSIG         _IO('t', 95)            /* pty: generate signal */
+#define TIOCDRAIN      _IO('t', 94)            /* wait till output drained */
 
 #define TTYDISC                0               /* termios tty line discipline */
 #define        TABLDISC        3               /* tablet discipline */
 #define        SLIPDISC        4               /* serial IP discipline */
 
 
 #define TTYDISC                0               /* termios tty line discipline */
 #define        TABLDISC        3               /* tablet discipline */
 #define        SLIPDISC        4               /* serial IP discipline */
 
-/*
- * Compatability with old terminal driver
- *
- * Source level -> #define USE_OLD_TTY
- * Kernel level -> options COMPAT_43
- */
-#if defined(USE_OLD_TTY) || defined(COMPAT_43)
-#ifdef KERNEL
-#include "ioctl_compat.h"
-#else
-#include <sys/ioctl_compat.h>
-#endif
-#endif
 
 #define        FIOCLEX         _IO('f', 1)             /* set close on exec on fd */
 #define        FIONCLEX        _IO('f', 2)             /* remove close on exec */
 
 #define        FIOCLEX         _IO('f', 1)             /* set close on exec on fd */
 #define        FIONCLEX        _IO('f', 2)             /* remove close on exec */
@@ -202,4 +197,28 @@ struct ttysize {
 #define        SIOCGARP        _IOWR('i',38, struct arpreq)    /* get arp entry */
 #define        SIOCDARP        _IOW('i', 32, struct arpreq)    /* delete arp entry */
 
 #define        SIOCGARP        _IOWR('i',38, struct arpreq)    /* get arp entry */
 #define        SIOCDARP        _IOW('i', 32, struct arpreq)    /* delete arp entry */
 
+#ifndef KERNEL
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int    ioctl __P((int, unsigned long, ...));
+__END_DECLS
+
+#endif /* !KERNEL */
+
+#endif /* !_IOCTL_H_ */
+
+/* - note: keep outside _IOCTL_H_
+ * Compatability with old terminal driver
+ *
+ * Source level -> #define USE_OLD_TTY
+ * Kernel level -> options COMPAT_43
+ */
+#if defined(USE_OLD_TTY) || defined(COMPAT_43)
+#ifdef KERNEL
+#include "ioctl_compat.h"
+#else
+#include <sys/ioctl_compat.h>
+#endif
 #endif
 #endif