]> git.ozlabs.org Git - ccan/blobdiff - ccan/io/io.h
io: add io_fd_block() helper.
[ccan] / ccan / io / io.h
index 11eeade63f820c2be20a296c6c7583f771b002a3..1e4e80e7db779410b72a80428c65b12e8137218f 100644 (file)
@@ -692,6 +692,16 @@ int io_conn_fd(const struct io_conn *conn);
  */
 bool io_flush_sync(struct io_conn *conn);
 
+/**
+ * io_fd_block - helper to set an fd blocking/nonblocking.
+ * @fd: the file descriptor
+ * @block: true to set blocking, false to set non-blocking.
+ *
+ * Generally only fails is @fd isn't a valid file descriptor, otherwise
+ * returns true.
+ */
+bool io_fd_block(int fd, bool block);
+
 /**
  * io_time_override - override the normal call for time.
  * @nowfn: the function to call.