On Fri, 20 Jul 2018 20:03:24 +0100
Daniel Stone <dani...@collabora.com> wrote:

> From: Pekka Paalanen <p...@iki.fi>
> 
> weston_debug is both a libweston API for relaying debugging messages,
> and the compositor-debug wayland protocol implementation for accessing those
> debug messages from a Wayland client.
> 
> weston_debug_compositor_{create,destroy}() are private API, hence not
> exported.
> 
> Signed-off-by: Pekka Paalanen <p...@iki.fi>
> 
> append the debug scope name along with the timestamp in
> weston_debug_scope_timestamp API
> 
> Signed-off-by: Maniraj Devadoss <maniraj.devad...@in.bosch.com>
> Reviewed-by: Pekka Paalanen <pekka.paala...@collabora.co.uk>
> 
> Add explicit advertisement of debug scope names.
> 
> Signed-off-by: Daniel Stone <dani...@collabora.com>
> ---
>  Makefile.am              |   2 +
>  libweston/compositor.c   |   6 +
>  libweston/compositor.h   |   9 +
>  libweston/weston-debug.c | 723 +++++++++++++++++++++++++++++++++++++++
>  libweston/weston-debug.h | 107 ++++++
>  5 files changed, 847 insertions(+)
>  create mode 100644 libweston/weston-debug.c
>  create mode 100644 libweston/weston-debug.h
> 

Hi,

yet another thing I noticed.

> +/** Write data into a specific debug stream
> + *
> + * \param stream The debug stream to write into.
> + * \param data[in] Pointer to the data to write.
> + * \param len Number of bytes to write.
> + *
> + * Writes the given data (binary verbatim) into the debug stream.
> + * If \c len is zero or negative, the write is silently dropped.
> + *
> + * Writing is continued until all data has been written or
> + * a write fails. If the write fails due to a signal, it is re-tried.
> + * Otherwise on failure, the stream is closed and
> + * \c weston_debug_stream_v1.failure event is sent to the client.
> + *
> + * \memberof weston_debug_stream
> + */
> +WL_EXPORT void
> +weston_debug_stream_write(struct weston_debug_stream *stream,
> +                       const char *data, size_t len)
> +{
> +     ssize_t len_ = len;
> +     ssize_t ret;
> +     int e;
> +
> +     if (stream->fd == -1)
> +             return;
> +
> +     while (len_ > 0) {
> +             ret = write(stream->fd, data, len_);
> +             e = errno;
> +             if (ret < 0) {
> +                     if (e == EINTR)
> +                             continue;
> +
> +                     stream_close_on_failure(stream,
> +                                     "Error writing %zd bytes: %s (%d)",
> +                                     len_, strerror(e), e);
> +                     break;
> +             }
> +
> +             len_ -= ret;
> +             data += ret;

If write() starts returning zero, we might be in for a very long loop.

> +     }
> +}


Thanks,
pq

Attachment: pgp6vsSyGLS8b.pgp
Description: OpenPGP digital signature

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to