From owner-freebsd-questions Sun Oct 22 23:29:37 2000 Delivered-To: freebsd-questions@freebsd.org Received: from soup.thpoon.com (cr103675-a.bloor1.on.wave.home.com [24.114.152.71]) by hub.freebsd.org (Postfix) with SMTP id 4DF9637B479 for ; Sun, 22 Oct 2000 23:29:34 -0700 (PDT) Received: (qmail 25829 invoked from network); 23 Oct 2000 06:29:33 -0000 Received: from unknown (HELO tea.thpoon.com) (mail@192.168.1.2) by cr103675-a.bloor1.on.wave.home.com with SMTP; 23 Oct 2000 06:29:33 -0000 Received: from antipode by tea.thpoon.com with local (Exim 3.12 #1 (Debian)) id 13nb6y-0008Fx-00 for ; Mon, 23 Oct 2000 02:29:32 -0400 To: freebsd-questions@FreeBSD.ORG Subject: Re: Too many open files in system References: <14835.26280.803484.793146@guru.mired.org> From: Arcady Genkin X-Face: 0=A/O5-+sE[Tf%X>rYr?Y5LD4,:^'jaJ!4jC&UR*ZrrK2>^`g22Qeb]!:d;}2YJ|Hq"LHdF OX`jWX|AT-WVFQ(TPhFVak)0nt$aEdlOq=1~D,:\z5QlVOrZ2(H,mKg=Xr|'VlHA="r Organization: thpoon.com Mail-Copies-To: never Date: 23 Oct 2000 02:29:32 -0400 In-Reply-To: <14835.26280.803484.793146@guru.mired.org> Message-ID: <87zojw9ik3.fsf@tea.thpoon.com> Lines: 46 User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.1 (Channel Islands) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Mike Meyer writes: > I don't have the lsof man page installed, but it may be counting every > occurence of a shared file descriptor, whereas kern.maxfiles counts > the actual open file descriptors. Try checking kern.openfiles. Indeed, Vic Abell, the author of lsof, sent me an exerpt from the lsof FAQ, which I include below for the benefit of the list. (I hope Vic doesn't mind, but since it's only a section of the FAQ...) ---------8<---------------8<------------- Lsof should not be used to calculate the maximum number of open files on a system without some careful scripting. Read the lsof FAQ file, 00FAQ, for an explanation -- 3.17 Why is `lsof | wc` bigger than my system's open file limit? There is a strong temptation to count files by piping lsof output to wc. If your purpose is to compare the number you get to some Unix system parameter that defines the number of open files your system can have, resist the temptation. One reason is that lsof reports a number of "files" that don't occupy Unix file table space -- current working directories, root directories, text files, library files, memory mapped files are some. Another reason is that lsof can report a file shared by more than one process that itself occupies only one file table slot. If you want to know the number of open files that occupy file table slots, use the +ff option and process the lsof output's FILE_ADDR column information with standard Unix tools like cut, grep, sed, and sort. You might also consider using use lsof's field output with +ff, selecting the file struct address with -FF, and processing the output with an AWK or Perl script. See the list_fields.awk and list_fields.perl scripts in the scripts/ subdirectory of the lsof distribution for hints on file struct post-processing filters. -- Arcady Genkin Don't read everything you believe. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message