summaryrefslogtreecommitdiffstats
path: root/src/osx
diff options
context:
space:
mode:
authorJos Dehaes <jos.dehaes@gmail.com>2021-10-17 22:19:41 +0200
committerJos Dehaes <jos.dehaes@gmail.com>2021-10-17 22:19:41 +0200
commit4c228de0ef8a75275178bad081e568f85fc579fd (patch)
tree4b1d41b2510c1a9be43e5432510253fe4f9aea89 /src/osx
parentc60fc29f0f62831730c04c23cd9ffbefef50a1d8 (diff)
use sysconf to get arg_max - seems simpler
Diffstat (limited to 'src/osx')
-rw-r--r--src/osx/btop_collect.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/osx/btop_collect.cpp b/src/osx/btop_collect.cpp
index ca302bd..0882afe 100644
--- a/src/osx/btop_collect.cpp
+++ b/src/osx/btop_collect.cpp
@@ -106,9 +106,8 @@ namespace Shared {
fs::path passwd_path;
uint64_t totalMem;
- long pageSize, clkTck, coreCount, physicalCoreCount;
+ long pageSize, clkTck, coreCount, physicalCoreCount, arg_max;
int totalMem_len;
- int arg_max;
void init() {
//? Shared global variables init
@@ -144,12 +143,7 @@ namespace Shared {
totalMem = memsize;
//* Get maximum length of process arguments
- size = sizeof(arg_max);
- int mib[] = {CTL_KERN, KERN_ARGMAX};
- if (sysctl(mib, 2, &arg_max, &size, NULL, 0) != 0) {
- arg_max = 0;
- }
-
+ arg_max = sysconf(_SC_ARG_MAX);
//? Init for namespace Cpu
if (not fs::exists(Cpu::freq_path) or access(Cpu::freq_path.c_str(), R_OK) == -1) Cpu::freq_path.clear();