Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/osf1 shuffle bits around. separate conversion co...



details:   https://anonhg.NetBSD.org/src/rev/b7462bd1c586
branches:  trunk
changeset: 472520:b7462bd1c586
user:      cgd <cgd%NetBSD.org@localhost>
date:      Sat May 01 02:57:08 1999 +0000

description:
shuffle bits around.  separate conversion conversion functions and tables
from the code that uses them, just as I previously separated out the
OSF/1 definitions and structures from the code that translates to and
from them.

diffstat:

 sys/compat/osf1/files.osf1        |    6 +-
 sys/compat/osf1/osf1.h            |    3 +-
 sys/compat/osf1/osf1_cvt.c        |  518 ++++++++++++++++++++++++++++++++++++++
 sys/compat/osf1/osf1_cvt.h        |   82 ++++++
 sys/compat/osf1/osf1_cvt_errno.c  |    6 +-
 sys/compat/osf1/osf1_cvt_signal.c |  111 ++++++++
 sys/compat/osf1/osf1_errno.h      |    4 +-
 sys/compat/osf1/osf1_exec.c       |    7 +-
 sys/compat/osf1/osf1_misc.c       |  147 +----------
 sys/compat/osf1/osf1_mount.c      |   73 +----
 sys/compat/osf1/osf1_signal.c     |  250 +-----------------
 sys/compat/osf1/osf1_signal.h     |    8 +-
 12 files changed, 747 insertions(+), 468 deletions(-)

diffs (truncated from 1534 to 300 lines):

diff -r 551dd33ae119 -r b7462bd1c586 sys/compat/osf1/files.osf1
--- a/sys/compat/osf1/files.osf1        Sat May 01 02:16:01 1999 +0000
+++ b/sys/compat/osf1/files.osf1        Sat May 01 02:57:08 1999 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.osf1,v 1.5 1999/04/26 18:34:05 cgd Exp $
+#      $NetBSD: files.osf1,v 1.6 1999/05/01 02:57:08 cgd Exp $
 #
 # Config file description for machine-independent OSF/1 compat code.
 # Included by ports that need it.
@@ -8,7 +8,9 @@
 
 # XXX COMPAT_OSF1 requires ECOFF
 
-file   compat/osf1/osf1_errno.c        compat_osf1
+file   compat/osf1/osf1_cvt.c          compat_osf1
+file   compat/osf1/osf1_cvt_errno.c    compat_osf1
+file   compat/osf1/osf1_cvt_signal.c   compat_osf1
 file   compat/osf1/osf1_exec.c         compat_osf1
 file   compat/osf1/osf1_ioctl.c        compat_osf1
 file   compat/osf1/osf1_misc.c         compat_osf1
diff -r 551dd33ae119 -r b7462bd1c586 sys/compat/osf1/osf1.h
--- a/sys/compat/osf1/osf1.h    Sat May 01 02:16:01 1999 +0000
+++ b/sys/compat/osf1/osf1.h    Sat May 01 02:57:08 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: osf1.h,v 1.13 1999/04/30 04:31:45 cgd Exp $ */
+/* $NetBSD: osf1.h,v 1.14 1999/05/01 02:57:08 cgd Exp $ */
 
 /*
  * Copyright (c) 1999 Christopher G. Demetriou.  All rights reserved.
@@ -43,6 +43,7 @@
 
 #include <sys/types.h>
 #include <compat/osf1/osf1_errno.h>
+#include <compat/osf1/osf1_signal.h>
 
 /*
  * type and structure definitions used by other structures
diff -r 551dd33ae119 -r b7462bd1c586 sys/compat/osf1/osf1_cvt.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/compat/osf1/osf1_cvt.c        Sat May 01 02:57:08 1999 +0000
@@ -0,0 +1,518 @@
+/* $NetBSD: osf1_cvt.c,v 1.1 1999/05/01 02:57:09 cgd Exp $ */
+
+/*
+ * Copyright (c) 1999 Christopher G. Demetriou.  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 Christopher G. Demetriou
+ *     for the NetBSD Project.
+ * 4. 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.
+ */
+
+/*
+ * Copyright (c) 1994, 1995 Carnegie-Mellon University.
+ * All rights reserved.
+ *
+ * Author: Chris G. Demetriou
+ * 
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
+ *
+ *  Software Distribution Coordinator  or  Software.Distribution%CS.CMU.EDU@localhost
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/namei.h>
+#include <sys/proc.h>
+#include <sys/file.h>
+#include <sys/stat.h>
+#include <sys/filedesc.h>
+#include <sys/kernel.h>
+#include <sys/malloc.h>
+#include <sys/mman.h>
+#include <sys/mount.h>
+#include <sys/signal.h>
+#include <sys/signalvar.h>
+#include <sys/reboot.h>
+#include <sys/syscallargs.h>
+#include <sys/exec.h>
+#include <sys/vnode.h>
+#include <sys/socketvar.h>
+#include <sys/resource.h>
+#include <sys/resourcevar.h>
+#include <sys/wait.h>
+#include <vm/vm.h>                             /* XXX UVM headers are Cool */
+#include <uvm/uvm.h>                           /* XXX see mmap emulation */
+
+#include <nfs/rpcv2.h>
+#include <nfs/nfsproto.h>
+#include <nfs/nfs.h>
+#include <nfs/nfsmount.h>
+
+#include <compat/osf1/osf1.h>
+#include <compat/osf1/osf1_util.h>
+#include <compat/osf1/osf1_cvt.h>
+
+const struct emul_flags_xtab osf1_open_flags_xtab[] = {
+    {  OSF1_O_ACCMODE,         OSF1_O_RDONLY,          O_RDONLY        },
+    {  OSF1_O_ACCMODE,         OSF1_O_WRONLY,          O_WRONLY        },
+    {  OSF1_O_ACCMODE,         OSF1_O_RDWR,            O_RDWR          },
+    {  OSF1_O_NONBLOCK,        OSF1_O_NONBLOCK,        O_NONBLOCK      },
+    {  OSF1_O_APPEND,          OSF1_O_APPEND,          O_APPEND        },
+#if 0 /* no equivalent +++ */
+    {  OSF1_O_DEFER,           OSF1_O_DEFER,           ???             },
+#endif
+    {  OSF1_O_CREAT,           OSF1_O_CREAT,           O_CREAT         },
+    {  OSF1_O_TRUNC,           OSF1_O_TRUNC,           O_TRUNC         },
+    {  OSF1_O_EXCL,            OSF1_O_EXCL,            O_EXCL          },
+    {  OSF1_O_NOCTTY,          OSF1_O_NOCTTY,          O_NOCTTY        },
+    {  OSF1_O_SYNC,            OSF1_O_SYNC,            O_SYNC          },
+    {  OSF1_O_NDELAY,          OSF1_O_NDELAY,          O_NDELAY        },
+#if 0 /* no equivalent, also same value as O_NDELAY! */
+    {  OSF1_O_DRD,             OSF1_O_DRD,             ???             },
+#endif
+    {  OSF1_O_DSYNC,           OSF1_O_DSYNC,           O_DSYNC         },
+    {  OSF1_O_RSYNC,           OSF1_O_RSYNC,           O_RSYNC         },
+    {  0                                                               }
+};
+
+const struct emul_flags_xtab osf1_open_flags_rxtab[] = {
+    {  O_ACCMODE,              O_RDONLY,               OSF1_O_RDONLY   },
+    {  O_ACCMODE,              O_WRONLY,               OSF1_O_WRONLY   },
+    {  O_ACCMODE,              O_RDWR,                 OSF1_O_RDWR     },
+    {  O_NONBLOCK,             O_NONBLOCK,             OSF1_O_NONBLOCK },
+    {  O_APPEND,               O_APPEND,               OSF1_O_APPEND   },
+#if 0 /* no equivalent +++ */
+    {  ???,                    ???,                    O_DEFER         },
+#endif
+    {  O_CREAT,                O_CREAT,                OSF1_O_CREAT    },
+    {  O_TRUNC,                O_TRUNC,                OSF1_O_TRUNC    },
+    {  O_EXCL,                 O_EXCL,                 OSF1_O_EXCL     },
+    {  O_NOCTTY,               O_NOCTTY,               OSF1_O_NOCTTY   },
+    {  O_SYNC,                 O_SYNC,                 OSF1_O_SYNC     },
+    {  O_NDELAY,               O_NDELAY,               OSF1_O_NDELAY   },
+#if 0 /* no equivalent, also same value as O_NDELAY! */
+    {  ???,                    ???,                    O_DRD           },
+#endif
+    {  O_DSYNC,                O_DSYNC,                OSF1_O_DSYNC    },
+    {  O_RSYNC,                O_RSYNC,                OSF1_O_RSYNC    },
+    {  0                                                               }
+};
+
+const struct emul_flags_xtab osf1_mmap_prot_xtab[] = {
+#if 0 /* pseudo-flag */
+    {  OSF1_PROT_NONE,         OSF1_PROT_NONE,         PROT_NONE       },
+#endif
+    {  OSF1_PROT_READ,         OSF1_PROT_READ,         PROT_READ       },
+    {  OSF1_PROT_WRITE,        OSF1_PROT_WRITE,        PROT_READ|PROT_WRITE },
+    {  OSF1_PROT_EXEC,         OSF1_PROT_EXEC,         PROT_READ|PROT_EXEC },
+    {  0                                                               }
+};
+
+const struct emul_flags_xtab osf1_mmap_flags_xtab[] = {
+    {  OSF1_MAP_SHARED,        OSF1_MAP_SHARED,        MAP_SHARED      },
+    {  OSF1_MAP_PRIVATE,       OSF1_MAP_PRIVATE,       MAP_PRIVATE     },
+    {  OSF1_MAP_TYPE,          OSF1_MAP_FILE,          MAP_FILE        },
+    {  OSF1_MAP_TYPE,          OSF1_MAP_ANON,          MAP_ANON        },
+    {  OSF1_MAP_FIXED,         OSF1_MAP_FIXED,         MAP_FIXED       },
+#if 0 /* pseudo-flag, and the default */
+    {  OSF1_MAP_VARIABLE,      OSF1_MAP_VARIABLE,      0               },
+#endif
+    {  OSF1_MAP_HASSEMAPHORE,  OSF1_MAP_HASSEMAPHORE,  MAP_HASSEMAPHORE },
+    {  OSF1_MAP_INHERIT,       OSF1_MAP_INHERIT,       MAP_INHERIT     },
+#if 0 /* no equivalent +++ */
+    {  OSF1_MAP_UNALIGNED,     OSF1_MAP_UNALIGNED,     ???             },
+#endif
+    {  0                                                               }
+};
+
+#define        bsd2osf_dev(dev)        osf1_makedev(major(dev), minor(dev))
+#define        osf2bsd_dev(dev)        makedev(osf1_major(dev), osf1_minor(dev))
+
+/*
+ * Convert from a stat structure to an osf1 stat structure.
+ */
+void
+osf1_cvt_stat_from_native(st, ost)
+       const struct stat *st;
+       struct osf1_stat *ost;
+{
+
+       ost->st_dev = bsd2osf_dev(st->st_dev);
+       ost->st_ino = st->st_ino;
+       ost->st_mode = st->st_mode;
+       ost->st_nlink = st->st_nlink;
+       ost->st_uid = st->st_uid == -2 ? (u_int16_t) -2 : st->st_uid;
+       ost->st_gid = st->st_gid == -2 ? (u_int16_t) -2 : st->st_gid;
+       ost->st_rdev = bsd2osf_dev(st->st_rdev);
+       ost->st_size = st->st_size;
+       ost->st_atime_sec = st->st_atime;
+       ost->st_spare1 = 0;
+       ost->st_mtime_sec = st->st_mtime;
+       ost->st_spare2 = 0;
+       ost->st_ctime_sec = st->st_ctime;
+       ost->st_spare3 = 0;
+       ost->st_blksize = st->st_blksize;
+       ost->st_blocks = st->st_blocks;
+       ost->st_flags = st->st_flags;
+       ost->st_gen = st->st_gen;
+}
+
+const struct emul_flags_xtab osf1_fcntl_getsetfd_flags_xtab[] = {
+    {  OSF1_FD_CLOEXEC,        OSF1_FD_CLOEXEC,        FD_CLOEXEC      },
+    {  0                                                               }
+};
+
+const struct emul_flags_xtab osf1_fcntl_getsetfd_flags_rxtab[] = {
+    {  FD_CLOEXEC,             FD_CLOEXEC,             OSF1_FD_CLOEXEC },
+    {  0                                                               }
+};
+
+/* flags specific to GETFL/SETFL; also uses open xtab */
+const struct emul_flags_xtab osf1_fcntl_getsetfl_flags_xtab[] = {
+    {  OSF1_FASYNC,            OSF1_FASYNC,            FASYNC          },
+    {  0                                                               }
+};
+
+/* flags specific to GETFL/SETFL; also uses open rxtab */
+const struct emul_flags_xtab osf1_fcntl_getsetfl_flags_rxtab[] = {
+    {  FASYNC,                 FASYNC,                 OSF1_FASYNC     },
+    {  0                                                               }
+};
+
+const struct emul_flags_xtab osf1_sendrecv_msg_flags_xtab[] = {
+    {  OSF1_MSG_OOB,           OSF1_MSG_OOB,           MSG_OOB         },
+    {  OSF1_MSG_PEEK,          OSF1_MSG_PEEK,          MSG_PEEK        },
+    {  OSF1_MSG_DONTROUTE,     OSF1_MSG_DONTROUTE,     MSG_DONTROUTE   },
+    {  OSF1_MSG_EOR,           OSF1_MSG_EOR,           MSG_EOR         },
+    {  OSF1_MSG_TRUNC,         OSF1_MSG_TRUNC,         MSG_TRUNC       },
+    {  OSF1_MSG_CTRUNC,        OSF1_MSG_CTRUNC,        MSG_CTRUNC      },
+    {  OSF1_MSG_WAITALL,       OSF1_MSG_WAITALL,       MSG_WAITALL     },
+    {  0                                                               }
+};
+
+const struct emul_flags_xtab osf1_reboot_opt_xtab[] = {
+#if 0 /* pseudo-flag */
+    {  OSF1_RB_AUTOBOOT,       OSF1_RB_AUTOBOOT,       RB_AUTOBOOT     },
+#endif
+    {  OSF1_RB_ASKNAME,        OSF1_RB_ASKNAME,        RB_ASKNAME      },
+    {  OSF1_RB_SINGLE,         OSF1_RB_SINGLE,         RB_SINGLE       },
+    {  OSF1_RB_NOSYNC,         OSF1_RB_NOSYNC,         RB_NOSYNC       },
+#if 0 /* same value as O_NDELAY, only used at boot time? */
+    {  OSF1_RB_KDB,            OSF1_RB_KDB,            RB_KDB          },
+#endif
+    {  OSF1_RB_HALT,           OSF1_RB_HALT,           RB_HALT         },
+    {  OSF1_RB_INITNAME,       OSF1_RB_INITNAME,       RB_INITNAME     },
+    {  OSF1_RB_DFLTROOT,       OSF1_RB_DFLTROOT,       RB_DFLTROOT     },
+#if 0 /* no equivalents +++ */
+    {  OSF1_RB_ALTBOOT,        OSF1_RB_ALTBOOT,        ???             },
+    {  OSF1_RB_UNIPROC,        OSF1_RB_UNIPROC,        ???             },
+    {  OSF1_RB_PARAM,          OSF1_RB_PARAM,          ???             },
+#endif
+    {  OSF1_RB_DUMP,           OSF1_RB_DUMP,           RB_DUMP         },
+    {  0                                                               }
+};
+
+/*
+ * Convert from as rusage structure to an osf1 rusage structure.
+ */
+void
+osf1_cvt_rusage_from_native(ru, oru)
+       const struct rusage *ru;
+       struct osf1_rusage *oru;



Home | Main Index | Thread Index | Old Index