[rtems-libbsd commit] Fix maxid and maxcpus sysctls

Sebastian Huber sebh at rtems.org
Wed Apr 1 07:16:38 UTC 2015


Module:    rtems-libbsd
Branch:    master
Commit:    4ccf797155d9be95129c5bc51c8e73faead6bcfd
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=4ccf797155d9be95129c5bc51c8e73faead6bcfd

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Mar 30 09:52:17 2015 +0200

Fix maxid and maxcpus sysctls

This prevents an infinte loop in netstat -m on SMP configurations.

---

 rtemsbsd/rtems/rtems-bsd-init.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/rtemsbsd/rtems/rtems-bsd-init.c b/rtemsbsd/rtems/rtems-bsd-init.c
index 43c1952..f7fcd27 100644
--- a/rtemsbsd/rtems/rtems-bsd-init.c
+++ b/rtemsbsd/rtems/rtems-bsd-init.c
@@ -77,13 +77,13 @@ struct timeval boottime;
 static SYSCTL_NODE(_kern, OID_AUTO, smp, CTLFLAG_RD|CTLFLAG_CAPRD, NULL,
     "Kernel SMP");
 
-static int one = 1;
+static int maxid_maxcpus;
 
-SYSCTL_INT(_kern_smp, OID_AUTO, maxid, CTLFLAG_RD|CTLFLAG_CAPRD, &one, 0,
-    "Max CPU ID.");
+SYSCTL_INT(_kern_smp, OID_AUTO, maxid, CTLFLAG_RD|CTLFLAG_CAPRD,
+    &maxid_maxcpus, 0, "Max CPU ID.");
 
-SYSCTL_INT(_kern_smp, OID_AUTO, maxcpus, CTLFLAG_RD|CTLFLAG_CAPRD, &one,
-    0, "Max number of CPUs that the system was compiled for.");
+SYSCTL_INT(_kern_smp, OID_AUTO, maxcpus, CTLFLAG_RD|CTLFLAG_CAPRD,
+    &maxid_maxcpus, 0, "Max number of CPUs that the system was compiled for.");
 
 rtems_status_code
 rtems_bsd_initialize(void)
@@ -94,6 +94,7 @@ rtems_bsd_initialize(void)
 	hz = (int) rtems_clock_get_ticks_per_second();
 	tick = 1000000 / hz;
 	maxusers = 1;
+	maxid_maxcpus = (int) rtems_get_processor_count();
 
 	gettimeofday(&boottime, NULL);
 	timeval2bintime(&boottime, &boottimebin);




More information about the vc mailing list