X-Git-Url: http://git.demorecorder.com/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fxcb_out.c;h=18bb5f912f90539b82c774259fbce315d22683bd;hb=ce5395eb4611341ba7c243ed524d023a616f73bb;hp=c0601f27024d667a8aaae1d4136c47848e99faf7;hpb=769acff0da8b9859ebdf052dce80045465c7598c;p=free-sw%2Fxcb%2Flibxcb diff --git a/src/xcb_out.c b/src/xcb_out.c index c0601f2..18bb5f9 100644 --- a/src/xcb_out.c +++ b/src/xcb_out.c @@ -25,6 +25,10 @@ /* Stuff that sends stuff to the server. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include @@ -256,6 +260,24 @@ unsigned int xcb_send_request(xcb_connection_t *c, int flags, struct iovec *vect return request; } +void +xcb_send_fd(xcb_connection_t *c, int fd) +{ +#if HAVE_SENDMSG + if (c->has_error) + return; + pthread_mutex_lock(&c->iolock); + while (c->out.out_fd.nfd == XCB_MAX_PASS_FD) { + _xcb_out_flush_to(c, c->out.request); + if (c->has_error) + break; + } + if (!c->has_error) + c->out.out_fd.fd[c->out.out_fd.nfd++] = fd; + pthread_mutex_unlock(&c->iolock); +#endif +} + int xcb_take_socket(xcb_connection_t *c, void (*return_socket)(void *closure), void *closure, int flags, uint64_t *sent) { int ret; @@ -268,7 +290,7 @@ int xcb_take_socket(xcb_connection_t *c, void (*return_socket)(void *closure), v * write requests, so keep flushing until we're done */ do - ret = _xcb_out_flush_to(c, c->out.request); + ret = _xcb_out_flush_to(c, c->out.request); while (ret && c->out.request != c->out.request_written); if(ret) {