mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 09:18:00 +08:00
libc: unistd: lib_getrlimit: return a value for RLIMIT_NOFILE request.
In the Nim language "selectors"(I/O multiplexing) module, the maximum
number of file descriptors is obtained with getrlimit() as follows.
var fdLim: RLimit
var res = int(getrlimit(RLIMIT_NOFILE, fdLim))
if res >= 0:
res = int(fdLim.rlim_cur) - 1
To be able to use the same implementation as other POSIX-based OS,
getrlimit() should return a value.
(For now, let it return 128.)
Signed-off-by: Takeyoshi Kikuchi <kikuchi@centurysys.co.jp>
This commit is contained in:
committed by
Xiang Xiao
parent
fff0e58860
commit
2e5a20612c
@@ -55,5 +55,19 @@ int getrlimit(int resource, FAR struct rlimit *rlp)
|
||||
/* This is a dummy realization to make the compiler happy */
|
||||
|
||||
memset(rlp, 0, sizeof(*rlp));
|
||||
|
||||
switch (resource)
|
||||
{
|
||||
case RLIMIT_NOFILE:
|
||||
{
|
||||
rlp->rlim_cur = 128;
|
||||
rlp->rlim_max = 1024 * 1024; /* dummy */
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user