~jlukas79/+junk/mysql-server

« back to all changes in this revision

Viewing changes to extra/libevent/poll.c

manual merge 6.0-main --> 6.0-bka-review

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
#include <sys/_time.h>
40
40
#endif
41
41
#include <sys/queue.h>
42
 
#include <sys/tree.h>
43
42
#include <poll.h>
44
43
#include <signal.h>
45
44
#include <stdio.h>
68
67
                              * "no entry." */
69
68
};
70
69
 
71
 
void *poll_init (struct event_base *);
72
 
int poll_add            (void *, struct event *);
73
 
int poll_del            (void *, struct event *);
74
 
int poll_recalc         (struct event_base *, void *, int);
75
 
int poll_dispatch       (struct event_base *, void *, struct timeval *);
76
 
void poll_dealloc       (struct event_base *, void *);
 
70
static void *poll_init  (struct event_base *);
 
71
static int poll_add             (void *, struct event *);
 
72
static int poll_del             (void *, struct event *);
 
73
static int poll_dispatch        (struct event_base *, void *, struct timeval *);
 
74
static void poll_dealloc        (struct event_base *, void *);
77
75
 
78
76
const struct eventop pollops = {
79
77
        "poll",
80
78
        poll_init,
81
79
        poll_add,
82
80
        poll_del,
83
 
        poll_recalc,
84
81
        poll_dispatch,
85
 
        poll_dealloc
 
82
        poll_dealloc,
 
83
    0
86
84
};
87
85
 
88
 
void *
 
86
static void *
89
87
poll_init(struct event_base *base)
90
88
{
91
89
        struct pollop *pollop;
102
100
        return (pollop);
103
101
}
104
102
 
105
 
/*
106
 
 * Called with the highest fd that we know about.  If it is 0, completely
107
 
 * recalculate everything.
108
 
 */
109
 
 
110
 
int
111
 
poll_recalc(struct event_base *base, void *arg, int max)
112
 
{
113
 
        return (0);
114
 
}
115
 
 
116
103
#ifdef CHECK_INVARIANTS
117
104
static void
118
105
poll_check_ok(struct pollop *pop)
147
134
#define poll_check_ok(pop)
148
135
#endif
149
136
 
150
 
int
 
137
static int
151
138
poll_dispatch(struct event_base *base, void *arg, struct timeval *tv)
152
139
{
153
140
        int res, i, msec = -1, nfds;
201
188
                        continue;
202
189
 
203
190
                if (r_ev && (res & r_ev->ev_events)) {
204
 
                        if (!(r_ev->ev_events & EV_PERSIST))
205
 
                                event_del(r_ev);
206
191
                        event_active(r_ev, res & r_ev->ev_events, 1);
207
192
                }
208
193
                if (w_ev && w_ev != r_ev && (res & w_ev->ev_events)) {
209
 
                        if (!(w_ev->ev_events & EV_PERSIST))
210
 
                                event_del(w_ev);
211
194
                        event_active(w_ev, res & w_ev->ev_events, 1);
212
195
                }
213
196
        }
215
198
        return (0);
216
199
}
217
200
 
218
 
int
 
201
static int
219
202
poll_add(void *arg, struct event *ev)
220
203
{
221
204
        struct pollop *pop = arg;
320
303
 * Nothing to be done here.
321
304
 */
322
305
 
323
 
int
 
306
static int
324
307
poll_del(void *arg, struct event *ev)
325
308
{
326
309
        struct pollop *pop = arg;
373
356
        return (0);
374
357
}
375
358
 
376
 
void
 
359
static void
377
360
poll_dealloc(struct event_base *base, void *arg)
378
361
{
379
362
        struct pollop *pop = arg;