qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: Laszlo Ersek <lersek@redhat.com>
Cc: qemu-devel@nongnu.org, Luiz Capitulino <lcapitulino@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 1/2] char: io_channel_send: don't lose written bytes
Date: Tue, 16 Jul 2013 14:51:26 -0500	[thread overview]
Message-ID: <87ppuifflt.fsf@codemonkey.ws> (raw)
In-Reply-To: <51E59E5B.8010301@redhat.com>

Laszlo Ersek <lersek@redhat.com> writes:

> On 07/16/13 20:57, Anthony Liguori wrote:
>> Laszlo Ersek <lersek@redhat.com> writes:
>> 
>>> The g_io_channel_write_chars() documentation states,
>>>
>>>   bytes_written: The number of bytes written. This can be nonzero even if
>>>                  the return value is not G_IO_STATUS_NORMAL. [...]
>>>
>>> io_channel_send() could lose such bytes before.
>>>
>>> Furthermore, the (status == G_IO_STATUS_EOF) condition used to evaluate to
>>> constant false whenever it was reached. When that condition actually held,
>>> it always led to -1 / EINVAL. This patch (almost) distinguishes
>>> G_IO_STATUS_EOF only when no bytes have been written, and then treats it
>>> as an error.
>> 
>> Just for my own benefit, I always assume G_IO_STATUS_EOF cannot happen
>> if bytes_written > 0.  I see what you mean by the comment but do you
>> have any reason to believe this happens in practice?
>
> In my opinion, G_IO_STATUS_EOF doesn't make any sense whatsoever for a
> write operation (for count>0) if glib kept any resemblance to write(),
> and should never happen in practice.

Okay, thanks!

I'll give other folks a chance to look at this series and then apply in
a day or so.

Regards,

Anthony Liguori

>
> The awkward commit message only captures the fact that I didn't forget
> about G_IO_STATUS_EOF, I considered it explicitly.
>
>> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
>
> Thanks!
>
> Laszlo

  reply	other threads:[~2013-07-16 19:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-16 18:19 [Qemu-devel] [PATCH 0/2] changes related to monitor flow control Laszlo Ersek
2013-07-16 18:19 ` [Qemu-devel] [PATCH 1/2] char: io_channel_send: don't lose written bytes Laszlo Ersek
2013-07-16 18:57   ` Anthony Liguori
2013-07-16 19:26     ` Laszlo Ersek
2013-07-16 19:51       ` Anthony Liguori [this message]
2013-07-16 18:19 ` [Qemu-devel] [PATCH 2/2] monitor: maintain at most one G_IO_OUT watch Laszlo Ersek
2013-07-16 18:58   ` Anthony Liguori
2013-07-17 10:34 ` [Qemu-devel] [PATCH 0/2] changes related to monitor flow control Amit Shah
2013-07-18 19:36 ` Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ppuifflt.fsf@codemonkey.ws \
    --to=aliguori@us.ibm.com \
    --cc=lcapitulino@redhat.com \
    --cc=lersek@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).