summaryrefslogtreecommitdiffstats
path: root/sys/compat
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2004-10-11 22:04:16 +0000
committerpeter <peter@FreeBSD.org>2004-10-11 22:04:16 +0000
commit09964b7499a5ae22028b46962764b78d5e698410 (patch)
tree1829b174800facf808eb5d32c6e9b155f798a0f6 /sys/compat
parent89db558372e0f70245194eceebce5e8c90ee25dc (diff)
downloadFreeBSD-src-09964b7499a5ae22028b46962764b78d5e698410.zip
FreeBSD-src-09964b7499a5ae22028b46962764b78d5e698410.tar.gz
Put on my peril sensitive sunglasses and add a flags field to the internal
sysctl routines and state. Add some code to use it for signalling the need to downconvert a data structure to 32 bits on a 64 bit OS when requested by a 32 bit app. I tried to do this in a generic abi wrapper that intercepted the sysctl oid's, or looked up the format string etc, but it was a real can of worms that turned into a fragile mess before I even got it partially working. With this, we can now run 'sysctl -a' on a 32 bit sysctl binary and have it not abort. Things like netstat, ps, etc have a long way to go. This also fixes a bug in the kern.ps_strings and kern.usrstack hacks. These do matter very much because they are used by libc_r and other things.
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/freebsd32/freebsd32_misc.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c
index b78f552..0326242 100644
--- a/sys/compat/freebsd32/freebsd32_misc.c
+++ b/sys/compat/freebsd32/freebsd32_misc.c
@@ -1203,25 +1203,21 @@ freebsd32_sysctl(struct thread *td, struct freebsd32_sysctl_args *uap)
if (uap->namelen > CTL_MAXNAME || uap->namelen < 2)
return (EINVAL);
-
- error = copyin(uap->name, &name, uap->namelen * sizeof(int));
+ error = copyin(uap->name, name, uap->namelen * sizeof(int));
if (error)
return (error);
-
mtx_lock(&Giant);
-
if (uap->oldlenp)
oldlen = fuword32(uap->oldlenp);
else
oldlen = 0;
error = userland_sysctl(td, name, uap->namelen,
uap->old, &oldlen, 1,
- uap->new, uap->newlen, &j);
+ uap->new, uap->newlen, &j, SCTL_MASK32);
if (error && error != ENOMEM)
goto done2;
- if (uap->oldlenp) {
+ if (uap->oldlenp)
suword32(uap->oldlenp, j);
- }
done2:
mtx_unlock(&Giant);
return (error);
OpenPOWER on IntegriCloud