mirror of
https://github.com/aristocratos/btop.git
synced 2024-09-27 22:01:29 +02:00
use sysconf to get arg_max - seems simpler
This commit is contained in:
parent
c60fc29f0f
commit
4c228de0ef
@ -106,9 +106,8 @@ namespace Shared {
|
|||||||
|
|
||||||
fs::path passwd_path;
|
fs::path passwd_path;
|
||||||
uint64_t totalMem;
|
uint64_t totalMem;
|
||||||
long pageSize, clkTck, coreCount, physicalCoreCount;
|
long pageSize, clkTck, coreCount, physicalCoreCount, arg_max;
|
||||||
int totalMem_len;
|
int totalMem_len;
|
||||||
int arg_max;
|
|
||||||
|
|
||||||
void init() {
|
void init() {
|
||||||
//? Shared global variables init
|
//? Shared global variables init
|
||||||
@ -144,12 +143,7 @@ namespace Shared {
|
|||||||
totalMem = memsize;
|
totalMem = memsize;
|
||||||
|
|
||||||
//* Get maximum length of process arguments
|
//* Get maximum length of process arguments
|
||||||
size = sizeof(arg_max);
|
arg_max = sysconf(_SC_ARG_MAX);
|
||||||
int mib[] = {CTL_KERN, KERN_ARGMAX};
|
|
||||||
if (sysctl(mib, 2, &arg_max, &size, NULL, 0) != 0) {
|
|
||||||
arg_max = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//? Init for namespace Cpu
|
//? 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();
|
if (not fs::exists(Cpu::freq_path) or access(Cpu::freq_path.c_str(), R_OK) == -1) Cpu::freq_path.clear();
|
||||||
|
Loading…
Reference in New Issue
Block a user