From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nz6ll-0006mE-SP for qemu-devel@nongnu.org; Tue, 06 Apr 2010 07:16:34 -0400 Received: from [140.186.70.92] (port=54918 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nz6lk-0006lX-CU for qemu-devel@nongnu.org; Tue, 06 Apr 2010 07:16:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nz6li-0005We-RR for qemu-devel@nongnu.org; Tue, 06 Apr 2010 07:16:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56495) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nz6li-0005WX-9Z for qemu-devel@nongnu.org; Tue, 06 Apr 2010 07:16:30 -0400 Message-ID: <4BBB1800.4060105@redhat.com> Date: Tue, 06 Apr 2010 13:16:16 +0200 From: Gerd Hoffmann MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 1/5] char: Let the caller know how many bytes were written in case of incomplete writes 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> In-Reply-To: <20100406110540.GP4135@amit-x200.redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Amit Shah Cc: Juan Quintela , Paul Brook , qemu-devel@nongnu.org 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 ... cheers, Gerd