mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: barebox@lists.infradead.org
Subject: is errno supposed to be positive or negative?
Date: Wed, 27 Jun 2012 11:35:51 +0200	[thread overview]
Message-ID: <20120627093551.GC18096@pengutronix.de> (raw)

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 == EBADF.

In barebox however most assignments use

	errno = -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.

I'd vote to fix barebox to use the same semantic for errno (and perror)
as POSIX.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2012-06-27  9:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-27  9:35 Uwe Kleine-König [this message]
2012-06-27  9:51 ` Sascha Hauer
2012-06-27 10:59   ` Uwe Kleine-König
2012-06-27 13:53     ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120627093551.GC18096@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox