Arnaud Fontaine [Wed, 25 Jan 2012 08:18:20 +0000 (17:18 +0900)]
Add xkb_internals and xkb_issues to EXTRA_DIST.
Jon TURNEY [Tue, 17 Jan 2012 20:59:56 +0000 (20:59 +0000)]
Update use of error_connection under WIN32 to _xcb_conn_ret_error()
Unfortunately, commit
31b57676 adding WSACleanup/WSAShutdown on Win32 adds a new use
of error_connection, which was removed in commit
769acff0, applied 5 minutes earlier.
src/xcb_util.c: In function 'xcb_connect_to_display_with_auth_info':
src/xcb_util.c:433:39: error: 'error_connection' undeclared (first use in this function)
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Arvind Umrao <arvind.umrao@oracle.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
Jon TURNEY [Wed, 18 Jan 2012 14:11:07 +0000 (14:11 +0000)]
Fix build of xcb_auth.c with XDMCP on WIN32
Fix a redefinition problem which shows up when building for _WIN32 and
libXdmcp is installed, so HASXDMAUTH is enabled
It seems this is a special place in xcb as it uses other X11 library headers here
If HASXDMAUTH is defined, include the wrapped windows.h before any header which
includes it unwrapped, to avoid conflicts with types defined in X headers
We need to include config.h and check HASXDMAUTH to avoid an unconditional dependency
on x11proto headers
In file included from install/include/X11/Xdmcp.h:19:0,
from git/xcb/libxcb/src/xcb_auth.c:52:
install/include/X11/Xmd.h:120:14: error: conflicting types for 'INT32'
/usr/i686-pc-mingw32/sys-root/mingw/include/basetsd.h:54:13: note: previous declaration of 'INT32' was here
install/include/X11/Xmd.h:143:15: error: conflicting types for 'BOOL'
/usr/i686-pc-mingw32/sys-root/mingw/include/windef.h:234:17: note: previous declaration of 'BOOL' was here
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Jeremy Huddleston [Wed, 18 Jan 2012 07:55:23 +0000 (23:55 -0800)]
Revert "Fix include order with Xdmcp on WIN32"
This reverts commit
0e9246def562be97cc816f824f702233a826ec56.
This change caused build failures because <X11/Xdmcp.h> was never
included under any circumstance. This is because the check for
HASXDMAUTH was moved before the inclusion of config.h (via xcbint.h)
which defined it.
Found-by: Tinderbox
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Julien Danjou [Thu, 12 Jan 2012 09:25:07 +0000 (10:25 +0100)]
Bump xcb-proto requirement
We are now unable to build xcb-proto before 1.7.
Signed-off-by: Julien Danjou <julien@danjou.info>
Julien Danjou [Wed, 11 Jan 2012 17:27:38 +0000 (18:27 +0100)]
Release libxcb 1.8
Signed-off-by: Julien Danjou <julien@danjou.info>
Ryan Pavlik [Wed, 11 Jan 2012 17:06:50 +0000 (18:06 +0100)]
Use WSAStartup()/WSACleanup() on WIN32
The alternative is to use these in every WIN32 application which uses xcb. Doing
it this way should be safe, as, according to MSDN, "There must be a call to
WSACleanup for each successful call to WSAStartup. Only the final WSACleanup
function call performs the actual cleanup. The preceding calls simply decrement
an internal reference count"
(We should probably also include ws2_32 in Libs.private for libxcb, as anything
which links with libxcb will also need that, but there seems to be some pkg-config
issues to resolve first...)
v2: Check for errors so WSAStartup()/WSACleanup() uses are balanced
v3: Use same indentation style as surrounding code
Reviewed-by: Peter Harris <pharris@opentext.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
Ryan Pavlik [Thu, 5 Jan 2012 20:57:53 +0000 (20:57 +0000)]
Fix include order with Xdmcp on WIN32
Fix a redefinition problem due to include order which shows up when
building for _WIN32 and libXdmcp is installed, so HASXDMAUTH is enabled
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Peter Harris <pharris@opentext.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
Jon TURNEY [Thu, 5 Jan 2012 20:57:52 +0000 (20:57 +0000)]
Fix WIN32 compilation after commit
163c47bdc0d32785d831e4c93fea9ab7e023446b
WIN32 does not have arpa/inet.h, so do not try to include it unless _WIN32 is
not defined
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Peter Harris <pharris@opentext.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
Arvind Umrao [Fri, 4 Nov 2011 10:12:05 +0000 (15:42 +0530)]
Added more error states and removed global error_connection
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=41443
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=42304
I have added more xcb connection error states at xcb.h header.
Also I have removed global error_connection variable, and added
an interface that returns connection error state.
TBD:
I will segregate errors states in a separate header file and try to
provide more precise error states, in future. Also I will give patch
for libX11, in that patch xcb_connection_t::has_error will be passed
to default io handler of libX11. This value can then be used for
displaying error messages.
Reviewed-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
Reviewed-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Arvind Umrao <arvind.umrao@oracle.com>
Keith Packard [Thu, 1 Dec 2011 10:28:51 +0000 (10:28 +0000)]
Make xcb_take_socket keep flushing until idle
_xcb_out_flush_to will drop the iolock in pthread_cond_wait allowing
other threads to queue new requests. When this happened,
there would be requests queued for the socket after _xcb_out_flush_to
returned, and xcb_take_socket would throw an assert.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=29875
Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
Uli Schlachter [Thu, 25 Aug 2011 12:18:16 +0000 (14:18 +0200)]
Fix a dead-lock due to xcb_poll_for_reply
Imagine two threads:
Thread#1: for(;;) { xcb_get_input_focus_reply(c, xcb_get_input_focus(c), 0); }
Thread#2: for(;;) { xcb_poll_for_event(c); }
Since xcb_poll_for_event() calls _xcb_in_read() directly without synchronizing
with any other readers, this causes two threads to end up calling recv() at the
same time. We now have a race because any of these two threads could get read
the GetInputFocus reply.
If thread#2 reads this reply, it will be put in the appropriate queue and
thread#1 will still be stuck in recv(), although its reply was already received.
If no other reply or event causes this thread to wake up, the process deadlocks.
To fix this, we have to make sure that there is only ever one thread reading
from the connection. The obvious solution is to check in poll_for_next_event()
if another thread is already reading (in which case c->in.reading != 0) and not
to read from the wire in this case.
This solution is actually correct if we assume that the other thread is blocked
in poll() which means there isn't any data which can be read. Since we already
checked that there is no event in the queue this means that
poll_for_next_event() didn't find any event to return.
There might be a small race here where the other thread already determined that
there is data to read, but it still has to wait for c->iolock. However, this
means that the next poll_for_next_event() will be able to read the event, so
this shouldn't cause any problems.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=40372
Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Peter Harris <pharris@opentext.com>
Jamey Sharp [Wed, 24 Aug 2011 15:52:02 +0000 (08:52 -0700)]
Keep ALIGNOF definition out of the public namespace.
Uli's patch is an excellent solution; I just want to keep the new
ALIGNOF macro hidden from XCB's users, as they don't need it to call
XCB.
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Markus Duft [Wed, 24 Aug 2011 14:49:06 +0000 (10:49 -0400)]
Support pre-IPv6 systems (without getaddrinfo)
Some of these systems (eg. Interix on XP) are still in use.
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Peter Harris <pharris@opentext.com>
Uli Schlachter [Wed, 24 Aug 2011 10:47:16 +0000 (12:47 +0200)]
Compute alignment correctly
The code previously assumed that everything has to be aligned to a 4 byte
boundary. This assumption is wrong as e.g. the STR struct from xproto shows.
Instead, each type has to be aligned to its natural alignment. So a char doesn't
need any alignment, a INT16 gets aligned to a 2-byte-boundary and a INT32 gets
the old 4 byte alignment.
I'm not 100% sure that this commit is correct, but some quick tests with awesome
and cairo-xcb went well.
This commit causes lots of dead assignments to xcb_align_to since only the last
field's alignment is actually used, but this simplified this patch a lot.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=34037
Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Peter Harris <pharris@opentext.com>
Michael Stapelberg [Thu, 18 Aug 2011 19:38:28 +0000 (21:38 +0200)]
Drop AI_ADDRCONFIG when resolving TCP addresses
When a system is completely offline (no interface has an IP address but 'lo'),
xcb could not connect to localhost via TCP, e.g. connections with
DISPLAY=127.0.0.1:0 fail.
AI_ADDRCONFIG will only return IPv4 addresses if the system has an IPv4
address configured (likewise for IPv6). This also takes place when
resolving localhost (or 127.0.0.0/8 or ::1). Also, as per RFC 3493,
loopback addresses are not considered as valid addresses when
determining whether to return IPv4 or IPv6 addresses.
As per mailing-list discussion on the xcb list started with message
20110813215405.
5818a0c1@x200, the AI_ADDRCONFIG flag is there for historical
reasons:
In the old days, the "default on-link" assumption in IPv6 made the flag vey
much indispensable for dual-stack hosts on IPv4-only networks. Without it,
there would be long timeouts trying non-existent IPv6 connectivity. Nowadays,
this assumption has been flagged as historic bad practice by IETF, and hosts
should have been updated to not make it anymore.
Then AI_ADDRCONFIG became mostly cosmetic: it avoids phony "Protocol family
not supported" or "Host unreachable" errors while trying to connect to a dual-
stack mode from a host with no support for source address selection.
Nowadays, on up-to-date systems, this flag is completely useless. Then again,
I understood only the very latest MacOS release is "up-to-date" with this
definition.
James Jones [Thu, 12 May 2011 06:22:22 +0000 (23:22 -0700)]
Insert, not append explicit xcbgen dir python path
If a the path to the xcb python generate libs is
explicitly specified to c_client.py, insert it in
the python path list just after the local dir entry,
rather than appending it to the existing paths.
This keeps a global/distro install of xcb from
overriding a local build of the xcb proto files.
Signed-off-by: James Jones <jajones@nvidia.com>
Signed-off-by: Jamey Sharp <jamey@minilop.net>
David Coles [Sat, 9 Apr 2011 00:47:05 +0000 (17:47 -0700)]
Add support for building with Python 3
Python 3 introduces some language changes that cause issues when running
c_client.py. This also breaks compatibility with Python 2.5 since it does not
support the "as" statement in try/except blocks and does not have reduce() in
the functools package.
The main changes are:
* try/except blocks require `except ... as ...:` to resolve syntactical ambiguity
* map() and filter() return iterators rather than lists in Python 3
* reduce() is now in functools package (and not built-in in Python 3)
* Dictionaries don't have a has_key() method in Python 3
* None and int types can't be directly compared in Python 3
* print() is a statement in Python 3
See http://diveintopython3.org/porting-code-to-python-3-with-2to3.html and
PEP-3110 for details.
Verified on Python 2.6.5 and 3.1.3.
Signed-off-by: David Coles <dcoles@gaikai.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
Jamey Sharp [Tue, 12 Apr 2011 20:09:23 +0000 (13:09 -0700)]
Revert "Introduce xcb_wait_for_event_until, for consuming responses in wire-order."
This function was intended to allow libX11 to fix a multi-threaded hang,
but the corresponding libX11 patch caused single-threaded apps to spin
sometimes. Since I've retracted that patch, this patch has no users and
shouldn't go into a release unless/until that changes.
This reverts commit
2415c11dec5e5adb0c17f98aa52fbb371a4f8f23.
Conflicts:
src/xcb.h
src/xcb_in.c
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Rami Ylimäki [Tue, 22 Mar 2011 12:33:23 +0000 (14:33 +0200)]
Introduce a variant of xcb_poll_for_event for examining event queue.
In some circumstances using xcb_poll_for_event is suboptimal because
it checks the connection for new events. This may lead to a lot of
failed nonblocking read system calls.
Signed-off-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Alan Coopersmith [Tue, 5 Apr 2011 04:36:47 +0000 (21:36 -0700)]
If protocol is "unix", use a Unix domain socket, not TCP
Fixes fallback to local connections from Xlib's XOpenDisplay(), which
will try with protocol "unix" if a hostname is specified and tcp fails
(as it usually will now that most OS'es ship with -nolisten tcp enabled).
Also fixes explicitly specifying DISPLAY as "unix/foo:0", which Xlib
previously accepted for Unix domain sockets.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Alan Coopersmith [Tue, 5 Apr 2011 04:28:00 +0000 (21:28 -0700)]
Make launchd code in xcb_util.c match surrounding code indent levels
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Carlos Garnacho [Tue, 5 Oct 2010 16:03:22 +0000 (18:03 +0200)]
Handle XGE events with the "send event" flag
This patch is necessary so xcb reads the payload after the message
for GenericEvents with the 0x80 flag turned on.
Signed-off-by: Carlos Garnacho <carlosg@gnome.org>
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Alan Coopersmith [Tue, 5 Apr 2011 03:20:16 +0000 (20:20 -0700)]
Add #include <sys/socket.h> to xcb_conn.c
Solves compiler warning on Solaris:
"xcb_conn.c", line 304: warning: implicit function declaration: shutdown
Also provides system definition of SHUT_RDWR on Solaris 11.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Alan Coopersmith [Tue, 5 Apr 2011 03:12:56 +0000 (20:12 -0700)]
Remove unused DECnet code
"unifdef -UDNETCONN src/xcb_util.c" plus re-indenting code that was
formerly in the else clause after a DECnet check.
DECnet support has been removed from most of the X.Org code base for
several years, and it appears DNETCONN was never defined in XCB.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Alan Coopersmith [Mon, 4 Apr 2011 23:32:45 +0000 (16:32 -0700)]
Use special path to sockets when running under Solaris Trusted Extensions
Solaris Trusted Extensions puts the endpoints for the X server's Unix
domain sockets in a special directory shared from the global zone to
each of the labeled zones, since each labeled zone has a separate /tmp.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Peter Harris <pharris@opentext.com>
Rami Ylimäki [Wed, 23 Mar 2011 15:47:50 +0000 (17:47 +0200)]
Prevent theoretical double free and leak on get_peer_sock_name.
Variable new_sockname will leak and sockname will be double freed if
both of the cases shown below are true.
1. realloc succeeds and doesn't return the original pointer
2. calling socket_func fails
Signed-off-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
Signed-off-by: Erkki Seppälä <erkki.seppala@vincit.fi>
Reviewed-by: Arnaud Fontaine <arnau@debian.org>
Signed-off-by: Peter Harris <pharris@opentext.com>
Jamey Sharp [Sun, 20 Mar 2011 03:04:55 +0000 (20:04 -0700)]
Delete the old c-client.xsl.
It hasn't been used since libxcb 1.1.90.1, released in 2008.
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Jamey Sharp [Sat, 19 Mar 2011 03:56:07 +0000 (20:56 -0700)]
Introduce xcb_wait_for_event_until, for consuming responses in wire-order.
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Josh Triplett <josh@freedesktop.org>
Jamey Sharp [Sat, 19 Mar 2011 00:36:32 +0000 (17:36 -0700)]
Dequeue readers that can't receive any new responses.
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Josh Triplett <josh@freedesktop.org>
Jamey Sharp [Fri, 18 Mar 2011 22:37:34 +0000 (15:37 -0700)]
Factor reader_list management out of wait_for_reply.
Later patches will insert reader_list entries from other entry points.
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Josh Triplett <josh@freedesktop.org>
Jamey Sharp [Sat, 19 Mar 2011 01:18:41 +0000 (18:18 -0700)]
Enable AM_SILENT_RULES on automake 1.11 or newer.
This incantation is supposed to be a no-op on earlier automake versions.
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Josh Triplett <josh@freedesktop.org>
Rami Ylimäki [Wed, 13 Oct 2010 14:48:13 +0000 (17:48 +0300)]
Prevent reply waiters from being blocked.
It's possible to call xcb_wait_for_reply more than once for a single
request. In this case we are nice and let reply waiters continue so
that they can notice that the reply is not available
anymore. Otherwise an event waiter could just signal the reply waiter
that got its reply to continue but leave a waiter for an earlier reply
blocked.
Below is an example sequence for reproducing this problem.
thread #1 (XNextEvent)
- waits for events
thread #2 (XSync)
- executes request #2
- waits for reply #2
thread #1
- reads reply #2
- signals waiter of reply #2 to continue
- waits for events
thread #2
- handles reply #2
thread #3 (XCloseDisplay)
- executes request #3
- waits for reply #2
thread #1
- reads reply #3
- nobody is waiting for reply #3 so don't signal
- wait for events
Of course it may be questionable to wait for a reply twice, but XCB
should be smart enough to let clients continue if they choose to do
so.
Signed-off-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Jamey Sharp [Sun, 13 Mar 2011 16:41:10 +0000 (09:41 -0700)]
Include XKB in ./configure's summary output.
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Jamey Sharp [Sun, 13 Mar 2011 16:18:24 +0000 (09:18 -0700)]
Merge branch 'master' of git+ssh://git.freedesktop.org/git/xcb/libxcb
Apparently I forgot to push these months ago.
Jeremy Huddleston [Fri, 4 Mar 2011 20:41:55 +0000 (12:41 -0800)]
darwin: Don't use poll() when expected to run on darwin10 and prior
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Peter Harris [Thu, 23 Dec 2010 18:32:17 +0000 (13:32 -0500)]
Don't try to sizeof(void)
sizeof(void) is a gcc extension, and not portable.
Xorg Bugzilla 31959
http://bugs.freedesktop.org/show_bug.cgi?id=31959
http://lists.freedesktop.org/archives/xcb/2010-May/006039.html
Signed-off-by: Peter Harris <pharris@opentext.com>
Tested-by: Cyril Brulebois <kibi@debian.org>
Vincent Torri [Sun, 28 Nov 2010 13:02:40 +0000 (14:02 +0100)]
fix Windows build and installation
Peter Harris [Thu, 23 Dec 2010 18:04:40 +0000 (13:04 -0500)]
Merge branch 'master' of git://anongit.freedesktop.org/~peterh/libxcb
Jeetu Golani [Sun, 12 Dec 2010 21:48:41 +0000 (16:48 -0500)]
Don't validate FD_SETSIZE on Win32
Windows' file handles have never been small or consecutive, so Windows'
select has always been implemented the same way as everyone else's poll.
On Windows, FD_SETSIZE is the size of the poll array, not the maximum
SOCKET number.
Signed-off-by: Peter Harris <git@peter.is-a-geek.org>
Uli Schlachter [Wed, 17 Nov 2010 19:26:11 +0000 (20:26 +0100)]
xcb_take_socket: Document sequence wrap requirements
If lots of requests are send without one causing a reply, xcb can get confused
about the current sequence number of a reply. Document the requirements of an
external socket owner to avoid this problem.
The return_socket callback for xcb_take_socket() originally was supposed to
return the last sequence number used, but the version committed to libxcb never
actually had this signature. This fixes the function's documentation not to
mention this non-existent return value.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
Nick Bowler [Thu, 11 Nov 2010 01:49:41 +0000 (20:49 -0500)]
xcb_auth: Fix memory leak in _xcb_get_auth_info.
If the initial get_peer_sock_name(getpeername ...) succeeds, the
pointer to allocated memory is overwritten by the later call to
get_peer_sock_name(getsockname ...). Fix that up by freeing
the allocated memory before overwriting the pointer.
Signed-off-by: Nick Bowler <nbowler@draconx.ca>
Signed-off-by: Julien Danjou <julien@danjou.info>
Jamey Sharp [Sun, 10 Oct 2010 00:13:45 +0000 (17:13 -0700)]
xcb_in: Use 64-bit sequence numbers internally everywhere.
Widen sequence numbers on entry to those public APIs that still take
32-bit sequence numbers.
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Jamey Sharp [Sat, 9 Oct 2010 20:19:05 +0000 (13:19 -0700)]
xcb_discard_reply: Simplify by re-using poll_for_reply helper.
If you discard a sequence number that has multiple responses already
read, this will do more allocations than necessary. But nobody cares
about ListFontsWithInfo.
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Jamey Sharp [Sat, 9 Oct 2010 19:32:05 +0000 (12:32 -0700)]
xcb_request_check: Hold the I/O lock while deciding to sync.
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Jamey Sharp [Sat, 9 Oct 2010 11:08:18 +0000 (04:08 -0700)]
xcb_send_request: Send all requests using a common internal send_request.
This simplifies the critical section of xcb_send_request and fixes a
couple of subtle bugs:
- It's possible for xcb_send_request to need to issue two sync requests
before it can issue the real request. Previously, we counted sequence
numbers as if both were issued, but only one went out on the wire.
- The test for whether to sync at 32-bit sequence number wrap has been
incorrect since we switched to 64-bit sequence numbers internally.
This change means that if the output queue was already full and the
current request is bigger than the output queue, XCB will do one more
write syscall than it did before. But syncs are rare and small requests
are the norm, so this shouldn't be a measurable difference.
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Peter Harris [Thu, 23 Sep 2010 03:15:38 +0000 (23:15 -0400)]
Fix _unserialize of reply headers
This cleans up a number of warnings, and passes the sequence number
through correctly.
Signed-off-by: Peter Harris <pharris@opentext.com>
Peter Harris [Thu, 23 Sep 2010 02:32:34 +0000 (22:32 -0400)]
Clean up a couple of warnings in xprint
Signed-off-by: Peter Harris <pharris@opentext.com>
Peter Harris [Thu, 23 Sep 2010 01:16:51 +0000 (21:16 -0400)]
Make *_unserialize safe to use on buffers in-place
By calling memmove instead of memcpy, and walking the buffer backward
from the end, *_unserialize is safe to use in-place.
Signed-off-by: Peter Harris <pharris@opentext.com>
Peter Harris [Fri, 10 Sep 2010 19:51:56 +0000 (15:51 -0400)]
Fix memory leak in _sizeof implemented with _unserialize
Signed-off-by: Peter Harris <pharris@opentext.com>
Peter Harris [Wed, 8 Sep 2010 19:57:00 +0000 (15:57 -0400)]
Don't emit out-of-module sizeof definitions
Signed-off-by: Peter Harris <pharris@opentext.com>
Josh Triplett [Sun, 19 Sep 2010 18:38:06 +0000 (20:38 +0200)]
Allow disconnecting connections that are in error state.
In support of this, consolidate the two static error_connection
definitions into one so we don't try to free the static out-of-memory
error_connection.
Commit by Josh Triplett and Jamey Sharp.
Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Peter Harris [Fri, 10 Sep 2010 19:53:13 +0000 (15:53 -0400)]
Add xkb.* to gitignore
Signed-off-by: Peter Harris <pharris@opentext.com>
Peter Harris [Wed, 8 Sep 2010 18:41:52 +0000 (14:41 -0400)]
Merge branch 'gsoc2010' of git://anongit.freedesktop.org/~chr/libxcb
Jamey Sharp [Sat, 4 Sep 2010 17:17:21 +0000 (10:17 -0700)]
_xcb_conn_wait: Shut down the connection on unexpected poll() events.
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>
Peter Harris [Tue, 31 Aug 2010 22:33:36 +0000 (18:33 -0400)]
Merge branch 'master' of git://github.com/topcat/xcb-win32
Conflicts:
src/xcb_conn.c
src/xcb_util.c
Signed-off-by: Peter Harris <pharris@opentext.com>
Aaron Plattner [Tue, 17 Aug 2010 15:04:41 +0000 (08:04 -0700)]
xcb_disconnect: call shutdown() to force a disconnect
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>
Jamey Sharp [Tue, 24 Aug 2010 16:17:38 +0000 (09:17 -0700)]
xcb_request_check: Sync even if an event was read for this sequence.
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>
Christoph Reimann [Mon, 16 Aug 2010 18:24:40 +0000 (20:24 +0200)]
small fix to get rid of some compiler warnings
also added very basic documentation for xkb
Christoph Reimann [Mon, 16 Aug 2010 16:22:42 +0000 (18:22 +0200)]
small fix in the xkb pkg file
Christoph Reimann [Mon, 16 Aug 2010 16:19:16 +0000 (18:19 +0200)]
added accessors for special cases
major bugfixes include: rewrite of prefix related functions, merge of serialize/unserialize/... generators, extended field name resolution
Julien Danjou [Fri, 13 Aug 2010 11:46:37 +0000 (13:46 +0200)]
Release libxcb 1.7
Signed-off-by: Julien Danjou <julien@danjou.info>
Christoph Reimann [Sun, 8 Aug 2010 19:25:13 +0000 (21:25 +0200)]
special case 'intermixed variable and fixed size fields': fixed reply side, needs testing
Christoph Reimann [Thu, 5 Aug 2010 13:55:28 +0000 (15:55 +0200)]
renamed most _unserialize() functions to _sizeof() and fixed _unserialize() for the special case of intermixed variable and fixed size fields
Eamon Walsh [Thu, 5 Aug 2010 04:48:08 +0000 (00:48 -0400)]
Tutorial uses wrong function.
https://bugs.freedesktop.org/show_bug.cgi?id=29392
Signed-off-by: Eamon Walsh <efw@eamonwalsh.com>
Christoph Reimann [Mon, 2 Aug 2010 21:30:42 +0000 (23:30 +0200)]
attempt to fix special case: variable fields followed by fixed size fields
Christoph Reimann [Sun, 1 Aug 2010 21:40:20 +0000 (23:40 +0200)]
bug fixes for all kinds of 'special cases'
Christoph Reimann [Thu, 22 Jul 2010 14:41:15 +0000 (16:41 +0200)]
partial rewrite of serialize helper functions completed;
_serialize() & _unserialize() have been tested for switch derived from valueparam
Christoph Reimann [Tue, 20 Jul 2010 20:46:37 +0000 (22:46 +0200)]
preliminary handling of further special cases in unserialize
first attempts to unify serialize and unserialize
Christoph Reimann [Thu, 15 Jul 2010 16:43:43 +0000 (18:43 +0200)]
added generating code for _serialize() in case of variable sized structs (largely untested)
Christoph Reimann [Tue, 13 Jul 2010 18:08:51 +0000 (20:08 +0200)]
xkb: added pkg config file
Christoph Reimann [Tue, 13 Jul 2010 18:06:08 +0000 (20:06 +0200)]
new and still preliminary functions for switch; feautures include
- 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
Christoph Reimann [Tue, 13 Jul 2010 17:59:23 +0000 (19:59 +0200)]
xkb: updated configure.ac/Makefile.am
Christoph Reimann [Tue, 13 Jul 2010 17:56:44 +0000 (19:56 +0200)]
added xcb_sumof() with restriction to uint8_t
Jamey Sharp [Tue, 13 Jul 2010 14:01:06 +0000 (07:01 -0700)]
_xcb_conn_wait: Fix whitespace.
Signed-off-by: Jamey Sharp <jamey@minilop.net>
Jeremy Huddleston [Mon, 12 Jul 2010 23:53:53 +0000 (16:53 -0700)]
AC_CHECK_PROG(LAUNCHD, [launchd], [yes], [no], [$PATH$PATH_SEPARATOR/sbin])
launchd: Explicitly search /sbin
Previously, launchd wasn't found if /sbin wasn't in the user's PATH.
https://bugs.freedesktop.org/show_bug.cgi?id=29028
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Vincent Torri [Mon, 21 Jun 2010 03:50:06 +0000 (20:50 -0700)]
configure.ac: Report which extensions are being built.
I was surprised to see that xinput was not installed. Looking at
configure.ac, it seems that it is disabled by default. Maybe configure
should output the status of the different extensions.
Pauli Nieminen [Fri, 11 Jun 2010 13:30:47 +0000 (16:30 +0300)]
xcb_connect_to_display_with_auth_info: Fix memory leak
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>
Pauli Nieminen [Fri, 11 Jun 2010 13:30:46 +0000 (16:30 +0300)]
_xcb_parse_display: Fix error path
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>
Jeremy Huddleston [Thu, 13 May 2010 02:53:45 +0000 (19:53 -0700)]
xcb_open: Improve protocol/host parsing
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>
Marcin Kościelnicki [Thu, 13 May 2010 21:05:57 +0000 (21:05 +0000)]
Add ~ operator support in code generator
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Julien Danjou <julien@danjou.info>
Arnaud Fontaine [Fri, 30 Apr 2010 17:49:18 +0000 (18:49 +0100)]
Fix GCC error on undeclared variable when not using abstract socket
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)
Arnaud Fontaine [Fri, 30 Apr 2010 12:47:16 +0000 (14:47 +0200)]
Get rid of PATH_MAX and MAXPATHLEN
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>
Jeremy Huddleston [Sat, 24 Apr 2010 04:57:26 +0000 (21:57 -0700)]
Use limits.h instead of syslimits.h
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>
Jeremy Huddleston [Sat, 24 Apr 2010 00:29:25 +0000 (17:29 -0700)]
Reworked launchd support to work better with _xcb_parse_display
Fixes: http://xquartz.macosforge.org/trac/ticket/390
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Jeetu Golani [Thu, 22 Apr 2010 19:17:16 +0000 (00:47 +0530)]
Replaced read() in read_block and _xcb_in_read() with recv for all
platforms. MSG_WAITALL is undefined in MinGW so it's been explicitly
defined in xcb_in.c
Jeetu Golani [Thu, 22 Apr 2010 17:53:27 +0000 (23:23 +0530)]
Set errno=0 in read_block. On Win32 there is no errno and this makes the
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.
Jamey Sharp [Sun, 18 Apr 2010 00:59:11 +0000 (17:59 -0700)]
Always wake up readers after writing.
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>
Jamey Sharp [Sun, 28 Mar 2010 17:31:55 +0000 (10:31 -0700)]
Fix strict-aliasing warning when getting generic event length.
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>
Jamey Sharp [Fri, 12 Feb 2010 20:25:05 +0000 (12:25 -0800)]
Delete a useless level of indirection from _xcb_out_send's parameters.
_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>
Julien Danjou [Fri, 9 Apr 2010 14:57:51 +0000 (16:57 +0200)]
Release libxcb 1.6
Rémi Denis-Courmont [Fri, 26 Mar 2010 21:12:47 +0000 (23:12 +0200)]
Fail if fd is too big and poll() is not available
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>
Jeetu Golani [Wed, 31 Mar 2010 16:30:04 +0000 (22:00 +0530)]
xcb_in.c #ifndef _WIN32 inside of #if USE_POLL redundant and removed
Jeetu Golani [Wed, 31 Mar 2010 04:20:51 +0000 (09:50 +0530)]
restablished inclusion of fcntl.h and netinet/tcp.h in xcb_util.c -- without these the code no longer compiled on *ix
Jeetu Golani [Mon, 29 Mar 2010 17:07:33 +0000 (22:37 +0530)]
changes in xcb_windefs.h - the flag _XCB_WINDEFS_H replaces WINDEFS_H
Jeetu Golani [Mon, 29 Mar 2010 17:01:49 +0000 (22:31 +0530)]
windefs.h is now called xcb_windefs.h - changed all includes to reflect that.Replaced one instance ofWIN32 with _WIN32 in each xcb_in.c and xcb_conn.c
Jeetu Golani [Fri, 26 Mar 2010 04:10:09 +0000 (09:40 +0530)]
Win32 code for xcb-1.5
Samuel Thibault [Fri, 12 Mar 2010 22:51:32 +0000 (23:51 +0100)]
Fix authentication on hpux and Hurd
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>
Rémi Denis-Courmont [Sat, 13 Feb 2010 10:23:51 +0000 (12:23 +0200)]
Open the X11 socket with close-on-exec flag
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>
Peter Harris [Tue, 9 Feb 2010 21:27:22 +0000 (16:27 -0500)]
Support xcb_discard_reply
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>