only try to open the event-handler, but close right away as we have to open it AFTER the daemonize again

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-merge-1.4.x@665 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.3
Jan Kneschke 18 years ago
parent e45388fc44
commit 478053510b
  1. 12
      src/fdevent_freebsd_kqueue.c
  2. 31
      src/fdevent_solaris_devpoll.c

@ -181,6 +181,18 @@ int fdevent_freebsd_kqueue_init(fdevents *ev) {
ev->kq_results = calloc(ev->maxfds, sizeof(*ev->kq_results));
ev->kq_bevents = bitset_init(ev->maxfds);
/* check that kqueue works */
if (-1 == (ev->kq_fd = kqueue())) {
fprintf(stderr, "%s.%d: kqueue failed (%s), try to set server.event-handler = \"poll\" or \"select\"\n",
__FILE__, __LINE__, strerror(errno));
return -1;
}
close(ev->kq_fd);
ev->kq_fd = -1;
return 0;
}
#else

@ -93,6 +93,26 @@ static int fdevent_solaris_devpoll_event_next_fdndx(fdevents *ev, int last_ndx)
return i;
}
int fdevent_solaris_devpoll_reset(fdevents *ev) {
/* a forked process does only inherit the filedescriptor,
* but every operation on the device will lead to a EACCES */
if ((ev->devpoll_fd = open("/dev/poll", O_RDWR)) < 0) {
fprintf(stderr, "%s.%d: opening /dev/poll failed (%s), try to set server.event-handler = \"poll\" or \"select\"\n",
__FILE__, __LINE__, strerror(errno));
return -1;
}
if (fcntl(ev->devpoll_fd, F_SETFD, FD_CLOEXEC) < 0) {
fprintf(stderr, "%s.%d: opening /dev/poll failed (%s), try to set server.event-handler = \"poll\" or \"select\"\n",
__FILE__, __LINE__, strerror(errno));
close(ev->devpoll_fd);
return -1;
}
return 0;
}
int fdevent_solaris_devpoll_init(fdevents *ev) {
ev->type = FDEVENT_HANDLER_SOLARIS_DEVPOLL;
#define SET(x) \
@ -100,6 +120,7 @@ int fdevent_solaris_devpoll_init(fdevents *ev) {
SET(free);
SET(poll);
SET(reset);
SET(event_del);
SET(event_add);
@ -116,15 +137,11 @@ int fdevent_solaris_devpoll_init(fdevents *ev) {
return -1;
}
if (fcntl(ev->devpoll_fd, F_SETFD, FD_CLOEXEC) < 0) {
fprintf(stderr, "%s.%d: opening /dev/poll failed (%s), try to set server.event-handler = \"poll\" or \"select\"\n",
__FILE__, __LINE__, strerror(errno));
close(ev->devpoll_fd);
/* we just wanted to check if it works */
close(ev->devpoll_fd);
return -1;
}
ev->devpoll_fd = -1;
return 0;
}

Loading…
Cancel
Save