Detection of nlist support seems to assume /dev/kem exists, and that is not
always the case on darwin. The darwin headers for darwin 8-10 unconditionally
undef KVM functions, even though /dev/kmem does still exists on PPC darwin8
machines.
This patch:
- checks for /dev/kmem and defines HAVE_KMEM if it exists
- updates conditions for CAN_USE_NLIST to check HAVE_KMEM
- removes darwin hardcoded KVM undefs (all KVM refs are already protected by
CAN_USE_NLIST)
Without this patch:
- darwin Intel snmpd builds fail to start unless -r specified (or configured
with --without-kmem-usage)
- PPC snmpd builds don't get the benefit of HAVE_KVM_GETPROCS and
HAVE_KVM_OPENFILES, whatever that might be)
Patch does not include regenerated configure or net-snmp-config.h.in; those
can be autogenerated on a machine with the proper versions. [Maybe we need a
make target to regenerate these that will warn if the required versions aren't
installed. Left as an exercise for the reader. ;-) ]
diff --git a/net-snmp/acconfig.h b/net-snmp/acconfig.h
index 83bd6b2..b6b6413 100644
--- a/net-snmp/acconfig.h
+++ b/net-snmp/acconfig.h
@@ -497,7 +497,7 @@
#undef CMU_COMPATIBLE
/* final conclusion on nlist usage */
-#if defined(HAVE_NLIST) && defined(HAVE_STRUCT_NLIST_N_VALUE) && !defined(NETSNMP_DONT_USE_NLIST) && !defined(NETSNMP_NO_KMEM_USAGE)
+#if defined(HAVE_NLIST) && defined(HAVE_STRUCT_NLIST_N_VALUE) && !defined(NETSNMP_DONT_USE_NLIST) && defined(HAVE_KMEM) && !defined(NETSNMP_NO_KMEM_USAGE)
#define NETSNMP_CAN_USE_NLIST
#endif
diff --git a/net-snmp/configure.d/config_os_misc4 b/net-snmp/configure.d/config_os_misc4
index 4dad90b..b6cb040 100644
--- a/net-snmp/configure.d/config_os_misc4
+++ b/net-snmp/configure.d/config_os_misc4
@@ -49,6 +49,23 @@ AC_CACHE_CHECK([for location of system kernel],
AC_DEFINE_UNQUOTED(KERNEL_LOC,"$ac_cv_KERNEL_LOC", [location of UNIX kernel])
+# /dev/kmem existence
+# used in agent only
+#
+AC_CACHE_CHECK([for /dev/kmem],
+ ac_cv_HAVE_KMEM,
+ [if test $CDEV_TEST_FLAG /dev/kmem; then
+ ac_cv_HAVE_KMEM="/dev/kmem"
+ fi
+])
+#
+# Note that it's OK if this device is not found
+#
+if test "x$ac_cv_HAVE_KMEM" = "x/dev/kmem"; then
+ AC_DEFINE_UNQUOTED(HAVE_KMEM,"$ac_cv_HAVE_KMEM", [Define if you have /dev/kmem])
+fi
+
+
# Swap device Location
# (/dev/dmem or /dev/drum)
# used in agent only
diff --git a/net-snmp/include/net-snmp/system/darwin10.h b/net-snmp/include/net-snmp/system/darwin10.h
index c3d17e7..8ed82d0 100644
--- a/net-snmp/include/net-snmp/system/darwin10.h
+++ b/net-snmp/include/net-snmp/system/darwin10.h
@@ -103,14 +103,6 @@
#endif
/*
- * Although Darwin does have a kvm.h file, kvm_openfiles etc. always
- * return null because /dev/kmem was removed completely in OS X 10.5.
- */
-#undef HAVE_KVM_H
-#undef HAVE_KVM_GETPROCS
-#undef HAVE_KVM_OPENFILES
-
-/*
* Although Darwin does have an fstab.h file, getfsfile etc. always return null.
* At least, as of 5.3.
*/
diff --git a/net-snmp/include/net-snmp/system/darwin8.h b/net-snmp/include/net-snmp/system/darwin8.h
index 991691d..1e6d7d3 100644
--- a/net-snmp/include/net-snmp/system/darwin8.h
+++ b/net-snmp/include/net-snmp/system/darwin8.h
@@ -63,14 +63,6 @@
#endif
/*
- * Although Darwin does have a kvm.h file, kvm_openfiles etc. always
- * return null because /dev/kmem was removed in OS X 10.4 for Intel.
- */
-#undef HAVE_KVM_H
-#undef HAVE_KVM_GETPROCS
-#undef HAVE_KVM_OPENFILES
-
-/*
* Although Darwin does have an fstab.h file, getfsfile etc. always return null.
* At least, as of 5.3.
*/
diff --git a/net-snmp/include/net-snmp/system/darwin9.h b/net-snmp/include/net-snmp/system/darwin9.h
index 02f9fb2..cf4e1d5 100644
--- a/net-snmp/include/net-snmp/system/darwin9.h
+++ b/net-snmp/include/net-snmp/system/darwin9.h
@@ -103,14 +103,6 @@
#endif
/*
- * Although Darwin does have a kvm.h file, kvm_openfiles etc. always
- * return null because /dev/kmem was removed completely in OS X 10.5.
- */
-#undef HAVE_KVM_H
-#undef HAVE_KVM_GETPROCS
-#undef HAVE_KVM_OPENFILES
-
-/*
* Although Darwin does have an fstab.h file, getfsfile etc. always return null.
* At least, as of 5.3.
*/
------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users
worldwide. Take advantage of special opportunities to increase revenue and
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________
Net-snmp-coders mailing list
Net-snmp-coders@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders