summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJos Dehaes <jos.dehaes@gmail.com>2021-10-17 22:10:50 +0200
committerJos Dehaes <jos.dehaes@gmail.com>2021-10-17 22:10:50 +0200
commitc60fc29f0f62831730c04c23cd9ffbefef50a1d8 (patch)
tree8bdc7591970daaf918fb1d53b1676169d45ec7cf
parent0b5a931a6d5e8d1a434e88e8fd0613ab948995fa (diff)
arg_max should be int on macos
-rw-r--r--src/osx/btop_collect.cpp5
1 files 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) {