X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fio%2Fio.h;h=0318aef300873fa71104e0a2b630ad28e93e7065;hb=dded32f2b03fca526271e35671fa36d299880429;hp=067a69c1dec441a752508dfe50ee8f83b8421466;hpb=e40f5c50a7a930fc98974936b7366b498ebf984c;p=ccan diff --git a/ccan/io/io.h b/ccan/io/io.h index 067a69c1..0318aef3 100644 --- a/ccan/io/io.h +++ b/ccan/io/io.h @@ -394,7 +394,7 @@ bool io_timeout_(struct io_conn *conn, struct timespec ts, * to have two connections for the same fd, and use one for read * operations and one for write. * - * You must io_close() both of them to close the fd. + * Returning io_close() on one will close both fds! * * Example: * static void setup_read_write(int fd, @@ -491,6 +491,14 @@ struct io_plan io_close_cb(struct io_conn *, void *unused); */ void *io_loop(void); +/** + * io_conn_fd - get the fd from a connection. + * @conn: the connection. + * + * Sometimes useful, eg for getsockname(). + */ +int io_conn_fd(const struct io_conn *conn); + /** * io_set_alloc - set alloc/realloc/free function for io to use. * @allocfn: allocator function