C interface to the X Window System protocol, which replaces the traditional Xlib interface.
Go to file
Martin Dørum 21324989b7 Handle EINTR from recvmsg in _xcb_in_read
I have a GTK application which occasionally crashes with an "interrupted
system call" g_message from gdk. After a lot of debugging, I've found
that the call to recvmsg in _xcb_in_read occasionally fails with EINTR,
and instead of retrying the system call, xcb would just shut down the
connection.

This change makes _xcb_in_read treat EINTR the same as it would treat
EAGAIN; it returns 1 and libX11 ends up calling xcb_poll_for_event
again (from what I have understood).

I have spoken with a few people who think recvmsg failing with EINTR in
this case shouldn't ever happen, and I don't know enough to agree or
disagree with that. In case anyone wants to dig further and try to
figure out why the recvmsg call sometimes fails with EINTR, here's the
backtrace from inside of _xcb_in_read where that happened:

Thread 1 "beanbar" hit Breakpoint 1, _xcb_in_read (c=c@entry=0x55ecbe4aba80) at xcb_in.c:1059
1059                fprintf(stderr, "Hello World am %s:%i, errno is %s\n", __FILE__, __LINE__, strerror(errno));
(gdb) bt
0  0x00007fa48fa48639 in _xcb_in_read (c=c@entry=0x55ecbe4aba80) at xcb_in.c:1059
1  0x00007fa48fa489d8 in poll_for_next_event (c=0x55ecbe4aba80, queued=queued@entry=0) at xcb_in.c:352
2  0x00007fa48fa48a3d in poll_for_next_event (queued=0, c=<optimized out>) at xcb_in.c:722
3  0x00007fa48fa48a3d in xcb_poll_for_event (c=<optimized out>) at xcb_in.c:722
4  0x00007fa4908d1b7e in poll_for_event (dpy=dpy@entry=0x55ecbe4a9730, queued_only=queued_only@entry=0) at xcb_io.c:245
5  0x00007fa4908d1cf0 in poll_for_response (dpy=dpy@entry=0x55ecbe4a9730) at xcb_io.c:303
6  0x00007fa4908d1fed in _XEventsQueued (mode=2, dpy=0x55ecbe4a9730) at xcb_io.c:363
7  0x00007fa4908d1fed in _XEventsQueued (dpy=dpy@entry=0x55ecbe4a9730, mode=mode@entry=2) at xcb_io.c:344
8  0x00007fa4908c3d47 in XPending (dpy=0x55ecbe4a9730) at Pending.c:55
9  0x00007fa493cadbc7 in  () at /usr/lib/libgdk-3.so.0
10 0x00007fa49234d08a in g_main_context_prepare () at /usr/lib/libglib-2.0.so.0
11 0x00007fa49234d6e6 in  () at /usr/lib/libglib-2.0.so.0
12 0x00007fa49234d8ae in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
13 0x00007fa4938b920e in g_application_run () at /usr/lib/libgio-2.0.so.0
14 0x000055ecbc820af4 in main (argc=1, argv=0x7ffd06238098) at src/main.c:190

Signed-off-by: Martin Dørum <martid0311@gmail.com>
2019-05-19 16:05:08 +02:00
doc Fix typos & awkward wording in tutorial 2014-07-11 20:41:15 -07:00
m4 config: issue an error if DRI3 is requested, but sendfds is not available 2014-08-06 13:26:08 +02:00
man Escape \n to display properly in xcb-requests man page 2015-04-29 23:23:05 -07:00
src Handle EINTR from recvmsg in _xcb_in_read 2019-05-19 16:05:08 +02:00
tests tests: Add files to .gitignore 2013-08-15 00:35:08 +02:00
tools Match only XCB-namespaced XID generators when converting to xcb_generate_id. 2006-10-15 12:34:30 -07:00
.autom4te.cfg Use build-aux as autom4te cache directory 2013-08-15 00:35:07 +02:00
.gitignore Add ChangeLog and INSTALL using xorg macros 2014-08-06 13:29:16 +02:00
COPYING Fix the year in COPYING. 2006-04-27 17:32:20 -07:00
Makefile.am Add README.md to EXTRA_DIST 2019-02-17 12:23:17 -08:00
NEWS Release libxcb 1.13.1 2018-09-27 14:04:17 +02:00
README.md Update README for gitlab migration 2019-02-16 13:41:28 -08:00
autogen.sh autogen.sh: Implement GNOME Build API 2013-01-16 13:20:49 -05:00
check-pc-requires Move internal/private dependencies to Requires.private 2014-10-03 23:53:54 +02:00
configure.ac Update configure.ac bug URL for gitlab migration 2019-02-16 13:35:06 -08:00
xcb-composite.pc.in Move internal/private dependencies to Requires.private 2014-10-03 23:53:54 +02:00
xcb-damage.pc.in Move internal/private dependencies to Requires.private 2014-10-03 23:53:54 +02:00
xcb-dpms.pc.in Move internal/private dependencies to Requires.private 2014-10-03 23:53:54 +02:00
xcb-dri2.pc.in Move internal/private dependencies to Requires.private 2014-10-03 23:53:54 +02:00
xcb-dri3.pc.in Move internal/private dependencies to Requires.private 2014-10-03 23:53:54 +02:00
xcb-ge.pc.in optionally build the GE extension 2017-03-11 10:51:33 +01:00
xcb-glx.pc.in Move internal/private dependencies to Requires.private 2014-10-03 23:53:54 +02:00
xcb-present.pc.in Move internal/private dependencies to Requires.private 2014-10-03 23:53:54 +02:00
xcb-randr.pc.in Move internal/private dependencies to Requires.private 2014-10-03 23:53:54 +02:00
xcb-record.pc.in Move internal/private dependencies to Requires.private 2014-10-03 23:53:54 +02:00
xcb-render.pc.in Move internal/private dependencies to Requires.private 2014-10-03 23:53:54 +02:00
xcb-res.pc.in Move internal/private dependencies to Requires.private 2014-10-03 23:53:54 +02:00
xcb-screensaver.pc.in Move internal/private dependencies to Requires.private 2014-10-03 23:53:54 +02:00
xcb-shape.pc.in Move internal/private dependencies to Requires.private 2014-10-03 23:53:54 +02:00
xcb-shm.pc.in Move internal/private dependencies to Requires.private 2014-10-03 23:53:54 +02:00
xcb-sync.pc.in Move internal/private dependencies to Requires.private 2014-10-03 23:53:54 +02:00
xcb-xevie.pc.in Move internal/private dependencies to Requires.private 2014-10-03 23:53:54 +02:00
xcb-xf86dri.pc.in Move internal/private dependencies to Requires.private 2014-10-03 23:53:54 +02:00
xcb-xfixes.pc.in Move internal/private dependencies to Requires.private 2014-10-03 23:53:54 +02:00
xcb-xinerama.pc.in Move internal/private dependencies to Requires.private 2014-10-03 23:53:54 +02:00
xcb-xinput.pc.in Move internal/private dependencies to Requires.private 2014-10-03 23:53:54 +02:00
xcb-xkb.pc.in Move internal/private dependencies to Requires.private 2014-10-03 23:53:54 +02:00
xcb-xprint.pc.in Move internal/private dependencies to Requires.private 2014-10-03 23:53:54 +02:00
xcb-xselinux.pc.in Move internal/private dependencies to Requires.private 2014-10-03 23:53:54 +02:00
xcb-xtest.pc.in Move internal/private dependencies to Requires.private 2014-10-03 23:53:54 +02:00
xcb-xv.pc.in Move internal/private dependencies to Requires.private 2014-10-03 23:53:54 +02:00
xcb-xvmc.pc.in Move internal/private dependencies to Requires.private 2014-10-03 23:53:54 +02:00
xcb.pc.in Store xcbproto version libxcb was compiled with 2009-05-25 12:20:23 +02:00

About libxcb

libxcb provides an interface to the X Window System protocol, which replaces the traditional Xlib interface. It has several advantages over Xlib, including:

  • size: small, simple library, and lower memory footprint
  • latency hiding: batch several requests and wait for the replies later
  • direct protocol access: interface and protocol correspond exactly
  • proven thread support: transparently access XCB from multiple threads
  • easy extension implementation: interfaces auto-generated from XML-XCB

Xlib also uses XCB as a transport layer, allowing software to make requests and receive responses with both, which eases porting to XCB. However, client programs, libraries, and toolkits will gain the most benefit from a native XCB port.

More information about xcb is available from our website:

https://xcb.freedesktop.org/

Please report any issues you find to the freedesktop.org bug tracker at:

https://gitlab.freedesktop.org/xorg/lib/libxcb/issues

Discussion about XCB occurs on the XCB mailing list:

https://lists.freedesktop.org/mailman/listinfo/xcb

You can obtain the latest development versions of XCB using GIT from the libxcb code repository at:

https://gitlab.freedesktop.org/xorg/lib/libxcb

For anonymous checkouts, use:

git clone https://gitlab.freedesktop.org/xorg/lib/libxcb.git

For developers, use:

git clone git@gitlab.freedesktop.org:xorg/lib/libxcb.git