diff options
author | Hartmut Brandt <harti@FreeBSD.org> | 2018-07-03 08:44:40 +0000 |
---|---|---|
committer | Hartmut Brandt <harti@FreeBSD.org> | 2018-07-03 08:44:40 +0000 |
commit | 8e9b3e707151d136ec95e7f1d37556e39c1e228c (patch) | |
tree | 0bf4cf04b0aa2c25155c8b45a1704512517c9127 /contrib/libbegemot | |
parent | 4dc1b29b7169560aa0a16bb3488dac17325767f0 (diff) | |
download | src-8e9b3e707151d136ec95e7f1d37556e39c1e228c.tar.gz src-8e9b3e707151d136ec95e7f1d37556e39c1e228c.zip |
Notes
Diffstat (limited to 'contrib/libbegemot')
-rw-r--r-- | contrib/libbegemot/rpoll.c | 49 | ||||
-rw-r--r-- | contrib/libbegemot/rpoll.h | 15 |
2 files changed, 24 insertions, 40 deletions
diff --git a/contrib/libbegemot/rpoll.c b/contrib/libbegemot/rpoll.c index 408635e01799..c61b84057eba 100644 --- a/contrib/libbegemot/rpoll.c +++ b/contrib/libbegemot/rpoll.c @@ -44,17 +44,6 @@ # include <unistd.h> # include <sys/time.h> -/* - * There happens to be linuxes which read siginfo.h when including - * signal.h, which, for no appearent reason, defines these symbols. - */ -# ifdef POLL_IN -# undef POLL_IN -# endif -# ifdef POLL_OUT -# undef POLL_OUT -# endif - # include "rpoll.h" /* @@ -339,11 +328,11 @@ poll_build(void) if(p->fd >= 0) { f->fd = p->fd; f->events = 0; - if(p->mask & POLL_IN) + if(p->mask & RPOLL_IN) f->events |= poll_in; - if(p->mask & POLL_OUT) + if(p->mask & RPOLL_OUT) f->events |= poll_out; - if(p->mask & POLL_EXCEPT) + if(p->mask & RPOLL_EXCEPT) f->events |= poll_except; f->revents = 0; p->pfd = f++; @@ -360,11 +349,11 @@ poll_build(void) if(p->fd >= 0) { if(p->fd > maxfd) maxfd = p->fd; - if(p->mask & POLL_IN) + if(p->mask & RPOLL_IN) FD_SET(p->fd, &rset); - if(p->mask & POLL_OUT) + if(p->mask & RPOLL_OUT) FD_SET(p->fd, &wset); - if(p->mask & POLL_EXCEPT) + if(p->mask & RPOLL_EXCEPT) FD_SET(p->fd, &xset); } # endif @@ -582,27 +571,27 @@ poll_dispatch(int wait) # ifdef USE_POLL if(regs[idx].pfd) { - if ((regs[idx].mask & POLL_IN) && + if ((regs[idx].mask & RPOLL_IN) && (regs[idx].pfd->revents & poll_in)) - mask |= POLL_IN; - if ((regs[idx].mask & POLL_OUT) && + mask |= RPOLL_IN; + if ((regs[idx].mask & RPOLL_OUT) && (regs[idx].pfd->revents & poll_out)) - mask |= POLL_OUT; - if((regs[idx].mask & POLL_EXCEPT) && + mask |= RPOLL_OUT; + if((regs[idx].mask & RPOLL_EXCEPT) && (regs[idx].pfd->revents & poll_except)) - mask |= POLL_EXCEPT; + mask |= RPOLL_EXCEPT; } # endif # ifdef USE_SELECT - if ((regs[idx].mask & POLL_IN) && + if ((regs[idx].mask & RPOLL_IN) && FD_ISSET(regs[idx].fd, &nrset)) - mask |= POLL_IN; - if ((regs[idx].mask & POLL_OUT) && + mask |= RPOLL_IN; + if ((regs[idx].mask & RPOLL_OUT) && FD_ISSET(regs[idx].fd, &nwset)) - mask |= POLL_OUT; - if ((regs[idx].mask & POLL_EXCEPT) && + mask |= RPOLL_OUT; + if ((regs[idx].mask & RPOLL_EXCEPT) && FD_ISSET(regs[idx].fd, &nxset)) - mask |= POLL_EXCEPT; + mask |= RPOLL_EXCEPT; # endif assert(idx < regs_alloc); @@ -723,7 +712,7 @@ main(int argc, char *argv[]) { argv = argv; gettimeofday(&start, NULL); - poll_register(0, infunc, NULL, POLL_IN); + poll_register(0, infunc, NULL, RPOLL_IN); if (argc < 2) { t0 = poll_start_timer(1000, 1, tfunc0, "1 second"); diff --git a/contrib/libbegemot/rpoll.h b/contrib/libbegemot/rpoll.h index 497a41ef5eaf..4f0c4e38ec7c 100644 --- a/contrib/libbegemot/rpoll.h +++ b/contrib/libbegemot/rpoll.h @@ -47,16 +47,11 @@ int poll_start_utimer(unsigned long long usecs, int repeat, timer_f func, void *arg); void poll_stop_timer(int); -# if defined(POLL_IN) -# undef POLL_IN -# endif -# if defined(POLL_OUT) -# undef POLL_OUT -# endif - -# define POLL_IN 1 -# define POLL_OUT 2 -# define POLL_EXCEPT 4 +enum { + RPOLL_IN = 1, + RPOLL_OUT = 2, + RPOLL_EXCEPT = 4, +}; extern int rpoll_policy; extern int rpoll_trace; |