library: remove the ull_int result type, <MEMINFO> api
Because of the vast quantities of virtual memory which may be allocated, it initially seemed like a good idea to provide for a widest possible range through the use of a 'ull_int' result type. However, on second thought the implementation was a bit flawed for these reasons: . that underlying meminfo_data variable 'VmallocTotal' is 'unsigned long' not a required 'unsigned long long' . there wasn't a convenient way to value it since each variable was set with a strtoul() call, not strtoull() So this patch will standardize on the 'ul_int' results type (and reduce the associated delta to 's_int' too). For now, we'll rely on protections under a 64-bit arch where a 'ull_int' & 'ul_int' yield identical capacity. Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
fac5e6fea0
commit
90753e2d5b
@ -164,7 +164,7 @@ MEM_set(MEM_TOTAL, ul_int, MemTotal)
|
||||
MEM_set(MEM_UNEVICTABLE, ul_int, Unevictable)
|
||||
MEM_set(MEM_USED, ul_int, derived_mem_used)
|
||||
MEM_set(MEM_VM_ALLOC_CHUNK, ul_int, VmallocChunk)
|
||||
MEM_set(MEM_VM_ALLOC_TOTAL, ull_int, VmallocTotal)
|
||||
MEM_set(MEM_VM_ALLOC_TOTAL, ul_int, VmallocTotal)
|
||||
MEM_set(MEM_VM_ALLOC_USED, ul_int, VmallocUsed)
|
||||
MEM_set(MEM_WRITEBACK, ul_int, Writeback)
|
||||
MEM_set(MEM_WRITEBACK_TMP, ul_int, WritebackTmp)
|
||||
@ -204,7 +204,7 @@ HST_set(DELTA_TOTAL, s_int, MemTotal)
|
||||
HST_set(DELTA_UNEVICTABLE, s_int, Unevictable)
|
||||
HST_set(DELTA_USED, s_int, derived_mem_used)
|
||||
HST_set(DELTA_VM_ALLOC_CHUNK, s_int, VmallocChunk)
|
||||
HST_set(DELTA_VM_ALLOC_TOTAL, sl_int, VmallocTotal)
|
||||
HST_set(DELTA_VM_ALLOC_TOTAL, s_int, VmallocTotal)
|
||||
HST_set(DELTA_VM_ALLOC_USED, s_int, VmallocUsed)
|
||||
HST_set(DELTA_WRITEBACK, s_int, Writeback)
|
||||
HST_set(DELTA_WRITEBACK_TMP, s_int, WritebackTmp)
|
||||
@ -487,7 +487,7 @@ static inline void cleanup_stack (
|
||||
if (this->item >= PROCPS_MEMINFO_logical_end)
|
||||
break;
|
||||
if (this->item > PROCPS_MEMINFO_noop)
|
||||
this->result.ull_int = 0;
|
||||
this->result.ul_int = 0;
|
||||
++this;
|
||||
}
|
||||
} // end: cleanup_stack
|
||||
|
@ -62,7 +62,7 @@ enum meminfo_item {
|
||||
PROCPS_MEMINFO_MEM_UNEVICTABLE, // ul_int
|
||||
PROCPS_MEMINFO_MEM_USED, // ul_int
|
||||
PROCPS_MEMINFO_MEM_VM_ALLOC_CHUNK, // ul_int
|
||||
PROCPS_MEMINFO_MEM_VM_ALLOC_TOTAL, // ull_int
|
||||
PROCPS_MEMINFO_MEM_VM_ALLOC_TOTAL, // ul_int
|
||||
PROCPS_MEMINFO_MEM_VM_ALLOC_USED, // ul_int
|
||||
PROCPS_MEMINFO_MEM_WRITEBACK, // ul_int
|
||||
PROCPS_MEMINFO_MEM_WRITEBACK_TMP, // ul_int
|
||||
@ -102,7 +102,7 @@ enum meminfo_item {
|
||||
PROCPS_MEMINFO_DELTA_UNEVICTABLE, // s_int
|
||||
PROCPS_MEMINFO_DELTA_USED, // s_int
|
||||
PROCPS_MEMINFO_DELTA_VM_ALLOC_CHUNK, // s_int
|
||||
PROCPS_MEMINFO_DELTA_VM_ALLOC_TOTAL, // sl_int
|
||||
PROCPS_MEMINFO_DELTA_VM_ALLOC_TOTAL, // s_int
|
||||
PROCPS_MEMINFO_DELTA_VM_ALLOC_USED, // s_int
|
||||
PROCPS_MEMINFO_DELTA_WRITEBACK, // s_int
|
||||
PROCPS_MEMINFO_DELTA_WRITEBACK_TMP, // s_int
|
||||
@ -126,10 +126,8 @@ struct procps_meminfo;
|
||||
struct meminfo_result {
|
||||
enum meminfo_item item;
|
||||
union {
|
||||
signed int s_int;
|
||||
signed long sl_int;
|
||||
unsigned long ul_int;
|
||||
unsigned long long ull_int;
|
||||
signed int s_int;
|
||||
unsigned long ul_int;
|
||||
} result;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user