~ubuntu-branches/ubuntu/oneiric/lighttpd/oneiric

« back to all changes in this revision

Viewing changes to src/fdevent_select.c

  • Committer: Bazaar Package Importer
  • Author(s): Lorenzo De Liso
  • Date: 2010-10-15 21:01:50 UTC
  • mfrom: (6.1.11 sid)
  • Revision ID: james.westby@ubuntu.com-20101015210150-edjmolu35qt56evm
Tags: 1.4.28-1ubuntu1
* Merge from debian unstable, remaining changes:
  - debian/control: 
    + libgamin-dev rather than libfam-dev to fix startup warning.
    + debhelper Build-depends bumped to (>= 7.0.50) for
      overrides in rules file. 
  - debian/index.html: s/Debian/Ubuntu/g branding on the default page.
  - Added a UFW profile set:
    + debian/lighttpd.dirs: added etc/ufw/applications.d
    + debian/rules: install the ufw profile.
    + debian/control: Suggests on ufw.
  - Add lighttpd-dev package:
    + debian/control: Added lighttpd-dev package; Build-depends on
      automake, libtool
    + debian/lighttpd-dev.install: Added.
  - debian/rules:
    + Add override_dh_installinit to set "defaults 91 09" to not start
      before apache2 but in the same runlevel with the same priority.
  - debian/patches/build-dev-package.patch: Updated
  - debian/lighttpd.conf: Comment 'use-ipv6.pl' by default, which causes
    failure to bind port in ipv4 (LP: #551211)
* debian/patches/build-dev-package.patch: updated
* Dropped changes:
  - debian/lighttpd.init: clean environment; Check syntax during start/reload:
    this change has been applied in the debian package
  - syntax_check function defined in init script. (LP: #600767): this change
    has been applied in the debian package
  - debian/patches/build-dev-package.patch: Updated: patch updated newly 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#include "fdevent.h"
2
2
#include "buffer.h"
 
3
#include "log.h"
3
4
 
4
5
#include <sys/time.h>
5
6
#include <sys/types.h>
33
34
        return -1;
34
35
}
35
36
 
36
 
static int fdevent_select_event_add(fdevents *ev, int fde_ndx, int fd, int events) {
 
37
static int fdevent_select_event_set(fdevents *ev, int fde_ndx, int fd, int events) {
37
38
        UNUSED(fde_ndx);
38
39
 
39
40
        /* we should be protected by max-fds, but you never know */
41
42
 
42
43
        if (events & FDEVENT_IN) {
43
44
                FD_SET(fd, &(ev->select_set_read));
44
 
                FD_CLR(fd, &(ev->select_set_write));
 
45
        } else {
 
46
                FD_CLR(fd, &(ev->select_set_read));
45
47
        }
46
48
        if (events & FDEVENT_OUT) {
47
 
                FD_CLR(fd, &(ev->select_set_read));
48
49
                FD_SET(fd, &(ev->select_set_write));
 
50
        } else {
 
51
                FD_CLR(fd, &(ev->select_set_write));
49
52
        }
50
53
        FD_SET(fd, &(ev->select_set_error));
51
54
 
95
98
        i = (ndx < 0) ? 0 : ndx + 1;
96
99
 
97
100
        for (; i < ev->select_max_fd + 1; i++) {
98
 
                if (FD_ISSET(i, &(ev->select_read))) break;
99
 
                if (FD_ISSET(i, &(ev->select_write))) break;
100
 
                if (FD_ISSET(i, &(ev->select_error))) break;
 
101
                if (FD_ISSET(i, &(ev->select_read))) return i;
 
102
                if (FD_ISSET(i, &(ev->select_write))) return i;
 
103
                if (FD_ISSET(i, &(ev->select_error))) return i;
101
104
        }
102
105
 
103
 
        return i;
 
106
        return -1;
104
107
}
105
108
 
106
109
int fdevent_select_init(fdevents *ev) {
112
115
        SET(poll);
113
116
 
114
117
        SET(event_del);
115
 
        SET(event_add);
 
118
        SET(event_set);
116
119
 
117
120
        SET(event_next_fdndx);
118
121
        SET(event_get_fd);