Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat/sunos32 we don't #include ../sunos/sunos_ioctl.c ...



details:   https://anonhg.NetBSD.org/src/rev/93ed494ee0fa
branches:  trunk
changeset: 503275:93ed494ee0fa
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sun Feb 04 15:38:17 2001 +0000

description:
we don't #include ../sunos/sunos_ioctl.c anymore...sigh

diffstat:

 sys/compat/sunos32/sunos32_ioctl.c |  1077 +++++++++++++++++++++++++++++++++++-
 1 files changed, 1072 insertions(+), 5 deletions(-)

diffs (truncated from 1089 to 300 lines):

diff -r cae988f2f80b -r 93ed494ee0fa sys/compat/sunos32/sunos32_ioctl.c
--- a/sys/compat/sunos32/sunos32_ioctl.c        Sun Feb 04 14:42:31 2001 +0000
+++ b/sys/compat/sunos32/sunos32_ioctl.c        Sun Feb 04 15:38:17 2001 +0000
@@ -1,4 +1,5 @@
-/*     $NetBSD: sunos32_ioctl.c,v 1.1 2001/02/02 07:28:54 mrg Exp $    */
+/*     $NetBSD: sunos32_ioctl.c,v 1.2 2001/02/04 15:38:17 mrg Exp $    */
+/* from: NetBSD: sunos_ioctl.c,v 1.35 2001/02/03 22:20:02 mrg Exp      */
 
 /*
  * Copyright (c) 2001 Matthew R. Green
@@ -28,8 +29,1074 @@
  * SUCH DAMAGE.
  */
 
-#define sunos_sys_ioctl sunos32_sys_ioctl
-#define sunos_sys_fcntl sunos32_sys_fcntl
-#define sys_ioctl netbsd32_ioctl
+/*
+ * Copyright (c) 1993 Markus Wild.
+ * 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. The name of the author may not be used to endorse or promote products
+ *    derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ *
+ * loosely from: Header: sunos_ioctl.c,v 1.7 93/05/28 04:40:43 torek Exp
+ */
+
+#if defined(_KERNEL) && !defined(_LKM)
+#include "opt_compat_netbsd32.h"
+#include "opt_execfmt.h"
+#endif
+
+#include <sys/param.h>
+#include <sys/proc.h>
+#include <sys/systm.h>
+#include <sys/file.h>
+#include <sys/filedesc.h>
+#include <sys/ioctl.h>
+#include <sys/termios.h>
+#include <sys/tty.h>
+#include <sys/socket.h>
+#include <sys/audioio.h>
+#include <sys/vnode.h>
+#include <sys/mount.h>
+#include <sys/disklabel.h>
+#include <sys/syscallargs.h>
+
+#include <miscfs/specfs/specdev.h>
+
+#include <net/if.h>
+
+#include <dev/sun/disklabel.h>
+
+#include <compat/sunos/sunos.h>
+#include <compat/sunos/sunos_syscallargs.h>
+#include <compat/netbsd32/netbsd32.h>
+#include <compat/netbsd32/netbsd32_syscallargs.h>
+#include <compat/sunos32/sunos32.h>
+#include <compat/sunos32/sunos32_syscallargs.h>
+#include <compat/common/compat_util.h>
+
+/*
+ * SunOS ioctl calls.
+ * This file is something of a hodge-podge.
+ * Support gets added as things turn up....
+ */
+
+static struct speedtab sptab[] = {
+       { 0, 0 },
+       { 50, 1 },
+       { 75, 2 },
+       { 110, 3 },
+       { 134, 4 },
+       { 135, 4 },
+       { 150, 5 },
+       { 200, 6 },
+       { 300, 7 },
+       { 600, 8 },
+       { 1200, 9 },
+       { 1800, 10 },
+       { 2400, 11 },
+       { 4800, 12 },
+       { 9600, 13 },
+       { 19200, 14 },
+       { 38400, 15 },
+       { -1, -1 }
+};
+
+static u_long s2btab[] = {
+       0,
+       50,
+       75,
+       110,
+       134,
+       150,
+       200,
+       300,
+       600,
+       1200,
+       1800,
+       2400,
+       4800,
+       9600,
+       19200,
+       38400,
+};
+
+static void stios2btios __P((struct sunos_termios *, struct termios *));
+static void btios2stios __P((struct termios *, struct sunos_termios *));
+static void stios2stio __P((struct sunos_termios *, struct sunos_termio *));
+static void stio2stios __P((struct sunos_termio *, struct sunos_termios *));
+
+/*
+ * These two conversion functions have mostly been done
+ * with some perl cut&paste, then hand-edited to comment
+ * out what doesn't exist under NetBSD.
+ * A note from Markus's code:
+ *     (l & BITMASK1) / BITMASK1 * BITMASK2  is translated
+ *     optimally by gcc m68k, much better than any ?: stuff.
+ *     Code may vary with different architectures of course.
+ *
+ * I don't know what optimizer you used, but seeing divu's and
+ * bfextu's in the m68k assembly output did not encourage me...
+ * as well, gcc on the sparc definitely generates much better
+ * code with `?:'.
+ */
+
+static void
+stios2btios(st, bt)
+       struct sunos_termios *st;
+       struct termios *bt;
+{
+       u_long l, r;
+
+       l = st->c_iflag;
+       r =     ((l & 0x00000001) ? IGNBRK      : 0);
+       r |=    ((l & 0x00000002) ? BRKINT      : 0);
+       r |=    ((l & 0x00000004) ? IGNPAR      : 0);
+       r |=    ((l & 0x00000008) ? PARMRK      : 0);
+       r |=    ((l & 0x00000010) ? INPCK       : 0);
+       r |=    ((l & 0x00000020) ? ISTRIP      : 0);
+       r |=    ((l & 0x00000040) ? INLCR       : 0);
+       r |=    ((l & 0x00000080) ? IGNCR       : 0);
+       r |=    ((l & 0x00000100) ? ICRNL       : 0);
+       /*      ((l & 0x00000200) ? IUCLC       : 0) */
+       r |=    ((l & 0x00000400) ? IXON        : 0);
+       r |=    ((l & 0x00000800) ? IXANY       : 0);
+       r |=    ((l & 0x00001000) ? IXOFF       : 0);
+       r |=    ((l & 0x00002000) ? IMAXBEL     : 0);
+       bt->c_iflag = r;
+
+       l = st->c_oflag;
+       r =     ((l & 0x00000001) ? OPOST       : 0);
+       /*      ((l & 0x00000002) ? OLCUC       : 0) */
+       r |=    ((l & 0x00000004) ? ONLCR       : 0);
+       /*      ((l & 0x00000008) ? OCRNL       : 0) */
+       /*      ((l & 0x00000010) ? ONOCR       : 0) */
+       /*      ((l & 0x00000020) ? ONLRET      : 0) */
+       /*      ((l & 0x00000040) ? OFILL       : 0) */
+       /*      ((l & 0x00000080) ? OFDEL       : 0) */
+       /*      ((l & 0x00000100) ? NLDLY       : 0) */
+       /*      ((l & 0x00000100) ? NL1         : 0) */
+       /*      ((l & 0x00000600) ? CRDLY       : 0) */
+       /*      ((l & 0x00000200) ? CR1         : 0) */
+       /*      ((l & 0x00000400) ? CR2         : 0) */
+       /*      ((l & 0x00000600) ? CR3         : 0) */
+       /*      ((l & 0x00001800) ? TABDLY      : 0) */
+       /*      ((l & 0x00000800) ? TAB1        : 0) */
+       /*      ((l & 0x00001000) ? TAB2        : 0) */
+       r |=    ((l & 0x00001800) ? OXTABS      : 0);
+       /*      ((l & 0x00002000) ? BSDLY       : 0) */
+       /*      ((l & 0x00002000) ? BS1         : 0) */
+       /*      ((l & 0x00004000) ? VTDLY       : 0) */
+       /*      ((l & 0x00004000) ? VT1         : 0) */
+       /*      ((l & 0x00008000) ? FFDLY       : 0) */
+       /*      ((l & 0x00008000) ? FF1         : 0) */
+       /*      ((l & 0x00010000) ? PAGEOUT     : 0) */
+       /*      ((l & 0x00020000) ? WRAP        : 0) */
+       bt->c_oflag = r;
+
+       l = st->c_cflag;
+       switch (l & 0x00000030) {
+       case 0:
+               r = CS5;
+               break;
+       case 0x00000010:
+               r = CS6;
+               break;
+       case 0x00000020:
+               r = CS7;
+               break;
+       case 0x00000030:
+               r = CS8;
+               break;
+       }
+       r |=    ((l & 0x00000040) ? CSTOPB      : 0);
+       r |=    ((l & 0x00000080) ? CREAD       : 0);
+       r |=    ((l & 0x00000100) ? PARENB      : 0);
+       r |=    ((l & 0x00000200) ? PARODD      : 0);
+       r |=    ((l & 0x00000400) ? HUPCL       : 0);
+       r |=    ((l & 0x00000800) ? CLOCAL      : 0);
+       /*      ((l & 0x00001000) ? LOBLK       : 0) */
+       r |=    ((l & 0x80000000) ? (CRTS_IFLOW|CCTS_OFLOW) : 0);
+       bt->c_cflag = r;
+
+       bt->c_ispeed = bt->c_ospeed = s2btab[l & 0x0000000f];
+
+       l = st->c_lflag;
+       r =     ((l & 0x00000001) ? ISIG        : 0);
+       r |=    ((l & 0x00000002) ? ICANON      : 0);
+       /*      ((l & 0x00000004) ? XCASE       : 0) */
+       r |=    ((l & 0x00000008) ? ECHO        : 0);
+       r |=    ((l & 0x00000010) ? ECHOE       : 0);
+       r |=    ((l & 0x00000020) ? ECHOK       : 0);
+       r |=    ((l & 0x00000040) ? ECHONL      : 0);
+       r |=    ((l & 0x00000080) ? NOFLSH      : 0);
+       r |=    ((l & 0x00000100) ? TOSTOP      : 0);
+       r |=    ((l & 0x00000200) ? ECHOCTL     : 0);
+       r |=    ((l & 0x00000400) ? ECHOPRT     : 0);
+       r |=    ((l & 0x00000800) ? ECHOKE      : 0);
+       /*      ((l & 0x00001000) ? DEFECHO     : 0) */
+       r |=    ((l & 0x00002000) ? FLUSHO      : 0);
+       r |=    ((l & 0x00004000) ? PENDIN      : 0);
+       bt->c_lflag = r;
+
+       bt->c_cc[VINTR]    = st->c_cc[0]  ? st->c_cc[0]  : _POSIX_VDISABLE;
+       bt->c_cc[VQUIT]    = st->c_cc[1]  ? st->c_cc[1]  : _POSIX_VDISABLE;
+       bt->c_cc[VERASE]   = st->c_cc[2]  ? st->c_cc[2]  : _POSIX_VDISABLE;
+       bt->c_cc[VKILL]    = st->c_cc[3]  ? st->c_cc[3]  : _POSIX_VDISABLE;
+       bt->c_cc[VEOF]     = st->c_cc[4]  ? st->c_cc[4]  : _POSIX_VDISABLE;
+       bt->c_cc[VEOL]     = st->c_cc[5]  ? st->c_cc[5]  : _POSIX_VDISABLE;
+       bt->c_cc[VEOL2]    = st->c_cc[6]  ? st->c_cc[6]  : _POSIX_VDISABLE;
+    /* bt->c_cc[VSWTCH]   = st->c_cc[7]  ? st->c_cc[7]  : _POSIX_VDISABLE; */
+       bt->c_cc[VSTART]   = st->c_cc[8]  ? st->c_cc[8]  : _POSIX_VDISABLE;
+       bt->c_cc[VSTOP]    = st->c_cc[9]  ? st->c_cc[9]  : _POSIX_VDISABLE;
+       bt->c_cc[VSUSP]    = st->c_cc[10] ? st->c_cc[10] : _POSIX_VDISABLE;
+       bt->c_cc[VDSUSP]   = st->c_cc[11] ? st->c_cc[11] : _POSIX_VDISABLE;
+       bt->c_cc[VREPRINT] = st->c_cc[12] ? st->c_cc[12] : _POSIX_VDISABLE;
+       bt->c_cc[VDISCARD] = st->c_cc[13] ? st->c_cc[13] : _POSIX_VDISABLE;
+       bt->c_cc[VWERASE]  = st->c_cc[14] ? st->c_cc[14] : _POSIX_VDISABLE;
+       bt->c_cc[VLNEXT]   = st->c_cc[15] ? st->c_cc[15] : _POSIX_VDISABLE;
+       bt->c_cc[VSTATUS]  = st->c_cc[16] ? st->c_cc[16] : _POSIX_VDISABLE;
+
+       /* if `raw mode', create native VMIN/VTIME from SunOS VEOF/VEOL */
+       bt->c_cc[VMIN]     = (bt->c_lflag & ICANON) ? 1 : bt->c_cc[VEOF];
+       bt->c_cc[VTIME]    = (bt->c_lflag & ICANON) ? 1 : bt->c_cc[VEOL];
+}
+
+
+static void
+btios2stios(bt, st)
+       struct termios *bt;
+       struct sunos_termios *st;
+{
+       u_long l, r;
+       int s;
+
+       l = bt->c_iflag;
+       r =     ((l &  IGNBRK) ? 0x00000001     : 0);
+       r |=    ((l &  BRKINT) ? 0x00000002     : 0);
+       r |=    ((l &  IGNPAR) ? 0x00000004     : 0);
+       r |=    ((l &  PARMRK) ? 0x00000008     : 0);
+       r |=    ((l &   INPCK) ? 0x00000010     : 0);
+       r |=    ((l &  ISTRIP) ? 0x00000020     : 0);
+       r |=    ((l &   INLCR) ? 0x00000040     : 0);
+       r |=    ((l &   IGNCR) ? 0x00000080     : 0);
+       r |=    ((l &   ICRNL) ? 0x00000100     : 0);
+       /*      ((l &   IUCLC) ? 0x00000200     : 0) */
+       r |=    ((l &    IXON) ? 0x00000400     : 0);
+       r |=    ((l &   IXANY) ? 0x00000800     : 0);
+       r |=    ((l &   IXOFF) ? 0x00001000     : 0);
+       r |=    ((l & IMAXBEL) ? 0x00002000     : 0);
+       st->c_iflag = r;
+
+       l = bt->c_oflag;
+       r =     ((l &   OPOST) ? 0x00000001     : 0);
+       /*      ((l &   OLCUC) ? 0x00000002     : 0) */
+       r |=    ((l &   ONLCR) ? 0x00000004     : 0);
+       /*      ((l &   OCRNL) ? 0x00000008     : 0) */
+       /*      ((l &   ONOCR) ? 0x00000010     : 0) */
+       /*      ((l &  ONLRET) ? 0x00000020     : 0) */
+       /*      ((l &   OFILL) ? 0x00000040     : 0) */
+       /*      ((l &   OFDEL) ? 0x00000080     : 0) */
+       /*      ((l &   NLDLY) ? 0x00000100     : 0) */



Home | Main Index | Thread Index | Old Index