Skip to content
Snippets Groups Projects
Commit 11545281 authored by Pekka Enberg's avatar Pekka Enberg
Browse files

libc: Use pthread stack info for RLIMIT_STACK


Currently, RLIMIT_STACK is 64 KB.  This is too small for the JVM which
limits stack size to RLIMIT_STACK if a VMA range that covers address
found in '__libc_stack_end' in /proc/self/maps.

In preparation for procfs support, switch to pthread_attr_getstacksize()
for RLIMIT_STACK.

Reviewed-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
parent 1152ad98
No related branches found
No related tags found
No related merge requests found
......@@ -42,9 +42,15 @@ int getrlimit(int resource, struct rlimit *rlim)
{
auto set = [=] (rlim_t r) { rlim->rlim_cur = rlim->rlim_max = r; };
switch (resource) {
case RLIMIT_STACK:
set(64*1024); // FIXME: something realer
case RLIMIT_STACK: {
pthread_attr_t attr;
pthread_attr_init(&attr);
size_t stacksize;
pthread_attr_getstacksize(&attr, &stacksize);
set(stacksize);
pthread_attr_destroy(&attr);
break;
}
case RLIMIT_NOFILE:
set(1024*10); // FIXME: larger?
break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment