summaryrefslogtreecommitdiff
path: root/dist/libxcb/src/xcb_util.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2016-02-02 18:42:23 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2016-02-02 18:42:23 +0000
commitdc62a0dd1b786d581886b0feb32ae088a6761155 (patch)
treebded301bcd5d02e269bdb2cbe049cb6dde5e2efb /dist/libxcb/src/xcb_util.c
parent8312291120c87c5c15a2471ecdcd6858dd4fe57e (diff)
Make sure the socket send buffer is at least 64KB. This reduces the number of
writev(2) system calls made for largish requests. A similar change was made to the libxtrans code a while ago. This should speed up applications that send images to the X server, like Firefox. The seedupmight not be noticable though. But it reduces the noice in ktrace logs. ok matthieu@
Diffstat (limited to 'dist/libxcb/src/xcb_util.c')
-rw-r--r--dist/libxcb/src/xcb_util.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/dist/libxcb/src/xcb_util.c b/dist/libxcb/src/xcb_util.c
index ba0f10867..a3357efde 100644
--- a/dist/libxcb/src/xcb_util.c
+++ b/dist/libxcb/src/xcb_util.c
@@ -428,6 +428,8 @@ static int _xcb_open_unix(char *protocol, const char *file)
{
int fd;
struct sockaddr_un addr;
+ socklen_t len = sizeof(int);
+ int val;
if (protocol && strcmp("unix",protocol))
return -1;
@@ -440,6 +442,11 @@ static int _xcb_open_unix(char *protocol, const char *file)
fd = _xcb_socket(AF_UNIX, SOCK_STREAM, 0);
if(fd == -1)
return -1;
+ if(getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) == 0 && val < 64 * 1024)
+ {
+ val = 64 * 1024;
+ setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, sizeof(int));
+ }
if(connect(fd, (struct sockaddr *) &addr, sizeof(addr)) == -1) {
close(fd);
return -1;