From c60fc29f0f62831730c04c23cd9ffbefef50a1d8 Mon Sep 17 00:00:00 2001 From: Jos Dehaes Date: Sun, 17 Oct 2021 22:10:50 +0200 Subject: arg_max should be int on macos --- src/osx/btop_collect.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/osx/btop_collect.cpp b/src/osx/btop_collect.cpp index 5aa9466..ca302bd 100644 --- a/src/osx/btop_collect.cpp +++ b/src/osx/btop_collect.cpp @@ -108,7 +108,7 @@ namespace Shared { uint64_t totalMem; long pageSize, clkTck, coreCount, physicalCoreCount; int totalMem_len; - size_t arg_max; + int arg_max; void init() { //? Shared global variables init @@ -1237,7 +1237,8 @@ namespace Proc { string proc_args; proc_args.resize(Shared::arg_max); int mib[] = {CTL_KERN, KERN_PROCARGS2, (int)pid}; - if (sysctl(mib, 3, proc_args.data(), &Shared::arg_max, NULL, 0) == 0) { + size_t argmax = Shared::arg_max; + if (sysctl(mib, 3, proc_args.data(), &argmax, NULL, 0) == 0) { int argc; memcpy(&argc, &proc_args[0], sizeof(argc)); if (size_t null_pos = proc_args.find('\0', sizeof(argc)); null_pos != string::npos) { -- cgit v1.2.3