ibm-power-utilities / powerpc-utils

Suite of utilities for Linux on Power systems
GNU General Public License v2.0
34 stars 55 forks source link

lparstat: Fix reported online memory in legacy format #71

Closed tabraham closed 2 years ago

tabraham commented 3 years ago

On systems with more than 2TB of online memory, legacy mode will calculate and report a negative value due to exceeding the maximum value for a signed 32-bit integer:

$ lparstat -i | grep "Online Memory" Online Memory : 3771084032 kB

$ lparstat -il | grep "Online Memory" Online Memory : -511604 MB

hramrach commented 3 years ago

Maybe use atoll while at it?

hramrach commented 3 years ago

Also for atol conversion the prinf format specifier should be %ld

hramrach commented 3 years ago

on 64bit long and long long is the same sizeof(char) 1, sizeof(int) 4, sizeof(long) 8, sizeof(long long) 8 but on 32bit int and long is the same sizeof(char) 1, sizeof(int) 4, sizeof(long) 4, sizeof(long long) 8 and powerpc-utils can technically be compiled for 32bit

hramrach commented 3 years ago

LGTM

Thanks

tyreld commented 2 years ago

Need a Signed-off-by:

hramrach commented 2 years ago

@tabraham ?

tabraham commented 2 years ago

Sorry for the delay. I missed seeing this.

tyreld commented 2 years ago

Fixed by commit https://github.com/ibm-power-utilities/powerpc-utils/commit/5d2d0a0b50ff386b7d9416e122d05214846573b6