summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_exec.c
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/kern/kern_exec.c
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/kern/kern_exec.c')
-rw-r--r--sys/kern/kern_exec.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index d236832..06cbc68 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -104,8 +104,8 @@ sysctl_kern_ps_strings(SYSCTL_HANDLER_ARGS)
int error;
p = curproc;
-#if defined(__amd64__) || defined(__ia64__)
- if (req->oldlen == sizeof(unsigned int)) {
+#ifdef SCTL_MASK32
+ if (req->flags & SCTL_MASK32) {
unsigned int val;
val = (unsigned int)p->p_sysent->sv_psstrings;
error = SYSCTL_OUT(req, &val, sizeof(val));
@@ -123,8 +123,8 @@ sysctl_kern_usrstack(SYSCTL_HANDLER_ARGS)
int error;
p = curproc;
-#if defined(__amd64__) || defined(__ia64__)
- if (req->oldlen == sizeof(unsigned int)) {
+#ifdef SCTL_MASK32
+ if (req->flags & SCTL_MASK32) {
unsigned int val;
val = (unsigned int)p->p_sysent->sv_usrstack;
error = SYSCTL_OUT(req, &val, sizeof(val));
OpenPOWER on IntegriCloud