Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nz6cn-0001vj-Kq for qemu-devel@nongnu.org; Tue, 06 Apr 2010 07:07:17 -0400 Received: from [140.186.70.92] (port=54066 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nz6cm-0001tY-9j for qemu-devel@nongnu.org; Tue, 06 Apr 2010 07:07:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nz6ck-0004ND-OV for qemu-devel@nongnu.org; Tue, 06 Apr 2010 07:07:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49550) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nz6ck-0004N3-Dc for qemu-devel@nongnu.org; Tue, 06 Apr 2010 07:07:14 -0400 Date: Tue, 6 Apr 2010 16:35:40 +0530 From: Amit Shah Subject: Re: [Qemu-devel] [PATCH 1/5] char: Let the caller know how many bytes were written in case of incomplete writes Message-ID: <20100406110540.GP4135@amit-x200.redhat.com> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4BBB0B40.9030402@redhat.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: Juan Quintela , Paul Brook , qemu-devel@nongnu.org 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. Amit