1 |
|
/* |
2 |
< |
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). |
3 |
< |
* s_bsd_kqueue.c: FreeBSD kqueue compatible network routines. |
2 |
> |
* ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd) |
3 |
|
* |
4 |
< |
* Originally by Adrian Chadd <adrian@creative.net.au> |
6 |
< |
* Copyright (C) 2005 Hybrid Development Team |
4 |
> |
* Copyright (c) 2000-2015 ircd-hybrid development team |
5 |
|
* |
6 |
|
* This program is free software; you can redistribute it and/or modify |
7 |
|
* it under the terms of the GNU General Public License as published by |
15 |
|
* |
16 |
|
* You should have received a copy of the GNU General Public License |
17 |
|
* along with this program; if not, write to the Free Software |
18 |
< |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
18 |
> |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 |
19 |
|
* USA |
20 |
< |
* |
21 |
< |
* $Id$ |
20 |
> |
*/ |
21 |
> |
|
22 |
> |
/*! \file s_bsd_kqueue.c |
23 |
> |
* \brief kqueue() compatible network routines. |
24 |
> |
* \version $Id$ |
25 |
|
*/ |
26 |
|
|
27 |
|
#include "stdinc.h" |
29 |
|
#include <sys/event.h> |
30 |
|
#include "fdlist.h" |
31 |
|
#include "ircd.h" |
31 |
– |
#include "memory.h" |
32 |
|
#include "s_bsd.h" |
33 |
|
#include "log.h" |
34 |
|
|
35 |
|
#define KE_LENGTH 128 |
36 |
|
|
37 |
– |
/* jlemon goofed up and didn't add EV_SET until fbsd 4.3 */ |
38 |
– |
|
39 |
– |
#ifndef EV_SET |
40 |
– |
#define EV_SET(kevp, a, b, c, d, e, f) do { \ |
41 |
– |
(kevp)->ident = (a); \ |
42 |
– |
(kevp)->filter = (b); \ |
43 |
– |
(kevp)->flags = (c); \ |
44 |
– |
(kevp)->fflags = (d); \ |
45 |
– |
(kevp)->data = (e); \ |
46 |
– |
(kevp)->udata = (f); \ |
47 |
– |
} while(0) |
48 |
– |
#endif |
49 |
– |
|
37 |
|
static fde_t kqfd; |
38 |
|
static struct kevent kq_fdlist[KE_LENGTH]; /* kevent buffer */ |
39 |
|
static int kqoff; /* offset into the buffer */ |
40 |
|
|
41 |
+ |
|
42 |
|
/* |
43 |
|
* init_netio |
44 |
|
* |
87 |
|
* and deregister interest in a pending IO state for a given FD. |
88 |
|
*/ |
89 |
|
void |
90 |
< |
comm_setselect(fde_t *F, unsigned int type, PF *handler, |
90 |
> |
comm_setselect(fde_t *F, unsigned int type, void (*handler)(fde_t *, void *), |
91 |
|
void *client_data, time_t timeout) |
92 |
|
{ |
93 |
|
int new_events, diff; |
140 |
|
int num, i; |
141 |
|
static struct kevent ke[KE_LENGTH]; |
142 |
|
struct timespec poll_time; |
143 |
< |
PF *hdl; |
143 |
> |
void (*hdl)(fde_t *, void *); |
144 |
|
fde_t *F; |
145 |
|
|
146 |
|
/* |