diff --git a/include/proto/fd.h b/include/proto/fd.h index 1cba33b7f..ffbb8e180 100644 --- a/include/proto/fd.h +++ b/include/proto/fd.h @@ -73,8 +73,6 @@ void run_poller(); #define EV_FD_SET(fd, ev) (cur_poller.set((fd), (ev))) #define EV_FD_CLR(fd, ev) (cur_poller.clr((fd), (ev))) #define EV_FD_ISSET(fd, ev) (cur_poller.is_set((fd), (ev))) -#define EV_FD_COND_S(fd, ev) (cur_poller.cond_s((fd), (ev))) -#define EV_FD_COND_C(fd, ev) (cur_poller.cond_c((fd), (ev))) #define EV_FD_REM(fd) (cur_poller.rem(fd)) #define EV_FD_CLO(fd) (cur_poller.clo(fd)) diff --git a/include/types/fd.h b/include/types/fd.h index 684b77abd..2e350b828 100644 --- a/include/types/fd.h +++ b/include/types/fd.h @@ -91,10 +91,6 @@ struct fdinfo { * poller should set it to 100. * - is initialized by the poller's init() function, and cleaned by * the term() function. - * - cond_s() checks if fd was not set then sets it and returns 1. Otherwise - * it returns 0. It may be the same as set(). - * - cond_c() checks if fd was set then clears it and returns 1. Otherwise - * it returns 0. It may be the same as clr(). * - clo() should be used to do indicate the poller that fd will be closed. It * may be the same as rem() on some pollers. * - poll() calls the poller, expiring at @@ -102,10 +98,8 @@ struct fdinfo { struct poller { void *private; /* any private data for the poller */ int REGPRM2 (*is_set)(const int fd, int dir); /* check if is being polled for dir */ - int REGPRM2 (*set)(const int fd, int dir); /* set polling on for */ - int REGPRM2 (*clr)(const int fd, int dir); /* clear polling on for */ - int REGPRM2 (*cond_s)(const int fd, int dir); /* set polling on for if unset */ - int REGPRM2 (*cond_c)(const int fd, int dir); /* clear polling on for if set */ + void REGPRM2 (*set)(const int fd, int dir); /* set polling on for */ + void REGPRM2 (*clr)(const int fd, int dir); /* clear polling on for */ void REGPRM1 (*rem)(const int fd); /* remove any polling on */ void REGPRM1 (*clo)(const int fd); /* mark as closed */ void REGPRM2 (*poll)(struct poller *p, int exp); /* the poller itself */ diff --git a/src/ev_epoll.c b/src/ev_epoll.c index 63782d3ef..6c8408bc0 100644 --- a/src/ev_epoll.c +++ b/src/ev_epoll.c @@ -147,7 +147,7 @@ REGPRM2 static void alloc_chg_list(const int fd, int old_evt) ptr->prev = old_evt; } -REGPRM2 static int __fd_set(const int fd, int dir) +REGPRM2 static void __fd_set(const int fd, int dir) { uint32_t ofs = FD2OFS(fd); uint32_t dmsk = DIR2MSK(dir); @@ -156,15 +156,14 @@ REGPRM2 static int __fd_set(const int fd, int dir) old_evt = fd_evts[ofs] >> FD2BIT(fd); old_evt &= 3; if (unlikely(old_evt & dmsk)) - return 0; + return; alloc_chg_list(fd, old_evt); dmsk <<= FD2BIT(fd); fd_evts[ofs] |= dmsk; - return 1; } -REGPRM2 static int __fd_clr(const int fd, int dir) +REGPRM2 static void __fd_clr(const int fd, int dir) { uint32_t ofs = FD2OFS(fd); uint32_t dmsk = DIR2MSK(dir); @@ -173,12 +172,11 @@ REGPRM2 static int __fd_clr(const int fd, int dir) old_evt = fd_evts[ofs] >> FD2BIT(fd); old_evt &= 3; if (unlikely(!(old_evt & dmsk))) - return 0; + return; alloc_chg_list(fd, old_evt); dmsk <<= FD2BIT(fd); fd_evts[ofs] &= ~dmsk; - return 1; } REGPRM1 static void __fd_rem(int fd) @@ -190,7 +188,6 @@ REGPRM1 static void __fd_rem(int fd) alloc_chg_list(fd, 0); fd_evts[ofs] &= ~FD2MSK(fd); - return; } /* @@ -206,7 +203,6 @@ REGPRM1 static void __fd_clo(int fd) ptr->prev = 0; chg_ptr[fd] = NULL; } - return; } /* @@ -399,8 +395,8 @@ static void _do_register(void) p->fork = _do_fork; p->is_set = __fd_is_set; - p->cond_s = p->set = __fd_set; - p->cond_c = p->clr = __fd_clr; + p->set = __fd_set; + p->clr = __fd_clr; p->rem = __fd_rem; p->clo = __fd_clo; } diff --git a/src/ev_kqueue.c b/src/ev_kqueue.c index 3d12e36bf..4bfbf1bf8 100644 --- a/src/ev_kqueue.c +++ b/src/ev_kqueue.c @@ -60,24 +60,22 @@ REGPRM2 static int __fd_is_set(const int fd, int dir) return FD_ISSET(fd, fd_evts[dir]); } -REGPRM2 static int __fd_set(const int fd, int dir) +REGPRM2 static void __fd_set(const int fd, int dir) { /* if the value was set, do nothing */ if (FD_ISSET(fd, fd_evts[dir])) - return 0; + return; FD_SET(fd, fd_evts[dir]); EV_SET(kev, fd, dir2filt[dir], EV_ADD, 0, 0, NULL); kevent(kqueue_fd, kev, 1, NULL, 0, NULL); - return 1; } -REGPRM2 static int __fd_clr(const int fd, int dir) +REGPRM2 static void __fd_clr(const int fd, int dir) { if (!kqev_del(kev, fd, dir)) - return 0; + return; kevent(kqueue_fd, kev, 1, NULL, 0, NULL); - return 1; } REGPRM1 static void __fd_rem(int fd) @@ -275,8 +273,8 @@ static void _do_register(void) p->fork = _do_fork; p->is_set = __fd_is_set; - p->cond_s = p->set = __fd_set; - p->cond_c = p->clr = __fd_clr; + p->set = __fd_set; + p->clr = __fd_clr; p->rem = __fd_rem; p->clo = __fd_clo; } diff --git a/src/ev_poll.c b/src/ev_poll.c index cb210f720..f72dfe286 100644 --- a/src/ev_poll.c +++ b/src/ev_poll.c @@ -43,34 +43,14 @@ REGPRM2 static int __fd_is_set(const int fd, int dir) return FD_ISSET(fd, fd_evts[dir]); } -REGPRM2 static int __fd_set(const int fd, int dir) +REGPRM2 static void __fd_set(const int fd, int dir) { FD_SET(fd, fd_evts[dir]); - return 0; } -REGPRM2 static int __fd_clr(const int fd, int dir) +REGPRM2 static void __fd_clr(const int fd, int dir) { FD_CLR(fd, fd_evts[dir]); - return 0; -} - -REGPRM2 static int __fd_cond_s(const int fd, int dir) -{ - int ret; - ret = !FD_ISSET(fd, fd_evts[dir]); - if (ret) - FD_SET(fd, fd_evts[dir]); - return ret; -} - -REGPRM2 static int __fd_cond_c(const int fd, int dir) -{ - int ret; - ret = FD_ISSET(fd, fd_evts[dir]); - if (ret) - FD_CLR(fd, fd_evts[dir]); - return ret; } REGPRM1 static void __fd_rem(const int fd) @@ -252,8 +232,6 @@ static void _do_register(void) p->set = __fd_set; p->clr = __fd_clr; p->clo = p->rem = __fd_rem; - p->cond_s = __fd_cond_s; - p->cond_c = __fd_cond_c; } diff --git a/src/ev_select.c b/src/ev_select.c index c5d393669..cf4526216 100644 --- a/src/ev_select.c +++ b/src/ev_select.c @@ -40,34 +40,14 @@ REGPRM2 static int __fd_is_set(const int fd, int dir) return FD_ISSET(fd, fd_evts[dir]); } -REGPRM2 static int __fd_set(const int fd, int dir) +REGPRM2 static void __fd_set(const int fd, int dir) { FD_SET(fd, fd_evts[dir]); - return 0; } -REGPRM2 static int __fd_clr(const int fd, int dir) +REGPRM2 static void __fd_clr(const int fd, int dir) { FD_CLR(fd, fd_evts[dir]); - return 0; -} - -REGPRM2 static int __fd_cond_s(const int fd, int dir) -{ - int ret; - ret = !FD_ISSET(fd, fd_evts[dir]); - if (ret) - FD_SET(fd, fd_evts[dir]); - return ret; -} - -REGPRM2 static int __fd_cond_c(const int fd, int dir) -{ - int ret; - ret = FD_ISSET(fd, fd_evts[dir]); - if (ret) - FD_CLR(fd, fd_evts[dir]); - return ret; } REGPRM1 static void __fd_rem(int fd) @@ -249,8 +229,6 @@ static void _do_register(void) p->set = __fd_set; p->clr = __fd_clr; p->clo = p->rem = __fd_rem; - p->cond_s = __fd_cond_s; - p->cond_c = __fd_cond_c; } diff --git a/src/ev_sepoll.c b/src/ev_sepoll.c index 5d93bf2a9..62ee1156e 100644 --- a/src/ev_sepoll.c +++ b/src/ev_sepoll.c @@ -215,7 +215,7 @@ REGPRM2 static int __fd_is_set(const int fd, int dir) * Don't worry about the strange constructs in __fd_set/__fd_clr, they are * designed like this in order to reduce the number of jumps (verified). */ -REGPRM2 static int __fd_set(const int fd, int dir) +REGPRM2 static void __fd_set(const int fd, int dir) { unsigned int i; @@ -229,15 +229,14 @@ REGPRM2 static int __fd_set(const int fd, int dir) if (i != FD_EV_STOP) { if (unlikely(i != FD_EV_IDLE)) - return 0; + return; // switch to SPEC state and allocate a SPEC entry. alloc_spec_entry(fd); } fdtab[fd].spec.e ^= (unsigned int)(FD_EV_IN_SL << dir); - return 1; } -REGPRM2 static int __fd_clr(const int fd, int dir) +REGPRM2 static void __fd_clr(const int fd, int dir) { unsigned int i; @@ -251,7 +250,7 @@ REGPRM2 static int __fd_clr(const int fd, int dir) if (i != FD_EV_SPEC) { if (unlikely(i != FD_EV_WAIT)) - return 0; + return; // switch to STOP state /* We will create a queue entry for this one because we want to * process it later in order to merge it with other events on @@ -260,7 +259,6 @@ REGPRM2 static int __fd_clr(const int fd, int dir) alloc_spec_entry(fd); } fdtab[fd].spec.e ^= (unsigned int)(FD_EV_IN_SL << dir); - return 1; } /* normally unused */ @@ -593,8 +591,8 @@ static void _do_register(void) p->fork = _do_fork; p->is_set = __fd_is_set; - p->cond_s = p->set = __fd_set; - p->cond_c = p->clr = __fd_clr; + p->set = __fd_set; + p->clr = __fd_clr; p->rem = __fd_rem; p->clo = __fd_clo; } diff --git a/src/sock_raw.c b/src/sock_raw.c index 8136d601c..1532e762d 100644 --- a/src/sock_raw.c +++ b/src/sock_raw.c @@ -793,7 +793,7 @@ static void sock_raw_data_finish(struct stream_interface *si) if (!(si->flags & SI_FL_WAIT_ROOM)) { if ((ib->flags & (BF_FULL|BF_HIJACK|BF_DONT_READ)) == BF_FULL) si->flags |= SI_FL_WAIT_ROOM; - EV_FD_COND_C(fd, DIR_RD); + EV_FD_CLR(fd, DIR_RD); ib->rex = TICK_ETERNITY; } } @@ -804,7 +804,7 @@ static void sock_raw_data_finish(struct stream_interface *si) * have updated it if there has been a completed I/O. */ si->flags &= ~SI_FL_WAIT_ROOM; - EV_FD_COND_S(fd, DIR_RD); + EV_FD_SET(fd, DIR_RD); if (!(ib->flags & (BF_READ_NOEXP|BF_DONT_READ)) && !tick_isset(ib->rex)) ib->rex = tick_add_ifset(now_ms, ib->rto); } @@ -818,7 +818,7 @@ static void sock_raw_data_finish(struct stream_interface *si) if (!(si->flags & SI_FL_WAIT_DATA)) { if ((ob->flags & (BF_FULL|BF_HIJACK|BF_SHUTW_NOW)) == 0) si->flags |= SI_FL_WAIT_DATA; - EV_FD_COND_C(fd, DIR_WR); + EV_FD_CLR(fd, DIR_WR); ob->wex = TICK_ETERNITY; } } @@ -829,7 +829,7 @@ static void sock_raw_data_finish(struct stream_interface *si) * have updated it if there has been a completed I/O. */ si->flags &= ~SI_FL_WAIT_DATA; - EV_FD_COND_S(fd, DIR_WR); + EV_FD_SET(fd, DIR_WR); if (!tick_isset(ob->wex)) { ob->wex = tick_add_ifset(now_ms, ob->wto); if (tick_isset(ib->rex) && !(si->flags & SI_FL_INDEP_STR)) { @@ -870,12 +870,12 @@ static void sock_raw_chk_rcv(struct stream_interface *si) /* stop reading */ if ((ib->flags & (BF_FULL|BF_HIJACK|BF_DONT_READ)) == BF_FULL) si->flags |= SI_FL_WAIT_ROOM; - EV_FD_COND_C(si_fd(si), DIR_RD); + EV_FD_CLR(si_fd(si), DIR_RD); } else { /* (re)start reading */ si->flags &= ~SI_FL_WAIT_ROOM; - EV_FD_COND_S(si_fd(si), DIR_RD); + EV_FD_SET(si_fd(si), DIR_RD); } } @@ -951,7 +951,7 @@ static void sock_raw_chk_snd(struct stream_interface *si) /* Otherwise there are remaining data to be sent in the buffer, * which means we have to poll before doing so. */ - EV_FD_COND_S(si_fd(si), DIR_WR); + EV_FD_SET(si_fd(si), DIR_WR); si->flags &= ~SI_FL_WAIT_DATA; if (!tick_isset(ob->wex)) ob->wex = tick_add_ifset(now_ms, ob->wto);