Feature #2171 » solaris-eventports-1.4.26.diff
./config.h.in 2010-03-10 11:18:17.517841697 +0100 | ||
---|---|---|
/* Define to 1 if you have the <sys/poll.h> header file. */
|
||
#undef HAVE_SYS_POLL_H
|
||
/* Define to 1 if you have the <sys/port.h> header file. */
|
||
#undef HAVE_SYS_PORT_H
|
||
/* Define to 1 if you have the <port.h> header file. */
|
||
#undef HAVE_PORT_H
|
||
/* Define to 1 if you have the <sys/prctl.h> header file. */
|
||
#undef HAVE_SYS_PRCTL_H
|
./configure 2010-03-10 11:18:17.523204484 +0100 | ||
---|---|---|
for ac_header in arpa/inet.h fcntl.h netinet/in.h stdlib.h string.h \
|
||
sys/socket.h sys/time.h unistd.h sys/sendfile.h sys/uio.h \
|
||
getopt.h sys/epoll.h sys/select.h poll.h sys/poll.h sys/devpoll.h sys/filio.h \
|
||
sys/mman.h sys/event.h sys/port.h pwd.h sys/syslimits.h \
|
||
sys/mman.h sys/event.h port.h pwd.h sys/syslimits.h \
|
||
sys/resource.h sys/un.h syslog.h sys/prctl.h uuid/uuid.h
|
||
do :
|
||
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
./configure.ac 2010-03-10 11:18:17.523738321 +0100 | ||
---|---|---|
AC_CHECK_HEADERS([arpa/inet.h fcntl.h netinet/in.h stdlib.h string.h \
|
||
sys/socket.h sys/time.h unistd.h sys/sendfile.h sys/uio.h \
|
||
getopt.h sys/epoll.h sys/select.h poll.h sys/poll.h sys/devpoll.h sys/filio.h \
|
||
sys/mman.h sys/event.h sys/port.h pwd.h sys/syslimits.h \
|
||
sys/mman.h sys/event.h port.h pwd.h sys/syslimits.h \
|
||
sys/resource.h sys/un.h syslog.h sys/prctl.h uuid/uuid.h])
|
||
dnl Checks for typedefs, structures, and compiler characteristics.
|
./src/configfile.c 2010-03-10 11:18:17.524358746 +0100 | ||
---|---|---|
#ifdef USE_SOLARIS_DEVPOLL
|
||
{ FDEVENT_HANDLER_SOLARIS_DEVPOLL,"solaris-devpoll" },
|
||
#endif
|
||
#ifdef USE_SOLARIS_PORT
|
||
{ FDEVENT_HANDLER_SOLARIS_PORT,"solaris-eventports" },
|
||
#endif
|
||
#ifdef USE_FREEBSD_KQUEUE
|
||
{ FDEVENT_HANDLER_FREEBSD_KQUEUE, "freebsd-kqueue" },
|
||
{ FDEVENT_HANDLER_FREEBSD_KQUEUE, "kqueue" },
|
./src/connections.c 2010-03-10 11:19:24.161434445 +0100 | ||
---|---|---|
}
|
||
} else if (revents & FDEVENT_ERR) {
|
||
#ifndef USE_LINUX_SIGIO
|
||
#if !defined(USE_LINUX_SIGIO) && !defined(USE_SOLARIS_PORT)
|
||
log_error_write(srv, __FILE__, __LINE__, "sd",
|
||
"connection closed: poll() -> ERR", con->fd);
|
||
#endif
|
./src/fdevent.c 2010-03-10 11:18:17.524713367 +0100 | ||
---|---|---|
return NULL;
|
||
}
|
||
break;
|
||
case FDEVENT_HANDLER_SOLARIS_PORT:
|
||
if (0 != fdevent_solaris_port_init(ev)) {
|
||
fprintf(stderr, "%s.%d: event-handler solaris-eventports failed, try to set server.event-handler = \"poll\" or \"select\"\n",
|
||
__FILE__, __LINE__);
|
||
return NULL;
|
||
}
|
||
break;
|
||
case FDEVENT_HANDLER_FREEBSD_KQUEUE:
|
||
if (0 != fdevent_freebsd_kqueue_init(ev)) {
|
||
fprintf(stderr, "%s.%d: event-handler freebsd-kqueue failed, try to set server.event-handler = \"poll\" or \"select\"\n",
|
./src/fdevent.h 2010-03-10 11:18:17.525096330 +0100 | ||
---|---|---|
# include <sys/devpoll.h>
|
||
#endif
|
||
#if defined HAVE_PORT_H && defined HAVE_PORT_CREATE && defined(__sun)
|
||
# define USE_SOLARIS_PORT
|
||
# include <port.h>
|
||
#endif
|
||
#if defined HAVE_SYS_EVENT_H && defined HAVE_KQUEUE
|
||
# define USE_FREEBSD_KQUEUE
|
||
# include <sys/event.h>
|
||
#endif
|
||
#if defined HAVE_SYS_PORT_H && defined HAVE_PORT_CREATE
|
||
# define USE_SOLARIS_PORT
|
||
# include <sys/port.h>
|
||
#endif
|
||
typedef handler_t (*fdevent_handler)(void *srv, void *ctx, int revents);
|
||
#define FDEVENT_IN BV(0)
|
||
... | ... | |
int devpoll_fd;
|
||
struct pollfd *devpollfds;
|
||
#endif
|
||
#ifdef USE_SOLARIS_PORT
|
||
port_event_t *port_events;
|
||
#endif
|
||
#ifdef USE_FREEBSD_KQUEUE
|
||
int kq_fd;
|
||
struct kevent *kq_results;
|
||
... | ... | |
int fdevent_linux_rtsig_init(fdevents *ev);
|
||
int fdevent_linux_sysepoll_init(fdevents *ev);
|
||
int fdevent_solaris_devpoll_init(fdevents *ev);
|
||
int fdevent_solaris_port_init(fdevents *ev);
|
||
int fdevent_freebsd_kqueue_init(fdevents *ev);
|
||
#endif
|
./src/fdevent_solaris_port.c 2010-03-10 11:18:17.525449922 +0100 | ||
---|---|---|
#include <sys/types.h>
|
||
#include <unistd.h>
|
||
#include <stdlib.h>
|
||
#include <stdio.h>
|
||
#include <string.h>
|
||
#include <errno.h>
|
||
#include <signal.h>
|
||
#include <fcntl.h>
|
||
#include "fdevent.h"
|
||
#include "settings.h"
|
||
#include "buffer.h"
|
||
#ifdef USE_SOLARIS_PORT
|
||
static int SOLARIS_PORT_POLL_WRITE = POLLIN;
|
||
static int SOLARIS_PORT_POLL_READ = POLLOUT;
|
||
static int SOLARIS_PORT_POLL_READ_WRITE = POLLIN & POLLOUT;
|
||
static int fdevent_solaris_port_event_del(fdevents *ev, int fde_ndx, int fd) {
|
||
if (fde_ndx < 0) return -1;
|
||
if (0 != port_dissociate(ev->port_fd, PORT_SOURCE_FD, fd)) {
|
||
fprintf(stderr, "%s.%d: port_dissociate failed: %s, dying\n",
|
||
__FILE__, __LINE__, strerror(errno));
|
||
|
||
SEGFAULT();
|
||
|
||
return 0;
|
||
}
|
||
return -1;
|
||
}
|
||
static int fdevent_solaris_port_event_add(fdevents *ev, int fde_ndx, int fd, int events) {
|
||
int solaris_port_events = 0;
|
||
void * user_data = NULL;
|
||
|
||
if ((events & FDEVENT_IN) && (events & FDEVENT_OUT)) {
|
||
solaris_port_events |= POLLIN;
|
||
solaris_port_events |= POLLOUT;
|
||
user_data = &SOLARIS_PORT_POLL_READ_WRITE;
|
||
} else if (events & FDEVENT_IN) {
|
||
solaris_port_events |= POLLIN;
|
||
user_data = &SOLARIS_PORT_POLL_READ;
|
||
} else if (events & FDEVENT_OUT) {
|
||
solaris_port_events |= POLLOUT;
|
||
user_data = &SOLARIS_PORT_POLL_WRITE;
|
||
}
|
||
|
||
if (0 != port_associate(ev->port_fd, PORT_SOURCE_FD, fd, solaris_port_events, user_data)) {
|
||
fprintf(stderr, "%s.%d: port_associate failed: %s, dying\n", __FILE__, __LINE__, strerror(errno));
|
||
|
||
SEGFAULT();
|
||
|
||
return 0;
|
||
}
|
||
return fd;
|
||
}
|
||
static int fdevent_solaris_port_event_get_revent(fdevents *ev, size_t ndx) {
|
||
int events = 0, e;
|
||
e = ev->port_events[ndx].portev_events;
|
||
if (e & POLLIN) events |= FDEVENT_IN;
|
||
if (e & POLLOUT) events |= FDEVENT_OUT;
|
||
if (e & POLLERR) events |= FDEVENT_ERR;
|
||
if (e & POLLHUP) events |= FDEVENT_HUP;
|
||
if (e & POLLPRI) events |= FDEVENT_PRI;
|
||
if (e & POLLNVAL) events |= FDEVENT_NVAL;
|
||
return e;
|
||
}
|
||
static int fdevent_solaris_port_event_get_fd(fdevents *ev, size_t ndx) {
|
||
return ev->port_events[ndx].portev_object;
|
||
}
|
||
static int fdevent_solaris_port_event_next_fdndx(fdevents *ev, int ndx) {
|
||
size_t i;
|
||
UNUSED(ev);
|
||
i = (ndx < 0) ? 0 : ndx + 1;
|
||
return i;
|
||
}
|
||
static void fdevent_solaris_port_free(fdevents *ev) {
|
||
close(ev->port_fd);
|
||
free(ev->port_events);
|
||
}
|
||
/* if there is any error it will return the return values of port_getn, otherwise it will return number of events **/
|
||
static int fdevent_solaris_port_poll(fdevents *ev, int timeout_ms) {
|
||
int i = 0;
|
||
int ret;
|
||
unsigned int available_events;
|
||
int * user_data;
|
||
int solaris_port_events = 0;
|
||
|
||
struct timespec timeout;
|
||
timeout.tv_sec = timeout_ms/1000L;
|
||
timeout.tv_nsec = (timeout_ms % 1000L) * 1000000L;
|
||
|
||
/* get the number of file descriptors with events */
|
||
if ((ret = port_getn(ev->port_fd, ev->port_events, 0, &available_events, &timeout)) < 0) return ret;
|
||
|
||
/* retrieve at least one event */
|
||
if (0 == available_events) available_events = 1;
|
||
|
||
/* get the events of the file descriptors */
|
||
if ((ret = port_getn(ev->port_fd, ev->port_events, ev->maxfds, &available_events, &timeout)) < 0) {
|
||
if (errno != ETIME) return ret;
|
||
}
|
||
|
||
for (i = 0; i < available_events; ++i) {
|
||
solaris_port_events = 0;
|
||
|
||
user_data = (int *) ev->port_events[i].portev_user;
|
||
|
||
if (SOLARIS_PORT_POLL_READ & *user_data) solaris_port_events |= POLLIN;
|
||
|
||
if (SOLARIS_PORT_POLL_WRITE & *user_data) solaris_port_events |= POLLOUT;
|
||
|
||
if ((ret = port_associate(ev->port_fd, PORT_SOURCE_FD, ev->port_events[i].portev_object,
|
||
solaris_port_events, user_data)) < 0) {
|
||
fprintf(stderr, "%s.%d: port_associate failed: %s, dying\n", __FILE__, __LINE__, strerror(errno));
|
||
|
||
SEGFAULT();
|
||
|
||
return 0;
|
||
}
|
||
}
|
||
return available_events;
|
||
}
|
||
int fdevent_solaris_port_init(fdevents *ev) {
|
||
ev->type = FDEVENT_HANDLER_SOLARIS_PORT;
|
||
#define SET(x) \
|
||
ev->x = fdevent_solaris_port_##x;
|
||
SET(free);
|
||
SET(poll);
|
||
|
||
SET(event_del);
|
||
SET(event_add);
|
||
SET(event_next_fdndx);
|
||
SET(event_get_fd);
|
||
SET(event_get_revent);
|
||
if ((ev->port_fd = port_create()) < 0) {
|
||
fprintf(stderr, "%s.%d: port_create() failed (%s), try to set server.event-handler = \"poll\" or \"select\"\n",
|
||
__FILE__, __LINE__, strerror(errno));
|
||
return -1;
|
||
}
|
||
|
||
ev->port_events = malloc(ev->maxfds * sizeof(*ev->port_events));
|
||
return 0;
|
||
}
|
||
#else
|
||
int fdevent_solaris_port_init(fdevents *ev) {
|
||
UNUSED(ev);
|
||
fprintf(stderr, "%s.%d: solaris-eventports not supported, try to set server.event-handler = \"poll\" or \"select\"\n",
|
||
__FILE__, __LINE__);
|
||
return -1;
|
||
}
|
||
#endif
|
./src/Makefile.am 2010-03-10 11:18:17.525794829 +0100 | ||
---|---|---|
data_integer.c md5.c data_fastcgi.c \
|
||
fdevent_select.c fdevent_linux_rtsig.c \
|
||
fdevent_poll.c fdevent_linux_sysepoll.c \
|
||
fdevent_solaris_devpoll.c fdevent_freebsd_kqueue.c \
|
||
fdevent_solaris_devpoll.c fdevent_solaris_port.c \
|
||
fdevent_freebsd_kqueue.c \
|
||
data_config.c bitset.c \
|
||
inet_ntop_cache.c crc32.c \
|
||
connections-glue.c \
|
./src/Makefile.in 2010-03-10 11:18:17.527100161 +0100 | ||
---|---|---|
data_array.c data_integer.c md5.c data_fastcgi.c \
|
||
fdevent_select.c fdevent_linux_rtsig.c fdevent_poll.c \
|
||
fdevent_linux_sysepoll.c fdevent_solaris_devpoll.c \
|
||
fdevent_solaris_port.c \
|
||
fdevent_freebsd_kqueue.c data_config.c bitset.c \
|
||
inet_ntop_cache.c crc32.c connections-glue.c configfile-glue.c \
|
||
http-header-glue.c network_write.c network_linux_sendfile.c \
|
||
... | ... | |
liblightcomp_la-fdevent_poll.lo \
|
||
liblightcomp_la-fdevent_linux_sysepoll.lo \
|
||
liblightcomp_la-fdevent_solaris_devpoll.lo \
|
||
liblightcomp_la-fdevent_solaris_port.lo \
|
||
liblightcomp_la-fdevent_freebsd_kqueue.lo \
|
||
liblightcomp_la-data_config.lo liblightcomp_la-bitset.lo \
|
||
liblightcomp_la-inet_ntop_cache.lo liblightcomp_la-crc32.lo \
|
||
... | ... | |
data_fastcgi.c fdevent_select.c fdevent_linux_rtsig.c \
|
||
fdevent_poll.c fdevent_linux_sysepoll.c \
|
||
fdevent_solaris_devpoll.c fdevent_freebsd_kqueue.c \
|
||
fdevent_solaris_port.c \
|
||
data_config.c bitset.c inet_ntop_cache.c crc32.c \
|
||
connections-glue.c configfile-glue.c http-header-glue.c \
|
||
network_write.c network_linux_sendfile.c \
|
||
... | ... | |
fdevent_linux_rtsig.$(OBJEXT) fdevent_poll.$(OBJEXT) \
|
||
fdevent_linux_sysepoll.$(OBJEXT) \
|
||
fdevent_solaris_devpoll.$(OBJEXT) \
|
||
fdevent_solaris_port.$(OBJEXT) \
|
||
fdevent_freebsd_kqueue.$(OBJEXT) data_config.$(OBJEXT) \
|
||
bitset.$(OBJEXT) inet_ntop_cache.$(OBJEXT) crc32.$(OBJEXT) \
|
||
connections-glue.$(OBJEXT) configfile-glue.$(OBJEXT) \
|
||
... | ... | |
fdevent_select.c fdevent_linux_rtsig.c \
|
||
fdevent_poll.c fdevent_linux_sysepoll.c \
|
||
fdevent_solaris_devpoll.c fdevent_freebsd_kqueue.c \
|
||
fdevent_solaris_port.c \
|
||
data_config.c bitset.c \
|
||
inet_ntop_cache.c crc32.c \
|
||
connections-glue.c \
|
||
... | ... | |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fdevent_poll.Po@am__quote@
|
||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fdevent_select.Po@am__quote@
|
||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fdevent_solaris_devpoll.Po@am__quote@
|
||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fdevent_solaris_port.Po@am__quote@
|
||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http-header-glue.Po@am__quote@
|
||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http_auth.Plo@am__quote@
|
||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http_auth_digest.Plo@am__quote@
|
||
... | ... | |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblightcomp_la-fdevent_poll.Plo@am__quote@
|
||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblightcomp_la-fdevent_select.Plo@am__quote@
|
||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblightcomp_la-fdevent_solaris_devpoll.Plo@am__quote@
|
||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblightcomp_la-fdevent_solaris_port.Plo@am__quote@
|
||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblightcomp_la-http-header-glue.Plo@am__quote@
|
||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblightcomp_la-http_chunk.Plo@am__quote@
|
||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liblightcomp_la-inet_ntop_cache.Plo@am__quote@
|
||
... | ... | |
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||
@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblightcomp_la_CFLAGS) $(CFLAGS) -c -o liblightcomp_la-fdevent_solaris_devpoll.lo `test -f 'fdevent_solaris_devpoll.c' || echo '$(srcdir)/'`fdevent_solaris_devpoll.c
|
||
liblightcomp_la-fdevent_solaris_port.lo: fdevent_solaris_port.c
|
||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblightcomp_la_CFLAGS) $(CFLAGS) -MT liblightcomp_la-fdevent_solaris_port.lo -MD -MP -MF $(DEPDIR)/liblightcomp_la-fdevent_solaris_port.Tpo -c -o liblightcomp_la-fdevent_solaris_port.lo `test -f 'fdevent_solaris_port.c' || echo '$(srcdir)/'`fdevent_solaris_port.c
|
||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liblightcomp_la-fdevent_solaris_port.Tpo $(DEPDIR)/liblightcomp_la-fdevent_solaris_port.Plo
|
||
@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@
|
||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fdevent_solaris_port.c' object='liblightcomp_la-fdevent_solaris_port.lo' libtool=yes @AMDEPBACKSLASH@
|
||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||
@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblightcomp_la_CFLAGS) $(CFLAGS) -c -o liblightcomp_la-fdevent_solaris_port.lo `test -f 'fdevent_solaris_port.c' || echo '$(srcdir)/'`fdevent_solaris_port.c
|
||
liblightcomp_la-fdevent_freebsd_kqueue.lo: fdevent_freebsd_kqueue.c
|
||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(liblightcomp_la_CFLAGS) $(CFLAGS) -MT liblightcomp_la-fdevent_freebsd_kqueue.lo -MD -MP -MF $(DEPDIR)/liblightcomp_la-fdevent_freebsd_kqueue.Tpo -c -o liblightcomp_la-fdevent_freebsd_kqueue.lo `test -f 'fdevent_freebsd_kqueue.c' || echo '$(srcdir)/'`fdevent_freebsd_kqueue.c
|
||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/liblightcomp_la-fdevent_freebsd_kqueue.Tpo $(DEPDIR)/liblightcomp_la-fdevent_freebsd_kqueue.Plo
|
./src/mod_status.c 2010-03-10 11:18:17.527636301 +0100 | ||
---|---|---|
#ifdef USE_SOLARIS_DEVPOLL
|
||
{ FDEVENT_HANDLER_SOLARIS_DEVPOLL,"solaris-devpoll" },
|
||
#endif
|
||
#ifdef USE_SOLARIS_PORT
|
||
{ FDEVENT_HANDLER_SOLARIS_PORT,"solaris-eventports" },
|
||
#endif
|
||
#ifdef USE_FREEBSD_KQUEUE
|
||
{ FDEVENT_HANDLER_FREEBSD_KQUEUE, "freebsd-kqueue" },
|
||
#endif
|
./src/server.c 2010-03-10 11:18:17.528214691 +0100 | ||
---|---|---|
#else
|
||
"\t- /dev/poll (Solaris)\n"
|
||
#endif
|
||
#ifdef USE_SOLARIS_PORT
|
||
"\t+ eventports (Solaris)\n"
|
||
#else
|
||
"\t- eventports (Solaris)\n"
|
||
#endif
|
||
#ifdef USE_FREEBSD_KQUEUE
|
||
"\t+ kqueue (FreeBSD)\n"
|
||
#else
|