lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lynx-dev < stdin , etc


From: Klaus Weide
Subject: Re: lynx-dev < stdin , etc
Date: Wed, 23 Dec 1998 15:44:16 -0600 (CST)

On Wed, 23 Dec 1998, Philip Webb wrote:
> 981222 Klaus Weide wrote: 
> > Here  /dev/stdin  is a symbolic link to  /dev/fd/0
> > which points to  /proc/self/fd/0 , but that would be system specific.
> 
> i suspect i'm not the only lynx-dever who would be interested
> to learn more about  /dev/fd  &  /proc/self/fd :
> the former exists on this system (IRIX 5.3) as a directory,
> but the latter doesn't: there's only  /proc  (a directory);
>  /dev  &  /proc  both contain large numbers of wierd-looking entries;
> my detailed notes on Kernighan & Pike say nothing.
> would you be willing to give (most of) us a brief lesson?

Unix likes to make all kinds of objects appear as files, so that they can
be accessed and manipulated with the same functions / system calls read(),
write(),chmod(),chmod(),ioctl() and so on.  That's already true for the
usual character and block device "files" in /dev/; the /proc/ filesystem
is just an extension of that idea to even more objects.  Under Linux,
you can for example get all kinds of useful information about (the current
state of the) hardware and OS kernel just by cat-ing the right "file"
under /proc; the root user can change the runtime behavior of the kernel
by writing certain values to some of those files.  This is entirely OS-
specific and depends on how the kernel was compiled.  There's also a
subdirectory /proc/<pid> for every process that exists, containing
"files" with various pieces of process-specific info, and each process
sees /proc/self as a symlink pointing to /proc/<my-pid>.  It's all
make-believe of course, the kernel just pretends those "directories" and
"files" are there.

This may be completely different on SGI, and other Unix flavours may or
may not have something similar.  On Linux /dev/fd/<fd> is a way of
accessing the corresponding filedescriptor (which is of course process-
specific), and happesn to be just a symlink to /proc/self/fd/<fd>.
Other systems also have /dev/fd/<fd> but it is implemented in a different
way.

   Klaus


reply via email to

[Prev in Thread] Current Thread [Next in Thread]