summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2010-09-08Merge branch 'gsoc2010' of git://anongit.freedesktop.org/~chr/libxcbPeter Harris
2010-09-04_xcb_conn_wait: Shut down the connection on unexpected poll() events.Jamey Sharp
If a client calls close(2) on the connection's file descriptor and then flushes writes, libxcb causes a hang in the client. Any flush eventually calls _xcb_out_send() with has the following loop: while(ret && *count) ret = _xcb_conn_wait(c, &c->out.cond, vector, count); _xcb_conn_wait(), if built with USE_POLL, gets the POLLNVAL error. It only checks for POLLIN and POLLOUT though, ignoring the error. Return value is 1, count is unmodified, leaving us with an endless loop and a client hang. XTS testcase Xlib3/XConnectionNumber triggers this bug. It creates a display connection, closes its file descriptor, tries to send a no-op, and then expects an error. http://cgit.freedesktop.org/xorg/test/xts/tree/xts5/Xlib3/XConnectionNumber.m If poll returned POLLHUP or POLLERR, we might see the same result. If poll returns any event we didn't ask for, this patch causes _xcb_conn_shutdown() to be invoked and an error returned. This matches the behaviour if select(2) is used instead of poll(2): select(2) returns -1 and EBADF for an already closed file descriptor. I believe this fix both is safe and will handle any similar error. POSIX says that the only bits poll is permitted to set in revents are those bits that were set in events, plus POLLHUP, POLLERR, and POLLNVAL. So if we see any flags we didn't ask for then something has gone wrong. Patch inspired by earlier proposals from Peter Hutterer and Aaron Plattner--thanks! Reported-by: Peter Hutterer <peter.hutterer@who-t.net> Reported-by: Aaron Plattner <aplattner@nvidia.com> Signed-off-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Aaron Plattner <aplattner@nvidia.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Tested-by: Aaron Plattner <aplattner@nvidia.com> Cc: Peter Hutterer <peter.hutterer@who-t.net> Cc: Dan Nicholson <dbn.lists@gmail.com> Signed-off-by: Peter Harris <pharris@opentext.com>
2010-08-31Merge branch 'master' of git://github.com/topcat/xcb-win32Peter Harris
Conflicts: src/xcb_conn.c src/xcb_util.c Signed-off-by: Peter Harris <pharris@opentext.com>
2010-08-25xcb_disconnect: call shutdown() to force a disconnectAaron Plattner
Fixes the X Test Suite's XCloseDisplay-6 test, which has this (admittedly ridiculous) behavior: 1. Create a window w. 2. Open two display connections, dpy1, and dpy2. 3. Grab the server using dpy1. 4. Fork. 5 (child). XSetProperty on w using dpy2. 5 (parent). Verify that no event was recieved on dpy1. 6 (parent). XCloseDisplay(dpy1). 6 (child). Verify that an event was received on dpy2. It was failing because at step 6 (child), the server had not actually ungrabbed yet because the file descriptor for dpy1 was still open in the child process. Shutting down the socket during XCloseDisplay matches the behavior of non-XCB Xlib, which calls shutdown() from _X11TransSocketDisconnect. Thanks to Julien Cristau for noticing this. Signed-off-by: Aaron Plattner <aplattner at nvidia.com> Reviewed-by: Julien Cristau <jcristau@debian.org> Signed-off-by: Peter Harris <pharris@opentext.com>
2010-08-24xcb_request_check: Sync even if an event was read for this sequence.Jamey Sharp
This fixes the test case I have so far for Havoc's report that xcb_request_check hangs. Rationale: Since we have a void cookie, request_expected can't have been set equal to this sequence number when the request was sent; it can only have become equal due to the arrival of an event or error. If it became equal due to an event then we still need to sync. If it became equal due to an error, then request_completed will have been updated, which means we correctly won't sync. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=29599 However, Havoc reports that he can still reproduce the problem, so we may be revisiting this later. Reported-by: Havoc Pennington <hp@pobox.com> Signed-off-by: Jamey Sharp <jamey@minilop.net>
2010-08-16small fix to get rid of some compiler warningsChristoph Reimann
also added very basic documentation for xkb
2010-08-16added accessors for special casesChristoph Reimann
major bugfixes include: rewrite of prefix related functions, merge of serialize/unserialize/... generators, extended field name resolution
2010-08-08special case 'intermixed variable and fixed size fields': fixed reply side, ↵Christoph Reimann
needs testing
2010-08-05renamed most _unserialize() functions to _sizeof() and fixed _unserialize() ↵Christoph Reimann
for the special case of intermixed variable and fixed size fields
2010-08-02attempt to fix special case: variable fields followed by fixed size fieldsChristoph Reimann
2010-08-01bug fixes for all kinds of 'special cases'Christoph Reimann
2010-07-22partial rewrite of serialize helper functions completed;Christoph Reimann
_serialize() & _unserialize() have been tested for switch derived from valueparam
2010-07-20preliminary handling of further special cases in unserializeChristoph Reimann
first attempts to unify serialize and unserialize
2010-07-15added generating code for _serialize() in case of variable sized structs ↵Christoph Reimann
(largely untested)
2010-07-13new and still preliminary functions for switch; feautures includeChristoph Reimann
- API compatibility with valueparam - request _aux() auxiliary functions - _serialize() and _unserialize() auxiliary functions - new data type that allows mixing of fixed and variable size members
2010-07-13xkb: updated configure.ac/Makefile.amChristoph Reimann
2010-07-13added xcb_sumof() with restriction to uint8_tChristoph Reimann
2010-07-13_xcb_conn_wait: Fix whitespace.Jamey Sharp
Signed-off-by: Jamey Sharp <jamey@minilop.net>
2010-06-15xcb_connect_to_display_with_auth_info: Fix memory leakPauli Nieminen
protocol and host are allocated in _xcb_parse_display but ownership of them is passed to the caller. They have to be freed in xcb_connect_to_display_with_auth_info. Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com> Signed-off-by: Peter Harris <pharris@opentext.com>
2010-06-15_xcb_parse_display: Fix error pathPauli Nieminen
xcb_parse_display claims that there is no side effects when failing. That requires _xcb_parse_display to free the memory in failure case. Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com> Signed-off-by: Peter Harris <pharris@opentext.com>
2010-05-14xcb_open: Improve protocol/host parsingJeremy Huddleston
Support scenarios where host is not set and protocol is. eg: DISPLAY=tcp/:0 as well as the "inet" and "inet6" alias for "tcp" for compatability with Xlib Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com> Reviewed-by: Jamey Sharp <jamey@minilop.net>
2010-05-14Add ~ operator support in code generatorMarcin Kościelnicki
Reviewed-by: Julien Cristau <jcristau@debian.org> Signed-off-by: Julien Danjou <julien@danjou.info>
2010-04-30Fix GCC error on undeclared variable when not using abstract socketArnaud Fontaine
This is a regression found by tinderbox in previous commit: xcb_util.c: In function '_xcb_open': xcb_util.c:213: error: 'fd' undeclared (first use in this function)
2010-04-30Get rid of PATH_MAX and MAXPATHLENArnaud Fontaine
There could be no upper limit on the length of a path according to POSIX, therefore these macros may not be defined at all on some systems (such as GNU Hurd). Signed-off-by: Arnaud Fontaine <arnau@debian.org> Reviewed-by: Peter Harris <pharris@opentext.com>
2010-04-23Use limits.h instead of syslimits.hJeremy Huddleston
Regression found by tinderbox in 89b3485dadef47a30264a5bf150b96522183376b xcb_util.c:31:27: error: sys/syslimits.h: No such file or directory xcb_util.c: In function '_xcb_open': xcb_util.c:148: error: 'PATH_MAX' undeclared (first use in this function) Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2010-04-23Reworked launchd support to work better with _xcb_parse_displayJeremy Huddleston
Fixes: http://xquartz.macosforge.org/trac/ticket/390 Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2010-04-23Replaced read() in read_block and _xcb_in_read() with recv for allJeetu Golani
platforms. MSG_WAITALL is undefined in MinGW so it's been explicitly defined in xcb_in.c
2010-04-22Set errno=0 in read_block. On Win32 there is no errno and this makes theJeetu Golani
do..while loop execute only once. Also set the return value to -1 in _xcb_open if control reaches the end - if all goes well it shouldn't reach there.
2010-04-17Always wake up readers after writing.Jamey Sharp
Since writers must make sure they read as well, threads may have gone to sleep waiting for the opportunity to read. The writer must wake up one of those readers or the application can hang. Signed-off-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Josh Triplett <josh@freedesktop.org>
2010-04-17Fix strict-aliasing warning when getting generic event length.Jamey Sharp
xcb_ge_event_t has its length field in the same place that xcb_generic_reply_t does, so there's no need to cast the generic reply. Signed-off-by: Jamey Sharp <jamey@minilop.net> Cc: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Julien Danjou <julien@danjou.info>
2010-04-17Delete a useless level of indirection from _xcb_out_send's parameters.Jamey Sharp
_xcb_out_send needs _xcb_conn_wait to store back its progress so it can be reinvoked to pick up where it left off---but then _xcb_out_send guarantees that it leaves either an empty output vector or a shut-down connection, so *its* callers never care how much progress was made. Signed-off-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Josh Triplett <josh@freedesktop.org>
2010-04-08Fail if fd is too big and poll() is not availableRémi Denis-Courmont
Depending on the process file limit, a file descriptor can be larger than the capacity of fd_set. There is no portable way to create a large enough fd_set at run-time. So we just fail if the file descriptor number is too high and poll() is not available. Reviewed-by: Jamey Sharp <jamey@minilop.net> Signed-off-by: Julien Danjou <julien@danjou.info>
2010-03-31xcb_in.c #ifndef _WIN32 inside of #if USE_POLL redundant and removedJeetu Golani
2010-03-31restablished inclusion of fcntl.h and netinet/tcp.h in xcb_util.c -- without ↵Jeetu Golani
these the code no longer compiled on *ix
2010-03-29changes in xcb_windefs.h - the flag _XCB_WINDEFS_H replaces WINDEFS_HJeetu Golani
2010-03-29windefs.h is now called xcb_windefs.h - changed all includes to reflect ↵Jeetu Golani
that.Replaced one instance ofWIN32 with _WIN32 in each xcb_in.c and xcb_conn.c
2010-03-26Win32 code for xcb-1.5Jeetu Golani
2010-03-13Fix authentication on hpux and HurdSamuel Thibault
libxcb's 010e5661 (Fix XDM-AUTHORIZATION-1 (bug #14202)) mistakenly inverted a few lines of code, making local socket authentication fail on hpux and Hurd: when getpeername fails, sockname needs to be initialized by getsockname before its address family can be checked. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Julien Danjou <julien@danjou.info>
2010-02-17Open the X11 socket with close-on-exec flagRémi Denis-Courmont
This saves the X11 connection from leaking into children processes. On Linux, this is fully thread-safe using SOCK_CLOEXEC. On other systems, there is a small race condition. Signed-off-by: Julien Danjou <julien@danjou.info>
2010-02-11Support xcb_discard_replyPeter Harris
This function is useful for dynamic language garbage collectors. Frequently a GC cycle may run before you want to block wainting for a reply. This function is also marginally useful for libxcb apps that issue speculative requests (eg. xlsclients). Reviewed-by: Jamey Sharp <jamey@minilop.net> Tested-by: Eamon Walsh <efw@eamonwalsh.com> Signed-off-by: Peter Harris <pharris@opentext.com>
2010-01-07xcb_connect_to_fd: fix descriptor leak on memory error pathRémi Denis-Courmont
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-12-03build: simplify extension buildingJulien Danjou
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-12-02setsockopt(SO_KEEPALIVE) on TCP display connections.Adam Jackson
This matches xtrans behaviour in SocketINETConnect, and makes it so apps don't hang forever if their display dies. Signed-off-by: Adam Jackson <ajax@redhat.com>
2009-10-19Add DRI2 support. (v2)Eric Anholt
v2: Build fix from jcristau.
2009-08-31Cygwin build fix: Add -no-undefined to libtool flagsYaakov Selkowitz
-no-undefined is needed to tell libtool a shared library can be built on platforms which require all references to be statisfied at link time. Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk> Signed-off-by: Julien Danjou <julien@danjou.info>
2009-07-15Add majorCode, minorCode and resourceID fields to X generic errorArnaud Fontaine
2009-07-06Fix precedence bug: wrong length for big-requests preceded by sync.Jamey Sharp
Also replace excessively clever use of bitwise OR with equivalent addition. Reported-by: Geoffrey Li <geoffrey@seitopos.com> Signed-off-by: Jamey Sharp <jamey@minilop.net> Signed-off-by: Josh Triplett <josh@joshtriplett.org>
2009-05-29Fix libxcb-randr version infoJulien Cristau
The SONAME shouldn't have been bumped in 1.3, only new symbols were added. Signed-off-by: Julien Danjou <julien@danjou.info>
2009-05-26Disable Nagle on TCP socketelupus
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-05-09depends on recent xcb-proto and bump version of randrJulien Danjou
Signed-off-by: Julien Danjou <julien@danjou.info>