Cygwin: sysconf, getrlimit: don't call getdtablesize
Now that getdtablesize always returns OPEN_MAX_MAX, we can simplify sysconf(_SC_OPEN_MAX) and getrlimit(RLIMIT_NOFILE) to just use that same constant instead of calling getdtablesize.
This commit is contained in:
parent
3d256e22e2
commit
b9cbc49b70
|
@ -182,10 +182,7 @@ getrlimit (int resource, struct rlimit *rlp)
|
||||||
__get_rlimit_stack (rlp);
|
__get_rlimit_stack (rlp);
|
||||||
break;
|
break;
|
||||||
case RLIMIT_NOFILE:
|
case RLIMIT_NOFILE:
|
||||||
rlp->rlim_cur = getdtablesize ();
|
rlp->rlim_cur = rlp->rlim_max = OPEN_MAX_MAX;
|
||||||
if (rlp->rlim_cur < OPEN_MAX)
|
|
||||||
rlp->rlim_cur = OPEN_MAX;
|
|
||||||
rlp->rlim_max = OPEN_MAX_MAX;
|
|
||||||
break;
|
break;
|
||||||
case RLIMIT_CORE:
|
case RLIMIT_CORE:
|
||||||
rlp->rlim_cur = cygheap->rlim_core;
|
rlp->rlim_cur = cygheap->rlim_core;
|
||||||
|
|
|
@ -21,15 +21,6 @@ details. */
|
||||||
#include "cpuid.h"
|
#include "cpuid.h"
|
||||||
#include "clock.h"
|
#include "clock.h"
|
||||||
|
|
||||||
static long
|
|
||||||
get_open_max (int in)
|
|
||||||
{
|
|
||||||
long max = getdtablesize ();
|
|
||||||
if (max < OPEN_MAX)
|
|
||||||
max = OPEN_MAX;
|
|
||||||
return max;
|
|
||||||
}
|
|
||||||
|
|
||||||
static long
|
static long
|
||||||
get_page_size (int in)
|
get_page_size (int in)
|
||||||
{
|
{
|
||||||
|
@ -520,7 +511,7 @@ static struct
|
||||||
{cons, {c:CHILD_MAX}}, /* 1, _SC_CHILD_MAX */
|
{cons, {c:CHILD_MAX}}, /* 1, _SC_CHILD_MAX */
|
||||||
{cons, {c:CLOCKS_PER_SEC}}, /* 2, _SC_CLK_TCK */
|
{cons, {c:CLOCKS_PER_SEC}}, /* 2, _SC_CLK_TCK */
|
||||||
{cons, {c:NGROUPS_MAX}}, /* 3, _SC_NGROUPS_MAX */
|
{cons, {c:NGROUPS_MAX}}, /* 3, _SC_NGROUPS_MAX */
|
||||||
{func, {f:get_open_max}}, /* 4, _SC_OPEN_MAX */
|
{cons, {c:OPEN_MAX_MAX}}, /* 4, _SC_OPEN_MAX */
|
||||||
{cons, {c:_POSIX_JOB_CONTROL}}, /* 5, _SC_JOB_CONTROL */
|
{cons, {c:_POSIX_JOB_CONTROL}}, /* 5, _SC_JOB_CONTROL */
|
||||||
{cons, {c:_POSIX_SAVED_IDS}}, /* 6, _SC_SAVED_IDS */
|
{cons, {c:_POSIX_SAVED_IDS}}, /* 6, _SC_SAVED_IDS */
|
||||||
{cons, {c:_POSIX_VERSION}}, /* 7, _SC_VERSION */
|
{cons, {c:_POSIX_VERSION}}, /* 7, _SC_VERSION */
|
||||||
|
|
Loading…
Reference in New Issue