Localize FD_SETSIZE manipulation to engine_select.c.
authorMichael Poole <mdpoole@troilus.org>
Tue, 12 Jul 2005 02:13:10 +0000 (02:13 +0000)
committerMichael Poole <mdpoole@troilus.org>
Tue, 12 Jul 2005 02:13:10 +0000 (02:13 +0000)
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1442 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
include/sys.h
ircd/engine_select.c
ircd/s_bsd.c

index ec391ab422821fe9789463098798ef3f148aca84..a468cb27cc047bab31f6960a686008aefae3fc7e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2005-07-11  Reed Loden <reed@reedloden.com>
+
+       * include/sys.h: Move FD_SETSIZE redefinition to engine_select.c.
+
+       * ircd/s_bsd.c: Move FD_SETSIZE sanity check to engine_select.c
+       Remove unused #include <sys/poll.h>.
+
+       * ircd/engine_select.c: Put FD_SETSIZE redefinition and sanity
+       checks here, since they are not used elsewhere in the daemon.
+       [Order slightly changed by Michael Poole to compile.]
+
 2005-07-03  Michael Poole <mdpoole@troilus.org>
 
        * ircd/convert-conf.c: New file.
index 7faef89e6bab2c8d6e2877e66b6b424c3deabfab..f3845e056eac57cf088d4301c7c2ba444c4b0b93 100644 (file)
  */
 #define MAXCLIENTS      (MAXCONNECTIONS-24)
 
-/* Define FD_SETSIZE to what we want before including sys/types.h on BSD */
-#if  defined(__FreeBSD__) || defined(__NetBSD__) || defined(__bsdi__)
-#if ((!defined(USE_POLL)) && (!defined(FD_SETSIZE)))
-#define FD_SETSIZE ((MAXCONNECTIONS)+4)
-#endif
-#endif
-
 #define IRCD_MAX(a, b)  ((a) > (b) ? (a) : (b))
 #define IRCD_MIN(a, b)  ((a) < (b) ? (a) : (b))
 
index 205283c052880437be380ec9f62d4d182d8a19e5..efb38c28aaff2fa925d978ab543d7b2fabe8fb19 100644 (file)
  */
 #include "config.h"
 
-#include "ircd_events.h"
-
-#include "ircd.h"
-#include "ircd_log.h"
-#include "s_debug.h"
-
 /* On BSD, define FD_SETSIZE to what we want before including sys/types.h */
 #if  defined(__FreeBSD__) || defined(__NetBSD__) || defined(__bsdi__)
 # if !defined(FD_SETSIZE)
-#  define FD_SETSIZE   MAXCONNECTIONS
+#  define FD_SETSIZE ((MAXCONNECTIONS)+4)
 # endif
 #endif
 
+#include "ircd_events.h"
+
+#include "ircd.h"
+#include "ircd_log.h"
+#include "s_debug.h"
+
 /* #include <assert.h> -- Now using assert in ircd_log.h */
 #include <errno.h>
 #include <string.h> /* needed for bzero() on OS X */
 #include <time.h>
 #include <unistd.h>
 
+#if FD_SETSIZE < (MAXCONNECTIONS + 4)
+/*
+ * Sanity check
+ *
+ * All operating systems work when MAXCONNECTIONS <= 252.
+ * Most operating systems work when MAXCONNECTIONS <= 1020 and FD_SETSIZE is
+ *   updated correctly in the system headers (on BSD systems sys/types.h might
+ *   have abruptly redefined it so the check is still done), you might
+ *   already need to recompile your kernel.
+ * For larger FD_SETSIZE your mileage may vary (kernel patches may be needed).
+ * The check is _NOT_ done if we will not use FD_SETS at all (USE_POLL)
+ */
+# error FD_SETSIZE is too small or MAXCONNECTIONS too large.
+#endif
+
 #define SELECT_ERROR_THRESHOLD 20      /**< after 20 select errors, restart */
 #define ERROR_EXPIRE_TIME      3600    /**< expire errors after an hour */
 
index 2a57382856f66d4030e6eedfc7fe67c96906602c..6ce42154deed60315319f03f0d949cdfe5be15c0 100644 (file)
 #include <sys/utsname.h>
 #include <unistd.h>
 
-#ifdef USE_POLL
-#include <sys/poll.h>
-#endif /* USE_POLL */
-
 /** Array of my own clients, indexed by file descriptor. */
 struct Client*            LocalClientArray[MAXCONNECTIONS];
 /** Maximum file descriptor in current use. */
@@ -108,24 +104,6 @@ const char* const TOS_ERROR_MSG          = "error setting TOS for %s: %s";
 static void client_sock_callback(struct Event* ev);
 static void client_timer_callback(struct Event* ev);
 
-#if !defined(USE_POLL)
-#if FD_SETSIZE < (MAXCONNECTIONS + 4)
-/*
- * Sanity check
- *
- * All operating systems work when MAXCONNECTIONS <= 252.
- * Most operating systems work when MAXCONNECTIONS <= 1020 and FD_SETSIZE is
- *   updated correctly in the system headers (on BSD systems our sys.h has
- *   defined FD_SETSIZE to MAXCONNECTIONS+4 before including the system's headers 
- *   but sys/types.h might have abruptly redefined it so the check is still 
- *   done), you might already need to recompile your kernel.
- * For larger FD_SETSIZE your mileage may vary (kernel patches may be needed).
- * The check is _NOT_ done if we will not use FD_SETS at all (USE_POLL)
- */
-#error "FD_SETSIZE is too small or MAXCONNECTIONS too large."
-#endif
-#endif
-
 
 /*
  * Cannot use perror() within daemon. stderr is closed in