From: Ben Bacarisse on
Seebs <usenet-nospam(a)seebs.net> writes:

> On 2010-06-09, Alan Curry <pacman(a)kosh.dhis.org> wrote:
>> It's documented in a sensible place corresponding to its real location.
>
>> $ ls -l /dev/fd
>> lrwxrwxrwx 1 root root 13 Feb 15 2009 /dev/fd -> /proc/self/fd
>
>> proc(5) contains a section on /proc/[pid]/fd (and a section on /proc/self
>> just in case you didn't know about that already)
>
> I'm not sure I am convinced that this is the "real" location. Assuming
> that you might occasionally use more than one kind of Unixy system,
> "/dev/fd/0" is the name that you would be looking for, "/proc/self/fd"
> is an implementation detail.

It seems to me that Alan was replying to your last remark: that you
could not find where it was documented in a Linux system.

It is not uncommon on Usenet to reply quoting only the words or phrase
they are replying to. At first this seems logical, but most things we
say are said in a context that alters the meaning. I like to include
the context if I can. If everything can be taken out of the context in
which it was said, you end up writing in a peculiar style where
every remark must be universally true.

After a remark that you can't find the documentation in Linux, something
explaining why it is not where you looked can't reasonably be taken to
be a remark about other systems. At least I read it as applying only to
Linux.

<snip>
--
Ben.
From: Seebs on
On 2010-06-09, Ben Bacarisse <ben.usenet(a)bsb.me.uk> wrote:
> After a remark that you can't find the documentation in Linux, something
> explaining why it is not where you looked can't reasonably be taken to
> be a remark about other systems. At least I read it as applying only to
> Linux.

True, but I had already commented on the passing mention in the /proc
man page.

>>>The first Linux I tried on
>>>came up with the floppy drive man page, which seems unusual. I
>>>see one passing reference in the output of "man proc"

So I'd found it there, so I understood him to be commenting on why it
was there, and I was disputing that rationale.

-s
--
Copyright 2010, all wrongs reversed. Peter Seebach / usenet-nospam(a)seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
From: Alan Curry on
In article <slrni0ufr4.1m5.usenet-nospam(a)guild.seebs.net>,
Seebs <usenet-nospam(a)seebs.net> wrote:
>On 2010-06-09, Alan Curry <pacman(a)kosh.dhis.org> wrote:
>> It's documented in a sensible place corresponding to its real location.
>
>> $ ls -l /dev/fd
>> lrwxrwxrwx 1 root root 13 Feb 15 2009 /dev/fd -> /proc/self/fd
>
>> proc(5) contains a section on /proc/[pid]/fd (and a section on /proc/self
>> just in case you didn't know about that already)
>
>I'm not sure I am convinced that this is the "real" location. Assuming
>that you might occasionally use more than one kind of Unixy system,
>"/dev/fd/0" is the name that you would be looking for, "/proc/self/fd"
>is an implementation detail.

No, /proc/self/fd is the properly documented, intentionally exposed
kernel-to-user interface. The /dev/fd symlink is sort of a joke that
unfortunately caught on.

"real unixy" /dev/fd has different semantics.

--
Alan Curry
From: Seebs on
On 2010-06-09, Alan Curry <pacman(a)kosh.dhis.org> wrote:
> No, /proc/self/fd is the properly documented, intentionally exposed
> kernel-to-user interface. The /dev/fd symlink is sort of a joke that
> unfortunately caught on.

Perhaps.

But it's not obvious to me that someone coming to Linux and porting
something which uses /dev/fd/N has any reasonable way to guess that
it's "sort of a joke" and that they should instead be reading the man
page for a feature they've never heard of or tried to use.

Maybe the real solution would be to implement a canonical-form /dev/fd
with the right semantics, and document it. :)

> "real unixy" /dev/fd has different semantics.

Does it? It has always looked about the same to me everywhere; /dev/fd/N
refers to file descriptor N, and if the system supports this, exists if and
only if fd N is open. (Some systems have the ability to do that, others
tend to just create predefined device nodes.)

-s
--
Copyright 2010, all wrongs reversed. Peter Seebach / usenet-nospam(a)seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
From: Alan Curry on
In article <slrni10911.8eh.usenet-nospam(a)guild.seebs.net>,
Seebs <usenet-nospam(a)seebs.net> wrote:
>On 2010-06-09, Alan Curry <pacman(a)kosh.dhis.org> wrote:
>> No, /proc/self/fd is the properly documented, intentionally exposed
>> kernel-to-user interface. The /dev/fd symlink is sort of a joke that
>> unfortunately caught on.
>
>Perhaps.
>
>But it's not obvious to me that someone coming to Linux and porting
>something which uses /dev/fd/N has any reasonable way to guess that
>it's "sort of a joke" and that they should instead be reading the man
>page for a feature they've never heard of or tried to use.

It's a symlink. ls -l isn't an advanced concept. It's not like there's an
obvious mapping from "names of things in /dev" to "names of man pages" in
general. You have to use a little intelligence here.

>
>Maybe the real solution would be to implement a canonical-form /dev/fd
>with the right semantics, and document it. :)
>
>> "real unixy" /dev/fd has different semantics.
>
>Does it? It has always looked about the same to me everywhere; /dev/fd/N
>refers to file descriptor N, and if the system supports this, exists if and
>only if fd N is open. (Some systems have the ability to do that, others
>tend to just create predefined device nodes.)
>

real unix people have expressed disappointment that Linux has a /dev/fd but
it doesn't work right. If the /dev/fd symlink hadn't been there, maybe that
wouldn't have been a problem.

I volunteer myself for the experiment: I just rm'ed /dev/fd, now I'll see
how long it takes to notice something not working because it fails to use
the documented interface.

--
Alan Curry