summaryrefslogtreecommitdiffstats
path: root/CRT.c
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2020-10-15 22:37:02 +0200
committerChristian Göttsche <cgzones@googlemail.com>2020-10-19 14:42:35 +0200
commit361877454fe56c95a995d5bdbb7eb70c21e39d62 (patch)
tree51f75a8ab66ece247dbbec3c673409028bdbec74 /CRT.c
parent0db398d4c3472071b2814505242450cd8f831501 (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.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/CRT.c b/CRT.c
index d3afd0ec..f6321f4c 100644
--- a/CRT.c
+++ b/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() {

© 2014-2024 Faster IT GmbH | imprint | privacy policy