[Xcb] [PUSHED] [PATCH] Increase unix socket send buffer to at least 64KB

Christian Linhart chris at DemoRecorder.com
Tue Feb 2 23:49:09 PST 2016


Hi Mark,

I have just pushed this patch for you.

Before that, I have made a quick test under Linux (running gimp with that lib)
in order to see whether it also works under Linux.
Looks good.
 
Thank you for this patch.

Chris

P.S.: If you want to get commit rights for xcb/proto and xcb/libxcb, the procedure is as follows:
* apply for a freedesktop.org account if you don't have one yet: 
    http://freedesktop.org/wiki/AccountRequests/
* For getting commit right to specific repos, I don't know the procedure.
   Does anybody have experience with this?
   If you need a new fdo-account and specify that you need it for XCB, then it may be done together with giving you the account(?).


On 2016-02-02 20:08, Mark Kettenis wrote:
>> Date: Sun, 24 Jan 2016 10:48:41 +0100
>> From: Matthieu Herrb <matthieu at herrb.eu>
>>
>> On Sat, Jan 23, 2016 at 05:29:32PM +0100, Mark Kettenis wrote:
>>> Some systems (e.g. OpenBSD) have a rather small default socket send buffer
>>> size of 4KB.  The result is that sending requests with a largish payload
>>> requires serveral writev(2) system calls.  Make sure the socket send buff=
>> er
>>> is at least 64KB such that we're likely to succeed with a single system
>>> call for most requests.  A similar change was made to the xtrans code
>>> some time ago.
>>> =20
>>> Signed-off-by: Mark Kettenis <kettenis at openbsd.org>
>> Reviewed-by: Matthieu Herrb <matthieu at herrb.eu>
> Looks like I don't have write permission to the libxcb repo.  Can
> somebody push this for me, or give me write permission?
>
> Thanks,
>
> Mark
>
>>> ---
>>>  src/xcb_util.c | 7 +++++++
>>>  1 file changed, 7 insertions(+)
>>> =20
>>> diff --git a/src/xcb_util.c b/src/xcb_util.c
>>> index ba0f108..a3357ef 100644
>>> --- a/src/xcb_util.c
>>> +++ b/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 =3D sizeof(int);
>>> +    int val;
>>> =20
>>>      if (protocol && strcmp("unix",protocol))
>>>          return -1;
>>> @@ -440,6 +442,11 @@ static int _xcb_open_unix(char *protocol, const char=
>>  *file)
>>>      fd =3D _xcb_socket(AF_UNIX, SOCK_STREAM, 0);
>>>      if(fd =3D=3D -1)
>>>          return -1;
>>> +    if(getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) =3D=3D 0 && val=
>>  < 64 * 1024)
>>> +    {
>>> +        val =3D 64 * 1024;
>>> +        setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, sizeof(int));
>>> +    }
>>>      if(connect(fd, (struct sockaddr *) &addr, sizeof(addr)) =3D=3D -1) {
>>>          close(fd);
>>>          return -1;
>>> --=20
>>> 2.7.0
>>> =20
>>> _______________________________________________
>>> Xcb mailing list
>>> Xcb at lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/xcb
>> --=20
>> Matthieu Herrb
> _______________________________________________
> Xcb mailing list
> Xcb at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xcb



More information about the Xcb mailing list