25#include <sys/select.h>
34static int fpm_event_select_init(
int max);
35static int fpm_event_select_wait(
struct fpm_event_queue_s *queue,
unsigned long int timeout);
36static int fpm_event_select_add(
struct fpm_event_s *ev);
37static int fpm_event_select_remove(
struct fpm_event_s *ev);
41 .support_edge_trigger = 0,
42 .init = fpm_event_select_init,
44 .wait = fpm_event_select_wait,
45 .add = fpm_event_select_add,
46 .remove = fpm_event_select_remove,
59 return &select_module;
70static int fpm_event_select_init(
int max)
81static int fpm_event_select_wait(
struct fpm_event_queue_s *queue,
unsigned long int timeout)
92 t.tv_sec = timeout / 1000;
93 t.tv_usec = (timeout % 1000) * 1000;
96 ret = select(FD_SETSIZE, ¤t_fds,
NULL,
NULL, &t);
100 if (
errno != EINTR) {
115 if (FD_ISSET(q->
ev->
fd, ¤t_fds)) {
137static int fpm_event_select_add(
struct fpm_event_s *ev)
140 if (ev->
fd >= FD_SETSIZE) {
141 zlog(
ZLOG_ERROR,
"select: not enough space in the select fd list (max = %d). Please consider using another event mechanism.", FD_SETSIZE);
146 if (!FD_ISSET(ev->
fd, &fds)) {
147 FD_SET(ev->
fd, &fds);
158static int fpm_event_select_remove(
struct fpm_event_s *ev)
161 if (FD_ISSET(ev->
fd, &fds)) {
162 FD_CLR(ev->
fd, &fds);
struct fpm_globals_s fpm_globals
void fpm_event_fire(struct fpm_event_s *ev)
struct fpm_event_module_s * fpm_event_select_module(void)
struct fpm_event_queue_s * next