mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
libthr: use nitems() for mib length
Suggested by: imp Reviewed by: brooks, imp (previous version) Discussed with: markj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D36540
This commit is contained in:
parent
0ae364adcd
commit
ebf7a01594
3 changed files with 6 additions and 7 deletions
|
|
@ -28,7 +28,7 @@
|
|||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
|
@ -83,7 +83,7 @@ __libc_map_stacks_exec(void)
|
|||
mib[0] = CTL_KERN;
|
||||
mib[1] = KERN_USRSTACK;
|
||||
len = sizeof(usrstack);
|
||||
if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), &usrstack, &len, NULL, 0)
|
||||
if (sysctl(mib, nitems(mib), &usrstack, &len, NULL, 0)
|
||||
== -1)
|
||||
return;
|
||||
if (getrlimit(RLIMIT_STACK, &rlim) == -1)
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/signalvar.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/link_elf.h>
|
||||
|
|
@ -466,7 +466,7 @@ init_private(void)
|
|||
mib[0] = CTL_KERN;
|
||||
mib[1] = KERN_USRSTACK;
|
||||
len = sizeof (_usrstack);
|
||||
if (sysctl(mib, 2, &_usrstack, &len, NULL, 0) == -1)
|
||||
if (sysctl(mib, nitems(mib), &_usrstack, &len, NULL, 0) == -1)
|
||||
PANIC("Cannot get kern.usrstack from sysctl");
|
||||
env_bigstack = getenv("LIBPTHREAD_BIGSTACK_MAIN");
|
||||
env_splitstack = getenv("LIBPTHREAD_SPLITSTACK_MAIN");
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/resource.h>
|
||||
|
|
@ -155,8 +155,7 @@ singlethread_map_stacks_exec(void)
|
|||
mib[0] = CTL_KERN;
|
||||
mib[1] = KERN_USRSTACK;
|
||||
len = sizeof(usrstack);
|
||||
if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), &usrstack, &len, NULL, 0)
|
||||
== -1)
|
||||
if (sysctl(mib, nitems(mib), &usrstack, &len, NULL, 0) == -1)
|
||||
return;
|
||||
if (getrlimit(RLIMIT_STACK, &rlim) == -1)
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in a new issue