From owner-freebsd-stable@FreeBSD.ORG Sat Sep 27 22:44:32 2008 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C3F331065686 for ; Sat, 27 Sep 2008 22:44:32 +0000 (UTC) (envelope-from 000.fbsd@quip.cz) Received: from elsa.codelab.cz (elsa.codelab.cz [91.103.162.4]) by mx1.freebsd.org (Postfix) with ESMTP id 7E4978FC21 for ; Sat, 27 Sep 2008 22:44:31 +0000 (UTC) (envelope-from 000.fbsd@quip.cz) Received: from localhost (localhost.codelab.cz [127.0.0.1]) by elsa.codelab.cz (Postfix) with ESMTP id 0803B19E02A; Sun, 28 Sep 2008 00:44:30 +0200 (CEST) Received: from [192.168.1.2] (r5bb235.net.upc.cz [86.49.61.235]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by elsa.codelab.cz (Postfix) with ESMTPSA id 8E23019E027; Sun, 28 Sep 2008 00:44:27 +0200 (CEST) Message-ID: <48DEB76D.2020706@quip.cz> Date: Sun, 28 Sep 2008 00:45:01 +0200 From: Miroslav Lachman <000.fbsd@quip.cz> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.12) Gecko/20050915 X-Accept-Language: cz, cs, en, en-us MIME-Version: 1.0 To: Peter Jeremy References: <98425339-23F8-4A90-8CF1-2E85DD82D857@ish.com.au> <20080927030204.GB40195@icarus.home.lan> <48DE9411.8010002@quip.cz> <20080927214627.GQ15376@server.vk2pj.dyndns.org> In-Reply-To: <20080927214627.GQ15376@server.vk2pj.dyndns.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-stable Stable Subject: Re: sysctl maxfiles X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Sep 2008 22:44:32 -0000 Peter Jeremy wrote: > On 2008-Sep-27 22:14:09 +0200, Miroslav Lachman <000.fbsd@quip.cz> wrote: > >>root@roxy ~/# fstat -u www | wc -l >> 9931 >>root@roxy ~/# fstat -u root | wc -l >> 718 >>root@roxy ~/# fstat | grep httpd | wc -l >> 6379 >>root@roxy ~/# fstat | grep httpd | wc -l >> 6002 >>root@roxy ~/# fstat -u www | wc -l >> 4691 >>root@roxy ~/# sysctl kern.openfiles >>kern.openfiles: 846 > > > kern.openfiles reflects the total number of open file structures > within the kernel, whereas fstat (and lsof) report both open files > and vnodes associated with each process. The differences are > 1) File structures are shared via fork() etc so the same file structure > can be reported multiple times. > 2) fstat reports executable name, working directory and root > > Open files in fstat can be detected because they have numeric values > (possibly with a '*' appended) in the FD column. Unfortunately, there > doesn't appear to be any easy way to detect shared file structures > (for inode-based files) using either fstat or lsof. > > In the case of apache, there are at least 6 file structures shared > by each httpd process (and it looks like it might be about 15). Thank you for your explanation. (Jeremy Chadwick, Oliver Fromme, Peter Jeremy. Now it makes sense to me. Miroslav Lachmanx