summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Fix buffer overflow when serializing a closure object1.3.92chi ding2014-01-091-8/+83
| | | | | | | | | Here is the JIRA page of this issue https://bugs.tizen.org/jira/browse/TIVI-1889 Change-Id: I773a6d2d8f6fd02ff10c92450db1fa8a69544219 Signed-off-by: Chi Ding <chi.ding@mobica.com> Closes: https://bugs.freedesktop.org/show_bug.cgi?id=65186
* scanner: set errno=0 before strtolAdrian Negreanu2013-12-171-0/+1
| | | | | | | | | | | | POSIX says to set errno=0 before calling strtol since the return value alne cannot tell a failure. on ubuntu armel I get: ../src/wayland-scanner client-header < ../../protocol/wayland.xml > wayland-client-protocol.h <stdin>:1188: error: invalid integer (2) Signed-off-by: Adrian Negreanu <adrian.m.negreanu@intel.com>
* client: Handle EINTR in wl_display_dispatch_queue()Kristian Høgsberg2013-12-091-1/+5
| | | | | | Restart the poll() if we take a signal. This is easily triggered in an application that ends up blocking in eglSwapBuffers(), and causes EGL to fail to allocate a back buffer.
* doc: Fix spelling of parametersJonas Ådahl2013-12-091-2/+2
| | | | Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
* doc: Remove incorrect docmentationJonas Ådahl2013-12-091-11/+0
| | | | | | | The documentation was about wl_client_get_object(), not about wl_resource_get_client(). Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
* client: Make wl_proxy_set_queue() with NULL revert to default queueNeil Roberts2013-12-041-1/+4
| | | | | | | | | | | | | | This will be useful in order to implement the EGL_WL_create_wayland_buffer_from_image extension. The buffers created within Mesa's Wayland platform are created using the the wl_drm object as a proxy factory which means they will be set to use Mesa's internal event queue. However, these buffers will be owned by the client application so they ideally need to use the default event loop. This function provides a way to set the proxy's event queue back to the default. krh: Edited from Neils original patch to just use wl_proxy_set_queue() with a NULL argument instead of introducing a new function.
* Add -pthread to AM_CFLAGS to do the right thing when using threadsKristian Høgsberg2013-11-231-1/+1
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=71633
* connection: Error out if file descriptor was not receivedLubomir Rintel2013-11-211-0/+9
| | | | | | | | Otherwise the tail of fds_in buffer would just shift beyond the beginning. That confuses the actual request handler and results in a crash further on due to corrupted tail. Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
* wayland-server: Improve error messages for bad globalsJasper St. Pierre2013-11-191-3/+7
| | | | | | A bug in Weston's toytoolkit gave me an hour of debugging headaches. Improve the error messages that we send if a client requests an invalid global, either by name or by version.
* client: Introduce functions to allocate and marshal proxies atomicallyKristian Høgsberg2013-11-154-75/+189
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The server requires clients to only allocate one ID ahead of the previously highest ID in order to keep the ID range tight. Failure to do so will make the server close the client connection. However, the way we allocate new IDs is racy. The generated code looks like: new_proxy = wl_proxy_create(...); wl_proxy_marshal(proxy, ... new_proxy, ...); If two threads do this at the same time, there's a chance that thread A will allocate a proxy, then get pre-empted by thread B which then allocates a proxy and then passes it to wl_proxy_marshal(). The ID for thread As proxy will be one higher that the currently highest ID, but the ID for thread Bs proxy will be two higher. But since thread B prempted thread A before it could send its new ID, B will send its new ID first, the server will see the ID from thread Bs proxy first, and will reject it. We fix this by introducing wl_proxy_marshal_constructor(). This function is identical to wl_proxy_marshal(), except that it will allocate a wl_proxy for NEW_ID arguments and send it, all under the display mutex. By introducing a new function, we maintain backwards compatibility with older code from the generator, and make sure that the new generated code has an explicit dependency on a new enough libwayland-client.so. A virtual Wayland merit badge goes to Kalle Vahlman, who tracked this down and analyzed the issue. Reported-by: Kalle Vahlman <kalle.vahlman@movial.com>
* shm: Avoid file descriptor leak upon unsuccessful mmapLubomir Rintel2013-11-151-1/+1
| | | | | | | It would be possible to make the compositor leak file descriptors by passing descriptors of open unmmapable files to it, such as /dev/null. Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
* Add documentation for wl_shm_buffer_begin/end_accessNeil Roberts2013-11-151-0/+64
| | | | | It's not obvious that these functions are needed so it would be good to have some documentation for them.
* scanner: Add location to elements so we can give better errors/warningsKristian Høgsberg2013-11-151-7/+25
|
* scanner: Make fail() function use va_list and elaborate a few errorsKristian Høgsberg2013-11-151-7/+14
|
* scanner: Introduce struct location for tracking source locationsKristian Høgsberg2013-11-151-20/+26
|
* scanner: Warn about requests with more than one new-id and don't generate stubsKristian Høgsberg2013-11-151-0/+14
| | | | | | | The generated code only support one new-id per request, since the stubs return the new proxy. It's still possible to send requests with multiple new-id arguments, but it must be done with wl_proxy_marshal_array_constructor().
* server: Start documenting the server side APIKristian Høgsberg2013-11-131-0/+130
| | | | This is now public, stable API, so it seems prudent to actually document it.
* server: Add API to protect access to an SHM bufferNeil Roberts2013-11-132-0/+137
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Linux will let you mmap a region of a file that is larger than the size of the file. If you then try to read from that region the process will get a SIGBUS signal. Currently the clients can use this to crash a compositor because it can create a pool and lie about the size of the file which will cause the compositor to try and read past the end of it. The compositor can't simply check the size of the file to verify that it is big enough because then there is a race condition where the client may truncate the file after the check is performed. This patch adds the following two public functions in the server API which can be used wrap access to an SHM buffer: void wl_shm_buffer_begin_access(struct wl_shm_buffer *buffer); void wl_shm_buffer_end_access(struct wl_shm_buffer *buffer); The first time wl_shm_buffer_begin_access is called a signal handler for SIGBUS will be installed. If the signal is caught then the buffer for the current pool is remapped to an anonymous private buffer at the same address which allows the compositor to continue without crashing. The end_access function will then post an error to the buffer resource. The current pool is stored as part of some thread-local storage so that multiple threads can safely independently access separate buffers. Eventually we may want to add some more API so that compositors can hook into the signal handler or replace it entirely if they also want to do some SIGBUS handling.
* wayland: Be consistent about #include-guard namesKristian Høgsberg2013-10-213-6/+6
| | | | | | | We had a mix of inconsistent names, some of which were non-conformant. Standardize on all-uppercase-and-underscore naming convention. https://bugs.freedesktop.org/show_bug.cgi?id=70679
* scanner: Handle unrecognized invocation modeKristian Høgsberg2013-10-071-1/+3
| | | | | Print usage if we don't recognize the invocation mode. Also fixes uninitialized variable warning.
* client: Fix handling display->reader_count if poll failsNeil Roberts2013-09-251-1/+3
| | | | | | | | | | In wl_display_dispatch_queue, if poll fails then it would previously return immediately and leak a reference in display->reader_count. Then if the application ignores the error and tries to read again it will block forever. This can happen for example if the poll fails with EINTR which the application might consider to be a recoverable error. This patch makes it cancel the read so the reader_count will be decremented when poll fails.
* Export the Wayland protocol XML fileJason Ekstrand2013-09-212-0/+4
| | | | Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
* client: fix an inconsistency in documentationChang Liu2013-09-211-1/+1
| | | | | The errno is set to EAGAIN when there are undispatched events, according to L1066 of wayland-client.c.
* doc: Slight tweaks to wl_listenerAaron Faanes2013-09-211-4/+6
| | | | | Prefer \comment over // in code blocks for consistency's sake and keep variable definitions separated by a line from the rest of the body.
* utils: Document wl_container_ofAaron Faanes2013-09-211-0/+35
|
* wayland-server: Improve wording for wl_signal_get's docAaron Faanes2013-09-161-1/+1
| | | | | The old description was a bit vague; this commit hopefully improves describing what is returned.
* utils: Add doxygen for wayland-util.hAaron Faanes2013-09-161-0/+5
| | | | | | This is needed for doxygen to generate output for macro definitions, such as wl_container_of, that are contained by this file. Classes like wl_list would be documented regardless.
* utils: Reference some useful methods in wl_signal's doxygenAaron Faanes2013-09-161-1/+6
| | | | This commit adds a bit more detail on the lifecycle of a signal.
* wayland-server: Document wl_listenerAaron Faanes2013-09-161-0/+45
| | | | | This patch takes Kristian's comments into account, adding a demonstration and giving a more thorough idea of how wl_listener is used.
* wayland-server: Add a wl_resource_for_each_safe macroRob Bradford2013-09-111-0/+8
| | | | | A version of wl_resource_for_each that is safe for iteration when items in the list are removed.
* utils: tweak wl_list for better doxygen outputAaron Faanes2013-09-111-2/+3
|
* wayland-server: Document wl_signalAaron Faanes2013-09-111-0/+37
|
* wayland-server: Fix a uninitialized warning from clangAaron Faanes2013-09-111-1/+1
| | | | | This warning is unnecessary, since the pointer in question is only used for pointer arithmetic, but setting it explicitly to NULL doesn't hurt.
* scanner: Emit wl_*_destroy stub even if interface has a destructorKristian Høgsberg2013-08-301-1/+1
| | | | | | | If an interface has a destructor but no 'destroy' method we used to not emit a destroy method. Now with the fix for missing destroy requests for wl_pointer etc we need to emit the local wl_*_destroy always.
* Add support for client-side language bindingsJason Ekstrand2013-08-192-9/+86
| | | | | | | This commit adds support for language bindings on the client half of the library. The idea is the same as for server-side dispatchers. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
* Add support for server-side language bindingsJason Ekstrand2013-08-195-25/+120
| | | | | | | | | | | | | | | | | | This commit adds support for server-side languages bindings. This is done in two ways: 1. Adding a wl_resource_set_dispatcher function that corresponds to wl_resource_set_interface. The only difference between the two functions is that the new version takes a dispatcher along with the implementation, data, and destructor. This allows for runtime calling of native language functions for callbacks instead of having to generate function pointers. 2. Adding versions of wl_resource_post_event and wl_resource_queue_event that take an array of wl_argument instead of a variable argument list. This allows for easier run-time argument conversion and removes the need for libffi-based calling of variadic functions. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
* wayland-client: Add wl_proxy_get_listenerRob Bradford2013-08-122-0/+20
| | | | | | This is the mirror function to wl_proxy_add_listener and is useful inside client libraries to differentiate events on listeners for which multiple proxies have been created.
* wayland-server: Add a wl_resource_for_each macroRob Bradford2013-08-121-0/+5
| | | | | This macro allows you to correctly iterate through a list of resources handling the opaque nature of this type.
* client: Improve spelling and grammar in commentsBryce W. Harrington2013-08-081-6/+6
| | | | Signed-off-by: Bryce Harrington <b.harrington@samsung.com>
* server: Release additional_shm_formats array at display destructionTomeu Vizoso2013-08-081-0/+2
|
* scanner: expand help stringPeter Hutterer2013-08-071-0/+4
| | | | Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
* scanner: support help and --helpPeter Hutterer2013-08-071-6/+23
| | | | | | | | | wayland-scanner without arguments prints out usage. With help or --help it waits for stdin to supply something which isn't quite as informative as printing out the help. This patch also moves the strcmp for args up to have all of them in one location.
* Don't include wayland-server.h in wayland-private.hKristian Høgsberg2013-08-071-1/+2
| | | | We just declare struct wl_display manually instead.
* shm: Add API for renderers to register additional pixel formatsTomeu Vizoso2013-08-064-13/+58
|
* server: Set client->error when we fail to send a closureKristian Høgsberg2013-08-061-14/+4
| | | | | | | We we're using wl_event_loop_add_idle() here, but if we're failing because of OOM, that will typically also fail. Instead, use the existing client->error flag, which will break out of the event handling loop and shut down the client.
* server: Handle OOM properly when we fail to allocate a send closureKristian Høgsberg2013-08-061-2/+6
| | | | | If we can't allocate a closure, don't just silently continue. Set client->error so we shut down the client when we're done processing events.
* client: Simply wl_display_dispatch_queue_pending() and fix return valueJiergir Ogoerg2013-07-291-7/+4
| | | | | We're supposed to return number of events dispatched on success, not 0. Refactor to avoid goto and just return ret.
* wayland-client: Handle potential NULL-derefKristian Høgsberg2013-07-131-0/+2
| | | | | Instead, return -1 on out-of-memory. errno will be set to ENOMEM by the failing malloc.
* scanner: Fail more gracefully on out-of-memoryKristian Høgsberg2013-07-131-18/+41
| | | | | Failing with an error message and error code is little nicer. I doubt we'll hit this case much, but it makes the static analysis happy.
* connection: Handle empty signature and signature with just a version.Mariusz Ceier2013-07-121-0/+1
| | | | | | | | | | | | Functions like wl_argument_from_va_list expect from get_next_argument, to initialize details->type but when the signature is empty or contains only version (like in desktop-shell-protocol.c in weston) it is left uninitialized. This patch fixes it, by initializing details->type with '\0' value, signaling end of arguments. Signed-off-by: Mariusz Ceier <mceier+wayland@gmail.com>