version 1.1.1.2, 2014/06/15 20:20:06
|
version 1.1.1.3, 2016/11/02 10:35:00
|
Line 1
|
Line 1
|
#ifndef _FDEVENT_H_ |
#ifndef _FDEVENT_H_ |
#define _FDEVENT_H_ |
#define _FDEVENT_H_ |
|
#include "first.h" |
|
|
#ifdef HAVE_CONFIG_H |
|
# include "config.h" |
|
#endif |
|
|
|
#include "settings.h" |
#include "settings.h" |
#include "bitset.h" |
|
|
|
#if defined HAVE_STDINT_H |
#if defined HAVE_STDINT_H |
# include <stdint.h> |
# include <stdint.h> |
Line 20
|
Line 16
|
|
|
#if defined(HAVE_EPOLL_CTL) && defined(HAVE_SYS_EPOLL_H) |
#if defined(HAVE_EPOLL_CTL) && defined(HAVE_SYS_EPOLL_H) |
# define USE_LINUX_EPOLL |
# define USE_LINUX_EPOLL |
|
struct epoll_event; /* declaration */ |
#endif |
#endif |
|
|
/* MacOS 10.3.x has poll.h under /usr/include/, all other unixes |
/* MacOS 10.3.x has poll.h under /usr/include/, all other unixes |
* under /usr/include/sys/ */ |
* under /usr/include/sys/ */ |
#if defined HAVE_POLL && (defined(HAVE_SYS_POLL_H) || defined(HAVE_POLL_H)) |
#if defined HAVE_POLL && (defined(HAVE_SYS_POLL_H) || defined(HAVE_POLL_H)) |
# define USE_POLL |
# define USE_POLL |
|
struct pollfd; /* declaration */ |
#endif |
#endif |
|
|
#if defined HAVE_SELECT |
#if defined HAVE_SELECT |
Line 40
|
Line 38
|
|
|
#if defined HAVE_SYS_DEVPOLL_H && defined(__sun) |
#if defined HAVE_SYS_DEVPOLL_H && defined(__sun) |
# define USE_SOLARIS_DEVPOLL |
# define USE_SOLARIS_DEVPOLL |
|
struct pollfd; /* declaration */ |
#endif |
#endif |
|
|
#if defined HAVE_PORT_H && defined HAVE_PORT_CREATE && defined(__sun) |
#if defined HAVE_PORT_H && defined HAVE_PORT_CREATE && defined(__sun) |
Line 49
|
Line 48
|
|
|
#if defined HAVE_SYS_EVENT_H && defined HAVE_KQUEUE |
#if defined HAVE_SYS_EVENT_H && defined HAVE_KQUEUE |
# define USE_FREEBSD_KQUEUE |
# define USE_FREEBSD_KQUEUE |
|
struct kevent; /* declaration */ |
#endif |
#endif |
|
|
#if defined HAVE_LIBEV |
#if defined HAVE_LIBEV |
# define USE_LIBEV |
# define USE_LIBEV |
|
struct ev_loop; /* declaration */ |
#endif |
#endif |
|
|
struct server; | struct server; /* declaration */ |
|
|
typedef handler_t (*fdevent_handler)(struct server *srv, void *ctx, int revents); |
typedef handler_t (*fdevent_handler)(struct server *srv, void *ctx, int revents); |
|
|
Line 69 typedef handler_t (*fdevent_handler)(struct server *sr
|
Line 70 typedef handler_t (*fdevent_handler)(struct server *sr
|
#define FDEVENT_HUP BV(4) |
#define FDEVENT_HUP BV(4) |
#define FDEVENT_NVAL BV(5) |
#define FDEVENT_NVAL BV(5) |
|
|
|
#define FDEVENT_STREAM_REQUEST BV(0) |
|
#define FDEVENT_STREAM_REQUEST_BUFMIN BV(1) |
|
#define FDEVENT_STREAM_REQUEST_POLLIN BV(15) |
|
|
|
#define FDEVENT_STREAM_RESPONSE BV(0) |
|
#define FDEVENT_STREAM_RESPONSE_BUFMIN BV(1) |
|
|
typedef enum { FD_EVENT_TYPE_UNSET = -1, |
typedef enum { FD_EVENT_TYPE_UNSET = -1, |
FD_EVENT_TYPE_CONNECTION, |
FD_EVENT_TYPE_CONNECTION, |
FD_EVENT_TYPE_FCGI_CONNECTION, |
FD_EVENT_TYPE_FCGI_CONNECTION, |
Line 177 fdevents *fdevent_init(struct server *srv, size_t maxf
|
Line 185 fdevents *fdevent_init(struct server *srv, size_t maxf
|
int fdevent_reset(fdevents *ev); /* "init" after fork() */ |
int fdevent_reset(fdevents *ev); /* "init" after fork() */ |
void fdevent_free(fdevents *ev); |
void fdevent_free(fdevents *ev); |
|
|
int fdevent_event_set(fdevents *ev, int *fde_ndx, int fd, int events); /* events can be FDEVENT_IN, FDEVENT_OUT or FDEVENT_IN | FDEVENT_OUT */ | #define fdevent_event_get_interest(ev, fd) \ |
int fdevent_event_del(fdevents *ev, int *fde_ndx, int fd); | ((fd) >= 0 ? (ev)->fdarray[(fd)]->events : 0) |
| void fdevent_event_set(fdevents *ev, int *fde_ndx, int fd, int events); /* events can be FDEVENT_IN, FDEVENT_OUT or FDEVENT_IN | FDEVENT_OUT */ |
| void fdevent_event_add(fdevents *ev, int *fde_ndx, int fd, int event); /* events can be FDEVENT_IN or FDEVENT_OUT */ |
| void fdevent_event_clr(fdevents *ev, int *fde_ndx, int fd, int event); /* events can be FDEVENT_IN or FDEVENT_OUT */ |
| void fdevent_event_del(fdevents *ev, int *fde_ndx, int fd); |
int fdevent_event_get_revent(fdevents *ev, size_t ndx); |
int fdevent_event_get_revent(fdevents *ev, size_t ndx); |
int fdevent_event_get_fd(fdevents *ev, size_t ndx); |
int fdevent_event_get_fd(fdevents *ev, size_t ndx); |
fdevent_handler fdevent_get_handler(fdevents *ev, int fd); |
fdevent_handler fdevent_get_handler(fdevents *ev, int fd); |