]> git.ozlabs.org Git - ccan/blobdiff - ccan/io/poll.c
ccan/io: add debugging helper for seeing if module is in charge of an fd.
[ccan] / ccan / io / poll.c
index 4cc9f4b7dc901c36ae4bf0869c0d1ebc9cee6c52..634f83d286a66669c54694daf2fab0de4ce1a416 100644 (file)
@@ -464,3 +464,15 @@ void *io_loop(struct timers *timers, struct timer **expired)
 
        return ret;
 }
+
+const void *io_have_fd(int fd, bool *listener)
+{
+       for (size_t i = 0; i < num_fds; i++) {
+               if (fds[i]->fd != fd)
+                       continue;
+               if (listener)
+                       *listener = fds[i]->listener;
+               return fds[i];
+       }
+       return NULL;
+}