~ubuntu-branches/ubuntu/precise/transmission/precise

« back to all changes in this revision

Viewing changes to third-party/libevent/devpoll.c

  • Committer: Bazaar Package Importer
  • Author(s): Leo Costela
  • Date: 2009-05-17 19:39:51 UTC
  • mto: (1.3.4 upstream) (2.2.1 squeeze)
  • mto: This revision was merged to the branch mainline in revision 36.
  • Revision ID: james.westby@ubuntu.com-20090517193951-k8x15sqoxzf7cuyx
ImportĀ upstreamĀ versionĀ 1.61

Show diffs side-by-side

added added

removed removed

Lines of Context:
75
75
static int devpoll_dispatch     (struct event_base *, void *, struct timeval *);
76
76
static void devpoll_dealloc     (struct event_base *, void *);
77
77
 
78
 
struct eventop devpollops = {
 
78
const struct eventop devpollops = {
79
79
        "devpoll",
80
80
        devpoll_init,
81
81
        devpoll_add,
139
139
 
140
140
        if (getrlimit(RLIMIT_NOFILE, &rl) == 0 &&
141
141
            rl.rlim_cur != RLIM_INFINITY)
142
 
                nfiles = rl.rlim_cur - 1;
 
142
                nfiles = rl.rlim_cur;
143
143
 
144
144
        /* Initialize the kernel queue */
145
145
        if ((dpfd = open("/dev/poll", O_RDWR)) == -1) {
187
187
{
188
188
        struct devpollop *devpollop = arg;
189
189
 
190
 
        if (max > devpollop->nfds) {
 
190
        if (max >= devpollop->nfds) {
191
191
                struct evdevpoll *fds;
192
192
                int nfds;
193
193
 
194
194
                nfds = devpollop->nfds;
195
 
                while (nfds < max)
 
195
                while (nfds <= max)
196
196
                        nfds <<= 1;
197
197
 
198
198
                fds = realloc(devpollop->fds, nfds * sizeof(struct evdevpoll));