From owner-freebsd-hackers Thu Oct 14 15: 1:20 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from bingnet2.cc.binghamton.edu (bingnet2.cc.binghamton.edu [128.226.1.18]) by hub.freebsd.org (Postfix) with ESMTP id 312CC14BDC for ; Thu, 14 Oct 1999 15:01:17 -0700 (PDT) (envelope-from zzhang@cs.binghamton.edu) Received: from sol.cs.binghamton.edu (cs1-gw.cs.binghamton.edu [128.226.171.72]) by bingnet2.cc.binghamton.edu (8.9.3/8.9.3) with SMTP id SAA08652 for ; Thu, 14 Oct 1999 18:01:14 -0400 (EDT) Date: Thu, 14 Oct 1999 16:58:38 -0400 (EDT) From: Zhihui Zhang To: freebsd-hackers@freebsd.org Subject: Determine # of open files via fdesc Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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