- re-enable kmem support, with 5.4.2 there don't seem to be
any problems on tested arch (including the ones that used to have trouble). - repair sysctl() use in cpu_sysctl.c, it was using the wrong type and at least on some arch the system call was failing, so because the code isn't careful about checking return codes and thus used uninitialized space, it tried to allocate memory for info structures for 128 million CPUs on one of my systems... "definitely ok" rui@
This commit is contained in:
parent
a05c70b5b9
commit
fa21bd3ed4
@ -1,12 +1,12 @@
|
||||
# $OpenBSD: Makefile,v 1.31 2008/09/20 22:15:51 rui Exp $
|
||||
# $OpenBSD: Makefile,v 1.32 2008/09/22 18:46:36 sthen Exp $
|
||||
|
||||
COMMENT-main= extendable SNMP implementation
|
||||
COMMENT-perl= SNMP modules for Perl
|
||||
|
||||
V= 5.4.2
|
||||
DISTNAME= net-snmp-${V}
|
||||
PKGNAME-main= ${DISTNAME}
|
||||
PKGNAME-perl= p5-SNMP-${V}
|
||||
PKGNAME-main= ${DISTNAME}p0
|
||||
PKGNAME-perl= p5-SNMP-${V}p0
|
||||
SHARED_LIBS= netsnmp 8.0 \
|
||||
netsnmpagent 8.0 \
|
||||
netsnmphelpers 8.0 \
|
||||
@ -41,8 +41,6 @@ CONFIGURE_ARGS= ${CONFIGURE_SHARED} --with-libwrap --with-perl-modules \
|
||||
--with-sys-contact="nobody@nowhere.invalid" \
|
||||
--with-sys-location="somewhere" \
|
||||
--with-logfile="/var/log/snmpd" \
|
||||
--without-kmem-usage \
|
||||
--with-out-mib-modules=host/hr_swrun \
|
||||
--with-persistent-directory="/var/net-snmp"
|
||||
REGRESS_TARGET= test
|
||||
|
||||
|
@ -0,0 +1,42 @@
|
||||
$OpenBSD: patch-agent_mibgroup_hardware_cpu_cpu_sysctl_c,v 1.1 2008/09/22 18:46:36 sthen Exp $
|
||||
|
||||
the last chunk is probably not used yet, but what they have now
|
||||
is plain wrong, so it may as well go in here so it's not lost.
|
||||
|
||||
--- agent/mibgroup/hardware/cpu/cpu_sysctl.c.orig Mon Sep 22 00:58:02 2008
|
||||
+++ agent/mibgroup/hardware/cpu/cpu_sysctl.c Mon Sep 22 01:06:11 2008
|
||||
@@ -37,19 +37,20 @@ void _cpu_copy_stats( netsnmp_cpu_info *cpu );
|
||||
* (including descriptions)
|
||||
*/
|
||||
void init_cpu_sysctl( void ) {
|
||||
- int i, n;
|
||||
+ int n;
|
||||
int ncpu_mib[] = { CTL_HW, HW_NCPU };
|
||||
int model_mib[] = { CTL_HW, HW_MODEL };
|
||||
+ size_t i;
|
||||
char descr[ SNMP_MAXBUF ];
|
||||
netsnmp_cpu_info *cpu = netsnmp_cpu_get_byIdx( -1, 1 );
|
||||
strcpy(cpu->name, "Overall CPU statistics");
|
||||
|
||||
i = sizeof(n);
|
||||
- sysctl(ncpu_mib, 2, &n, (void *)&i, NULL, 0);
|
||||
+ sysctl(ncpu_mib, 2, &n, &i, NULL, 0);
|
||||
if ( n <= 0 )
|
||||
n = 1; /* Single CPU system */
|
||||
i = sizeof(descr);
|
||||
- sysctl(model_mib, 2, descr, (void *)&i, NULL, 0);
|
||||
+ sysctl(model_mib, 2, descr, &i, NULL, 0);
|
||||
for ( i = 0; i < n; i++ ) {
|
||||
cpu = netsnmp_cpu_get_byIdx( i, 1 );
|
||||
cpu->status = 2; /* running */
|
||||
@@ -190,8 +191,8 @@ int netsnmp_cpu_arch_load( netsnmp_cache *cache, void
|
||||
|
||||
#ifdef NETSNMP_KERN_MCPU
|
||||
mcpu_stats = malloc(cpu_num*sizeof(NETSNMP_KERN_MCPU_TYPE));
|
||||
- sysctl(mcpu_mib, 2, mcpu_stats,
|
||||
- cpu_num*sizeof(NETSNMP_KERN_MCPU_TYPE), NULL, 0);
|
||||
+ mcpu_size = sizeof(mcpu_stats);
|
||||
+ sysctl(mcpu_mib, 2, mcpu_stats, &mcpu_size, NULL, 0);
|
||||
for ( i = 0; i < cpu_num; i++ ) {
|
||||
cpu = netsnmp_cpu_get_byIdx( i, 0 );
|
||||
/* XXX - per-CPU statistics - mcpu_mib[i].??? */
|
Loading…
x
Reference in New Issue
Block a user