X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fio%2Ffdpass%2Ffdpass.h;fp=ccan%2Fio%2Ffdpass%2Ffdpass.h;h=533bc840f7ba5fbb03af6979032c9674b906d701;hp=366ff3521606e23e182ed5073b4378d12fdc98dd;hb=60e31637d7545a22844a3c0f46833031bce4295f;hpb=4f6d604ce616e70659b8494fd41ecd41e8fca30a diff --git a/ccan/io/fdpass/fdpass.h b/ccan/io/fdpass/fdpass.h index 366ff352..533bc840 100644 --- a/ccan/io/fdpass/fdpass.h +++ b/ccan/io/fdpass/fdpass.h @@ -7,6 +7,7 @@ * io_send_fd - output plan to send a file descriptor * @conn: the connection that plan is for. * @fd: the file descriptor to pass. + * @fdclose: true to close fd after successful sending. * @next: function to call output is done. * @arg: @next argument * @@ -22,17 +23,17 @@ * Example: * static struct io_plan *fd_to_conn(struct io_conn *conn, int fd) * { - * // Write fd, then close. - * return io_send_fd(conn, fd, io_close_cb, NULL); + * // Write fd, then close conn. + * return io_send_fd(conn, fd, false, io_close_cb, NULL); * } */ -#define io_send_fd(conn, fd, next, arg) \ - io_send_fd_((conn), (fd), \ +#define io_send_fd(conn, fd, fdclose, next, arg) \ + io_send_fd_((conn), (fd), (fdclose), \ typesafe_cb_preargs(struct io_plan *, void *, \ (next), (arg), struct io_conn *), \ (arg)) struct io_plan *io_send_fd_(struct io_conn *conn, - int fd, + int fd, bool fdclose, struct io_plan *(*next)(struct io_conn *, void *), void *arg);