diff options
author | Peter Wemm <peter@FreeBSD.org> | 2004-10-11 22:04:16 +0000 |
---|---|---|
committer | Peter Wemm <peter@FreeBSD.org> | 2004-10-11 22:04:16 +0000 |
commit | a7bc3102c474e06cee479c0474f8815bd54bf994 (patch) | |
tree | 1829b174800facf808eb5d32c6e9b155f798a0f6 /sys/compat/freebsd32/freebsd32_misc.c | |
parent | 731239920fb7702a4710c231d842457bb77bf069 (diff) | |
download | src-a7bc3102c474e06cee479c0474f8815bd54bf994.tar.gz src-a7bc3102c474e06cee479c0474f8815bd54bf994.zip |
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.
Notes
Notes:
svn path=/head/; revision=136404
Diffstat (limited to 'sys/compat/freebsd32/freebsd32_misc.c')
-rw-r--r-- | sys/compat/freebsd32/freebsd32_misc.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index b78f552dbff5..0326242ecd2e 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); |