]> pd.if.org Git - nbds/commitdiff
Mac OS fix
authorjdybnis <jdybnis@9ec2166a-aeea-11dd-8830-69e4bb380a4a>
Mon, 9 Feb 2009 04:57:07 +0000 (04:57 +0000)
committerjdybnis <jdybnis@9ec2166a-aeea-11dd-8830-69e4bb380a4a>
Mon, 9 Feb 2009 04:57:07 +0000 (04:57 +0000)
makefile
runtime/mem.c

index dbb0b8db987ffd01e9621506ab1e8c1f2db04578..9bfac5d69b685fbcccbb28ba6c0cb257885a3316 100644 (file)
--- 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 
index 7ffda4378208bb60daa78d29577bace2b634bfd3..a2dac2dfaf61a99dfde17cac17e57f6515a3470f 100644 (file)
@@ -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) {