]> git.ozlabs.org Git - ccan/blobdiff - ccan/io/io.h
io: allow overriding poll function.
[ccan] / ccan / io / io.h
index fe42b53736005c4459c3b56afbbaa87ffe46f04a..11eeade63f820c2be20a296c6c7583f771b002a3 100644 (file)
@@ -4,6 +4,7 @@
 #include <ccan/tal/tal.h>
 #include <ccan/typesafe_cb/typesafe_cb.h>
 #include <stdbool.h>
 #include <ccan/tal/tal.h>
 #include <ccan/typesafe_cb/typesafe_cb.h>
 #include <stdbool.h>
+#include <poll.h>
 #include <unistd.h>
 
 struct timers;
 #include <unistd.h>
 
 struct timers;
@@ -701,4 +702,14 @@ bool io_flush_sync(struct io_conn *conn);
  */
 struct timemono (*io_time_override(struct timemono (*now)(void)))(void);
 
  */
 struct timemono (*io_time_override(struct timemono (*now)(void)))(void);
 
+/**
+ * io_poll_override - override the normal call for poll.
+ * @pollfn: the function to call.
+ *
+ * io usually uses poll() internally, but this forces it to use your
+ * function (eg. for debugging, suppressing fds, or polling on others unknown
+ * to ccan/io).  Returns the old one.
+ */
+int (*io_poll_override(int (*poll)(struct pollfd *fds, nfds_t nfds, int timeout)))(struct pollfd *, nfds_t, int);
+
 #endif /* CCAN_IO_H */
 #endif /* CCAN_IO_H */