summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlastair Poole <netstar@gmail.com>2019-12-05 13:56:19 +0000
committerAlastair Poole <netstar@gmail.com>2019-12-05 13:56:19 +0000
commit0a036c0453ed0516e05a42dd554a07e6d30a68e1 (patch)
treeeb17adf6f1b93e4b4582837a18299b5cbfd9afe4
parentebe27c31f0535ec6b99ce840b78c0c17a5e9c5d8 (diff)
getpagesize: No need to keep calling this funtion.
-rw-r--r--src/bin/process.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/bin/process.c b/src/bin/process.c
index 42796c7..62ca69d 100644
--- a/src/bin/process.c
+++ b/src/bin/process.c
@@ -457,7 +457,10 @@ _process_list_freebsd_get(void)
457 struct kinfo_proc kp; 457 struct kinfo_proc kp;
458 int mib[4]; 458 int mib[4];
459 size_t len; 459 size_t len;
460 int pagesize = getpagesize(); 460 static int pagesize = 0;
461
462 if (!pagesize)
463 pagesize = getpagesize();
461 464
462 list = NULL; 465 list = NULL;
463 466
@@ -510,7 +513,9 @@ proc_info_by_pid(int pid)
510 struct kinfo_proc kp; 513 struct kinfo_proc kp;
511 int mib[4]; 514 int mib[4];
512 size_t len; 515 size_t len;
513 int pagesize = getpagesize(); 516 static int pagesize = 0;
517
518 if (!pagesize) pagesize = getpagesize();
514 519
515 len = sizeof(int); 520 len = sizeof(int);
516 if (sysctlnametomib("kern.proc.pid", mib, &len) == -1) 521 if (sysctlnametomib("kern.proc.pid", mib, &len) == -1)