MINOR: fd: Add fd_update_events function
This function should be called by the poller to set FD_POLL_* flags on an FD and
update its state if needed. This function has been added to ease threads support
integration.
diff --git a/include/proto/fd.h b/include/proto/fd.h
index 14b2849..56e2082 100644
--- a/include/proto/fd.h
+++ b/include/proto/fd.h
@@ -343,6 +343,20 @@
}
}
+/* Update events seen for FD <fd> and its state if needed. This should be called
+ * by the poller to set FD_POLL_* flags. */
+static inline void fd_update_events(int fd, int evts)
+{
+ fdtab[fd].ev &= FD_POLL_STICKY;
+ fdtab[fd].ev |= evts;
+
+ if (fdtab[fd].ev & (FD_POLL_IN | FD_POLL_HUP | FD_POLL_ERR))
+ fd_may_recv(fd);
+
+ if (fdtab[fd].ev & (FD_POLL_OUT | FD_POLL_ERR))
+ fd_may_send(fd);
+}
+
/* Prepares <fd> for being polled */
static inline void fd_insert(int fd)
{