diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2001-08-16 18:20:09 +0400 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2001-08-16 18:20:09 +0400 |
commit | 3171175e90d908fd5be0da43af7aa427701d45b6 (patch) | |
tree | 39c083e9990369ccf70baad8ede312404504fcad /winsup | |
parent | 91a1423a877aa2464b290cc42f362ffa6f46d434 (diff) |
* resource.cc (getrlimit): Return OPEN_MAX as current limit
on RLIMIT_NOFILE.
* syscalls.cc (getdtablesize): Return OPEN_MAX.
* sysconf.cc (sysconf): Return OPEN_MAX on _SC_OPEN_MAX.
* include/limits.h (OPEN_MAX): Define as 256.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 8 | ||||
-rw-r--r-- | winsup/cygwin/include/limits.h | 7 | ||||
-rw-r--r-- | winsup/cygwin/resource.cc | 3 | ||||
-rw-r--r-- | winsup/cygwin/syscalls.cc | 2 | ||||
-rw-r--r-- | winsup/cygwin/sysconf.cc | 5 |
5 files changed, 20 insertions, 5 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index dd49aaa30..c3df032d4 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,11 @@ +Thu Aug 16 16:17:00 2001 Corinna Vinschen <corinna@vinschen.de> + + * resource.cc (getrlimit): Return OPEN_MAX as current limit + on RLIMIT_NOFILE. + * syscalls.cc (getdtablesize): Return OPEN_MAX. + * sysconf.cc (sysconf): Return OPEN_MAX on _SC_OPEN_MAX. + * include/limits.h (OPEN_MAX): Define as 256. + Wed Aug 15 12:43:00 2001 Corinna Vinschen <corinna@vinschen.de> * times.cc (utimes): Revert previous change. Just open the diff --git a/winsup/cygwin/include/limits.h b/winsup/cygwin/include/limits.h index 397ba2030..4a2ad3a8d 100644 --- a/winsup/cygwin/include/limits.h +++ b/winsup/cygwin/include/limits.h @@ -122,6 +122,13 @@ details. */ This limits how many children we can fork/spawn off. */ #define CHILD_MAX 63 +/* # of open files per process. Actually it can be more since Cygwin + grows the dtable as necessary. We define a reasonable limit here + which is returned by getdtablesize(), sysconf(_SC_OPEN_MAX) and + getrlimit(RLIMIT_NOFILE). */ +#undef OPEN_MAX +#define OPEN_MAX 256 + /* POSIX values */ /* These should never vary from one system type to another */ /* They represent the minimum values that POSIX systems must support. diff --git a/winsup/cygwin/resource.cc b/winsup/cygwin/resource.cc index c56fb77fd..3ee6c57da 100644 --- a/winsup/cygwin/resource.cc +++ b/winsup/cygwin/resource.cc @@ -15,6 +15,7 @@ details. */ #include "winsup.h" #include <errno.h> #include <unistd.h> +#include <limits.h> #include "cygerrno.h" #include "sync.h" #include "sigproc.h" @@ -117,7 +118,9 @@ getrlimit (int resource, struct rlimit *rlp) case RLIMIT_FSIZE: case RLIMIT_DATA: case RLIMIT_STACK: + break; case RLIMIT_NOFILE: + rlp->rlim_cur = OPEN_MAX; break; case RLIMIT_CORE: rlp->rlim_cur = rlim_core; diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 9fbd7f833..8e34825e2 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -1445,7 +1445,7 @@ setdtablesize (int size) extern "C" int getdtablesize () { - return cygheap->fdtab.size; + return OPEN_MAX; } extern "C" size_t diff --git a/winsup/cygwin/sysconf.cc b/winsup/cygwin/sysconf.cc index b3cad2528..5c930fb22 100644 --- a/winsup/cygwin/sysconf.cc +++ b/winsup/cygwin/sysconf.cc @@ -33,10 +33,7 @@ sysconf (int in) /* FIXME: what's the right value? _POSIX_ARG_MAX is only 4K */ return 1048576; case _SC_OPEN_MAX: - /* FIXME: this returns the current limit which can increase - if and when dtable::find_unused_handle is called. Perhaps - we should return NOFILE or OPEN_MAX instead? */ - return cygheap->fdtab.size; + return OPEN_MAX; case _SC_PAGESIZE: return getpagesize (); case _SC_CLK_TCK: |