[PATCH weston v5 03/14] libweston: add weston_debug API and implementation

Daniel Stone daniel at fooishbar.org
Mon Aug 27 15:15:23 UTC 2018


Hi Pekka,

On Mon, 6 Aug 2018 at 14:05, Pekka Paalanen <ppaalanen at gmail.com> wrote:
> On Fri, 20 Jul 2018 20:03:24 +0100 Daniel Stone <daniels at collabora.com> wrote:
> > +     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.

I don't think there's much we can do about that to be honest. I guess
we could post an error to the owning client and disconnect it? Else
we're just throwing away data, potentially corrupting the debug
stream, which seems suboptimal.

Currently we just block, and document that your debug client _must_
keep up with the incoming stream.

Cheers,
Daniel


More information about the wayland-devel mailing list