#define LSTCHK_NETADM 0x00000004 /* check that we have CAP_NET_ADMIN */
#define LSTCHK_TCPSPLICE 0x00000008 /* check that linux tcp_splice is enabled */
+/* Global tuning options */
+/* available polling mechanisms */
+#define GTUNE_USE_SELECT (1<<0)
+#define GTUNE_USE_POLL (1<<1)
+#define GTUNE_USE_EPOLL (1<<2)
+#define GTUNE_USE_KQUEUE (1<<3)
+#define GTUNE_USE_SEPOLL (1<<4)
+
+
/* FIXME : this will have to be redefined correctly */
struct global {
int uid;
struct {
int maxpollevents; /* max number of poll events at once */
int maxaccept; /* max number of consecutive accept() */
+ int options; /* various tuning options */
} tune;
struct listener stats_sock; /* unix socket listener for statistics */
int stats_timeout; /* in ticks */
+++ /dev/null
-/*
- include/types/polling.h
- File descriptors and polling definitions.
-
- Copyright (C) 2000-2007 Willy Tarreau - w@1wt.eu
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation, version 2.1
- exclusively.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-#ifndef _TYPES_POLLING_H
-#define _TYPES_POLLING_H
-
-/* for fd_set */
-#include <sys/time.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <common/config.h>
-
-/* poll mechanisms available */
-#define POLL_USE_SELECT (1<<0)
-#define POLL_USE_POLL (1<<1)
-#define POLL_USE_EPOLL (1<<2)
-#define POLL_USE_KQUEUE (1<<3)
-#define POLL_USE_SEPOLL (1<<4)
-
-extern int cfg_polling_mechanism; /* POLL_USE_{SELECT|POLL|EPOLL|KQUEUE|SEPOLL} */
-
-
-#endif /* _TYPES_POLLING_H */
-
-/*
- * Local variables:
- * c-indent-level: 8
- * c-basic-offset: 8
- * End:
- */
#include <types/capture.h>
#include <types/global.h>
-#include <types/polling.h>
#include <proto/acl.h>
#include <proto/backend.h>
global.mode |= MODE_DEBUG;
}
else if (!strcmp(args[0], "noepoll")) {
- cfg_polling_mechanism &= ~POLL_USE_EPOLL;
+ global.tune.options &= ~GTUNE_USE_EPOLL;
}
else if (!strcmp(args[0], "nosepoll")) {
- cfg_polling_mechanism &= ~POLL_USE_SEPOLL;
+ global.tune.options &= ~GTUNE_USE_SEPOLL;
}
else if (!strcmp(args[0], "nokqueue")) {
- cfg_polling_mechanism &= ~POLL_USE_KQUEUE;
+ global.tune.options &= ~GTUNE_USE_KQUEUE;
}
else if (!strcmp(args[0], "nopoll")) {
- cfg_polling_mechanism &= ~POLL_USE_POLL;
+ global.tune.options &= ~GTUNE_USE_POLL;
}
else if (!strcmp(args[0], "quiet")) {
global.mode |= MODE_QUIET;
int totalconn; /* total # of terminated sessions */
int actconn; /* # of active sessions */
-int cfg_polling_mechanism = 0; /* POLL_USE_{SELECT|POLL|EPOLL} */
-
struct poller pollers[MAX_POLLERS];
struct poller cur_poller;
int nbpollers = 0;
#include <types/capture.h>
#include <types/global.h>
-#include <types/polling.h>
#include <proto/acl.h>
#include <proto/backend.h>
init_pendconn();
init_proto_http();
- cfg_polling_mechanism = POLL_USE_SELECT; /* select() is always available */
+ global.tune.options |= GTUNE_USE_SELECT; /* select() is always available */
#if defined(ENABLE_POLL)
- cfg_polling_mechanism |= POLL_USE_POLL;
+ global.tune.options |= GTUNE_USE_POLL;
#endif
#if defined(ENABLE_EPOLL)
- cfg_polling_mechanism |= POLL_USE_EPOLL;
+ global.tune.options |= GTUNE_USE_EPOLL;
#endif
#if defined(ENABLE_SEPOLL)
- cfg_polling_mechanism |= POLL_USE_SEPOLL;
+ global.tune.options |= GTUNE_USE_SEPOLL;
#endif
#if defined(ENABLE_KQUEUE)
- cfg_polling_mechanism |= POLL_USE_KQUEUE;
+ global.tune.options |= GTUNE_USE_KQUEUE;
#endif
pid = getpid();
}
#if defined(ENABLE_EPOLL)
else if (*flag == 'd' && flag[1] == 'e')
- cfg_polling_mechanism &= ~POLL_USE_EPOLL;
+ global.tune.options &= ~GTUNE_USE_EPOLL;
#endif
#if defined(ENABLE_SEPOLL)
else if (*flag == 'd' && flag[1] == 's')
- cfg_polling_mechanism &= ~POLL_USE_SEPOLL;
+ global.tune.options &= ~GTUNE_USE_SEPOLL;
#endif
#if defined(ENABLE_POLL)
else if (*flag == 'd' && flag[1] == 'p')
- cfg_polling_mechanism &= ~POLL_USE_POLL;
+ global.tune.options &= ~GTUNE_USE_POLL;
#endif
#if defined(ENABLE_KQUEUE)
else if (*flag == 'd' && flag[1] == 'k')
- cfg_polling_mechanism &= ~POLL_USE_KQUEUE;
+ global.tune.options &= ~GTUNE_USE_KQUEUE;
#endif
else if (*flag == 'V')
arg_mode |= MODE_VERBOSE;
* Built-in pollers have been registered before main().
*/
- if (!(cfg_polling_mechanism & POLL_USE_KQUEUE))
+ if (!(global.tune.options & GTUNE_USE_KQUEUE))
disable_poller("kqueue");
- if (!(cfg_polling_mechanism & POLL_USE_EPOLL))
+ if (!(global.tune.options & GTUNE_USE_EPOLL))
disable_poller("epoll");
- if (!(cfg_polling_mechanism & POLL_USE_SEPOLL))
+ if (!(global.tune.options & GTUNE_USE_SEPOLL))
disable_poller("sepoll");
- if (!(cfg_polling_mechanism & POLL_USE_POLL))
+ if (!(global.tune.options & GTUNE_USE_POLL))
disable_poller("poll");
- if (!(cfg_polling_mechanism & POLL_USE_SELECT))
+ if (!(global.tune.options & GTUNE_USE_SELECT))
disable_poller("select");
/* Note: we could disable any poller by name here */