No subject


Fri Jan 31 06:23:24 EST 2014


>From suter  Fri Nov 16 17:21:23 2001
Return-Path: <majordom at caliburn.humbug.org.au>
Received: from diadora.client.uq.net.au (IDENT:root at diadora-2 [10.0.1.2])
	by zwitterion.humbug.org.au (8.12.1/8.12.1/Debian -2) with ESMTP id fAG7LMas028030
	for <suter at zwitterion.humbug.org.au>; Fri, 16 Nov 2001 17:21:23 +1000
Received: from caliburn (mail at caliburn.humbug.org.au [203.15.51.6])
	by diadora.client.uq.net.au (8.12.1/8.12.1/Debian -2) with ESMTP id fAG7LOtQ017960
	for <suter at zwitterion.humbug.org.au>; Fri, 16 Nov 2001 17:21:24 +1000
Received: from majordom by caliburn with local (Exim 3.12 #1 (Debian))
	id 164cze-0002Uz-00
	for <general-outgoing at lists.humbug.org.au>; Fri, 16 Nov 2001 17:00:54 +1000
Received: from fox.uq.net.au ([203.101.255.1] helo=uq.net.au)
	by caliburn with esmtp (Exim 3.12 #1 (Debian))
	id 164czb-0002Up-00
	for <general at lists.humbug.org.au>; Fri, 16 Nov 2001 17:00:51 +1000
Received: from freezer.home (mail at d-15-99.stlucia.uq.net.au [203.100.15.99])
	by uq.net.au (8.9.3/8.9.3) with ESMTP id RAA16891
	for <general at lists.humbug.org.au>; Fri, 16 Nov 2001 17:00:11 +1000 (GMT+1000)
Received: from henry by freezer.home with local (Exim 3.32 #1 (Debian))
	id 164cyt-0008LH-00; Fri, 16 Nov 2001 17:00:07 +1000
To: general at lists.humbug.org.au
Subject: [H-GEN] Fun One-Liner
From: Jason Henry Parker <jasonp at uq.net.au>
Date: 16 Nov 2001 17:00:07 +1000
Message-ID: <87elmzw688.fsf at freezer.home>
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Precedence: bulk
Reply-To: general at lists.humbug.org.au
X-Loop: general at lists.humbug.org.au
List-Help: <mailto:majordomo at lists.humbug.org.au?subject=help>
List-Post: <mailto:general at lists.humbug.org.au>
List-Subscribe: <mailto: general-request at lists.humbug.org.au?subject=subscribe>
List-Id: semi-serious discussions about Humbug and Unix-related topics <general at lists.humbug.org.au>
List-Unsubscribe: <mailto: general-request at lists.humbug.org.au?subject=unsubscribe>
List-Archive: <http://archive.humbug.org.au/humbug-general/>
Sender: Majordomo <majordom at caliburn.humbug.org.au>
Status: RO
Content-Length: 1684
Lines: 32

[ Humbug *General* list - semi-serious discussions about Humbug and  ]
[ Unix-related topics.  Please observe the list's charter.           ]
[ Worthwhile understanding: http://www.humbug.org.au/netiquette.html ]

(Warning:  gratuitous Linux-isms follow.)

I wrote this short one-liner to find files holding references to
upgraded libraries, since these processes keep the deleted file's link
count above zero, stopping its blocks from being freed (eg libc is
upgraded, and sshd, which is linked against it, keeps a reference to a
temporary file created during the upgrade, which continues to use disk
space on a starved root filesystem)[1].

grep -l 'deleted)$' /proc/*/maps |
  perl -F/ -lane'$pids{$F[2]}++
    }{
    @procs=`ps awwux`; chomp at procs;
    map {
      $l=undef;
      (undef,$l) = split /\s+/, $_;
      if(defined$pids{$l}){print}
    } @procs'

Before anyone puts up a cry of `line-noise Perl!', I humbly submit
that naysayers should either suggest an improvement, or encourage me
to dissect and explain the script at the net meeting.

jason

[1] : I thought I remembered an option to fuser or lsof that did this,
      but for the life of me, I couldn't find it, so here I am.
-- 
||----|---|------------|--|-------|------|-----------|-#---|-|--|------||
| The Proud Tower, Barbara Tuchman            http://linux.org.au/conf/ |
| A History of Mathematics, Carl B. Boyer              jasonp at uq.net.au |
||--|--------|--------------|----|-------------|------|---------|-----|-|

--
* This is list (humbug) general handled by majordomo at lists.humbug.org.au .
* Postings to this list are only accepted from subscribed addresses of
* lists 'general' or 'general-post'.



More information about the General mailing list