Commit 3d433960 by Ian Lance Taylor

runtime: Correct test of mmap return value.

From-SVN: r180731
parent 207c35fa
...@@ -85,6 +85,7 @@ void* ...@@ -85,6 +85,7 @@ void*
runtime_SysReserve(void *v, uintptr n) runtime_SysReserve(void *v, uintptr n)
{ {
int fd = -1; int fd = -1;
void *p;
// On 64-bit, people with ulimit -v set complain if we reserve too // On 64-bit, people with ulimit -v set complain if we reserve too
// much address space. Instead, assume that the reservation is okay // much address space. Instead, assume that the reservation is okay
...@@ -103,7 +104,11 @@ runtime_SysReserve(void *v, uintptr n) ...@@ -103,7 +104,11 @@ runtime_SysReserve(void *v, uintptr n)
fd = dev_zero; fd = dev_zero;
#endif #endif
return runtime_mmap(v, n, PROT_NONE, MAP_ANON|MAP_PRIVATE, fd, 0); p = runtime_mmap(v, n, PROT_NONE, MAP_ANON|MAP_PRIVATE, fd, 0);
if((uintptr)p < 4096 || -(uintptr)p < 4096) {
return nil;
}
return p;
} }
void void
......
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