From owner-freebsd-ports@FreeBSD.ORG Tue Aug 13 07:32:34 2013 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 570848AC for ; Tue, 13 Aug 2013 07:32:34 +0000 (UTC) (envelope-from matthew@freebsd.org) Received: from smtp.infracaninophile.co.uk (smtp6.infracaninophile.co.uk [IPv6:2001:8b0:151:1:3cd3:cd67:fafa:3d78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C86E72FEC for ; Tue, 13 Aug 2013 07:32:33 +0000 (UTC) Received: from rufus.webfusion.com (mail.heartinternet.co.uk [79.170.40.31]) (authenticated bits=0) by smtp.infracaninophile.co.uk (8.14.7/8.14.7) with ESMTP id r7D7WTI2099021 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO) for ; Tue, 13 Aug 2013 08:32:29 +0100 (BST) (envelope-from matthew@freebsd.org) DKIM-Filter: OpenDKIM Filter v2.8.3 smtp.infracaninophile.co.uk r7D7WTI2099021 Authentication-Results: smtp.infracaninophile.co.uk/r7D7WTI2099021; dkim=none reason="no signature"; dkim-adsp=none (unprotected policy) X-Authentication-Warning: lucid-nonsense.infracaninophile.co.uk: Host mail.heartinternet.co.uk [79.170.40.31] claimed to be rufus.webfusion.com Message-ID: <5209E10C.7060400@freebsd.org> Date: Tue, 13 Aug 2013 08:32:28 +0100 From: Matthew Seaman User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130809 Thunderbird/17.0.8 MIME-Version: 1.0 To: freebsd-ports@freebsd.org Subject: Re: List shared libraries for running processes References: <1376376258.57345.YahooMailNeo@web190702.mail.sg3.yahoo.com> In-Reply-To: <1376376258.57345.YahooMailNeo@web190702.mail.sg3.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.97.8 at lucid-nonsense.infracaninophile.co.uk X-Virus-Status: Clean X-Spam-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00, RCVD_IN_DNSWL_NONE,SPF_SOFTFAIL autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on lucid-nonsense.infracaninophile.co.uk X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Aug 2013 07:32:34 -0000 On 13/08/2013 07:44, Quark wrote: > MS Windows has a command 'tasklist' which take /m switch > > If I wanted to list all processes who have kernel32.dll loaded I had invoke > > tasklist /m kernel32.dll > > > Image Name PID Modules > ========================= ======== ============================================ > taskhost.exe 1876 kernel32.dll > dwm.exe 1664 kernel32.dll > explorer.exe 1688 kernel32.dll > hkcmd.exe 2860 kernel32.dll > igfxpers.exe 2868 kernel32.dll > TSVNCache.exe 2124 kernel32.dll > McUICnt.exe 2100 kernel32.dll > wuauclt.exe 4520 kernel32.dll > vmware-vmx.exe 3172 kernel32.dll > gvim.exe 5992 kernel32.dll > cmd.exe 3844 kernel32.dll > conhost.exe 4004 kernel32.dll > tasklist.exe 3184 kernel32.dll > > see that is pretty nice, what is option on FreeBSD? it is OK to write some script if the need be > don't want to consider lsof at the moment, if it can be achieved using fstat or something similar > if not will give lsof a shot, I have slight dislike of non-core utils. procstat -v pid should give you a list of shared libraries used by the process with that pid. procstat -va is the equivalent for every process on the system. Turning that into a nicely formatted list for all processes as you show for the Windows output above shouldn't be too hard for anyone with reasonable shell skills. Cheers, Matthew