summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authordfr <dfr@FreeBSD.org>1998-12-27 18:03:29 +0000
committerdfr <dfr@FreeBSD.org>1998-12-27 18:03:29 +0000
commit9238b8271dba66bff7d748e765d7930407e62c0e (patch)
tree9ea9431f80a2fb0797ec7a3226df618d63334d8b /sys
parentab302cd2cde3a14092cba2812798a98860e1e41b (diff)
downloadFreeBSD-src-9238b8271dba66bff7d748e765d7930407e62c0e.zip
FreeBSD-src-9238b8271dba66bff7d748e765d7930407e62c0e.tar.gz
Fix some 64bit truncation problems which crept into SYSCTL_LONG() with the
last cleanup. Since the oid_arg2 field of struct sysctl_oid is not wide enough to hold a long, the SYSCTL_LONG() macro has been modified to only support exporting long variables by pointer instead of by value. Reviewed by: bde
Diffstat (limited to 'sys')
-rw-r--r--sys/alpha/pci/pcibus.c13
-rw-r--r--sys/kern/kern_exec.c9
-rw-r--r--sys/kern/kern_sysctl.c38
-rw-r--r--sys/kern/subr_devstat.c4
-rw-r--r--sys/sys/sysctl.h8
5 files changed, 21 insertions, 51 deletions
diff --git a/sys/alpha/pci/pcibus.c b/sys/alpha/pci/pcibus.c
index 1b5d9bf..697373c 100644
--- a/sys/alpha/pci/pcibus.c
+++ b/sys/alpha/pci/pcibus.c
@@ -23,7 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: pcibus.c,v 1.6 1998/11/15 18:25:16 dfr Exp $
+ * $Id: pcibus.c,v 1.7 1998/11/18 23:53:12 dfr Exp $
*
*/
@@ -53,18 +53,15 @@ SYSCTL_STRING(_hw_chipset, OID_AUTO, type, CTLFLAG_RD, chipset_type, 0,
"PCI chipset type");
SYSCTL_INT(_hw_chipset, OID_AUTO, bwx, CTLFLAG_RD, &chipset_bwx, 0,
"PCI chipset supports BWX access");
-SYSCTL_LONG(_hw_chipset, OID_AUTO, ports, CTLFLAG_RD, &chipset_ports, 0,
+SYSCTL_LONG(_hw_chipset, OID_AUTO, ports, CTLFLAG_RD, &chipset_ports,
"PCI chipset port address");
-SYSCTL_LONG(_hw_chipset, OID_AUTO, memory, CTLFLAG_RD, &chipset_memory, 0,
+SYSCTL_LONG(_hw_chipset, OID_AUTO, memory, CTLFLAG_RD, &chipset_memory,
"PCI chipset memory address");
-SYSCTL_LONG(_hw_chipset, OID_AUTO, dense, CTLFLAG_RD, &chipset_dense, 0,
+SYSCTL_LONG(_hw_chipset, OID_AUTO, dense, CTLFLAG_RD, &chipset_dense,
"PCI chipset dense memory address");
-SYSCTL_LONG(_hw_chipset, OID_AUTO, hae_mask, CTLFLAG_RD, &chipset_hae_mask, 0,
+SYSCTL_LONG(_hw_chipset, OID_AUTO, hae_mask, CTLFLAG_RD, &chipset_hae_mask,
"PCI chipset mask for HAE register");
-static int cfgmech;
-static int devmax;
-
#ifdef notyet
/* return max number of devices on the bus */
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index e3a3b71..93e7bbd 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: kern_exec.c,v 1.89 1998/12/16 16:06:27 bde Exp $
+ * $Id: kern_exec.c,v 1.90 1998/12/16 16:28:57 bde Exp $
*/
#include <sys/param.h>
@@ -66,8 +66,11 @@
static long *exec_copyout_strings __P((struct image_params *));
-SYSCTL_LONG(_kern, KERN_PS_STRINGS, ps_strings, CTLFLAG_RD, 0, PS_STRINGS, "");
-SYSCTL_LONG(_kern, KERN_USRSTACK, usrstack, CTLFLAG_RD, 0, USRSTACK, "");
+static long ps_strings = PS_STRINGS;
+SYSCTL_LONG(_kern, KERN_PS_STRINGS, ps_strings, CTLFLAG_RD, &ps_strings, "");
+
+static long usrstack = USRSTACK;
+SYSCTL_LONG(_kern, KERN_USRSTACK, usrstack, CTLFLAG_RD, &usrstack, "");
/*
* Each of the items is a pointer to a `const struct execsw', hence the
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index b43c4ee..55e583b 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -37,7 +37,7 @@
* SUCH DAMAGE.
*
* @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94
- * $Id: kern_sysctl.c,v 1.79 1998/12/04 22:54:51 archie Exp $
+ * $Id: kern_sysctl.c,v 1.80 1998/12/13 07:18:54 truckman Exp $
*/
#include "opt_compat.h"
@@ -497,7 +497,7 @@ SYSCTL_NODE(_sysctl, 4, oidfmt, CTLFLAG_RD, sysctl_sysctl_oidfmt, "");
*/
/*
- * Handle an integer, signed or unsigned.
+ * Handle an int, signed or unsigned.
* Two cases:
* a variable: point arg1 at it.
* a constant: pass it in arg2.
@@ -524,7 +524,7 @@ sysctl_handle_int SYSCTL_HANDLER_ARGS
}
/*
- * Handle an integer, signed or unsigned.
+ * Handle a long, signed or unsigned.
* Two cases:
* a variable: point arg1 at it.
* a constant: pass it in arg2.
@@ -535,10 +535,7 @@ sysctl_handle_long SYSCTL_HANDLER_ARGS
{
int error = 0;
- if (arg1)
- error = SYSCTL_OUT(req, arg1, sizeof(long));
- else
- error = SYSCTL_OUT(req, &arg2, sizeof(long));
+ error = SYSCTL_OUT(req, arg1, sizeof(long));
if (error || !req->newptr)
return (error);
@@ -551,33 +548,6 @@ sysctl_handle_long SYSCTL_HANDLER_ARGS
}
/*
- * Handle an integer, signed or unsigned.
- * Two cases:
- * a variable: point arg1 at it.
- * a constant: pass it in arg2.
- */
-
-int
-sysctl_handle_intptr SYSCTL_HANDLER_ARGS
-{
- int error = 0;
-
- if (arg1)
- error = SYSCTL_OUT(req, arg1, sizeof(intptr_t));
- else
- error = SYSCTL_OUT(req, &arg2, sizeof(intptr_t));
-
- if (error || !req->newptr)
- return (error);
-
- if (!arg1)
- error = EPERM;
- else
- error = SYSCTL_IN(req, arg1, sizeof(intptr_t));
- return (error);
-}
-
-/*
* Handle our generic '\0' terminated 'C' string.
* Two cases:
* a variable string: point arg1 at it, arg2 is max length.
diff --git a/sys/kern/subr_devstat.c b/sys/kern/subr_devstat.c
index 8976c3b..5fcf88e 100644
--- a/sys/kern/subr_devstat.c
+++ b/sys/kern/subr_devstat.c
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: subr_devstat.c,v 1.6 1998/11/15 23:57:22 ken Exp $
+ * $Id: subr_devstat.c,v 1.7 1998/12/04 22:54:51 archie Exp $
*/
#include <sys/param.h>
@@ -243,6 +243,6 @@ SYSCTL_PROC(_kern_devstat, OID_AUTO, all, CTLFLAG_RD|CTLTYPE_OPAQUE,
SYSCTL_INT(_kern_devstat, OID_AUTO, numdevs, CTLFLAG_RD, &devstat_num_devs,
0, "Number of devices in the devstat list");
SYSCTL_LONG(_kern_devstat, OID_AUTO, generation, CTLFLAG_RD,
- &devstat_generation, 0, "Devstat list generation");
+ &devstat_generation, "Devstat list generation");
SYSCTL_INT(_kern_devstat, OID_AUTO, version, CTLFLAG_RD, &devstat_version,
0, "Devstat list version number");
diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h
index 8e9704b..4c14622 100644
--- a/sys/sys/sysctl.h
+++ b/sys/sys/sysctl.h
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)sysctl.h 8.1 (Berkeley) 6/2/93
- * $Id: sysctl.h,v 1.66 1998/12/13 07:19:13 truckman Exp $
+ * $Id: sysctl.h,v 1.67 1998/12/16 16:06:29 bde Exp $
*/
#ifndef _SYS_SYSCTL_H_
@@ -156,10 +156,10 @@ int sysctl_handle_opaque SYSCTL_HANDLER_ARGS;
SYSCTL_OID(parent, nbr, name, CTLTYPE_INT|access, \
ptr, val, sysctl_handle_int, "I", descr)
-/* Oid for a long. If ptr is NULL, val is returned. */
-#define SYSCTL_LONG(parent, nbr, name, access, ptr, val, descr) \
+/* Oid for a long. The pointer must be non NULL. */
+#define SYSCTL_LONG(parent, nbr, name, access, ptr, descr) \
SYSCTL_OID(parent, nbr, name, CTLTYPE_INT|access, \
- ptr, val, sysctl_handle_long, "L", descr)
+ ptr, 0, sysctl_handle_long, "L", descr)
/* Oid for an opaque object. Specified by a pointer and a length. */
#define SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr) \
OpenPOWER on IntegriCloud