On 07Jun2007 07:25, abhishek misra <[EMAIL PROTECTED]> wrote:
|             elm3a138:/dev # ls  | grep std
| stderr
| stdin
| stdout
| elm3a138:/dev #

Try this:

  ls -ld /dev/std*

It is more informative.

| does a linux system have single set of std files or does every program has a 
set of its own.

Every program has its own. And when you talk about them in this case,
you are _not_ talking about the files in /dev. Every program has
assorted open files; each open file is identified to the program with a
"file descriptor", a number starting at 0. Descriptor zero is stdin,
descriptor 1 is stdout and descriptor 2 is stderr. Other open files will
have other descriptor numbers.

In /dev/fd (a directory) are a bunch of special files named numericly:
  
  ls /dev/fd

Like /dev/tty, which when opened gives you a file handle attached to your
terminal, opening /dev/fd/n (where 'n' is a number) gives you a file handle
attached to the same file as file descriptor 'n' in your current
process.

/dev/stdin, stdout and stderr are convenient symbolic links to
/dev/fd/0, 1, and 2. That is all. No magic.

| it is also said that as every program starts it is supplied these files

Yes.

| when we run different progs on different terminals, each of them has its i/o 
on that terminal only

Yes.

| so i think that every one gets their own set

Yes.

| but then it does not make sence for /dev to have these listed

There are various programs that can only be handed filenames when run.
For such programs is it convenient to have "filenames" that will open
a process' already-open files. So you might use the filename /dev/fd/1
to has - as a filename - your current stnadard output to a command as
a filename argument.

| are file discriptors unique to the system or the  process 

The process.

Each descriptor is an index into a per-process table of open files. At
the OS level, to write to a file you issue a function call like:

  write(fd, buffer, size)

where fd is the fiel descriptor - of course the file is open by the time
you write to it; in fact it must be open - there is no other way to try
to write.
-- 
Cameron Simpson <[EMAIL PROTECTED]> DoD#743
http://www.cskk.ezoshosting.com/cs/

The mystery is why a proud people, descended from revolutionaries, is willing
to submit, with good humor, to the intrusion of corporate and governmental
authorities.    - Barbara Ehrenreich


To unsubscribe from this list, please email [EMAIL PROTECTED] & you will be 
removed. 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/LINUX_Newbies/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/LINUX_Newbies/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to