From owner-freebsd-questions Thu Aug 3 8:24:45 2000 Delivered-To: freebsd-questions@freebsd.org Received: from bingnet2.cc.binghamton.edu (bingnet2.cc.binghamton.edu [128.226.1.18]) by hub.freebsd.org (Postfix) with ESMTP id 7CE8237BA24 for ; Thu, 3 Aug 2000 08:24:40 -0700 (PDT) (envelope-from zzhang@cs.binghamton.edu) Received: from sol.cs.binghamton.edu (sol.cs.binghamton.edu [128.226.123.100]) by bingnet2.cc.binghamton.edu (8.9.3/8.9.3) with ESMTP id LAA03408; Thu, 3 Aug 2000 11:24:32 -0400 (EDT) Date: Thu, 3 Aug 2000 11:21:48 -0400 (EDT) From: Zhihui Zhang To: Laurence Barry Cc: FreeBSD Questions Subject: Re: nfiles In-Reply-To: <39898501.6FDC3C79@herculeez.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Thu, 3 Aug 2000, Laurence Barry wrote: > Sure this is a simple one ... > > I need to determine the total number of files open on a system. The only > way I can think to do this is a sysctl() call with mib[0]=CTL_KERN and > mib[1]=KERN_FILE, then trawl through the file structure that is > returned. There must be a simpler way. You can add a new sysctl variable named something like "kern.openfiles" easily to account for the number of file structures in use. Adding a new sysctl variable is really easy (two lines are enough). But you need to build a custom kernel. See FreeBSD handbook online for how to do this. -Zhihui To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message