summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Harris <pharris@opentext.com>2012-08-16 11:59:14 -0400
committerPeter Harris <pharris@opentext.com>2012-09-18 11:42:23 -0400
commit08cc068ead7b8e678cdb119b38ada5261d5cc3ea (patch)
tree10884817653262c3c3af3273e0f8b4f3b749bebe /src
parentff53285ae3f604e9f2cc5f4837255220459b5e44 (diff)
Allow xcb_send_request with >MAX_IOV iovecs
This allows an application to do a scatter/gather operation on a large image buffer to avoid the extra memcpy. Use autoconf to use UIO_MAXIOV where IOV_MAX is not available (and the POSIX minimum of 16 where neither are available). Reviewed-by: Uli Schlachter <psychon@znc.in> Signed-off-by: Peter Harris <pharris@opentext.com>
Diffstat (limited to 'src')
-rw-r--r--src/xcb_conn.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/xcb_conn.c b/src/xcb_conn.c
index 7979491..e01d566 100644
--- a/src/xcb_conn.c
+++ b/src/xcb_conn.c
@@ -36,6 +36,7 @@
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
+#include <limits.h>
#include "xcb.h"
#include "xcbint.h"
@@ -209,7 +210,11 @@ static int write_vec(xcb_connection_t *c, struct iovec **vector, int *count)
i++;
}
#else
- n = writev(c->fd, *vector, *count);
+ n = *count;
+ if (n > IOV_MAX)
+ n = IOV_MAX;
+
+ n = writev(c->fd, *vector, n);
if(n < 0 && errno == EAGAIN)
return 1;
#endif /* _WIN32 */