1
0
mirror of https://github.com/golang/go synced 2024-11-26 18:16:48 -07:00

runtime: handle locked mmap failure on Linux

Used to then die on a nil pointer situation. Most Linux standard setups are rather
restrictive regarding the default amount of lockable memory.

R=minux.ma, rsc
CC=golang-dev
https://golang.org/cl/6997049
This commit is contained in:
Sébastien Paolacci 2012-12-29 14:34:06 -05:00 committed by Russ Cox
parent 975bf6d323
commit e786829e83

View File

@ -10,6 +10,7 @@
enum
{
EAGAIN = 11,
ENOMEM = 12,
_PAGE_SIZE = 4096,
};
@ -63,6 +64,10 @@ runtime·SysAlloc(uintptr n)
runtime·printf("if you're running SELinux, enable execmem for this process.\n");
runtime·exit(2);
}
if(p == (void*)EAGAIN) {
runtime·printf("runtime: mmap: too much locked memory (check 'ulimit -l').\n");
runtime·exit(2);
}
return nil;
}
return p;