OSDN Git Service

* resource.cc (getrlimit): Return OPEN_MAX as current limit
authorcorinna <corinna>
Thu, 16 Aug 2001 14:20:09 +0000 (14:20 +0000)
committercorinna <corinna>
Thu, 16 Aug 2001 14:20:09 +0000 (14:20 +0000)
        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.

winsup/cygwin/ChangeLog
winsup/cygwin/include/limits.h
winsup/cygwin/resource.cc
winsup/cygwin/syscalls.cc
winsup/cygwin/sysconf.cc

index dd49aaa..c3df032 100644 (file)
@@ -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
index 397ba20..4a2ad3a 100644 (file)
@@ -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.
index c56fb77..3ee6c57 100644 (file)
@@ -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;
index 9fbd7f8..8e34825 100644 (file)
@@ -1445,7 +1445,7 @@ setdtablesize (int size)
 extern "C" int
 getdtablesize ()
 {
-  return cygheap->fdtab.size;
+  return OPEN_MAX;
 }
 
 extern "C" size_t
index b3cad25..5c930fb 100644 (file)
@@ -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: