From 4f579ed8f63f420959c3cb3ac320aae14d2feac3 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Wed, 4 Aug 2021 16:37:58 +0200 Subject: [PATCH] Hopefully fix compilation on OpenIndiana --- pdns/devpollmplexer.cc | 1 + pdns/epollmplexer.cc | 2 ++ pdns/kqueuemplexer.cc | 2 ++ pdns/portsmplexer.cc | 9 +++++---- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/pdns/devpollmplexer.cc b/pdns/devpollmplexer.cc index 715206d775..c73c03d28f 100644 --- a/pdns/devpollmplexer.cc +++ b/pdns/devpollmplexer.cc @@ -93,6 +93,7 @@ static int convertEventKind(FDMultiplexer::EventKind kind) case FDMultiplexer::EventKind::Both: return POLLIN | POLLOUT; } + throw std::runtime_error("Unhandled event kind in the /dev/poll multiplexer"); } void DevPollFDMultiplexer::addFD(int fd, FDMultiplexer::EventKind kind) diff --git a/pdns/epollmplexer.cc b/pdns/epollmplexer.cc index 88e58b7b78..dc060f1307 100644 --- a/pdns/epollmplexer.cc +++ b/pdns/epollmplexer.cc @@ -113,6 +113,8 @@ static uint32_t convertEventKind(FDMultiplexer::EventKind kind) case FDMultiplexer::EventKind::Both: return EPOLLIN | EPOLLOUT; } + + throw std::runtime_error("Unhandled event kind in the epoll multiplexer"); } void EpollFDMultiplexer::addFD(int fd, FDMultiplexer::EventKind kind) diff --git a/pdns/kqueuemplexer.cc b/pdns/kqueuemplexer.cc index 447b45ea3b..da2fa1647c 100644 --- a/pdns/kqueuemplexer.cc +++ b/pdns/kqueuemplexer.cc @@ -97,6 +97,8 @@ static uint32_t convertEventKind(FDMultiplexer::EventKind kind) case FDMultiplexer::EventKind::Both: throw std::runtime_error("Read and write events cannot be combined in one go with kqueue"); } + + throw std::runtime_error("Unhandled event kind in the kqueue multiplexer"); } void KqueueFDMultiplexer::addFD(int fd, FDMultiplexer::EventKind kind) diff --git a/pdns/portsmplexer.cc b/pdns/portsmplexer.cc index 2f3c945912..76ebdb1e07 100644 --- a/pdns/portsmplexer.cc +++ b/pdns/portsmplexer.cc @@ -74,6 +74,7 @@ static int convertEventKind(FDMultiplexer::EventKind kind) case FDMultiplexer::EventKind::Both: return POLLIN | POLLOUT; } + throw std::runtime_error("Unhandled event kind in the ports multiplexer"); } void PortsFDMultiplexer::addFD(int fd, FDMultiplexer::EventKind kind) @@ -124,14 +125,14 @@ void PortsFDMultiplexer::getAvailableFDs(std::vector& fds, int timeout) const auto fd = d_pevents[n].portev_object; /* we need to re-associate the FD */ - if ((d_pevents[n].portev_events & POLLIN || d_pevents[n].portev_events & POLLER || d_pevents[n].portev_events & POLLHUP)) { + if ((d_pevents[n].portev_events & POLLIN || d_pevents[n].portev_events & POLLERR || d_pevents[n].portev_events & POLLHUP)) { if (d_readCallbacks.count(fd)) { if (port_associate(d_portfd, PORT_SOURCE_FD, fd, d_writeCallbacks.count(fd) > 0 ? POLLIN | POLLOUT : POLLIN, 0) < 0) { throw FDMultiplexerException("Unable to add fd back to ports (read): " + stringerror()); } } } - else if ((d_pevents[n].portev_events & POLLOUT || d_pevents[n].portev_events & POLLER)) { + else if ((d_pevents[n].portev_events & POLLOUT || d_pevents[n].portev_events & POLLERR)) { if (d_writeCallbacks.count(fd)) { if (port_associate(d_portfd, PORT_SOURCE_FD, fd, d_readCallbacks.count(fd) > 0 ? POLLIN | POLLOUT : POLLOUT, 0) < 0) { throw FDMultiplexerException("Unable to add fd back to ports (write): " + stringerror()); @@ -182,7 +183,7 @@ int PortsFDMultiplexer::run(struct timeval* now, int timeout) d_inrun = true; for (unsigned int n = 0; n < numevents; ++n) { - if (d_pevents[n].portev_events & POLLIN || d_pevents[n].portev_events & POLLER || d_pevents[n].portev_events & POLLHUP) { + if (d_pevents[n].portev_events & POLLIN || d_pevents[n].portev_events & POLLERR || d_pevents[n].portev_events & POLLHUP) { const auto& iter = d_readCallbacks.find(d_pevents[n].portev_object); if (iter != d_readCallbacks.end()) { iter->d_callback(iter->d_fd, iter->d_parameter); @@ -191,7 +192,7 @@ int PortsFDMultiplexer::run(struct timeval* now, int timeout) } } } - if (d_pevents[n].portev_events & POLLOUT || d_pevents[n].portev_events & POLLER) { + if (d_pevents[n].portev_events & POLLOUT || d_pevents[n].portev_events & POLLERR) { const auto& iter = d_writeCallbacks.find(d_pevents[n].portev_object); if (iter != d_writeCallbacks.end()) { iter->d_callback(iter->d_fd, iter->d_parameter); -- 2.47.2