noux: handle more libc getrlimit parameters

- we claim to have no limits on file handles and number of threads
- remove obsolete Thread_base::myself fall-back code for stack size calculation

Issue #1733.
This commit is contained in:
Alexander Boettcher 2015-10-06 11:53:44 +02:00 committed by Christian Helmuth
parent 2e62543fdb
commit a608d48ddf
1 changed files with 10 additions and 8 deletions

View File

@ -282,16 +282,14 @@ extern "C" int getrlimit(int resource, struct rlimit *rlim)
using namespace Genode;
Thread_base * me = Thread_base::myself();
if (me) {
addr_t top = reinterpret_cast<addr_t>(me->stack_top());
addr_t cur = reinterpret_cast<addr_t>(me->stack_base());
rlim->rlim_cur = rlim->rlim_max = top - cur;
return 0;
}
if (!me)
break;
/* XXX - fix Thread_base::myself to be working also for main thread */
rlim->rlim_cur = rlim->rlim_max = 64 * 1024;
addr_t top = reinterpret_cast<addr_t>(me->stack_top());
addr_t cur = reinterpret_cast<addr_t>(me->stack_base());
rlim->rlim_cur = rlim->rlim_max = top - cur;
return 0;
}
case RLIMIT_AS:
@ -304,6 +302,10 @@ extern "C" int getrlimit(int resource, struct rlimit *rlim)
case RLIMIT_RSS:
rlim->rlim_cur = rlim->rlim_max = Genode::env()->ram_session()->quota();
return 0;
case RLIMIT_NPROC:
case RLIMIT_NOFILE:
rlim->rlim_cur = rlim->rlim_max = RLIM_INFINITY;
return 0;
}
errno = ENOSYS;
PDBG("not implemented %d", resource);