From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Sjpxu-0001Nc-3X for barebox@lists.infradead.org; Wed, 27 Jun 2012 10:59:18 +0000 Date: Wed, 27 Jun 2012 12:59:15 +0200 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= Message-ID: <20120627105915.GE18096@pengutronix.de> References: <20120627093551.GC18096@pengutronix.de> <20120627095128.GF1623@pengutronix.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20120627095128.GF1623@pengutronix.de> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: barebox-bounces@lists.infradead.org Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: Re: is errno supposed to be positive or negative? To: Sascha Hauer Cc: barebox@lists.infradead.org On Wed, Jun 27, 2012 at 11:51:28AM +0200, Sascha Hauer wrote: > On Wed, Jun 27, 2012 at 11:35:51AM +0200, Uwe Kleine-K=F6nig wrote: > > Hello, > > = > > Well, ok, errno is supposed to be zero, but in the rare cases where it's > > not, what is intended? > > = > > Assuming ESOMETHING is always positive, in userspace errno is > > positive, e.g. you test for errno =3D=3D EBADF. > > = > > In barebox however most assignments use > > = > > errno =3D -ESOMETHING > > = > > but there are also some tests and assignments without minus. barebox' > > perror expects a negative errno which is also different from POSIX' > > perror. strerror uses positive semantics in both barebox and POSIX. > = > Your tree is not up to date. > = > see: > = > commit 6188685091c58c9772b990cf0ca6ac522f97a9d0 > Author: Sascha Hauer > Date: Sun May 13 12:43:58 2012 +0200 > = > Make errno a positive value > = > Normally errno contains a positive error value. A certain unnamed dev= eloper > mixed this up while implementing U-Boot-v2. Also, normally errno is n= ever > set to zero by any library function. This patch fixes this. > = > Signed-off-by: Sascha Hauer OK, you're right. There is just: $ git grep errno\ =3D\ -E origin/master origin/master:fs/ramfs.c: errno =3D -ENOENT; Best regards Uwe -- = Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | http://www.pengutronix.de/ | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox