]> git.ozlabs.org Git - ccan/blobdiff - ccan/io/io.h
ccan/io: save errno on io_close, for finish functions.
[ccan] / ccan / io / io.h
index 8199bda9802050f747440f66ec1da97f987fcb47..6553e7ab29b93de5bc1bd5118f63745f81b5279b 100644 (file)
@@ -38,6 +38,9 @@ struct io_plan {
                        const char *buf;
                        size_t *lenp;
                } writepart;
+               struct {
+                       int saved_errno;
+               } close;
                struct {
                        void *p;
                        size_t len;
@@ -84,7 +87,8 @@ struct io_conn *io_new_conn_(int fd, struct io_plan plan);
  * @arg: the argument to @finish.
  *
  * @finish will be called when an I/O operation fails, or you call
- * io_close() on the connection.
+ * io_close() on the connection.  errno will be set to the value
+ * after the failed I/O, or at the call to io_close().
  */
 #define io_set_finish(conn, finish, arg)                               \
        io_set_finish_((conn),                                          \