From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LP0Nl-0002XL-Oc for qemu-devel@nongnu.org; Mon, 19 Jan 2009 15:06:01 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LP0Nj-0002WU-V6 for qemu-devel@nongnu.org; Mon, 19 Jan 2009 15:06:01 -0500 Received: from [199.232.76.173] (port=32911 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LP0Nj-0002WP-Lf for qemu-devel@nongnu.org; Mon, 19 Jan 2009 15:05:59 -0500 Received: from bsdimp.com ([199.45.160.85]:65400 helo=harmony.bsdimp.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LP0Nj-0002vY-0y for qemu-devel@nongnu.org; Mon, 19 Jan 2009 15:05:59 -0500 Date: Mon, 19 Jan 2009 13:03:31 -0700 (MST) Message-Id: <20090119.130331.1346848276.imp@bsdimp.com> Subject: Re: [Qemu-devel] [6324] Return -errno on write failure (Gleb Natapov) From: "M. Warner Losh" In-Reply-To: <7523661163-BeMail@laptop> References: <18804.26133.917740.497581@mariner.uk.xensource.com> <7523661163-BeMail@laptop> Mime-Version: 1.0 Content-Type: Text/Plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, revol@free.fr In message: <7523661163-BeMail@laptop> "Fran=E7ois Revol" writes: : > But returning -errno to indicate an error is a very convenient : > practice. It is deservedly widely used, not just in qemu. To do : = : I'm still wondering why this convenient way of doing has not been use= d = : for decades outside Unix kernels themselves until recently... s/Unix/Linux/g. This is a Linuxism that isn't widespread outside of Linux and programs that were written to emulate the Linux -EBLAH style in the Linux kernel. BSD doesn't do this at all, nor does Solaris or the antecedents of SysV, 8th edition, seventh edition, sixth edition, etc. The Linux kernel was the first place I saw the practice, which many have panned as unwise in-band signaling since it tries to encode in part of the range of the return value the error, when in fact you can't always assume that all system-call functions will return a negative number that's not meaningful (which is why the standards are very careful to specify that the return value of the system call is -1, and errno is set to provide more information about the error). So please, let's not get carried away and claim that this practice originated in Unix, nor tar the whole Unix world with this dubious practice. Of course, the polemics on this thread are already out of this world, and I should know better than to reply... Warner