From 0acb9dfe4d8c27b8e6be6ddf3943fbb9b7e4b52f Mon Sep 17 00:00:00 2001 From: nick black Date: Mon, 6 Dec 2021 06:57:10 -0500 Subject: [PATCH] use sysconf(_SC_PAGESIZE) --- src/man/main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/man/main.c b/src/man/main.c index e66fcad31..42bfd0504 100644 --- a/src/man/main.c +++ b/src/man/main.c @@ -122,7 +122,12 @@ map_troff_data(int fd, size_t* len){ // the last four bytes have the uncompressed length uint32_t ulen; memcpy(&ulen, buf + *len - 4, 4); - size_t pgsize = 4096; // FIXME + long sc = sysconf(_SC_PAGESIZE); + if(sc <= 0){ + fprintf(stderr, "couldn't get page size\n"); + return NULL; + } + size_t pgsize = sc; void* ubuf = mmap(NULL, (ulen + pgsize - 1) / pgsize * pgsize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0); if(ubuf == MAP_FAILED){