mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-14 04:54:37 +03:00
Cache PAGE_SIZE
man:sysconf(3) states: The values obtained from these functions are system configuration constants. They do not change during the lifetime of a process.
This commit is contained in:
7
CRT.c
7
CRT.c
@ -544,6 +544,9 @@ const char* CRT_termType;
|
||||
|
||||
int CRT_colorScheme = 0;
|
||||
|
||||
long CRT_pageSize = -1;
|
||||
long CRT_pageSizeKB = -1;
|
||||
|
||||
ATTR_NORETURN
|
||||
static void CRT_handleSIGTERM(int sgn) {
|
||||
(void) sgn;
|
||||
@ -675,6 +678,10 @@ void CRT_init(int delay, int colorScheme, bool allowUnicode) {
|
||||
mousemask(BUTTON1_RELEASED, NULL);
|
||||
#endif
|
||||
|
||||
CRT_pageSize = sysconf(_SC_PAGESIZE);
|
||||
if (CRT_pageSize == -1)
|
||||
CRT_fatalError("Fatal error: Can not get PAGE_SIZE by sysconf(_SC_PAGESIZE)");
|
||||
CRT_pageSizeKB = CRT_pageSize / 1024;
|
||||
}
|
||||
|
||||
void CRT_done() {
|
||||
|
Reference in New Issue
Block a user