Debian Codegraph @

00FAQ

raw
1
2 Frequently Asked Questions about lsof
3
4 **********************************************************************
5 | The latest release of lsof is always available via anonymous ftp |
6 | from lsof.itap.purdue.edu. Look in pub/lsof.README for its |
7 | location. |
8 **********************************************************************
9
10 ______________________________________________________________________
11
12 This file contains frequently asked questions about lsof and answers
13 to them.
14
15 Vic Abell <[email protected]>
16 October 13, 2014
17 ______________________________________________________________________
18
19 Table of Contents:
20
21 1.0 General Concepts
22 1.1 Lsof -- what is it?
23 1.2 Where do I get lsof?
24 1.2.1 Are there mirror sites?
25 1.2.2 Are lsof executables available?
26 1.2.3 How do I check the validity of an lsof distribution?
27 1.2.4 Why can't I get the sum(1) result reported in
28 README.lsof_<revision>?
29 1.2.5 Why won't gpg accept the lsof-signing PGP public key?
30 1.3 Where can I get more lsof documentation?
31 1.4 How do I report an lsof bug?
32 1.5 Where can I get the lsof FAQ?
33 1.5.1 How timely is the on-line FAQ?
34 1.6 Is there a test suite?
35 1.7 Is lsof vulnerable to the standard I/O descriptor attack?
36 1.8 Can I alter lsof's make(1) behavior?
37 1.9 Is there an lsof license?
38 1.10 Language locale support
39 1.10.1 Does lsof support language locales? How do I use the support?
40 1.10.2 Does lsof support wide characters in language locales?
41 1.11 Are any files in the lsof distribution copyrighted?
42 1.12 Are there other lsof-related resources?
43 1.13 What does the "WARNING: unsupported dialect or version" mean?
44
45 2.0 Lsof Ports
46 2.1 What ports exist?
47 2.2 What about a new port?
48 2.2.1 User-contributed Ports
49 2.3 Why isn't there an AT&T SVR4 port?
50 2.4 Why isn't there an SGI IRIX port?
51 2.5 Why does lsof's Configure script report "WARNING: unsupported
52 dialect or version"?
53
54 3.0 Lsof Problems
55 3.1 Configuration Problems
56 3.1.1 Why can't Configure determine the UNIX dialect version?
57 3.2 Compilation Problems
58 3.2.1 Why does the compiler complain about missing header files?
59 3.2.2 Why does gcc complain about the contents of header files
60 distributed by the system's vendor?
61 3.2.3 Other header file problems
62 3.3 Why doesn't lsof report full path names?
63 3.3.1 Why do lsof -r reports show different path names?
64 3.3.2 Why does lsof report the wrong path names?
65 3.3.3 Why doesn't lsof report path names for unlinked (rm'd) files?
66 3.3.4 Why doesn't lsof report the "correct" hard linked file path
67 name?
68 3.3.5 When will lsof report path names for deleted files?
69 3.4 Why is lsof so slow?
70 3.5 Why doesn't lsof's setgid or setuid permission work?
71 3.6 Does lsof have security problems?
72 3.7 Will lsof show remote hosts using files via NFS?
73 3.8 Why doesn't lsof report locks held on NFS files?
74 3.8.1 Why does lsof report a one byte lock on byte zero as a full
75 file lock?
76 3.9 Why does lsof report different values for open files on the
77 same file system (the automounter phenomenon)?
78 3.10 Why don't lsof and netstat output match?
79 3.10.1 Why can't lsof find accesses to some TCP and UDP ports?
80 3.11 Why does lsof update the device cache file?
81 3.12 Why doesn't lsof report state for UDP socket files?
82 3.13 I am editing a file with vi; why doesn't lsof find the file?
83 3.14 Why doesn't lsof report TCP/TPI window and queue sizes for my
84 dialect?
85 3.14.1 Why doesn't lsof report socket options, socket states, and TCP
86 flags and values for my dialect?
87 3.14.2 Why doesn't lsof report the partial listen queue connection
88 count for my dialect?
89 3.15 What does "no more information" in the NAME column mean?
90 3.16 Why doesn't lsof find a process that ps finds?
91 3.17 Why doesn't -V report a search failure?
92 3.18 Portmap problems
93 3.18.1 Why isn't a name displayed for the portmap registration?
94 3.18.2 How can I display only portmap registrations?
95 3.18.3 Why doesn't lsof report portmap registrations for some ports?
96 3.18.4 Why doesn't lsof report portmap registrations for some Solaris
97 versions?
98 3.19 Why is `lsof | wc` bigger than my system's open file limit?
99 3.20 Why doesn't lsof report file offset (position)?
100 3.20.1 What does lsof report for size when the file doesn't really have
101 one?
102 3.21 Problems with path name arguments
103 3.21.1 How do I ask lsof to search a file system?
104 3.21.2 Why doesn't lsof find all the open files in a file system?
105 3.21.3 Why does the lsof exit code report it didn't find open files
106 when some files were listed?
107 3.21.4 Why won't lsof find all the open files in a directory?
108 3.21.5 Why are the +D and +d options so slow?
109 3.21.6 Why do the +D and +d options produce warning messages?
110 3.22 Why can't my C compiler find the rpcent structure definition?
111 3.23 Why doesn't lsof report fully on file "foo" on UNIX dialect
112 "bar?"
113 3.24 Why do I get a complaint when I execute lsof that some library
114 file can't be found?
115 3.25 Why does lsof complain it can't open files?
116 3.26 Why does lsof warn "compiled for x ... y; this is z."?
117 3.27 How can I disable the kernel identity check?
118 3.28 Why don't ps(1) and lsof agree on the owner of a process?
119 3.29 Why doesn't lsof find an open socket file whose connection
120 state is past CLOSE_WAIT?
121 3.30 Why don't machine.h definitions work when the surrounding
122 comments are removed?
123 3.31 What do "can't read inpcb at 0x...", "no protocol control
124 block", "no PCB, CANTSENDMORE, CANTRCVMORE", etc. mean?
125 3.32 What do the "unknown file system type" warnings mean?
126 3.33 Installation
127 3.33.1 How do I install lsof?
128 3.33.2 How do I install a common lsof when I have machines that
129 need differently constructed lsof binaries?
130 3.34 Why do lsof 4.53 and above reject device cache files built
131 by earlier lsof revisions?
132 3.35 What do "like block special" and "like character special" mean
133 in the NAME column?
134 3.36 Why does an lsof make fail because of undefined symbols?
135 3.37 Command Regular Expressions (REs)
136 3.37.1 What are basic and extended regular expressions?
137 3.37.2 Why can't I put a slash in a command regular expression?
138 3.37.3 Why does lsof say my command regular expression wasn't found?
139 3.38 Why doesn't lsof report on shared memory segments?
140 3.39 Why does lsof report two instances of itself?
141 3.40 Why does lsof report '\n' in device cache file error messages?
142 3.41 Kernel Symbol and Address Problems
143 3.41.1 What does "lsof: WARNING: name cache hash size length error: 0"
144 mean?
145 3.41.2 Why does lsof produce "garbage" output?
146 3.42 Why does lsof report open files when run as super user that
147 it doesn't report when run with lesser privileges?
148 3.43 Test Suite Problems
149 3.43.1 Errors all tests can report:
150 3.43.1.1 Why do tests complain "ERROR!!! can't execute ../lsof"?
151 3.43.1.2 Why do tests complain "ERROR!!! can't find ..." a file?
152 3.43.1.3 Why do some tests fail to compile?
153 3.43.1.4 Why do some tests always fail?
154 3.43.1.5 Why does the test suite say it hasn't been validated on
155 my dialect?
156 3.43.1.6 Why do the tests complain they can't stat() or open()
157 /dev/mem or /dev/kmem?
158 3.43.2 LTbigf test issues
159 3.43.2.1 Why does the LTbigf test say that the dialect doesn't
160 support large files?
161 3.43.2.2 Why does LTbigf complain about operations on its config.LTbigf*
162 file?
163 3.43.2.3 Why does LTbigf warn that lsof doesn't return file offsets?
164 3.43.3 Why does the LTbasic test complain "ERROR!!! lsof this ..."
165 and "ERROR!!! lsof that ..."?
166 3.43.4 LTnfs test issues
167 3.43.4.1 Why does the LTnfs test complain "couldn't find NFS file ..."?
168 3.43.5 LTnlink test issues
169 3.43.5.1 Why does the LTnlink test complain that its test file is on
170 an NFS file system?
171 3.43.5.2 Why does LTnlink delay and report "waiting for link count
172 update: ..."?
173 3.43.5.3 Why does LTnlink fail because of an unlink error?
174 3.43.6 LTdnlc test issues
175 3.43.6.1 Why won't the LTdnlc test run?
176 3.43.6.2 What does the LTdnlc test mean by "... <path> found: 100.00%"?
177 3.43.6.3 Why does the DNLC test fail?
178 3.43.7 Why hasn't the test suite been qualified for 64 bit HP-UX
179 11 when lsof is compiled with gcc?
180 3.43.8 LTszoff test issues
181 3.43.8.1 Why does LTszoff warn that lsof doesn't return file offsets?
182 3.43.9 LTlock test issues
183 3.44 File descriptor list (the ``-d'' option) problems
184 3.44.1 Why does lsof reject a ``-d'' FD list?
185 3.44.2 Why are file descriptors other than those in my FD list
186 reported?
187 3.45 How can I supply device numbers for inaccessible NFS file
188 systems?
189 3.46 Why won't lsof find open files on over-mounted file systems?
190 3.47 What can be done when lsof reports no more space?
191 3.48 What if the lsof build encounters ar and ld problems?
192 3.49 Why does lsof -i report an open socket file for a process, but
193 lsof -p on that process' ID report nothing?
194
195 4.0 AIX Problems
196 4.1 What is the Stale Segment ID bug and why is -X needed?
197 4.1.1 Stale Segment ID APAR
198 4.2 Gcc Work-around for AIX 4.1x
199 4.3 Gcc and AIX 4.2
200 4.4 Why won't lsof's Configure allow the use of gcc for AIX
201 below 4.1?
202 4.5 What is an AIX SMT file type?
203 4.6 Why does AIX lsof start so slowly?
204 4.7 Why does exec complain it can't find libc.a[shr.o]?
205 4.8 What does lsof mean when it says, "TCP no PCB, CANTSENDMORE,
206 CANTRCVMORE" in a socket file's NAME column?
207 4.9 When the -X option is used on AIX 4.3.3, why does lsof disable
208 it, saying "WARNING: user struct mismatch; -X option disabled?"
209 4.10 Why doesn't the -X option work on my AIX 5L or 5.[123] system?
210 4.11 Why doesn't /usr/bin/oslevel report the correct AIX version?
211 4.11.1 Why doesn't /usr/bin/oslevel report the correct AIX version
212 on AIX 5.1?
213 4.12 Why does lsof for AIX 5.1 or above Power architecture
214 complain about kernel bit size?
215 4.13 What can't gcc be used to compile lsof on the ia64 architecture
216 for AIX 5 and above?
217 4.14 Why does lsof get a segmentation fault when compiled with gcc
218 for a 64 bit Power architecture AIX 5.1 kernel?
219 4.15 Why does lsof ignore AFS on my AIX system?
220 4.16 Why does lsof report "system paging space is low" and exit?
221 4.17 Why does lsof have compilation and execution problems on AIX
222 5.3 above maintenance level 1?
223
224 5.0 Apple Darwin Problems
225 5.1 What do /dev/kmem-based and libproc-based mean?
226 5.2 /dev/kmem-based Apple Darwin Questions
227 5.2.1 Why does Configure ask for a path to the Darwin XNU kernel
228 header files?
229 5.2.1.1 Why does Configure complain that Darwin XNU kernel header
230 files are missing?
231 5.2.2 Why doesn't Apple Darwin lsof report text file information?
232 5.2.3 Why doesn't Apple Darwin lsof support IPv6?
233 5.2.4 Why does lsof complain about a mismatch between the release
234 for which lsof was compiled and the booted Mac OS X release?
235 5.2.5 Why does lsof for Apple Darwin 8 and higher report
236 "stat(...): ..." in the NAME column?
237 5.2.6 What are the limitations of Apple Darwin lsof link count
238 reporting?
239 5.2.7 Why does Apple Darwin report process group IDs incorrectly?"ayy
240 5.3 Libproc-based Apple Darwin Questions
241
242 6.0 BSD/OS BSDI Problems
243 6.0.5 Statement of deprecation
244
245 8.0 FreeBSD Problems
246 8.1 Why doesn't lsof report on open kernfs files?
247 8.2 Why doesn't lsof work on my FreeBSD system?
248 8.3 Why doesn't lsof work on the RELEASE version of CURRENT?
249 8.4 Why can't kvm_open() can't find some file?
250 8.5 FreeBSD ZFS Problems
251 8.5.1 Why does FreeBSD lsof report "WARNING: no ZFS support has been
252 8.6 Why can't Configure create lsof_owner.h for FreeBSD 6 and above?
253 8.6.1 Why are there lockf structure compiler errors for FreeBSD 6.0
254 and higher lsof?
255 8.6.2 Why don't /usr/src/sys/sys/lockf.h and /usr/include/sys/lockf.h
256 match?
257 8.7 FreeBSD and clang
258 8.7.1 Why does clang complain about VOP_FSYNC?
259
260 9.0 HP-UX Problems
261 9.1 What do /dev/kmem-based and PSTAT-based mean?
262 9.2 /dev/kmem-based HP-UX lsof Questions
263 9.2.1 Why doesn't a /dev/kmem-based HP-UX lsof compilation use -O?
264 9.2.2 Why doesn't the /dev/kmem-based CCITT support work under 10.x?
265 9.2.3 Why can't /dev/kmem-based lsof be compiled with `cc -Aa` or
266 `gcc -ansi` under HP-UX 10.x?
267 9.2.4 Why does /dev/kmem-based lsof complain about no C compiler?
268 9.2.5 Why does Configure complain about q4 for /dev/kmem-based lsof
269 for HP-UX 11?
270 9.2.6 When compiling /dev/kmem-based lsof for HP-UX 11 what do the
271 "aCC runtime: ERROR..." messages mean?
272 9.2.7 Why doesn't /dev/kmem-based lsof for HP-UX 11 report VxFS file
273 link counts, node numbers, and sizes correctly?
274 9.2.8 Why can't /dev/kmem-based lsof be built with gcc for 64 bit
275 HP-UX 11?
276 9.2.8.1 How can I acquire a gcc for building lsof for 64 bit HP-UX 11?
277 9.2.9 Why does /dev/kmem-based lsof for HP-UX 11 report "unknown file
278 system type" for VxFS files?
279 9.2.10 Why does the ANSI-C compiler complain about comments in HP-UX
280 11 header files?
281 9.2.11 Why does dnode1.c cause the HP-UX 11 compiler to complain that
282 <sys/fs/vx_inode.h> is missing or incorrect?
283 9.3 PSTAT-based HP-UX lsof Questions
284 9.3.1 Why does PSTAT-based lsof complain about pst_static and
285 other PSTAT structures?
286 9.3.2 Why does PSTAT-based lsof complain it can't read pst_*
287 structures?
288 9.3.3 Why does PSTAT-based lsof rebuild the device cache file
289 after each reboot?
290 9.3.4 Why doesn't PSTAT-based lsof report TCP addresses for
291 telnetd's open socket files?
292 9.3.5 Why does PSTAT-based lsof cause an HP-UX 11.11 kernel panic?
293 9.3.6 Why doesn't PSTAT-based lsof report a CWD that is on a loopback
294 (LOFS) file system?
295 9.3.7 Why do some swinstall packages for PSTAT-based HP-UX 11.11
296 packages complain about setgid and setuid bits?
297 9.3.8 Why won't the bundled C compiler build PSTAT-based lsof for
298 PA-RISC HP-UX 11.23?
299 9.3.9 Why won't gcc build PSTAT-based lsof for PA-RISC HP-UX 11.23?
300 9.3.10 Why does PSTAT-based lsof complain, "FATAL: pst_stream_size
301 should be: 672; is 72" on HP-UX 11.11 and above?
302 9.4 Why won't the HP-UX depot install?
303
304 10.0 Linux Problems
305 10.1 What do /dev/kmem-based and /proc-based lsof mean?
306 10.2 /proc-based Linux lsof Questions
307 10.2.1 Why doesn't /proc-based lsof report file offsets (positions)?
308 10.2.2 Why does /proc-based lsof report "can't identify protocol" for
309 some socket files?
310 10.2.3 Why does /proc-based lsof warn about unsupported formats?
311 10.2.4 Why does /proc-based lsof report "(deleted)" after a path name?
312 10.2.5 Why doesn't /proc-based lsof report full open file information
313 for all processes?
314 10.2.6 Why won't Customize offer to change HASDCACHE or WARNDEVACCESS
315 for /proc-based lsof?
316 10.2.7 /proc-based lsof Linux NFS questions
317 10.2.7.1 Why can't lsof find files on an accessible NFS file system?
318 10.2.7.2 Why can't lsof find files on an inaccessible NFS file system?
319 10.2.8 Why doesn't /proc-based Linux lsof report socket options and
320 values, socket state flags, and TCP options and values?
321 10.2.9 Does /proc-based Linux lsof use a device cache?
322 10.2.10 Why doesn't /proc-based Linux lsof report any or all file structure
323 values for its +fcfgGn option?
324 10.3 Special Linux file types
325 10.3.1 Why is ``DEL'' reported as a Linux file type?
326 10.3.2 Why is ``unknown'' reported as a Linux file type?
327 10.4 Linux ``mem'' Entry Problems
328 10.4.1 What do ``path dev=xxx'' and ``path inode=yyy'' mean in the
329 NAME column of Linux ``mem'' file types?
330 10.4.2 Why is neither link count nor size reported for some Linux
331 ``DEL'' and ``mem'' file types?
332 10.5 Special Linux NAME column messages
333 10.5.1 What does ``(stat: xxx)'' mean in the NAME column of Linux
334 files?
335 10.5.2 What does ``(readlink: xxx)'' mean in the NAME column of
336 Linux files?
337 10.6 Why is ``NOFD'' reported as a Linux file type?
338 10.7 Why does Linux lsof report a NAME column value that begins with
339 ``/proc''?
340 10.8 Linux /proc/net/tcp* and /proc/net/udp* issues
341 10.8.1 Why use the Linux -X option?
342 10.8.2 Why does lsof say ``-i is useless when -X is specified''?
343 10.8.3 Why does lsof say ``can't identify protocol (-X specified)''?
344
345 11.0 NetBSD Problems
346 11.1 Why doesn't lsof report on open kernfs files?
347 11.2 Why doesn't lsof report on open files on: file descriptor
348 file systems; /proc file systems; 9660 (CD-ROM) file systems;
349 MS-DOS (floppy disk) file systems; or kernel file systems?
350 11.3 Why does lsof produce confusing results for nullfs file
351 systems?
352 11.4 NetBSD header file problems
353 11.4.1 Why can't the compiler find some NetBSD header files?
354 11.4.2 Why does NetBSD lsof produce incorrect output?
355 11.5 Why isn't lsof feature xxx enabled for NetBSD?
356
357 13.0 OpenBSD Problems
358 13.1 Why doesn't lsof support kernfs on my OpenBSD system?
359 13.2 Will lsof work on OpenBSD on non-x86-based architectures?
360 13.3 <sys/pipe.h> problems
361 13.3.1 Why does the compiler claim nbpg isn't defined?
362 13.3.2 What value should I assign to nbpg?
363 13.4 Why doesn't lsof report on open MS-DOS file system (floppy
364 disk) files?
365 13.5 Why isn't lsof feature xxx enabled for OpenBSD?
366
367 14.0 Output problems
368 14.1 Why do the lsof column sizes change?
369 14.2 Why does the offset have ``0t' and ``0x'' prefixes?
370 14.3 What are the values printed in the FILE_FLAG column
371 and why is 0x<value> sometimes included?
372 14.3.1 Why doesn't lsof display FILE_FLAG values for my dialect?
373 14.4 Network Addresses
374 14.4.1 Why does lsof's -n option cause IPv4 addresses, mapped to
375 IPv6, to be displayed in IPv6 notation?
376 14.5 Why does lsof output \x, ^x, or \xnn for characters
377 sometimes?
378 14.5.1 Why is space considered a non-printable character in command
379 names?
380 14.6 Why doesn't lsof print all the characters of a command name?
381 14.7 Why does lsof reject some -c command names, saying their lengths
382 are "> what system provides (nn)"?
383 14.8 Why does lsof sometimes print TYPE numbers instead of names?
384 14.9 Marker line format problems
385 14.9.1 Why won't lsof accept a marker line format?
386 14.9.2 Why does lsof reject the NL (%n) marker line format?
387 14.10 How are protocol state name exclusion and inclusion used?
388 14.10.1 Why doesn't my dialect support state name exclusion and inclusion?
389
390 15.0 Pyramid Version Problems
391 15.0.5 Statement of deprecation
392
393 16.0 SCO Problems
394 16.1 SCO OpenServer Problems
395 16.1.1 How can I avoid segmentation faults when compiling lsof?
396 16.1.2 Where is libsocket.a?
397 16.1.3 Why do I get "warning C4200" messages when I compile lsof?
398 16.2 SCO|Caldera UnixWare Problems
399 16.2.1 Why doesn't lsof compile on my UnixWare 7.1.1 or above
400 system?
401 16.2.2 Why does lsof complain about node_self() on my UnixWare
402 7.1.1 or above system?
403 16.2.3 Why does UnixWare 7.1.1 or above complain about -lcluster,
404 node_self(), or libcluster.so?
405 16.2.4 Why does UnixWare 7.1.1 or above lsof complain it can't
406 read the kernel name list?
407 16.2.5 Why doesn't lsof report link count, node number, and size
408 for some UnixWare 7.1.1 or above CFS files?
409 16.2.6 Why doesn't lsof report open files on all UnixWare 7.1.1
410 NonStop Cluster (NSC) nodes?
411 16.2.7 Why doesn't lsof report the UnixWare 7.1.1 NonStop Cluster
412 (NSC) node a process is using?
413 16.2.8 Why does the compiler complain about missing UnixWare 2.1[.x]
414 header files?
415
416 17.0 Sun Problems
417 17.0.5 Statement of deprecation
418 17.1 My Sun gcc-compiled lsof doesn't work -- why?
419 17.2 How can I make lsof compile with gcc under Solaris 2.[456],
420 2.5.1, 7, 8 or 9?
421 17.3 Why does Solaris Sun C complain about system header files?
422 17.4 Why doesn't lsof work under my Solaris 2.4 system?
423 17.5 Where are the Solaris header files?
424 17.6 Where is the Solaris /usr/src/uts/<architecture>/sys/machparam.h?
425 17.7 Why does Solaris lsof say ``can't read proc table''?
426 17.8 Why does Solaris lsof complain about a bad cached clone device?
427 17.9 Why doesn't Solaris make generate .o files?
428 17.10 Why does lsof report some Solaris 2.3 and 2.4 lock types as `N'?
429 17.11 Why does lsof Configure say "WARNING: no cc in ..."?
430 17.12 Solaris 7, 8 and 9 Problems
431 17.12.1 Why does lsof say the compiler isn't adequate for Solaris
432 7, 8 or 9?
433 17.12.2 Why does Solaris 7, 8 or 9 lsof say "FATAL: lsof was compiled
434 for..."?
435 17.12.3 How do I build lsof for a 64 bit Solaris kernel under a 32
436 bit Solaris kernel?
437 17.12.4 How do I install lsof for Solaris 7, 8 or 9?
438 17.12.5 Why does my Solaris 7, 8 or 9 system say it cannot execute
439 lsof?
440 17.12.6 What gcc will produce 64 bit Solaris 7, 8 and 9 executables?
441 17.12.7 Why does lsof on my Solaris 7, 8 or 9 system say, "can't
442 read namelist from /dev/ksyms?"
443 17.13 Solaris and COMMON
444 17.13.1 What does COMMON mean in the NAME column for a Solaris VCHR
445 file?
446 17.13.2 Why does a COMMON Solaris VCHR file sometimes seem to have an
447 incorrect minor device number?
448 17.14 Why don't lsof and Solaris pfiles reports always match?
449 17.15 Why does lsof say, "kvm_open(namelist=default, core=default):
450 Permission denied?"
451 17.16 Why is lsof slow on my busy Solaris UFS file system?
452 17.17 Why is lsof so slow on my Solaris 8 or 9 system?
453 17.18 Solaris and VxFS
454 17.18.1 Why doesn't lsof support VxFS 3.4 on Solaris 2.6, and above?
455 17.18.2 Why does lsof report "vx_inode: vxfsu_get_ioffsets error"
456 for open Solaris 2.6 and above VxFS 3.4 and above files?
457 17.18.3 Why does Solaris Configure claim there is no VxFS library?
458 17.18.4 Why doesn't Solaris lsof report VxFS path name components?
459 17.18.5 Why does Solaris 10 lsof report scrambled VxFS paths?
460 17.19 Large file problems
461 17.19.1 Why does lsof complain it can't stat(2) a Solaris 2.5.1
462 large file?
463 17.20 Why does lsof get a segmentation fault on 64 bit Solaris
464 8 using NIS+?
465 17.21 Will lsof crash the Solaris kernel?
466 17.22 Why does lsof on Solaris 7, 8, or 9 report a kvm_open()
467 failure?
468 17.23 Solaris and SAM-FS
469 17.23.1 Why does Solaris lsof report "(limited SAM-FS info)"?
470 17.23.2 Why can't lsof locate named SAM-FS files?
471 17.24 Lsof and Solaris 10 zones
472 17.24.1 How can I make lsof list the Solaris zone?
473 17.24.2 Why doesn't lsof work in a Solaris 10 zone?
474 17.24.3 Why does lsof complain it can't stat() Solaris 10 zone file
475 systems?
476 17.25 Solaris 10 problems
477 17.25.1 Why does Solaris 10 lsof sometimes report the wrong path name?
478 17.25.2 Why does Solaris 10 lsof sometimes report only the mounted-on
479 directory and device?
480 17.25.3 What does "(deleted)" mean in the NAME column of a Solaris 10
481 open file?
482 17.25.4 What does "(?)" mean in the NAME column of a Solaris 10 open
483 file?
484 17.26 Solaris contract file problems
485 17.26.1 Why doesn't lsof report size, link count and node number for
486 Solaris 10 contract files?
487 17.26.2 Why can't lsof locate a Solaris 10 contract file by path name?
488 17.27 Solaris 10 and above ZFS problems
489 17.27.1 Why does Configure warn that ZFS support is not enabled?
490 17.28 Problems with Solaris 9 and above
491 17.28.1 Why does the compiler complain about lgrp_root on Solaris 9
492 and above?
493
494 18.0 Lsof Features
495 18.1 Why doesn't lsof doesn't report on /proc entries on my
496 system?
497 18.2 How do I disable the device cache file feature or alter
498 its behavior?
499 18.2.1 What's the risk with a perverted device cache file?
500 18.2.2 How do I put the full host name in a personal device cache file
501 path?
502 18.2.3 How do I put the personal device cache file in /tmp?
503 18.3 Why doesn't lsof know about AFS files on my favorite dialect?
504 18.3.1 Why doesn't lsof report node numbers for all AFS volume files,
505 or how do I reveal dynamic module addresses to lsof?
506 ______________________________________________________________________
507
508
509 1.0 General Concepts
510
511 1.1 Lsof -- what is it?
512
513 Lsof is a UNIX-specific tool. Its name stands for LiSt
514 Open Files, and it does just that. It lists information
515 about files that are open by the processes running on a
516 UNIX system.
517
518 See the lsof man page, the 00DIST file, the 00QUICKSTART
519 file, and the 00README file of the lsof distribution for
520 more information.
521
522 1.2 Where do I get lsof?
523
524 Lsof is available via anonymous ftp from lsof.itap.purdue.edu.
525 Look in the pub/tools/unix/lsof sub-directory.
526
527 ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof
528
529 Bzip2'd, compressed and gzip'd tar files with GPG certificates
530 are available.
531
532 1.2.1 Are there mirror sites?
533
534 On March 21, 2013 these sites appeared to have the latest
535 lsof revision:
536
537 ftp://ftp.fu-berlin.de/pub/unix/tools/lsof
538 ftp://sunsite.ualberta.ca/pub/Mirror/lsof
539 http://www.mirrorservice.org/sites/lsof.itap.purdue.edu/pub/tools/unix/lsof/
540 ftp://ftp.mirrorservice.org/sites/lsof.itap.purdue.edu/pub/tools/unix/lsof/
541 rsync://rsync.mirrorservice.org/lsof.itap.purdue.edu/pub/tools/unix/lsof/
542
543 1.2.2 Are lsof executables available?
544
545 Some lsof executables are available in the subdirectory
546 tree pub/tools/unix/lsof/binaries These are neither guaranteed
547 to be current nor cover every dialect and machine architecture.
548
549 I don't recommend you use pre-compiled lsof binaries; I
550 recommend you obtain the sources and build your own binary.
551 Even if you're a Sun user without a Sun C compiler, you
552 can use gcc to compile lsof.
553
554 If you must use a binary file, please be conscious of the
555 security and configuration implications in using an executable
556 of unknown or different origin. The lsof binaries are
557 accompanied by GPG certificates. Please use them!
558
559 Three additional cautions apply to executables:
560
561 1. Don't try to use an lsof executable, compiled for one
562 version of a UNIX dialect, on another. Patches can
563 make the dialect version different.
564
565 2. If you want to use an lsof binary on multiple systems,
566 they must be running the same dialect OS version and
567 have the same patches and feature support.
568
569 1.2.3 How do I check the validity of an lsof distribution?
570
571 There are two ways to check the validity of an lsof
572 distribution:
573
574 1. Follow the instructions in the CHECKSUMS_<revision>
575 file found with the lsof distribution.
576
577 Checking with GPG is the best method.
578
579 2. Follow the instructions in the "Security" section of the
580 README.lsof_<revision> file found inside the lsof
581 distribution.
582
583 Again, checking with GPG is the best method.
584
585 1.2.4 Why can't I get the sum(1) result reported in
586 README.lsof_<revision>?
587
588 The "Security" section of the README.lsof_<revision> file found
589 inside the lsof distribution gives md5, sum, and GPG certificate
590 information.
591
592 The simplest, the sum(1) signature, seems to be the trickiest.
593 That's because there are different sum(1) methods, BSD systems
594 usually have cksum(1) instead of sum(1), and different systems
595 compute the block size value differently.
596
597 First, the lsof sum results are computed with the old,
598 "alternate" algorithm. On newer systems, you can use sum's
599 "-r" option to get that computation result.
600
601 Second, on BSD systems you usually must use cksum(1) instead
602 of sum(1), because they have no sum(1). To tell cksum(1)
603 to use the old, "alternate" algorithm, use its "-o1" option.
604
605 Third, the second value that sum reports, the block count, may
606 be computed differently on different systems -- usually block
607 size is considered to be 512 or 1,024. The lsof block counts
608 were computed on a system with a sum(1) option that considers
609 block size to be 512. The BSD system cksum(1) -o1 option
610 considers block size to be 1,024. If your sum(1) or cksum(1)
611 doesn't report a block count that matches the sum(1) signature
612 given in README.lsof_<revision>, check its man page to see what
613 block size it uses, then adjust its reported block count
614 appropriately.
615
616 1.2.5 Why won't gpg accept the lsof-signing PGP public key?
617
618 An older PGP key that once signed lsof distributions is
619 included in lsof revisions prior to 4.70. The PGP key is
620 indeed my key, but is incompatible with GPG. It was created
621 about ten years ago and is still acceptable to PGP versions
622 2.6.2 through 6.5.2.
623
624 Lsof revisions 4.70 and above are signed with a copy of my PGP
625 key that has been made acceptable for use with GPG by importing
626 it under GPG's "--allow-non-selfsigned-uid" option.
627
628 You can find my GPG compatible key in lsof revisions 4.70 and
629 above and at:
630
631 ftp://lsof.itap.purdue.edu/pub/Victor_A_Abell.gpg
632
633 If you have an older lsof revision with my PGP key, there are
634 two possible ways to use it:
635
636 * Use it with a PGP version from 2.6.2 through 6.5.2.
637
638 * Use GPG's "--allow-non-selfsigned-uid" option when you
639 import my PGP key into your GPG key ring.
640
641 $ gpg --allow-non-selfsigned-uid --import Victor_A_Abell.pgp
642
643 1.3 Where can I get more lsof documentation?
644
645 A significant set of documentation may be found in the lsof
646 distribution (See "Where can I get lsof?). There is a
647 manual page, copious documentation in files whose names
648 begin with 00, and a copy of this FAQ in the file 00FAQ
649 (perhaps slightly less recent than this file if you're
650 reading it via a web browser.)
651
652 Two URLs provide some documentation that appears in the
653 lsof distribution:
654
655 FAQ: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/FAQ
656
657 man page: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_man
658
659 1.4 How do I report an lsof bug?
660
661 If you believe you have discovered a bug in lsof, you can report it to
662 https://github.com/lsof-org/lsof. Do NOT report lsof bugs to the UNIX
663 dialect vendor.
664
665 Before you send a bug report, please read the "Bug Reports" section of
666 the 00README file of the lsof distribution. It lists the steps you
667 should take before and when reporting a suspected bug.
668
669 1.5 Where can I get the lsof FAQ?
670
671 This lsof FAQ is available in the file 00FAQ in the lsof
672 distribution and at the URL:
673
674 ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/FAQ
675
676 1.5.1 How timely is the on-line FAQ?
677
678 The on-line FAQ is sometimes too timely. :-)
679
680 I update it as soon as new information is available. That may
681 include information about support that won't appear in the lsof
682 source distribution until the next revision. If you encounter
683 something like that, please send me e-mail at <[email protected]>. I
684 may be able to point you at a pre-release distribution that contains
685 the support of interest. Make sure "lsof" appears in the "Subject:"
686 line so my e-mail filter won't classify your letter as Spam.
687
688 1.6 Is there a test suite?
689
690 Yes, as of lsof revision 4.63 there's an automated lsof
691 test suite in the tests/ sub-directory of the lsof top-level
692 directory.
693
694 More information on using the test suite, what it does,
695 how to use it and how to configure it may be found in the
696 00TEST file of the lsof distribution. That file also
697 explains where the test suite has been tested.
698
699 Frequently asked questions about the test suite will be
700 asked and answered here in the FAQ. (See "Test Suite
701 Problems.")
702
703 After lsof has been configured with the Configure script,
704 lsof can be made and tested with:
705
706 $ make
707 $ cd tests
708 $ make
709
710 Under normal conditions -- i.e., unless the lsof tree has
711 been cleaned or purged severely -- all tests or individual
712 tests may be run by:
713
714 $ cd test
715 $ make
716 or
717 $ <run a single test> (See 00TEST.)
718
719 1.7 Is lsof vulnerable to the standard I/O descriptor attack?
720
721 Lsof revisions 4.63 and above are not vulnerable.
722
723 Lsof revisions 4.62 and below are vulnerable, but no damage
724 scenarios have so far been demonstrated.
725
726 The standard I/O descriptor attack is a local programmed
727 assault on setuid and setgid programs that tricks them into
728 opening a sensitive file with write access on a standard
729 descriptor, usually stderr (2), and writing error messages
730 to stderr. If the attacker can control the content of the
731 error message, the attacker may gain elevated privileges.
732
733 The attack was first described in Pine Internet Advisory
734 PINE-CERT-20020401, available at:
735
736 http://www.pine.nl/advisories/pine-cert-20020401.txt
737
738 If you are using an lsof revision below 4.63, you should
739 remove any setuid or setgid permissions you might have
740 given its executable. Then you should upgrade to lsof
741 revision 4.63.
742
743 1.8 Can I alter lsof's make(1) behavior?
744
745 Yes. There are at least two ways to do that.
746
747 You can put replacements for lsof Makefile strings in your
748 environment. If you specify the -e make option, make will
749 give environment variable values precedence over strings
750 from the Makefile. For example, to change the compiler
751 string CC from the environment, you might do this with the
752 Bourne shell:
753
754 $ CC=foobar; export CC
755 $ make -e
756
757 You can also replace lsof Makefile strings in the make
758 command invocation. Here's the previous example done that
759 way:
760
761 $ make CC=foobar
762
763 Changing the CFGF, CFGL, and DEBUG strings used in lsof
764 Makefiles, either from the environment or from the make
765 invocation, can significantly alter lsof make(1) behavior.
766 I commonly use DEBUG to change the -O option to -g so I
767 can build an lsof executable for debugging -- e.g.,
768
769 $ make DEBUG=-g
770
771 (Look for DEBUG in this FAQ for other examples of its use.)
772
773 Consult the Makefiles to see what CFGL, CFGL, and other
774 lsof Makefile strings contain, and to see what influence
775 their alteration might have on lsof make(1) behavior.
776
777 1.9 Is there an lsof license?
778
779 No.
780
781 The only restriction on the use or redistribution of lsof
782 is contained in this copyright statement, found in every
783 lsof source file. (The copyright year in or format of the
784 notice may vary slightly.)
785
786 /*
787 * Copyright 2002 Purdue Research Foundation, West Lafayette,
788 * Indiana 47907. All rights reserved.
789 *
790 * Written by Victor A. Abell
791 *
792 * This software is not subject to any license of the American
793 * Telephone and Telegraph Company or the Regents of the
794 * University of California.
795 *
796 * Permission is granted to anyone to use this software for
797 * any purpose on any computer system, and to alter it and
798 * redistribute it freely, subject to the following
799 * restrictions:
800 *
801 * 1. Neither the authors nor Purdue University are responsible
802 * for any consequences of the use of this software.
803 *
804 * 2. The origin of this software must not be misrepresented,
805 * either by explicit claim or by omission. Credit to the
806 * authors and Purdue University must appear in documentation
807 * and sources.
808 *
809 * 3. Altered versions must be plainly marked as such, and must
810 * not be misrepresented as being the original software.
811 *
812 * 4. This notice may not be removed or altered.
813 */
814
815 1.10 Language locale support
816
817 1.10.1 Does lsof support language locales? How do I use the support?
818
819 Most UNIX dialect versions of lsof support 8 bit language
820 locale characters -- e.g., the ability to print 8 bit
821 characters that have accents and other marks over them.
822
823 See the answer to the "Does lsof support wide characters in
824 language locales?" question for information on when lsof's
825 language locale support covers characters wider than 8 bits.
826
827 To see if lsof supports language locales for your dialect, look
828 in the dialect's machine.h header file for the HASSETLOCALE
829 definition. If it is present and not disabled, then lsof has
830 language locale support for the dialect.
831
832 To enable lsof's language locale support, you must specify in a
833 locale environment variable (e.g., LANG) a language locale
834 known to your system that supports the printing of marked
835 characters -- e.g, en_US. (On some dialects locale(1) may be
836 used to list the known language locales.)
837
838 Note that LANG=C and LANG=POSIX are NOT language locales that
839 support the printing of marked characters.
840
841 If the language locale doesn't support the printing of marked
842 characters, lsof's OUTPUT of them follows the rules for
843 non-printable characters described in the OUTPUT section of
844 lsof(8).
845
846 Consult your dialect's setlocale(3) man page for the names of
847 environment variables other than LANG -- e.g., LC_ALL,
848 LC_TYPE, etc. -- which may be used to define language locales.
849
850 1.10.2 Does lsof support wide characters in language locales?
851
852 When lsof's language locale support is enabled with the
853 HASSETLOCALE definition, for selected dialects lsof will also
854 print wide characters (e.g., from UTF-8) when iswprint(3)
855 reports them to be printable.
856
857 Wide character support is available when HASWIDECHAR is defined
858 in a dialect's machine.h header file. As of this writing on
859 July 22, 2004, the following dialect versions have wide character
860 support:
861
862 AIX >= 4.3.2
863 Apple Darwin >= 7.3.0
864 FreeBSD >= 5.2
865 HP-UX >= 11.00
866 /proc-based Linux
867 NetBSD >= 1.6
868 SCO OpenServer >= 5.0.6
869 Solaris >= 2.6
870 Tru64 UNIX 5.1
871
872 1.11 Are any files in the lsof distribution copyrighted?
873
874 Yes. Most files carry the copyright of the Purdue Research
875 Foundation and may be redistributed under the terms that
876 accompany the copyright notice. Those terms may also be found
877 in the answer to the question, "Is there an lsof license?")
878
879 A few files carry other copyright notices. Some are BSD
880 notices and they explain the terms under which they are
881 included in the lsof distribution.
882
883 Those that carry vendor copyright notices have been reproduced
884 in their original or modified forms with permission from the
885 copyright owners. That permission is indicated in the README
886 files that accompany the files.
887
888 1.12 Are there other lsof-related resources?
889
890 There are other resources available, connected to lsof. Among
891 them are FreeBSD and Linux packages whose products use lsof and
892 two particularly interesting resources.
893
894 The two interesting resources are a Gnome Tool Kit (GTK) GUI
895 for lsof and a Perl wrapper module.
896
897 The GTK GUI is called Glsof and was developed by Gnele. It can
898 be found at:
899
900 http://www.sourceforge.net
901
902 The Perl wrapper module by Marc Beyer can be found at:
903
904 http://search.cpan.org/dist/Unix-Lsof/
905
906 1.13 What does the "WARNING: unsupported dialect or version" mean?
907
908 The lsof configure script issues that message for UNIX dialects
909 or their versions where I have been unable to test the current
910 revision of lsof. The message doesn't mean that lsof won't
911 work, just that I have no direct evidence that it will.
912
913 If the COnfigure script succeeds, except for the warning, try
914 compiling) lsof. If that succeeds, try the lsof test suite.
915
916 2.0 Lsof Ports
917
918 2.1 What ports exist?
919
920 The pub/lsof.README file carries the latest port information:
921
922 AIX 5.[23] and 5.3
923 FreeBSD 4.9 and 6.4 for x86-based systems
924 FreeBSD 8.[234], 9.0, 10.0 and 11.0 for AMD64-based systems
925 Linux 2.1.72 and above for x86-based systems
926 Solaris 9, 10 and 11
927
928 In the above list the only UNIX dialects present are ones for
929 which I test the current lsof revision. Lsof may still support
930 unlisted dialect versions -- e.g., HP-UX 10.20, Solaris 7, etc.
931 -- but I don't have access to systems where I could test lsof
932 on them, so I can't claim lsof works on them. If your dialect
933 isn't in the list, you should try building lsof on it anyway.
934
935 Lsof version 4 predecessors, versions 2 and 3, may support older
936 version of some dialects. Contact me via e-mail at <[email protected]>
937 if you're interested in their distributions. Make sure "lsof"
938 appears in the "Subject:" line so my e-mail filter won't classify
939 your letter as Spam.
940
941 2.2 What about a new port?
942
943 The 00PORTING file in the distribution gives hints on doing
944 a port. I will consider doing a port in exchange for
945 permanent access to a test host. I require permanent access
946 so I can test new lsof revisions, because I will not offer
947 distributions of dialect ports I cannot upgrade and test.
948
949 2.2.1 User-contributed Ports
950
951 Sometimes I receive contributions of ports of lsof to
952 systems where I can't test future revisions of lsof. Hence,
953 I don't incorporate these contributions into my lsof
954 distribution.
955
956 However, I do make descriptions of these contributions
957 available. You can find them in the 00INDEX and README
958 files at:
959
960 ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/contrib
961
962 Consult the 00INDEX file in the contrib/ directory for a
963 list of the available contributions and consult README
964 there for information on how to obtain them.
965
966 2.3 Why isn't there an AT&T SVR4 port?
967
968 I haven't produced an AT&T SVR4 port because I haven't seen
969 a UNIX dialect that is strictly limited to the AT&T System
970 V, Release 4 source code. Every one I have seen is a
971 derivative with vendor additions.
972
973 The vendor additions are significant to lsof because they
974 affect the internal kernel structures with which lsof does
975 business. While some vendor derivatives of SVR4 are similar,
976 each one I have encountered so far has been different enough
977 from its siblings to require special source code.
978
979 If you're interested in an SVR4 version of lsof, here are
980 some existing ports you might consider:
981
982 DC/OSx (This obsolete port is only available upon
983 special request.)
984 Reliant UNIX (This obsolete port is only available
985 upon special request.)
986 SCO|Caldera UnixWare (This is the most likely choice.)
987 Solaris
988
989 2.4 Why isn't there an SGI IRIX port?
990
991 Lsof support for IRIX was terminated at lsof revision 4.36,
992 because it had become increasingly difficult for me to
993 obtain information on the IRIX kernel structures lsof needs
994 to access.
995
996 At IRIX 6.5 I decided the obstacles were too large for me
997 to overcome, and I stopped supporting lsof on IRIX. I have
998 sources to the last revision of lsof (4.36) for IRIX, but
999 that version of lsof does not work on IRIX 6.5 and is
1000 vulnerable to the standard I/O descriptor attack. (See
1001 the "Is lsof vulnerable to the standard I/O descriptor
1002 attack?" Q&A for more information.) Contact me to discuss
1003 obtaining those sources.
1004
1005 If you wish to pursue the issue, don't contact me, contact
1006 SGI. This case was opened with SGI on the subject:
1007
1008 Case ID: 0982584
1009 Category: Unix
1010 Priority: 30-Moderate Impact
1011
1012 Problem Summary:
1013 kernel structure header files needed for continued lsof
1014 support
1015
1016 Problem Description:
1017 Email In 07/17/98 19:09:23
1018
1019 2.5 Why does lsof's Configure script report "WARNING: unsupported
1020 dialect or version"?
1021
1022 Lsof's Configure script issues this message when it encounters
1023 a dialect or its version that lsof once supported, but no
1024 longer does. Usually I drop support for a dialect or version
1025 when I can no longer test lsof on it.
1026
1027 However, it's worth trying to compile and use lsof. Be sure to
1028 run the test suite. (See the answer to the "Is there a test
1029 suite? question for information on the test suite.)
1030
1031 If you have problems with an unsupported dialect or version,
1032 contact me via e-mail at <[email protected]> and I may be able to help.
1033 Make sure "lsof" appears in the "Subject:" line so my e-mail filter
1034 won't classify your letter as Spam.
1035
1036
1037 3.0 Lsof Problems
1038
1039 3.1 Configuration Problems
1040
1041 3.1.1 Why can't Configure determine the UNIX dialect version?
1042
1043 The lsof Configure script uses UNIX shell commands, often in a
1044 command pipeline, to determine the UNIX dialect version.
1045 (Consult the dialect stanza in Configure to determine which
1046 commands are used.) If Configure can't determine the dialect
1047 version, probably one of the commands is not behaving as
1048 Configure expects.
1049
1050 Symptoms of the failure include Configure warning messages and
1051 incorrect version definitions in the Makefile CFLAGS.
1052
1053 If you suspect that the lsof Configure script is failing to
1054 determine the dialect version correctly, try running the
1055 commands from Configure stanza one at a time. That will
1056 usually reveal the source of the problem. Be particularly
1057 mindful that the PATH environment variable can cause commands
1058 to be executed from non-standard directories.
1059
1060 If you can't determine the source of the problem, there is a
1061 work-around. You can supply the UNIX dialect version in the
1062 LSOF_VSTR environment variable. Use Configure as a guide to
1063 forming what it expects in LSOF_VSTR. There is also some
1064 information on LSOF_VSTR in the 00XCONFIG documentation file
1065 of the lsof distribution.
1066
1067 3.2 Compilation Problems
1068
1069 3.2.1 Why does the compiler complain about missing header files?
1070
1071 When you use make to build lsof, the compiler may complain
1072 that it can't find header files -- e.g.,
1073
1074 $ make
1075 (cd lib; make DEBUG="-O" CFGF="-DAIXA=0 -DAIXV=4330 \
1076 -DLSOF_VSTR=\"4.3.3.0\"")
1077 gcc -DAIXA=0 -DAIXV=4330 -DLSOF_VSTR="4.3.3.0" -O \
1078 -c ckkv.c
1079 In file included from ckkv.c:33: ../machine.h:70: \
1080 sys/types.h: A file or directory in the path name \
1081 does not exist. \
1082
1083 That type of complaint doesn't represent an lsof problem.
1084 It represents a problem with a missing system header file
1085 that probably should be found in /usr/include or in the
1086 system source tree.
1087
1088 As a first step try using find(1) to locate the problem
1089 header file. If it's a system header file and can't be
1090 found, here are some possible causes:
1091
1092 1. The file set, RPM or package containing the header files
1093 has not been installed. Instructions for doing that
1094 are specific to the UNIX dialect and beyond the scope
1095 of this document.
1096
1097 2. If the compiler is gcc, the private gcc header files:
1098
1099 * May not have been installed;
1100
1101 * May have been installed incorrectly;
1102
1103 * May not have been updated properly after the last
1104 compiler or system update;
1105
1106 * Ones from a previous installation may not have been
1107 removed.
1108
1109 A path leading to the gcc private header files can be
1110 found with `gcc -v`. Consult the gcc documentation for
1111 instructions on proper installation of the private gcc
1112 header files.
1113
1114 3. On some dialects -- e.g., FreeBSD, NetBSD, OpenBSD --
1115 lsof may need to use header files that are located in
1116 the system source tree -- /sys or /usr/src/sys, for
1117 example. Make sure the system source tree has been
1118 installed.
1119
1120 3.2.2 Why does gcc complain about the contents of header files
1121 distributed by the system's vendor?
1122
1123 When you use make to build lsof and gcc to compile it, gcc
1124 may complain that it finds errors in system header files
1125 -- e.g.,
1126
1127 $ make
1128 (cd lib; make DEBUG="-O" CFGF="-Dsolaris=80000 \
1129 -DHASPR_GWINDOWS -m64 -DHASIPv6 -DHAS_VSOCK \
1130 -DLSOF_VSTR=\"5.8\"")
1131 gcc -Dsolaris=80000 -DHASPR_GWINDOWS -m64 -DHASIPv6 \
1132 -DHAS_VSOCK -DLSOF_VSTR="5.8" -O -c dvch.c
1133 In file included from /usr/include/sys/proc.h:31, \
1134 from /homes/abe/gnu/gcc-3.2.1/lib/gcc-lib/sparcv9-sun-solaris2/ \
1135 3.2.1/include/sys/user.h:267, from /usr/include/kvm.h:13, \
1136 from ../dlsof.h:53, from ../lsof.h:172, from dvch.c:43: \
1137 /homes/abe/gnu/gcc-3.2.1/lib/gcc-lib/sparcv9-sun-solaris2/\
1138 3.2.1/include/sys/task.h:59: parse error before "uint_t"
1139
1140 Errors like the above are most likely not problems in the
1141 system's header files, but in the private copies of them
1142 that were created when gcc was made or installed. Note
1143 the presence of
1144 ".../gcc-3.2.1/lib/gcc-lib/sparcv9-sun-solaris2/3.2.1/include/..."
1145 in the paths for user.h and task.h. It indicates both
1146 header files are gcc-specific.
1147
1148 To solve errors like this requires comparing the header
1149 files in the vendor's /usr/include tree to the gcc-specific
1150 ones in gcc's private gcc-lib/.../include tree. It may be
1151 necessary to regenerate gcc-specific header files, correct
1152 them or remove them. See the gcc distribution for the
1153 appropriate tools.
1154
1155 A possible temporary work-around is to direct gcc to use
1156 the vendor's header files instead of its temporary ones by
1157 declaring -I/usr/include in the compilation flags.
1158
1159 3.2.3 Other header file problems
1160
1161 Don't overlook any vendor tools that might validate the
1162 vendor header files installed on the system -- e.g., the
1163 Solaris pkgchk tool can be used to check the header files
1164 that were installed from the SUNWhea package.
1165
1166 For other header file problems contact me at <[email protected]>.
1167 Please follow the reporting guidelines in the "How do I
1168 report an lsof bug?" section of this FAQ.
1169
1170 3.3 Why doesn't lsof report full path names?
1171
1172 Lsof reports the full path name when it is specified as a
1173 search argument for open files that match the argument.
1174 However, if the argument is a file system mounted-on
1175 directory, and lsof finds additional path name components
1176 from the kernel name cache, it will report them.
1177
1178 Lsof reports path name for file system types that have path
1179 name lookup features -- e.g., some versions of AdvFS for
1180 Digital and Tru64 UNIX. The Linux /proc-based lsof reports
1181 full path names, because the Linux /proc file system provides
1182 them. Lsof on recent builds of Solaris 10 also report full
1183 path names, because those Solaris kernels record the full path
1184 name in the vnode structure.
1185
1186 Otherwise, lsof uses the kernel name cache, where it exists
1187 and can be accessed, and reports some or all path name
1188 components (e.g., the sys and proc.h components of
1189 /usr/include/sys/proc.h) for these dialects:
1190
1191 Apple Darwin
1192 DC/OSx
1193 FreeBSD
1194 HP-UX, /dev/kmem and PSTAT based
1195 Linux, /dev/kmem-based
1196 NetBSD
1197 OpenBSD
1198 Reliant UNIX
1199 SCO OpenServer
1200 SCO|Caldera UnixWare
1201 Solaris 2.x, 7, 8 and 9 (except for some VxFS versions;
1202 see the "Why doesn't Solaris
1203 lsof report VxFS path name
1204 components?" section for more
1205 information)
1206 Solaris 10 (early builds) Tru64 UNIX
1207
1208 As far as I can determine, AFS path lookups don't share in
1209 kernel name cache operations, so lsof can't identify open AFS
1210 path name components. Apparently Solaris VxFS versions 4 and
1211 above don't share in kernel name cache operations, either, so
1212 lsof can't display path name components for those open files.
1213
1214 Since the size of the kernel name cache is limited and the
1215 cache is in constant flux, it does not always contain the names
1216 of all components in an open file's path; sometimes it contains
1217 none of them.
1218
1219 Lsof reports the file system directory name and whatever
1220 components of the file's path it finds in the cache, starting
1221 with the last component and working backwards through the
1222 directories that contain it. If lsof finds no path
1223 components, lsof reports the file system device name instead.
1224
1225 When lsof does report some path components in the NAME
1226 column, it prefixes them with the file system directory
1227 name, followed by " -- ", followed by the components --
1228 e.g., /usr -- sys/path.h for /usr/include/sys/path.h. The
1229 " -- " is omitted when lsof finds all the path name components
1230 of a file's name.
1231
1232 The PSTAT-based HP-UX lsof relies on kernel name cache
1233 contents, too, even though its information comes to lsof
1234 via pstat() function calls. Consequently, PSTAT-based
1235 HP-UX lsof won't always report full paths, but may use the
1236 " -- " partial path name notation, or may occasionally
1237 report no path name at all but just the file system mounted-on
1238 directory and device names.
1239
1240 Lsof can't obtain path name components from the kernel name
1241 caches of the following dialects:
1242
1243 AIX
1244
1245 Only the Linux kernel records full path names in the
1246 structures it maintains about open files; instead, most
1247 kernels convert path names to device and node number doublets
1248 and use them for subsequent file references once files have
1249 been opened.
1250
1251 To convert the device and node number doublet into a
1252 complete path name, lsof would have to start at the root
1253 node (root directory) of the file system on which the node
1254 resides, and search every branch for the node, building
1255 possible path names along the way. That would be a time
1256 consuming operation and require access to the raw disk
1257 device (usually implying setuid-root permission).
1258
1259 If the prospect of all that local disk activity doesn't
1260 concern you, think about the cost when the device is
1261 NFS-mounted.
1262
1263 Try using the file system mount point and node number lsof
1264 reports as parameters to find -- e.g.,
1265
1266 $ find <mount_point> -inum <node_number> -print
1267
1268 and you may get an appreciation of what a file system
1269 directory tree search would cost.
1270
1271 3.3.1 Why do lsof -r reports show different path names?
1272
1273 When you run lsof with its repeat (``-r'') option, you may
1274 notice that the extent to which it reports path names for
1275 the same files may vary from cycle to cycle. That happens
1276 because other processes are making kernel calls affecting
1277 the cache and causing entries to be removed from and added
1278 to it.
1279
1280 3.3.2 Why does lsof report the wrong path names?
1281
1282 Under some circumstances lsof may report an incorrect path
1283 name component, especially for files in a rapidly changing
1284 directory like /tmp.
1285
1286 In a rapidly changing directory, like /tmp, if the kernel
1287 doesn't clear the cache entry when it removes a file, a
1288 new file may be given the same keys and lead lsof to believe
1289 that the old cache entry with the same keys belongs to the
1290 new file.
1291
1292 Lsof tries to avoid this error by purging duplicate entries
1293 from its copy of the kernel name cache when they have the
1294 same device and inode number, but different names.
1295
1296 This error is less likely to occur in UNIX dialects where the
1297 keys to the name cache are node address and possibly a
1298 capability ID. The Apple Darwin, Digital UNIX, FreeBSD, HP-UX,
1299 NEXTSTEP, OPENSTEP, Solaris, Tru64 UNIX, and UnixWare dialects
1300 use node address. Apple Darwin, FreeBSD, NetBSD, OpenBSD,
1301 Tru64 UNIX, and also use a capability ID to further identify
1302 name cache entries.
1303
1304 3.3.3 Why doesn't lsof report path names for unlinked (rm'd) files?
1305
1306 When lsof gets path name components from the kernel's name
1307 cache, it does not report the path names of a file that has
1308 been unlinked from its parent directory -- e.g., deleted via
1309 rm, or the unlink() system call -- even when some process may
1310 still hold the file open; lsof reports only the file system's
1311 mounted-on directory and device. That's because path name
1312 components are removed from the kernel name cache when the file
1313 is unlinked.
1314
1315 Unlinked open files are sometimes used by applications for
1316 temporary, but invisible storage (i.e., ls won't show them,
1317 and no other process can open them.) However, they may
1318 occasionally consume disk space to excess and cause concern
1319 for a system administrator, who will be unable to locate
1320 them with find, ls, du, or other tools that rely on finding
1321 files by examining the directory tree.
1322
1323 By using lsof's +L option you can see the link count of
1324 open files -- in the NLINK column. An unlinked file will
1325 have an NLINK value of zero. By using the option +L1 you
1326 can tell lsof to display only files whose link count is
1327 less than one (i.e., zero).
1328
1329 There are some UNIX dialect-specific exceptions to lsof's
1330 inability to report unlinked path names. They are described in
1331 the answer to the "When will lsof report path names for deleted
1332 files?" question.
1333
1334 3.3.4 Why doesn't lsof report the "correct" hard linked file path
1335 name?
1336
1337 When lsof reports a rightmost path name component for a
1338 file with hard links, the component may come from the
1339 kernel's name cache. Since the key which connects an open
1340 file to the kernel name cache may be the same for each
1341 differently named hard link, lsof may report only one name
1342 for all open hard-linked files. Sometimes that will be
1343 "correct" in the eye of the beholder; sometimes it will
1344 not. Remember, the file identification keys significant
1345 to the kernel are the device and node numbers, and they're
1346 the same for all the hard linked names.
1347
1348 3.3.5 When will lsof report path names for deleted files?
1349
1350 Lsof will report path names for deleted files for two
1351 dialects: Linux and later builds of Solaris 10.
1352
1353 Deleted Linux path names are reported by default and have
1354 "(deleted)" at their ends.
1355
1356 The display of Solaris 10 deleted path names may be selected
1357 with the -X option. When selected they are also reported with
1358 "(deleted)" at their ends.
1359
1360 3.4 Why is lsof so slow?
1361
1362 Lsof may appear to be slow if network address to host name
1363 resolution is slow. This can happen, for example, when the
1364 name server is unreachable, or when a Solaris PPP cache daemon
1365 is malfunctioning.
1366
1367 To see if name lookup is causing lsof to be slow, turn it off
1368 with the ``-n'' option.
1369
1370 Port service name lookup or portmap registration lookup may
1371 also be causes of slow-down. To suppress port service name
1372 lookup, specify the ``-P'' option.
1373
1374 Lsof doesn't usually make direct portmap calls -- only when +M
1375 is specified, or when HASPMAPENABLED is defined during lsof
1376 construction. (The lsof help panel, produced with `lsof -h`
1377 will display the default portmap registration reporting
1378 state.) The quickest first step in checking if lsof is slow
1379 because of the portmapper is to use lsof's ``-M'' option.
1380
1381 Lsof may be slow if UID to login name lookups are slow.
1382 Suppress them with ``-l''.
1383
1384 On dialects where lsof uses the kernel name cache, try
1385 disabling its use with ``-C''. (You can tell if lsof uses the
1386 kernel name cache by looking for ``-C'' in lsof's ``-h''
1387 output.) Of course, disabling kernel name cache use will mean
1388 that lsof won't report full or partial path names, just file
1389 system and character device names.
1390
1391 If you're just interested in the open files of one process, try
1392 using the ``-p <Process-ID>'' option to limit lsof to that
1393 process. (The ``-p'' option may also be followed with a list
1394 of Process-IDs.)
1395
1396 If you're interested in including or excluding certain
1397 commands, try lsof's "-c[^]cmd" option.
1398
1399 If you're interested in certain Internet TCP and UDP states
1400 (e.g., ESTABLISHED) or in excluding some (e.g., CLOSE_WAIT),
1401 try lsof's "-s p:s" option, available where shown on the lsof
1402 help output, obtained with -h or -?. More information on it
1403 may be found in the answer to the "How are protocol state name
1404 exclusion and inclusion used?" question.
1405
1406 Your UNIX dialect may not support "-s p:s" and its associated
1407 performance improvements to Internet-only file processing. You
1408 can find more information on those topics in the answer to the
1409 "Why doesn't my dialect support state name exclusion and
1410 inclusion?" question.
1411
1412 Older AIX lsof may be slow to start because of its oslevel
1413 identity comparison. (Newer AIX lsof uses uname(2).) See the
1414 "Why does AIX lsof start so slowly?" and "Why does lsof warn
1415 "compiled for x ... y; this is z.?" sections for more
1416 information.
1417
1418 3.5 Why doesn't lsof's setgid or setuid permission work?
1419
1420 If you install lsof on an NFS file system that has been
1421 mounted with the nosuid option, lsof may not be able to
1422 use the setgid or setuid permission you give it, complaining
1423 it can't open the kernel memory device -- e.g., /dev/kmem.
1424
1425 The only solution is to install lsof on a file system that
1426 doesn't inhibit setgid or setuid permission.
1427
1428 3.6 Does lsof have security problems?
1429
1430 I don't think so. However, lsof does usually start with
1431 setgid permission, and sometimes with setuid-root permission.
1432 Any program that has setgid or setuid-root permission,
1433 should always be regarded with suspicion.
1434
1435 Lsof drops setgid power, holding it only while it opens
1436 access to kernel memory devices (e.g., /dev/kmem, /dev/mem,
1437 /dev/swap). That allows lsof to bypass the weaker security
1438 of access(2) in favor of the stronger checks the kernel
1439 makes when it examines the right of the lsof process to
1440 open files declared with -k and -m. Lsof also restricts
1441 some device cache file naming options when it senses the
1442 process has setuid-root power.
1443
1444 On a few dialects lsof requires setuid-root permission
1445 during its full execution in order to access files in the
1446 /proc file system. These dialects include:
1447
1448 DC/OSx 1.1 for Pyramid systems
1449 Reliant UNIX 5.4[34] for Pyramid systems
1450
1451 When lsof runs with setuid-root permission it severely
1452 restricts all file accesses it might be asked to make with
1453 its options.
1454
1455 The device cache file (typically .lsof_hostname in the home
1456 directory of the real user ID that executes lsof) has 0600
1457 modes. (The suffix, hostname, is the first component of
1458 the host's name returned by gethostname(2).) However, even
1459 when lsof runs setuid-root, it makes sure the file's
1460 ownerships are changed to that of the real user and group.
1461 In addition, lsof checks the file carefully before using
1462 it (See the question "How do I disable the device cache
1463 file feature or alter its behavior?" for a description of
1464 the checks.); discards the file if it fails the scrutiny;
1465 complains about the condition of the file; then rebuilds
1466 the file.
1467
1468 See the 00DCACHE file of the lsof distribution for more
1469 information about device cache file handling and the risks
1470 associated with the file.
1471
1472 3.7 Will lsof show remote hosts using files via NFS?
1473
1474 No. Remember, lsof displays open files for the processes
1475 of the host on which it runs. If the host on which lsof
1476 is running is an NFS server, the remote NFS client processes
1477 that are accessing files on the server leave no process
1478 records on the server for lsof to examine.
1479
1480 3.8 Why doesn't lsof report locks held on NFS files?
1481
1482 Generally lock information held by local processes on remote
1483 NFS files is not recorded by the UNIX dialect kernel. Hence,
1484 lsof can't report it.
1485
1486 One exception is some patch levels of Solaris 2.3, and all
1487 versions of Solaris 2.4 and above. Lsof for those dialects
1488 does report on locks held by local processes on remotely
1489 mounted NFS files.
1490
1491 3.8.1 Why does lsof report a one byte lock on byte zero as a full
1492 file lock?
1493
1494 When a process has a lock of length one, starting at byte
1495 zero, lsof can't distinguish it from a full file lock.
1496 That's because most UNIX dialects represent both locks the
1497 same way in their file lock (flock or eflock) structures.
1498
1499 3.9 Why does lsof report different values for open files on the
1500 same file system (the automounter phenomenon)?
1501
1502 On UNIX dialects where file systems may be mounted by an
1503 automounter with the ``direct'' type, lsof may sometimes
1504 report difference DEVICE, SIZE/OFF, INODE and NAME values
1505 when asked to report files open on the file system.
1506
1507 This happens because some files open on the file system --
1508 e.g., the current directory of a shell that changed its
1509 directory to the file system as the file system's first
1510 reference -- may be characterized in the kernel with
1511 temporary automounter node information. The cd doesn't
1512 cause the file system to be mounted.
1513
1514 A subsequent reference to the file system -- e.g., an ls
1515 of any place in it -- will cause the file system to be
1516 mounted. Processes with files open to the mounted file
1517 system are characterized in the kernel with data that
1518 reflects the mounted file system's parameters.
1519
1520 Unfortunately some kernels (e.g., some versions of Solaris
1521 2.x) don't revisit the process that did only a change-directory
1522 for the purpose of updating the data associated with the
1523 open directory file. The file continues to be characterized
1524 with temporary automounter information until it does another
1525 directory change, even a trivial ``cd .''.
1526
1527 Lsof will report on both reference types, when supplied
1528 the file system name as an argument, but the data lsof
1529 reports will reflect what it finds in the kernel. For the
1530 different types lsof will display different data, including
1531 different major and minor device numbers in the DEVICE
1532 column, different lengths in the SIZE/OFF column, different
1533 node numbers in the INODE column, and slightly different
1534 file system names in the NAME column.
1535
1536 In contrast, fuser, where available, can only report on
1537 one reference type when supplied the file system name as
1538 an argument. Usually it will report on the one that is
1539 associated with the mounted file system information. If
1540 the only reference type is the temporary automounter one,
1541 fuser will often be silent about it.
1542
1543 3.10 Why don't lsof and netstat output match?
1544
1545 Lsof and netstat output don't match because lsof reports
1546 the network information it finds in open file system objects
1547 -- e.g., socket files -- while netstat often gets its
1548 information from separate kernel tables.
1549
1550 The information available to netstat may describe network
1551 activities never or no longer associated with open files,
1552 but necessary for proper network state machine operation.
1553
1554 For example, a TCP connection in the FIN_WAIT_[12] state
1555 may no longer have an associated open file, because the
1556 connection has been closed at the application layer and is
1557 now being closed at the TCP/IP protocol layer.
1558
1559 3.10.1 Why can't lsof find accesses to some TCP and UDP ports?
1560
1561 Lsof stands for LiSt Open Files. If there is no open file
1562 connected to a TCP or UDP port, lsof won't find it. That's
1563 the most common reason why lsof doesn't find a port netstat
1564 might report open.
1565
1566 One reason I've found on some UNIX dialects is that their
1567 kernels set aside TCP and UDP ports for communicating with
1568 support activities, running in application layer servers
1569 -- the automounter daemons, and the NFS biod and nfsd
1570 daemons are examples. Netstat may report the ports are in
1571 use, but lsof doesn't.
1572
1573 Another reason is that netstat may also be able to report
1574 a port is open on a particular dialect, because it uses a
1575 source of data different from what lsof uses -- e.g.,
1576 netstat might examine kernel tables or use streams messages
1577 to MIB2, while lsof relies on the information it finds in
1578 open file structures and their descendants.
1579
1580 Sometimes it's possible to search the data netstat and lsof
1581 use. For example, on Linux /proc/tcp and /proc/udp can be
1582 examined. There might an entry there for a particular
1583 protocol and port, but if the line on which the port appears
1584 doesn't have an inode number that matches an inode number
1585 of an open file, lsof won't be able to identify the process
1586 using the port.
1587
1588 This is a tough question to which there is no easy answer.
1589
1590 3.11 Why does lsof update the device cache file?
1591
1592 At the end of the lsof output you may see the message:
1593
1594 lsof: WARNING: /Homes/abe/.lsof_vic was updated.
1595
1596 In this message /Homes/abe/.lsof_vic is the path to the
1597 private device cache file for login abe. (See 00DCACHE.)
1598
1599 Lsof issues this message when it finds it necessary to
1600 recheck the system device directory (e.g., /dev or /devices)
1601 and rebuild the device cache file during the open file
1602 scan. Lsof may need to do these things it finds that a
1603 device directory node has changed, or if it cannot find a
1604 device in the cache.
1605
1606 3.12 Why doesn't lsof report state for UDP socket files?
1607
1608 Lsof reports UDP TPI connection state -- TS_IDLE (Idle),
1609 TS_BOUND (Bound), etc. -- for some, but not all dialects.
1610 TPI state is stream-based TCP/IP information that isn't
1611 available in many dialects.
1612
1613 A fairly weak general rule is if netstat(1) reports UDP
1614 TPI state, lsof may be able to report it, too. But don't
1615 be surprised if lsof fails to report UDP TPI state for your
1616 dialect. Other factors influence lsof's ability to report
1617 UDP TPI state, including the availability of state number
1618 data in kernel structures, and state number to state name
1619 conversion data.
1620
1621 3.13 I am editing a file with vi; why doesn't lsof find the file?
1622
1623 Classic implementations of vi usually don't keep open the file
1624 being edited. (Newer ones may do so in order to maintain an
1625 advisory lock.) Instead classic vi opens the file, makes a
1626 temporary copy (usually in /tmp or /usr/tmp), and does its work
1627 in that file. When you save the file being edited from a
1628 classic vi implementation, it reopens and rewrites the file.
1629
1630 During a classic vi session, except for the brief periods when
1631 vi is reading or rewriting the file, lsof won't find an open
1632 reference to the file from the vi process, because there is
1633 none.
1634
1635 3.14 Why doesn't lsof report TCP/TPI window and queue sizes for my
1636 dialect?
1637
1638 Lsof only reports TCP/TPI window sizes for Solaris, because
1639 only its netstat reports them. The intent of providing
1640 TCP/TPI information in lsof NAME column output is to make
1641 it easier to match netstat output to lsof output.
1642
1643 In general lsof only reports queue sizes for both TCP and
1644 UDP (TPI) connections on BSD-derived UNIX dialects, where
1645 both sets of values appear in kernel socket queue structures.
1646 SYSV-derived UNIX dialects whose TCP/IP implementations
1647 are based on streams generally provide only TCP queue sizes,
1648 not UDP (TPI) ones.
1649
1650 While you may find that netstat on some SYSV-derived UNIX
1651 dialects with streams TCP/IP may report UDP (TPI) queue
1652 sizes, you will probably also find that the sizes are always
1653 zero -- netstat supplies a constant zero for UDP (TPI)
1654 queue sizes to make its headers align the same for TCP and
1655 UDP (TPI) connections. Solaris seems to get it right --
1656 i.e., its netstat does not report UDP (TPI) queue sizes.
1657
1658 When in doubt, I chose to avoid reporting UDP (TPI) queue
1659 sizes for UNIX dialects whose netstat-reported values I
1660 knew to be a constant zero or whose origin I couldn't
1661 determine. OSR is a dialect in this category.
1662
1663 3.14.1 Why doesn't lsof report socket options, socket states, and TCP
1664 flags and values for my dialect?
1665
1666 The lsof -T argument, 'f', that selects the reporting of socket
1667 options, socket states and TCP flags was implemented at lsof
1668 revision 4.71 for the following UNIX dialects, providing the
1669 indicated information:
1670
1671 AIX 4.3.2 and 5.1 and above
1672 All socket options and values, socket states, and TCP
1673 flags and values described in lsof(8) are reported.
1674 Apple Darwin 7.2 and above
1675 All socket options and values, socket states, and TCP
1676 flags and values described in lsof(8) are reported.
1677 FreeBSD 4.9 and above
1678 All socket options and values, socket states, and TCP
1679 flags and values described in lsof(8) are reported.
1680 HP-UX 11.00 (/dev/kmem-based lsof)
1681 All socket options and values are reported. No socket
1682 states are reported. Only the TF_NODELAY TCP flag and
1683 the TF_MSS value are reported.
1684 HP-UX 11.11 and iiiv2 (PSTAT-based lsof)
1685 All socket options and values, and socket states are
1686 reported. No TCP flags or values are reported.
1687 Linux
1688 No socket options and values, socket states, or TCP
1689 flags and values are reported. The support for "-Tf"
1690 could not be added to Linux, because socket options,
1691 socket states, and TCP flags and values are not
1692 available via the /proc file system.
1693 NetBSD 1.6G and above
1694 All socket options and values, socket states, and TCP
1695 flags and values described in lsof(8) are reported.
1696 OpenBSD 3.4 and above
1697 All socket options and values, socket states, and TCP
1698 flags and values described in lsof(8) are reported.
1699 OpenUNIX 8
1700 All socket options and values, socket states, and TCP
1701 flags and values described in lsof(8) are reported.
1702 SCO OpenServer Release 5.0.6
1703 All socket options and values, socket states, and TCP
1704 flags and values described in lsof(8) are reported.
1705 Solaris 2.6, 8 and above
1706 The socket option display is limited to BROADCAST,
1707 DEBUG, DGRAM_ERRIND, DONTROUTE and OOBINLINE. Socket
1708 values are limited to KEEPALIVE and LINGER. No socket
1709 states are reported. The TCP DELACK, NODELAY and
1710 SENTFIN flags are reported. The TCP MSS value is
1711 reported.
1712 UnixWare 7.1.[134]
1713 All socket options and values, socket states, and TCP
1714 flags and values described in lsof(8) are reported.
1715
1716 3.14.2 Why doesn't lsof report the partial listen queue connection
1717 count for my dialect?
1718
1719 The reporting of partial listen queue connections was added to
1720 -Tf processing at lsof revision 4.76. Currently it is reported
1721 for these dialects:
1722
1723 AIX 4.3.2
1724 This dialect is no longer supported, so no attempt
1725 was made to add partial listen queue length support
1726 for it.
1727 AIX 5.1 and above
1728 Partial listen queue information is available.
1729 Apple Darwin 7.2 and above
1730 Partial listen queue information is available.
1731 FreeBSD 4.9 and above
1732 Partial listen queue information is available.
1733 HP-UX 11.00 (/dev/kmem-based lsof)
1734 No partial listen queue information is available.
1735 HP-UX 11.11 and iiiv2 (PSTAT-based lsof)
1736 No partial listen queue information is available.
1737 Linux
1738 No partial listen queue information is available.
1739 NetBSD 1.6G and above
1740 Partial listen queue information is available.
1741 OpenBSD 3.4 and above
1742 Partial listen queue information is available.
1743 OpenUNIX 8
1744 This dialect is no longer supported, so no attempt
1745 was made to add partial listen queue length support
1746 for it.
1747 SCO OpenServer Release 5.0.6
1748 No partial listen queue information is available.
1749 Solaris 2.6, 8 and above
1750 Partial listen queue information is available.
1751 Tru64 UNIX 5.0
1752 This dialect is no longer supported, so no attempt
1753 was made to add partial listen queue length support
1754 for it.
1755 Tru64 UNIX 5.1
1756 Partial listen queue information is available.
1757 UnixWare 7.1.[134]
1758 Partial listen queue information is available.
1759
1760
1761 3.15 What does "no more information" in the NAME column mean?
1762
1763 When lsof can find no successor structures -- a gnode,
1764 inode, socket, or vnode -- connected to the file structure
1765 of an open descriptor of a process, it reports "no more
1766 information" in the NAME column. The TYPE, DEVICE, SIZE/OFF,
1767 and INODE columns will be blank.
1768
1769 Because the file structure is supposed to contain a pointer
1770 to the next structure of a file's processing support, if
1771 the pointer is NUL, lsof can go no further.
1772
1773 Some UNIX dialects have file structures for system processes
1774 -- e.g., the sched process -- that have no successor
1775 structure pointers. The "no more information" NAME will
1776 commonly appear for these processes in lsof output.
1777
1778 It may also be the case that lsof has read the file structure
1779 while it is being assembled and before a successor structure
1780 pointer value has been set. The "no more information" NAME
1781 will again result.
1782
1783 Unless lsof output is filled with "no more information"
1784 NAME column messages, the appearance of a few should be no
1785 cause for alarm.
1786
1787 3.16 Why doesn't lsof find a process that ps finds?
1788
1789 If lsof fails to display open files for a process that ps
1790 indicates exists, there may be several reasons for the
1791 difference.
1792
1793 The process may be a "zombie" for which ps displays the
1794 "(defunct)" state. In that case, the process has exited
1795 and has no open file information lsof can display. It does
1796 still have a process structure, sufficient for the needs
1797 of ps.
1798
1799 Another possible explanation is that kernel tables and
1800 structures may have been changing when lsof looked for the
1801 process, making lsof unable to find all relevant process
1802 structures. Try repeating the lsof request.
1803
1804 3.17 Why doesn't -V report a search failure?
1805
1806 The usual reason that -V won't report a search failure is
1807 that lsof located the search item, but was prevented from
1808 listing it by an option that doesn't participate in search
1809 failure reporting.
1810
1811 For example, this lsof invocation:
1812
1813 $ lsof -V -i TCP@foobar -a -d 999
1814
1815 won't report it can't find the Internet address TCP@foobar,
1816 even if there is an open file connected to that address,
1817 unless the open file also has a file descriptor number of
1818 999 (the ``-a -d 999'' options).
1819
1820 Compile-time options can also affect -V results in much the
1821 same way. For example, if HASSECURITY and HASNOSOCKSECURITY
1822 are defined at compile time, this lsof invocation, run by a
1823 non-root user:
1824
1825 $ lsof -V -c inetd
1826
1827 won't report that it can't find the inetd command, even if
1828 there is a process running the inetd command, because the
1829 HASSECURITY and HASNOSOCKSECURITY options prevent the
1830 listing of all but the socket files of another user, and
1831 no socket file selector (e.g., "-i") was specified.
1832
1833
1834 3.18 Portmap problems
1835
1836 3.18.1 Why isn't a name displayed for the portmap registration?
1837
1838 When portmap registration reporting is enabled, any time
1839 there is a registration for a local TCP or UDP port, lsof
1840 displays it in square brackets, following the port number
1841 or service name -- e.g., ``:1234[name]'' or ``:name[100083]''.
1842
1843 The TCP or UDP port number or service number (what follows
1844 the `:') is displayed under the control of the lsof -P
1845 option. The registration identity is held by the portmapper
1846 and may be a name or a number, depending on how the
1847 registration's owner declared it. Lsof reports what the
1848 port map holds and cannot derive a registration name from
1849 a registration number.
1850
1851 Lsof can be compiled with registration reporting enabled
1852 or disabled by default, under the control of the HASPMAPENABLED
1853 #define (usually in machine.h). The lsof help panel (`lsof
1854 -h`) will show the default. Lsof is distributed with
1855 reporting disabled by default.
1856
1857 3.18.2 How can I display only portmap registrations?
1858
1859 Lsof doesn't have an option that will display only TCP or
1860 UDP ports with portmap registrations. The +M option only
1861 enables the reporting of registration information when
1862 Internet socket files are displayed; +M doesn't select
1863 the displaying of Internet socket files -- the -i option
1864 does that.
1865
1866 This simple lsof pipe to grep will do the job:
1867
1868 $ lsof -i +M | grep "\["
1869
1870 This works because -i selects Internet socket files, +M
1871 enables portmap registration reporting, and only output
1872 lines with opening square brackets will have registrations.
1873
1874 When portmap registration reporting is enabled by default,
1875 because the lsof builder constructed it that way, +M is
1876 not necessary. (The lsof help panel, produced with `lsof
1877 -h` will display the default portmapper registration
1878 reporting state.) However, specifying +M when reporting
1879 is already enabled is acceptable, as is specifying -M when
1880 reporting is already disabled.
1881
1882 Digression: lsof will accept `+' or `-' as a prefix to most
1883 options. (That isn't documented in the man page or help
1884 panel to reduce confusion and complexity.) The -i option
1885 is as acceptable as +i, so the above example could be
1886 written a little more tersely as:
1887
1888 $ lsof +Mi | grep "\["
1889
1890 But be careful to use the ``Mi'' ordering, since ``iM''
1891 implies M is an address argument to `i'.
1892
1893 3.18.3 Why doesn't lsof report portmap registrations for some ports?
1894
1895 Lsof reports portmap registrations for local TCP and UDP
1896 ports only. It identifies local ports this way:
1897
1898 * The port appears in the local address section of the
1899 kernel structure that contains it.
1900
1901 * The port appears in the foreign address section of a
1902 kernel structure whose local and foreign Internet
1903 addresses are the same.
1904
1905 * The port appears in the foreign address section of a
1906 kernel address structure whose Internet address is
1907 INADDR_LOOPBACK (127.0.0.1).
1908
1909 Following these rules, lsof ignores foreign portmapped
1910 ports. That's done for reasons of efficiency and possible
1911 security prohibitions. Contacting all remote portmappers
1912 could take a long time and be blocked by network difficulties
1913 (i.e., be inefficient). Many firewalls block portmapper
1914 access for security reasons.
1915
1916 Lsof may occasionally ignore portmap registration information
1917 for a legitimate local port by virtue of its local port
1918 rules. This can happen when a port appears in the foreign
1919 part of its kernel structure and the local and foreign
1920 Internet addresses don't match (perhaps because they're on
1921 different interfaces), and the foreign Internet address
1922 isn't INADDR_LOOPBACK (127.0.0.1).
1923
1924 3.18.4 Why doesn't lsof report portmap registrations for some Solaris
1925 versions?
1926
1927 In some versions of Solaris -- 9 and 10 are known to exhibit
1928 this problem -- lsof is unable to display portmap registrations.
1929
1930 This portmap registration reporting failure occurs when the
1931 Solaris netconfig field (in /etc or etc/inet) has its first two
1932 non-comment lines enabling tcp6 and udp6. When netconfig is
1933 configured in that fashion, lsof's attempt to read the portmap
1934 via an RPC function fails.
1935
1936 I don't have an explanation for the failure, but this comment
1937 in the netconfig(4) man page appears to have some bearing on
1938 the problem:
1939
1940 # The following two entries starting with udp6 and tcp6 are
1941 # meant to be used for IPv6. If you have Ipv6 enabled on your
1942 # machine then you can uncomment these two lines to enable
1943 # RPC and NFS to use the Ipv6 stack.
1944 ...
1945 #udp6 tpi_clts v inet6 udp /dev/udp6 -
1946 #tcp6 tpi_cots_ord v inet6 tcp /dev/tcp6 - "
1947
1948 My interpretation of that comment is that there is a different
1949 RPC interface to the portmap when IPv6 is enabled. However, I
1950 can't find any documentation on it in the RPC man pages. If
1951 anyone has information on it, please send it to me at
1952 <abe@purdue> and put "lsof Solaris portmap" in the subject
1953 line.
1954
1955 A work-around may be to move the ucp6 and tcp6 lines after the
1956 udp and tcxp lines in netconfig. I don't know if that change
1957 has any unacceptable consequences, but it works for me on my
1958 Solaris 9 test system, and I have a report that it also works
1959 on Solaris 10.
1960
1961
1962 3.19 Why is `lsof | wc` bigger than my system's open file limit?
1963
1964 There is a strong temptation to count open files by piping
1965 lsof output to wc. If your purpose is to compare the number
1966 you get to some Unix system parameter that defines the
1967 number of open files your system can have, resist the
1968 temptation.
1969
1970 One reason is that lsof reports a number of "files" that
1971 don't occupy Unix file table space -- current working
1972 directories, root directories, jail directories, text files,
1973 library files, memory mapped files are some. Another reason
1974 is that lsof can report a file shared by more than one
1975 process that itself occupies only one file table slot.
1976
1977 If you want to know the number of open files that occupy
1978 file table slots, use the +ff option and process the lsof
1979 output's FILE_ADDR column information with standard Unix
1980 tools like cut, grep, sed, and sort.
1981
1982 You might also consider using use lsof's field output with
1983 +ff, selecting the file struct address with -FF, and
1984 processing the output with an AWK or Perl script. See the
1985 list_fields.awk, list_fields.perl, and shared.perl5 scripts
1986 in the scripts/ subdirectory of the lsof distribution for
1987 hints on file struct post-processing filters.
1988
1989 3.20 Why doesn't lsof report file offset (position)?
1990
1991 Lsof won't report a file offset (position) value if the -s
1992 option (without parameters) has been specified, or if the
1993 dialect doesn't support the displaying of file offset
1994 (position). (Note that on selected dialects the help output,
1995 obtained with -h or -?, may show that the -s option can also be
1996 supplied the "p:s" parameters; for more information on that
1997 addition, see the answer to the "How are protocol state name
1998 exclusion and inclusion used?" question.)
1999
2000 That lsof is reporting only file size is indicated by the
2001 fact that the appropriate column header says SIZE instead
2002 of SIZE/OFF.
2003
2004 If lsof doesn't support the displaying of file offset
2005 (position) -- e.g., for Linux /proc-based lsof -- the -h
2006 or -? output panel won't list the -o option.
2007
2008 Sometimes the availability of file offset information
2009 depends on the dialect's kernel. This is particularly true
2010 for socket file offsets.
2011
2012 Maintenance of offsets for pseudo-terminal devices varies
2013 by UNIX dialect and is related to how the dialect kernel
2014 implements pseudo-terminal support. Kernels like AIX, for
2015 example, that short-circuit the transfer of data between
2016 socket and pseudo devices to reduce TCP/IP daemon interrupt
2017 rates won't advance offsets in the TCP/IP daemon socket
2018 files. Instead they will advance offsets in the open
2019 standard I/O files of the shell child precess where the
2020 pseudo-terminal devices are used.
2021
2022 When in doubt about the behavior of lsof in reporting file
2023 offset information, do some carefully measured experiments,
2024 consult the lsof sources, or contact me at <[email protected]>
2025 to discuss the matter. Please follow the reporting guidelines
2026 in the "How do I report an lsof bug?" section of this FAQ.
2027
2028 3.20.1 What does lsof report for size when the file doesn't really have
2029 one?
2030
2031 When a file has no true size -- e.g., it's a socket, a
2032 FIFO, or a pipe -- lsof tries to report the information it
2033 finds in the kernel that describes the contents of associated
2034 kernel buffers.
2035
2036 Thus, for example, size for most TCP/IP files is socket
2037 buffer size. The size of the socket read buffer is reported
2038 for read-only files; the size of the write buffer for
2039 write-only files; and the sum of the buffers sizes for
2040 read-write files.
2041
2042 3.21 Problems with path name arguments
2043
2044 3.21.1 How do I ask lsof to search a file system?
2045
2046 You can ask lsof to search for all open files on a file
2047 system by specifying its mounted path name as an lsof
2048 argument -- e.g.,
2049
2050 $ lsof /
2051
2052 Output of the mount command will show file system mounted
2053 path names. It will also show the mounted-on device path
2054 for the file system.
2055
2056 If the mounted-on device is a block device (the permission
2057 field in output of `ls -l <device>` starts with a `b/),
2058 you can specify its name, too -- e.g.,
2059
2060 $ lsof /dev/sd0a
2061
2062 If the mounted-on device isn't a block device -- for example,
2063 some UNIX dialects call a CD-ROM device a character device
2064 (ls output starts with a `c') -- you can force lsof to
2065 assume that the specified device names a file system with
2066 the +f option -- e.g.,
2067
2068 $ lsof +f -- /dev/sd0a
2069
2070 (Note: you must use ``--'' after +f or -f if a file name
2071 follows immediately, because +f and -f can be followed by
2072 characters that specify flag output selections.)
2073
2074 When you use +f and lsof can't match the device to a file
2075 system, lsof will issue a complaint.
2076
2077 The +f option may be used in some dialects to ask lsof to
2078 search for an NFS file system by its server name and server
2079 mount point. If the mount application reports an NFS file
2080 system mounted-on value that way, then this sample lsof
2081 request should work.
2082
2083 $ lsof +f -- fleet:/home/fleet/u5
2084
2085 Finally, you can use -f if you don't want a mounted file
2086 system path name to be considered a request to report all
2087 open files on the file system. This is useful when you
2088 want to know if anyone is using the file system's mounted
2089 path name. This example directs lsof to report on open
2090 access to the `/' directory, including when it's being used
2091 as a current working or root directory.
2092
2093 $ lsof -f -- /
2094
2095 The lsof -f option performs the same function as -f does
2096 in some fuser implementations. However, since the lsof -c
2097 option was chosen for another purpose before the `f' option
2098 was added to lsof, +f was selected as the analogue to the
2099 fuser -c option. (Sorry for the potential confusion.)
2100
2101 3.21.2 Why doesn't lsof find all the open files in a file system?
2102
2103 Lsof may not find all the open files in a file system for
2104 several reasons.
2105
2106 First, some processes with files open on the file system
2107 may have been changing status when lsof examined the process
2108 table, and lsof "missed" them. Remember, the kernel changes
2109 much faster than lsof can respond to the changes.
2110
2111 Second, be sure you have specified the file system correctly.
2112 Perhaps you specified a file instead. You can use lsof's
2113 -V option to have lsof report in detail on what it couldn't
2114 find. Make sure the report for the file system you specified
2115 says "file system." Here's some -V output:
2116
2117 $ /lsof -V /tmp ./lsof.h ./lsof
2118 COMMAND PID USER FD TYPE DEVICE SIZE/OFF INODE NAME
2119 lsof 2688 abe txt VREG 18,1,7 1428583 226641 ./lsof
2120 lsof 2689 abe txt VREG 18,1,7 1428583 226641 ./lsof
2121 lsof: no file use located: ./lsof.h
2122
2123 You can also use lsof's +f option to force it to consider
2124 a path name as a file system. If lsof can't find a file
2125 system by the specified name, it will issue a complaint --
2126 e.g.,
2127
2128 $ lsof +f -- /usr
2129 lsof: not a file system: /usr
2130
2131 (/usr is a directory in the / file system.)
2132
2133 3.21.3 Why does the lsof exit code report it didn't find open files
2134 when some files were listed?
2135
2136 Sometimes lsof will list some open files, yet return a
2137 non-zero exit code, suggesting it hasn't found all the
2138 specified files.
2139
2140 The first thing you should when you suspect lsof is incorrect
2141 is to repeat the request, adding the -V option. In the
2142 resulting report you may find that your file system
2143 specification really wasn't a file system specification,
2144 just a file specification.
2145
2146 Finally, if you specify two files or two file systems twice,
2147 lsof will credit all matches to the first of the two and
2148 believe that there were no matches for the second. It's
2149 possible to specify a single file system twice with different
2150 path names by using both its mounted directory path name
2151 and mounted-one device name.
2152
2153 $ lsof +f -V spcuna:/sysprog /sysprog
2154 COMMAND PID USER FD TYPE DEVICE SIZE/OFF INODE NAME
2155 ksh 11092 abe cwd VDIR 39,0,1 1536 226562 /sysprog
2156 (spcuna:/sysprog)
2157 ...
2158 lsof: no file system use located: spcuna:/sysprog
2159
2160 All matches were credited to /sysprog; none to spcuna:/sysprog.
2161
2162 3.21.4 Why won't lsof find all the open files in a directory?
2163
2164 When you give lsof a simple directory path name argument
2165 (not a file system mounted-on name), you are asking it to
2166 search for processes that have the directory open as a
2167 file, or as a process-specific directory -- e.g., root or
2168 current working directory.
2169
2170 If you want to list instances of open files inside the
2171 directory, you need to either specify the individual path names
2172 of those files, their common mount point, or use the lsof +D
2173 and +d options.
2174
2175 For example, if you wanted to check the files open in your /lsof
2176 folder then the following might be the quickest way to get
2177 the answer you are looking for:
2178
2179 lsof / | grep /lsof | grep -v DIR
2180
2181 See the answer to the question "Why are the +D and +d
2182 options so slow?" before you use +D or +d casually.
2183
2184 See the answer to the question "Why do the +D and +d options
2185 produce warning messages?" for an explanation of some
2186 process authority limitations of +D and +d.
2187
2188 3.21.5 Why are the +D and +d options so slow?
2189
2190 The +D and +d options cause lsof to build a path name search
2191 list for a specified directory. +D causes lsof to descend
2192 the directory to its furthest subdirectory, while +d
2193 restricts it to the top level. In both cases, the specified
2194 directory itself is included in the search list. In both
2195 symbolic links are ignored.
2196
2197 Building such a search list can take considerable time,
2198 especially when the specified directory contains many files
2199 and subdirectories -- lsof must call the system readlink()
2200 and stat() functions for each file and directory. Storing
2201 the search list can cause lsof to use more than its normal
2202 amount of dynamic memory -- each file recorded in the search
2203 list consumes dynamic memory for its path name, characteristics,
2204 and search linkages. Using the list means lsof must search
2205 it for every open file in the system.
2206
2207 Building the search list for a directory specified on some
2208 file systems can be slow -- e.g., for an NFS directory with
2209 many files. Some file systems have special logging features
2210 that can introduce additional delays to the building of
2211 the search list -- e.g., NFS logging, or logging on a
2212 Solaris UFS file system. The bottom line is that slow
2213 search list construction may not be so much an lsof problem
2214 as a file system problem. (Hint: if you're using Solaris
2215 UFS logging, consider specifying the "logging,noatime"
2216 option pair to reduce the number of atime writes to the
2217 UFS logging queue and disk.)
2218
2219 A somewhat risky way to speed up lsof's building of the
2220 search list is to use lsof's ``-O'' option. It forces lsof
2221 to do all system calls needed to build the search list
2222 directly, rather than in a child process. While direct
2223 system calls are much faster, they can block in the kernel
2224 -- e.g., when an NFS server stops responding -- stopping
2225 lsof until the kernel operation unblocks.
2226
2227 As an example of the load +D can impose, consider that an
2228 `lsof +D /` on a lightly loaded NeXT '040 cube with a 1GB
2229 root file system disk took 4+ minutes of real time. It
2230 also generated several hundred error messages about files
2231 and directories the lsof process didn't have permission to
2232 access with stat(2).
2233
2234 The bottom line is that +D and +d should be used cautiously.
2235 +D is more costly than +d for deeply nested directory trees,
2236 because of the full directory descent it causes. So use
2237 +d where possible. And you might need to consider the
2238 performance of the file system that holds the directory
2239 you name with +d or +D.
2240
2241 In view of these warnings, when is it appropriate to use
2242 +D or +d? Probably the most appropriate time is when you
2243 would specify the directory's contents to lsof with a shell
2244 globbing construct -- e.g., `lsof *`. If that's what you
2245 need to do, `lsof +d .` is probably more efficient than
2246 having the shell produce a directory list, form it into an
2247 argument vector, and pass the vector to lsof for it to
2248 unravel.
2249
2250 See the answer to the question "Why do the +D and +d options
2251 produce warning messages?" for an explanation of some
2252 process authority limitations of +D and +d.
2253
2254 3.21.6 Why do the +D and +d options produce warning messages?
2255
2256 +D and +d option processing is limited by the authority of
2257 the lsof process -- i.e., lsof can only examine (with
2258 lstat(2) and stat(2)) files the owner of the process can
2259 access.
2260
2261 If the ownership, group membership, or permissions of the
2262 specified directory, file within it, or directory within
2263 it prevents the owner of the lsof process from using lstat(2)
2264 or stat(2) on it, lsof will issue a warning message, naming
2265 the path and giving the system's (lstat(2's or stat(2)'s)
2266 reason (errno explanation text) for refusing access.
2267
2268 As an example, assume user abc has a subdirectory in /tmp,
2269 owned by abc and readable, writable and searchable by only
2270 its owner. If user def asks lsof to search for all /tmp
2271 references with +D or +d, lsof will be unable to lstat(2)
2272 or stat(2) anything in abc's private subdirectory, and will
2273 issue an appropriate warning.
2274
2275 Lsof warnings can usually be suppressed with the -w option.
2276 However, using -w with +D or +d means that there will be
2277 no indication why lsof couldn't find an open reference to
2278 a restricted directory or something contained in it.
2279
2280 Hint: if you need to use +D or +d and avoid authority
2281 warnings, and if you have super-user power, su and use lsof
2282 with +D or +d as root.
2283
2284 3.22 Why can't my C compiler find the rpcent structure definition?
2285
2286 When you try to compile lsof your compiler may complain
2287 that the rpcent structure is undefined. The complaints
2288 may look like this:
2289
2290 >print.c: In function `fill_portmap':
2291 >print.c:213: dereferencing pointer to incomplete type
2292 >...
2293
2294 The most likely cause is that someone has allowed a BIND
2295 installation to update /usr/include/netdb.h (or perhaps
2296 /usr/include/rpc/netdb.h), removing the rpcent structure
2297 definition that lsof expects to find there.
2298
2299 Only Solaris has an automatic work-around. (See dlsof.h
2300 in dialects/sun.). The Solaris work-around succeeds because
2301 there is another header file, <rpc/rpcent.h>, with the rpcent
2302 structure definition, and there is a Solaris C pre-processor
2303 test that can tell when the BIND <netdb.h> is in place and
2304 hence <rpc/rpcent.h> must be included.
2305
2306 Doubtlessly there are similar work-arounds possible in
2307 other UNIX dialects whose header files have been "touched"
2308 by BIND, but in general I recommend restoration of the
2309 vendor's <netdb.h> and any other header files BIND might
2310 have replaced. (I think BIND replaces <resolv.h>,
2311 <sys/bitypes.h>, <sys/cdefs.h> -- and maybe others.)
2312
2313 3.23 Why doesn't lsof report fully on file "foo" on UNIX dialect
2314 "bar?"
2315
2316 Lsof sometimes won't report much information on a given
2317 file, or may even report an error message in its NAME
2318 column. That's usually because the file is of a special
2319 type -- e.g., in a file system specific to the UNIX dialect
2320 -- and I haven't used a system where the file appeared
2321 during my testing.
2322
2323 If you encounter such a situation, send me e-mail at
2324 <[email protected]> and we may be able to devise an addition to
2325 lsof that will report on the file in question. Please follow
2326 the reporting guidelines in the "How do I report an lsof bug?"
2327 section of this FAQ. Make sure "lsof" appears in the
2328 "Subject:" line so my e-mail filter won't classify your letter
2329 as Spam.
2330
2331 3.24 Why do I get a complaint when I execute lsof that some library
2332 file can't be found?
2333
2334 On systems where the LIBPATH (or the equivalent) environment
2335 variable is used to record the library search path in
2336 executable files when they are built, an incorrect value
2337 may make it impossible for the system to find the shared
2338 libraries needed to load lsof for execution.
2339
2340 This may be particularly true on systems like AIX >= 4.1.4,
2341 where the lsof Makefile takes the precautionary step of
2342 using the -bnolibpath loader flag to insure that the path
2343 to the private static lsof library is not recorded in the
2344 lsof binary. Should LIBPATH be invalid when lsof is built,
2345 it will be recorded in the lsof binary as the default
2346 library path search order and lead to an inability to find
2347 libraries when lsof is executed.
2348
2349 So, if you get missing library complaints when you try to
2350 execute lsof, check LIBPATH, or whatever environment variable
2351 is used on your system to define library search order in
2352 executable files. Use the tools at your disposal to look
2353 at the library paths recorded in the lsof binary -- e.g.,
2354 chatr on HP-UX, dump on AIX, ldd on Solaris.
2355
2356 Make sure, too, that when the correct library search path
2357 has been recorded in the executable file, the required
2358 library files exist at one or more of the search paths.
2359
2360
2361 3.25 Why does lsof complain it can't open files?
2362
2363 When lsof begins execution, unless it has been asked to
2364 report only help or version information, typically it will
2365 attempt to access kernel memory and symbol files -- e.g.,
2366 /unix, /dev/kmem. Even though lsof needs only permission
2367 to open these files for reading, read access to them might
2368 be restricted by ownerships and permission modes.
2369
2370 So the first step to diagnosing lsof problems with opening
2371 files is to use ls(1) to examine the ownerships and permission
2372 modes of the files that lsof wants to open. You may find
2373 that lsof needs to be installed with some type of special
2374 ownership or permission modes to enable it to open the
2375 necessary files for reading. See the "Installing Lsof"
2376 section of 00README for more information.
2377
2378 3.26 Why does lsof warn "compiled for x ... y; this is z."?
2379
2380 Unless warnings are suppressed (with -w) or the kernel
2381 identity check symbol (HASKERNIDCK) definition has been
2382 deleted, all but one lsof dialect version (exception:
2383 /proc-based Linux lsof) compare the identity of the running
2384 kernel to that of the one for which lsof was constructed.
2385 If the identities don't match, lsof issues a warning like
2386 this:
2387
2388 lsof: WARNING: compiled for Solaris release 5.7; this is 5.6.
2389
2390 Two kernel identity differences can generate this warning
2391 -- the version number and the release number.
2392
2393 Build and running identity differences are usually significant,
2394 because they usually indicate kernels whose structures are
2395 different -- kernel structures commonly change at dialect
2396 version releases. Since lsof reads data from the kernel
2397 in the form of structures, it is sensitive to changes in
2398 them. The general rule is that an lsof compiled for one
2399 UNIX dialect version will not work correctly when run on
2400 a different version.
2401
2402 There are three work-arounds: 1) use -w to suppress the
2403 warning -- and risk missing other warnings; 2) permanently
2404 disable the identity check by deleting the definition of
2405 HASKERNIDCK in the dialect's machine.h header file -- with
2406 the same risk; or 3) rebuild lsof on the system where it
2407 is to be run. (Deleting HASKERNIDCK can be done with the
2408 Customize script or by editing machine.h.)
2409
2410 Generally checking kernel identity is a quick operation
2411 for lsof. However, it is potentially slow under AIX, where
2412 lsof must run /usr/bin/oslevel. To speed up lsof, use -w
2413 to suppress the /usr/bin/oslevel test. See "Why does AIX
2414 lsof start so slowly?" for more information.
2415
2416 3.27 How can I disable the kernel identity check?
2417
2418 The kernel identity check is controlled by the HASKERNIDCK
2419 definition. When it is defined, most dialects (exclusion:
2420 /proc-based Linux lsof) will compare the build-time kernel
2421 identity with the run-time one.
2422
2423 To disable the kernel identity check, disable the HASKERNIDCK
2424 definition in the dialect's machine.h header file. The
2425 Customize script can be used to do that in its section
2426 about the kernel identity check.
2427
2428 Caution: while disabling the kernel identity check may
2429 result in smaller lsof startup overhead, it comes with the
2430 risk of executing an lsof that may produce warning messages,
2431 error messages, incorrect output, or no output at all.
2432
2433 3.28 Why don't ps(1) and lsof agree on the owner of a process?
2434
2435 Generally the user ID lsof reports in its USER column is
2436 the process effective user ID, as found in the process
2437 structure. Sometimes that may not agree with what ps(1)
2438 reports for the same process.
2439
2440 There are sundry reasons for the difference. Sometimes
2441 ps(1) uses a different source for process information,
2442 e.g., the /proc file system or the psinfo structure.
2443 Sometimes the kernel is lax or confused (e.g., Solaris
2444 2.5.1) about what ID to report as the effective user ID.
2445 Sometimes the system carries only one user ID in its process
2446 structure (some BSD derivatives), leaving lsof no choice.
2447
2448 The differences between lsof and ps(1) user identifications
2449 should be small and normally it will be apparent that the
2450 confusion is over a process whose application has changed
2451 to an effective user ID different from the real one.
2452
2453 3.29 Why doesn't lsof find an open socket file whose connection
2454 state is past CLOSE_WAIT?
2455
2456 TCP/IP connections in states past CLOSE_WAIT -- e.g.,
2457 FIN_WAIT_1, CLOSING, LAST_ACK, FIN_WAIT_2, and TIME_WAIT
2458 -- don't always have open files associated with them. When
2459 they don't, lsof can't identify them. When the connection
2460 state advances from CLOSE_WAIT, sometimes the open file
2461 associated with the connection is deleted.
2462
2463 3.30 Why don't machine.h definitions work when the surrounding
2464 comments are removed?
2465
2466 The machine.h header files in dialect subdirectories have
2467 some commented-out definitions like:
2468
2469 /* #define HASSYSDC "/your/choice/of/path */
2470
2471 You can't simply remove the comments and expect the definition
2472 to work. That's intended to make you think about what
2473 value you are assigning to the symbol. The assigned value
2474 might have a system-specific convention. HASSYSDC, for
2475 example, might be /var/db/lsof.dc for FreeBSD, but it might
2476 be /var/adm/lsof.dc for Solaris.
2477
2478 Symbols defined in the lsof documentation are described in
2479 00PORTING, other machine.h comments, and other lsof
2480 documentation files. HASSYSDC, for example, is discussed
2481 in 00DCACHE. When comments and documentation don't suffice,
2482 consult the source code for hints on how the symbol is
2483 used.
2484
2485 3.31 What do "can't read inpcb at 0x...", "no protocol control
2486 block", "no PCB, CANTSENDMORE, CANTRCVMORE", etc. mean?
2487
2488 Sometimes lsof will report "can't read inpcb at 0x00000000",
2489 "no protocol control block", "no PCB, CANTSENDMORE,
2490 CANTRCVMORE" or a similar message in the NAME column for
2491 open TCP socket files. These messages mean the file's socket
2492 structure lacks a pointer to the INternet Protocol Control
2493 Block (inpcb) where lsof expects to find connection addresses
2494 -- local and foreign ports, local and foreign IP addresses.
2495 The socket file has probably been submitted to the shutdown(2)
2496 function for processing.
2497
2498 In some implementations lsof issues the "no PCB, CANTSENDMORE,
2499 CANTRCVMORE" message, which tries to explain the absence
2500 of a protocol control block by showing the socket state
2501 settings that have been made by the shutdown(2) function.
2502
2503 If a non-zero address follows the "0x" in the "can't read
2504 inpcb" message, it means lsof couldn't read inpcb contents
2505 from the indicated address in kernel memory.
2506
2507 3.32 What do the "unknown file system type" warnings mean?
2508
2509 Lsof may report a message similar to"
2510
2511 unknown file system type, v_op: 0x10472f10
2512
2513 in the NAME column for some files.
2514
2515 This means that lsof has encountered a vnode for the file
2516 whose operation switch address (from v_op) references a
2517 file system type for which there is no support in lsof.
2518 After lsof identifies the file system type, it uses
2519 pre-compiled code to locate the file system specific node
2520 for the file where lsof finds information like file size,
2521 device number, node number, etc.
2522
2523 To get some idea of what the file system type might be,
2524 use nm on your kernel symbol file to locate the symbol name
2525 that corresponds to the v_op address -- e.g., on Solaris
2526 do:
2527
2528 $ nm -x /dev/ksyms | grep 0x10472f10
2529 0x10472f10 ... |file_system_name_vnodeops
2530
2531 Where "file_system_name" is the clue to the unsupported
2532 file system.
2533
2534 Lsof doesn't use the v_op address to identify file system
2535 types on all dialects. Sometimes it uses an index number
2536 it finds in the vnode. It will translate that symbol to
2537 a short name in the warning message -- e.g., "nfs3" -- if
2538 possible.
2539
2540 3.33 Installation
2541
2542 3.33.1 How do I install lsof?
2543
2544 There is no "standard" way to install lsof. Too much
2545 depends on local conditions for me to be able to provide
2546 working install rules in the lsof make files. (The skeleton
2547 install rules you will find just give "hints.") See the
2548 "Installing Lsof" section of 00README for a fuller explanation.
2549
2550 To install lsof you will need to consider these questions:
2551
2552 * Who should be able to use lsof? (See HASSECURITY and
2553 HASNOSOCKSECURITY in the "Security" section of 00README.)
2554
2555 * Where should lsof be installed? This is a decision
2556 mostly dictated by local conditions. Somewhere in
2557 /usr/local -- etc/ or sbin/ -- is a common choice.
2558
2559 * What permissions should I give the lsof executable?
2560 The answer to this varies by dialect. The make files
2561 have install rules that give hints. The "Installing
2562 Lsof" section of 00README gives information, too.
2563
2564 * What if I want to install lsof in a shared file system
2565 for machines that require different lsof configurations?
2566 See the next question and answer, "How do I install a
2567 common lsof when I have machines that need differently
2568 constructed lsof binaries?"
2569
2570 3.33.2 How do I install a common lsof when I have machines that
2571 need differently constructed lsof binaries?
2572
2573 A dilemma that faces some system administrators when they
2574 install lsof in a shared file system -- e.g., NFS -- is
2575 that they must have different lsof executables for different
2576 systems.
2577
2578 The answer is to build an lsof wrapper script that is
2579 executed in place of lsof. The script can use system
2580 commands to determine which lsof binary should be executed.
2581
2582 Consider this example. You have HP-UX machines with 32
2583 and 64 bit kernels that share the /usr/local/sbin directory
2584 where you want to install lsof. Consequently, on each
2585 system you must use a different lsof executable, built for
2586 the system's bit size. (That's because lsof reads kernel
2587 structures, sized by the kernel's bit size.)
2588
2589 One answer is to install three things in /usr/local/sbin:
2590 1) a 32 bit lsof as lsof32; 2) a 64 bit lsof as lsof64;
2591 and 3) an lsof script. The script might look like this
2592 one, based on work by Amir J. Katz:
2593
2594 #!/bin/sh
2595 x=`/usr/bin/getconf KERNEL_BITS` # returns 32 or 64
2596 if /usr/bin/test "X$x" = "X32"
2597 then
2598 lsof32 $*
2599 else
2600 if /usr/bin/test "X$x" = "X64"
2601 then
2602 lsof64 $*
2603 else
2604 echo "Can't determine which lsof executable to use;"
2605 echo "getconf KERNEL_BITS says: $x"
2606 exit 1
2607 fi
2608 fi
2609
2610 Solaris users should consult "How do I install lsof for
2611 Solaris 7, 8 or 9?" for information on a similar trick
2612 using the Solaris isaexec command.
2613
2614 Users of other dialects might be able to use a command like
2615 uname(1) that can identify a distinguishing feature of the
2616 system to be incorporated in pre-installed lsof executable
2617 names. For example, use `uname -r` and install binaries
2618 with suffixes that match `uname -r` output.
2619
2620 3.34 Why do lsof 4.53 and above reject device cache files built
2621 by earlier lsof revisions?
2622
2623 When lsof revisions 4.53 run and encounter a device cache
2624 file built by an earlier revision, it will reject the file
2625 and build a new one. The rejection will be advertised with
2626 these messages:
2627
2628 lsof: WARNING: no /dev device in <name>: 2 sections
2629 ...
2630 lsof: WARNING: created device cache file: <name>
2631
2632 This happens because the header line of the device cache
2633 file was changed at revision 4.53 to contain the number of
2634 the device on which the device directory resides. The old
2635 device cache file header line -- the "2 sections" line in
2636 the above warning message, node reads "2 sections, dev=600".
2637
2638 This is not a serious problem, since lsof automatically
2639 rebuilds the device cache file with the correct header
2640 line.
2641
2642 3.35 What do "like block special" and "like character special" mean
2643 in the NAME column?
2644
2645 When lsof comes across an open block or character file
2646 whose device, raw device and inode place it somewhere other
2647 than /dev (or /devices), lsof doesn't report the /dev (or
2648 /devices) name in the NAME column. Instead lsof reports
2649 the file system name and device or path name in the NAME
2650 column and parenthetically adds "like block special <path>"
2651 or "like character special <path>".
2652
2653 The value for <path> will point to a block or character
2654 device in /dev (or /devices) whose raw device number matches
2655 that of the open file being reported, but whose device
2656 number or node number (or both) don't match.
2657
2658 Such an open file is connected to a device node that has
2659 been created in a directory other than /dev (or /devices.)
2660 See mknod(8) for information on how such nodes are created.
2661 (Generally one needs root power to create device nodes with
2662 mknod.)
2663
2664 3.36 Why does an lsof make fail because of undefined symbols?
2665
2666 When lsof is compiled via the `make` step and the final
2667 load step fails because of missing symbols, the problem
2668 may not be lsof. The problem may be that ld, called by
2669 the compiler as part of the `make` step, can't find some
2670 library that lsof needs.
2671
2672 First check the last compiler line of the make operation
2673 -- e.g., the last line with cc or gcc in it before the
2674 undefined symbol report -- for loader arguments, i.e.,
2675 ones beginning with "-l". Except for "-llsof" the rest
2676 name system libraries. ("-L./lib" precedes "-llsof" to
2677 tell the loader its location.)
2678
2679 Check that all the named system libraries exist. Look in
2680 /lib and /usr/lib as a start, but that may not be the only
2681 place system libraries live. Consult your dialect's
2682 documentation, e.g., the compiler and loader man pages,
2683 for other possible locations.
2684
2685 If some system library doesn't exist, that may mean it was
2686 never installed or was removed. You'll have to re-install
2687 the missing library.
2688
2689 You may find that all the system libraries lsof uses exist.
2690 Your next step might be to use nm and grep to see if any
2691 of them contain the undefined symbols.
2692
2693 $ nm library | grep symbol
2694
2695 If the undefined symbol exists in some library named by
2696 the lsof make step, then you might have a problem with some
2697 environment variable that controls the load step. The most
2698 common is LD_LIBRARY_PATH. It may have a setting that
2699 causes ld to ignore a directory containing a library lsof
2700 names. If this is the case, try unsetting LD_LIBRARY_PATH
2701 in the environment of the ld process -- e.g., do:
2702
2703 $ unset LD_LIBRARY_PATH
2704 or
2705 % unsetenv LD_LIBRARY_PATH
2706
2707 Consult your ld man page for other environment variables
2708 that might affect library searching -- e.g., LIBPATH, LPATH,
2709 SHLIB_PATH, etc.
2710
2711 If the undefined function doesn't exist in any libraries
2712 lsof names, check other libraries. See if the function
2713 has a man page that names its library. If the latter is
2714 true, please let me know, because that is an lsof problem
2715 I need to fix.
2716
2717 If none of these solutions work for you, send me some
2718 documentation via e-mail at <[email protected]>. Include `uname
2719 -a` output, the output of the lsof `Configure ...` and `make`
2720 steps, and the contents of the environment in force when the
2721 `make` step was executed -- e.g., `env` or `printenv` output.
2722 If you've located the libraries lsof names, send me that
2723 information, too. Make sure "lsof" appears in the "Subject:"
2724 line so my e-mail filter won't classify your letter as Spam.
2725
2726 3.37 Command Regular Expressions (REs)
2727
2728 3.37.1 What are basic and extended regular expressions?
2729
2730 Lsof's ``-c'' option allows the specification of regular
2731 expressions (REs), enclosed in two slash ('/') characters and
2732 followed by these modifiers:
2733
2734 b the RE is a basic RE.
2735 i ignore case.
2736 x the RE is an extended RE (the default).
2737
2738 Note: the characters of the regular expression may need to
2739 be quoted to prevent their expansion by the shell.
2740
2741 Example: this RE is an extended RE that matches exactly
2742 four characters, whose third may be an upper ('O') or lower
2743 case ('o') oh:
2744
2745 -c /^..o.$/i
2746
2747 For simplicity's sake, an RE that is acceptable to egrep(1)
2748 is usually called an extended RE.
2749
2750 REs suitable for the old line editor, ed(1), are often
2751 called basic REs (and sometimes also called obsolete).
2752
2753 These are some ways basic REs usually differ from extended
2754 REs. (There are other differences.)
2755
2756 * `|', `+', `?', '{', and '}' are ordinary characters.
2757
2758 * `^' is an ordinary character except at the beginning of
2759 the RE.
2760
2761 * `$' is an ordinary character except at the end of the
2762 RE.
2763
2764 * `*' is an ordinary character if it appears at the
2765 beginning of the RE.
2766
2767 For more information on REs and the distinction between
2768 basic and extended REs, consult your dialect's man pages
2769 for ed(1), egrep(1), sed(1), and possibly regex(5) or
2770 regex(7).
2771
2772 3.37.2 Why can't I put a slash in a command regular expression?
2773
2774 Since a UNIX command name is the last part of a path to
2775 the command's executable, the lsof command regular expression
2776 (RE) syntax uses slash ('/') to mark the beginning and end
2777 of an RE. Slash may not appear in the RE and the `\'
2778 back-slash escape is ineffective for "hiding" it.
2779
2780 More likely than not, if you try to put a slash in an lsof
2781 command RE, you'll get this response:
2782
2783 $ lsof -s/.\// ...
2784 lsof: invalid regexp modifier: /
2785
2786 Lsof is complaining the first character it found after
2787 the second slash isn't an lsof command RE modifier -- 'b',
2788 'i', or 'x'.
2789
2790 3.37.3 Why does lsof say my command regular expression wasn't found?
2791
2792 When you use both forms of lsof's -c option --
2793 ``-c <command>'' and ``-c /RE/[m]'' -- and ask that lsof
2794 do a verbose search (``-V''), you may be surprised that
2795 lsof will say that the regular expression wasn't found.
2796
2797 This can happen if the ``-c <command>'' form matches first,
2798 because then the ``-c/RE/[m]'' test will never have been
2799 applied. For example:
2800
2801 $ ./lsof -clsof -c/^..o.$/ -V -adcwd
2802 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
2803 lsof 7850 abe cwd VDIR 6,0 2048 96442 / (/dev/sd0a)
2804 lsof: no command found for regex: ^..o.$
2805
2806 The ``-clsof'' option matched first, so the ``-c/^..o.$/
2807 option wasn't tested.
2808
2809 3.38 Why doesn't lsof report on shared memory segments?
2810
2811 Lsof reports on shared memory segments only if they're
2812 associated with an open file. That's consistent with lsof's
2813 mission -- to LiSt Open Files. Shared memory segments with
2814 no file associations aren't open files.
2815
2816 That's not to say that a report on shared memory segments
2817 and their associated processes wouldn't be useful. But it
2818 calls for a new tool, not more baggage for lsof.
2819
2820 3.39 Why does lsof report two instances of itself?
2821
2822 When you ask lsof to report all open files and it has
2823 permission to do so, you may see two lsof processes in the
2824 output. The processes are connected via pipes -- e.g.,
2825 here's an HP-UX 11 example.
2826
2827 COMMAND PID USER FD TYPE DEVICE ...
2828 ...
2829 lsof 29450 abe 7w PIPE 0x48732408 ...
2830 lsof 29450 abe 8r PIPE 0x48970808 ...
2831 ...
2832 lsof 29451 abe 6r PIPE 0x48732408 ...
2833 lsof 29451 abe 9w PIPE 0x48970808 ...
2834
2835 The first process will usually be the lsof you initiated;
2836 the second, an lsof child process that is used to isolate
2837 its parent process from kernel functions that can block --
2838 e.g., readlink() or stat().
2839
2840 Information to and from the kernel functions is exchanged
2841 via the two pipes. When the parent process detects that
2842 the child process has become blocked, it attempts to kill
2843 the child. Depending on the UNIX dialect that may succeed
2844 or fail, but the parent won't be blocked in any event.
2845
2846 See the "BLOCKS AND TIMEOUTS" and "AVOIDING KERNEL BLOCKS"
2847 sections of the lsof man page for more information on why
2848 the child process is used and how you can specify lsof
2849 options to avoid it. (Caution: that may be risky.)
2850
2851 3.40 Why does lsof report '\n' in device cache file error messages?
2852
2853 Lsof revisions prior to 4.58 may report '\n' in error
2854 messages it delivers about problems in the device cache
2855 file -- e.g.,
2856
2857 lsof: WARNING: no ...: 4 sections\n
2858
2859 That's deliberately done to show the exact contents of the
2860 device cache file line about which lsof is complaining,
2861 including its terminating NL (New Line) '\n' character.
2862 In the above example the line in the device cache file
2863 causing the lsof complaint contains "4 sections" and ends
2864 with a '\n'.
2865
2866 At revision 4.58 and above, device cache error messages
2867 like the one in the above example have been changed to
2868 read:
2869
2870 lsof: WARNING: no ...: line "4 sections"
2871
2872 The terminal '\n' is no longer reported, the line contents
2873 are enclosed in double quote marks ('"'), and the word
2874 "line" has been added as a prefix to denote that what
2875 follows is a line from the device cache file.
2876
2877 3.41 Kernel Symbol and Address Problems
2878
2879 3.41.1 What does "lsof: WARNING: name cache hash size length error: 0"
2880 mean?
2881
2882 When run on some systems, lsof may issue this warning:
2883
2884 lsof: WARNING: name cache hash size length error: 0
2885
2886 That is an example from a FreeBSD system where lsof reads
2887 the kernel's _nchash variable and finds its value is zero.
2888
2889 Similar warnings include:
2890
2891 WARNING: kernel name cache size:
2892 WARNING: can't read kernel's name cache:
2893 WARNING: no name cache address
2894 WARNING: name cache hash size length error:
2895 WARNING: unusable name cache size:
2896
2897 These warnings are issued when lsof is attempting to read
2898 the kernel's name cache information. They are usually the
2899 result of a mis-match between the addresses for kernel
2900 symbols lsof gets via nlist(2) and the addresses in use by
2901 the kernel.
2902
2903 Lsof usually gets kernel symbol addresses from what it
2904 believes to be the kernel boot file. In FreeBSD, for
2905 example, that's the path returned by getbootfile(3), usually
2906 /kernel. The boot file can have other names in other UNIX
2907 dialects -- /unix, /vmunix, /bsd, /netbsd, /mach, /stand/vmunix,
2908 etc.
2909
2910 Lsof will get incorrect (mismatched) addresses from the
2911 boot file if it has been replaced by a newer one which
2912 hasn't yet been booted -- e.g., if this is done in FreeBSD:
2913
2914 # mv /kernel /kernel.OLD
2915 # mv /kernel.NEW /kernel
2916
2917 Until the FreeBSD system is rebooted, the booted kernel is
2918 /kernel.OLD, but getbootfile() says it is /kernel. If
2919 symbol addresses important to lsof in /kernel.OLD and
2920 /kernel don't match, the lsof WARNING messages result.
2921
2922 3.41.2 Why does lsof produce "garbage" output?
2923
2924 Kernel name cache warnings may not be the only sign that
2925 lsof is using incorrect symbol addresses to read kernel
2926 values. If there's no reasonable test lsof can make on
2927 what it reads from the kernel, it may issue other warnings
2928 or even report nonsensical results.
2929
2930 The warnings may appear on STDERR, such as:
2931
2932 lsof: can't read proc table info
2933
2934 Or the warnings may appear in the NAME column as messages
2935 saying lsof can't read or interpret some kernel structure --
2936 e.g.,
2937
2938 ... NAME
2939 ... can't read file struct from 0x12345
2940
2941 One possible work-around is to point lsof's kernel symbol
2942 address gathering at the proper boot file. That can be
2943 done with lsof's -k option -- e.g.,
2944
2945 $ lsof -k /kernel.OLD
2946
2947 The best work-around is to make sure the standard boot file
2948 is properly sited -- e.g., if you've moved a new /kernel
2949 in place, boot it.
2950
2951 3.42 Why does lsof report open files when run as super user that
2952 it doesn't report when run with lesser privileges?
2953
2954 The most likely cause is that the HASSECURITY option was
2955 selected when the lsof executable was built.
2956
2957 If HASSECURITY is defined when lsof is built, and lsof is
2958 run with the privileges of a non-ROOT user, it will only
2959 list open files belonging to the user. The same lsof
2960 executable, when run with root user privileges, will list
2961 all open files.
2962
2963 However, if HASSECURITY and HASNOSOCKSECURITY are both
2964 defined when lsof is built, lsof will list open files
2965 belonging to the user and will also list anyone else's open
2966 socket files, provided their listing is selected with the
2967 "-i" option.
2968
2969 So first ask yourself if the process whose open files lsof
2970 won't list belong to a user other than the one under which
2971 you're running lsof, and are not open socket files. If
2972 either is true, use lsof's help (-h or -?) option and look
2973 for a line near the bottom of the help panel that says:
2974
2975 "... can list all files..."
2976
2977 If the leading "..." says "Only root" then HASSECURITY was
2978 defined when lsof was built. If the trailing "..." says
2979 ", but anyone can list socket files" then HASNOSOCKSECURITY
2980 was also defined.
2981
2982 Should you want an lsof not built with HASSECURITY defined,
2983 rerun the lsof Configure script. If you let Configure do
2984 customization, make sure you answer 'n' when it asks if
2985 you want to enable HASSECURITY and HASNOSOCKSECURITY. If
2986 you don't need to do customization, you can rebuild lsof
2987 with the "-n" option to Configure. Here's an example of
2988 such a rebuild sequence:
2989
2990 $ Configure -clean
2991 $ Configure -n <dialect-abbreviation>
2992 $ make
2993
2994 More information on the HASSECURITY and HASNOSOCKSECURITY
2995 options may be found in the "Security" section of the
2996 00README file of the lsof distribution.
2997
2998 3.43 Test Suite Problems
2999
3000 3.43.1 Errors all tests can report:
3001
3002 3.43.1.1 Why do tests complain "ERROR!!! can't execute ../lsof"?
3003
3004 All tests in the test suite expect an executable lsof file
3005 to exist in the tests parent directory, ../lsof.
3006
3007 If there's none there, the tests/Makefile has a rule to
3008 make it, but there are probably circumstances where that
3009 rule may fail.
3010
3011 The work-around is to re-Configure and re-make lsof, then
3012 run the test suite.
3013
3014 3.43.1.2 Why do tests complain "ERROR!!! can't find ..." a file?
3015
3016 Many tests create (or use from a supplied environment
3017 variable path) a test file and use lsof to find it. When
3018 lsof can't file the file, the tests report the error with
3019 messages of the form:
3020
3021 ERROR!!! can't find ... : <some file path>
3022 or
3023 ERROR!!! lsof couldn't find ...
3024
3025 These type of error messages mean that the lsof field output
3026 delivered to the test didn't contain a file that the test
3027 could identify as the one it intended lsof to find. It
3028 might also mean that the process information -- command
3029 name, PID or parent PID -- didn't match what the test
3030 expected.
3031
3032 This could imply a bug in the test or a bug in lsof. Try
3033 using lsof to find a known file that is open. For example,
3034 while in the tests sub-directory, do this:
3035
3036 $ sleep 30 < Makefile
3037 $ ../lsof Makefile
3038
3039 If lsof doesn't report that Makefile is open, then the
3040 fault may be with lsof. If lsof reports the file is open,
3041 search further in the test code for the failure cause.
3042
3043 3.43.1.3 Why do some tests fail to compile?
3044
3045 If a test suite program fails to compile, it may be because
3046 I've never had an opportunity to compile the test on the
3047 particular UNIX version you are using.
3048
3049 See Appendix B in 00TEST for a list of the UNIX dialects
3050 where the test suite has been validate.
3051
3052 3.43.1.4 Why do some tests always fail?
3053
3054 There are several tests in the optional group that have
3055 conflicting or special requirements:
3056
3057 LTbigf needs a dialect and file system that support
3058 large files.
3059
3060 LTlock won't work if the tests/ sub-directory is
3061 on an NFS file system.
3062
3063 LTnfs won't work if the tests/ sub-directory is
3064 not on an NFS file system.
3065
3066 So for two tests in particular, LTlock and LTnfs, one will
3067 generally fail.
3068
3069 Some failing tests can be run successfully by supplying to
3070 them a path to the appropriate type of file system with
3071 the -p option.
3072
3073 3.43.1.5 Why does the test suite say it hasn't been validated on
3074 my dialect?
3075
3076 When you use the default rule of the test suite's Makefile,
3077 it may issue this complaint:
3078
3079 $ cd tests
3080 $ make
3081 !!!WARNING!!!
3082
3083 This dialect or its particular version may not have
3084 been validated with the lsof test suite. Consequently
3085 some tests may fail or may not even compile.
3086
3087 !!!WARNING!!!
3088
3089 You are then given the opportunity to answer 'y' to have
3090 the test suite operation continue.
3091
3092 This message means that the tests/TestDB file in the tests
3093 sub-directory doesn't show that the test suite has been
3094 run with the combination of compiler flags found in
3095 tests/config.cflags. The tests might nor run; they may
3096 encounter compiler failures.
3097
3098 See 00TEST for more information on the UNIX dialects where
3099 the test suite has been validated and on the workings of
3100 TestDB and its supporting scripts.
3101
3102 When the tests/Makefile "auto" rule is used, the message
3103 is more terse and the condition is fatal.
3104
3105 This suite has not been validated on:
3106
3107 <dialect_description>
3108
3109 No opportunity to continue is offered.
3110
3111 The tests/Makefile "silent" rule will skip checking for
3112 the validation footprint.
3113
3114 3.43.1.6 Why do the tests complain they can't stat() or open()
3115 /dev/mem or /dev/kmem?
3116
3117 When the tests detect that lsof for the dialect reads its
3118 information from kernel memory (i.e., the LT_KMEM definition
3119 is present in tests/config.cflags), and when the lsof
3120 executable path is ../lsof, the tests make sure they can
3121 stat() and open() for read access the relevant kernel memory
3122 devices, /dev/kmem and possibly /dev/mem.
3123
3124 If those stat() or open() operations fail, the tests issue
3125 an error message and quit. The message explains why the
3126 system rejected the operation in terms of system "errno"
3127 symbols and messages. More often than not the explanation
3128 will be that the process lacks permission to access the
3129 indicated device node.
3130
3131 One work-around is to give the lsof executable being tested
3132 the necessary permission -- e.g., via chgrp, chmod, etc.
3133 -- and set its path in the LT_LSOF_PATH environment variable.
3134 (See 00TEST.)
3135
3136 Another work-around is to make sure the process that runs
3137 the tests has the necessary permissions -- e.g., run it as
3138 root, or enable the process login to access the resources.
3139 For example, I can run the tests on my personal work-station
3140 because /dev/kmem and /dev/mem are readable by the "kmem"
3141 group and my login is in that group.
3142
3143
3144 3.43.2 LTbigf test issues
3145
3146 3.43.2.1 Why does the LTbigf test say that the dialect doesn't
3147 support large files?
3148
3149 Large file support is defined dialect by dialect in the
3150 lsof source files and Configure script. If large file
3151 support isn't defined there, it isn't defined in the LTbigf
3152 test.
3153
3154 If you think that's wrong for a particular dialect, contact me
3155 via e-mail at <[email protected]>. Make sure "lsof" appears in the
3156 "Subject:" line so my e-mail filter won't classify your letter
3157 as Spam.
3158
3159 3.43.2.2 Why does LTbigf complain about operations on its config.LTbigf*
3160 file?
3161
3162 The LTbigf must be able to write a large file test (size
3163 > 32 bits) and seek within it and the process file ulimit
3164 size must permit the operation. If the default location
3165 for the test file, tests/, isn't on a file system enabled
3166 for large file operations or if the process ulimit file
3167 block size is too small, lsof will get file operation
3168 errors, particularly when seeking
3169
3170 There may be a work-around. Specify the path to a file
3171 LTbigf can write in a file system enabled for large file
3172 operations a the -poption. Make sure that the ulimit file
3173 block size permits writing a large file. For example,
3174 presuming /scratch23 is large-file-enabled, and presuming
3175 you have permission to raise the ulimit file block size,
3176 this shell commands will allow the LTbigf test to run on
3177 AIX:
3178
3179 $ ./LTbigf -p /scratch23/abe/bigfile
3180
3181 (Note: syntax for the ulimit command varies by dialect and
3182 by shell. Discovering the proper variant is left to the
3183 reader.)
3184
3185 More information on this subject can be found in the LTbigf
3186 description in the 00TEST file. If course, the LTbigf.c
3187 source file in tests/ is the ultimate source of information,
3188
3189 3.43.2.3 Why does LTbigf warn that lsof doesn't return file offsets?
3190
3191 On some dialects (e.g., Linux) lsof can't report file
3192 offsets, because the data access method underlying lsof
3193 doesn't provide them. If LTbigf knows that lsof can't
3194 report file offsets for the dialect, it issues this warning:
3195
3196 LTbigf ... WARNING!!! lsof can't return file offsets
3197 for this dialect, so offset tests have
3198 been disabled.
3199
3200 LTbigf then performs the size test and skips the offset
3201 tests.
3202
3203 For more information see 00TEST and the "Why doesn't
3204 /proc-based lsof report file offsets (positions)?" Q&A of
3205 this file.
3206
3207 3.43.3 Why does the LTbasic test complain "ERROR!!! lsof this ..."
3208 and "ERROR!!! lsof that ..."?
3209
3210 The LTbasic test program uses lsof to examine a running
3211 lsof process. It looks for the lsof current working
3212 directory, executable (if possible), and kernel memory file
3213 (if applicable).
3214
3215 Failures to find those things result in the LTbasic error
3216 messages. More information on how LTbasic produces the error
3217 messages may be found in the LTbasic.c source file.
3218
3219 On HP-UX 11.11 and higher, for example, if the test's current
3220 working directory is on a loopback (LOFS) file system, LTbasic
3221 won't be able to find the current working directory of the lsof
3222 process because of a bug in the HP-UX kernel.
3223
3224 The solution for that HP-UX problem is to install an HP-UX
3225 patch. See the answer to the "Why doesn't PSTAT-based lsof
3226 report a CWD that is on a loopback (LOFS) file system?"
3227 question for more information on the patch.
3228
3229 3.43.4 NFS test issues
3230
3231 3.43.4.1 Why does the LTnfs test complain "couldn't find NFS file ..."?
3232
3233 The LTnfs test must work with an NFS test file. After it
3234 opens the file it asks lsof to find it on an NFS file system.
3235 If the file isn't on an NFS file system, lsof won't find it,
3236 and the NFS test script complains and fails.
3237
3238 The work-around is to use -p option to supply a path to a
3239 regular NFS file (not a directory) that is on an NFS file
3240 system that LTnfs can read. Presuming /share/bin/file is
3241 such a file and can be opened for reading by the LTnfs
3242 test, this sample shell command could be used to run the
3243 LTnfs test successfully:
3244
3245 $ ./LTnfs -p /share/bin/file
3246
3247 (If the NFS file system is enabled for large files, the
3248 NFS test will produce the error message described in the
3249 following Q&A.)
3250
3251 3.43.5 LTnlink test issues
3252
3253 3.43.5.1 Why does the LTnlink test complain that its test file is on
3254 an NFS file system?
3255
3256 The LTnlink test may complain:
3257
3258 LTnlink ... WARNING!!! test file <path> is NFS mounted.
3259
3260 and then issue an explanation and a hint about using the
3261 -p option.
3262
3263 The LTnlist test does this because of the way NFS file
3264 links are managed when an NFS file is unlinked and the
3265 unlinking process still has the file open. Unlike with
3266 files on a local file system, when an NFS file that is
3267 still open is unlinked, its link count is not reduced.
3268
3269 The file name is changed to a name of the form .nfsxxxx
3270 and the link count is left unchanged until the process
3271 holding the file open closes it. That's done by NFS so it
3272 can keep proper track of the file on NFS clients and servers.
3273
3274 Since the link count isn't reduced when the LTnlink test
3275 program closes the NFS test file it still has open, lsof
3276 won't find it for LTnlink with a link count of zero.
3277 Consequently, LTnlink disables that test section and issues
3278 its warning.
3279
3280 The warning suggests that the unlink test section can be
3281 run by giving LTnlink a path to a test file with the -p
3282 option. That path must name a file LTnlink can write and
3283 unlink. Presuming /scratch23/abe/nlinkfile is on a local
3284 file system and the LTnlink test can write to it and unlink
3285 it, this sample shell command can be used to run the complete
3286 LTnlink test successfully:
3287
3288 $ LTnlink -p /scratch23/abe/nlinkfile
3289
3290 3.43.5.2 Why does LTnlink delay and report "waiting for link count
3291 update: ..."?
3292
3293 On some UNIX dialects and file system combinations the
3294 updating of link count after a file has been unlinked can
3295 be delayed. Consequently, lsof won't be able to report
3296 the updated link count to LTnlink for a while.
3297
3298 When lsof doesn't report the proper link count to LTnlink,
3299 it sleeps and repeats the lsof call, using the "waiting
3300 for link count update: ..." message as a signal that it is
3301 waiting for the expected lsof response. The wait cycle
3302 duration is limited to approximately one minute.
3303
3304 3.43.5.3 Why does LTnlink fail because of an unlink error?
3305
3306 LTnlink may fail with an error similar to:
3307
3308 LTnlink ... ERROR!! unlink(<name>) failed: (Permission denied).
3309
3310 That message will be followed by a short explanation.
3311
3312 The error means that the kernel support for the file system on
3313 which the file <name> resides does not allow a process to
3314 unlink a file while it has the file open. (When LTnlink is run
3315 without the "-p path" option, it creates a <name> that begins
3316 with "./config.LTnlink" and ends with the LTnlink process ID
3317 number.)
3318
3319 An unlink failure of this type runs counter to original UNIX
3320 file system behavior, but it has been observed on some file
3321 system types, especially on the ZFS file system.
3322
3323 The work-around is to run LTnlink on a file system that allows
3324 a process to unlink a file it has open. Usually /tmp has that
3325 support. So, try running LTnlink this way:
3326
3327 $ ./LTnlink -p /tmp/<name>
3328
3329 where <name> is a unique name in /tmp of your choosing. To
3330 be safe, create a subdirectory in /tmp, named by your login:
3331
3332 $ rm -f /tmp/<login>
3333 $ mkdir /tmp/<login>
3334 $ ./LTnlink -p /tmp/<login>/<name>
3335
3336 3.43.6 LTdnlc test issues
3337
3338 3.43.6.1 Why won't the LTdnlc test run?
3339
3340 Lsof is unable to access the DNLC cache on AIX, because the
3341 kernel symbols for the DNLC aren't exported. Contact IBM
3342 to learn why that decision was made.
3343
3344 The LTdnlc test won't work on Apple Darwin because lsof
3345 can't obtain reliable DNLC information.
3346
3347 The LTdnlc test may fail on other dialects. Failure causes
3348 include: a busy system with a DNLC that is changing rapidly;
3349 path name components too large for the DNLC; a file system
3350 -- e.g., NFS, /tmp, loopback -- which doesn't fully
3351 participate in the DNLC; or DNLC limitations (Many DNLC
3352 implementations will only store path name components if
3353 they are 31 characters or less.)
3354
3355 If you suspect the file system doesn't fully participate
3356 in kernel DNLC processing, as a work-around rebuild and
3357 test lsof on one that does.
3358
3359 3.43.6.2 What does the LTdnlc test mean by "... <path> found: 100.00%"?
3360
3361 Even when it succeeds the LTdnlc test will report:
3362
3363 LTdnlc ... /export/home/abe/src/lsof4/tests found: 100.00%
3364
3365 This message means that the LTdnlc test asked lsof to find
3366 the file at the indicated path five times and lsof found
3367 the full path name in the indicated percentage of calls.
3368 The LTdnlc test considers it a failure if the percentage
3369 falls below 50.0%
3370
3371 3.43.6.3 Why does the DNLC test fail?
3372
3373 The DNLC test may fail when some component of the lsof
3374 tests/ sub-directory can't be cached by the kernel DNLC.
3375 Some kernels have a limit on the length of individual
3376 components (typically) 32.
3377
3378 3.43.7 Why hasn't the test suite been qualified for 64 bit HP-UX
3379 11 when lsof is compiled with gcc?
3380
3381 When I attempted to qualify lsof for HP-UX 11, compiled
3382 with gcc 3.0, the LTsock test failed. I traced the failure
3383 to a gcc compilation error. Because LTsock is an important
3384 test, I didn't feel that the test suite was qualified if
3385 it failed.
3386
3387 LTsock compiles and runs correctly on 64 bit HP-UX 11 when
3388 compiled with HP's ANSI-C.
3389
3390 3.43.8 LTszoff test issues
3391
3392 3.43.8.1 Why does LTszoff warn that lsof doesn't return file offsets?
3393
3394 On some dialects (e.g., Linux) lsof can't report file
3395 offsets, because the data access method underlying lsof
3396 doesn't provide them. If LTszoff knows that lsof can't
3397 report file offsets for the dialect, it issues this warning:
3398
3399 LTszoff ... WARNING!!! lsof can't return file offsets
3400 for this dialect, so offset tests have
3401 been disabled.
3402
3403 LTszoff then performs the size test and skips the offset
3404 tests.
3405
3406 For more information see 00TEST and the "Why doesn't
3407 /proc-based lsof report file offsets (positions)?" Q&A of
3408 this file.
3409
3410 3.43.9 LTlock test issues
3411
3412 3.44 File descriptor list (the ``-d'' option) problems
3413
3414 3.44.1 Why does lsof reject a ``-d'' FD list?
3415
3416 Lsof rejects ``-d'' FD lists that contain both exclusions
3417 and inclusions with messages like:
3418
3419 lsof: exclude in an include list: ^1
3420 lsof: include in an exclude list: 2
3421
3422 That's because ``-d'' FD lists are processed as ORed lists,
3423 so it makes no sense for them to contain both exclusions
3424 and inclusions.
3425
3426 I.e.,, if a ``-d'' FD list were to contain ``^cwd,1'', the
3427 ``^cwd'' member is useless, because the ``1'' member
3428 dominates by saying "include only FD 1". That effectively
3429 excludes ``cwd'' FD.
3430
3431 Note that lists may have multiple members of the same type,
3432 exclude or include. They are processed as an ORed set.
3433 If an FD isn't excluded by any member of an exclude list,
3434 it is selected. If an FD is included by any member of an
3435 include list, it is selected.
3436
3437 3.44.2 Why are file descriptors other than those in my FD list
3438 reported?
3439
3440 The FD list that follows ``-d'' excludes or includes file
3441 descriptors, but unless the ``-a'' (AND) option is specified,
3442 the FD list selections are ORed to the other selections.
3443
3444 For example, the following lsof command will cause all file
3445 descriptors to be listed for the lsof command, and all but
3446 the cwd descriptor for all other commands, probably not
3447 what was intended.
3448
3449 $ lsof -clsof -d^cwd
3450
3451 Hint: use ``-a'' -- e.g.,
3452
3453 $ lsof -clsof -a -d^cwd
3454
3455 3.45 How can I supply device numbers for inaccessible NFS file
3456 systems?
3457
3458 When lsof can't get device numbers for inaccessible NFS file
3459 systems via stat(2) or lstat(2), it attempts to get them from
3460 the mount table's dev=xxx options. Successes are reported with
3461 a warning message that indicates the source of the device
3462 number and that output might be incomplete as a consequence of
3463 the warnings.
3464
3465 Some system mount tables -- e.g., Linux /proc/mounts -- don't
3466 have a dev=xxx option. In that case, and provided lsof for the
3467 dialect supports them, you can use the +m option to create a
3468 mount table supplement file and the "+m m" option to use it.
3469
3470 First check the lsof -h (help) output to see if the +m and
3471 "+m m" options are supported. If they are, use +m to create a
3472 mount table supplement file when all mounted file systems are
3473 accessible. Use "+m m" later to make the supplement available
3474 when some mounted file systems might not be available.
3475
3476 Here's an example that creates a mount supplement file in
3477 $HOME/mnt-sup and later makes it available to lsof.
3478
3479 $ rm -f $HOME/mnt-sup
3480 $ lsof +m > $HOME/mnt-sup
3481 ...
3482 $ lsof +m $HOME/mnt-sup <other lsof options>
3483
3484 If lsof has to get the device number from the supplement, it
3485 will issue an informative warning message. The warning can be
3486 suppressed with lsof's -w option.
3487
3488 Caution! Since the mount table supplement file is static, it
3489 is its supplier's responsibility to update it as file system
3490 mounts change.
3491
3492 For more information, consult the lsof man page. The
3493 "ALTERNATE DEVICE NUMBERS" section has useful information on
3494 how lsof acquires device numbers when stat(2) or lstat(2)
3495 fail.
3496
3497 3.46 Why won't lsof find open files on over-mounted file systems?
3498
3499 When a file system, /xyz for example, is mounted on the same
3500 mount point as another file system, /abc for example, running
3501 lsof with an argument of the path of the first file system's
3502 mount point -- the over-mounted one, /abc -- probably will not
3503 reveal any files open on /abc.
3504
3505 That's because lsof looks for open files on a file system by
3506 looking for files with the file system's device number. The
3507 two file systems usually have different device numbers and lsof
3508 determines the device number search key from the supplied name
3509 of the second file system.
3510
3511 A general work-around exists only for Linux. On that UNIX
3512 dialect, when you know the over-mounted file system's mount
3513 point path, you can ask lsof to report on all open files and
3514 grep that output for the path of the over-mounted file system
3515 mount point.
3516
3517 3.47 What can be done when lsof reports no more space?
3518
3519 Many lsof methods cache information in memory, using the
3520 dialects malloc() library function. When malloc() can't
3521 allocate the requested amount of memory, lsof exits with
3522 warning messages similar to this AIX message:
3523
3524 lsof: no more dev-ch space at pid 2257750: 0x82a8e600
3525
3526 Lsof then exits immediately and produces no more output.
3527
3528 A possible work-around is to increase the memory foot print
3529 of the shell that runs lsof. That is often done with the
3530 ulimit(1) shell command.
3531
3532 3.48 What if the lsof build encounters ar and ld problems?
3533
3534 The lsof main and library Makefiles use the library archiver,
3535 ar, and the system loader, ld, applications. Improperly
3536 located, installed or configured versions of them may cause the
3537 lsof build to encounter errors with them.
3538
3539 The application producing the error should identify itself in
3540 its error messages.
3541
3542 The first thing to check the path of the application that is
3543 being used. Try `which ar` or `which ld` to see if perhaps the
3544 PATH used during the build might be causing the wrong archiver
3545 or loader to be used.
3546
3547 If the problem is with the use of the wrong archiver, and it's
3548 not possible to correct the PATH to it, try using the LSOF_AR
3549 environment variable to specify the path to and arguments for
3550 the correct archiver. See 00XCONFIG for more information and
3551 note that LSOF_AR must specify the path to the archive
3552 application and the arguments for it, less the terminating
3553 library and module name arguments.
3554
3555 If the problem is with the loader, there is no lsof work-
3556 around. That's because lsof calls the loader via the C
3557 compiler, so the problem must be fixed at the compiler (system)
3558 level.
3559
3560 3.49 Why does lsof -i report an open socket file for a process, but
3561 lsof -p on that process' ID report nothing?
3562
3563 The lsof in use was probably built with the HASSECURITY and
3564 HASNOSOCKSECURITY options and the process in question does not
3565 belong to the user of lsof.
3566
3567 The HASSECURITY option limits lsof output to processes owned
3568 by the user invoking lsof and the HASNOSOCKSECURITY option
3569 weakens that slightly to allow output of open socket file
3570 information for all processes.
3571
3572 For example, if process PID 12345 is owned by some user other
3573 than the one invoking lsof, and lsof has been compiled with the
3574 HASSECURITY and HASNOSOCKSECURITY options, the following lsof
3575 command will display the open socket files of process 12345:
3576
3577 $ lsof -p 12345 -a -i
3578
3579 This security restriction is described in the lsof(8) manual
3580 page.
3581
3582
3583 4.0 AIX Problems
3584
3585 4.1 What is the Stale Segment ID bug and why is -X needed?
3586
3587 Kevin Ruderman reports that he has been informed by IBM
3588 that processes using the AIX 3.2.x, 4.1[.12345]], 4.2[.1],
3589 and 4.3.x kernel's readx() function can cause other AIX
3590 processes to hang because of what appears to be file system
3591 corruption.
3592
3593 This failure, known as the Stale Segment ID bug, is caused
3594 by an error in the AIX kernel's journaled segment memory
3595 handler that causes the kernel's dir_search() function
3596 erroneously to believe directory entries contain zeroes.
3597 The process using the readx() call need not be doing anything
3598 wrong. Usually the system must be under such heavy load
3599 that the segment ID being used in the readx() call has been
3600 freed and then reallocated to another process since it was
3601 obtained from kernel memory.
3602
3603 Lsof uses the readx() function to access library entry
3604 structures, based on the segment ID it finds in the proc
3605 structure of a process. Since IBM probably will never fix
3606 the kernel bug, I've added an AIX-specific option to lsof
3607 that controls its use of the readx() function.
3608
3609 By default lsof readx() use is disabled; specifying the
3610 ``-X'' option enables readx() use.
3611
3612 If you want to change the default readx() behavior of AIX
3613 lsof, change the HASXOPT, HASXOPT_ROOT, and HASXOPT_VALUE
3614 definitions in dialects/aix/machine.h. You can also use
3615 these definitions to enable or disable readx() -- consult
3616 the comments in machine.h. You may want to disable readx()
3617 use permanently if you plan to make lsof publicly executable.
3618
3619 When HASXOPT_ROOT is defined, lsof will restrict use of
3620 the -X option to processes whose real UID is root; if
3621 HASXOPT_ROOT isn't defined, any user may specify the -X
3622 option. The Customize script offers the option to change
3623 HASXOPT_ROOT when HASXOPT is defined and HASXOPT_ROOT is
3624 named in any dialect's machine.h header file.
3625
3626 I have never seen lsof cause a problem with its use of
3627 readx(), but I believe there is some chance it could, given
3628 the right circumstances.
3629
3630 4.1.1 Stale Segment ID APAR
3631
3632 Here are the details of the Stale Segment ID bug and IBM's
3633 response, provided by Kevin Ruderman.
3634
3635 AIX V3
3636 APAR=ix49183
3637 user process hangs forever in kernel due to file
3638 system corruption
3639 STAT=closed prs TID=tx2527 ISEV=2 SEV=2
3640 (A "closed prs" is one closed with a Permanent
3641 ReStriction.)
3642 RCOMP=575603001 aix v3 for rs/6 RREL=r320
3643
3644 AIX V4 (internal defect, no apar #)
3645 prefix p
3646 name 175671
3647 abstract KERMP: loop for ever in dir_search()
3648
3649 Problem description:
3650
3651 1. Some user application -- e.g., lsof -- gets the segment
3652 ID (SID) for the process private segment of a target
3653 process from the process table.
3654
3655 2. The target process exits, deleting the process private
3656 segment.
3657
3658 3. The SID is reallocated for use as a persistent segment.
3659
3660 4. The user application runs again and tries to read the
3661 user area structure from /dev/mem, using the SID it read
3662 from the process table.
3663
3664 5. The loads done by the driver for /dev/mem cause faults
3665 in the directory; new blocks are allocated; the size
3666 changed; and zero pages created.
3667
3668 6. The next application that looks for a file in the affected
3669 directory hangs in the kernel's dir_search() function
3670 because of the zero pages. This occurs because the
3671 kernel's dir_search() function loops through the variable
3672 length entries one at a time, moving from one to the
3673 next by adding the length of the current entry to its
3674 address to get the address of the next entry. This
3675 process should end when the current pointer passes the
3676 end of the known directory length.
3677
3678 However, while the directory length has increased, the
3679 entry length data has not, so when dir_search() reaches
3680 the zero pages, it loops forever, adding a length of
3681 zero to the current pointer, never passing the end of
3682 the directory length. The application process is hung;
3683 it can't be killed or stopped.
3684
3685 IBM closed the problem with a PRS code (Permanent ReStriction)
3686 under AIX Version 3 and had targeted a fix for AIX 4.2. They
3687 have recently (I became aware of it September 10, 1996)
3688 cancelled the defect report altogether and have indicated they
3689 are not going to fix the defect.
3690
3691 4.2 Gcc Work-around for AIX 4.1x
3692
3693 When gcc is used to compile lsof for AIX 4.1x, it doesn't
3694 align one element of the user structure correctly. Xlc
3695 sees the U_irss element as a type "long long" and aligns
3696 it on an 8 byte boundary. That's because the default mode
3697 of xlc is -qlonglong; when -qlonglong is enabled, the
3698 _LONG_LONG symbol is also defined.
3699
3700 Gcc sees U_irss as a two element array of type long, because
3701 _LONG_LONG isn't defined. Hence gcc aligns the U_irss
3702 element array on a 4 byte boundary, rather than an 8 byte
3703 one, making the gcc incantation of the user structure 4
3704 bytes shorter than xlc's.
3705
3706 When the length of gcc's user structure is supplied as
3707 argument 4 to the undocumented getuser() function of the
3708 AIX kernel, getuser() rejects it as an incorrect size and
3709 returns EINVAL.
3710
3711 Lsof has a work-around for this problem. It involves a
3712 special test in the Configure script when the "aixgcc"
3713 Configure abbreviation is used -- e.g.,
3714
3715 $ Configure -n aixgcc
3716
3717 The test is to compile a small program with gcc and check
3718 the alignment of U_irss. If it's not aligned on an 8 byte
3719 boundary, the Configure script makes a special copy of
3720 <sys/user.h> in ./dialects/aix/aix<AIX_version> whose
3721 U_irss will align properly, and generates compile time
3722 options to use it.
3723
3724 While I have tested this work-around only with 4.1.4, it
3725 should work with earlier versions of AIX 4.1. It does not
3726 work for AIX 4.2; a different work-around is employed there.
3727 (See the next section.)
3728
3729 If you want to use this technique to compile other AIX
3730 4.1x programs with gcc for using getuser(), check the
3731 Configure script.
3732
3733 Stuart D. Gathman identified this gcc AIX alignment problem.
3734
3735 4.3 Gcc and AIX 4.2[.1]
3736
3737 Alignment problems with gcc and AIX 4.2[.1] inside the user
3738 structure are more severe, because there are some new 64
3739 bit types in AIX that gcc doesn't yet (as of 2.7.x) support.
3740 The <sys/user.h> U_irss element problem, discussed in 4.3
3741 above, doesn't exist in 4.2[.1].
3742
3743 The AIX lsof machine.h header file has a work-around,
3744 provided by Henry Grebler, that bypasses gcc alignment
3745 problems. Later versions of gcc (e.g., 2.8.x) will probably
3746 bypass the problems as well.
3747
3748 4.4 Why won't lsof's Configure allow the use of gcc for AIX
3749 below 4.1?
3750
3751 Gcc can't reliably be used to compile lsof for AIX versions
3752 below AIX 4.1 because of possible kernel structure element
3753 alignment differences between it and xlc.
3754
3755 4.5 What is an AIX SMT file type?
3756
3757 When you run AIX X clients with the DISPLAY environment
3758 variable set to ``:0.0'' they communicate with the AIX X
3759 server via files whose kernel file structure has an undefined
3760 type (f_type == 0xf) -- at least there's no definition for
3761 it in <sys/file.h>.
3762
3763 These are Shared Memory Transport (SMT) sockets, an artifact
3764 of AIXWindows, designed for more efficient data transfers
3765 between the X server and its clients.
3766
3767 Henry Grebler and David J. Wilson alerted me to the existence
3768 of these files. Mike Feldman and others helped me identify
3769 them as SMT sockets.
3770
3771 The curious reader can find more about SMT sockets in
3772 /usr/lpp/X11/README.SMT.
3773
3774 4.6 Why does AIX lsof start so slowly?
3775
3776 When AIX lsof starts it compares the running kernel's
3777 identity to the one for which it was built, using
3778 /usr/bin/oslevel. That comparison can sometimes take a
3779 long time to complete, depending on the system's maintenance
3780 level and how recently it was examined with oslevel.
3781
3782 AIX revisions 4.67 and above for AIX 5 and above don't use
3783 oslevel to determine the kernel identity. They use uname(2)
3784 instead, and it is much faster.
3785
3786 You can skip the oslevel test by suppressing warning messages
3787 with lsof's -w option. Doing that carries with it the risk
3788 of missing other warning messages, however.
3789
3790 You can also disable the kernel identity check by disabling
3791 the definition of the HASKERNIDCK symbol by editing AIX
3792 machine.h header file or by using the Customize script to
3793 disable it.
3794
3795 See the "Why does lsof warn "compiled for x ... y; this is
3796 z.?" section for more information.
3797
3798 4.7 Why does exec complain it can't find libc.a[shr.o]?
3799
3800 When you try to execute lsof you may get this complaint:
3801
3802 exec(): 0509-036 Cannot load program ./lsof because of
3803 the following errors:
3804 0509-022 Cannot load library libc.a[shr.o].
3805 0509-026 System error: A file or directory in
3806 the path name does not exist.
3807
3808 This is probably the result of making lsof when the LIBPATH
3809 environment variable contained a directory path that doesn't
3810 contain libc.a. You can see what LIBPATH contained when
3811 lsof was made by using the dump application on lsof. For
3812 example, if LIBPATH contained /foo/bar when lsof was made,
3813 you will see this (partial) dump output:
3814
3815 $ dump -H lsof
3816 ...
3817 ***Import File Strings***
3818 INDEX PATH BASE ...
3819 0 /foo/bar
3820
3821 To correct the problem, revisit the lsof source directory
3822 and remake lsof this way:
3823
3824 $ unset LIBPATH; make (sh or ksh)
3825 or
3826 % unsetenv LIBPATH; make (csh or tcsh)
3827
3828 4.8 What does lsof mean when it says, "no PCB, CANTSENDMORE,
3829 CANTRCVMORE" in a socket file's NAME column?
3830
3831 When an AIX application calls shutdown(2) on an open socket
3832 file, but hasn't called close(2) on the file, the file will
3833 remain visible to lsof as an open socket file without any
3834 extended protocol information.
3835
3836 Lsof reports that state in the NAME column by saying that
3837 there is "no PCB" (Protocol Control Block) for the protocol
3838 (e.g., TCP in the NODE column). If the open socket file
3839 has the state variables SO_CANTSENDMORE and SO_CANTRCVMORE
3840 set -- i.e., from the shutdown(2) call -- lsof reports them
3841 with the CANTSENDMORE and CANTRCVMORE notes in the NAME
3842 column.
3843
3844 4.9 When the -X option is used on AIX 4.3.3, why does lsof disable
3845 it, saying "WARNING: user struct mismatch; -X option disabled?"
3846
3847 The -X option causes lsof to read the loader information
3848 of the user structure from virtual memory via the readx()
3849 system call. It does that with the user structure definition
3850 from <sys/user.h> that was compiled into the lsof executable.
3851
3852 On AIX 4.3.3 there are two different user structure
3853 definitions in two separate <sys/user.h> header files,
3854 distributed at different times by IBM. If lsof was compiled
3855 with one and the kernel on which lsof is being run was
3856 compiled with the other, lsof normally won't get correct
3857 loader information when it calls readx().
3858
3859 In an attempt to compensate for that difference, lsof makes
3860 an independent check of the loader information by getting
3861 the user structure's open file count via readx() and
3862 comparing it to the open file count obtained independently
3863 via getprocs(). When the two counts don't match, lsof
3864 tries to read the count (and re-read the loader information)
3865 with two offsets, based on observed differences between
3866 the two user structures.
3867
3868 When one of the three attempts produces a correct open file
3869 count, lsof uses its corresponding offset on subsequent
3870 readings of the loader information.
3871
3872 When none of the three attempts produces a correct open
3873 file count, lsof issues the WARNING message and disables
3874 -X processing.
3875
3876 To eliminate this problem, obtain an lsof binary that
3877 matches the kernel of the AIX 4.3.3 system where you want
3878 to run lsof. Compiling lsof on the target system is the
3879 preferred way to get a matching binary.
3880
3881 4.10 Why doesn't the -X option work on my AIX 5L or 5.[123] system?
3882
3883 If your AIX 5L or 5.[123] system uses the ia64 architecture,
3884 lsof needs setuid-root permission to be able to do the
3885 processing that -X requires.
3886
3887 Check the output of `uname -a` to determine the architecture
3888 type.
3889
3890 The work-around is to give lsof setuid-root permission.
3891
3892 4.11 Why doesn't /usr/bin/oslevel report the correct AIX version?
3893
3894 The oslevel man page says, "The oslevel command reports
3895 the level of the operating system using a subset of all
3896 filesets installed on your system."
3897
3898 You can see which fileset is below the expected level with
3899 oslevel's -l option. For example, if you believe your
3900 system is at AIX level 4.3.3, but oslevel reports 4.3.2,
3901 use this oslevel command to find the filesets below 4.3.3:
3902
3903 $ /usr/bin/oslevel -l 4.3.3.0
3904
3905 If you don't know what level argument to supply to oslevel's
3906 -l option, use oslevel's -q option first.
3907
3908 4.11.1 Why doesn't /usr/bin/oslevel report the correct AIX version
3909 on AIX 5.1?
3910
3911 The subset list for oslevel on AIX 5.1 seems to include at
3912 least two filesets, xlsmp.msg.en_US.rte and xlsmp.rte, that
3913 do not install from AIX 5.1 media with a 5.1.0.0 level.
3914 Hence, oslevel reports 5.0.0.0 instead of the expected
3915 5.1.0.0.
3916
3917 If either xlsmp.msg.en_US.rte or xlsmp.rte is installed,
3918 lsof's Configure script and run-time tests will identify
3919 the AIX version incorrectly. The run-time test will
3920 issue a complaint message of this form:
3921
3922 lsof: WARNING: compiled for AIX version xxx; this is yyy.
3923
3924 You can correct the Configure test by pre-defining the
3925 oslevel value, setting the correct value in the LSOF_VSTR
3926 environment variable before running the Configure script
3927 -- e.g., to pre-define AIX 5.1 when using ksh, do this:
3928
3929 $ LSOF_VSTR=5.1.0.0 Configure -n aix
3930
3931 You can't affect oslevel output without uninstalling
3932 xlsmp.msg.en_US.rte and xlsmp.rte. If you can't do that,
3933 you'll have to put up with the run-time complaint.
3934
3935 4.12 Why does lsof for AIX 5.1 or above Power architecture
3936 complain about kernel bit size?
3937
3938 When you run an lsof binary on an AIX 5.1 or above Power
3939 system, it might complain:
3940
3941 lsof: FATAL: compiled for a 32 bit kernel.
3942 The bit size of this kernel is 64.
3943 or
3944 exec: 0509-036 Cannot load program ./lsof because of
3945 the following errors:
3946 0509-032 Cannot run a 64-bit program on a 32-bit
3947 machine.
3948
3949 Starting at lsof revision 4.61, lsof binaries for Power
3950 architecture systems running AIX 5.1 or above are closely
3951 tied to the kernel bit size. Lsof must do that so it can
3952 read and understand kernel structures.
3953
3954 Lsof's Configure script tunes the lsof configuration so
3955 that the binary built in the make(1) step is adjusted to
3956 the kernel bit size.
3957
3958 An lsof binary knows the bit size for which it was constructed,
3959 tests the bit size of the kernel under which it is running,
3960 and objects if the two sizes don't match. To see the bit
3961 size for which lsof was constructed, run it with its -v
3962 option and look for these lines in the output:
3963
3964 configuration info: 32 bit kernel
3965 or
3966 configuration info: 64 bit kernel
3967
3968 (Note: these lines will appear only in -v output for AIX
3969 5.1 and above lsof binaries, built for Power architecture.)
3970
3971 You can see the kernel bit size test method in the aix
3972 stanza of the lsof Configure script and in the get_kernel_access()
3973 function of the lsof .../dialects/aix/dproc.c source file.
3974
3975 There is more information on pre-defining the kernel bit
3976 size when building lsof in Configure, 00PORTING, and
3977 00XCONFIG.
3978
3979 The only work-around is to use an lsof binary built to
3980 match the running kernel bit size.
3981
3982 4.13 What can't gcc be used to compile lsof on the ia64 architecture
3983 for AIX 5 and above?
3984
3985 Gcc can't be used to compile lsof on the ia64 architecture
3986 for AIX 5 and above because I haven't had access to a system
3987 that has a working gcc compiler. The gcc compiler on my
3988 one and only ia64 AIX 5.1 test system, provided by IBM,
3989 didn't work at all.
3990
3991 4.14 Why does lsof get a segmentation fault when compiled with gcc
3992 for a 64 bit Power architecture AIX 5.1 kernel?
3993
3994 When lsof is configured with the lsof "aixgcc" Configure
3995 abbreviation, the resulting lsof executable may cause a
3996 segmentation violation when it is run. I've observed this
3997 with gcc version 2.9-aix43-010414-7.
3998
3999 As far as I have been able to tell, the segmentation fault
4000 is the result of a gcc compilation, loading, or library
4001 error. Watching lsof run with gcc's companion debugger,
4002 gdb, shows no error in the lsof source code that might
4003 explain the fault.
4004
4005 The only work-around I know is to use the IBM C compiler
4006 in place of gcc -- i.e., use the "aix" lsof Configure
4007 abbreviation.
4008
4009 4.15 Why does lsof ignore AFS on my AIX system?
4010
4011 The lsof Configure script quits on AIX when AFS is present,
4012 the AIX version is greater than 4.3.3.0 or the AFS version
4013 is greater than 3.5. That's because I have no test systems
4014 available for those AIX and AFS version combinations.
4015
4016 When the lsof Configure script detects an AIX and AFS
4017 version combination that is unsupported, it will report:
4018
4019 !!!FATAL: Lsof does not support AFS on this combination of
4020 AIX and AFS versions. To disable AFS, set the
4021 value of the AIX_HAS_AFS environment variable to
4022 "no".
4023
4024 The only work-around is to set the AIX_HAS_AFS environment
4025 variable as explained in the error message:
4026
4027 $ AIX_HAS_NSF=no; export AIX_HAS_NFS
4028 $ ./Configure -n aix
4029
4030 4.16 Why does lsof report "system paging space is low" and exit?
4031
4032 When AIX paging space runs low, the AIX kernel sends a SIGDANGER
4033 signal to processes, warning them that they should reduce their
4034 memory usage.
4035
4036 When lsof receives that signal, it issues the following fatal
4037 error message and exits:
4038
4039 lsof: FATAL: system paging space is low.
4040
4041 A possible work-around is to limit the amount of information
4042 lsof must cache in its process memory with the "-c", "-g", "-l"
4043 and "-p" options.
4044
4045 Also see the answer to the "What can be done when lsof reports
4046 no more space?" question.
4047
4048 4.17 Why does lsof have a compilation problem on AIX 5.3 above
4049 maintenance level 1?
4050
4051 On some AIX 5.3 systems with maintenance levels 2 and higher
4052 installed, lsof 4.77 and below may not compile properly. The
4053 compiler complains the snapshotObject structure definition,
4054 needed by <j2/j2_inode.h>, is missing.
4055
4056 That problem is fixed in the 4.78 revision.
4057
4058
4059 5.0 Apple Darwin Problems
4060
4061 5.1 What do /dev/kmem-based and libproc-based mean?
4062
4063 Lsof for Apple Darwin currently uses /dev/kmem to read kernel
4064 data structures from which it gathers and reports open file
4065 information. That version of lsof is called /dev/kmem-based
4066 lsof.
4067
4068 At an upcoming release lsof will use a library called libproc
4069 to obtain information about open files. That version of lsof
4070 will be called libproc-based lsof.
4071
4072 The /dev/kmem-based lsof sources may be found in the kmem
4073 subdirectory of the dialects/darwin branch of the lsof source
4074 tree. When the supporting version of Apple Darwin is released,
4075 the libproc-based lsof sources will be found in
4076 .../dialects/darwin/libproc.
4077
4078 5.2 /dev/kmem-based Apple Darwin Questions
4079
4080 5.2.1 Why does Configure ask for a path to the Darwin XNU kernel
4081 header files?
4082
4083 When lsof was ported to Apple Darwin by Allan Nathanson at
4084 revision 4.53, some kernel header files needed by lsof
4085 weren't being exported by the developers. (That's still
4086 true at lsof revision 4.76.)
4087
4088 At first a shell script that Allan provided would get the
4089 missing header files by checking them out from the CVS
4090 root. Although the script was updated from time to time,
4091 eventually the re-organization of Darwin sources has made
4092 it impossible to update the script to do an automatic
4093 download of the missing header files.
4094
4095 At lsof revision 4.69 and above it is necessary for the Darwin
4096 lsof builder to download the Darwin XNU kernel headers before
4097 attempting to build lsof. The download my be done via a web
4098 browser, starting at this URL:
4099
4100 http://www.opensource.apple.com/darwinsource/index.html
4101
4102 Once there, select the link to the Mac OS X version that
4103 matches the one on the system where lsof is to be built.
4104
4105 Follow that link's "[ Source ]" link. Once there, select the
4106 tar.gz link of the xnu* entry near the bottom of the page.
4107 That entry should have a name that matches the xnu* name shown
4108 by `uname -a` -- e.g., if uname reports:
4109
4110 $ uname -a
4111 ... root:xnu/xnu-517.7.21 ...
4112
4113 Then the appropriate xnu* entry is xnu-517.7.21. Clicking
4114 its link should lead to an "Apple Open Source" page requesting
4115 an Apple ID and password.
4116
4117 Enter them if they're available. If an Apple ID and password
4118 are not available, get them by following the instructions on
4119 the page -- i.e., follow the signin.apple.com link.
4120
4121 Once a valid Apple ID and its password have been entered,
4122 the download will begin. Select the saving of the downloaded
4123 xnu*.tar.gz file in an appropriate place on the Mac OS X
4124 system.
4125
4126 Once the download completes, install it. Use gunzip to
4127 decompress the download and tar to extract the archive -- e.g.,
4128
4129 $ gunzip -c xnu-517.7.21.tar.gz | tar xf -
4130
4131 Remember the absolute path to the extracted archive. That is
4132 its installed place. E.g., if the xnu-517.7.21.tar archive was
4133 extracted to the lsof builder's home directory, its full
4134 installation path will be something like:
4135
4136 ~/xnu-517.7.21
4137
4138 Now run the lsof Configure script. When it asks for the path
4139 to the installed Darwin XNU kernel header files, supply the
4140 path to the gunzip'd and extracted xnu* archive -- e.g.,
4141 ~/xnu-517.7.21.
4142
4143 The path to the Darwin XNU kernel headers may also be
4144 supplied to the Configure script in the DARWIN_XNUDIR
4145 environment variable, eliminating the need to enter it
4146 interactively -- e.g.,
4147
4148 $ DARWIN_XNUDIR=~/xnu-344.49 ./Configure -n darwin
4149
4150 5.2.1.1 Why does Configure complain that Darwin XNU kernel header
4151 files are missing?
4152
4153 These are some reasons why the lsof Configure script might
4154 claim that Darwin XNU header files are missing:
4155
4156 * The wrong path to them was specified.
4157
4158 * The files and directories in the path are not readable
4159 and searchable -- i.e., check the modes and ownerships.
4160
4161 * The downloaded archive doesn't match the Mac OS X
4162 version of the system.
4163
4164 If in doubt, revisit the Darwin XNU kernel header file
4165 download instructions in the answer to the question "Why
4166 does Configure ask for a path to the Darwin XNU kernel
4167 header files?"
4168
4169 If Configure still can't find Darwin XNU kernel header
4170 files, contact me via e-mail at <[email protected]> for help.
4171 Make sure "lsof" appears in the "Subject:" line so my e-mail
4172 filter won't classify your letter as Spam.
4173
4174 5.2.2 Why doesn't Apple Darwin lsof report text file information?
4175
4176 At the first port of lsof to Apple Darwin, revision 4.53,
4177 insufficient information was available -- logic and header
4178 files -- to permit the installation of VM space scanning
4179 for text files. As of lsof 4.70 it is sill not available.
4180
4181 Text file support will be added to Apple Darwin lsof after
4182 the necessary information becomes available.
4183
4184 5.2.3 Why doesn't Apple Darwin lsof support IPv6?
4185
4186 At the first port of lsof to Apple Darwin, revision 4.53,
4187 Apple Darwin lacked IPv6 support. IPv6 became available
4188 in Apple Darwin version 1.5 and support for it was added
4189 to lsof then.
4190
4191 5.2.4 Why does lsof complain about a mismatch between the release
4192 for which lsof was compiled and the booted Mac OS X release?
4193
4194 When lsof is started on the "Gold Master" Darwin release
4195 (aka Mac OS X), it complains:
4196
4197 lsof: compiled for 1.0 release; this is 1.3.2.
4198
4199 This happens because the lsof binary released with Mac OS
4200 X was built on a system whose release number (1.0) doesn't
4201 match that of the released system -- usually 1.3.x Lsof
4202 makes this check because UNIX dialect OS changes are often
4203 accompanied by header file changes that affect lsof.
4204
4205 In this specific case, this error can be ignored. If you
4206 don't want to do that, get the lsof distribution and build
4207 lsof so its built-on and running-on Mac OS X release numbers
4208 match.
4209
4210 5.2.5 Why does lsof for Apple Darwin 8 and higher report
4211 "stat(...): ..." in the NAME column?
4212
4213 Lsof for Apple Darwin 8 may report messages like these in the
4214 NAME column:
4215
4216 stat(/private/var/run/asl_prune): No such file or directory
4217 or
4218 stat(/private/var/db/netinfo/local.nidb/Config): Permission denied
4219
4220 Those messages indicate that lsof was unable to collect open
4221 file information for the paths enclosed in "stat(...)" with the
4222 stat(2) function, because the function encountered the reported
4223 error.
4224
4225 A work-around for the "Permission denied" error is to run lsof
4226 with elevated privileges -- e.g., when logged on as the super
4227 user.
4228
4229 If the stat(2) error message is "No such file or directory",
4230 the file probably has been unlinked (removed) and there is no
4231 lsof work-around.
4232
4233 5.2.6 What are the limitations of Apple Darwin lsof link count
4234 reporting?
4235
4236 Lsof for Apple Darwin cannot report link count information
4237 reliably.
4238
4239 For Apple Darwin below 8 link count information is not always
4240 available in the kernel node structures available to lsof.
4241 When link count information is available, however, it includes
4242 link counts of zero. Thus, using lsof's +L1 option may result
4243 in the finding of some files whose link counts are zero.
4244
4245 Lsof can report only some link count information for Apple
4246 Darwin 8 and above. Link count information is only available
4247 for files where lsof can assemble the full file path and has
4248 permission to apply stat(2) to it. (See the answer to the "Why
4249 does lsof for Apple Darwin 8 and higher report "stat(...): ..."
4250 in the NAME column?" question for more information on stat(2)
4251 failures.)
4252
4253 Apple Darwin 8 and above files that have been unlinked and thus
4254 have a link count of zero cannot be found by stat(2) -- i.e.,
4255 stat(2) returns a "No such file or directory" error. As a
4256 result lsof never displays link counts of zero and the use of
4257 lsof's +L1 option to find them always fails.
4258
4259 5.2.7 Why does Apple Darwin report process group IDs incorrectly?"
4260
4261 The kmem version of lsof for Apple Darwin does not report
4262 process group IDs correctly when requested to do so with its
4263 ``-g'' option. This is a bug that surfaced after the libproc
4264 version was released and access to kmem test systems has
4265 prevented patching the bug.
4266
4267 If you are using the kmem version and would like a fix for this
4268 problem, please send e-mail to me <[email protected]>. Make sure
4269 "lsof" appears in the "Subject:" line so my e-mail filter won't
4270 classify your letter as Spam.
4271
4272 5.3 Libproc-based Apple Darwin Questions
4273
4274
4275 6.0 BSD/OS BSDI Problems
4276
4277 6.0.5 Statement of deprecation
4278
4279 As of lsof revision 4.76 support for BSDI BSD/OS has been
4280 dropped. The 4.76 distribution of lsof for BSDI BSD/OS may be
4281 found on lsof.itap.purdue.edu in pub/tools/unix/lsof/OLD/src.
4282
4283 8.0 FreeBSD Problems
4284
4285 8.1 Why doesn't lsof report on open kernfs files?
4286
4287 Lsof doesn't report on open FreeBSD kernfs files because
4288 the structures lsof needs aren't defined in the kernfs.h
4289 header file in /sys/misc/kernfs.
4290
4291 8.2 Why doesn't lsof work on my FreeBSD system?
4292
4293 If lsof doesn't work on your FreeBSD system, first make
4294 sure you have the latest lsof revision. See the answer to
4295 the "Where do I get lsof?" question for information on how
4296 to get the latest lsof revision.
4297
4298 Once you have gotten the latest lsof revision, Configure
4299 and make it. If Configure fails -- e.g., it complains
4300 about an unknown FreeBSD version -- then lsof probably
4301 hasn't been ported to your FreeBSD version yet, and there's
4302 no need to go any further. Follow the answer to the "How
4303 do I report an lsof bug" to report the Configure complaint
4304 to me.
4305
4306 If you are able to Configure and make lsof, run its test
4307 suite. (See the answer to the "Is there a test suite?"
4308 question for more information on how to use lsof's test
4309 suite.)
4310
4311 If lsof still fails, make sure your kernel sources, kernel
4312 header files, kernel boot file, standard header files and
4313 libraries are synchronized. They should all be built from the
4314 same CVS refresh. (Don't forget to do a "make buildworld"
4315 followed by a "make installworld".) If they aren't, then the
4316 KVM library or lsof may be using kernel structure definitions
4317 that don't match the booted kernel; or lsof may fail to compile
4318 properly because of header files in /usr/src/sys/sys and
4319 /usr/include/sys that don't match.
4320
4321 If you have synchronized your kernel, header files and
4322 libraries, and still can't get lsof to work, follow the
4323 steps in the answer to the "How do I report an lsof bug"
4324 question to report the problem to me.
4325
4326 8.3 Why doesn't lsof work on the RELEASE version of CURRENT?
4327
4328 Lsof tracks the CURRENT release of the current leading edge
4329 FreeBSD version, because my access to leading edge FreeBSD is
4330 limited to FreeBDSD.org reference systems, all running the
4331 CURRENT release.
4332
4333 Sometimes that tracking leads to changes in lsof that won't
4334 work on an earlier RELEASE version of the current leading edge
4335 version.
4336
4337 When that happens, please send e-mail to me <[email protected]>.
4338 Make sure "lsof" appears in the "Subject:" line so my e-mail
4339 filter won't classify your letter as Spam.
4340
4341 8.4 Why does kvm_open() complain it can't find some file?
4342
4343 If lsof issues this complaint:
4344
4345 lsof: kvm_open(execfile=/boot/kernel/kernel,
4346 corefile=/dev/mem: No such file or directory
4347
4348 Your FreeBSD system might not have a /dev/mem device. If
4349 not, create one -- e.g., as root do:
4350
4351 # mknod /dev/mem c <major> 0
4352 # chmod 440 /dev/mem
4353 # chgrp kmem /dev/mem
4354
4355 For <major> use /dev/kmem's major device number.
4356
4357 You may have to run kldload, too -- again as root do:
4358
4359 # kldload mem
4360
4361 8.5 FreeBSD ZFS Problems
4362
4363 8.5.1 Why does FreeBSD lsof report "WARNING: no ZFS support has been
4364 defined."?
4365
4366 Lsof issues that message when it detects a file on a ZFS file
4367 system, but has not been built with support for ZFS. Lsof's
4368 Configure script detects support can be added for ZFS when it
4369 finds this file:
4370
4371 /usr/src/sys/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h
4372
4373 That header file and others in the OpenSolaris files in
4374 /usr/src enable lsof to extract information about ZFS files
4375 from the kernel structures associated with them.
4376
4377 8.6 Why can't Configure create lsof_owner.h for FreeBSD 6 and above?
4378
4379 Lsof may report:
4380
4381 Creating ./lockf_owner.h from /usr/src/sys/kern/kern_lockf.c
4382 FATAL ERROR: can't read /usr/src/sys/kern/kern_lockf.c
4383 FATAL ERROR: ./lockf_owner.h creation failed (see 00FAQ)
4384 or
4385 Creating ./lockf_owner.h from /usr/src/sys/kern/kern_lockf.c
4386 FATAL ERROR: ./lockf_owner.h creation failed (see 00FAQ)
4387
4388 Those messages mean that lsof's Configure script failed to
4389 create a local header file, ./lockf_owner.h, needed to use the
4390 new kernel file locking code of some versions of FreeBSD 6 and
4391 above.
4392
4393 The changes that implement that new locking code alter the
4394 lockf structure in <sys/lockf.h> and introduce a new structure,
4395 lockf_entry, to that header file. When Configure detects the
4396 presence of the lockf_entry definition in <sys/lockf.h>, it
4397 tries to construct the local header file, ./lockf_owner.h.
4398
4399 Configure has to do that because an unfortunate side effect of
4400 the new kernel file locking code is that <sys/lockf.h> doesn't
4401 contain the lockf_owner structure definition referenced in its
4402 own lockf structure. Lsof needs to access elements of that
4403 lockf_owner structure to determine if a lock belongs to the
4404 process that has a file open.
4405
4406 The missing lockf_owner structure definition is in the kernel
4407 source file, typically /usr/src/sys/kern/kern_lockf.c.
4408 Configure tries to extract the lockf_owner structure definition
4409 from kern_lockf.c into lsof's local header file, ./lockf_owner.h.
4410 If Configure can't do that, it reports:
4411
4412 FATAL ERROR: ./lockf_owner.h creation failed
4413
4414 If Configure can't even read kern_lockf.c, it first reports:
4415
4416 FATAL ERROR: can't read /usr/src/sys/kern/kern_lockf.c
4417
4418 The work-around for this problem is to update the FreeBSD
4419 kernel /usr/src tree (e.g., do a CVSup or csup) on the system
4420 where lsof is to be built and then do a "make buildworld"
4421 followed by a "make installworld".
4422
4423 8.6.1 Why are there lockf structure compiler errors for FreeBSD 6.0
4424 and higher lsof?
4425
4426 If, when compiling lsof, the compiler complains with error
4427 messages like:
4428
4429 dnode.c: In function 'get_lock_state':
4430 dnode.c:113: error: 'struct lockf' has no member named 'lf_flags'
4431 dnode.c:115: error: 'struct lockf' has no member named 'lf_id'
4432 ...
4433
4434 Then lsof is being built on a system that has new kernel file
4435 locking code and lsof's Configure script failed to build a
4436 local lockf_owner.h header file with a structure definition
4437 lsof needs.
4438
4439 See the "Why can't Configure create lsof_owner.h for FreeBSD 6
4440 and above?" section for more information and a work-around.
4441
4442 8.6.2 Why don't /usr/src/sys/sys/lockf.h and /usr/include/sys/lockf.h
4443 match?
4444
4445 This mismatch can cause the errors explained in the answer to
4446 the "Why are there lockf structure compiler errors for FreeBSD
4447 6.0 and higher lsof?" question.
4448
4449 If /usr/src/sys/sys/lockf.h has been updated with a CVSup or
4450 csup, the new lockf.h won't be propagated to /usr/include/sys
4451 until the "make buildworld" and "make installworld" steps have
4452 been completed.
4453
4454 8.7 FreeBSD and clang
4455
4456 As of lsof revision 4.87, lsof may be compiled with clang.
4457
4458 8.7.1 Why does clang complain about VOP_FSYNC?
4459
4460 There is an error in the Solaris ZFS compatibility vnode.h
4461 header file with use of VOP_FSYNC before it is defined. No
4462 work-around is possible that will eliminate the clang
4463 compile-time warning message about the invalid declaration of
4464 the VOP_FSYNC function.
4465
4466
4467 9.0 HP-UX Problems
4468
4469 9.1 What do /dev/kmem-based and PSTAT-based mean?
4470
4471 Lsof for HP-UX 11.0 and below uses /dev/kmem to read kernel
4472 data structures from which it gathers and reports open file
4473 information. That version of lsof is called /dev/kmem-based
4474 lsof.
4475
4476 Starting with HP-UX 10.10, finding definitions for the
4477 necessary kernel structures became more difficult as HP no
4478 longer distributed header files in /usr/include that defined
4479 all kernel structures. So I started "inventing" structure
4480 definitions by using Q4 to display them.
4481
4482 By HP-UX 11, the process of invention became extremely
4483 intensive to support. Following a patch to the ipc_s
4484 structure in early 1999, my invented definition of that
4485 structure became incorrect. Although I was able to devise
4486 a work-around test for the patch with Q4, it was clear that
4487 my inventions were bound to cause more problems.
4488
4489 Discussion with HP about the patch led to my proposing that
4490 an lsof API in the HP-UX kernel was the proper solution.
4491 Much to my surprise, HP agreed. I believe Carl Davidson
4492 was the prime mover behind that decision, but I know others
4493 participated, among them Louis Huemiller, Rich Rauenzahn,
4494 and Sailu Yallapragada. I am indebted to these folks and
4495 HP for their willingness to do this work.
4496
4497 The API was added to the PSTAT interface in a project named
4498 PEGL, Pstat Enhancements for Glance and Lsof. Louis and
4499 Sailu did the bulk of the design and implementation work
4500 and testing began in March, 2000
4501
4502 HP-UX 11.11 is the first version that provides PSTAT support
4503 for lsof. HP-UX versions in between 11.0 and 11.11 -- all
4504 Beta versions as far as I can determine -- have no lsof
4505 support.
4506
4507 See the "PSTAT-based HP-UX lsof Questions" section for
4508 questions and answers specific to PSTAT-based HP-UX lsof.
4509 The next section, "Why doesn't a /dev/kmem-based HP-UX lsof
4510 compilation use -O?" covers /dev/kmem-based HP-UX lsof.
4511
4512 The /dev/kmem-based lsof sources may be found in the kmem
4513 subdirectory of the dialects/hpux branch of the lsof source
4514 tree. The PSTAT-based lsof sources may be found in
4515 .../dialects/hpux/pstat.
4516
4517 9.2 /dev/kmem-based HP-UX lsof Questions
4518
4519 The sources for /dev/kmem-based lsof for HP-UX may be found
4520 in lsof_<revision>/dialects/hpux/kmem.
4521
4522 Lsof's Configure shell script decides to use these sources
4523 when it finds that the /usr/include/sys/pstat subdirectory
4524 doesn't exist.
4525
4526 Lsof can be forced to use the /dev/kmem sources by setting
4527 "/dev/kmem" in the HPUX_BASE environment variable. Consult
4528 the Configure shell script and 00XPORTING for more information.
4529
4530 9.2.1 Why doesn't a /dev/kmem-based HP-UX lsof compilation use -O?
4531
4532 If you only have the standard (bundled) HP-UX C compiler
4533 and haven't purchased and installed the optional one, then
4534 you can't use cc's -O option. The HP-UX cc(1) man page
4535 says this:
4536
4537 "Options
4538 Note that in the following list, the cc and c89 options
4539 -A , -G , -g , -O , -p , -v , -y , +z , and +Z are
4540 not supported by the C compiler provided as part of
4541 the standard HP-UX operating system. They are supported
4542 by the C compiler sold as an optional separate product."
4543
4544 Lsof's Configure script tries to detect what C compiler
4545 product you have installed by examining your compiler. If
4546 that examination reveals a standard (bundled) compiler,
4547 lsof avoids using -O.
4548
4549 If the Configure compiler test fails, the C compiler will
4550 complain that it doesn't support -O. You can suppress that
4551 complaint with this make invocation:
4552
4553 $ make DEBUG=""
4554
4555 9.2.2 Why doesn't the /dev/kmem-based CCITT support work under 10.x?
4556
4557 Pasi Kaara, who originally provided the HP-UX CCITT support,
4558 reports that it no longer works under HP-UX 10.x.
4559 Consequently, at lsof revision 4.02 it has been disabled.
4560
4561 9.2.3 Why can't /dev/kmem-based lsof be compiled with `cc -Aa` or
4562 `gcc -ansi` under HP-UX 10.x?
4563
4564 Some HP-UX 10.x header files, needed by lsof, can't be
4565 compiled properly in ANSI_C mode; structure element definition
4566 and alignment problems result. The f_offset member of the
4567 file structure, for example, is incorrect.
4568
4569 This ANSI-C obstacle extends to using the -Aa option of
4570 the HP C compiler and the -ansi option of gcc.
4571
4572 9.2.4 Why does /dev/kmem-based lsof complain about no C compiler?
4573
4574 Lsof's Configure script looks in /bin and /usr/ccs/bin for
4575 an HP C compiler, because it needs to know if the compiler
4576 is the standard (bundled) one or the optional separate
4577 product. If it finds no compiler in either place, Configure
4578 quits after complaining:
4579
4580 No executable cc in /bin or /usr/ccs/bin
4581
4582 If you don't have a C compiler in either of these standard
4583 places, you should consider installing it. If you have
4584 gcc installed, you can use it by declaring the ``hpuxgcc''
4585 abbreviation to lsof's Configure script.
4586
4587 If you have a C compiler in a non-standard location, you
4588 can use the HPUX_CCDIR[12] environment variables to name
4589 the path to it. Consult the 00XCONFIG file of the lsof
4590 distribution for more information.
4591
4592 9.2.5 Why does Configure complain about q4 for /dev/kmem-based lsof
4593 for HP-UX 11?
4594
4595 When you run Configure on an HP-UX 11 system, it may complain:
4596
4597 !!!ERROR!!! !!!ERROR!!! !!!ERROR!!! !!!ERROR!!!
4598 Configure can't use /usr/contrib/bin/q4 to examine the ipis_s
4599 structure. You must do that yourself, report the result in
4600 the HPUX_IPC_S_PATCH environment variable, then repeat the
4601 Configure step. Consult the Configure script's use of
4602 /usr/contrib/bin/q4 and the 00XCONFIG file for information
4603 on ipis_s testing and the setting of HPUX_IPC_S_PATCH.
4604 !!!ERROR!!! !!!ERROR!!! !!!ERROR!!! !!!ERROR!!!
4605
4606 This message states that Configure cannot use q4 from
4607 /usr/contrib/bin to examine the kernel's boot image for
4608 the ipis_s structure. Maybe q4 hasn't been installed, or
4609 perhaps Configure can't execute it.
4610
4611 Lsof needs to gather information about ipis_s to determine
4612 if the ipis_s structure is defined in the kernel boot image,
4613 if the ipis_s structure of the kernel boot image has an
4614 ipis_msgsqueued member, and if the ipc_s structure of the
4615 kernel boot image uses has an ipc_ipis member.
4616
4617 The ipis_s structure isn't described in any header file
4618 HP-UX releases with HP-UX 11. It appears in the private
4619 lsof header file .../dialects/hpux/kmem/hpux11/ipc_s.h.
4620 Lsof gets local and remote connection addresses (IP and
4621 port numbers) from ipc_s, so an incorrect ipc_s definition
4622 may cause incorrect reporting of TCP/IP connection addresses.
4623 It definitely will cause incorrect reporting on 32 bit
4624 kernels. In any case lsof should be compiled with a correct
4625 ipc_s definition no matter the kernel bit size, so the
4626 Configure script always tests for it when the HP-UX version
4627 is 11.
4628
4629 For lsof's Configure script to gather the necessary ipis_s
4630 information q4 needs to be installed in /usr/contrib/bin
4631 and the kernel boot image, /stand/vmunix, needs to have
4632 been processed with pxdb. If either is untrue, lsof issues
4633 the above error message, perhaps preceded by q4 messages.
4634 (Note: lsof's use of q4 may also fail if q4 can't execute
4635 nm -- e.g., it can't find /usr/bin/nm, or there is a
4636 conflicting, private version of nm earlier in the path.)
4637
4638 If /stand/vmunix hasn't been processed by pxdb, the q4
4639 messages will include:
4640
4641 q4: (error) vmunix not pxdb'd
4642 or
4643 q4: (warning) /stand/vmunix has not been processed by pxdb.
4644
4645 It's possible to make a suitable private copy of /stand/vmunix
4646 for configuring lsof. That requires /opt/langtools/bin/pxdb
4647 or the q4 version of pxdb from /usr/contrib/bin/q4pxdb.
4648 The path to the result is supplied to the lsof Configure
4649 script in the HPUX_BOOTFILE environment variable. Configure
4650 still requires /usr/contrib/bin/q4.
4651
4652 The following sample Bourne shell commands make a private
4653 copy of /stand/vmunix in /tmp, process it with pxdb or
4654 q4pxdb, and supply its path to lsof's Configure script in
4655 HPUX_BOOTFILE.
4656
4657 $ cp /stand/vmunix /tmp/vmunix.lsof
4658
4659 $ /opt/langtools/bin/pxdb /tmp/vmunix.lsof
4660 or
4661 $ /usr/contrib/bin/q4pxdb /tmp/vmunix.lsof
4662
4663 ... pxdb messages ...
4664 $ HPUX_BOOTFILE=/tmp/vmunix.lsof Configure -n hpux
4665
4666 It may also be necessary to use q4 outside the lsof Configure
4667 script. In that case q4 can be to determine the state of
4668 ipis_s and ipc_s with these q4 commands:
4669
4670 $ /usr/contrib/bin/q4 /stand/vmunix
4671 ...
4672 q4> fields -c struct ipc_s
4673 ...
4674 q4> fields -c struct ipis_s
4675
4676 Look in the q4 output for the ipc_ipis member of the ipc_s
4677 structure, and look in the q4 output for the ipis_s structure
4678 for the ipis_msgsqueued member. If ipc_s has ipc_ipis but
4679 ipis_s lacks ipis_msgsqueued, set HPUX_IPC_S_PATCH environment
4680 variable to "1". If ipc_s has ipc_ipis and ipis_s has
4681 ipis_msgsqueued, set HPUX_IPC_S_PATCH to "2" -- e.g.,
4682
4683 $ HPUX_IPC_S_PATCH=1 Configure -n hpux
4684 or
4685 $ HPUX_IPC_S_PATCH=2 Configure -n hpux
4686
4687 If ipc_s has no ipc_ipis member, set HPUX_IPC_S_PATCH to
4688 "N" -- e.g., use this Configure step:
4689
4690 $ HPUX_IPC_S_PATCH=N Configure -n hpux
4691
4692 9.2.6 When compiling /dev/kmem-based lsof for HP-UX 11 what do the
4693 "aCC runtime: ERROR..." messages mean?
4694
4695 When the lsof Makefile asks the HP-UX unbundled compiler
4696 to load lsof, it may complain:
4697
4698 /bin/cc -o lsof -DHPUXV=1100 -DHASVXFS -DHPUXKERNBITS=64 \
4699 -I/home/abe/src/lsof4/dialects/hpux/kmem/hpux11 +DD64 \
4700 -DHAS_IPC_S_PATCH=2 -I/home/abe/src/lsof4/dialects/hpux/kmem \
4701 -DLSOF_VSTR=\"B.11.00\" -g dfile.o dmnt.o dnode.o dnode1.o \
4702 dnode2.o dproc.o dsock.o dstore.o arg.o main.o misc.o \
4703 node.o print.o proc.o store.o usage.o -L./lib -llsof -lelf \
4704 -lnsl
4705 aCC runtime: ERROR: Unexpected use of shared libraries
4706 aCC runtime: ERROR: Read aCC manpage, +A option
4707 /usr/lib/nls/loc/locales.1//is_IS.iso88591
4708
4709 This is a bug in the HP-UX national language support.
4710 (Notice the last message with "locales" in it?) Complain
4711 to HP -- then use this work-around before executing make:
4712
4713 $ unset LANG
4714 $ make
4715
4716 9.2.7 Why doesn't /dev/kmem-based lsof for HP-UX 11 report VxFS file
4717 link counts, node numbers, and sizes correctly?
4718
4719 This is usually the result of running an lsof binary whose
4720 revision number is less than 4.57 on a system that has
4721 OnlineJFS support installed. It can also happen with lsof
4722 4.57 binaries when the OnlineJFS support with which they
4723 were built doesn't match the OnlineJFS status of the system
4724 on which they are run.
4725
4726 The OnlineJFS status of lsof 4.57 and higher binaries can
4727 be determined by running:
4728
4729 $ lsof -v 2>&1 | grep HASONLINEJFS
4730
4731 If that shell pipe produces output, lsof was compiled with
4732 OnlineJFS support enabled; no output, disabled.
4733
4734 If OnlineJFS is installed on an HP-UX 11 system the
4735 /sbin/fs/vxfs/subtype executable exists and outputs "vxfs3.3"
4736 when run.
4737
4738 The problem occurs because the optional OnlineJFS support
4739 installation doesn't update <sys/fs/vx_inode.h>. Consequently
4740 lsof can be compiled with an incorrect definition of the
4741 vx_inode structure and look for for link counts, node
4742 numbers, and sizes in the wrong places in the structure.
4743
4744 The current response I have gotten from HP is that no
4745 <sys/fs/vx_inode.h> update will be provided for OnlineJFS.
4746
4747 I've addressed this problem temporarily with a work-around
4748 (hack) in lsof revision 4.57.
4749
4750 9.2.8 Why can't /dev/kmem-based lsof be built with gcc for 64 bit
4751 HP-UX 11?
4752
4753 When Configure is given the "hpuxgcc" abbreviation, the
4754 HP-UX version is 11, and the kernel bit size is 64, the
4755 lsof Configure script may abort with the messages:
4756
4757 !!!!!!!!!!!!!!!!! FATAL ERROR !!!!!!!!!!!!!!!!!!
4758
4759 APPARENTLY GCC CANNOT BUILD 64 BIT EXECUTABLES.
4760 A COMPILER MUST BE USED THAT CAN. SEE 00FAQ
4761 FOR MORE INFORMATION.
4762
4763 (This is the "more information" in 00FAQ.)
4764
4765 This means the Configure script compiled a test program
4766 with gcc the result wasn't an ELF-64 binary. Lsof tries
4767 two gcc modes, one with no options and another with the
4768 -mlp64 option, before it concludes gcc can't be used.
4769
4770 See the "How can I acquire a gcc for building lsof for 64
4771 bit HP-UX 11?" answer for information on where you might
4772 be able to get a gcc for HP-UX 11 that can produce ELF-64
4773 executables.
4774
4775 9.2.8.1 How can I acquire a gcc for building lsof for 64 bit HP-UX 11?
4776
4777 Check this HP URL:
4778
4779 http://h21007.www2.hp.com/dspp/tech/tech_TechSoftwareDetailPage_IDX/1,1703,547,00.html
4780
4781 (That's one very long link; be careful you cut 'n paste it
4782 all.)
4783
4784 In November 2001 that URL led to a web page whose title
4785 was "gcc for hp-ux 11." The page offered a link for
4786 downloading a 64 bit gcc 3.0 compiler for HP-UX 11.0 and
4787 11i. Rich Rauenzahn of HP installed that compiler on an
4788 HP test system he allows me to use and I successfully built
4789 a 64 bit lsof with it.
4790
4791 The HP package may install the 64 bit capable gcc in
4792 /usr/local/pa20_64/bin/gcc, so you may have to adjust your
4793 path or set the LSOF_CC environment variable to compensate.
4794
4795 9.2.9 Why does /dev/kmem-based lsof for HP-UX 11 report "unknown file
4796 system type" for some open files?
4797
4798 The lsof binary being used probably doesn't have support for
4799 the VxFS file system.
4800
4801 To confirm that, check `lsof -v` output for "-DHASVXFS". If
4802 it's not present, lsof doesn't have VxFS support.
4803
4804 You also need to establish that lsof really is complaining
4805 about VxFS files by checking the kernel boot file for the
4806 symbol associated with the hexadecimal address reported in the
4807 "unknown file system type" message -- e.g., "v_op: 0x8711c8."
4808 Use nm(1) to do that:
4809
4810 $ nm -x /stand/vmunix | grep 8711c8
4811
4812 If nm reports the symbol associated with the address is
4813 vx_vnodeops, then lsof is complaining about an open VxFS file.
4814
4815 The solution in that case is to build lsof yourself (The
4816 bundled C compiler will do it.), making sure that lsof's
4817 Configure script detects the presence of VxFS. Configure does
4818 that by finding these two header files:
4819
4820 /usr/include/sys/fs/vx_hpux.h
4821 /usr/include/sys/fs/vx_inode.h
4822
4823 If the system where you are building lsof doesn't have those
4824 header files, but does have VxFS, you might be able to install
4825 the header files by installing the HP JournalFS package from
4826 the CoreOS CD -- in particular the file set JournalFS.VXFS-PRG
4827 and its associated patch, PHKL_18543. (My thanks to Steve
4828 Bonds for that information.)
4829
4830 Finally, if you find that lsof isn't complaining about VxFS
4831 when it complains about an unknown file system type, send
4832 e-mail to me <[email protected]> for further assistance. Make
4833 sure "lsof" appears in the "Subject:" line so my e-mail filter
4834 won't classify your letter as Spam.
4835
4836 9.2.10 Why does the ANSI-C compiler complain about comments in HP-UX
4837 11 header files?
4838
4839 When compiling lsof on HP-UX 11, the HP ANSI-C compiler's
4840 pre-processor, cpp, may complain about comments in HP-UX header
4841 files -- e.g.,
4842
4843 cpp: "/usr/include/sys/cdfs.h", line 232: warning 2028:
4844 Found comment inside comment started on line 232.
4845 cpp: "/usr/include/sys/cdnode.h", line 196: warning 2028:
4846 Found comment inside comment started on line 196.
4847 cpp: "/usr/include/nfs/snode.h", line 30: warning 2028:
4848 Found comment inside comment started on line 30
4849
4850 This is not a problem with lsof. It is a problem with the
4851 HP-UX header files; they have non-compliant ANSI-C comment
4852 sequences in them -- e.g.,
4853
4854 <sys/cdfs.h>: 232
4855 /* struct cdfs *cdfs_link; /* linked list of file systems */
4856
4857 The initial "/*" is not terminated by an ending "*/" before the
4858 appearance of a second "/*".
4859
4860 9.2.11 Why does dnode1.c cause the HP-UX 11 compiler to complain that
4861 <sys/fs/vx_inode.h> is missing or incorrect?
4862
4863 If CFLAGS in the lsof Makefile for an HP-UX 11 compilation
4864 includes HASONLINEJFS, indicating the system has OnlineJFS
4865 support, lsof needs the <sys/fs/vx_inode.h> header file.
4866 Sometimes it is missing from /usr/include/sys/fs.
4867
4868 <sys/fs/vx_inode.h> is a header file that must be obtained from
4869 Veritas. If that proves impossible, please contact me via
4870 e-mail at <[email protected]>. Make sure "lsof" appears in the
4871 "Subject:" line so my e-mail filter won't classify your letter
4872 as Spam.
4873
4874
4875 9.3 PSTAT-based HP-UX lsof Questions
4876
4877 The sources for PSTAT-based lsof for HP-UX may be found in
4878 lsof_<revision>/dialects/hpux/pstat.
4879
4880 Lsof's Configure shell script decides to use these sources
4881 when it finds that the /usr/include/sys/pstat subdirectory
4882 exists.
4883
4884 Lsof can be forced to use the PSTAT-based sources by setting
4885 "pstat" in the HPUX_BASE environment variable. Consult
4886 the Configure shell script and 00XPORTING for more information.
4887
4888 9.3.1 Why does PSTAT-based lsof complain about pst_static and
4889 other PSTAT structures?
4890
4891 When lsof starts it may issue one of these fatal error
4892 messages:
4893
4894 lsof: FATAL: can't determine PSTAT static size
4895 lsof: FATAL: can't read <n> bytes of pst_static
4896 lsof: FATAL: pst_static doesn't contain <name>_size
4897 lsof: FATAL: <name>_size should be <n>
4898
4899 These messages indicate that lsof's tests for the proper
4900 level of PSTAT support have failed. The structure names,
4901 given in <name>, and sizes, given in <n>, identify the
4902 support deficiency more precisely.
4903
4904 You may need to upgrade the PSTAT support in your kernel
4905 to be able to use PSTAT-based lsof.
4906
4907 9.3.2 Why does PSTAT-based lsof complain it can't read pst_*
4908 structures?
4909
4910 Lsof may put messages like the following in the NAME
4911 column of its output.
4912
4913 can't read cwd pst_filedetails: Permission denied
4914 can't read mem pst_filedetails: Permission denied
4915 can't read rtd pst_filedetails: Permission denied
4916 can't read txt pst_filedetails: Permission denied
4917 can't read pst_filedetails: Permission denied
4918 can't read 3 stream structures: Permission denied
4919 can't read pst_socket: Permission denied
4920
4921 These messages indicate that the lsof binary lacks the
4922 authority to read the name structures for processes other
4923 than ones belonging to the UID under which lsof is running.
4924 Authority to read the structures of other processes is
4925 limited to root processes -- i.e., lsof must have setuid-root
4926 permission if it is to list open files for arbitrary
4927 processes.
4928
4929 If you want to eliminate these errors, you must run lsof
4930 as root or install it with setuid-root permission.
4931
4932 9.3.3 Why does PSTAT-based lsof rebuild the device cache file
4933 after each reboot?
4934
4935 After each HP-UX rebuild, the first time a user runs lsof it
4936 will report:
4937
4938 lsof: WARNING: device cache mismatch: /dev/tun...
4939 lsof: WARNING: created device cache file: /<user_path>
4940
4941 This happens because the device numbers on /dev/tun* device
4942 nodes are recalculated at each reboot. When lsof detects
4943 a change in the device number of a /dev/tun* file, it rebuilds
4944 its local device cache file.
4945
4946 9.3.4 Why doesn't PSTAT-based lsof report TCP addresses for
4947 telnetd's open socket files?
4948
4949 When lsof can't report TCP addresses for telnetd's open
4950 socket files it is because an unpatched PSTAT kernel
4951 interface doesn't report the addresses to lsof.
4952
4953 This has been addressed in PSTAT kernel patch PHKL_24047.
4954 It is available from the HP IT Resource Center at:
4955
4956 http://itrc.hp.com
4957
4958 In the page's "maintenance / support" box select the
4959 "individual patches" link. Once at its page, select the
4960 "hp-ux" link. On that page select the "Series 800" or
4961 "Series 700" radio button and select "11.11" from the
4962 pull-down list to the right of the button. Under "search
4963 or browse the path list" select "Search by Patch IDs" from
4964 the pull down list, enter PHKL_24047 in the following text
4965 box, and select search. That should lead to information
4966 about PHKL_24047 and a link for downloading it. (You may
4967 have to log in first and you may have to create a login
4968 identity by registering before you can log in.)
4969
4970 Some time in March 2006 the PHKL_24047 patch was "lost"
4971 by the HP-UX networking lab. It has been "found" again
4972 in August 2006 and will be re-released as a GRO patch
4973 "some time." I don't yet know when that will be. You
4974 must contact HP to learn about the availability of the
4975 GRO patch.
4976
4977 9.3.5 Why does PSTAT-based lsof cause an HP-UX 11.11 kernel panic?
4978
4979 When PSTAT-based lsof runs on some HP-UX 11.11 kernels,
4980 the kernel may panic. Symptoms include:
4981
4982 Console message:
4983 0xFBE000301100EF00 00000000 0000EF00 -
4984 type 31 = legacy PA HEX chassis-code
4985
4986 /var/adm/syslog:
4987 ... vmunix: Trap Type 15 (Data page fault)
4988 ... vmunix: Instruction Address (pcsq.pcoq) = 0x...
4989
4990 The panic is caused by a bug in the way PSTAT's pstat_getstream()
4991 function obtains module names from streams managed by the
4992 otsam stream driver (part of OSI Transport Services). Lsof
4993 calls pstat_getstream() when it encounters an open otsam
4994 stream file. An HP-UX 11.11 system uses otsam if otsam
4995 appears in /stand/system.
4996
4997 HP-UX 11.11 patch PHKL_24507 (available some time after
4998 July 15, 2001) fixes the pstat_getstream() bug. See the
4999 information in the answer to the "Why doesn't PSTAT-based
5000 lsof report TCP addresses for telnetd's open socket files?"
5001 question for information on how to obtain the patch.
5002
5003 9.3.6 Why doesn't PSTAT-based lsof report a CWD that is on a loopback
5004 (LOFS) file system?
5005
5006 When PSTAT-based lsof reports on processes whose current
5007 working directory (CWD) is on a loopback file system, lsof
5008 can't report the open CWD file. The reason is that the HP-UX
5009 11.11 and above kernel's loopback file system code is not
5010 passing the CWD file ID to the kernel's pstat(2) code. Hence
5011 lsof is given no information on the lofs CWD.
5012
5013 The problem was first reported to me by Ermin Borovac and an
5014 internal bug report was filed with the HP-UX file system group
5015 on October 26, 2004. That report has now been answered by the
5016 patch PHKL_33200 -- s700_800 11.11 lofs cumulative patch. The
5017 HP IT Resource Center (http://itrc.hp.com) is a source for the
5018 patch.
5019
5020 9.3.7 Why do some swinstall packages for PSTAT-based HP-UX 11.11
5021 packages complain about setgid and setuid bits?
5022
5023 First, let me explain that I do not provide lsof swinstall
5024 packages for lsof. Others provide them and they should be
5025 contacted about problems with their packages.
5026
5027 However, I have become aware of a problem with one package
5028 about which I have some information I can share. The problem
5029 shows up in these swinstall messages:
5030
5031 ERROR: Unknown owner and/or group for file
5032 "/usr/local/bin/lsof". SUID and/or SGID bit was
5033 not set.
5034 ERROR: Failed installing fileset "lsof.lsof-RUN,r=4.73".
5035 Check the above output for details.
5036
5037 The swpackage SUID/SGID functionality was restricted by changes
5038 for POSIX compliance, breaking backward compatibility. The
5039 patch PHCO_27671 allows SUID/SGID for uid/gid of 0 only, as a
5040 compromise between backward compatibility and POSIX conformance.
5041
5042 If the setuid bit is to be set on the executable, the UID and
5043 GID of the executable must be 0 (zero).
5044
5045 9.3.8 Why won't the bundled C compiler build PSTAT-based lsof for
5046 PA-RISC HP-UX 11.23?
5047
5048 A PA-RISC HP-UX 11.23 bundled C compiler dated May 2005 or
5049 later will not build PSTAT-based lsof. It will deliver error
5050 messages related to the system's <gssapi/gssapi.h> header
5051 file.
5052
5053 There is nothing wrong with that header file or lsof. The
5054 problem is that the bundled C compiler can't cope with the
5055 gssapi.h header file.
5056
5057 The work-around is to use the HP ANSI C compiler. Using gcc
5058 is not a satisfactory work-around. See the answer to the "Why
5059 won't gcc build PSTAT-based lsof for PA-RISC HP-UX 11.23?"
5060 question for more information.
5061
5062 9.3.9 Why won't gcc build PSTAT-based lsof for PA-RISC HP-UX 11.23?
5063
5064 Gcc will not even compile PSTAT-based lsof revisions below 4.77
5065 for PA-RISC HP-UX 11.23 dated May 2005 or later. It reports
5066 errors in lsof's print.c fill_portmap() function about missing
5067 members of the rpcent structure. That happens because gcc
5068 defines _XOPEN_SOURCE_EXTENDED which disables the definition of
5069 the rpcent structure in <netdb.h>.
5070
5071 Using the HP bundled C compiler is not a viable work-around.
5072 That is explained in the answer to the "Why won't the bundled C
5073 compiler build PSTAT-based lsof for PA-RISC HP-UX 11.23?"
5074
5075 While an lsof revision 4.77 or higher can be compiled with gcc,
5076 the results are unreliable. Lsof will compile, but it
5077 occasionally produces segment faults when it runs. I have not
5078 been able to reproduce the failure reliably or locate a
5079 debugger that will work with the gcc-compiled lsof.
5080
5081 The only reliable work-around is to use the HP ANSI C
5082 compiler.
5083
5084 9.3.10 Why does PSTAT-based lsof complain, "FATAL: pst_stream_size
5085 should be: 672; is 72" on HP-UX 11.11 and above?
5086
5087 This message indicates a mismatch between the PSTAT header
5088 files used to build lsof (<sys/pstat.h> and those in the
5089 /usr/include/sys/pstat subdirectory), and those that built the
5090 running kernel.
5091
5092 Unfortunately the June 2008 patch set for HP-UX 11.23 creates
5093 this inconsistency, because it does not contain all the patches
5094 needed to match the kernel with the PSTAT header files. Even
5095 more serious is that the missing patches update the kernel's
5096 PSTAT support to provide TCP/UDP endpoint information to lsof
5097 from TCP/TLI streams.
5098
5099 The patch inconsistency comes about because, while the following
5100 patch is installed,
5101
5102 PHKL_36577 1.0 PM-PSTAT section 2 manpage changes
5103
5104 other kernel patches are not.
5105
5106 The PHKL_36577 patch updates the PSTAT header files and manual
5107 pages to match kernel changes that other patches with the
5108 following numbers (or patches that contain or supersede them)
5109 contain:
5110
5111 PHNE_36575 1.0 Cumulative STREAMS Patch
5112 PHNE_37670 1.0 cumulative ARPA Transport patch
5113 PHNE_37851 1.0 NFS cumulative patch
5114
5115 Those patches implement the kernel changes that support the
5116 delivery of information promised in patch PHKL_36577.
5117
5118 The work-around is to install the missing patches.
5119
5120 9.4 Why won't the HP-UX depot install?
5121
5122 I don't distribute lsof depots, so I can't support them.
5123
5124 From time to time depots prepared by various sites -- e.g.,
5125 usually HP-UX software collection sites -- will contain errors
5126 that cause installation of the depot to fail.
5127
5128 Do not contact me when this happens. Instead, contact the
5129 administrator of the site that prepared the depot.
5130
5131 As should be clear from the bulk of the lsof documentation, I
5132 do not recommend you use pre-built lsof binaries in any form.
5133 Instead, I recommend you obtain the lsof source distribution
5134 and build lsof yourself.
5135
5136
5137 10.0 Linux
5138
5139 10.1 What do /dev/kmem-based and /proc-based lsof mean?
5140
5141 At approximately Linux 2.1.72 and exactly at lsof revision
5142 4.23 support for Linux forks. The first fork, containing
5143 the oldest lsof form is based on access to kernel memory
5144 structures, and is called /dev/kmem-based lsof. A
5145 /dev/kmem-based lsof is heavily intertwined with the Linux
5146 kernel version, its header files, and its system map file.
5147 Typically a /dev/kmem-based lsof needs only setgid permission
5148 to local all open file information.
5149
5150 After approximately Linux 2.1.72 and at revision 4.23 lsof
5151 obtains all its information from the /proc file system.
5152 That lsof is called the /proc-based lsof. A /proc-based
5153 lsof does not read kernel memory, needs neither kernel
5154 header files nor the system map file, and is less likely
5155 to be affected by Linux kernel changes. However, it does
5156 require setuid-root permission to list all open files, and
5157 it can't report file offsets (positions).
5158
5159 After revision 4.52 the /dev/kmem-based Linux sources for
5160 lsof are no longer distributed. Information about them
5161 may be found in the 00INDEX and README files at:
5162
5163 ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/OLD/src
5164
5165 10.2 /proc-based Linux lsof Questions
5166
5167 10.2.1 Why doesn't /proc-based lsof report file offsets (positions)?
5168
5169 /proc-based lsof revisions 4.79 and above can only report file
5170 offsets (positions) for the files of Linux kernels 2.6.22 and
5171 above.
5172
5173 During its initialization /proc-based lsof tests to see if
5174 offset information can be obtained. If it cannot, lsof
5175 disables offset reporting. If the -o option was selected, lsof
5176 also issues this warning:
5177
5178 lsof: WARNING: can't report offset; disregarding -o.
5179
5180
5181 10.2.2 Why does /proc-based lsof report "can't identify protocol" for
5182 some socket files?
5183
5184 /proc-based lsof may report:
5185
5186 COMMAND PID ... TYPE ... NODE NAME
5187 pump 226 ... sock ... 309 can't identify protocol
5188
5189 This means that it can't identify the protocol (i.e., the
5190 AF_* designation) being used by the open socket file. Lsof
5191 identifies protocols by matching the node number associated
5192 with the /proc/<PID>/fd entry to the node numbers found in
5193 selected files of the /proc/net sub-directory. Currently
5194 /proc-based lsof examines these protocol files:
5195
5196 /proc/net/ax25 (untested)
5197 /proc/net/icmp
5198 /proc/net/ipx (needs kernel patch)
5199 /proc/net/netlink
5200 /proc/net/packet
5201 /proc/net/raw
5202 /proc/net/raw6
5203 /proc/net/sctp/assocs
5204 /proc/net/sctp/eps
5205 /proc/net/sockstat
5206 /proc/net/sockstat6
5207 /proc/net/tcp
5208 /proc/net/tcp6
5209 /proc/net/udp
5210 /proc/net/udp6
5211 /proc/net/udplite
5212 /proc/net/udplite6
5213 /proc/net/unix
5214
5215 If /proc-based lsof says it can't identify the protocol
5216 for an open socket file, you may be able to identify the
5217 protocol yourself by using grep to look for the specific
5218 node number in the files of /proc/net -- e.g.,
5219
5220 $ grep <node_number> /proc/net/*
5221
5222 You may not be able to find the desired node number, because
5223 not all kernel protocol modules fully support /proc/net
5224 information.
5225
5226 If you find a matching node number in a /proc/net file that is
5227 not currently being processed by lsof, contact me via e-mail at
5228 <[email protected]>. I'll discuss adding support to /proc-based
5229 lsof for the protocol of the /proc/net file with you. Make
5230 sure "lsof" appears in the "Subject:" line so my e-mail filter
5231 won't classify your letter as Spam.
5232
5233 The code that matches node numbers of open IPX protocol
5234 socket files to those in /proc/net/ipx requires Jonathan
5235 Sergent's Linux 2.1.79 patch to /usr/src/linux/net/ipx/af_ipx.c.
5236 The patch, suitable for input to Larry Wall's patch program,
5237 may be found in the lsof distribution file:
5238
5239 .../dialects/linux/proc/patches/net_ipx_af_ipx.c.patch
5240
5241 10.2.3 Why does /proc-based lsof warn about unsupported formats?
5242
5243 Lsof may issue the following warning:
5244
5245 lsof: WARNING: unsupported format: /proc/net/<file>
5246
5247 if the header line of the indicated <file> in /proc/net --
5248 ax25, ipx, raw, tcp, udp, or unix -- doesn't match what
5249 lsof expects to find.
5250
5251 When the header line of a /proc/net file isn't what lsof
5252 expects, lsof probably can't parse the rest of the file
5253 correctly and doesn't try. As a result, lsof can't report
5254 any NAME column information (e.g., local and remote addresses)
5255 for socket files bound to the indicated network protocol.
5256
5257 If you get this warning, please send me e-mail at <[email protected]>.
5258 Include the contents of the file lsof claims has an unsupported
5259 format. Make sure "lsof" appears in the "Subject:" line so my
5260 e-mail filter won't classify your letter as Spam.
5261
5262 10.2.4 Why does /proc-based lsof report "(deleted)" after a path name?
5263
5264 The "(deleted)" notation following a path name in /proc-based
5265 lsof's NAME column comes from the /proc/<PID>/fd/<FD> entry
5266 for the open file. It's the Linux kernel's way of indicating
5267 the file is open but has been unlinked (rm'd).
5268
5269 10.2.5 Why doesn't /proc-based lsof report full open file information
5270 for all processes?
5271
5272 /proc-based lsof can only report on processes whose /proc
5273 files it has permission to read. /proc normally grants
5274 permission to read all its files only to root or to the
5275 owning user ID.
5276
5277 Without permission to read most /proc files, lsof can only
5278 report full information for processes belonging to the user
5279 who is running lsof. /proc-based lsof may be able to report
5280 some information for all processes, depending on the
5281 permissions of their associated /proc files, but usually
5282 /proc-based lsof won't be able to access the files in
5283 /proc/<PID>/fd/ that describe regular open files.
5284
5285 If you want /proc-based lsof to report on all processes, you
5286 must install it with setuid-root permission.
5287
5288 10.2.6 Why won't Customize offer to change HASDCACHE or WARNDEVACCESS
5289 for /proc-based lsof?
5290
5291 /proc-based lsof doesn't read device information from /dev
5292 or the device cache file, so it makes no sense to change
5293 the state of device cache processing or /dev node accessibility
5294 warnings.
5295
5296 10.2.7 /proc-based lsof Linux NFS questions
5297
5298 10.2.7.1 Why can't lsof find files on an accessible NFS file system?
5299
5300 On occasion lsof may be unable to identify that an open
5301 file is on an NFS file system. This is most likely the
5302 result of a bug in the way the Linux kernel supplies
5303 information to the reader of /proc/mounts (lsof) -- sometimes
5304 that pseudo-file is truncated by the kernel.
5305
5306 One way to see if this is the case is to search for the
5307 NFS file system in /proc/mounts -- e.g.,
5308
5309 $ grep <NFS_file_system_mount_point> /proc/mounts
5310
5311 If you get no output or the third word of the output isn't
5312 "nfs", then lsof won't consider the file system an NFS file
5313 system.
5314
5315 A second test is to look at the end of /proc/mounts --
5316 e.g.,
5317
5318 $ tail /proc/mounts
5319
5320 If tail reports "# truncated" then /proc/mounts is incomplete
5321 because of a Linux kernel bug. The bug is documented at:
5322
5323 http://www.xss.co.at/sysinfo/mounts.html
5324
5325 The bug is fixed in Linux kernel 2.4.18, and possibly in
5326 some earlier Linux kernel versions.
5327
5328 10.2.7.2 Why can't lsof find files on an inaccessible NFS file system?
5329
5330 If lsof issues this message about a Linux file system,
5331 mounted from an NFS server:
5332
5333 lsof: WARNING: can't stat() nfs file system /xxx/yyy
5334
5335 Then lsof won't be able to find any open files on the file
5336 system.
5337
5338 That's because of an inadequacy in the Linux /proc file
5339 system. Its /proc/mounts file doesn't give the device
5340 doublet (major and minor numbers) of the file system as do
5341 many UNIX systems (e.g., Solaris). The only way lsof can
5342 get the device doublet for a Linux file system is to call
5343 stat(2) on the file system path, which fails if the NFS
5344 server isn't accessible.
5345
5346 When lsof doesn't know the device doublet of a file system,
5347 it can't find open files on the inaccessible file system,
5348 because it can't match the doublets of open files to the
5349 doublet of the inaccessible file system.
5350
5351 This topic is covered extensively in lsof(8) it its ALTERNATE
5352 DEVICE NUMBERS and BLOCKS AND TIMEOUTS sections.
5353
5354 10.2.8 Why doesn't /proc-based Linux lsof report socket options and
5355 values, socket state flags, and TCP options and values?
5356
5357 The Linux /proc file system doesn't report socket options
5358 and values, socket states, and TCP options and values to
5359 lsof.
5360
5361 10.2.9 Does /proc-based Linux lsof use a device cache?
5362
5363 No. The Linux /proc/<PID>/fd/* entries provide device names to
5364 lsof via readlink(2). It is not necessary to enable device
5365 cache processing for /proc-based Linux lsof via the Customize
5366 script or modifications to the Linux machine.h header file.
5367
5368 10.2.10 Why doesn't /proc-based Linux lsof report any or all file structure
5369 values for its +fcfgGn option?
5370
5371 /proc-based lsof revisions 4.79 and above can only report some
5372 file structure values for Linux kernels below 2.6.22.
5373
5374 When running on Linux kernels at 2.6.22 and above lsof 4.79 can
5375 report some file flag values -- i.e., in response to the +fg or
5376 +fG options. The flag values are obtained from the
5377 /proc/<PID>/fdinfo/ files introduced at Linux kernel 2.6.22.
5378
5379 /proc-based Linux lsof tests its availability to obtain file
5380 flag values at initialization. If values are not available,
5381 lsof disables file flag reporting. If the flags were requested
5382 with +fg or +fG, lsof displays this warning:
5383
5384 lsof: WARNING: can't report file flags; disregarding +f.
5385
5386 As a special note, when Linux lsof can report flag bits, it
5387 will not report 'R' for a read-only file. There is no
5388 read-only flag bit O_* symbol in <fcntl.h> (or <bits/fcntl.h>)
5389 and lsof reports only bits that are set. The absence of O_RDWR
5390 and O_WRONLY flag bits implies the file is read-only.
5391
5392 10.3 Special Linux file types
5393
5394 10.3.1 Why is ``DEL'' reported as a Linux file type?
5395
5396 Lsof usually reports entries from the Linux /proc/<PID>/maps
5397 file with ``mem'' in the TYPE column. However, when lsof can't
5398 stat(2) a path in the process' ``maps'' file and the ``maps''
5399 file entry contains ``(deleted)'', indicating the file was
5400 deleted after it had been opened, lsof reports the file type as
5401 ``DEL''.
5402
5403 10.3.2 Why is ``unknown'' reported as a Linux file type?
5404
5405 Lsof may report a Linux file's type as ``unknown'' in the TYPE
5406 column when lsof can't obtain complete stat(2) results for the
5407 file.
5408
5409 Usually the NAME column will contain a ``(stat: xxx)'' error
5410 message, but that could have been suppressed with the lsof
5411 ``-w'' option.
5412
5413 10.4 Linux ``mem'' Entry Problems
5414
5415 10.4.1 What do ``path dev=xxx'' and ``path inode=yyy'' mean in the
5416 NAME column of Linux ``mem'' file types?
5417
5418 When the device or inode number in the process' ``maps'' file
5419 entry doesn't match the stat(2) results from the file path,
5420 lsof reports the inconsistent information from the stat(2) of
5421 the path parenthetically after the path in the NAME column
5422 in one of these forms:
5423
5424 (path dev=xxx) only the device number,
5425 ``xxx'', from a stat(2) of the
5426 ``maps'' file entry path
5427 differs from the ``maps'' file
5428 entry value reported in the
5429 DEVICE column.
5430
5431 (path inode=yyy) only the inode number,
5432 ``yyy'', from a stat(2) of the
5433 ``maps'' file entry path
5434 differs from the ``maps'' file
5435 entry value reported in the
5436 NODE column.
5437
5438 (path dev=xxx inode=yyy) Both device and inode numbers
5439 differ.
5440
5441 Lsof reports the ``maps'' file device number in the DEVICE
5442 column and the inode number in the NODE column.
5443
5444 When device and inode mismatches occur, lsof suppresses the
5445 reporting of link count and size. See the answer to the "Why
5446 is neither link count nor size reported for some Linux ``DEL''
5447 and ``mem'' file types?" question for more information.
5448
5449 Device and inode inconsistencies can occur when a file at a
5450 ``maps'' path is replaced after the process has started, or
5451 when a different file system with similar path names is mounted
5452 on top of the original file system.
5453
5454 The device inconsistency parenthetical messages can be
5455 suppressed with lsof's ``-w'' option.
5456
5457 10.4.2 Why is neither link count nor size reported for some Linux
5458 ``DEL'' and ``mem'' file types?
5459
5460 Link count and size are not reported for some entries from the
5461 process' ``maps'' file because a stat(2) of the entry file path
5462 failed or stat(2) delivered device or inode numbers that don't
5463 match the ones in the ``maps'' entry.
5464
5465 When the stat(2) device or inode numbers don't match those in
5466 the ``maps'' file entry, it is likely that the stat(2) results
5467 don't apply to the file that was originally mapped by the
5468 process and whose path appears in the ``maps'' file entry, so
5469 lsof tries to avoid reporting possibly incorrect information.
5470
5471 See the answer to the "What do ``path dev=xxx'' and ``path
5472 inode=yyy'' mean in the NAME column of Linux ``mem'' file
5473 types?" for more information on how mismatched stat(2) device
5474 and inode numbers are reported.
5475
5476 10.5 Special Linux NAME column messages
5477
5478 10.5.1 What does ``(stat: xxx)'' mean in the NAME column of Linux
5479 files?
5480
5481 When lsof tried to stat(2) the path in the NAME column, the
5482 stat(2) system call failed and produced an error message of
5483 ``xxx''.
5484
5485 This situation usually occurs if the lsof process lacks
5486 permission to stat(2) the path -- e.g., the lsof executable
5487 lacks root permission, or lsof is attempting to stat(2) a path
5488 on an NFS device mounted with the root_squash option.
5489
5490 The message can be suppressed with lsof's ``-w'' option.
5491
5492 10.5.2 What does ``(readlink: xxx)'' mean in the NAME column of
5493 Linux files?
5494
5495 When lsof tried to convert the /proc/<PID>/fd path, reported in
5496 the NAME column, to its full and more meaningful path, the
5497 readlink(2) system call used to do the conversion failed. The
5498 readlink(2) failure message is ``xxx''.
5499
5500 This situation usually occurs if the lsof process lacks
5501 permission to readlink(2) some part of the path -- e.g., the
5502 lsof executable lacks root permission, or lsof is attempting to
5503 stat(2) a path on an NFS device mounted with the root_squash
5504 option.
5505
5506 The message can be suppressed with lsof's ``-w'' option.
5507
5508 10.6 Why is ``NOFD'' reported as a Linux file type?
5509
5510 When lsof lacks permission to use opendir() on the fd/
5511 subdirectory of a process' /proc/<PID> directory, it reports a
5512 single file of the type ``NOFD'' (for no file descriptors).
5513
5514 Lsof reports the /proc/<PID>/path in the NAME column,
5515 followed by "(opendir: xxx)", where ``xxx'' is the error
5516 message returned by opendir().
5517
5518 The ``NOFD'' entry can be suppressed with lsof's ``-w'' option.
5519
5520 10.7 Why does Linux lsof report a NAME column value that begins with
5521 ``/proc''?
5522
5523 When lsof has problems processing a ``/proc/<PID>'' entry --
5524 e.g., it can't convert the entry to a full and more meaningful
5525 path name, or it can't access the /proc/<PID>/fd subdirectory
5526 with opendir() -- it will report the /proc/<PID> path in the
5527 NAME column.
5528
5529 10.8 Linux /proc/net/tcp* and /proc/net/udp* issues
5530
5531 10.8.1 Why use the Linux -X option?
5532
5533 If you're not interested in TCP/IP socket information for a
5534 particular use of lsof, adding the -X option will make lsof run
5535 more quickly, because -X inhibits the reading of the
5536 /proc/net/tcp* and /proc/net/udp* files. For example, you may
5537 only be interested in knowing what process has a particular
5538 file open.
5539
5540 When the Linux system has a large number of open TCP/IP socket
5541 files, the time savings provided by -X can be significant.
5542
5543 10.8.2 Why does lsof say ``-i is useless when -X is specified''?
5544
5545 If -X is specified, lsof can't report much information on open
5546 TCP/IP socket files. However, lsof's -i option requests that
5547 information. Hence, the two options conflict and can't be used
5548 together.
5549
5550 10.8.3 Why does lsof say ``can't identify protocol (-X specified)''?
5551
5552 If the Linux lsof -X option is specified and an open socket
5553 file can't be identified without accessing the /proc/net/tcp*
5554 and /proc/net/udp* files, lsof will report that it can't
5555 identify the socket's protocol and that the failure may be
5556 caused by the -X specification
5557
5558
5559 11.0 NetBSD Problems
5560
5561 11.1 Why doesn't lsof report on open kernfs files?
5562
5563 Lsof doesn't report on open NetBSD kernfs files because the
5564 structures lsof needs aren't defined in the kernfs.h header
5565 file in /sys/misc/kernfs.
5566
5567 11.2 Why doesn't lsof report on open files on: file descriptor
5568 file systems; /proc file systems; 9660 (CD-ROM) file systems;
5569 MS-DOS (floppy disk) file systems; or kernel file systems?
5570
5571 Lsof is not able to report on open files on certain file
5572 system if /usr/src/sys/msdosfs didn't exist when the lsof
5573 Configure script ran and lsof was made. /usr/src/sys/msdosfs
5574 contains header files lsof needs for collecting data on
5575 certain file system files.
5576
5577 You can tell if an lsof executable above) lacks support
5578 for a file system if the following test of `lsof -v` produces
5579 nothing:
5580
5581 $ lsof -v 2>&1 | grep <support_enabled_definition>
5582
5583 The <support-enabled_definition> will be:
5584
5585 File System Type Definition Note
5586 ---------------- ---------- ----
5587 File descriptor HASFDESCFS
5588 /proc HASPROCFS
5589 9660 HAS9660FS
5590 MS-DOS HASMSDOSFS (lsof 4.61 and above)
5591 Kernel HASKERNFS
5592
5593 The work-around is to install /usr/src/sys, rerun the lsof
5594 Configure script, and remake lsof.
5595
5596 11.3 Why does lsof produce confusing results for nullfs file
5597 systems?
5598
5599 Consider this report from /sbin/mount:
5600
5601 /usr/home on /home type null (local)
5602
5603 (According to /sbin/mount /usr/home is the mounted-on device
5604 and /home is the mounted-on directory.)
5605
5606 When lsof is asked to report on open files on /home, it
5607 will report them as files on /usr/home instead. That's an
5608 artifact of the NetBSD kernel's dynamic name lookup cache
5609 (DNLC) and the way the kernel handles nullfs mounted-on
5610 directories.
5611
5612 While lsof will report all open files on /home when given
5613 /home as a file system directory argument, even though
5614 reporting them as located on /usr/home, lsof will not find
5615 the same files when asked to report on all open files on
5616 /usr/home when given /usr/home as a file system device
5617 argument. That's because from the mount perspective
5618 /usr/home is equivalent to a device, but from the device
5619 perspective it is still a directory.
5620
5621 So, what this lsof command reports:
5622
5623 $ lsof /home
5624 ... NAME
5625 ... /usr/home/...
5626
5627 Won't be duplicated by this lsof command:
5628
5629 $ lsof /usr/home
5630
5631 Another way to look at this confusing /home and /usr/home
5632 example is to consider what stat(2) reports. For /home
5633 stat(2) reports a device doublet that matches what lsof
5634 finds in open file node structures, while the device doublet
5635 stat(2) reports for /usr/home won't match what lsof finds.
5636 Nor does the mode reported by stat(2) indicate a block
5637 devices, as is the expected case.
5638
5639 There is no simple answer to this confusion, nor is there
5640 even a simple explanation. Simply be aware that when
5641 supplying file system arguments to lsof on NetBSD, use the
5642 mounted-on directory name for a nullfs as the lsof argument,
5643 and don't be surprised when the NAME column reports the
5644 mounted-on device name.
5645
5646 11.4 NetBSD header file problems
5647
5648 11.4.1 Why can't the compiler find some NetBSD header files?
5649
5650 If the compiler's pre-processor complains it can't find some
5651 header files when it compiles lsof source files, /usr/include
5652 and /usr/src may not have all the header files lsof needs.
5653
5654 As a work-around use the NETBSD_SYS environment variable
5655 to specify to lsof the location of the additional header
5656 files -- e.g.,
5657
5658 % setenv NETBSD_SYS /my_source
5659 % ./Configure -n netbsd
5660
5661 or
5662 $ NETBSD_SYS=/mys_source ./Configure -n netbsd
5663
5664 Caution: using this work-around may cause the lsof Configure
5665 script to activate or omit different features, depending
5666 on where it finds the header files that determine the state
5667 of the features.
5668
5669 11.4.2 Why does NetBSD lsof produce incorrect output?
5670
5671 If the NetBSD system's kernel was built from header files that
5672 don't match those in /usr/include -- e.g., //usr/src has the
5673 ones from which the kernel was built -- lsof may build, but
5674 won't produce correct output.
5675
5676 As a possible work-around, try directing the C compiler to
5677 select header files from /usr/src before it selects them from
5678 /usr/include. That can be done with the DEBUG make string --
5679 e.g.,
5680
5681 $ make DEBUG="-I/usr/src -I/usr/include"
5682
5683 If that work-around fails, try using the LSOF_INCLUDE and
5684 NETBSD_SYS environment variables to swap /usr/include and
5685 /usr/src when running the Configure script, then use the make
5686 DEBUG string when running make -- e.g.,
5687
5688 $ LSOF_INCLUDE=/usr/src; export LSOF_INCLUDE
5689 $ NETBSD_SYS=/usr/include; export NETBSD_SYS
5690 $ ./Configure -n netbsd
5691 $ make DEBUG="-I/usr/src -I/usr/include"
5692
5693 11.5 Why isn't lsof feature xxx enabled for NetBSD?
5694
5695 Lsof's Configure script enables NetBSD features by locating
5696 and examining header files associated with the features,
5697 and based on what it finds, setting compile-time definitions
5698 in Makefiles. (See 00PORTING for a list of the definitions.)
5699
5700 When Configure doesn't find header files or doesn't find
5701 appropriate values in header files, that may mean the header
5702 file tree lsof is searching is incomplete or out of date.
5703
5704 Lsof normally looks for NetBSD header files in /usr/include.
5705 It can also be directed to look in other directories --
5706 e.g., /sys -- if told to do so with the contents of the
5707 LSOF_INCLUDE and NETBSD_SYS environment variables.
5708
5709 To determine what header file enables a missing feature,
5710 check the NetBSD stanza in the Configure script. Then
5711 check the locations it checks for the indicated header
5712 files and contents.
5713
5714 See 00XCONFIG for more information on LSOF_INCLUDE and
5715 and NETBSD_SYS.
5716
5717
5718 13.0 OpenBSD Problems
5719
5720 13.1 Why doesn't lsof support kernfs on my OpenBSD system?
5721
5722 Lsof supports the kernel file system on OpenBSD versions
5723 whose /sys/miscfs/kernfs/kernfs.h (or <miscfs/kernfs/kernfs.h>
5724 header file correctly defines the kern_target structure.
5725 The lsof Configure script's openbsd stanza checks for the
5726 presence of the structure's kt_name element and activates
5727 kernfs support for the CFLAGS -DHASKERNFS definition only
5728 when it finds kt_name.
5729
5730 The kernfs.h header file is scheduled to be updated in the
5731 OpenBSD 2.1 release, according to Kenneth Stailey, who
5732 authored its changes.
5733
5734 13.2 Will lsof work on OpenBSD on non-x86-based architectures?
5735
5736 I've not tested lsof on an OpenBSD system that uses a
5737 non-x86-based architecture, but I've had one report that
5738 lsof 4.33 compiles and works on OpenBSD for the pmax
5739 architecture (decstation 3100).
5740
5741 13.3 <sys/pipe.h> problems
5742
5743 13.3.1 Why does the compiler claim nbpg isn't defined?
5744
5745 When compiling lsof on some (older) OpenBSD SPARC versions,
5746 the compiler may complain:
5747
5748 In file included from ../dlsof.h:191,
5749 from ../lsof.h:166,
5750 from fino.c:52:
5751 /usr/include/sys/pipe.h:83: `nbpg' undeclared here
5752 (not in a function)
5753 /usr/include/sys/pipe.h:83: size of array `ms' has
5754 non-integer type
5755
5756 This happens because <sys/pipe.h> uses NBPG from
5757 <machine/param.h> to size the `ms' array, and some OpenBSD
5758 systems define NBPG in terms of a kernel integer variable,
5759 nbpg.
5760
5761 Lsof revisions 4.46 and above have a hack to dlsof.h,
5762 developed by Volker Borchert that avoids the compiler
5763 problem for SPARC OpenBSD 2.3. The hack might work for
5764 other OpenBSD SPARC versions, but hasn't been tested there.
5765
5766 If you want to enable the hack for your OpenBSD SPARC
5767 version, modify this code in .../dialects/openbsd/dlsof.h:
5768
5769 # if defined(OPENBSDV)
5770 # if OPENBSDV==2030 && defined(__sparc__)
5771 # if defined(nbpg)
5772 #undef nbpg
5773 # endif /* defined(nbpg) */
5774 #define nbpg 4096 /* WARNING!!! ... */
5775 # endif /* OPENBSDV==2030 && defined(__sparc__) */
5776 #include <sys/pipe.h>
5777 #endif /* defined(OPENBSDV) */
5778
5779 You will probably want to change the second #if test to
5780 match your OpenBSD version. You may also want to change
5781 what value is assigned to nbpg. See the next section,
5782 "What value should I assign to nbpg?"
5783
5784 13.3.2 What value should I assign to nbpg?
5785
5786 If you need to enable the nbpg hack, described in "Why does
5787 the compiler claim nbpg isn't defined?", you may also need
5788 to assign a value other than 4096 to nbpg. 4096 works for
5789 the sun4c processor and should work for sun4m, but 8192
5790 may be needed for sun4.
5791
5792 Check <machine/param.h> and other OpenBSD documentation to
5793 determine the correct nbpg assignment.
5794
5795 13.4 Why doesn't lsof report on open MS-DOS file system (floppy
5796 disk) files?
5797
5798 Lsof is not able to report on open MS-DOS file system files
5799 if /usr/src/sys/msdosfs didn't exist when the lsof Configure
5800 script ran and lsof was made. /usr/src/sys/msdosfs contains
5801 header files lsof needs for collecting data on MS-DOS file
5802 system files.
5803
5804 You can tell if an lsof executable (revisions 4.61 and
5805 above) lacks MS-DOS file system support if the following
5806 command reports nothing:
5807
5808 $ lsof -v 2>&1 | grep HASMSDOSFS
5809
5810 The work-around is to install /usr/src/sys, rerun the lsof
5811 Configure script, and remake lsof.
5812
5813 13.5 Why isn't lsof feature xxx enabled for OpenBSD?
5814
5815 Lsof's Configure script enables OpenBSD features by locating
5816 and examining header files associated with the features,
5817 and based on what if finds, setting compile-time definitions
5818 in Makefiles. (See 00PORTING for a list of the definitions.)
5819
5820 When Configure doesn't find header files or doesn't find
5821 appropriate values in header files, that may mean the header
5822 file tree lsof is searching is incomplete or out of date.
5823
5824 Lsof normally looks for OpenBSD header files in /usr/include
5825 and /sys. It can also be directed to look in other
5826 directories if told to do so with the contents of the
5827 LSOF_INCLUDE and NETBSD_SYS environment variables.
5828
5829 To determine what header file enables a missing feature,
5830 check the OpenBSD stanza in the Configure script. Then
5831 check the locations it checks for the indicated header
5832 files and contents.
5833
5834 See 00XCONFIG for more information on LSOF_INCLUDE and
5835 and NETBSD_SYS.
5836
5837
5838 14.0 Output Problems
5839
5840 14.1 Why do the lsof column sizes change?
5841
5842 Lsof dynamically sizes its output columns each time it runs
5843 to make sure that each column takes the minimum space.
5844 Column parsing -- e.g., with awk -- is possible, because
5845 each column is guaranteed to be separated from the preceding
5846 one by at lease one space, and no column except the last
5847 (NAME) contains embedded spaces.
5848
5849 14.2 Why does the offset have ``0t' and ``0x'' prefixes?
5850
5851 The offset value that appears in the SIZE/OFF column has
5852 ``0t' and ``0x'' prefixes to distinguish it from size values
5853 that may appear in the same column.
5854
5855 Normally if the offset value is less than 100,000,000 (8
5856 digits), it appears in decimal with a ``0t' prefix; over
5857 99,999,999, in hexadecimal with a ``0x'' prefix.
5858
5859 A decimal offset is handy, for example, when tracking the
5860 progress of an outbound ftp transfer. When lsof reports
5861 on the ftp process, it will report the size of the file
5862 being sent with its open descriptor; it will report the
5863 progress of the transfer via the offset of the outbound
5864 open ftp data socket descriptor.
5865
5866 The ``-o [n]'' option may be used to specify the maximum
5867 number of decimal digits to be printed after ``0t'' before
5868 lsof switches to the hexadecimal digits after `0x''. As
5869 already noted, the default decimal digit count is 8.
5870
5871 14.3 What are the values printed in the FILE_FLAG column
5872 and why is 0x<value> sometimes included?
5873
5874 The two comma separated lists, separated by a semicolon,
5875 printed in the FILE-FLAG column (when the "+fg" option is
5876 specified), are short-hand names or hexadecimal values for
5877 the bits lsof finds in the f_flag or f_flags member of file
5878 structures for files (the first list, the one before the
5879 semicolon), and process open files flags found in various
5880 kernel structures, often named "pofile" (the second list,
5881 the one after the semicolon).
5882
5883 Lsof determines the short-hand names from symbols in the
5884 <fcntl.h>, <linux/fs.h>, <sys/fcntl.h>, <sys/fcntlcom.h>,
5885 o<sys/file.h>, and <sys/user.h> header files.
5886
5887 See the discussion of FILE-FLAG in the OUTPUT section of
5888 the lsof man page, and the FF_* and POF_* symbols in lsof.h
5889 for a list of the names.
5890
5891 Bits with no names defined for them are represented by an
5892 0x<value> member of the comma-separated list -- a hexadecimal
5893 integer. When "+fG" is specified (instead of "+fg"), lsof
5894 will list all flag values as two hexadecimal integers,
5895 separated by a semicolon.
5896
5897 When "-FG" is specified to get the flags in an output field,
5898 the format defaults to hexadecimal. You can get names
5899 instead by following "-FG" with "+fg" -- e.g.,
5900
5901 $ lsof -FG +fg ...
5902
5903 However, when you precede "-FG" with "+fg" -- e.g.,
5904
5905 $ lsof +fg -FG
5906
5907 the format will be hexadecimal; order is important.
5908
5909 14.3.1 Why doesn't lsof display FILE_FLAG values for my dialect?
5910
5911 All versions of lsof except the /proc-based Linux lsof
5912 report FILE-FLAG values. Lsof can't obtain FILE-FLAG
5913 information from the Linux /proc interface.
5914
5915 14.4 Network Addresses
5916
5917 14.4.1 Why does lsof's -n option cause IPv4 addresses, mapped to
5918 IPv6, to be displayed in IPv6 notation?
5919
5920 When you use the -n option to tell lsof to display numeric
5921 network addresses, and an IPv4 address has been mapped to
5922 IPv6, lsof displays the address in IPv6 format and puts
5923 "ipv4" in the TYPE column. That combination indicates the
5924 IPv4 address has been mapped to IPv6.
5925
5926 For example, the IPv4 address 1.2.3.4, when mapped to an
5927 IPv6 address, will be displayed by lsof as:
5928
5929 [::ffff:1.2.3.4]
5930
5931 The enclosing brackets are lsof's signal that this is an
5932 IPv6 address. Inside the brackets is a standard IPv6
5933 address, reported by inet_ntop(). The first two colons,
5934 signifying zeroes in the first 64 bits of the IPv6 address,
5935 and the hexadecimal ffff in the next 32 bits, indicate that
5936 the last 32 bits contains a mapped IPv4 address, which is
5937 then displayed in IPv4 dot notation.
5938
5939 14.5 Why does lsof output \x, ^x, or \xnn for characters
5940 sometimes?
5941
5942 Lsof displays only printable ASCII characters. Lsof
5943 considers a character printable if isprint(3) says it
5944 is. If isprint(3) says a character isn't printable,
5945 the lsof may page explains:
5946
5947 "... Non-printable characters are printed in one of
5948 three forms: the C ``\[bfrnt]'' form; the control
5949 character `^' form (e.g., ``^@''); or hexadecimal
5950 leading ``\x'' form (e.g., ``\xab''). Space is
5951 non-printable in the COMMAND column (``\x20'') and
5952 printable elsewhere."
5953
5954 14.5.1 Why is space considered a non-printable character in command
5955 names?
5956
5957 Space is considered an unprintable character in command
5958 names because it is sometimes possible to hide the full
5959 command name from scripts that parse ps(1) output by
5960 embedding a space in the name.
5961
5962 14.6 Why doesn't lsof print all the characters of a command name?
5963
5964 By default lsof prints the first nine characters of the
5965 names of commands associated with processes. If more
5966 characters are required, the "w" value of the "+c w" option
5967 may be used to specify a larger width.
5968
5969 If "w" is zero ('0') lsof will print all characters of all
5970 command names up to the limit of the number of characters
5971 supplied by the particular UNIX dialect. When reporting
5972 command names, lsof replaces non-printable characters as
5973 discussed in the answer to " Why does lsof output \x, ^x, or
5974 \xnn for characters sometimes?"
5975
5976 See the answer to the "Why is space considered a non-printable
5977 character in command names?" question for an explanation of why
5978 spaces are replaced by the ``\x20'' representation in command
5979 names.
5980
5981 The number of command name characters supplied to lsof by UNIX
5982 dialects in files and structures varies by dialect. For
5983 example, Linux 2.4.27 supplies lsof the first 15 characters of
5984 command names and Solaris 9 supplies 16. Thus, even if "w" is
5985 zero ('0'), lsof can't report more characters for command names
5986 on those two UNIX dialects than they provide lsof.
5987
5988 14.7 Why does lsof reject some -c command names, saying their lengths
5989 are "> what system provides (nn)"?
5990
5991 The command name length that a specific system provides varies
5992 from dialect to dialect. As noted in the answer to the "Why
5993 doesn't lsof print all the characters of a command name?"
5994 question, Linux and Solaris provide a limited number of command
5995 name characters.
5996
5997 When more characters are specified in the parameter to the -c
5998 option, lsof considers it an error and issues a fatal error
5999 message -- e.g.,
6000
6001 lsof: "-c xxxxyyyy" length (8) > what system provides (7)
6002
6003 The only work-around is to specify no more characters to -c
6004 that the system provides to lsof.
6005
6006 14.8 Why does lsof sometimes print TYPE numbers instead of names?
6007
6008 When lsof can't convert a type number to a name for printing in
6009 the TYPE column, it will report the number as four octets.
6010
6011 14.9 Marker line format problems
6012
6013 14.9.1 Why won't lsof accept a marker line format?
6014
6015 Lsof's Configure script must find the localtime(3) and
6016 strftime(3) functions in the dialect's C library in order to
6017 enable support for marker line formats.
6018
6019 Check the output of lsof's -v option for the presence of
6020 -DHAS_STRFTIME in the compiler flags. If it isn't there,
6021 Configure didn't find the necessary two C library functions.
6022
6023 If you think lsof should have found the functions, make a copy
6024 of the C test program in the Configure script that it uses to
6025 find the functions. Then use the copy, or a more informative
6026 modification of it, to learn why Configure can't find the
6027 functions. You can find that program by searching for
6028 strftime.
6029
6030 14.9.2 Why does lsof reject the NL (%n) marker line format?
6031
6032 When repeat mode and field output (with -F) have both been
6033 specified, lsof won't allow new line (NL) formats to be
6034 specified with ``%n''. That's because the marker line is
6035 always guaranteed to be a single line.
6036
6037 There is no work-around to this restriction.
6038
6039 14.10 How are protocol state name exclusion and inclusion used?
6040
6041 Protocol state name inclusion and exclusion with the ``-s p:s''
6042 option and its arguments have some issues to consider. Note:
6043 the ``-s p:s'' option is only available when the help output,
6044 obtained with -h or -?, shows it; it was a recent addition to
6045 lsof and is supported only on dialects where it could be
6046 tested.
6047
6048 First, there is the problem of determining what state names, if
6049 any, the dialect produces. Try running this lsof command to
6050 find them:
6051
6052 $ lsof -i
6053
6054 Knowing the state names of interest, the next problem is to
6055 decide on the lsof options and their parameters that will
6056 produce the desired output. Here some examples are probably
6057 the most useful.
6058
6059 To list only TCP socket files in LISTEN and CLOSE_WAIT states,
6060 use:
6061
6062 $ lsof -itcp -stcp:listen,close_wait
6063 or
6064 $ lsof -iTCP -sTCP:LISTEN,CLOSE_WAIT
6065
6066 Case isn't important to lsof in protocol and state names.
6067
6068 To exclude TCP socket files in CLOSE_WAIT state, use:
6069
6070 $ lsof -itcp -stcp:^close_wait
6071
6072 Note the `^' preceding close_wait; it selects exclusion. You
6073 can mix included and excluded names in a comma separated list,
6074 but you may not include and exclude the same name for the same
6075 protocol.
6076
6077 To list TCP files in LISTEN state and UDP files in Idle state,
6078 use:
6079
6080 $ lsof -i -stcp:listen -sudp:idle
6081
6082 Note: if you don't accompany the ``-s p:s'' list option and
6083 argguments with the -i option, lsof will list all other regular
6084 files, while applying the specified inclusion and exclusion
6085 specifications to network files. Generally, then, you want to
6086 use -i with -s.
6087
6088 14.10.1 Why doesn't my dialect support state name exclusion and inclusion?
6089
6090 When state name inclusion and exclusion was added, I had access
6091 to test systems for AIX, Darwin, FreeBSD, Linux, PSTAT-based
6092 HP-UX and Solaris.
6093
6094 Therefore, I was unable to add and test the support to any other
6095 UNIX dialects.
6096
6097 If a dialect has the support, then the HASTCPUDPSTATE definition
6098 in its machine.h header file will be active; if not, it will be
6099 absent or commented out.
6100
6101 If your dialect doesn't have the support and you want it added,
6102 you will have to provide me Internet access to a test host, where
6103 I can compile lsof and have the credentials to test the changes
6104 the support requires. If that's possible for you, please contact
6105 me via e-mail at <[email protected]>. Make sure "lsof" appears in
6106 the "Subject:" line so my e-mail filter won't classify your letter
6107 as Spam.
6108
6109
6110 15.0 Pyramid Version Problems
6111
6112 15.0.5 Statement of deprecation
6113
6114 As of lsof revision 4.52 support for all Pyramid versions has
6115 been dropped. Contact me via e-mail at <[email protected]> if you
6116 are interested in obtaining the last lsof Pyramid distribution.
6117 Make sure "lsof" appears in the "Subject:" line so my e-mail
6118 filter won't classify your letter as Spam.
6119
6120
6121 16.0 SCO Problems
6122
6123 16.1 SCO OpenServer Problems
6124
6125 16.1.1 How can I avoid segmentation faults when compiling lsof?
6126
6127 If you have an older SCO OpenServer compiler, it may get
6128 a segmentation fault when compiling some lsof modules.
6129 That appears to happen because of the -Ox optimization
6130 action requested in the lsof Makefile.
6131
6132 Try changing -Ox to -O with this make invocation:
6133
6134 $ make DEBUG=-O
6135
6136 Bela Lubkin supplied this tip and Steve Williams verified
6137 it.
6138
6139 16.1.2 Where is libsocket.a?
6140
6141 If you compile lsof and the loader says it can't find the
6142 socket library, libsocket.a, called by the -lsocket option
6143 in the lsof compile flags, you probably are running an SCO
6144 OpenServer release earlier than 5.0 and don't have the
6145 TCP/IP Development System package installed.
6146
6147 You may have the necessary header files, because you have
6148 the TCP/IP run-time package installed, but if you don't
6149 have the TCP/IP Development System package installed, you
6150 won't have libsocket.a.
6151
6152 Your choices are to install the TCP/IP Development System
6153 package or upgrade to OpenServer Release 5.0. You will
6154 find libsocket.a in 5.0 -- you'll find all the libraries
6155 and header files there, in fact -- and you can use gcc to
6156 compile lsof if you don't want to install the 5.0 Development
6157 System package.
6158
6159 16.1.3 Why do I get "warning C4200" messages when I compile lsof?
6160
6161 When you compile lsof under OSR 3.2v4.2 (and perhaps under
6162 earlier versions as well), you may get many compiler warning
6163 messages of the form:
6164
6165 node.c(183) : warning C4200: previous declarator is not
6166 compatible with default argument promotion
6167
6168 In my opinion this is a bug in the OSR compiler. Because
6169 the compiler cannot handle full ANSI-C prototypes, it
6170 assumes default types for function parameters as it encounters
6171 untyped in a function prototype -- e.g., in this function
6172 declaration from node.c,
6173
6174 readrnode(ra, r)
6175 KA_T ra;
6176 struct rnode *r;
6177 {
6178 ...
6179
6180 the compiler assigns default int types to the ra and r
6181 arguments.
6182
6183 Then, when the compiler encounters the fully typed parameters
6184 after the function skeleton and sees parameters with types
6185 that don't match the assumptions it previously made, it
6186 whines about its own assumptions.
6187
6188 You can ignore these messages.
6189
6190 16.2 SCO|Caldera UnixWare Problems
6191
6192 16.2.1 Why doesn't lsof compile on my UnixWare 7.1.1 or above
6193 system?
6194
6195 When you Configure lsof with the "uw" abbreviation and try
6196 to compile it for UnixWare 7.1.1, you may get compiler
6197 error messages like this:
6198
6199 UX:acomp: ERROR: "dproc.c", line 98:
6200 undefined struct/union member: p_pgidp
6201
6202 This suggest that you probably have a non-stop cluster
6203 UnixWare 7.1.1 system. Its <sys/proc.h> header file differs
6204 from the one on the system where I did the lsof port to
6205 UnixWare 7.1.1. I currently don't have access to a non-stop
6206 cluster system to be able to develop changes to lsof that
6207 would make it compile and work there.
6208
6209 If you have a non-stop cluster UnixWare 7.1.1 system, want lsof
6210 for it, and can offer me a test account on the system, please
6211 contact me via e-mail at <[email protected]>. Make sure "lsof"
6212 appears in the "Subject:" line so my e-mail filter won't
6213 classify your letter as Spam.
6214
6215 If you have a system with nsc_cfs and can offer me a test
6216 account on it, please contact me via e-mail at <[email protected]>.
6217 Make sure "lsof" appears in the "Subject:" line so my e-mail
6218 filter won't classify your letter as Spam.
6219
6220 16.2.2 Why does lsof complain about node_self() on my UnixWare
6221 7.1.1 or above system?
6222
6223 If lsof exits immediately after issuing this message:
6224
6225 can't identify process NSC node; node_self(): <message>
6226
6227 It means that lsof has been built to run on a NonStop
6228 Cluster (NSC) UnixWare 7.1.1 or higher system and can't
6229 get the number of the node on which it is running. Lsof
6230 uses the node number to determine the path to the kernel
6231 boot file.
6232
6233 You can tell if lsof has been built for NSC by looking for
6234 "-DHAS_UW_NSC" in lsof's "-v" option output.
6235
6236 If the system on which you're trying to run lsof isn't
6237 running an NSC kernel, you will need to build a non-NSC
6238 lsof.
6239
6240 16.2.3 Why does UnixWare 7.1.1 or above complain about -lcluster,
6241 node_self(), or libcluster.so?
6242
6243 When you build, compile, and load lsof for UnixWare 7.1.1
6244 and above, ld may complain that it can't find the -lcluster
6245 library or that the node_self symbol is undefined. When
6246 you try to run an existing lsof binary it may complain that
6247 libcluster.so can't be found.
6248
6249 These messages mean the tests made by Configure on your
6250 system led it to believe your system is running a NonStop
6251 Cluster (NSC) kernel, or the lsof binary you're trying to
6252 use was built on a NonStop Cluster system. If an lsof
6253 binary was built for NSC, this shell command produces
6254 output:
6255
6256 $ strings <lsof_binary> | grep HAS_UW_NSC
6257
6258 If that's not the case, and you can rebuild lsof, set the
6259 UW_HAS_NSC environment variable to "N" and do this:
6260
6261 $ Configure -n clean
6262 $ UW_HAS_NSC=N
6263 $ export UW_HAS_NSC
6264 $ Configure -n uw
6265 $ make
6266
6267 You can also edit Makefile and lib/Makefile. Remove
6268 -DHAS_UW_NSC from the CFGF strings. Remove -lcluster from
6269 the CFGL strings. Then run make again.
6270
6271 If you have an existing NSC lsof binary and you want one
6272 for a non-NSC system, you will have to build lsof yourself
6273 on the system where you want to use it. (That's always a
6274 good idea anyway.)
6275
6276
6277 16.2.4 Why does UnixWare 7.1.1 or above lsof complain it can't
6278 read the kernel name list?
6279
6280 If lsof complains:
6281
6282 can't read kernel name list from <path>
6283
6284 It means that lsof can't find the booted kernel image file
6285 at <path>. On NonStop Cluster (NSC) UnixWare 7.1.1 or
6286 higher systems lsof determines the booted file path by
6287 examining this file:
6288
6289 /stand/`node_self`/boot
6290
6291 If examining that file doesn't lead to an NSC path, lsof
6292 uses:
6293
6294 /stand/1/unix
6295
6296 On non-NSC systems lsof expects the booted kernel image to
6297 be in /stand/unix.
6298
6299 If your booted kernel image is in a different place, use
6300 lsof's "-k <path>" option to specify its path.
6301
6302 16.2.5 Why doesn't lsof report link count, node number, and size
6303 for some UnixWare 7.1.1 or above CFS files?
6304
6305 Lsof reports link count, node number, and size for open
6306 CFS files as recorded in their kernel node structure's
6307 cached attributes. Sometimes not all attributes are cached
6308 on the node where lsof runs, so lsof cannot report them.
6309
6310 16.2.6 Why doesn't lsof report open files on all UnixWare 7.1.1
6311 NonStop Cluster (NSC) nodes?
6312
6313 Lsof can only report on files open on the node on which it
6314 runs, because the information lsof reports comes from the
6315 private kernel memory of the node. This may mean that
6316 asking lsof to find a specific open file, or use of a
6317 specific Internet address or port, may not report all open
6318 instances on nodes other than the one used to run lsof.
6319
6320 You can use the NSC onnode(1) command to run lsof on specific
6321 nodes, or the onall(1) command to run lsof on all nodes --
6322 e.g.,
6323
6324 $ onall lsof [options] 2>&1 | less
6325 or
6326 $ onnode node-number lsof [options] 2>&1 | less
6327
6328 Note that, when lsof is run all nodes, the path name
6329 component assembly results it reports in its NAME column
6330 may vary, because the dynamic name cache from which lsof
6331 gets the components is private to the kernel of each node.
6332
6333 Also note the use of shell redirection in the examples to
6334 merge the standard error file information from onnode and
6335 onall with lsof's standard output file output. That will
6336 put the onnode and onall node announcements in proper
6337 sequence with lsof's output.
6338
6339 16.2.7 Why doesn't lsof report the UnixWare 7.1.1 NonStop Cluster
6340 (NSC) node a process is using?
6341
6342 To induce lsof to report the node on which a process runs
6343 would be a significant, non-standard modification to lsof.
6344 It has much wider implications than merely the printing of
6345 a number in an output column. I'm not currently (April
6346 2001) prepared to undertake such a modification.
6347
6348 If you want node-specific NSC information about open files,
6349 run lsof under the control of onall(1) or onnode(1).
6350
6351 $ onall lsof [options] 2>&1 | less
6352 or
6353 $ onnode node-number lsof [options] 2>&1 | less
6354
6355 16.2.8 Why does the compiler complain about missing UnixWare 2.1[.x]
6356 header files?
6357
6358 SCO|Caldera didn't ship the following header files with
6359 UnixWare 2.1 through 2.1.3:
6360
6361 <fs/proc/prdata.h>
6362 <fs/procfs/prdata.h>
6363 <sys/fs/fifonode.h>
6364 <sys/fs/namenode.h>
6365
6366 Lsof needs those header files for its compilation. Contact
6367 SCO|Caldera to get copies of those header files.
6368
6369 If you can't get the header files from SCO|Caldera, please
6370 contact me via e-mail at <[email protected]>. Make sure "lsof"
6371 appears in the "Subject:" line so my e-mail filter won't
6372 classify your letter as Spam.
6373
6374
6375 17.0 Sun Problems
6376
6377 17.0.5 Statement of deprecation
6378
6379 Lsof support for SunOS 4.1.x was last tested at revision 4.51.
6380 Contact me via e-mail at <[email protected]> if you're interested in
6381 obtaining it. Make sure "lsof" appears in the "Subject:" line so
6382 my e-mail filter won't classify your letter as Spam.
6383
6384 17.1 My Sun gcc-compiled lsof doesn't work -- why?
6385
6386 Gcc can be used to build lsof successfully. However, an
6387 improperly installed Sun gcc compiler will usually not
6388 produce a working lsof.
6389
6390 If your Sun gcc-compiled lsof doesn't report anything, or
6391 reports ``can't read proc table,'' or gcc refuses to compile
6392 lsof without error, check that the gcc step that "fixes"
6393 Sun header files was run on the system where you're using
6394 gcc to compile lsof. As an alternative, if you have the
6395 SunPro C 5.0 compiler or later available, use it to compile
6396 lsof -- e.g., use the solariscc Configure abbreviations.
6397
6398 17.2 How can I make lsof compile with gcc under Solaris 2.[456],
6399 2.5.1, 7, 8 or 9?
6400
6401 Presuming your gcc-specific header files are wrong for
6402 Solaris, edit the lsof Configure-generated Makefile and
6403 lib/Makefile and make this change:
6404
6405 CFGF= -Dsolaris=20400 ...
6406 to
6407 CFGF= -Dsolaris=20400 -D__STDC__=0 -I/usr/include ...
6408
6409 or change:
6410
6411 CFGF= -Dsolaris=20500 ...
6412 to
6413 CFGF= -Dsolaris=20500 -D__STDC__=0 -I/usr/include ...
6414
6415 or change:
6416
6417 CFGF= -Dsolaris=20501 ...
6418 to
6419 CFGF= -Dsolaris=20501 -D__STDC__=0 -I/usr/include ...
6420
6421 This is only a temporary work-around. You really should
6422 instruct gcc to to update your gcc-specific header files
6423 or install a recent gcc (e.g., 3.2), which has no need for
6424 private copies of Solaris include files.
6425
6426 17.3 Why does Solaris Sun C complain about system header files?
6427
6428 You're probably trying to use /usr/ucb/cc if you get compiler
6429 complaints like:
6430
6431 cc -O -Dsun -Dsolaris=20300 ...
6432 "/usr/include/sys/machsig.h", line 81: macro BUS_OBJERR
6433 redefines previous macro at "/usr/ucbinclude/sys/signal.h",
6434 line 444
6435
6436 Note the reference to "/usr/ucbinclude/sys/signal.h". It
6437 reveals that the BSD Compatibility Package C compiler is
6438 in use. Lsof requires the ANSI C version of the Solaris
6439 C compiler, usually found in /usr/opt/bin/cc or
6440 /opt/SUNWspro/bin/cc.
6441
6442 Try adding a CC string to the lsof Makefile that points to
6443 the Sun ANSI C version of the Sun C compiler -- e.g.,
6444
6445 CC= /usr/opt/bin/cc
6446 or
6447 CC= /opt/SUNWspro/bin/cc.
6448
6449 17.4 Why doesn't lsof work under my Solaris 2.4 system?
6450
6451 If lsof doesn't work under your Solaris 2.4 system -- e.g.,
6452 it produces no output, little output, or the output is
6453 missing command names or file descriptors -- you may have
6454 a pair of conflicting Sun patches installed.
6455
6456 Solaris patch 101945-32 installs a kernel that was built
6457 with a <sys/auxv.h> header file whose NUM_*_VECTORS
6458 definitions don't match the ones in the <sys/auxv.h> updated
6459 by Solaris patch 102303-02.
6460
6461 NUM_*_VECTORS in the kernel of patch 101945-32 are smaller
6462 than the ones in the <sys/auxv.h> of patch 102303-02. The
6463 consequence is that when lsof is compiled with the <sys/auxv.h>
6464 whose NUM_*_VECTORS definitions are larger than the ones
6465 used to compile the patched kernel, lsof's user structure
6466 does not align with the one that the kernel employs.
6467
6468 If you have these two patches installed, contact Sun and
6469 complain about the mis-match.
6470
6471 You may be able to work around the problem by editing
6472 /usr/include/sys/auxv.h to have the following NUM_*_VECTORS
6473 definitions:
6474
6475 #define NUM_GEN_VECTORS 4
6476 #define NUM_SUN_VECTORS 8
6477
6478 The Configure script issues a prominent WARNING that you should
6479 try the work-around.
6480
6481 I thank Leif Hedstrom for identifying the offending patches.
6482
6483 17.5 Where are the Solaris header files?
6484
6485 If you try to compile lsof under Solaris and get a compiler
6486 complaint that it can't find system header files, perhaps
6487 you forgot to add the header file package, SUNWhea.
6488
6489 17.6 Where is the Solaris /usr/src/uts/<architecture>/sys/machparam.h?
6490
6491 When you try to Configure lsof for Solaris 2.[23456], 2.5.1,
6492 and 7 -- e.g., on a `uname -m` == sun4m system -- Configure
6493 complains:
6494
6495 grep: /usr/src/uts/sun4m/sys/machparam.h:
6496 No such file or directory
6497 grep: /usr/src/uts/sun4m/sys/machparam.h:
6498 No such file or directory
6499
6500 And when you try to compile the configured lsof, cc or gcc
6501 complains:
6502
6503 dproc.c:530: `KERNELBASE' undeclared (first use this function)
6504
6505 The explanation is that somehow your Solaris system doesn't
6506 have the header files in /usr/src/uts it should have. Perhaps
6507 someone removed the directory to save space. Perhaps you're
6508 using a gcc installation, copied from another system. In any
6509 event, you will have to load the header files from the SUNWhea
6510 package of your Solaris distribution.
6511
6512 KERNELBASE is an important symbol to lsof -- it keeps lsof
6513 from sending an illegal kernel value to kvm_read() where
6514 a segmentation violation might result (a bug in the kvm
6515 library). Lsof can get illegal kernel values because it
6516 reads kernel values slowly with kvm_read() calls that the
6517 kernel is changing rapidly.
6518
6519 Lsof doesn't need KERNELBASE at Solaris 2.5 and above,
6520 because it has a KERNELBASE value whose address lsof can
6521 find with /dev/ksyms and whose value it can read with
6522 kvm_read(). Under Solaris 2.5 /usr/src/uts has moved to
6523 /usr/platform.
6524
6525 17.7 Why does Solaris lsof say ``can't read proc table''?
6526
6527 When lsof collects data on processes, using the kvm_*()
6528 functions to scan the kernel's proc structure table, it
6529 checks to make sure it has identified a reasonable number
6530 of them -- a minimum of three. When lsof can't identify
6531 three processes during a scan, it repeats the scan.
6532
6533 When five scans fail to yield three processes, lsof issues
6534 the fatal message:
6535
6536 lsof: can't read proc table
6537
6538 and exits.
6539
6540 Usually lsof fails to identify three processes during a
6541 scan because its idea of the form of the proc structure
6542 differs from that being used by the kernel. Since the proc
6543 structure is defined in <sys/proc.h> and other /usr/include
6544 header files, the root cause of a proc structure discrepancy
6545 usually can be found in the composition of /usr/include.
6546
6547 One common way that /usr/include header files can be
6548 incorrect is that gcc was used to compile lsof, gcc used
6549 its special (i.e., "fixed") header files instead of the
6550 ones in /usr/include, and the special gcc header files
6551 weren't updated when Solaris was. Answers to these questions:
6552
6553 My Sun gcc-compiled lsof doesn't work -- why?
6554
6555 How can I make lsof compile with gcc under Solaris 2.[456],
6556 2.5.1, 7, 8 or 9?
6557
6558 Why does Solaris Sun C complain about system header files?
6559
6560 discuss the gcc header file problem and offer suggestions
6561 on how to fix it or work around it.
6562
6563 It may also be that you are trying to run a version of lsof
6564 that was compiled on an older version of Solaris. For
6565 example, an lsof executable, compiled for Solaris 2.4, will
6566 produce the ``can't read proc table'' message if you try
6567 to run it under Solaris 2.5. If you have compiled lsof
6568 under Solaris 2.5 and it still won't work, see if the header
6569 files in /usr/include have been updated to 2.5, or still
6570 represent a previous version of Solaris.
6571
6572 Another source of header file discrepancies to consider is
6573 the Solaris patch level and whether a binary kernel patch
6574 was not matched with a corresponding header file update.
6575 See the "Why doesn't lsof work under my Solaris 2.4 system?"
6576 question for an example of one in Solaris 2.4 -- there may
6577 be other such patch conflicts I don't know about.
6578
6579 17.8 Why does Solaris lsof complain about a bad cached clone device?
6580
6581 When lsof revisions below 4.04 have been run on a Solaris
6582 system and have been allowed to create a device cache file,
6583 the running of revisions 4.04 and above on the same systems
6584 may produce this complaint:
6585
6586 lsof: bad cached clone device: ...
6587 lsof: WARNING: created device cache file: ...
6588
6589 This is the result of a change in the device cache file
6590 that took place at lsof revision 4.04. The change introduced
6591 a node number into the clone device lines of the device
6592 cache file and was done in such a way that lsof could detect
6593 device cache files whose clone lines don't have node numbers
6594 (lines created by previous lsof revisions) and recognize
6595 the need to regenerate the device cache file.
6596
6597 17.9 Why doesn't Solaris make generate .o files?
6598
6599 Solaris /usr/ccs/bin/make won't generate .o files from .c
6600 files if /usr/share/lib/make/make.rules is missing. It
6601 may be found in and installed from the SUNWsport package.
6602
6603 17.10 Why does lsof report some Solaris 2.3 and 2.4 lock types as `N'?
6604
6605 For Solaris 2.3 with patch P101318 installed at level 45
6606 or above, and for all versions of Solaris 2.4, NFS locks
6607 are represented by a NFS-specific kernel lock structure
6608 that sometimes lacks a read or write lock type indicator.
6609 When lsof encounters such a lock structure, it reports the
6610 lock type as `N'.
6611
6612 17.11 Why does lsof Configure say "WARNING: no cc in ..."?
6613
6614 When lsof's Configure script is executed with the solariscc
6615 abbreviation it tries to make sure it's using the Sun C
6616 compiler and not the UCB substitute from /usr/ucb/cc.
6617 Thus, it looks for cc in the "standard" Sun compiler
6618 location, /opt/SUNWspro/bin.
6619
6620 If Configure can't find cc there, it issues the warning:
6621
6622 lsof: WARNING: no cc in /opt/SUNWspro/bin;
6623 using cc without path.
6624
6625 and uses cc for the compiler name, letting the shell find
6626 cc with its PATH environment variable.
6627
6628 You can tell Configure where to find your cc with the
6629 SOLARIS_CCDIR cross-configuration environment variable.
6630 (See 00XCONFIG for more information on SOLARIS_CCDIR).
6631 For example, use this Configure shell command:
6632
6633 SOLARIS_CCDIR=/usr/special/bin Configure -n solariscc
6634
6635 (SOLARIS_CCDIR should be the full path to the directory
6636 containing your cc.)
6637
6638 17.12 Solaris 7, 8 and 9 Problems
6639
6640 17.12.1 Why does lsof say the compiler isn't adequate for Solaris
6641 7, 8 or 9?
6642
6643 Solaris 7, 8 and 9 kernels come in two flavors, 32 and 64
6644 bit. 64 bit kernels run on machines that support the SPARC
6645 v9 instruction set architecture. Separate executables for
6646 some programs, -- e.g., ones using libkvm like lsof -- must
6647 be built for 32 and 64 bit kernels.
6648
6649 Previous Sun (e.g., SC4.0) and earlier gcc compilers will
6650 build lsof for 32 bit kernels, but they won't build it for
6651 64 bit kernels. Compilers that will build lsof for 64 bit
6652 Solaris 7, 8 and 9 kernels are the Sun WorkShop Compilers
6653 C 5.0 and above, and recent gcc versions, e.g., 3.2.
6654
6655 When given the ``-xarch=v9'' flag, the C 5.0 compiler and
6656 above, and associated loader and 64 bit libraries will
6657 build a 64 bit lsof executable; when given the "-m64" or
6658 "-mcpu=v9" (deprecated) flags, an appropriate gcc compiler
6659 will build a 64 bit lsof executable.
6660
6661 When the lsof Configure script detects a 64 bit kernel is
6662 in use (e.g., by executing `/bin/isainfo -kv`), and when
6663 it finds that the specified compiler is inappropriate,
6664 it complains with these messages:
6665
6666 For gcc:
6667
6668 "!!!WARNING!!!=========!!!WARNING!!!=========!!!WARNING!!!"
6669 "! !"
6670 "! LSOF NEEDS TO BE CONFIGURED FOR A 64 BIT KERNEL, BUT !"
6671 "! THIS GCC DOESN'T SUPPORT THE BUILDING OF 64 BIT !"
6672 "! SOLARIS EXECUTABLES. LSOF WILL BE CONFIGURED FOR A !"
6673 "! 32 BIT echo KERNEL. !"
6674 "! !"
6675 "!!!WARNING!!!=========!!!WARNING!!!=========!!!WARNING!!!"
6676
6677 For Sun C:
6678
6679 !!!WARNING!!!==========!!!WARNING!!!==========!!!WARNING!!!
6680 ! !
6681 ! LSOF NEEDS TO BE CONFIGURED FOR A 64 BIT KERNEL, BUT |
6682 ! THE VERSION OF SUN C AVAILABLE DOESN'T SUPPORT THE !
6683 ! -xarch=v9 FLAG. LSOF WILL BE CONFIGURED FOR A 32 BIT !
6684 ! KERNEL. !
6685 ! !
6686 !!!WARNING!!!==========!!!WARNING!!!==========!!!WARNING!!!
6687
6688 17.12.2 Why does Solaris 7, 8 or 9 lsof say "FATAL: lsof was compiled
6689 for..."?
6690
6691 Solaris 7, 8 or 9 lsof may say:
6692
6693 lsof: FATAL: lsof was compiled for a xx bit kernel,
6694 but this machine has booted a yy bit kernel.
6695
6696 Where: xx = 32 or 64
6697 yy = 64 or 32
6698
6699 (xx and yy won't match.)
6700
6701 This message indicates that lsof was compiled for one size
6702 kernel and is being asked to execute on a different size
6703 one. That's not possible for programs like lsof that use
6704 libkvm.
6705
6706 Depending on the instruction sets for which you need Solaris
6707 7, 8 or 9 lsof, you may need two or more versions of lsof,
6708 compiled for each kernel size, installed for use with
6709 /usr/lib/isaexec. See the "How do I install lsof for
6710 Solaris 7, 8 or 9?" section of this document for more
6711 information on that.
6712
6713 17.12.3 How do I build lsof for a 64 bit Solaris kernel under a 32
6714 bit Solaris kernel?
6715
6716 If your Solaris system has an appropriate compiler (e.g.,
6717 WorkShop Compilers C 5.0 and above, or a recent gcc like
6718 3.2) and the 64 bit libraries have been installed, you can
6719 force lsof's Configure script to build a 64 bit version of
6720 lsof with:
6721
6722 $ SOLARIS_KERNBITS=64 Configure -n solariscc
6723
6724 The SOLARIS_KERNBITS environment variable is part of the
6725 lsof cross-configuration support, described in the 00XCONFIG
6726 file of the lsof distribution.
6727
6728 17.12.4 How do I install lsof for Solaris 7, 8 or 9?
6729
6730 If you are installing lsof where it will be used only under
6731 the bit size kernel for which it was built, no special
6732 installation is required.
6733
6734 If, however, you are installing different versions of lsof
6735 for different bit sizes -- e.g., for use on a 64 bit NFS
6736 server and from its 32 bit clients -- you should read the
6737 man page for isaexec(3C) and install lsof according to its
6738 instructions.
6739
6740 The executable at the directory where lsof is to be found
6741 should be a hard link to /usr/lib/isaexec or a copy of it.
6742 In the directory there must be instruction architecture
6743 subdirectories -- e.g., .../sparc/ and .../sparcv9/. The
6744 lsof for 64 bit size kernels is installed in the .../sparcv9/
6745 subdirectory; the one for 32 bit size kernels, in .../sparc/.
6746
6747 For example, if you're installing 32 and 64 bit lsof
6748 executables in /usr/local/etc, you would:
6749
6750 # cd /usr/local/etc
6751 # ln /usr/lib/isaexec lsof
6752 # mkdir sparc sparcv9
6753 # install the 32 bit lsof as sparc/lsof
6754 # install the 64 bit lsof as sparcv9/lsof
6755 # chmod, chown, and chgrp sparc/lsof and
6756 sparcv9/lsof appropriately
6757
6758 Lsof permissions and ownerships are the same whether one
6759 or more lsof executables are being installed, with or
6760 without the /usr/lib/isaexec hard link.
6761
6762 17.12.5 Why does my Solaris 7, 8 or 9 system say it cannot execute
6763 lsof?
6764
6765 When you attempt to execute lsof, your Solaris 7, 8 or 9
6766 shell may complain:
6767
6768 ksh: ./lsof: cannot execute
6769
6770 If the lsof executable exists and has the proper execution
6771 permissions, this error may be the result of trying to
6772 execute an lsof, built for a 64 bit kernel, on a 32 bit
6773 kernel.
6774
6775 This will tell you about the lsof executable:
6776
6777 $ file lsof
6778 lsof: ELF 64-bit MSB executable SPARCV9 Version 1,
6779 dynamically linked, not stripped
6780
6781 The "64-bit" notation indicates the binary was built for
6782 a 64 bit kernel. To see the running kernel bit size, use
6783 this command:
6784
6785 $ isainfo -kv
6786 32-bit sparc kernel modules
6787
6788 The "32-bit" notation indicates a 32 bit kernel has been
6789 booted.
6790
6791 The only work-around is to obtain, or Configure and make,
6792 an lsof for the appropriate kernel bit size. If you
6793 Configure and make lsof on the kernel where you wish to
6794 run it the proper compiler, the lsof Configure step will
6795 generate Makefiles that can be used with make to build an
6796 appropriate lsof executable.
6797
6798 To compile a 64 bit lsof, you must have an appropriate
6799 compiler -- i.e., Sun WorkShop Compilers C 5.0 or higher
6800 or a recent gcc like 3.2.
6801
6802 17.12.6 What gcc will produce 64 bit Solaris 7, 8 and 9 executables?
6803 8 and 9 executables?
6804
6805 Properly built and installed recent gcc versions -- e.g.,
6806 3.2 -- will build lsof for 64 bit Solaris kernels.
6807
6808 If you update your gcc version to 3.2 or later, make sure
6809 the private gcc header files become current -- i.e., clear
6810 out any private header files from a previous gcc or Solaris
6811 installation before installing the new ones, or build to
6812 a new --prefix root and replace the old root with it after
6813 the build and installation are complete.
6814
6815 17.12.7 Why does lsof on my Solaris 7, 8 or 9 system say, "can't
6816 read namelist from /dev/ksyms?"
6817
6818 You're probably trying to use an lsof executable built for
6819 an earlier Solaris release on a 64 bit Solaris 7, 8 or 9
6820 kernel. The output from `lsof -v` will tell you the build
6821 environment of your lsof executable. You should also have
6822 gotten a warning message that lsof is compiled for a
6823 different Solaris version than the one under which it is
6824 running -- something like this:
6825
6826 lsof: WARNING: compiled for Solaris release X; this is Y
6827
6828 You need to build lsof on the system where you want to use
6829 it. For 64 bit Solaris 7, 8 and 9 you need a compiler that
6830 can generate 64 bit Solaris executables -- e.g., the Sun
6831 Workshop 5 C compiler or later, or a recent gcc version
6832 like 3.2. See the "Why does lsof say the compiler isn't
6833 adequate for Solaris 7, 8 or 9?" section and the ones
6834 following it for a discussion of building lsof for 64 bit
6835 Solaris 7, 8 or 9.
6836
6837 17.13 Solaris and COMMON
6838
6839 17.13.1 What does COMMON mean in the NAME column for a Solaris VCHR
6840 file?
6841
6842 When lsof puts COMMON or (COMMON) in the NAME column of a
6843 Solaris VCHR file, it means that the file is handled by
6844 the special file system functions of the kernel through a
6845 common vnode.
6846
6847 17.13.2 Why does a COMMON Solaris VCHR file sometimes seem to have an
6848 incorrect minor device number?
6849
6850 When lsof reports on an open file in a Solaris special file
6851 system that uses a COMMON vnode, and the file is a VCHR
6852 file, lsof tries to locate the associated device node by
6853 looking for matches on the major and minor device numbers
6854 first.
6855
6856 If no major and minor match results, lsof then looks for
6857 a match on pseudo and clone device files. (See /devices/pseudo.)
6858 Those device nodes are matched specially by either their
6859 major or minor device numbers, but not both. Hence, when
6860 lsof finds a match under those special conditions, it may
6861 report a value in its output DEVICE column that differs
6862 from one of the major and minor numbers of the device node.
6863
6864 Here's an example from a sun4m Solaris 7 system:
6865
6866 $ ls -li /devices/pseudo/pm@0:pm
6867 151261 crw-rw-rw- 1 root sys 117, 0 ...
6868 $ lsof /devices/pseudo/pm@0:pm
6869 COMMAND ... DEVICE ... NODE NAME
6870 powerd 117,1 ... 151261 /devices/pseudo/pm@0:pm (COMMON)
6871 Xsun ... 117,0 ... 151261 /devices/pseudo/pm@0:pm
6872
6873 Note that the DEVICE value for the file with (COMMON) in
6874 its name field has a different minor device number (1) from
6875 what ls reports (0), while the DEVICE value for the file
6876 without (COMMON) matches the ls output exactly. Both match
6877 on the major device number, 117. The minor device number
6878 mis-match is a result of the way the Solaris kernel handles
6879 special file system common vnodes, and it's the reason lsof
6880 puts (COMMON) after the name to signal that a mis-match is
6881 possible.
6882
6883 17.14 Why don't lsof and Solaris pfiles reports always match?
6884
6885 /usr/proc/bin/pfiles for Solaris 2.6, 7, 8, and 9 also
6886 reports information on open files for processes. Sometimes
6887 the information it reports differs from what lsof reports.
6888
6889 There are several reasons why this might be true. First,
6890 because pfiles is a Sun product, based on Sun kernel
6891 features, its developers have a better chance of knowing
6892 exactly how open file information is organized. I sometimes
6893 have to guess at how kernel file structure linkages are
6894 constructed by gleaning hints from header files.
6895
6896 Second, lsof is aimed at providing information, specifically
6897 device and node numbers, that can be used to identify named
6898 file system objects -- i.e., path names. Thus, lsof tries
6899 to make sure its device and node numbers match those reported
6900 by stat(2). Pfiles doesn't always report numbers that
6901 match stat(2) -- e.g., for files using clone and pseudo
6902 devices via common vnodes like the nlist() /dev/ksyms usage.
6903
6904 Here's the Solaris 7 COMMON VCHR example again with additional
6905 pfiles output:
6906
6907 $ ls -li /devices/pseudo/pm@0:pm
6908 151261 crw-rw-rw- 1 root sys 117, 0 ...
6909 $ lsof /devices/pseudo/pm@0:pm
6910 vic1: 10 = lsof /dev/pm
6911 COMMAND ... DEVICE ... NODE NAME
6912 powerd ... 117,1 ... 151261 /devices/pseudo/pm@0:pm (COMMON)
6913 Xsun ... 117,0 ... 151261 /devices/pseudo/pm@0:pm
6914 $ pfiles ...
6915 0: S_IFCHR ... dev:32,24 ino:61945 ... rdev:117,1
6916 ...
6917 14: S_IFCHR ... dev:32,24 ino:151261 ... rdev:117,0
6918
6919 Note that the NODE number, reported by lsof, matches what
6920 ls(1) and stat(2) report, while the ino value pfiles reports
6921 doesn't. Lsof also indicates with the (COMMON) notation
6922 that the DEVICE number is a pseudo one, derived from the
6923 character device's value. The lsof DEVICE value matches
6924 the pfiles rdev value, correct behavior for a character
6925 device, but pfiles gives no sign that it's not possible to
6926 find that character device number in /devices with ls(1)
6927 or stat(2).
6928
6929 17.15 Why does lsof say, "kvm_open(namelist=default, core=default):
6930 Permission denied?"
6931
6932 Lsof needs permission to read from the /dev/kmem and /dev/mem
6933 memory devices. Access to them is opened via a call to
6934 the kvm_open() library function and it reports the indicated
6935 message.
6936
6937 You must give lsof permission to read the memory devices.
6938 The super user can almost always do that, but other lsof
6939 users can do it if some group -- e.g., sys -- has permission
6940 to read the memory devices, and the lsof binary is installed
6941 with the group's ownership and with the setgid permission
6942 bit enabled.
6943
6944 17.16 Why is lsof slow on my busy Solaris UFS file system?
6945
6946 Lsof may be slow on a busy Solaris UFS file system when
6947 UFS logging has been enabled with the "logging" mount
6948 option. That option can significantly increase disk
6949 operations under certain conditions -- e.g., when a lot of
6950 files are accessed quickly.
6951
6952 When only the "logging" option is specified to mount, all
6953 file accesses (atime updates) are logged to the UFS logging
6954 queue. Each atime update requires two writes to the disk
6955 to complete it.
6956
6957 If you want to do UFS logging -- and there are reliability
6958 advantages to it -- consider using the "logging,noatime"
6959 mount options instead. That will shift atime updates from
6960 the logging queue to fewer and independent asynchronous
6961 operations, consequently making the UFS logging queue a
6962 smaller bottleneck.
6963
6964 Consult mount_ufs(1M) for more information on the logging
6965 and noatime options.
6966
6967 (My thanks to Casper Dik for this tip on improving the
6968 performance of UFS logging.)
6969
6970 17.17 Why is lsof so slow on my Solaris 8 or 9 system?
6971
6972 Solaris 8 has a post-release feature upgrade modifying
6973 kernel name cache (DNLC) handling that can slow lsof
6974 throughput dramatically. The feature, sometimes called
6975 negative DNLC caching, is standard in Solaris 9.
6976
6977 As best I can tell, when you install the Solaris 8 MU1
6978 package, you get negative DNLC caching. If this pipe
6979 produces any output, your system has negative DNLC caching.
6980
6981 $ nm /dev/ksyms | grep negative_cache_vnode
6982
6983 The reason negative DNLC caching perturbs lsof is that a
6984 single vnode address (found in the negative_cache_vnode
6985 kernel variable) is used to mark entries in the DNLC that
6986 are not (the negative part) found on disk.
6987
6988 Since a single vnode address (the DNLC key lsof uses) can
6989 represent many (I've seen upwards of 30,000.) DNLC entries,
6990 their presence overloads lsof's internal DNLC hashing
6991 function. An overloaded hash function is a slow hash
6992 function, and lsof's slows to a crawl when it encounters
6993 thousands of keys that produce the same value when the lsof
6994 DNLC hash function is applied to them.
6995
6996 The solution is simple -- ignore negative DNLC cache keys.
6997 They don't represent path name components lsof can use.
6998 Lsof revisions 4.50 and above have an addition that ignores
6999 them and the performance of those lsof revisions improves
7000 significantly when presented with negative DNLC cache keys.
7001
7002 If you don't have an lsof revision at 4.51 or later, there's
7003 a work-around. Use lsof's ``-C'' option. It disables
7004 lsof's DNLC caching. Of course, that also inhibits the
7005 reporting of any path name components from the kernel DNLC.
7006 When ``-c'' is used, lsof will continue to report file
7007 system and character device paths.
7008
7009 17.18 Solaris and VxFS
7010
7011 17.18.1 Why doesn't lsof support VxFS 3.4 on Solaris 2.6, and above?
7012
7013 Lsof will not support VxFS version 3.4 on Solaris 2.6 and above
7014 unless some files from VxFS Update 2 have been installed. VxFS
7015 3.4 FCS and VxFS 3.4 update 1 lack the header files lsof
7016 normally uses to obtain information from the VxFS 3.4 kernel
7017 node structure, vx_inode. VxFS 3.4 Update 2 provides a method
7018 whereby lsof can obtain the necessary vx_inode information from
7019 the vxfsu_get_ioffsets() function in Veritas utility
7020 libraries.
7021
7022 The utility libraries (32 bit and 64 bit versions) may be
7023 found in /opt/VRTSvxfs/lib. An ancillary header file may
7024 be found in /opt/VRTSvxfs/include/sys/fs/vx_libutil.h.
7025 Documentation of the vxfsu_get_ioffsets(3) function may be
7026 found in /opt/VRTS/man/man3/vxfsu_get_ioffsets.3.
7027
7028 Those files of VxFS 3.4 Update 2 may be downloaded from:
7029
7030 ftp://ftp.veritas.com/pub/support/vxfs_34.i64243.tar
7031
7032 The vxfs_34.i64243.tar archive will unpack into an i64243
7033 directory containing these files:
7034
7035 $ ls i64243
7036 README
7037 libvxfsutil.sol26.sums
7038 libvxfsutil.sol26.tar.Z
7039 libvxfsutil.sol27.sums
7040 libvxfsutil.sol27.tar.Z
7041 libvxfsutil.sol28.sums
7042 libvxfsutil.sol28.tar.Z
7043
7044 Read README. Select the *.tar.Z file appropriate for your
7045 Solaris version. Its contents will unpack into /opt/VRTS
7046 and /opt/VRTSvxfs, so you will need sufficient permission
7047 -- e.g., do it as root -- to unpack the uncompressed archive.
7048 Once you've done that, it's a good idea to compare the
7049 checksums of the archive you unpacked with the ones recorded
7050 in the appropriate *.sums file. Use `sum -r` to verify
7051 the checksums.
7052
7053 For example, if you want the Solaris 8 version, uncompress
7054 and unpack libvxfsutil.sol28.tar.Z -- e.g.,
7055
7056 $ su
7057 ...
7058 # cd i6423
7059 # zcat libvxfsutil.sol28.tar.Z | tar xf -
7060
7061 That should create these new files and subdirectories with
7062 the indicated checksums:
7063
7064 File or subdirectory sum -r
7065
7066 /opt/VRTSvxfs/include/vxfsutil.h 03938
7067 /opt/VRTSvxfs/lib/libvxfsutil.a 51794
7068 /opt/VRTSvxfs/lib/sparcv9/
7069 /opt/VRTSvxfs/lib/sparcv9/libvxfsutil.a 07420
7070 /opt/VRTS/man/man3/
7071 /opt/VRTS/man/man3/vxfsu_get_ioffsets.3 62480
7072
7073 Once these files are in place, run lsof's Configure script
7074 for the solaris or solariscc abbreviation. Configure will
7075 locate the appropriate VxFS 3.4 Update 2 files and set up
7076 for the making of an lsof that will properly display open
7077 VxFS 3.4 file information.
7078
7079 17.18.2 Why does lsof report "vx_inode: vxfsu_get_ioffsets error"
7080 for open Solaris 2.6 and above VxFS 3.4 and above files?
7081
7082 Even when lsof supports VxFS 3.4 and above on Solaris 2.6 and
7083 above, it may report "vx_inode: vxfsu_get_ioffsets error" in
7084 the NAME column for all VxFS files.
7085
7086 The usual cause is that lsof doesn't have permission to
7087 read the file at the end of the /dev/vxportal symbolic
7088 link. If, for example, lsof has been installed setgid(sys),
7089 then the /dev/vxportal symbolic link destination should be
7090 owned by the sys group and readable by it.
7091
7092 Update 2 for VxFS 3.4 sets the modes of the /dev/vxportal
7093 symbolic link destination to 0640 and the group ownership
7094 to sys. But I have had a report that the modes are wrong
7095 in a VxFS 4.0 installation.
7096
7097 Another cause may be that the system has more than one version
7098 of VxFS installed (Only one can be active.), and lsof's
7099 Configure script did not choose the header files and libraries
7100 for the active VxFS version. Configure opts for VxFS 4.0 and
7101 above header files and libraries (in /opt/VRTS) in preference
7102 to those for VxFS below 4.0 (in /opt/VRTSvxfs).
7103
7104 Look for the directories /opt/VRTS and /opt/VRTSvxfs. If you
7105 have /opt/VRTS, make sure its header and library symbolic links
7106 point to those of the active VxFS version.
7107
7108 If you have both directories, look at the CFLAGS that Configure
7109 constructed for making lsof and see which directory path
7110 follows a -I option. If that doesn't match the directory path
7111 of the active VxFS version, try pointing Configure at the
7112 correct directory with the SOLARIS_VXFSINCL environment
7113 variable -- e.g.,
7114
7115 $ SOLARIS_VXFSINCL=/opt/.../include ./Configure -n solaris
7116
7117 17.18.3 Why does Solaris Configure claim there is no VxFS library?
7118
7119 The lsof Configure script, when configuring for Solaris, may
7120 report:
7121
7122 FATAL: no VxFS .../libvxfsutil.a
7123
7124 That fatal error message indicates lsof has found the VxFS
7125 utility library's header files, but can't find the library
7126 itself in the expected location adjacent to the header files.
7127
7128 One possible cause is an incorrect symbolic link from
7129 /opt/VRTS/lib/sparcv9/libvxfsutil.a to the library's real
7130 location. (Some VxFS distributions declared the link
7131 incorrectly.) Use `ls -lL` on that path to see if it exists.
7132 If it doesn't exist, the link may be missing an additional
7133 leading "../" component.
7134
7135 If the problem is a missing "../" from the library's link, you
7136 can correct the link or check with Veritas/Symantec for the
7137 patch that corrects it.
7138
7139 If the problem is not a missing "../", and you know the
7140 libvxfsutil.a location, you can define its path in the
7141 SOLARIS_VXFSLIB environment variable before running the lsof
7142 Configure script. (See 00XCONFIG for information about using
7143 the SOLARIS_VXFSLIB environment variable.)
7144
7145 If you have no libvxfsutil.a, you must obtain it from
7146 Veritas/Symantec or find it in your VxFS installation package.
7147
7148 17.18.4 Why doesn't Solaris lsof report VxFS path name components?
7149
7150 Solaris lsof will report path name components for VxFS versions
7151 that use the common Solaris Dynamic Name Lookup Cache (DNLC) or
7152 on some file systems of VxFS versions that support the VxFS
7153 Reverse Name Lookup (RNL) facility.
7154
7155 VxFS versions 3.3 (approximately) and below use the common
7156 Solaris DNLC. (I haven't been able to determine exactly when
7157 VxFS stopped using the DNLC.) For versions above that boundary,
7158 but below 4.0, lsof can't report path name components.
7159
7160 At VxFS 4.0 and above, lsof can be compiled to use the VxFS RNL
7161 facility for reporting path names. If "-DHASVXFSRNL" appears
7162 in the compiler flags section of lsof "-v" option output, then
7163 the lsof Configure script detected the VxFS RNL facility and
7164 lsof has been compiled to use it.
7165
7166 Lsof's use of the RNL facility can fail when the VxFS file
7167 system disk layout version is below 6. In that case, lsof can
7168 report no path name components. For more information, see the
7169 vxfs_inotopath(3) manual page. any of the following commands
7170 will show the disk layout version for a VxFS file system, when
7171 supplied the block device or mount point on which the file
7172 system is mounted.
7173
7174 fstyp -v <block_device>
7175 or
7176 mkfs -m <block_device>
7177 or
7178 vxupgrade <mount_point>
7179
7180 You must have permission to read the block device -- e.g., be
7181 the root user.
7182
7183 You may also be able to upgrade an older disk layout to one
7184 that will work with the RNL. See the vxupgrade(1M) man page
7185 for more information on that.
7186
7187 When lsof can't report VxFS path name components, it reports
7188 the file system mount point and the path name of device on
7189 which it is mounted. The device path name is enclosed in
7190 parentheses.
7191
7192 17.18.5 Why does Solaris 10 lsof report scrambled VxFS paths?
7193
7194 Solaris 10 lsof may report a bogus, scrambled path for an open
7195 VxFS file, when lsof obtains the path from a vnode's cached
7196 path. Veritas/Symantec reports that their Solaris 10
7197 implementation has bugs in the way it handles the Solaris 10
7198 vnode cached path and those bugs will be fixed in an upcoming
7199 patch some time after August 15, 2005.
7200
7201 When Solaris 10 lsof reports a path for an open VxFs file
7202 obtained via the VxFS Reverse Name Lookup facility, the path
7203 will be correct.
7204
7205 Also see the answers to the questions "Why does Solaris 10 lsof
7206 sometimes report the wrong path name?" and "Why doesn't Solaris
7207 lsof report VxFS path name components?"
7208
7209 17.19 Large file problems
7210
7211 17.19.1 Why does lsof complain it can't stat(2) a Solaris 2.5.1
7212 large file?
7213
7214 When given an argument that is the path to a Solaris 2.5.1
7215 file, enable for large file operations with the O_LARGEFILE
7216 open(2) option, lsof complains that it can't stat(2) the
7217 file. That's because lsof isn't using a stat(2) call and
7218 associated structure enabled for large files.
7219
7220 This error has been fixed, starting at lsof revision 4.58
7221 for Solaris 2.6 and above. That fix won't work on Solaris
7222 2.5.1 and I no longer have access to a Solaris 2.5.1 test
7223 system to develop a separate fix.
7224
7225 The work-around is to avoid specifying a O_LARGEFILE path
7226 as an argument to lsof on Solaris 2.5.1. Instead use a
7227 combination of lsof and grep to achieve the same results,
7228 albeit more clumsily.
7229
7230 17.20 Why does lsof get a segmentation fault on 64 bit Solaris
7231 8 using NIS+?
7232
7233 I have received a report from Gary Craig that lsof produces
7234 a segmentation fault on his 64 bit Solaris 8 system using
7235 NIS+. Via an independent test program we have exonerated
7236 lsof and tracked the fault to the NIS+ __nis_server_name()
7237 function in the C name server library, -lnsl.
7238
7239 Lsof causes the __nis_server_name() NIS+ function to be
7240 called by calling getservent() to read entries of the port
7241 number to service name map.
7242
7243 The only Sun bug ID that appears to describe the problem
7244 is 4304244, although its text is unclear enough to leave
7245 room for doubt.
7246
7247 Until Sun eliminates the __nis_server_name() segmentation
7248 fault cause, a work-around for lsof is to use its "-P"
7249 option, causing lsof to avoid port to service name lookups.
7250
7251 17.21 Will lsof crash the Solaris kernel?
7252
7253 I've received and investigated one report that it has when
7254 the Sun hardware (a QME interface) was faulty. Today (May
7255 23, 2002) I've learned that Sun has reports of kernel
7256 crashes caused by adb, lsof, and mdb.
7257
7258 The Sun investigation pinpointed a problem in the /dev/kmem
7259 kernel driver and there is a Sun bug report, 4344513, about
7260 the problem. There is a fix in Solaris 9, and patches for
7261 Solaris 7 and 8 (SPARC and x86).
7262
7263 To see if your Solaris system is fixed, look for a
7264 /devices/pseudo/*allkmem node.
7265
7266 Extensive address filtering was added to lsof revision 4.50
7267 to forestall what I then (July 2001) believed to be only
7268 the possibility that lsof might crash Solaris. However,
7269 the filtering isn't perfect, since a filtered address might
7270 become invalid after lsof has filtered it but before lsof
7271 has delivered it to /dev/kmem. That filtering work is
7272 described in .../dialects/sun/solaris_kaddr_filters, also
7273 available at:
7274
7275 ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/solaris_kaddr_filters
7276
7277 The best and safest work-around is to upgrade to Solaris
7278 9 or install an appropriate patch or its equivalent from
7279 this list:
7280
7281 Solaris SPARC x86
7282 Version Patch Patch
7283 ======= ===== =====
7284 7 106541-20 106542-20
7285 8 108528-14 108529-14
7286
7287 17.22 Why does lsof on Solaris 7, 8, or 9 report a kvm_open()
7288 failure?
7289
7290 When lsof is started on some Solaris 7, 8, and 9 systems
7291 it may report:
7292
7293 lsof: kvm_open(namelist=default, corefile=default): \
7294 No such file or directory
7295
7296 Lsof revisions 4.65 and later will first report:
7297
7298 lsof: cannot stat /dev/allkmem
7299
7300 The second message, not delivered in lsof revisions below
7301 4.65, explains the cause of the kvm_open() failure; it
7302 can't find /dev/allkmem.
7303
7304 /dev/allkmem is a device added to Solaris 7 and 8 in patches
7305 and in the Solaris 9 FCS. See the preceding "Will lsof
7306 crash the Solaris kernel?" section for more information on
7307 /dev/allkmem and the patches.
7308
7309 The kvm_open(3KVM) function in the KVM library of patched
7310 Solaris 7 and 8 systems and in Solaris 9 expects to find
7311 /dev/allkmem and exits on error when it does not.
7312
7313 If you have installed the patch that updated your KVM
7314 library to a version that expects /dev/allkmem to be present
7315 and it is not, you may need to reconfigure your system's
7316 devices with devfsadm(1M) or enter "boot -r" to the OpenBoot
7317 monitor's prompt (usually "ok").
7318
7319 17.23 Solaris and SAM-FS
7320
7321 17.23.1 Why does Solaris lsof report "(limited SAM-FS info)"?
7322
7323 Lsof 4.68 and above report "(limited SAM-FS info)" on
7324 Solaris in the NAME column after the path or file system
7325 name for all files it finds on SAM-FS file systems.
7326
7327 That's because no more information is known about the
7328 composition of the nodes that follow SAM-FS vnodes. If
7329 you can provide that information, please contact me via
7330 e-mail at <[email protected]>. Make sure "lsof" appears in the
7331 "Subject:" line so my e-mail filter won't classify your letter
7332 as Spam.
7333
7334 17.23.2 Why can't lsof locate named SAM-GS files?
7335
7336 Solaris lsof 4.68 and above can't locate files on SAM-FS
7337 file systems when the files are named as lsof arguments
7338 because lsof doesn't know how to locate open SAM-FS file
7339 device and node number information. (See also 'Why does
7340 Solaris lsof report "(limited SAM-FS info)?')
7341
7342 17.24 Lsof and Solaris 10 zones
7343
7344 17.24.1 How can I make lsof list the Solaris zone?
7345
7346 Use the lsof "-z [z]" option.
7347
7348 17.24.2 Why doesn't lsof work in a Solaris 10 zone?
7349
7350 When run from within a Solaris 10 zone, lsof will usually
7351 report:
7352
7353 lsof: can't stat(/devices): No such file or directory
7354
7355 That's because a Solaris zone usually has no /devices
7356 subdirectory, a restriction of the zone implementation intended
7357 to limit the ability of zone processes to control global system
7358 resources, including physical devices.
7359
7360 While a zone may have a /dev subdirectory, that subdirectory
7361 usually lacks the /dev/allkmem, /dev/mem and /dev/kmem devices
7362 lsof and the KVM library it uses require.
7363
7364 The work-around is to run lsof in the global zone. When it is
7365 run in a global zone lsof will be able to report on processes
7366 running in any zone, including the global zone.
7367
7368 17.24.3 Why does lsof complain it can't stat() Solaris 10 zone file
7369 systems?
7370
7371 When run from the global zone on Solaris 10 lsof may complain:
7372
7373 lsof: WARNING: can't stat() 15 zone file systems;
7374 using dev= options
7375
7376 The warning message means lsof found the reported number of
7377 file system entries in the mount table for which it didn't have
7378 permission to get stat(2) results, but which had "zone=" and
7379 "dev=" mount table options.
7380
7381 That is a normal restriction of Solaris 10 zones. Since the
7382 lsof warning message indicates it was able to find "dev="
7383 options for the file systems, lsof will probably work
7384 correctly.
7385
7386 One work-around is to relax the restrictions on zone mount
7387 points, so that lsof can stat() them. While that may be
7388 possible by changing directory modes or group ownerships, it is
7389 probably not a good idea, because it weakens the restrictions
7390 zones are intended to provide.
7391
7392 Another work-around is to suppress the warning message with
7393 lsof's "-w" option. The down side of that is that it causes
7394 the suppression of all warning messages, leading to the
7395 possibility that some non-stat() warning messages will be
7396 suppressed.
7397
7398 17.25 Solaris 10 problems
7399
7400 17.25.1 Why does Solaris 10 lsof sometimes report the wrong path name?
7401
7402 When a path name component is renamed -- e.g., with mv(1) --
7403 Solaris 10 lsof may report the old component for an open file
7404 that used the component in its path before the rename. That's
7405 because Solaris 10 lsof reports the path name cached in the
7406 open file's vnode and the Solaris 10 kernel doesn't update the
7407 open vnode's cached path name when a component of it is changed.
7408
7409 When an open file is deleted -- e.g., with rm(1) -- the path
7410 name by which it was opened remains cached in the vnode. Lsof
7411 can be instructed to display that path name with the -X option.
7412 The path name might be incorrect because of the rename problem
7413 described above. See the answer to the 'What does "(deleted)"
7414 mean in the NAME column of a Solaris 10 open file?' question
7415 for more information.
7416
7417 Lsof is sometimes able to detect that cached path name is
7418 incorrect. In that case lsof may report only the mounted-on
7419 directory and device of the file system or it may report that
7420 the path name is of questionable accuracy by appending a
7421 trailing "(?)" to it in the NAME column.
7422
7423 See the answer to the "Why does Solaris 10 lsof sometimes
7424 report only the mounted-on directory and device?" and 'What
7425 does "(?)" mean in the NAME column of a Solaris 10 open file?'
7426 questions for more information.
7427
7428 17.25.2 Why does Solaris 10 lsof sometimes report only the mounted-on
7429 directory and device?
7430
7431 For some regular open files lsof may report only the mounted-on
7432 directory and device of the file system on which the file
7433 resides. That's because lsof was able to determine that the
7434 path name cached in the open file's vnode is incorrect.
7435
7436 Lsof detects the cached path name is incorrect by applying
7437 stat(2) to it, provided that no error was detected when stat(2)
7438 was applied to the file system mounted-on directory during lsof
7439 setup. If a mounted-on directory stat(2) error was detected
7440 during setup, lsof does no cached path name analysis and simply
7441 reports it.
7442
7443 When the application of stat(2) to the cached path name returns
7444 a no-entry reply (the ENOENT error number), lsof concludes the
7445 path no longer exists (i.e., has been unlinked) and reports the
7446 mounted-on directory and device of the file system. That
7447 behavior can be modified with the -X option in lsof revisions
7448 4.77 and above. See the answer to the 'What does "(deleted)"
7449 mean in the NAME column of a Solaris 10 open file?' for more
7450 information.
7451
7452 When the application of stat(2) to the cached path name returns
7453 a permission error reply (the EACCES or EPERM error numbers),
7454 lsof reports the cached path name and adds a trailing "(?)" to
7455 indicate the reported path name is of questionable accuracy.
7456 See the answer to the question 'What does "(?)" mean in the
7457 NAME column of a Solaris 10 open file?' for more information.
7458
7459 If the application of stat(2) to the cached path name yields
7460 any other error reply, lsof reports the mounted-on directory
7461 and device of the file system.
7462
7463 When the application of stat(2) to the cached path name
7464 succeeds, lsof compares the reported device and node numbers to
7465 what it has obtained for the open file from kernel structures.
7466 If they match, lsof reports the cached path name. If they
7467 don't match, lsof instead reports the mounted-on directory and
7468 device of the file system.
7469
7470 A work-around that allows lsof to apply stat(2) successfully to
7471 cached path names is to give lsof sufficient permission to do
7472 it -- i.e., run lsof as the root user.
7473
7474 17.25.3 What does "(deleted)" mean in the NAME column of a Solaris 10
7475 open file?
7476
7477 When the -X option is specified to Solaris 10 lsof, it will
7478 report in its NAME column the path name cached for a deleted
7479 file in its vnode. The path name will be followed by
7480 "(deleted)".
7481
7482 Note that the path name cached in a file's vnode is the path
7483 name by which the file was opened. It is not updated by the
7484 Solaris kernel when any path name component is changed. Hence,
7485 it may not represent the final path name the open file had.
7486
7487 See the answer to the "Why does Solaris 10 lsof sometimes
7488 report the wrong path name?" question for more information on
7489 how changing a path name component affects the correctness of a
7490 what lsof reports.
7491
7492 17.25.4 What does "(?)" mean in the NAME column of a Solaris 10 open
7493 file?
7494
7495 When lsof encounters a path name cached in the open file's
7496 vnode that stat(2) reports lsof lacks permission to access,
7497 lsof adds "(?)" to the path name reported in the NAME column to
7498 indicate the path name is of questionable accuracy.
7499
7500 See the answers to the "Why does Solaris 10 lsof sometimes
7501 report the wrong path name?" and "Why does Solaris 10 lsof
7502 sometimes report only the mounted-on directory and device?"
7503 questions for more information on why lsof may report a path
7504 name of questionable accuracy.
7505
7506 A work-around that allows lsof to apply stat(2) successfully to
7507 cached path names is to give lsof sufficient permission to do
7508 it -- i.e., run lsof as the root user.
7509
7510 17.26 Solaris contract file problems
7511
7512 17.26.1 Why doesn't lsof report size, link count and node number for
7513 Solaris 10 contract files?
7514
7515 Lsof doesn't report size, link count or node number for Solaris
7516 10 contract files because I don't know how to obtain them from
7517 contract file kernel structures.
7518
7519 17.26.2 Why can't lsof locate a Solaris 10 contract file by path name?
7520
7521 Because lsof can't find the node number of Solaris contract
7522 files, it can't match the device and node numbers it gets from
7523 applying stat(2) to the contract file path name with what it
7524 finds in kernel data.
7525
7526 17.27 Solaris 10 and above ZFS problems
7527
7528 17.27.1 Why does Configure warn that ZFS support is not enabled?
7529
7530 To provide ZFS support it is necessary that lsof have access to
7531 the definitions of ZFS structures used by the kernel. Those
7532 definitions are made available to lsof when it runs by the
7533 libctl library.
7534
7535 If lsof's Configure script finds that ZFS is indicated by the
7536 presence of the <sys/fs/zfs.h> header file, but the libctl
7537 library is not indicated via the <libctl.h> header file, the
7538 script concludes that ZFS support is not possible and issues
7539 the following warning:
7540
7541 WARNING: ZFS support not enabled; libctf.h missing.
7542
7543 Install libctf support to remedy this problem.
7544
7545
7546 17.28 Problems with Solaris 9 and above
7547
7548 17.28.1 Why does the compiler complain about lgrp_root on Solaris 9
7549 and above?
7550
7551 When compiling lsof 4.84 on later Solaris 9 and 10 systems, the
7552 compiler may report the following error:
7553
7554 /usr/include/sys/lgrp.h", line ...: identifier redeclared: lgrp_root
7555
7556 This error results from a conflict between usage of lgrp_root
7557 in both <sys/lgrp.h> and <sys/lgrp_user.h> when _KMEMUSER or
7558 _KERNEL is #define'd before <sys/lgrp.h> is #include'd. This
7559 problem is noted in Sunsolve bug ID 5064229.
7560
7561 The work-around is to use lsof revision 4.85 sources.
7562
7563
7564 18.0 Lsof Features
7565
7566 18.1 Why doesn't lsof doesn't report on /proc entries on my
7567 system?
7568
7569 /proc file system support is generally available only for
7570 BSD, SYSV R4 dialects, and Tru64 UNIX (Digital UNIX, DEC
7571 OSF/1). It's also available for Linux, and Pyramid DC/OSx
7572 and Reliant UNIX.
7573
7574 Even on some SYSV R4 dialects I encountered many problems
7575 while trying to incorporate /proc file system support.
7576 The chief problem is that some vendors don't distribute
7577 the header file that describes the /proc file system node
7578 -- usually called prdata.h.
7579
7580 18.2 How do I disable the device cache file feature or alter
7581 its behavior?
7582
7583 To disable the device cache file feature for a dialect,
7584 remove the HASDCACHE definition from the machine.h file of
7585 the dialect's machine.h header file. You can also use
7586 HASDCACHE to change the default prefix (``.lsof'') of the
7587 device cache file.
7588
7589 Be sure you consider disabling the device cache file feature
7590 carefully. Having a device cache file significantly reduces
7591 lsof startup overhead by eliminating a full scan of /dev
7592 (or /devices) once the device cache file has been created.
7593 That full scan also overloads the kernel's name cache with
7594 the names of the /dev (or /devices) nodes, reducing the
7595 opportunity for lsof to find path name components of open
7596 files.
7597
7598 If you're worried about the presence of mode 0600 device
7599 cache files in the home directories of the real user IDs
7600 that execute lsof, consider these checks that lsof makes
7601 on the file before using it:
7602
7603 1. To read the device cache file, lsof must gain
7604 permission from access(2).
7605
7606 2. The device cache file's modes must be 0600 (0644
7607 if lsof is reading a system-wide device cache file)
7608 and its size non-zero.
7609
7610 3. There must be a correctly formatted section count
7611 line at the beginning of the file.
7612
7613 4. Each section must have a header line with a count
7614 that properly numbers the lines in the section.
7615 Legal sections are device, clone, pseudo-device,
7616 and CRC.
7617
7618 5. The lines of a section must have the proper format.
7619
7620 6. All lines are included in a 16 bit CRC, and it is
7621 recorded in a non-checksummed section line at the
7622 end of the file.
7623
7624 7. The checksum computed when the file is read must
7625 match the checksum recorded when the file was
7626 written.
7627
7628 8. The checksum section line must be followed by
7629 end-of-information.
7630
7631 9. Lsof must be able to get matching results from
7632 stat(2) on a randomly chosen entry of the device
7633 section.
7634
7635 For more information on the device cache file, read the
7636 00DCACHE file of the lsof distribution.
7637
7638 18.2.1 What's the risk with a perverted device cache file?
7639
7640 Even with the checks that lsof makes on the device cache
7641 file, it's conceivable that an intruder could modify it so
7642 it would pass lsof's tests.
7643
7644 The only serious consequence I know of this change is the
7645 removal of a file whose major device number identifies a
7646 socket from some user ID's device cache file. When such
7647 a device has been removed from the device cache file, and
7648 when lsof doesn't detect the removal, lsof may not be able
7649 to identify socket files when executed by the affected user
7650 ID. Only certain dialects are at risk to this attack --
7651 e.g., SCO OpenServer and Solaris 2.x, 7, 8, and 9.
7652
7653 If you're tracking a network intruder with lsof, that could
7654 be important to you. If you suspect that someone has
7655 corrupted the device cache file you're using, I recommend
7656 you use lsof's -Di option to tell it to ignore it and use
7657 the contents of /dev (or /devices) instead; or remove the
7658 device cache file (usually .lsof_hostname, where hostname
7659 is the first component of the host's name returned by
7660 gethostname(2)) from the user ID's home directory and let
7661 lsof create a new one for you.
7662
7663 18.2.2 How do I put the full host name in a personal device cache file
7664 path?
7665
7666 Lsof constructs the personal device cache file path name
7667 from a format specified in the HASPERSDC #define in the
7668 dialect's machine.h header file. As distributed HASPERSDC
7669 declares the path to be ``.lsof_'' plus the first component
7670 of the host name with the format ``.lsof_%L''.
7671
7672 If you want to change the way lsof constructs the personal
7673 device cache file path name, you can change the HASPERSDC
7674 #define and recompile lsof. If, for example, you #define
7675 HASPERSDC to be ``.lsof_%l'' (note the lower case `l'),
7676 Configure and remake lsof, then the personal device cache
7677 file path will be ``.lsof_'' plus the host name returned
7678 by gethostname(2).
7679
7680 See the 00DCACHE file of the lsof distribution for more
7681 information on the formation of the personal device cache
7682 file path and the use of the HASPERSDC #define.
7683
7684 18.2.3 How do I put the personal device cache file in /tmp?
7685
7686 Change the HASPERSDC definition in your dialect's machine.h
7687 header file.
7688
7689 When you redefine HASPERSDC, make sure you put at least
7690 one user identification conversion in it to keep separate
7691 the device cache files for each user of lsof. Also give
7692 some thought to including the ``%0'' conversion to define
7693 an alternate path for setuid-root and root processes.
7694
7695 Here's a definition that puts a personal device cache file
7696 in /tmp with the name ``.lsof_login_hostname_pers''.
7697
7698 #define HASPERSDC "/tmp/.lsof_%u_%l_pers"
7699
7700 Thus the /tmp personal device cache file path for login
7701 "abe" on host "lsof.itap.purdue.edu" would be:
7702
7703 /tmp/.lsof_abe_lsof.itap.purdue.edu_pers
7704
7705 You can add the User ID (UID) with the "%U" conversion and
7706 the first host name component with the ``%L'' conversion.
7707
7708 CAUTION: be careful using absolute paths like /tmp lest
7709 lsof processes that are setuid-root or whose real UID is
7710 root be used to exploit some security weakness via /tmp.
7711 Elect instead to add an alternate path for those processes
7712 with the ``%0'' conversion. Here's an extension of the
7713 previous HASPERSDC format for /tmp that declares an alternate
7714 path:
7715
7716 #define HASPERSDC "/tmp/.lsof_%u_%l_pers%0%h/.lsof_%L"
7717
7718 When the lsof process is setuid-root or its real UID is
7719 root, presuming root's home directory is `/' and the host's
7720 name is ``lsof.itap.purdue.edu'', the extended format yields:
7721
7722 /.lsof_vic
7723
7724 18.3 Why doesn't lsof know about AFS files on my favorite dialect?
7725
7726 Lsof currently supports AFS for these dialects:
7727
7728 AIX 4.1.4 (AFS 3.4a)
7729 Linux 1.2.13 (AFS 3.3)
7730 Solaris 2.[56] (AFS 3.4a)
7731
7732 It may recognize AFS files on other versions of these
7733 dialects, but I have no way to test that. Lsof may report
7734 correct information for AFS files on other dialects, but
7735 I can't test that either.
7736
7737 AFS support must be custom crafted for each UNIX dialect
7738 and then tested. If lsof supports your favorite dialect,
7739 but doesn't recognize its AFS files, probably I don't have
7740 access to a test system. If you want AFS support badly
7741 for your dialect, consider helping me do the development
7742 and testing.
7743
7744 18.3.1 Why doesn't lsof report node numbers for all AFS volume files,
7745 or how do I reveal dynamic module addresses to lsof?
7746
7747 When AFS is implemented via dynamic kernel modules -- e.g.,
7748 in NEXTSTEP -- lsof can't obtain the addresses of AFS
7749 variables in the kernel that it uses to identify AFS vnodes.
7750 It can guess that a vnode is assigned to an AFS file and
7751 it can obtain other information about AFS files, but it
7752 has trouble computing AFS volume node numbers.
7753
7754 To determine node numbers for AFS volumes other than the
7755 root volume, /afs, lsof needs access to a hashed volume
7756 structure pointer table. When it can't find the address
7757 of that table, because AFS support is implemented via
7758 dynamic kernel modules, lsof will return blanks in the
7759 INODE column for AFS volume files. Lsof can identify the
7760 root volume's node number (0), and can compute the node
7761 numbers for all other AFS files.
7762
7763 If you have a name list file that contains the addresses
7764 of the AFS dynamic modules -- e.g., you saved module symbols
7765 when you created a loadable module kernel with modload(8)
7766 by specifying -sym -- lsof may be able to find the kernel
7767 addresses it needs in that file.
7768
7769 Lsof looks up AFS dynamic kernel addresses for these dialects
7770 at these default paths:
7771
7772 NEXTSTEP 3.2 /usr/vice/etc/afs_loadable
7773
7774 A different path to a name list file with AFS dynamic kernel
7775 addresses may be specified with the -A option, when the -A
7776 option description appears in lsof's -h or -? (help) output.
7777
7778 If any addresses appear in the -A name list file that also
7779 appear in the regular kernel name list file -- e.g., /vmunix
7780 -- they must match, or lsof will silently ignore the -A
7781 addresses on the presumption that they are out of date.