Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Aug 2013 08:32:28 +0100
From:      Matthew Seaman <matthew@freebsd.org>
To:        freebsd-ports@freebsd.org
Subject:   Re: List shared libraries for running processes
Message-ID:  <5209E10C.7060400@freebsd.org>
In-Reply-To: <1376376258.57345.YahooMailNeo@web190702.mail.sg3.yahoo.com>
References:  <1376376258.57345.YahooMailNeo@web190702.mail.sg3.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5209E10C.7060400>