Browse Source

Apply patch from Johan Walles to treat all mapped files as recently used.

suites/ascii
Bill Allombert 15 years ago
parent
commit
71ff6110d1
  1. 4
      debian/changelog
  2. 33
      popularity-contest

4
debian/changelog

@ -14,8 +14,10 @@ popularity-contest (1.43) UNRELEASED; urgency=low
- add -s /bin/sh in case nobody has no shell. Closes: #429405, #431867.
* cron.weekly, default.conf, FAQ:
- Add support for HTTP_PROXY. Closes: #365681.
* Apply patch from Johan Walles to treat all mapped files as recently used
(which they obviously are). Closes: #457441, #327693.
-- Bill Allombert <ballombe@debian.org> Fri, 30 Nov 2007 11:33:58 +0100
-- Bill Allombert <ballombe@debian.org> Tue, 08 Jan 2008 19:40:31 +0100
popularity-contest (1.42) unstable; urgency=low

33
popularity-contest

@ -70,8 +70,29 @@ my $lastmonth = $now - $monthlen;
my %popcon=();
#Read dpkg database of installed packages
# List all mapped files
my %mapped;
if (opendir(PROC, "/proc"))
{
my @procfiles = readdir(PROC);
closedir(PROC);
foreach (@procfiles)
{
-d "/proc/$_" or next;
m{^[0-9]+$} or next;
open MAPS, "/proc/$_/maps" or next;
while (<MAPS>)
{
m{(/.*)} or next;
$mapped{$1} = 1;
}
close MAPS;
}
}
# Read dpkg database of installed packages
open PACKAGES, "dpkg-query --show --showformat='\${status} \${package}\\n'|";
while (<PACKAGES>)
{
@ -83,11 +104,17 @@ while (<PACKAGES>)
while (<FILES>)
{
chop;
m{/bin/|/sbin/|^/usr/games/|\.[ah]$|\.pm$|\.php$|^/boot/System\.map-} or next;
-f $_ or next;
m{/bin/|/sbin/|^/usr/games/|\.[ah]$|\.pm$|\.php$|^/boot/System\.map-}
|| -f $_
|| defined $mapped{$_}
|| next;
my($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks)
= stat;
if (defined $mapped{$_}) {
# It's currently being accessed by a process
$atime = time();
}
print STDERR if (!defined($atime));
if (!defined($bestatime) || $atime >= $bestatime)
{

Loading…
Cancel
Save