1. 17 Aug, 2018 2 commits
  2. 15 Feb, 2018 1 commit
  3. 22 Jan, 2018 1 commit
  4. 09 Jan, 2018 1 commit
  5. 28 Dec, 2017 2 commits
  6. 27 Dec, 2017 4 commits
  7. 04 Dec, 2017 2 commits
  8. 10 Nov, 2016 1 commit
  9. 11 May, 2016 1 commit
  10. 23 Apr, 2016 1 commit
  11. 11 Feb, 2016 1 commit
  12. 19 Jan, 2016 1 commit
    • Sung-Jin Park's avatar
      server: Add an API to get the file descriptor for a client · eb52bb8e
      Sung-Jin Park authored
      This adds an API to get the file descriptor for a client.
      The client file descriptor can be used for a wayland compositor to validate
      a request from a client if there are any additional information provided from
      the client's file descriptor.
      For instance, this will be helpful in some linux distributions, in which SELinux
      or SMACK is enabled. In those environments, each file (including socket) will have
      each security contexts in its inode as xattr member variable. A wayland compositor
      can validate a client request by getting the file descriptor of the client and
      by checking the security contexts associated with the file descriptor.
      Signed-off-by: default avatarSung-Jin Park <input.hacker@gmail.com>
  13. 12 Jan, 2016 2 commits
  14. 16 Nov, 2015 1 commit
  15. 12 Jun, 2015 1 commit
  16. 12 Nov, 2014 1 commit
  17. 05 Nov, 2014 1 commit
  18. 04 Nov, 2014 1 commit
    • Benjamin Herr's avatar
      connection: Leave fd open in wl_connection_destroy · 391820b0
      Benjamin Herr authored
      Calling close() on the same file descriptor that a previous call to
      close() already closed is wrong, and racy if another thread received
      that same file descriptor as a eg. new socket or actual file.
      There are two situations where wl_connection_destroy() would close its
      file descriptor and then another function up in the call chain would
      close the same file descriptor:
        * When wl_client_create() fails after calling wl_connection_create(),
          it will call wl_connection_destroy() before returning. However, its
          caller will always close the file descriptor if wl_client_create()
        * wl_display_disconnect() unconditionally closes the display file
          descriptor and also calls wl_connection_destroy().
      So these two seem to expect wl_connection_destroy() to leave the file
      descriptor open. The other caller of wl_connection_destroy(),
      wl_client_destroy(), does however expect wl_connection_destroy() to
      close its file descriptor, alas.
      This patch changes wl_connection_destroy() to indulge this majority of
      two callers by simply not closing the file descriptor. For the benefit
      of wl_client_destroy(), wl_connection_destroy() then returns the
      unclosed file descriptor so that wl_client_destroy() can close it
      Since wl_connection_destroy() is a private function called from few
      places, changing its semantics seemed like the more expedient way to
      address the double-close() problem than shuffling around the logic in
      wl_client_create() to somehow enable it to always avoid calling
      Signed-off-by: default avatarBenjamin Herr <ben@0x539.de>
      Reviewed-by: default avatarMarek Chalupa <mchqwerty@gmail.com>
      Reviewed-by: Pekka Paalanen's avatarPekka Paalanen <pekka.paalanen@collabora.co.uk>
  19. 19 Jun, 2014 1 commit
  20. 25 Apr, 2014 1 commit
  21. 21 Apr, 2014 1 commit
  22. 18 Feb, 2014 1 commit
    • Jasper St. Pierre's avatar
      connection: Use wl_log to report errors · 52a77fca
      Jasper St. Pierre authored
      In some cases, like Xwayland, stdout and stderr are redirected to
      /dev/null, losing us valuable information, while wl_log can be
      overridden, allowing us to send it to a log file instead. This
      can help debugging immensely.
  23. 09 Jan, 2014 1 commit
  24. 22 Nov, 2013 1 commit
  25. 19 Aug, 2013 1 commit
    • Jason Ekstrand's avatar
      Add support for server-side language bindings · c4409090
      Jason Ekstrand authored
      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's avatarJason Ekstrand <jason@jlekstrand.net>
  26. 13 Jul, 2013 1 commit
  27. 02 Jul, 2013 1 commit
    • Jason Ekstrand's avatar
      Add version information to wl_message signatures. · d35b6278
      Jason Ekstrand authored
      This commit adds version information to wl_message signatures and a
      wl_message_get_since function to retrieve.  The since version comes in the
      form of a (possible) integer at the begining of the message.  If the
      message starts with an integer, then it specifies the "since" version of
      that message.  Messages present in version one do not get this "since"
      information.  In this way we can run-time detect the version information
      for a structure on a per-message basis.
      Signed-off-by: Jason Ekstrand's avatarJason Ekstrand <jason@jlekstrand.net>
  28. 21 Jun, 2013 1 commit
  29. 17 Jun, 2013 1 commit
    • Kristian H. Kristensen's avatar
      client: Add wl_display_prepare_read() API to relax thread model assumptions · 3c7e8bfb
      Kristian H. Kristensen authored
      The current thread model assumes that the application or toolkit will have
      one thread that either polls the display fd and dispatches events or just
      dispatches in a loop.  Only this main thread will read from the fd while
      all other threads will block on a pthread condition and expect the main
      thread to deliver events to them.
      This turns out to be too restrictive.  We can't assume that there
      always will be a thread like that.  Qt QML threaded rendering will
      block the main thread on a condition that's signaled by a rendering
      thread after it finishes rendering.  This leads to a deadlock when the
      rendering threads blocks in eglSwapBuffers(), and the main thread is
      waiting on the condition.  Another problematic use case is with games
      that has a rendering thread for a splash screen while the main thread
      is busy loading game data or compiling shaders.  The main thread isn't
      responsive and ends up blocking eglSwapBuffers() in the rendering thread.
      We also can't assume that there will be only one thread polling on the
      file descriptor.  A valid use case is a thread receiving data from a
      custom wayland interface as well as a device fd or network socket.
      The thread may want to wait on either events from the wayland
      interface or data from the fd, in which case it needs to poll on both
      the wayland display fd and the device/network fd.
      The solution seems pretty straightforward: just let all threads read
      from the fd.  However, the main-thread restriction was introduced to
      avoid a race.  Simplified, main loops will do something like this:
      	/* Race here if other thread reads from fd and places events
      	 * in main eent queue.  We go to sleep in poll while sitting on
      	 * events that may stall the application if not dispatched. */
      	poll(fds, nfds, -1);
      	/* Race here if other thread reads and doesn't queue any
      	 * events for main queue. wl_display_dispatch() below will block
      	 * trying to read from the fd, while other fds in the mainloop
      	 * are ignored. */
      The restriction that only the main thread can read from the fd avoids
      these races, but has the problems described above.
      This patch introduces new API to solve both problems.  We add
      	int wl_display_prepare_read(struct wl_display *display);
      	int wl_display_read_events(struct wl_display *display);
      wl_display_prepare_read() registers the calling thread as a potential
      reader of events.  Once data is available on the fd, all reader
      threads must call wl_display_read_events(), at which point one of the
      threads will read from the fd and distribute the events to event
      queues.  When that is done, all threads return from
      From the point of view of a single thread, this ensures that between
      calling wl_display_prepare_read() and wl_display_read_events(), no
      other thread will read from the fd and queue events in its event
      queue.  This avoids the race conditions described above, and we avoid
      relying on any one thread to be available to read events.
  30. 19 Mar, 2013 1 commit
  31. 17 Mar, 2013 1 commit
    • Jonas Ådahl's avatar
      client: Invoke new_id closure arguments as pointers instead of integers · cb73bffe
      Jonas Ådahl authored
      This commit adds a flags parameter to wl_closure_invoke(). The so far
      added flags are ment to specify if the invokation is client side or
      server side. When on the server side, closure arguments of type 'new_id'
      should be invoked as a integer id while on the client side they should
      be invoked as a pointer to a proxy object.
      This fixes a bug happening when the address of a client side 'new_id'
      proxy object did not fit in a 32 bit integer.
      krh: Squashed test suite compile fix from Jason Ekstrand.
      Signed-off-by: Jonas Ådahl's avatarJonas Ådahl <jadahl@gmail.com>
  32. 26 Feb, 2013 2 commits
    • Kristian H. Kristensen's avatar
      Stylistic nitpicking · 8f1386fb
      Kristian H. Kristensen authored
      No space between '!' and its argument, 	prefer i++ over ++i.
    • Jason Ekstrand's avatar
      Clean up and refactor wl_closure and associated functions · 2fc248dc
      Jason Ekstrand authored
      The primary purpose of this patch is to clean up wl_closure and separate
      closure storage, libffi, and the wire format.  To that end, a number of changes
      have been made:
       - The maximum number of closure arguments has been changed from a magic number
         to a #define WL_CLOSURE_MAX_ARGS
       - A wl_argument union has been added for storing a generalized closure
         argument and wl_closure has been converted to use wl_argument instead of the
         combination of libffi, the wire format, and a dummy extra buffer.  As of
         now, the "extra" field in wl_closure should be treated as bulk storage and
         never direclty referenced outside of wl_connection_demarshal.
       - Everything having to do with libffi has been moved into wl_closure_invoke
         and the convert_arguments_to_ffi helper function.
       - Everything having to do with the wire format has been restricted to
         wl_connection_demarshal and the new static serialize_closure function.  The
         wl_closure_send and wl_closure_queue functions are now light wrappers around
      Signed-off-by: Jason Ekstrand's avatarJason Ekstrand <jason@jlekstrand.net>