mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-07-24 04:34:25 +08:00
Fix maxid and maxcpus sysctls
This prevents an infinte loop in netstat -m on SMP configurations.
This commit is contained in:
parent
8e37837b21
commit
4ccf797155
@ -77,13 +77,13 @@ struct timeval boottime;
|
|||||||
static SYSCTL_NODE(_kern, OID_AUTO, smp, CTLFLAG_RD|CTLFLAG_CAPRD, NULL,
|
static SYSCTL_NODE(_kern, OID_AUTO, smp, CTLFLAG_RD|CTLFLAG_CAPRD, NULL,
|
||||||
"Kernel SMP");
|
"Kernel SMP");
|
||||||
|
|
||||||
static int one = 1;
|
static int maxid_maxcpus;
|
||||||
|
|
||||||
SYSCTL_INT(_kern_smp, OID_AUTO, maxid, CTLFLAG_RD|CTLFLAG_CAPRD, &one, 0,
|
SYSCTL_INT(_kern_smp, OID_AUTO, maxid, CTLFLAG_RD|CTLFLAG_CAPRD,
|
||||||
"Max CPU ID.");
|
&maxid_maxcpus, 0, "Max CPU ID.");
|
||||||
|
|
||||||
SYSCTL_INT(_kern_smp, OID_AUTO, maxcpus, CTLFLAG_RD|CTLFLAG_CAPRD, &one,
|
SYSCTL_INT(_kern_smp, OID_AUTO, maxcpus, CTLFLAG_RD|CTLFLAG_CAPRD,
|
||||||
0, "Max number of CPUs that the system was compiled for.");
|
&maxid_maxcpus, 0, "Max number of CPUs that the system was compiled for.");
|
||||||
|
|
||||||
rtems_status_code
|
rtems_status_code
|
||||||
rtems_bsd_initialize(void)
|
rtems_bsd_initialize(void)
|
||||||
@ -94,6 +94,7 @@ rtems_bsd_initialize(void)
|
|||||||
hz = (int) rtems_clock_get_ticks_per_second();
|
hz = (int) rtems_clock_get_ticks_per_second();
|
||||||
tick = 1000000 / hz;
|
tick = 1000000 / hz;
|
||||||
maxusers = 1;
|
maxusers = 1;
|
||||||
|
maxid_maxcpus = (int) rtems_get_processor_count();
|
||||||
|
|
||||||
gettimeofday(&boottime, NULL);
|
gettimeofday(&boottime, NULL);
|
||||||
timeval2bintime(&boottime, &boottimebin);
|
timeval2bintime(&boottime, &boottimebin);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user