Commit Graph

587 Commits

Author SHA1 Message Date
Keith Packard 83f28ef865 Switch to using the CMSG_* macros for FD passing
Use these instead of computing the values directly so that it might
work on BSD or other non-Linux systems

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-11-07 20:24:59 -08:00
Keith Packard cca6074090 Add Present extension
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-By: Uli Schlachter <psychon@znc.in>
2013-11-07 14:02:37 -08:00
Keith Packard 7a9373078e Add DRI3 library
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-By: Uli Schlachter <psychon@znc.in>
2013-11-07 14:02:37 -08:00
Keith Packard 93d733e85d Require xcb proto version 1.9
Signed-off-by: Keith Packard <keithp@keithp.com>
2013-11-07 14:02:37 -08:00
Keith Packard 79019541e7 Add event queue splitting
This allows apps to peel off certain XGE events into separate queues
for custom handling. Designed to support the Present extension

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-By: Uli Schlachter <psychon@znc.in>
2013-11-07 14:02:37 -08:00
Keith Packard 7983bf0fbd Add support for receiving fds in replies
Requests signal which replies will have fds, and the replies report
how many fds they expect in byte 1.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-By: Uli Schlachter <psychon@znc.in>
2013-11-07 14:02:37 -08:00
Keith Packard 7b53fb0f9b Add xcb_send_fd API
This uses sendmsg to transmit file descriptors from the application to
the X server

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-By: Uli Schlachter <psychon@znc.in>
2013-11-07 14:02:35 -08:00
Keith Packard 98c227a222 -pendantic is too pendantic
Many system headers have warnings when compiled with this flag.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-By: Uli Schlachter <psychon@znc.in>
2013-11-07 14:02:00 -08:00
Keith Packard d04a4a03a9 Make protocol C files depend on protocol XML files
When new XML files get installed, make sure the C files are regenerated

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-By: Uli Schlachter <psychon@znc.in>
2013-11-07 14:01:31 -08:00
Keith Packard f4d5b84800 Remove xcb_ge_event_t from xcb.h
xcb proto now publishes this structure from an XML description

Signed-off-by: Keith Packard <keithp@keithp.com>
2013-11-07 14:01:31 -08:00
Daphne Pfister e4e0c6eec8 Use /usr/spool/sockets/X11/ on HP-UX for UNIX sockets (#69118). 2013-10-11 18:34:56 +09:00
Daphne Pfister f1405d9fe4 Fix poll() if POLLIN == ROLLRDNORM|POLLRDBAND
It seems like POLLIN is specified as equivalent to POLLRDNORM | POLLRDBAND. Some
systems (e.g. QNX and HP-UX) take this literaly and have POLLIN defined as the
above bit combination. Other systems (e.g. Linux) have POLLIN as just a single
bit.

This means that if no out-of-band data is available (which should never be the
case), the result of poll() will not fulfil (fd.revents & POLLIN) == POLLIN on
QNX, because the POLLRDBAND bit is not set.

In other words, even though poll() signaled that the fd is readable, xcb would
not read from the file descriptor.

Fix this by checking if any bits from POLLIN are set in the result of poll(),
instead of all of them.

(This change was independently done by seanb@qnx.com as well)

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=38001
Acked-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-08 23:01:11 +02:00
Uli Schlachter ac47e0ecdb Fix documentation of xcb_poll_for_event()
In commit 8eba8690ad, the API documentation for xcb_poll_for_event() was
fixed to remove an argument that was previously removed in commit 34168ab549.

However, that commit only removed the first line of the documentation, leaving
behind a spurious half-sentence. That commit happened seven years ago and now
finally someone noticed...

Thanks to Benjamin Herr for reporting this on IRC.

v2: Thanks again to Benjamin Herr for noticing that my commit message blamed the
wrong commit.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-08 22:23:18 +02:00
Daniel Martin c52f2891b4 tests: Add files to .gitignore
Add check_all.log, check_all.trs and test-suite.log to tests/.gitignore.

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
2013-08-15 00:35:08 +02:00
Daniel Martin a8d11c36ed Sort gitignore, adjust pattern for config.h
Don't ignore the files config.h and config.h.in, adjust the pattern to
ignore config.h*. This matches an additional config.h.in~ too.

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Uli Schlachter <psychon@znc.in>
Tested-By: Ran Benita <ran234@gmail.com>
2013-08-15 00:35:08 +02:00
Daniel Martin cbe54c97b3 Use m4 directory
- Follow the suggestion by libtoolize:
   "Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and
    rerunning libtoolize, to keep the correct libtool macros in-tree.
    Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am."
  and add the macro and define.

- Create the m4 directory and move acinclude.m4 as xcb.m4 there.

- Ignore the m4 files libtoolize copies into the m4 directory
  (m4/l*.m4).

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Uli Schlachter <psychon@znc.in>
Tested-By: Ran Benita <ran234@gmail.com>
2013-08-15 00:35:08 +02:00
Daniel Martin 6746ab1549 Use build-aux as autom4te cache directory
Remove the generated directory ./autom4te.cache by reusing ./build-aux
as cache directory.

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Uli Schlachter <psychon@znc.in>
Tested-By: Ran Benita <ran234@gmail.com>
2013-08-15 00:35:07 +02:00
Daniel Martin b6d8c8fe61 Set AC_CONFIG_AUX_DIR to build-aux
Do not clutter the project directory with generated/copied auxiliary
files, save them in ./build-aux.

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Uli Schlachter <psychon@znc.in>
Tested-By: Ran Benita <ran234@gmail.com>
2013-08-15 00:35:07 +02:00
Daniel Martin e3b34ad346 Remove second AC_PREREQ, require version 2.60
Remove a second AC_PREREQ and bump the required autoconf version to
2.60.

Version 2.59c was a testing release, published in April 2006. Version
2.60 was the stable release afterwards, released in June 2006.

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Uli Schlachter <psychon@znc.in>
Tested-By: Ran Benita <ran234@gmail.com>
2013-08-15 00:35:07 +02:00
Daniel Martin 50fb3a6312 Initialize automake earlier (bugfix for #66413)
This fixes:
    https://bugs.freedesktop.org/show_bug.cgi?id=66413
    Bug 66413 - libxcb 1.9.1: Fails to build on Arch Linux: \
        /home/<user>/install-sh: No such file or directory

Without that patch the search path for `install-sh` will become $HOME
and the `install` target will fail, when DESTDIR doesn't exist in
advance. (occured with automake 1.14 and autoconf 2.69)

Initial patch by: Alain Kalker <a.c.kalker@gmail.com>
Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Uli Schlachter <psychon@znc.in>
Tested-By: Ran Benita <ran234@gmail.com>
2013-08-15 00:35:07 +02:00
Daniel Martin dd01db570c Make xsltproc optional
Fix Bug 23863 - xcb still checks for xsltproc:
    https://bugs.freedesktop.org/show_bug.cgi?id=23863

xsltproc is used to generate the optional html page for `check` results,
only. So, it's not a hard build dependency.

Additionally, use yes/no instead of true/false in the HTML_CHECK_RESULT
variable for consistent output after a configure run.

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
2013-08-15 00:35:02 +02:00
Daniel Martin 0289348f2c c_client.py: Do not create pointers in unions
Do not create pointers in unions for fields of variadic length.

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Reviewed-by: Ran Benita <ran234@gmail.com>
2013-08-15 00:34:26 +02:00
Daniel Martin b9efd2a09a c_client.py: Always initialize xcb_align_to
to get rid of:
    warning: 'xcb_align_to' may be used uninitialized in this function

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Reviewed-by: Peter Harris <pharris@opentext.com>
2013-08-15 00:34:21 +02:00
Alan Coopersmith 5648ddd2b9 Define _xcb_map_new with explicit void arg list instead of empty one
Fixes Solaris Studio compiler warning:
"xcb_list.c", line 50: warning: old style function definition

and gcc warning:
xcb_list.c: In function '_xcb_map_new':
xcb_list.c:50:11: warning: old-style function definition [-Wold-style-definition]

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
2013-08-06 11:10:01 -07:00
Alan Coopersmith cb51f271b2 Enable warnings for pre-C89 style definitions for gcc & Solaris Studio
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
2013-08-06 11:09:56 -07:00
Michael Stapelberg bc6a4f557f Build xcb-xkb by default
There have not been any big issues with xcb-xkb recently.

Also, Wayland is using xcb-xkb actively, making distributions compile
libxcb with xkb support anyway, so let’s reflect reality :).

Reviewed-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Daniel Martin <consume.noise@gmail.com>
2013-08-06 18:46:43 +02:00
Daniel Martin 45619dc71e c_client.py: Inject full_sequence into GE events
The generic event structure xcb_ge_event_t has the full_sequence field
at the 32byte boundary. That's why we've to inject this field into GE
events while generating the structure for them. Otherwise we would read
garbage (the internal full_sequence) when accessing normal event fields
there.

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Peter Harris <pharris@opentext.com>
2013-07-12 15:56:14 -04:00
Alan Coopersmith a1e67b141a Fix "indention" typos in xcb-examples.3 man page
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-07-08 17:54:35 -07:00
Marc Deslauriers 8b6bb1a719 Update Makefile.am for newer automake
Debian Bug #710344

Reviewed-by: Daniel Martin <consume.noise@gmail.com>
2013-07-03 19:11:08 -04:00
Christian König 9ae84ad187 fix deadlock with xcb_take_socket/return_socket v3
To prevent different threads from stealing the socket from each other the
caller of "xcb_take_socket" must hold a lock that is also acquired in
"return_socket". Unfortunately xcb tries to prevent calling return_socket
from multiple threads and this can lead to a deadlock situation.

A simple example:
- X11 has taken the socket
- Thread A has locked the display.
- Thread B does xcb_no_operation() and thus ends up in libX11's return_socket(),
  waiting for the display lock.
- Thread A calls e.g. xcb_no_operation(), too, ends up in return_socket() and
  because socket_moving == 1, ends up waiting for thread B
=> Deadlock

This patch allows calling return_socket from different threads at the same time
an so resolves the deadlock situation.

Partially fixes: https://bugs.freedesktop.org/show_bug.cgi?id=20708

v2: fixes additional pthread_cond_wait dependencies,
    rework comments and patch description

v3: separate pthread_cond_wait dependencies and unrelated whitespace
    change into their own patch, use unsigned for socket_seq

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-06-01 22:28:50 +02:00
Alan Coopersmith 1b33867fa9 integer overflow in read_packet() [CVE-2013-2064]
Ensure that when calculating the size of the incoming response from the
Xserver, we don't overflow the integer used in the calculations when we
multiply the int32_t length by 4 and add it to the default response size.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-05-23 08:12:13 -07:00
Daniel Martin e602b653c1 c_client.py: Handle multiple expr. in a bitcase
Adopt a change from xcbgen. With that modification the expression in a
bitcase became a list of expressions to support multiple <enumref> in a
<bitcase>.

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Signed-off-by: Peter Harris <pharris@opentext.com>
2013-05-23 10:52:05 -04:00
Christian König 6b6044cb8a whitespace fix in xcb_take_socket
Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Jamey Sharp <jamey@minilop.net>
2013-05-15 15:10:22 -07:00
Colin Walters 0dd8f8d26a autogen.sh: Implement GNOME Build API
http://people.gnome.org/~walters/docs/build-api.txt

Signed-off-by: Adam Jackson <ajax@redhat.com>
2013-01-16 13:20:49 -05:00
Chí-Thanh Christopher Nguyễn 76a2166de9 c_client.py: Fix python-3 invalid except statement
Replace except statement with a PEP-3110 compliant one. This fixes a regression
introduced by c3deeaf714
https://bugs.freedesktop.org/show_bug.cgi?id=55690

Reviewed-by: Peter Harris <pharris@opentext.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-11-10 19:45:25 +01:00
Chí-Thanh Christopher Nguyễn 9db4517c87 c-client.py: Fix python-3 AttributeError: 'dict' object has no attribute 'iteritems'
This fixes a regression introduced by ea71d7d7e3
https://bugs.freedesktop.org/show_bug.cgi?id=55690

Reviewed-by: Peter Harris <pharris@opentext.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-11-10 19:45:13 +01:00
Uli Schlachter 4ffe54f690 Release libxcb 1.9
Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-10-05 14:53:37 +02:00
Uli Schlachter 4f52f884f4 Include static man pages in "make dist"
This was found by distcheck. It tried to install src/man/xcb-examples.3 and
src/man/xcb-requests.3, but those files weren't in the distribution.

Fix this by explicitly telling automake to distribute those files.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-10-05 11:23:26 +02:00
Uli Schlachter 23911a707b Fix a multi-thread deadlock
This fixes a deadlock which was seen in-the-wild with wine.

It could happen that two threads tried to read from the socket at the same time
and one of the thread got stuck inside of poll()/select().

The fix works by making sure that the writing thread doesn't steal the reading
thread's reply.

Debugged-by: Erich Hoover <ehoover@mines.edu>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54671
Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-09-30 10:10:18 +02:00
Uli Schlachter c16cc5467e Add a .gitignore for src/man/
Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-09-25 12:31:53 +02:00
Peter Harris 08cc068ead Allow xcb_send_request with >MAX_IOV iovecs
This allows an application to do a scatter/gather operation on a large
image buffer to avoid the extra memcpy.

Use autoconf to use UIO_MAXIOV where IOV_MAX is not available (and the
POSIX minimum of 16 where neither are available).

Reviewed-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Peter Harris <pharris@opentext.com>
2012-09-18 11:42:23 -04:00
Alan Coopersmith ff53285ae3 Return connection failure if display string specifies non-existent screen
Matches the behaviour of Xlib - if you set DISPLAY to :0.1 but only have
one screen, closes connection and returns error.

This introduces a new connection error code:
XCB_CONN_CLOSED_INVALID_SCREEN

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
2012-08-29 22:00:55 -07:00
Alan Coopersmith 90889794ad Add AC_USE_SYSTEM_EXTENSIONS to allow use of more system functionality
Copied from libX11 configure.ac

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-08-25 12:34:25 -07:00
Alan Coopersmith b52790e8ed Always include "config.h" at the start of all C source files.
Allows configure to set defines such as _POSIX_SOURCE in config.h
that affect functions exposed by system headers and get consistent
results across all the source files.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-08-25 12:34:24 -07:00
Alan Coopersmith ed93a6a2a8 Fix "sppported" typo in doxygen comment for XCB_CONN_CLOSED_EXT_NOTSUPPORTED
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-08-25 12:34:24 -07:00
Colin Walters c3deeaf714 c_client: Fix parallel-make issue creating 'man' directory
With make -j, it was possible to hit a race condition in the code to
make the 'man' directory.

Signed-off-by: Julien Danjou <julien@danjou.info>
2012-08-14 13:33:01 +02:00
Jeremy Huddleston 5f8f2ba1c4 xcb_connect: launchd: Don't fall back on tcp if $DISPLAY is a path to a launchd socket
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
2012-04-21 22:42:51 -07:00
Julien Danjou 71a295082e Move static man to man
Signed-off-by: Julien Danjou <julien@danjou.info>
2012-03-27 12:10:59 +02:00
Julien Danjou df217bf7c9 Do not list manpages, use a wildcard
Signed-off-by: Julien Danjou <julien@danjou.info>
2012-03-27 12:10:15 +02:00
Julien Danjou a4417b1611 Split manpage list in two (static/built)
Signed-off-by: Julien Danjou <julien@danjou.info>
2012-03-27 12:06:54 +02:00