From 973c2b13fe82d6ebd030cd58869fa237b1fe5370 Mon Sep 17 00:00:00 2001 From: jdybnis Date: Mon, 9 Feb 2009 04:57:07 +0000 Subject: [PATCH] Mac OS fix --- makefile | 2 +- runtime/mem.c | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/makefile b/makefile index dbb0b8d..9bfac5d 100644 --- a/makefile +++ b/makefile @@ -4,7 +4,7 @@ ################################################################################################### # Makefile for building programs with whole-program interfile optimization ################################################################################################### -CFLAGS0 := -Wall -Werror -std=gnu99 -lpthread #-m32 -DNBD32 +CFLAGS0 := -Wall -Werror -std=gnu99 -lpthread -m64 #-m32 -DNBD32 CFLAGS1 := $(CFLAGS0) -g #-O3 #-DNDEBUG #-fwhole-program -combine CFLAGS2 := $(CFLAGS1) #-DENABLE_TRACE CFLAGS3 := $(CFLAGS2) #-DLIST_USE_HAZARD_POINTER diff --git a/runtime/mem.c b/runtime/mem.c index 7ffda43..a2dac2d 100644 --- a/runtime/mem.c +++ b/runtime/mem.c @@ -89,7 +89,7 @@ static void *get_new_region (int block_scale) { if (region_size < PAGE_SIZE) { region_size = PAGE_SIZE; } - void *region = mmap(NULL, region_size, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0); + void *region = mmap(NULL, region_size, PROT_READ|PROT_WRITE, MAP_NORESERVE|MAP_ANON|MAP_PRIVATE, -1, 0); TRACE("m1", "get_new_region: mmapped new region %p (size %p)", region, region_size); if (region == (void *)-1) { perror("get_new_region: mmap"); @@ -133,9 +133,8 @@ void mem_init (void) { // Allocate space for the page headers. This could be a big chunk of memory on 64 bit systems, // but it just takes up virtual address space. Physical space used by the headers is still // proportional to the amount of memory the user mallocs. - headers_ = (header_t *)malloc(HEADERS_SIZE); + headers_ = mmap(NULL, HEADERS_SIZE, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0); TRACE("m1", "mem_init: header page %p", headers_, 0); - memset(headers_, 0, HEADERS_SIZE); // initialize spsc queues for (int i = 0; i < MAX_NUM_THREADS; ++i) { -- 2.40.0