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
This commit is contained in:
Joel Sing 2013-03-23 02:15:52 +11:00
parent d88133137b
commit 28f65bf4a2
2 changed files with 2 additions and 2 deletions

View File

@ -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;
}

View File

@ -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;
}