Commit 28f65bf4 authored by Joel Sing's avatar Joel Sing

runtime: improve mmap return value checking for netbsd/openbsd

Rather than just checking for ENOMEM, check for a return value of less
than 4096, so that we catch other errors such as EACCES and EINVAL.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7942043
parent d8813313
......@@ -50,7 +50,7 @@ runtime·SysReserve(void *v, uintptr n)
return v;
p = runtime·mmap(v, n, PROT_NONE, MAP_ANON|MAP_PRIVATE, -1, 0);
if(p == (void*)ENOMEM)
if(p < (void*)4096)
return nil;
return p;
}
......
......@@ -50,7 +50,7 @@ runtime·SysReserve(void *v, uintptr n)
return v;
p = runtime·mmap(v, n, PROT_NONE, MAP_ANON|MAP_PRIVATE, -1, 0);
if(p == (void*)ENOMEM)
if(p < (void*)4096)
return nil;
return p;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment