Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/compat/netbsd32 make sysctl vm.loadavg work.
details: https://anonhg.NetBSD.org/src/rev/162d8b2488c7
branches: trunk
changeset: 503257:162d8b2488c7
user: mrg <mrg%NetBSD.org@localhost>
date: Sun Feb 04 06:35:07 2001 +0000
description:
make sysctl vm.loadavg work.
diffstat:
sys/compat/netbsd32/netbsd32.h | 7 +++-
sys/compat/netbsd32/netbsd32_netbsd.c | 58 +++++++++++++++++++++++++++++++++-
2 files changed, 62 insertions(+), 3 deletions(-)
diffs (114 lines):
diff -r 8a592c060b8e -r 162d8b2488c7 sys/compat/netbsd32/netbsd32.h
--- a/sys/compat/netbsd32/netbsd32.h Sun Feb 04 06:19:40 2001 +0000
+++ b/sys/compat/netbsd32/netbsd32.h Sun Feb 04 06:35:07 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32.h,v 1.16 2001/02/02 07:08:17 mrg Exp $ */
+/* $NetBSD: netbsd32.h,v 1.17 2001/02/04 06:35:07 mrg Exp $ */
/*
* Copyright (c) 1998 Matthew R. Green
@@ -170,6 +170,11 @@
typedef u_int32_t netbsd32_rlimitp_t;
+struct netbsd32_loadavg {
+ fixpt_t ldavg[3];
+ netbsd32_long fscale;
+};
+
/* from <sys/ipc.h> */
typedef u_int32_t netbsd32_ipc_permp_t;
struct netbsd32_ipc_perm {
diff -r 8a592c060b8e -r 162d8b2488c7 sys/compat/netbsd32/netbsd32_netbsd.c
--- a/sys/compat/netbsd32/netbsd32_netbsd.c Sun Feb 04 06:19:40 2001 +0000
+++ b/sys/compat/netbsd32/netbsd32_netbsd.c Sun Feb 04 06:35:07 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_netbsd.c,v 1.51 2001/02/03 12:46:55 mrg Exp $ */
+/* $NetBSD: netbsd32_netbsd.c,v 1.52 2001/02/04 06:35:08 mrg Exp $ */
/*
* Copyright (c) 1998 Matthew R. Green
@@ -127,6 +127,7 @@
static __inline void netbsd32_from_shmid_ds __P((struct shmid_ds *, struct netbsd32_shmid_ds *));
static __inline void netbsd32_to_semid_ds __P((struct netbsd32_semid_ds *, struct semid_ds *));
static __inline void netbsd32_from_semid_ds __P((struct semid_ds *, struct netbsd32_semid_ds *));
+static __inline void netbsd32_from_loadavg __P((struct netbsd32_loadavg *, struct loadavg *));
/* note that the netbsd32_msghdr's iov really points to a struct iovec, not a netbsd32_iovec. */
@@ -609,6 +610,18 @@
s32dsp->sem_ctime = dsp->sem_ctime;
}
+static __inline void
+netbsd32_from_loadavg(av32, av)
+ struct netbsd32_loadavg *av32;
+ struct loadavg *av;
+{
+
+ av32->ldavg[0] = av->ldavg[0];
+ av32->ldavg[1] = av->ldavg[1];
+ av32->ldavg[2] = av->ldavg[2];
+ av32->fscale = (netbsd32_long)av->fscale;
+}
+
/*
* below are all the standard NetBSD system calls, in the 32bit
* environment, with the necessary conversions to 64bit before
@@ -4256,6 +4269,40 @@
return (sys_ftruncate(p, &ua, retval));
}
+int uvm_sysctl32(int *, u_int, void *, size_t *, void *, size_t, struct proc *);
+
+/*
+ * uvm_sysctl32: sysctl hook into UVM system, handling special 32-bit
+ * sensitive calls.
+ */
+int
+uvm_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_loadavg av32;
+
+ /* all sysctl names at this level are terminal */
+ if (namelen != 1)
+ return (ENOTDIR); /* overloaded */
+
+ switch (name[0]) {
+ case VM_LOADAVG:
+ netbsd32_from_loadavg(&av32, &averunnable);
+ return (sysctl_rdstruct(oldp, oldlenp, newp, &av32,
+ sizeof(av32)));
+
+ default:
+ return (EOPNOTSUPP);
+ }
+ /* NOTREACHED */
+}
+
int
netbsd32___sysctl(p, v, retval)
struct proc *p;
@@ -4303,7 +4350,14 @@
fn = hw_sysctl;
break;
case CTL_VM:
- fn = uvm_sysctl;
+ switch (name[1]) {
+ case VM_LOADAVG:
+ fn = uvm_sysctl32; /* need to convert a `long' */
+ break;
+ default:
+ fn = uvm_sysctl;
+ break;
+ }
break;
case CTL_NET:
fn = net_sysctl;
Home |
Main Index |
Thread Index |
Old Index