Subject: Re: sort(1) opens too many files
To: Jeremy C. Reed <reed@reedmedia.net>
From: Dave Huang <khym@azeotrope.org>
List: current-users
Date: 04/05/2001 04:41:15
On Thu, 5 Apr 2001, Jeremy C. Reed wrote:
> Couldn't 190 file descriptors already be in use (by something else) and
> maybe the sort is only using around five?

It's a per-process limit... file descriptors used by other processes in
the system wouldn't count towards the limit.

> (How can it be checked?)

ktrace, fstat, debugging printfs... I tried 'em all :) Here's what fstat
says:

yerfable ~> sort /usr/share/dict/words > /dev/null
[I wait a second or two, then ^Z]
Suspended
yerfable ~> jobs -l
[1]  + 14955 Suspended                     sort /usr/share/dict/words >
/dev/null
yerfable ~> fstat -p 14955
USER     CMD          PID   FD MOUNT      INUM MODE         SZ|DV R/W
khym     sort       14955   wd /usr2    2088992 drwxr-xr-x   16896 r
khym     sort       14955    0 /          6040 crw--w----   ttyp6 rw
khym     sort       14955    1 /          5957 crw-rw-rw-    null w
khym     sort       14955    2 /          6040 crw--w----   ttyp6 rw
khym     sort       14955    3 /usr     294350 -rw-------   31041 rw
khym     sort       14955    4 /usr     293786 -rw-------   59525 rw
khym     sort       14955    5 /usr     293788 -rw-------   59331 rw
khym     sort       14955    6 /usr     293789 -rw-------   59562 rw
[ about 100 lines deleted ]
khym     sort       14951  110 /usr     294348 -rw-------   59413 rw
khym     sort       14951  111 /usr     294349 -rw-------   59173 rw
khym     sort       14951  112 /usr     294351 -rw-------   57344 rw

> (Also what shell has a limit resource called "descriptors"? Is this the
> same as "openfiles"?)

tcsh... yeah, it's the same as csh's openfiles. And I don't know why
tcsh doesn't use the same name for it as csh :)
-- 
Name: Dave Huang         |  Mammal, mammal / their names are called /
INet: khym@azeotrope.org |  they raise a paw / the bat, the cat /
FurryMUCK: Dahan         |  dolphin and dog / koala bear and hog -- TMBG
Dahan: Hani G Y+C 25 Y++ L+++ W- C++ T++ A+ E+ S++ V++ F- Q+++ P+ B+ PA+ PL++