]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
STABLE12-rx-lwp-fdsetsize-20040708
authorJeffrey Hutzelman <jhutz@cmu.edu>
Mon, 18 Oct 2004 06:52:23 +0000 (06:52 +0000)
committerDerrick Brashear <shadow@dementia.org>
Mon, 18 Oct 2004 06:52:23 +0000 (06:52 +0000)
FIXES 5615

limit our fd set size so we don't "lose" fds.

(cherry picked from commit 775933e89544da31c0cf22cd0937614f5616c50e)

src/lwp/iomgr.c
src/rx/rx_globals.c
src/rx/rx_lwp.c
src/vol/fssync.c

index f5d176b72164c57330147b4dbc2fccf661d3716d..e5dfcbd028324946c032a8b4aab34827fc2ac5b1 100644 (file)
        IO Manager routines & server process for VICE server.
 */
 
+/* This controls the size of an fd_set; it must be defined early before
+ * the system headers define that type and the macros that operate on it.
+ * Its value should be as large as the maximum file descriptor limit we
+ * are likely to run into on any platform.  Right now, that is 65536
+ * which is the default hard fd limit on Solaris 9 */
+/* We don't do this on Windows because on that platform there is code
+ * which allocates fd_set's on the stack (IOMGR_Sleep on Win9x, and
+ * FDSetAnd on WinNT) */
+#ifndef _WIN32
+#define FD_SETSIZE 65536
+#endif
 #include <afsconfig.h>
 #include <afs/param.h>
 
@@ -177,7 +189,7 @@ static _go32_dpmi_seginfo callback_info;
 
 /* fd_set pool managment. 
  * Use the pool instead of creating fd_set's on the stack. fd_set's can be
- * 2K in size, so making three could put 6K in the limited space of an LWP
+ * 8K in size, so making three could put 24K in the limited space of an LWP
  * stack.
  */
 struct IOMGR_fd_set {
index 4d7701c0c6cc4e3faca7d941c834f75ea020d3fc..e77cfa647654b073a0f7665c1cca684f73559c29 100644 (file)
@@ -9,6 +9,13 @@
 
 /* RX:  Globals for internal use, basically */
 
+/* This controls the size of an fd_set; it must be defined early before
+ * the system headers define that type and the macros that operate on it.
+ * Its value should be as large as the maximum file descriptor limit we
+ * are likely to run into on any platform.  Right now, that is 65536
+ * which is the default hard fd limit on Solaris 9 */
+#define FD_SETSIZE 65536
 #include <afsconfig.h>
 #ifdef KERNEL
 #include "../afs/param.h"
index 0e6ffb557bb20925831992840825b68f027a6aee..dad356051fd32314ebab7af7a9eeab9c40ceeef1 100644 (file)
@@ -9,6 +9,13 @@
 
 /* rx_user.c contains routines specific to the user space UNIX implementation of rx */
 
+/* This controls the size of an fd_set; it must be defined early before
+ * the system headers define that type and the macros that operate on it.
+ * Its value should be as large as the maximum file descriptor limit we
+ * are likely to run into on any platform.  Right now, that is 65536
+ * which is the default hard fd limit on Solaris 9 */
+#define FD_SETSIZE 65536
 #include <afsconfig.h>
 #include <afs/param.h>
 
index 701c31ed38cb0c7e019b65aa7feb53ea8fc8681d..411d6f03243e2456dab9b78db1e2a3d0bc129add 100644 (file)
@@ -35,6 +35,14 @@ static int newVLDB = 1;
    fsync.c
    File server synchronization with external volume utilities.
  */
+
+/* This controls the size of an fd_set; it must be defined early before
+ * the system headers define that type and the macros that operate on it.
+ * Its value should be as large as the maximum file descriptor limit we
+ * are likely to run into on any platform.  Right now, that is 65536
+ * which is the default hard fd limit on Solaris 9 */
+#define FD_SETSIZE 65536
 #include <afsconfig.h>
 #include <afs/param.h>
 
@@ -246,6 +254,8 @@ static int getport(addr)
     return sd;
 }
 
+static fd_set FSYNC_readfds;
 static void FSYNC_sync() {
     struct sockaddr_in addr;
     int on = 1;
@@ -293,18 +303,17 @@ static void FSYNC_sync() {
     InitHandler();
     AcceptOn();
     for(;;) {
-       fd_set readfds;
        int maxfd;
-       GetHandler(&readfds, &maxfd);
+       GetHandler(&FSYNC_readfds, &maxfd);
        /* Note: check for >= 1 below is essential since IOMGR_select
         * doesn't have exactly same semantics as select.
         */
 #ifdef AFS_PTHREAD_ENV
-        if (select(maxfd+1, &readfds, NULL, NULL, NULL) >= 1)
+       if (select(maxfd + 1, &FSYNC_readfds, NULL, NULL, NULL) >= 1)
 #else /* AFS_PTHREAD_ENV */
-        if (IOMGR_Select(maxfd+1, &readfds, NULL, NULL, NULL) >= 1)
+       if (IOMGR_Select(maxfd + 1, &FSYNC_readfds, NULL, NULL, NULL) >= 1)
 #endif /* AFS_PTHREAD_ENV */
-            CallHandler(&readfds);
+           CallHandler(&FSYNC_readfds);
     }
 }