From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nz8rB-0001wh-UK for qemu-devel@nongnu.org; Tue, 06 Apr 2010 09:30:17 -0400 Received: from [140.186.70.92] (port=34326 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nz8rA-0001wX-PP for qemu-devel@nongnu.org; Tue, 06 Apr 2010 09:30:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nz8r8-0006lG-JS for qemu-devel@nongnu.org; Tue, 06 Apr 2010 09:30:16 -0400 Received: from mail2.shareable.org ([80.68.89.115]:53920) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nz8r8-0006jn-F9 for qemu-devel@nongnu.org; Tue, 06 Apr 2010 09:30:14 -0400 Date: Tue, 6 Apr 2010 14:30:02 +0100 From: Jamie Lokier Subject: Re: [Qemu-devel] [PATCH 1/5] char: Let the caller know how many bytes were written in case of incomplete writes Message-ID: <20100406133002.GA24003@shareable.org> References: <1270471538-31275-1-git-send-email-amit.shah@redhat.com> <201004051733.38629.paul@codesourcery.com> <20100406032429.GB4135@amit-x200.redhat.com> <201004061034.30213.paul@codesourcery.com> <20100406095804.GK4135@amit-x200.redhat.com> <4BBB0B40.9030402@redhat.com> <20100406110540.GP4135@amit-x200.redhat.com> <4BBB1800.4060105@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4BBB1800.4060105@redhat.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: Amit Shah , qemu-devel@nongnu.org, Paul Brook , Juan Quintela Gerd Hoffmann wrote: > On 04/06/10 13:05, Amit Shah wrote: > >On (Tue) Apr 06 2010 [12:21:52], Gerd Hoffmann wrote: > >>On 04/06/10 11:58, Amit Shah wrote: > >>>>>It would certainly be beneficial for consumers of virtio-serial to be > >>>>>notified of -EAGAIN so that the guest can be throttled till the chardev > >>>>>catches up with the data being sent. > >>>> > >>>>EAGAIN should only ever occur if no bytes are written. > >>> > >>>Right. That, or just return 0 and let the caller handle the situation? > >> > >>Go with the usual unix semantics instead of creating something new. > >> > >>When something was written -- return the number of bytes. Caller has to > >>compare with the length passed in to figure whenever it was a partial > >>write or not. > >> > >>When nothing was written -- return the error. > > > >Unless Paul wants to never return recoverable error messages as he > >mentioned in his first mail. > > Return value "0" usually means end-of-file, I would not use that for > something else too. We have to agree on something though ... Which is why EAGAIN was invented. -- Jamie