Re: Determine # of open files via fdesc

1999-10-15 Thread Dag-Erling Smorgrav

Zhihui Zhang [EMAIL PROTECTED] writes:
 I do not know whether it is a good idea to determine the number of open
 files of a process by enabling fdesc in the kernel. Anyway, I do the
 following:
 
 # mount_fdesc -o union fdesc /dev
 # ls -al /dev/fd  list
  cat list
 total 1
 crw---  1 root  tty 12,   0 Oct 15 17:09 0
 -rw-r--r--  1 root  wheel 0 Oct 15 17:09 1
 crw---  1 root  tty 12,   0 Oct 15 17:09 2
 drw-r--r--  5 root  wheel  1024 Oct 15 17:09 3
 dr--r--r--  2 root  wheel   512 Oct 15 16:28 4
 
 I do not know why 3 and 4 are labeled as directory.  1 was labeled as
 character device but is changed probably by the redirection .  I run a
 small program to open three files and run forever in the background. After
 this, I expect to see three more items under /dev/fd, but there are not.
 Can anyone explain this to me?

Each process only sees its own file descriptors. The five descriptors
you see above belong to ls. 0 (stdin) and 2 (stderr) are whichever tty
or pty you typed this into, 1 (stdout) is the file you redirected the
output from ls into, 3 is /dev and 4 is /dev/fd.

DES
-- 
Dag-Erling Smorgrav - [EMAIL PROTECTED]


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: Determine # of open files via fdesc

1999-10-15 Thread Dag-Erling Smorgrav

Dag-Erling Smorgrav [EMAIL PROTECTED] writes:
 Each process only sees its own file descriptors. The five descriptors
 you see above belong to ls. 0 (stdin) and 2 (stderr) are whichever tty
 or pty you typed this into, 1 (stdout) is the file you redirected the
 output from ls into, 3 is /dev and 4 is /dev/fd.

OBTW, this is adequately documented in the fdesc(5) man page.

DES
-- 
Dag-Erling Smorgrav - [EMAIL PROTECTED]


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message