public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Philippe Troin <phil@fifi.org>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Albert Cahalan <albert@users.sourceforge.net>,
	linux-kernel mailing list <linux-kernel@vger.kernel.org>,
	Andrew Morton OSDL <akpm@osdl.org>
Subject: Re: errno
Date: 03 May 2004 22:58:56 -0700	[thread overview]
Message-ID: <87r7u0g2cf.fsf@electrolyt.fifi.org> (raw)
In-Reply-To: <Pine.LNX.4.58.0405032111450.1636@ppc970.osdl.org>

Linus Torvalds <torvalds@osdl.org> writes:

> On Mon, 3 May 2004, Albert Cahalan wrote:
> > 
> > The obvious fix would be to stuff errno into the
> > task_struct, hmmm?
> 
> No. "errno" is one of those fundamentally broken things that should not 
> exist. It was wrogn in original UNIX, it's wrong now.
> 
> The kernel usage comes not from the kernel wanting to use it per se (the 
> kernel has always used the "negative error" approach), but from some 
> misguided kernel modules using the user-space interfaces.
> 
> The Linux way of returning negative error numbers is much nicer. It's
> inherently thread-safe, and it has no performance downsides. Of course, it
> does depend on having enough of a result domain that you can always
> separate error returns from good returns, but that's true in practice for
> all system calls.

Except of course for fcntl(fd, F_GETOWN) where the owner is a
(negative) process group... If the owning process group has a "low
enough" PGID, it collides with errors and glibc reports an error and
sets errno to -PGID. One might argue that in this instance, that the
BSD's overloading of the pid field with pgids is at fault, but the bug
still remains :-)

Phil.

  reply	other threads:[~2004-05-04  5:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-04  1:26 errno Albert Cahalan
2004-05-04  4:14 ` errno Linus Torvalds
2004-05-04  5:58   ` Philippe Troin [this message]
2004-05-06  1:16     ` errno Philippe Troin

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=87r7u0g2cf.fsf@electrolyt.fifi.org \
    --to=phil@fifi.org \
    --cc=akpm@osdl.org \
    --cc=albert@users.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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