Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 1 | /* |
| 2 | include/types/polling.h |
| 3 | File descriptors and polling definitions. |
| 4 | |
| 5 | Copyright (C) 2000-2006 Willy Tarreau - w@1wt.eu |
| 6 | |
| 7 | This library is free software; you can redistribute it and/or |
| 8 | modify it under the terms of the GNU Lesser General Public |
| 9 | License as published by the Free Software Foundation, version 2.1 |
| 10 | exclusively. |
| 11 | |
| 12 | This library is distributed in the hope that it will be useful, |
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | Lesser General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU Lesser General Public |
| 18 | License along with this library; if not, write to the Free Software |
| 19 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | */ |
| 21 | |
| 22 | #ifndef _TYPES_POLLING_H |
| 23 | #define _TYPES_POLLING_H |
| 24 | |
| 25 | /* for fd_set */ |
| 26 | #include <sys/time.h> |
| 27 | #include <sys/types.h> |
| 28 | #include <unistd.h> |
| 29 | |
Willy Tarreau | 2dd0d47 | 2006-06-29 17:53:05 +0200 | [diff] [blame] | 30 | #include <common/config.h> |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 31 | |
| 32 | /* for POLL_* */ |
| 33 | #if defined(ENABLE_POLL) |
| 34 | #include <sys/poll.h> |
| 35 | #endif |
| 36 | |
| 37 | /* for EPOLL_* */ |
| 38 | #if defined(ENABLE_EPOLL) |
| 39 | #if !defined(USE_MY_EPOLL) |
| 40 | #include <sys/epoll.h> |
| 41 | #else |
Willy Tarreau | 2dd0d47 | 2006-06-29 17:53:05 +0200 | [diff] [blame] | 42 | #include <common/epoll.h> |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 43 | #endif |
| 44 | #endif |
| 45 | |
| 46 | /* possible actions for the *poll() loops */ |
| 47 | #define POLL_LOOP_ACTION_INIT 0 |
| 48 | #define POLL_LOOP_ACTION_RUN 1 |
| 49 | #define POLL_LOOP_ACTION_CLEAN 2 |
| 50 | |
| 51 | /* poll mechanisms available */ |
| 52 | #define POLL_USE_SELECT (1<<0) |
| 53 | #define POLL_USE_POLL (1<<1) |
| 54 | #define POLL_USE_EPOLL (1<<2) |
| 55 | |
Willy Tarreau | baaee00 | 2006-06-26 02:48:02 +0200 | [diff] [blame] | 56 | /* fd states */ |
| 57 | extern fd_set *StaticReadEvent, *StaticWriteEvent; |
| 58 | extern int cfg_polling_mechanism; /* POLL_USE_{SELECT|POLL|EPOLL} */ |
| 59 | |
| 60 | |
| 61 | #endif /* _TYPES_POLLING_H */ |
| 62 | |
| 63 | /* |
| 64 | * Local variables: |
| 65 | * c-indent-level: 8 |
| 66 | * c-basic-offset: 8 |
| 67 | * End: |
| 68 | */ |