mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-08 01:10:23 +00:00
use sysconf(_SC_PAGESIZE)
This commit is contained in:
parent
eab3ca981e
commit
0acb9dfe4d
@ -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){
|
||||
|
Loading…
Reference in New Issue
Block a user