20 |
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
21 |
|
* USA |
22 |
|
* |
23 |
< |
* $Id: s_bsd_devpoll.c,v 7.30 2005/09/18 14:46:02 adx Exp $ |
23 |
> |
* $Id$ |
24 |
|
*/ |
25 |
|
|
26 |
|
#include "stdinc.h" |
27 |
+ |
#if USE_IOPOLL_MECHANISM == __IOPOLL_MECHANISM_DEVPOLL |
28 |
|
#include <sys/ioctl.h> |
29 |
|
/* HPUX uses devpoll.h and not sys/devpoll.h */ |
30 |
|
#ifdef HAVE_DEVPOLL_H |
39 |
|
#include "fdlist.h" |
40 |
|
#include "ircd.h" |
41 |
|
#include "s_bsd.h" |
42 |
< |
#include "s_log.h" |
42 |
> |
#include "log.h" |
43 |
|
|
44 |
|
static fde_t dpfd; |
45 |
|
|
56 |
|
|
57 |
|
if ((fd = open("/dev/poll", O_RDWR)) < 0) |
58 |
|
{ |
59 |
< |
ilog(L_CRIT, "init_netio: Couldn't open /dev/poll - %d: %s", |
59 |
> |
ilog(LOG_TYPE_IRCD, "init_netio: Couldn't open /dev/poll - %d: %s", |
60 |
|
errno, strerror(errno)); |
61 |
|
exit(115); /* Whee! */ |
62 |
|
} |
82 |
|
|
83 |
|
/* Write the thing to our poll fd */ |
84 |
|
if (write(dpfd.fd, &pfd, sizeof(pfd)) != sizeof(pfd)) |
85 |
< |
ilog(L_NOTICE, "devpoll_write_update: dpfd write failed %d: %s", |
85 |
> |
ilog(LOG_TYPE_IRCD, "devpoll_write_update: dpfd write failed %d: %s", |
86 |
|
errno, strerror(errno)); |
87 |
|
} |
88 |
|
|
110 |
|
F->write_data = client_data; |
111 |
|
} |
112 |
|
|
113 |
< |
new_events = (F->read_handler ? POLLRDNORM : 0) | |
114 |
< |
(F->write_handler ? POLLWRNORM : 0); |
113 |
> |
new_events = (F->read_handler ? POLLIN : 0) | |
114 |
> |
(F->write_handler ? POLLOUT : 0); |
115 |
|
|
116 |
|
if (timeout != 0) |
117 |
|
F->timeout = CurrentTime + (timeout / 1000); |
162 |
|
if (F == NULL || !F->flags.open) |
163 |
|
continue; |
164 |
|
|
165 |
< |
if ((dopoll.dp_fds[i].revents & (POLLRDNORM | POLLIN | POLLHUP | POLLERR))) |
165 |
> |
if ((dopoll.dp_fds[i].revents & POLLIN)) |
166 |
|
if ((hdl = F->read_handler) != NULL) |
167 |
|
{ |
168 |
|
F->read_handler = NULL; |
169 |
|
hdl(F, F->read_data); |
170 |
< |
if (!F->flags.open) |
171 |
< |
continue; |
170 |
> |
if (!F->flags.open) |
171 |
> |
continue; |
172 |
|
} |
173 |
|
|
174 |
< |
if ((dopoll.dp_fds[i].revents & (POLLWRNORM | POLLOUT | POLLHUP | POLLERR))) |
174 |
> |
if ((dopoll.dp_fds[i].revents & POLLOUT)) |
175 |
|
if ((hdl = F->write_handler) != NULL) |
176 |
|
{ |
177 |
|
F->write_handler = NULL; |
178 |
|
hdl(F, F->write_data); |
179 |
< |
if (!F->flags.open) |
180 |
< |
continue; |
179 |
> |
if (!F->flags.open) |
180 |
> |
continue; |
181 |
|
} |
182 |
|
|
183 |
|
comm_setselect(F, 0, NULL, NULL, 0); |
184 |
|
} |
185 |
|
} |
186 |
+ |
#endif |