]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: unbreak build on dragonfly
authorJoel Sing <jsing@google.com>
Mon, 9 Sep 2013 15:48:06 +0000 (08:48 -0700)
committerIan Lance Taylor <iant@golang.org>
Mon, 9 Sep 2013 15:48:06 +0000 (08:48 -0700)
Update dragonfly memory functions to work with new memory statistics.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/13615043

src/pkg/runtime/mem_dragonfly.c

index cc45cc96c115bb36e2ee989aa73992498bc01987..025b62ea6782d5c73e0a797d23403d32555d7e11 100644 (file)
@@ -14,14 +14,14 @@ enum
 };
 
 void*
-runtime·SysAlloc(uintptr n)
+runtime·SysAlloc(uintptr n, uint64 *stat)
 {
        void *v;
 
-       mstats.sys += n;
        v = runtime·mmap(nil, n, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0);
        if(v < (void*)4096)
                return nil;
+       runtime·xadd64(stat, n);
        return v;
 }
 
@@ -39,9 +39,9 @@ runtime·SysUsed(void *v, uintptr n)
 }
 
 void
-runtime·SysFree(void *v, uintptr n)
+runtime·SysFree(void *v, uintptr n, uint64 *stat)
 {
-       mstats.sys -= n;
+       runtime·xadd64(stat, -(uint64)n);
        runtime·munmap(v, n);
 }
 
@@ -63,11 +63,11 @@ runtime·SysReserve(void *v, uintptr n)
 }
 
 void
-runtime·SysMap(void *v, uintptr n)
+runtime·SysMap(void *v, uintptr n, uint64 *stat)
 {
        void *p;
        
-       mstats.sys += n;
+       runtime·xadd64(stat, n);
 
        // On 64-bit, we don't actually have v reserved, so tread carefully.
        if(sizeof(void*) == 8) {