3 # Open in their package.
9 # But only this sub name is visible to them.
15 if (!$isopen{$file}) {
16 if (++$numopen > $maxopen) {
17 local(@lru) = sort {$isopen{$a} <=> $isopen{$b};} keys(%isopen);
18 splice(@lru, $maxopen / 3);
20 for (@lru) { close $_; delete $isopen{$_}; }
22 &open($file, ($saw{$file}++ ? '>>' : '>') . $file)
23 || die "Can't create $file: $!\n";
25 $isopen{$file} = ++$seq;
33 if (open(PARAM,'/usr/include/sys/param.h')) {
36 $maxopen = $1 - 4 if /^\s*#\s*define\s+NOFILE\s+(\d+)/;
40 $maxopen = 16 unless $maxopen;