Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/netbsd32 emulate kern.boottime. now 32-bit w(1) ...



details:   https://anonhg.NetBSD.org/src/rev/583808221c37
branches:  trunk
changeset: 503258:583808221c37
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sun Feb 04 07:08:51 2001 +0000

description:
emulate kern.boottime.  now 32-bit w(1) works properly.

diffstat:

 sys/compat/netbsd32/netbsd32_netbsd.c |  62 +++++++++++++++++++++++++++++++++-
 1 files changed, 60 insertions(+), 2 deletions(-)

diffs (90 lines):

diff -r 162d8b2488c7 -r 583808221c37 sys/compat/netbsd32/netbsd32_netbsd.c
--- a/sys/compat/netbsd32/netbsd32_netbsd.c     Sun Feb 04 06:35:07 2001 +0000
+++ b/sys/compat/netbsd32/netbsd32_netbsd.c     Sun Feb 04 07:08:51 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_netbsd.c,v 1.52 2001/02/04 06:35:08 mrg Exp $ */
+/*     $NetBSD: netbsd32_netbsd.c,v 1.53 2001/02/04 07:08:51 mrg Exp $ */
 
 /*
  * Copyright (c) 1998 Matthew R. Green
@@ -4270,6 +4270,7 @@
 }
 
 int uvm_sysctl32(int *, u_int, void *, size_t *, void *, size_t, struct proc *);
+int kern_sysctl32(int *, u_int, void *, size_t *, void *, size_t, struct proc *);
 
 /*
  * uvm_sysctl32: sysctl hook into UVM system, handling special 32-bit
@@ -4303,6 +4304,51 @@
        /* NOTREACHED */
 }
 
+/*
+ * kern_sysctl32: sysctl hook into KERN system, handling special 32-bit
+ * sensitive calls.
+ */
+int
+kern_sysctl32(name, namelen, oldp, oldlenp, newp, newlen, p)
+       int *name;
+       u_int namelen;
+       void *oldp;
+       size_t *oldlenp;
+       void *newp;
+       size_t newlen;
+       struct proc *p;
+{
+       struct netbsd32_timeval bt32;
+
+       /* All sysctl names at this level, except for a few, are terminal. */
+       switch (name[0]) {
+#if 0
+       case KERN_PROC:
+       case KERN_PROC2:
+       case KERN_PROF:
+       case KERN_MBUF:
+       case KERN_PROC_ARGS:
+       case KERN_SYSVIPC_INFO:
+               /* Not terminal. */
+               break;
+#endif
+       default:
+               if (namelen != 1)
+                       return (ENOTDIR);       /* overloaded */
+       }
+
+       switch (name[0]) {
+       case KERN_BOOTTIME:
+               netbsd32_from_timeval(&boottime, &bt32);
+               return (sysctl_rdstruct(oldp, oldlenp, newp, &bt32,
+                   sizeof(struct netbsd32_timeval)));
+
+       default:
+               return (EOPNOTSUPP);
+       }
+       /* NOTREACHED */
+}
+
 int
 netbsd32___sysctl(p, v, retval)
        struct proc *p;
@@ -4344,7 +4390,19 @@
 
        switch (name[0]) {
        case CTL_KERN:
-               fn = kern_sysctl;
+               switch (name[1]) {
+#if 0
+               case KERN_FILE:
+               case KERN_NTPTIME:
+               case KERN_SYSVIPC_INFO:
+#endif
+               case KERN_BOOTTIME:
+                       fn = kern_sysctl32;
+                       break;
+               default:
+                       fn = kern_sysctl;
+                       break;
+               }
                break;
        case CTL_HW:
                fn = hw_sysctl;



Home | Main Index | Thread Index | Old Index