Projects / lsof / Comments

RSS Comments for lsof

21 Oct 2009 11:51 gdegoulet Thumbs up

patch to see full cmdline when +c0 (lsof_4.82)

--- dialects/linux/dproc.c 2008-10-21 18:17:25.000000000 +0200
+++ dialects/linux/dproc.c.new 2009-10-21 13:48:17.000000000 +0200
@@ -166,6 +166,7 @@
static char *pidpath = (char *)NULL;
static MALLOC_S pidpathl = 0;
static MALLOC_S pidx = 0;
+ char nmabuf[MAXPATHLEN + 1], pbuf[MAXPATHLEN + 1];
static DIR *ps = (DIR *)NULL;
static char *taskpath = (char *)NULL;
static int taskpathl = 0;
@@ -278,12 +279,26 @@
*/
(void) make_proc_path(pidpath, n, &path, &pathl, "stat");
rv = read_id_stat(0, path, pid, &cmd, &ppid, &pgid);
+ /*gd: override cmd if +c0 */
+ if (CmdLim == 0)
+ {
+ (void) make_proc_path(pidpath, n, &path, &pathl, "exe");
+ if (getlinksrc(path, pbuf, sizeof(pbuf)) < 1) { /*not a link, very strange .. nothing to do*/ }
+ else { cmd=pbuf; }
+ }
+
+
+ /*restoring initial path*/
+ (void) make_proc_path(pidpath, n, &path, &pathl, "stat");
+
+
if (rv == 1)
continue;
else if (rv == 0) {
(void) process_id(pidpath, n, cmd, uid, pid, ppid, pgid);
continue;
}
+
/*
* The process is a zombie. Check for a non-zombie task.
*/

21 Oct 2009 10:17 gdegoulet Thumbs up

feature request for linux : it could be nice to see the command with its real full path.
the command is actualy grabbed from the /proc/pid/stat but you can simply do a readlink from /proc/pid/exe ?
maybe can we have an option (-C) to change the output of the command ? (need to override the CMDL from lsof.h)

Thanks

08 Jun 2009 10:31 iza_cutie

I have missed to type there the url of the article:

www.vmware.com/applian...

08 Jun 2009 10:29 iza_cutie

Hi;
I saw this article saying "lsof for version for AMD 64-bit processors with the 64-bit Solaris 10 kernel is being worked on."

I have this problem where i get this:

# lsof
lsof: FATAL: lsof was compiled for a 32 bit kernel,
but this machine has booted a 64 bit kernel.

Below is my machine info:

# isainfo
amd64 i386
# isainfo -v
64-bit amd64 applications
sse3 sse2 sse fxsr amd_3dnowx amd_3dnow amd_mmx mmx cmov amd_sysc cx8
tsc fpu
32-bit i386 applications
sse3 sse2 sse fxsr amd_3dnowx amd_3dnow amd_mmx mmx cmov amd_sysc cx8
tsc fpu
# isainfo -b
64

lsof version used: lsof_4.78.tar.gz

gcc=gcc version 3.4.4
cc=cc: Sun C 5.8 2005/10/13

Can I confirm with you if lsof_4.78 for version for AMD 64-bit processors with the 64-bit Solaris 10 kernel is not working yet too?

If the answer is no, can you suggest, what I should do to correct the error?
Thanks

13 May 2002 19:19 Raboo Thumbs up

nice work
lsof is great, thanks ;)

Keep the good work up.

24 May 2001 19:55 tenebraen

Re: downloading lsof

> The link is not broken. It appears
> broken because vic.cc.purdue.edu
> cannot Reverse-DNS your box.

For those trapped behind firewalls or who are
otherwise nameless, the FTP server at
vic.cc.purdue.edu reports that "you may be able to
get lsof from one of these mirror sites":

ftp.cerias.purdue.edu/...

ftp.cert.dfn.de/pub/to...

ftp.cetis.hvu.nl/pub/lsof

ftp.crc.doc.ca/package...

ftp.fu-berlin.de/pub/u...

ftp.sunet.se/pub/unix/...

ftp.tau.ac.il/pub/unix...

ftp.tu-darmstadt.de/pu...

ftp.tux.org/pub/sites/...

ftp.uni-mainz.de/pub/m...

ftp.web.ad.jp/pub/UNIX...

gd.tuwien.ac.at/utils/...

sunsite.ualberta.ca/pu...

the.wiretapped.net/pub...

wuarchive.wustl.edu/pa...

I successfully downloaded the 'lsof' source
from 'wuarchive.wustl.edu' and they appear to have
a good set of current binaries for the latest os
levels as well.

Although not in the suggested list, you can
also download the source (one release back) and
the Solaris binary from:

ftp.sunfreeware.com

16 Oct 2000 20:10 unixjavabob

downloading lsof
The link is not broken. It appears broken because vic.cc.purdue.edu cannot Reverse-DNS your box.

Screenshot

Project Spotlight

file

File type identification utility

Screenshot

Project Spotlight

Tcl/Tk

A portable scripting environment for Unix, Windows, and Macintosh.