Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Oct 1999 16:58:38 -0400 (EDT)
From:      Zhihui Zhang <zzhang@cs.binghamton.edu>
To:        freebsd-hackers@freebsd.org
Subject:   Determine # of open files via fdesc
Message-ID:  <Pine.GSO.3.96.991014164954.3631B-100000@sol.cs.binghamton.edu>

next in thread | raw e-mail | index | archive | help

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?

Any help is appreciated.

-Zhihui



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.3.96.991014164954.3631B-100000>