[RFC wayland 00/12] wayland-client: error recovery

David Herrmann dh.herrmann at googlemail.com
Thu Oct 11 14:37:41 PDT 2012


This patchset is some _untested_ (but compile-tested) proposal to add
error-recovery paths to libwayland-client. The basic idea is to set a global
flag when a fatal-error occurs and waking up all event-queues. All sleeping
dispatchers and all further dispatches will return -1 and errno set to the fatal
error code.

Patch #1 adds the "last_error" flag to wl_display.
Patches #2 to #9 are simple error-path fixups.
Patch #10 to #12 implement correct error-handling in wl_display_*.

There are still many paths inside of libwayland-client that call assert or
abort, however, these can easily be changed to call wl_display_fatal_error() or
display_fatal_error() to initiate a graceful shutdown.

As one further step I intend to make all wl_proxy_* functions accept NULL as
proxy and just perform a no-op. This allows us to remove any kind of
error-recovery from the protocol-stubs.


David Herrmann (12):
  wayland-client: add wl_display_get_error()
  wayland-util: return -1 if wl_array_copy() fails
  wayland-util: return -1 on OOM in wl_map_insert_new()
  connection: close pending outgoing fds on shutdown
  connection: fix buffer-overflow in close_fds()
  connection: close pending incoming FDs on shutdown
  connection: fix buffer-overflow in build_cmsg()
  connection: fix leaking FDs on buffer-overflow during read
  connection: return error on buffer-overflow during read
  wayland-client: link all event-queues of each display into a list
  wayland-client: duplicate fd on connect
  wayland-client: forward fatal errors to caller

 src/connection.c      |  81 ++++++++++++++++--------
 src/wayland-client.c  | 172 +++++++++++++++++++++++++++++++++++++++++---------
 src/wayland-client.h  |   3 +-
 src/wayland-private.h |   2 +-
 src/wayland-util.c    |  16 +++--
 src/wayland-util.h    |   2 +-
 6 files changed, 214 insertions(+), 62 deletions(-)


More information about the wayland-devel mailing list