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 (alphabetize)



details:   https://anonhg.NetBSD.org/src/rev/b2a61a709b03
branches:  trunk
changeset: 472696:b2a61a709b03
user:      cgd <cgd%NetBSD.org@localhost>
date:      Wed May 05 00:48:30 1999 +0000

description:
shuffle (alphabetize)

diffstat:

 sys/compat/osf1/osf1_cvt.c |  667 ++++++++++++++++++++++----------------------
 1 files changed, 333 insertions(+), 334 deletions(-)

diffs (truncated from 727 to 300 lines):

diff -r d888eb46333e -r b2a61a709b03 sys/compat/osf1/osf1_cvt.c
--- a/sys/compat/osf1/osf1_cvt.c        Wed May 05 00:03:10 1999 +0000
+++ b/sys/compat/osf1/osf1_cvt.c        Wed May 05 00:48:30 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: osf1_cvt.c,v 1.3 1999/05/04 02:12:15 cgd Exp $ */
+/* $NetBSD: osf1_cvt.c,v 1.4 1999/05/05 00:48:30 cgd Exp $ */
 
 /*
  * Copyright (c) 1999 Christopher G. Demetriou.  All rights reserved.
@@ -90,59 +90,41 @@
 #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,           ???             },
+/* XXX these don't belong here */
+#define osf1_sigmask(n)                (1UL << ((n) - 1))
+#define osf1_sigemptyset(s)    memset((s), 0, sizeof(*(s)))
+#define osf1_sigismember(s, n) (*(s) & osf1_sigmask(n))
+#define osf1_sigaddset(s, n)   (*(s) |= osf1_sigmask(n))
+
+const struct emul_flags_xtab osf1_access_flags_xtab[] = {
+#if 0 /* pseudo-flag */
+    {  OSF1_F_OK,              OSF1_F_OK,              F_OK            },
 #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         },
+    {  OSF1_X_OK,              OSF1_X_OK,              X_OK            },
+    {  OSF1_W_OK,              OSF1_W_OK,              W_OK            },
+    {  OSF1_R_OK,              OSF1_R_OK,              R_OK            },
     {  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    },
+const struct emul_flags_xtab osf1_fcntl_getsetfd_flags_rxtab[] = {
+    {  FD_CLOEXEC,             FD_CLOEXEC,             OSF1_FD_CLOEXEC },
+    {  0                                                               }
+};
+
+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_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 },
+/* flags specific to GETFL/SETFL; also uses open rxtab */
+const struct emul_flags_xtab osf1_fcntl_getsetfl_flags_rxtab[] = {
+    {  FASYNC,                 FASYNC,                 OSF1_FASYNC     },
+    {  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                                                               }
 };
 
@@ -163,171 +145,16 @@
     {  0                                                               }
 };
 
-/*
- * 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 = osf1_cvt_dev_from_native(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 = osf1_cvt_dev_from_native(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     },
+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_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;
-{
-
-       oru->ru_utime.tv_sec = ru->ru_utime.tv_sec;
-       oru->ru_utime.tv_usec = ru->ru_utime.tv_usec;
-
-       oru->ru_stime.tv_sec = ru->ru_stime.tv_sec;
-       oru->ru_stime.tv_usec = ru->ru_stime.tv_usec;
-
-       oru->ru_maxrss = ru->ru_maxrss;
-       oru->ru_ixrss = ru->ru_ixrss;
-       oru->ru_idrss = ru->ru_idrss;
-       oru->ru_isrss = ru->ru_isrss;
-       oru->ru_minflt = ru->ru_minflt;
-       oru->ru_majflt = ru->ru_majflt;
-       oru->ru_nswap = ru->ru_nswap;
-       oru->ru_inblock = ru->ru_inblock;
-       oru->ru_oublock = ru->ru_oublock;
-       oru->ru_msgsnd = ru->ru_msgsnd;
-       oru->ru_msgrcv = ru->ru_msgrcv;
-       oru->ru_nsignals = ru->ru_nsignals;
-       oru->ru_nvcsw = ru->ru_nvcsw;
-       oru->ru_nivcsw = ru->ru_nivcsw;
-}
-
-const struct emul_flags_xtab osf1_access_flags_xtab[] = {
-#if 0 /* pseudo-flag */
-    {  OSF1_F_OK,              OSF1_F_OK,              F_OK            },
-#endif
-    {  OSF1_X_OK,              OSF1_X_OK,              X_OK            },
-    {  OSF1_W_OK,              OSF1_W_OK,              W_OK            },
-    {  OSF1_R_OK,              OSF1_R_OK,              R_OK            },
-    {  0                                                               }
-};
-
-const struct emul_flags_xtab osf1_wait_options_xtab[] = {
-    {  OSF1_WNOHANG,           OSF1_WNOHANG,           WNOHANG         },
-    {  OSF1_WUNTRACED,         OSF1_WUNTRACED,         WUNTRACED       },
-    {  0                                                               }
-};
-
-void
-osf1_cvt_statfs_from_native(bsfs, osfs)
-       const struct statfs *bsfs;
-       struct osf1_statfs *osfs;
-{
-
-       memset(osfs, 0, sizeof (struct osf1_statfs));
-       if (!strncmp(MOUNT_FFS, bsfs->f_fstypename, MFSNAMELEN))
-               osfs->f_type = OSF1_MOUNT_UFS;
-       else if (!strncmp(MOUNT_NFS, bsfs->f_fstypename, MFSNAMELEN))
-               osfs->f_type = OSF1_MOUNT_NFS;
-       else if (!strncmp(MOUNT_MFS, bsfs->f_fstypename, MFSNAMELEN))
-               osfs->f_type = OSF1_MOUNT_MFS;
-       else
-               /* uh oh...  XXX = PC, CDFS, PROCFS, etc. */
-               osfs->f_type = OSF1_MOUNT_ADDON;
-       osfs->f_flags = bsfs->f_flags;          /* XXX translate */
-       osfs->f_fsize = bsfs->f_bsize;
-       osfs->f_bsize = bsfs->f_iosize;
-       osfs->f_blocks = bsfs->f_blocks;
-       osfs->f_bfree = bsfs->f_bfree;
-       osfs->f_bavail = bsfs->f_bavail;
-       osfs->f_files = bsfs->f_files;
-       osfs->f_ffree = bsfs->f_ffree;
-       memcpy(&osfs->f_fsid, &bsfs->f_fsid,
-           max(sizeof bsfs->f_fsid, sizeof osfs->f_fsid));
-       /* osfs->f_spare zeroed above */
-       memcpy(osfs->f_mntonname, bsfs->f_mntonname,
-           max(sizeof bsfs->f_mntonname, sizeof osfs->f_mntonname));
-       memcpy(osfs->f_mntfromname, bsfs->f_mntfromname,
-           max(sizeof bsfs->f_mntfromname, sizeof osfs->f_mntfromname));
-       /* XXX osfs->f_xxx should be filled in... */
-}
-
 const struct emul_flags_xtab osf1_nfs_mount_flags_xtab[] = {
     {  OSF1_NFSMNT_SOFT,       OSF1_NFSMNT_SOFT,       NFSMNT_SOFT,    },
     {  OSF1_NFSMNT_WSIZE,      OSF1_NFSMNT_WSIZE,      NFSMNT_WSIZE,   },
@@ -355,59 +182,83 @@
     {  0                                                               }
 };
 
-
-#define osf1_sigmask(n)                (1UL << ((n) - 1))
-#define osf1_sigemptyset(s)    memset((s), 0, sizeof(*(s)))
-#define osf1_sigismember(s, n) (*(s) & osf1_sigmask(n))
-#define osf1_sigaddset(s, n)   (*(s) |= osf1_sigmask(n))
-
-int
-osf1_cvt_sigset_to_native(oss, bss)
-       const osf1_sigset_t *oss;
-       sigset_t *bss;
-{
-       int i, newsig;
-
-       sigemptyset(bss);
-       for (i = 1; i < OSF1_NSIG; i++) {
-               if (osf1_sigismember(oss, i)) {
-                       newsig = osf1_signal_xlist[i];
-                       if (newsig)
-                               sigaddset(bss, newsig);
-               }



Home | Main Index | Thread Index | Old Index