diff options
author | Christian Göttsche <cgzones@googlemail.com> | 2020-10-15 22:37:02 +0200 |
---|---|---|
committer | Christian Göttsche <cgzones@googlemail.com> | 2020-10-19 14:42:35 +0200 |
commit | 361877454fe56c95a995d5bdbb7eb70c21e39d62 (patch) | |
tree | 51f75a8ab66ece247dbbec3c673409028bdbec74 /CRT.c | |
parent | 0db398d4c3472071b2814505242450cd8f831501 (diff) |
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.
Diffstat (limited to 'CRT.c')
-rw-r--r-- | CRT.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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() { |