Debian Codegraph @

00README

raw
1
2 Making and Installing lsof 4
3
4 ********************************************************************
5 | The latest release of lsof is always available via anonymous ftp |
6 | from lsof.itap.purdue.edu. Look in pub/tools/unix/lsof. |
7 ********************************************************************
8
9 Contents
10
11 Pre-built Lsof Binaries
12 Making Lsof
13 Other Configure Script Options
14 Environment Variables
15 Security
16 Run-time Warnings
17 Device Access Warnings
18 NFS Blocks
19 Caches -- Name and Device
20 Raw Sockets
21 Other Compile-time Definitions
22 The AFSConfig Script
23 The Inventory Script
24 The Customize Script
25 Cautions
26 Warranty
27 License
28 Bug Reports
29 The 00FAQ File
30 The lsof-l Mailing List
31 Field Output Example Scripts
32 Field Output C Library
33 Testing Lsof
34 Dialect Notes
35 AFS
36 AIX
37 Apple Darwin
38 Auspex LFS (no longer maintained)
39 BSDI BSD/OS
40 FreeBSD
41 HP-UX
42 IPv6
43 Linux
44 NetBSD
45 OpenBSD
46 Pyramid DC/OSx and Reliant UNIX (no longer available)
47 Caldera OpenUNIX
48 SCO OpenServer
49 SCO|Caldera UnixWare
50 Solaris 2.x, 7, 8, 9 and 10
51 Ultrix (no longer available)
52 Veritas VxFS and VxVM
53 User-contributed Dialect Support
54 Dialects No Longer Supported
55 Installing Lsof
56 Setuid-root Lsof Dialects
57 Setgid Lsof Dialects
58 Porting lsof 4 to a New UNIX Dialect
59 Quick Start to Using lsof
60 Cross-configuring Lsof
61 Environment Variables Affecting the Configure Script
62
63
64 =======================
65 Pre-built Lsof Binaries
66 =======================
67
68 Avoid using pre-built lsof binaries if you can; build your own
69 instead.
70
71 I do not support lsof binaries built and packaged by third parties nor
72 lsof binaries built from anything but the latest lsof revision. (See
73 the Bug Reports section for more information on the details of lsof
74 support.)
75
76 One important reasone for those support restrictions is that when lsof
77 is built its Configure script tunes lsof to the features available on
78 the building system, often embodied in supporting header files and
79 libraries. If the building system doesn't have support for a
80 particular feature, lsof won't be built to support the feature on any
81 system.
82
83 The Veritas VxFS file system is a good example of a feature that
84 requires build-time support.
85
86 UNIX dialect version differences -- Solaris 8 versus 9, AIX 4.3.3
87 vesus 5.2, etc. -- can also render a pre-built lsof binary useless
88 on a different version. So can kernel bit size.
89
90 There are so many potential pitfalls to using an lsof binary
91 improperly that I strongly recommend lsof be used only where it is
92 built.
93
94
95 ===========
96 Making Lsof
97 ===========
98
99 $ cd <lsof source directory>
100 $ ./Configure <your dialect's abbreviation>
101 $ make
102
103 (Consult the 00FAQ and 00XCONFIG files of the lsof distribution
104 for information about using make command invocations and environment
105 variables to override lsof default Makefile strings.)
106
107 This lsof distribution can be used with many UNIX dialects. However,
108 it must be configured specifically for each dialect. Configuration
109 is done in three ways: 1) by changing definitions in the machine.h
110 header file of the UNIX dialect of interest; 2) by defining
111 environment variable values prior to calling Configure (see the
112 00XCONFIG file, the Environment Variabls and Environment Variables
113 Affecting the Configure Script sections of this file); and 3) by
114 running the Configure shell script found in the top level of the
115 distribution directory.
116
117 You may not need to change any machine.h definitions, but you might
118 want to look at them anyway. Pay particular attention to the
119 definitions that are discussed in the Security section of this
120 file. Please read that section.
121
122 The Configure script calls three other scripts in the lsof
123 distribution: AFSConfig; Inventory; and Customize. The AFSConfig
124 script is called for selected dialects (AIX, HP-UX, NEXTSTEP, and
125 Solaris) to locate AFS header files and determine the AFS version.
126 See The AFSConfig Script section of this file for more information.
127
128 The Inventory script checks the completeness of the lsof distribution.
129 Configure calls Inventory after it has accepted the dialect
130 abbreviation, but before it configures the top-level directory for
131 the dialect. See The Inventory Script section of this file for
132 more information.
133
134 Configure calls the Customize script after it has configured the
135 top-level lsof directory for the declared dialect. Customize helps
136 you modify some of the important compile-time definitions of
137 machine.h. See the The Customize Script section.
138
139 You should also think about where you will install lsof and its
140 man page, and whom you will let execute lsof. Please read the
141 Installing Lsof section of this file for information on installation
142 considerations.
143
144 Once you have inspected the machine.h file for the dialect for
145 which you want to build lsof, and made any changes you need, run
146 the Configure script, supplying it with the abbreviation for the
147 dialect. (See the following table.) Configure selects the
148 appropriate options for the dialect and runs the Mksrc shell script
149 in the dialect sub-directory to construct the appropriate source
150 files in the top-level distribution directory.
151
152 Configure may also run the MkKernOpts script in the dialect
153 sub-directory to propagate kernel build options to the dialect
154 Makefile. This is done for only a few dialects -- e.g., DC/OSx,
155 and Reliant UNIX.
156
157 Configure creates a dialect-specific Makefile. You may want to
158 inspect or edit this Makefile to make it conform to local conventions.
159 If you want the Makefile to install lsof and its man page, you will
160 have to create an appropriate install rule.
161
162 Lsof may be configured using UNIX dialect abbreviations from the
163 following table. Alternative abbreviations are indicated by a
164 separating `|'. For example, for SCO OpenServer you can use either
165 the ``osr'' or the ``sco'' abbreviation:
166
167 $ Configure osr
168 or
169 $ Configure sco
170
171 Abbreviations UNIX Dialect
172 ------------- ------------
173
174 aix IBM AIX 5.[23] and 5.3-ML1 using IBM's C Compiler
175 aixgcc IBM AIX 5.[12] and 5.3-ML1 using gcc
176 darwin Apple Darwin 7.x and 8.x for Power Macintosh systems
177 freebsd FreeBSD 4.x, 4.1x, 5.x and [67].x
178 hpux HP-UX 11.00, 11.11 and 11.23, using HP's C
179 Compiler, both /dev/kmem-based and PSTAT-based
180 hpuxgcc HP-UX 11.00, 11.11 and 11.23, using gcc, both
181 /dev/kmem-based and PSTAT-based
182 linux Linux 2.1.72 and above for x86-based systems
183 netbsd NetBSD 1.[456], 2.x and 3.x
184 openbsd OpenBSD 2.[89] and 3.[0-9]
185 osr SCO OpenServer Release 5.0.6, using the C compiler
186 from the SCO developer's kit
187 osrgcc SCO OpenServer Release 5.0.6, using gcc
188 osr6 SCO Openserver 6.0.0, using the SCO C compiler
189 sco SCO OpenServer Release 5.0.6, using the C compiler
190 from the SCO developer's kit
191 scogcc SCO OpenServer Release 5.0.6, using gcc
192 solaris Solaris 2.x, 7, 8, 9 and 10 using gcc
193 solariscc Solaris 2.x, 7, 8, 9 and 10 using Sun's cc
194 unixware SCO|Caldera UnixWare 7.1.4
195 uw SCO|Caldera UnixWare 7.1.4
196
197 If you have an earlier version of a dialect not named in the above
198 list, lsof may still work on your system. I have no way of testing
199 that myself. Try configuring for the named dialect -- e.g., if
200 you're using Solaris 2.1, try configuring for Solaris 2.5.1.
201
202 After you have configured lsof for your UNIX dialect and have
203 selected options via the Customize script (See the The Customize
204 Script section.) , use the make command to build lsof -- e.g.,
205
206 $ make
207
208
209 Other Configure Script Options
210 ==============================
211
212 There are three other useful options to the Configure script besides
213 the dialect abbreviation:
214
215 -clean may be specified to remove all traces of
216 a dialect configuration, including the
217 Makefile, symbolic links, and library files.
218
219 -h may be specified to obtain a list of
220 -help Configure options, including dialect
221 abbreviations.
222
223 -n may be specified to stop the Configure
224 script from calling the Customize and
225 Inventory scripts.
226
227 Caution: -n also suppresses the AFSConfig
228 step.
229
230
231
232 Environment Variables
233 =====================
234
235 Lsof configuration, building, and execution may be affected by
236 environment variable settings. See the Definitions That Affect
237 Compilation section in the 00PORTING file, the General Environment
238 Variables section in the 00XCONFIG file, the Dialect-Specific
239 Environment Variables section in the 00XCONFIG file, and the
240 Environment Variables Affecting the Configure Script section of
241 this file for more information.
242
243 Note in the General Environment Variables section of the 00XCONFIG
244 file that there are five environment variables that can be used to
245 pre-define values in lsof's -v output: LSOF_BLDCMT, LSOF_HOST,
246 LSOF_LOGNAME, LSOF_SYSINFO, and LSOF_USER.
247
248
249 Security
250 ========
251
252 If the symbol HASSECURITY is defined, a security mode is enabled,
253 and lsof will allow only the root user to list all open files.
254 Non-root users may list only open files whose processes have the
255 same user ID as the real user ID of the lsof process (the one that
256 its user logged on with).
257
258 However, if HASNOSOCKSECURITY is also defined, anyone may list
259 anyone else's open socket files, provided their listing is enabled
260 with the "-i" option.
261
262 Lsof is distributed with the security mode disabled -- HASSECURITY
263 is not defined. (When HASSECURITY is not defined, the definition
264 of HASNOSOCKSECURITY has no meaning.) You can enable the security
265 mode by defining HASSECURITY in the Makefile or in the machine.h
266 header file for the specific dialect you're using -- e.g.
267 dialects/aix/machine.h.
268
269 The Customize script, run by Configure when it has finished its
270 work, gives you the opportunity to define HASSECURITY and
271 HASNOSOCKSECURITY. (See the The Customize Script section.)
272
273 The lsof -h output indicates the state HASSECURITY and HASNOSOCKSECURITY
274 had when lsof was built, reporting:
275
276 "Only root can list all files;"
277 if HASSECURITY was defined and HASNOSOCKSECURITY wasn't
278 defined;
279
280 "Only root can list all files, but anyone can list socket files."
281 if HASSECURITY and HASNOSOCKSECURITY were both defined;
282
283 "Anyone can list all files;"
284 if HASSECURITY wasn't defined. (The definition of
285 HASNOSOCKSECURITY doesn't matter when HASSECURITY isn't
286 defined.)
287
288 You should carefully consider the implications of using the default
289 security mode. When lsof is compiled in the absence of the
290 HASSECURITY definition, anyone who can execute lsof may be able to
291 see the presence of all open files. This may allow the lsof user
292 to observe open files -- e.g., log files used to track intrusions
293 -- whose presence you would rather not disclose.
294
295 As distributed, lsof writes a user-readable and user-writable device
296 cache file in the home directory of the real user ID executing
297 lsof. There are other options for constructing the device cache file
298 path, and they each have security implications.
299
300 The 00DCACHE file in the lsof distribution discusses device cache
301 file path construction in great detail. It tells how to disable
302 the various device cache file path options, or how to disable the
303 entire device cache file feature by removing the HASDCACHE definition
304 from the dialect's machine.h file. There is also information on
305 the device cache file feature in the 00FAQ file. (The 00DCACHE
306 and 00FAQ files are part of the lsof distribution package.)
307
308 The Customize script, run by Configure after it has finished its
309 work, gives you the opportunity to change the compile-time options
310 related to the device cache file. (See The Customize Script
311 section.)
312
313 Since lsof may need setgid or setuid-root permission (See the Setgid
314 Lsof Dialects and Setuid-root Lsof Dialects sections.), its security
315 should always be viewed with skepticism. Lest the setgid and
316 setuid-root permissions allow lsof to read kernel name list or
317 memory files, declared with the -k and -m options, that the lsof
318 user can't normally access, lsof uses access(2) to establish its
319 real user's authority to read such files when it can't surrender
320 its power before opening them. This change was added at the
321 suggestion of Tim Ramsey.
322
323 Lsof surrenders setgid permission on most dialects when it has
324 gained access to the kernel's memory devices. There are exceptions
325 to this rule, and some lsof implementations need to run setuid-root.
326 (The Setgid Lsof Dialects and Setuid-root Lsof Dialects sections
327 contains a list of lsof implementations and the permissions
328 recommended in the distribution's Makefiles.)
329
330 The surrendering of setgid permission is controlled by the WILLDROPGID
331 definition in the dialect machine.h header files.
332
333 In the end you must judge for yourself and your installation the
334 risks that lsof presents and restrict access to it according to
335 your circumstances and judgement.
336
337
338 Run-time Warnings
339 =================
340
341 Lsof can issue warning messages when it runs -- e.g., about the
342 state of the device cache file, about an inability to access an
343 NFS file system, etc. Issuance of warnings are enabled by default
344 in the lsof distribution.
345
346 Issuance or warnings may be disabled by default by defining
347 WARNINGSTATE in the dialect's machine.h. The Customize script may
348 also be used to change the default warning message issuance state.
349 (See The Customize Script section.)
350
351 The ``-w'' option description of the ``-h'' option (help) output
352 will indicate the default warning issuance state. Whatever the
353 state may be, it can be reversed with ``-w''.
354
355
356 Device Access Warnings
357 ======================
358
359 When lsof encounters a /dev (or /devices) directory, one of its
360 sub-directories, or one of their files that it cannot access with
361 opendir(3) or stat(2), it issues a warning message and continues.
362 Lsof will be more likely to issue such a warning when it has been
363 installed with setgid(<some group name>) permission; it won't have
364 trouble if it has been installed with setuid(root) permission or
365 is being run under the root login.
366
367 The lsof caller can inhibit or enable the warning with the -w
368 option, depending on the issuance state of run-time warnings. (See
369 the Run-time Warnings section.)
370
371 The warning messages do not appear when lsof obtains device
372 information from a device cache file that it has built and believes
373 to be current or when warning message issuance is disabled by
374 default. (See the "Caches -- Name and Device" section for more
375 information on the device cache file.)
376
377 The lsof builder can inhibit the warning by disabling the definition
378 of WARNDEVACCESS in the dialect's machine.h or disable all warnings
379 by defining WARNINGSTATE. WARNDEVACCESS is defined by default for
380 most dialects. However, some dialects have some device directory
381 elements that are private -- e.g., HP-UX -- and it is more convenient
382 for the lsof user if warning messages about them are inhibited.
383
384 Output from lsof's -h option indicates the status of WARNDEVACCESS.
385 If it was defined when lsof was compiled, this message will appear:
386
387 /dev warnings = enabled
388
389 If WARNDEVACCESS was not defined when lsof was compiled, this
390 message will appear instead:
391
392 /dev warnings = disabled
393
394 The Customize script, run by Configure after it has finished its
395 work, gives you the opportunity to change the WARNDEVACCESS
396 definition. (See The Customize Script section.)
397
398
399 NFS Blocks
400 ==========
401
402 Lsof is susceptible to NFS blocks when it tries to lstat() mounted
403 file systems and when it does further processing -- lstat() and
404 readlink() -- on its optional file and file system arguments.
405
406 Lsof tries to avoid being stopped completely by NFS blocks by doing
407 the lstat() and readlink() functions in a child process, which
408 returns the function response via a pipe. The lsof parent limits
409 the wait for data to arrive in the pipe with a SIGALRM, and, if
410 the alarm trips, terminates the child process with a SIGINT and a
411 SIGKILL.
412
413 This is as reliable and portable a method for breaking NFS deadlocks
414 as I have found, although it still fails under some combinations
415 of NFS version, UNIX dialect, and NFS file system mount options.
416 It generally succeeds when the "intr" or "soft" mount options are
417 used; it generally fails when the "hard" mount option is used.
418
419 When lsof cannot kill the child process, a second timeout causes
420 it to stop waiting for the killed child to complete. While the
421 second timeout allows lsof to complete, it may leave behind a hung
422 child process. Unless warnings are inhibited by default or with
423 the -w option, lsof reports the possible hung child.
424
425 NFS block handling was updated with suggestions made by Andreas
426 Stolcke. Andreas suggested using the alternate device numbers that
427 appear in the mount tables of some dialects when it is not possible
428 to stat(2) the mount points.
429
430 The -b option was added to direct lsof to avoid the stat(2) and
431 readlink(2) calls that might block on NFS mount points and always
432 use the alternate device numbers. If warning message issuance is
433 enabled and you don't want warning messages about what lsof is
434 doing, use the -w option, too.
435
436 The -O option directs lsof to avoid doing the potentially blocking
437 operations in child processes. Instead, when -O is specified, lsof
438 does them directly. While this consumes far less system overhead,
439 it can cause lsof to hang, so I advise you to use -O sparingly.
440
441
442 Caches -- Name and Device
443 ==========================
444
445 Robert Ehrlich suggested that lsof obtain path name components for
446 open files from the kernel's name cache. Where possible, lsof
447 dialect implementations do that. The -C option inhibits kernel
448 name cache examination.
449
450 Since AFS apparently does not use the kernel's name cache, where
451 lsof supports AFS it is unable to identify AFS files with path name
452 components.
453
454 Robert also suggested that lsof cache the information it obtains
455 via stat(2) for nodes in /dev (or /devices) to reduce subsequent
456 running time. Lsof does that, too.
457
458 In the default distribution the device cache file is stored in
459 .lsof_hostname, mode 0600, in the home directory of the login of
460 the user ID that executes lsof. The suffix, hostname, is the first
461 component of the host's name returned by gethostname(2). If lsof
462 is executed by a user ID whose home directory is NFS-mounted from
463 several hosts, the user ID's home directory may collect several
464 device cache files, one for each host from which it was executed.
465
466 Lsof senses accidental or malicious damage to the device cache file
467 with extensive integrity checks, including the use of a 16 bit CRC.
468 It also tries to sense changes in /dev (or /devices) that indicate
469 the device cache file is out of date.
470
471 There are other options for forming the device cache file path.
472 Methods the lsof builder can use to control and employ them are
473 documented in the separate 00DCACHE file of the lsof distribution.
474
475
476 Raw Sockets
477 ===========
478
479 On many UNIX systems raw sockets use a separate network control
480 block structure. Display of files for applications using raw
481 sockets -- ping, using ICMP, for example -- need special support
482 for displaying their information. This support is so dialect-specific
483 and information to provide it so difficult to find that not all
484 dialect revisions of lsof handle raw sockets completely.
485
486
487 Other Compile-time Definitions
488 ==============================
489
490 The machine.h and dlsof.h header files for each dialect contains
491 definitions that affect the compilation of lsof. Check the
492 Definitions That Affect Compilation section of the 00PORTING file
493 of the lsof distribution for their descriptions. (Also see The
494 Customize Script section.)
495
496
497 The AFSConfig Script
498 ====================
499
500 Lsof supports AFS on some combinations of UNIX dialect and AFS
501 version. See the AFS section of this document for a list of
502 supported combinations.
503
504 When configuring for dialects where AFS is supported, the Configure
505 script calls the AFSConfig script to determine the location of AFS
506 header files and the AFS version. Configure will not call AFSConfig,
507 even for the selected dialects, unless the file /usr/vice/etc/ThisCell
508 exists.
509
510 The AFS header file location is recorded in the AFSHeaders file;
511 version, AFSVersion. Once these values have been recorded, Configure
512 can be told to skip the calling of AFSConfig by specifying its
513 (Configure's) -n option.
514
515
516 The Inventory Script
517 ====================
518
519 The lsof distribution contains a script, called Inventory, that
520 checks the distribution for completeness. It uses the file 00MANIFEST
521 in the distribution as a reference point.
522
523 After the Configure script has accepted the dialect abbreviation,
524 it normally calls the Inventory script to make sure the distribution
525 is complete.
526
527 After Inventory has run, it creates the file ".ck00MAN" in the
528 top-level directory to record for itself the fact that the inventory
529 has been check. Should Inventory be called again, it senses this
530 file and asks the caller if another check is in order, or if the
531 check should be skipped.
532
533 The -n option may be supplied to Configure to make it bypass the
534 calling of the Inventory script. (The option also causes Configure
535 to avoid calling the Customize script.)
536
537 The lsof power user may want to define (touch) the file ".neverInv".
538 Configure avoids calling the Inventory script when ".neverInv"
539 exists.
540
541
542 The Customize Script
543 ====================
544
545 Normally when the Configure script has finished its work, it calls
546 another shell script in the lsof distribution called Customize.
547 (You can tell Configure to bypass Customize with its -n option.)
548
549 Customize leads you through the specification of these important
550 compile-time definitions for the dialect's machine.h header file:
551
552 HASDCACHE device cache file control
553 HASENVDC device cache file environment
554 variable name
555 HASPERSDC personal device cache file path
556 format
557 HASPERSDCPATH name of environment variable that
558 provides an additional component
559 of the personal device cache file
560 path
561 HASSYSDC system-wide device cache file path
562 HASKERNIDCK the build-time to run-time kernel
563 identity check
564 HASSECURITY the security option
565 HASNOSOCKSECURITY the open socket listing option when
566 HASSECURITY is defined
567 WARNDEVACCESS /dev (or /devices) warning message
568 control
569 WARNINGSTATE warning message issuance state
570
571 The Customize script accompanies its prompting for entry of new
572 values for these definitions with brief descriptions of each of
573 them. More information on these definitions may be found in this
574 file or in the 00DCACHE and 00FAQ files of the lsof distribution.
575
576 You don't need to run Customize after Configure. You can run it
577 later or you can edit machine.h directly.
578
579 The -n option may be supplied to Configure to make it bypass the
580 calling of the Customize script. (The option also causes Configure
581 to avoid calling the Inventory script.)
582
583 The lsof power user may want to define (touch) the file ".neverCust".
584 Configure avoids calling the Customize script when ".neverCust"
585 exists.
586
587 Customize CAUTION: the Customize script works best when it is
588 applied to a newly configured lsof source base -- i.e., the machine.h
589 header file has not been previously modified by the Customize
590 script. If you have previously configured lsof, and want to rerun
591 the Customize script, I recommend you clean out the previous
592 configuration and create a new one:
593
594 $ Configure -clean
595 $ Configure <dialect_abbreviation>
596 ...
597 Customize in response to the Customize script prompts.
598
599
600 Cautions
601 ========
602
603 Lsof is a tool that is closely tied to the UNIX operating system
604 version. It uses header files that describe kernel structures and
605 reads kernel structures that typically change from OS version to
606 OS version, and even within a version as vendor patches are applied.
607
608 DON'T TRY TO USE AN LSOF BINARY, COMPILED FOR ONE UNIX OS VERSION,
609 ON ANOTHER. VENDOR PATCHES INFLUENCE THE VERSION IDENTITY.
610
611 On some UNIX dialects lsof versions may be even more restricted by
612 architecture type.
613
614 The bottom line is use lsof where you built it. If you intend to
615 use a common lsof binary on multiple systems, make sure all systems
616 run exactly the same OS version and have exactly the same patches.
617
618
619 Warranty
620 ========
621
622 Lsof is provided as-is without any warranty of any kind, either
623 expressed or implied, including, but not limited to, the implied
624 warranties of merchantability and fitness for a particular purpose.
625 The entire risk as to the quality and performance of lsof is with
626 you. Should lsof prove defective, you assume the cost of all
627 necessary servicing, repair, or correction.
628
629
630 License
631 =======
632
633 Lsof has no license. Its use and distribution are subject to these
634 terms and conditions, found in each lsof source file. (The copyright
635 year in or format of the notice may vary slightly.)
636
637 /*
638 * Copyright 2002 Purdue Research Foundation, West Lafayette,
639 * Indiana 47907. All rights reserved.
640 *
641 * Written by Victor A. Abell
642 *
643 * This software is not subject to any license of the American
644 * Telephone and Telegraph Company or the Regents of the
645 * University of California.
646 *
647 * Permission is granted to anyone to use this software for
648 * any purpose on any computer system, and to alter it and
649 * redistribute it freely, subject to the following
650 * restrictions:
651 *
652 * 1. Neither the authors nor Purdue University are responsible
653 * for any consequences of the use of this software.
654 *
655 * 2. The origin of this software must not be misrepresented,
656 * either by explicit claim or by omission. Credit to the
657 * authors and Purdue University must appear in documentation
658 * and sources.
659 *
660 * 3. Altered versions must be plainly marked as such, and must
661 * not be misrepresented as being the original software.
662 *
663 * 4. This notice may not be removed or altered.
664 */
665
666
667 Bug Reports
668 ===========
669
670 Now that the obligatory disclaimer is out of the way, let me hasten to
671 add that I accept lsof bug reports and try hard to respond to them. I
672 will also consider and discuss requests for new features, ports to new
673 dialects, or ports to new OS versions.
674
675 PLEASE DON'T SEND BUG REPORTS ABOUT LSOF TO THE UNIX DIALECT OR DIALECT
676 OPTION VENDOR.
677
678 At worst such bug reports will confuse the vendor; at best, the vendor
679 will forward the bug report to me.
680
681 PLEASE DON'T SEND BUG REPORTS ABOUT LSOF BINARIES BUILT OR DISTRIBUTED
682 BY SOMEONE ELSE, BECAUSE I CAN'T SUPPORT THEM.
683
684 Before you send me a bug report, please do these things:
685
686 * Make sure you try the latest lsof revision.
687
688 + Download the latest revision from:
689
690 ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof
691
692 + Verify the signatures of what you have downloaded;
693
694 + While connected to lsof.itap.purdue.edu, check for patches:
695
696 ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/patches
697
698 + If patches exist, install them in the latest revision
699 you just downloaded. Then build the latest revision and
700 see if it fixes your bug.
701
702 * If you're having trouble compiling lsof with gcc, try the
703 UNIX dialect vendor's compiler. I don't have access to gcc on
704 all test systems, so my support for it is hit-and-miss, and so
705 is my ability to respond to gcc compilation problem reports.
706
707 * Check the lsof frequently asked questions file, 00FAQ,
708 to see if there's a question and answer relevant to your
709 problem.
710
711 * Make sure you're running the lsof you think you are by
712 checking the path to it with which(1). When in doubt, use an
713 absolute path to lsof. Make sure that lsof binary has
714 sufficient permissions to do what you ask, including internal
715 permissions given it (e.g., restrictions on what files lsof may
716 report for whom) during its build.
717
718 When you send a bug report, make sure you include output from your
719 running of lsof's Configure script. If you were able to compile a
720 running lsof, please also include:
721
722 * Output from which(1) that shows the absolute path to the
723 lsof binary in question;
724
725 * Output from running lsof with its -h and -v options at
726 lsof's absolute path;
727
728 * Output from "ls -l" directed to lsof's absolute path.
729
730 If you weren't able to compile a running lsof, please send me: the
731 compiler error output; identification of the lsof revision you're using
732 (contents of the lsof version.c file); identification of your system
733 (full uname output or output from whatever other tool identifies the
734 system); and compiler identification (e.g., gcc -v output).
735
736 Either set of output will help me understand how lsof was configured
737 and what UNIX dialect and lsof revision is involved.
738
739 Please send all bug reports, requests, etc. to me via e-mail at
740 <[email protected]>. Make sure "lsof" appears in the "Subject:" line so
741 my e-mail filter won't classify your letter as Spam.
742
743
744 The 00FAQ File
745 ==============
746
747 The lsof distribution contains an extensive frequently asked
748 questions file on lsof features and problems. I recommend you
749 consult it before sending me e-mail. Use your favorite editor or
750 pager to search 00FAQ -- e.g., supplying as a search argument some
751 fixed text from an lsof error message.
752
753
754 The lsof-l Mailing List
755 =======================
756
757 Information about lsof, including notices about the availability
758 of new revisions, may be found in mailings of the lsof-l listserv.
759 For more information about it, including instructions on how to
760 subscribe, read the 00LSOF-L file of the lsof distribution.
761
762
763 Field Output Example Scripts
764 ============================
765
766 Example AWK and Perl 4 or 5 scripts for post-processing lsof field
767 output are locate in the scripts sub-directory of the lsof distribution.
768 The scripts sub-directory contains a 00README file with information
769 about the scripts.
770
771
772 Field Output C Library
773 ======================
774
775 The lsof test suite (See "Testing Lsof."), checks basic lsof
776 operations using field output. The test suite has its own library
777 of C functions for common test program operations, including
778 processing of field output. The library or selections of its
779 functions could be adapted for use by C programs that want to
780 process lsof field output. See the library in the file LTlib.c
781 in the tests/ sub-directory
782
783
784 Testing Lsof
785 ============
786
787 Lsof has an automated test suite in the tests/ sub-directory that
788 can be used to test some basic lsof features -- once lsof has been
789 configured and made. Tests are arranged in three groups: basic
790 tests that should run on all dialects; standard tests that should
791 run on all dialects; and optional tests that may not run on all
792 dialects or may need special resources to run. See 00TEST for more
793 information.)
794
795 CAUTION!!! Before you attempt to use the test suite make sure that
796 the lsof you want to test can access the necessary kernel resources
797 -- e.g., /dev/mem, /dev/kmem, /proc, etc. Usually you want to test
798 the lsof you just built, so this is an important check. (See
799 00TEST.)
800
801 To run the basic and standard tests, using the lsof in the parent
802 directory of tests/, do this:
803
804 $ cd tests
805 $ make test
806 or $ make std
807 or $ make standard
808
809 The basic and standard tests may be run as silently as possible,
810 using the lsof in the parent directory of tests/, with:
811
812 $ cd tests
813 $ make auto
814
815 This is the "automatic" test mode, designed for use by scripts that
816 build lsof. The caller is expected to test the make exit code to
817 determine if the tests succeeded. The caller should divert standard
818 output and standard error to /dev/null to suppress make's error
819 exit message.
820
821 The optional tests may be run, using the lsof in the parent directory
822 of tests/, with:
823
824 $ cd tests
825 $ make opt
826 or $ make optional
827
828 It's possible to execute individual tests, too. See the 00TEST file
829 of this distribution for more information on the tests, what they
830 do, and how to run and possibly customize each test.
831
832 It's possible to run the tests, using an lsof other than the one
833 in the parent directory of /tests, too. See 00TEST for information
834 about using the LT_LSOF_PATH environment variable to do that.
835
836
837 =============
838 Dialect Notes
839 =============
840
841
842 AFS
843 ===
844
845 Lsof recognizes AFS files on the following combinations of UNIX
846 dialect and AFS versions:
847
848 AIX 4.1.4 (AFS 3.4a)
849 Linux 1.2.13 (AFS 3.3)
850 Solaris 2.6 (AFS 3.4a)
851 Ultrix 4.2 RISC (AFS 3.2b) (no longer available)
852
853 Lsof has not been tested under other combinations -- e.g. HP-UX
854 10.10 and AFS 3.4a -- and probably won't even compile there. Often
855 when a UNIX dialect version or AFS version changes, the new header
856 files come into conflict, causing compiler objections.
857
858
859 AIX
860 ===
861
862 Specify the aix Configure abbreviation for AIX 4.1.[45], 4.2[.1],
863 4.3[.123], 5L, and 5.[123].
864
865 Specify aixgcc on AIX above 4.1 to use the gcc compiler. (Gcc can't be
866 used to compile lsof on AIX 4.1 and below because of kernel structure
867 alignment differences between it and xlc.) Gcc results sometimes
868 depend on the version of the gcc compiler that is used.
869
870 Compilation of lsof with gcc on AIX 4.3[.123], 5L, and 5.[123] has been
871 sparsely tested with varying degrees of success: it has been reported
872 to succeed on AIX 4.3.3 and 32 bit Power AIX 5.1; to fail on ia64 AIX
873 5.1 and 64 bit Power AIX 5.1; and to succeed on 32 and 64 bit Power AIX
874 5.2. Lsof compilation with gcc hasn't been tested on AIX 5.3.
875
876 At revision 4.61 and above lsof is configured and built to match the
877 bit size of the kernel of Power architecture AIX 5.1 systems. Lsof
878 binaries built for 32 and 64 bit kernels are not interchangeable. See
879 00FAQ for more information.
880
881 The Configure script uses /usr/bin/oslevel to determine the AIX version
882 for AIX less than 5 and ``uname -rv'' for AIX 5 and higher. If
883 /usr/bin/oslevel isn't executable on AIX less than 5, the Configure
884 script issues a warning message and uses ``uname -rv'' to determine the
885 AIX version.
886
887 When Configure must use ``uname -rv'' on AIX less than 5 to determine
888 the AIX version, the result will lack a correct third component --
889 e.g., the `4' of ``4.1.4''. If your AIX less than 5 system lacks lacks
890 an executable oslevel, I suggest you edit the Configure-produced
891 Makefile and complete the _AIXV definition in the CFGF string.
892
893 By default lsof avoids using the kernel's readx() function, causing
894 it to be unable to report information on some text and library file
895 references. The ``-X'' option allows the lsof user to ask for the
896 information readx() supplies.
897
898 Lsof avoids readx() to avoid the possibility of triggering a kernel
899 problem, known as the Stale Segment ID kernel bug. Kevin Ruderman
900 reported this bug to me. The bug shows up when the kernel's
901 dir_search() function hangs, hanging the application process that
902 called it so completely that the application process can neither
903 be killed nor stopped. The hang is the consequence of another
904 process (perhaps lsof) making legitimate use of the kernel's readx()
905 function to access the kernel memory that dir_search() is examining.
906 IBM has indicated they have no plans to fix the bug.
907
908 A fuller discussion of this bug may be found in the 00FAQ file of
909 the lsof distribution. There you will find a description of the
910 Stale Segment ID bug, the APAR on it, and a discussion of the
911 sequence of events that exposes it.
912
913 I added the ``-X'' function so you can tell lsof to use readx(),
914 but if you use ``-X'', you should be alert to its possibly serious
915 side effects. Although readx() is normally disabled, its state is
916 controlled with the HASXOPT, HASXOPT_ROOT, and HASXOPT_VALUE
917 definitions in dialects/aix/machine.h, and you can change its
918 default state by changing those definitions. You can also change
919 HASXOPT_ROOT via the Customize script.
920
921 You can also compile lsof with readx() use permanently enabled or
922 disabled -- see the comments about the definitions in the
923 dialects/aix/machine.h header file. You may want to permanently
924 disable lsof's use of readx() if you plan to make lsof publicly
925 executable. You can also restrict -X to processes whose real UID
926 is root by defining HASXOPT_ROOT.
927
928 I have never seen lsof cause the Stale Segment ID bug to occur and
929 haven't had a report that it has, but I believe there is a possibility
930 it could.
931
932 AFS support for AIX was added with help help from Bob Cook and Jan
933 Tax who provided test systems.
934
935 Henry Grebler and David J. Wilson helped with lsof for AIX 4.2.
936
937 Bill Pemberton provided an AIX 4.3 test system. Andrew Kephart
938 and Tom Weaver provided AIX 4.3 technical assistance. Niklas
939 Edmundsson did 4.3.1 testing. Doug Crabill provided an AIX 4.3.2
940 test system. Jeff W. Stewart provided an AIX 4.3.3 test system.
941
942 The SMT file type for AIX 4.1.[45], 4.2[.1], and 4.3[.12] is my
943 fabrication. See the 00FAQ file more information on it.
944
945 Loc Le and Nasser Momtaheni of IBM provided test systems for AIX 5L and
946 5.1. Lsof for AIX 5L and 5.1 needs setuid-root permission to process
947 the -X option on systems whose architecture type is ia64.
948
949 Dale Talcott of Purdue provided AIX 5.1 and 5.2 test systems. Dale and
950 John Jackson of Purdue provided an AIX 5.3 test system.
951
952
953 Apple Darwin
954 ============
955
956 The Apple Darwin port was provided by Allan Nathanson for version
957 1.2. Allan also arranged for access to a test system for maintenance
958 and regression testing. Dale Talcott provided a test system, too.
959
960 Allan supplied patches for updates to 1.4, 5.x, 6.x, 7.x and 8.x.
961
962
963 BSDI BSD/OS
964 ===========
965
966 As of lsof revision 4.77 support for BSDI BSD/OS has been
967 discontinued. Lsof revision 4.76 with BSDI BSD/OS support may be found
968 on lsof.itap.purdue.edu in pub/tools/unix/lsof/src.
969
970
971 FreeBSD
972 =======
973
974 Bill Bormann of Purdue University provided access to several FreeBSD
975 test systems. Ade Barkah, John Clear, Ralph Forsythe, Michael
976 Haro, Kurt Jaeger, and William McVey have also provided FreeBSD
977 test systems.
978
979 The FreeBSD distribution header files are augmented by header files
980 in the dialects/freebsd/include directory.
981
982 Larry Rosenman maintains the lsof FreeBSD port package.
983
984
985 HP-UX
986 =====
987
988 Lsof has two HP-UX bases: /dev/kmem for HP-UX 11.0 and earlier;
989 and PSTAT for HP-UX 11.11 and later. The lsof Configure script
990 will pick the appropriate base.
991
992 To use the CCITT x.25 socket support for HP-UX, you must have the
993 x.25 header files in /etc/conf/x25
994
995 Pasi Kaara helped with the HP-UX port, especially with its CCITT
996 x.25 socket support.
997
998 Richard Allen provided HP-UX 10.x and 11.x test systems, as did
999 Mark Bixby, and Elias Halldor Agustsson. Marc Winkler helped test
1000 the 10.20 port. Richard J. Rauenzahn provided a 64 bit HP-UX 11
1001 test system and an HP-UX 11.11 development system.
1002
1003 AFS support for HP-UX was added thanks to help from Chaskiel Moses
1004 Grundman, who provided a test system.
1005
1006 The /dev/kmem-based HP-UX 11.00 support is extremely fragile. It
1007 depends on privately developed kernel structure definitions. (See
1008 .../dialects/hpux/hpux11 for the header files making the definitions.)
1009 Those header files and their definitions will not be updated by
1010 HP-UX 11.00 patches, making it likely that any patch changing a
1011 kernel structure critical to lsof will break lsof in some way.
1012
1013 It's possible to build a 64 bit lsof for 64 bit HP-UX 11.00 with
1014 gcc, but you must have a gcc compiler capable of producing 64 bit
1015 executables. See the 00FAQ file for more information.
1016
1017 The PSTAT-based lsof for HP-UX 11.11 and later is much more solid.
1018 I am indebted to the vision of HP for providing an lsof kernel API
1019 through the PSTAT implementation. Specifically I appreciate the
1020 help of HP staff members Carl Davidson, Louis Huemiller, Rich
1021 Rauenzahn, and Sailu Yallapragada that made PSTAT-based HP-UX lsof
1022 possible.
1023
1024
1025 IPv6
1026 ====
1027
1028 Lsof has IPv6 support that has been tested for these UNIX dialects:
1029 AIX 4.3.x; Apple Darwin 5.[12] and 6.0; the INRIA and KAME FreeBSD IPv6
1030 implementations; PSTAT-based HP-UX; /proc-based Linux; the INRIA and
1031 KAME NetBSD implementations; and Solaris 8 and 9. Lsof has IPv6
1032 support that hasn't been tested for: OpenBSD (KAME); OpenUNIX 8; Tru64
1033 Unix 5.[01]; and UnixWare 7.1.[34].
1034
1035 Please let me know if your UNIX dialect has IPv6 support and I'll
1036 see if it can be supported by lsof.
1037
1038
1039 Linux
1040 =====
1041
1042 Tim Korb, Steve Logue, Joseph J. Nuspl Jr., and Jonathan Sergent
1043 have provided Linux test systems.
1044
1045 Michael Shields helped add and test automatic handling of ELF/COFF
1046 form names in /System.map, Marty Leisner and Keith Parks have helped
1047 test many lsof revisions. Marty has provided valuable suggestions,
1048 Linux hints, and code, too.
1049
1050 The 00FAQ file gives some Linux tips, including information on
1051 coping with system map file problems.
1052
1053 To determine the state of the Linux 2.1.x C library lseek() function,
1054 the lsof Configure script runs a test program that must have
1055 permission to read /dev/kmem. The test determines if the lseek()
1056 function properly handles kernel offsets, which appear to be negative
1057 because their high order bit is set. If the lseek() test reveals
1058 a faulty lseek(), Configure activates the use of a private lseek()
1059 function for kernel offset positioning. See the Linux problems
1060 section of the 00FAQ file of the lsof distribution for more
1061 information.
1062
1063
1064 NetBSD
1065 ======
1066
1067 Greg Earle and Paul Kranenburg have assisted with the NetBSD ports.
1068 Paul has provided test systems. Ray Phillips provided a NetBSA
1069 Alpha test system. Andrew Brown also provided a test system.
1070
1071 The NetBSD dialect version of lsof is compiled using the dialect
1072 sources in the netbsd dialect sub-directory.
1073
1074
1075 OpenBSD
1076 =======
1077
1078 David Mazieres has provided OpenBSD test systems. The OpenBSD
1079 dialect version of lsof is compiled using the dialect sources it
1080 shares with NetBSD in the openbsd dialect sub-directory.
1081
1082 Kenneth Stailey has provided OpenBSD testing and advice.
1083
1084 John Dzubera (Zube) reports, "lsof 4.33 compiles and runs on OpenBSD
1085 2.3 for the pmax architecture (decstation 3100)."
1086
1087 I have not tested lsof on OpenBSD 3.8, but David Mazieres reports
1088 revision 4.76 worked on OpenBSD 3.8.
1089
1090
1091 Pyramid DC/OSx and Reliant UNIX
1092 ===============================
1093
1094 As of lsof revision 4.52 support for all Pyramid dialects has been
1095 discontinued. Lsof revision 4.51 with Pyramid support may be
1096 obtained upon request. Send the request to [email protected].
1097
1098 These two UNIX dialects are very similar and share dialect-specific
1099 source files from the pyramid sub-directory.
1100
1101 The Reliant Unix Pyramid C compiler issues warning messages that
1102 I haven't found a convenient way to suppress. You can ignore
1103 warning messages about casts and conversions that lose bits. The
1104 message "warning: undefining __STDC__" is intentionally caused by
1105 the lsof MkKernOpts configuration script to suppress warning messages
1106 about cast and conversion problems in standard system header files,
1107 such as <stdio.h> and <string.h>.
1108
1109 Bruce Beare and Kevin Smith provided test systems.
1110
1111
1112 Caldera OpenUNIX
1113 ================
1114
1115 Larry Rosenman provided an OpenUNIX 8 test system. Matthew Thurmaier
1116 provided technical assistance, along with these people from Caldera:
1117 Jack Craig, Robert Lipe, and Bela Lubkin.
1118
1119 Robert Lipe supplied changes to lsof for OpenUNIX 8.0.1. Those
1120 changes were also incorporated in UnixWare 7.1.3 when it became
1121 the release name for OpenUNIX 8.0.1.
1122
1123 Support for lsof on OpenUNIX ended at lsof revision 4.74. The last
1124 lsof revision, 4.74, tested on OpenUNIX, may be found at the lsof
1125 "home" ftp site, lsof.itap.purdue.edu, in pub/tools/unix/lsof/OLD/src.
1126
1127
1128 SCO OpenServer
1129 ==============
1130
1131 Dion Johnson, Bela Lubkin, and Nathan Peterson of SCO gave me copies
1132 of SCO OpenServer and the SCO OpenServer Development System 3.0
1133 and provided technical advice for the lsof port.
1134
1135 Hugh Dickins, Bela Lubkin, Craig B. Olofson, and Nathan Peterson
1136 provided version 5.0 and gave technical advice for porting lsof to
1137 it. Bela provided the 5.0.4 changes. D. Chris Daniels provided
1138 a 5.0.4 test system, Lee Penn provided one for 5.0.5, and John
1139 Dubois for 5.0.6.
1140
1141 The <netdb.h> header file was accidentally omitted from some SCO
1142 OpenServer Development System releases. The Configure script will
1143 sense its absence and substitute an equivalent from the BSD
1144 distribution. The BSD <netdb.h> and the <sys/cdefs.h> header file
1145 it includes are located in the dialects/os/include sub-directory
1146 tree.
1147
1148 To compile lsof from its distribution sources you must have the
1149 TCP/IP and NSF headers in /usr/include. While those are optional
1150 OpenServer packages, I have access to no system that doesn't have
1151 them, so I'm unable to build lsof for such a configuration. However,
1152 it should be possible to modify the lsof Configure script and
1153 sources so lsof would compile and work without those optional
1154 packages.
1155
1156 If you have an OpenServer system configured without the TCP/IP and
1157 NFS packages, and want to tackle the job of building lsof for it,
1158 contact me via e-mail at <[email protected]>. I'll identify the
1159 Configure script, header file, and source file changes you will
1160 need to make. (Caution: this is not a simple task, or I would have
1161 already done it.)
1162
1163 The optional osrgcc and scogcc Configure abbreviations construct
1164 Makefiles for compiling lsof with gcc.
1165
1166 The UnixWare 7.1.4 sources are used for OpenServer Release 6.0.0.
1167 Hence there is a separate Configure abbreviation for it, "osr6".
1168 Richard of SCO provided a test system and technical assistance.
1169
1170
1171 SCO|Caldera UnixWare
1172 ============
1173
1174 D. Chris Daniels, John Hughes, Ken Laing, Andrew Merril, Lee Penn, and
1175 Matthew Thurmaier provided test systems. Bela Lubkin provided
1176 technical assistance. Larry Rosenman provided 7.1.[34] test systems.
1177
1178
1179 Solaris 2.x, 7, 8, 9 and 10
1180 ===========================
1181
1182 SEE THE CAUTIONS SECTION OF THIS DOCUMENT.
1183
1184 The latest Solaris revision of lsof 4 might work under Solaris
1185 2.[1-4] and 2.5[.1] and 7 but hasn't been tested there. I have no
1186 test systems for those Solaris versions.
1187
1188 Lsof will compile with gcc and the Sun C compiler under Solaris.
1189 If you want to use the Sun compiler, use the solariscc Configure
1190 abbreviation. If you use a gcc version less than 2.8 on Solaris,
1191 make sure the gcc-specific includes have been updated for your
1192 version of Solaris -- i.e., run the gcc fixincludes script.
1193
1194 Solaris 7, 8, 9 and 10 support for 64 bit kernels depends on a Sun
1195 WorkShop or Forte C compiler version that supports the "-xarch=v9"
1196 flag -- usually 5.0 or greater. Gcc versions 2.95 and above *may*
1197 be configured and built for 64 bit support, but it takes some extra
1198 work, the resulting compiler may be fragile, and the gcc developers
1199 discourage it. I've built 64 bit capable gcc compilers for Solaris
1200 7, 8 and 9 from gcc versions 2.95 through 3.0.1 and produced working
1201 lsof executables with them. More information on 64 bit gcc for
1202 Solaris may be found in the 00FAQ file.
1203
1204 Solaris 10 ZFS support is questionable, because Sun does not distribute
1205 the ZFS kernel structure definition header files. The lsof Configure
1206 script and source code use some risky work-arounds. ZFS file system
1207 support was made possible with help from Horst Scheuermann.
1208
1209 Dave Curry and Steve Kirsch provided resources for Solaris 2.x
1210 ports. Casper Dik and Gerry Singleton consulted and provided
1211 valuable assistance.
1212
1213 Henry Katz, Joseph Kowalski, Charles Stephens, Mike Sullivan, and
1214 Mike Tracy provided technical assistance.
1215
1216 AFS support was added to Solaris lsof with help from Curt Freeland,
1217 Heidi Hornstein, Michael L. Lewis, Terry McCoy, Phillip Moore, and
1218 Sushila R. Subramanian.
1219
1220 Casper Dik provided valuable assistance for the Solaris 8 support.
1221
1222 Sun has graciously provided me access to BETA versions of Solaris
1223 2.5, 2.6, 7, 8, and 9.
1224
1225 John Dzubera provided Solaris 7 and 8 test systems.
1226
1227 Mike Miscevic provided Solaris 10 test systems.
1228
1229
1230 Ultrix
1231 ======
1232
1233 As of lsof revision 4.52 support for Ultrix is no longer available,
1234 because I no longer have an Ultrix test system.
1235
1236 Terry Friedrichsen, Dwight McKay, and Jeffrey Mogul helped me with
1237 this port.
1238
1239 DECnet support was added to Ultrix lsof with the help of John
1240 Beacom, who kindly provided a test system. The Configure script
1241 decides that DECnet support is available if /usr/lib/libdnet.a and
1242 /usr/include/netdnet/dn.h exist and are readable.
1243
1244
1245 Veritas VxFS and VxVM
1246 =====================
1247
1248 Lsof supports some versions of Veritas VxFS and VxVM on some UNIX
1249 dialects. Consult the lsof Configure script for the specific
1250 dialect, and consult the lsof dialect-specific source files for
1251 the UNIX dialect of interest. Veritas support will usually be
1252 found in a source file named dnode[1-9].c.
1253
1254 Since Veritas rarely has a version number that can be extracted
1255 with shell commands, lsof doesn't use it. Instead, when lsof
1256 supports Veritas, the Configure script will form compile-time
1257 definitions starting with HASVXFS. Check the lsof 00PORTING
1258 documentation file for more information.
1259
1260 Lsof Veritas support requires that the supporting Veritas header
1261 files be installed -- e.g., in /usr/include/sys/fs. (The location
1262 will depend in the dialect's header file conventions.)
1263
1264 Some information on lsof support for Veritas extensions may be
1265 found in the lsof 00DIST file. (The ChangeLog file points to
1266 00DIST.)
1267
1268 Chris Kordish and Andy Thomas have provided Solaris VxFS test
1269 systems.
1270
1271
1272 ================================
1273 User-contributed Dialect Support
1274 ================================
1275
1276 There are some user-contributed dialect versions of lsof; more
1277 information on them can be found at:
1278
1279 ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/contrib
1280
1281 Check the 00INDEX file there for details.
1282
1283
1284 ============================
1285 Dialects No Longer Supported
1286 ============================
1287
1288 Because I don't have access to test systems, these UNIX dialects
1289 are no longer supported by lsof:
1290
1291 CDC EP/IX
1292 /dev/kmem-based Linux
1293 MIPS RISC/os
1294 Motorola V/88
1295 Pyramid DC/OSx
1296 Pyramid Reliant UNIX
1297 Sequent DYNIX
1298 SGI IRIX
1299 SunOS 4.x
1300 Ultrix
1301 UnixWare below 7.0
1302
1303 Remnants of the support lsof once provided for these dialects may
1304 be found in:
1305
1306 ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/OLD/dialects
1307
1308
1309 ===============
1310 Installing Lsof
1311 ===============
1312
1313 The distributed Makefiles do not have actions that will install
1314 lsof. I've come to the conclusion there is no standard for installing
1315 lsof or its man page, so I no longer distribute make rules for
1316 installing them. You should adjust the Makefile for your local
1317 preferences.
1318
1319 The Makefile does have an install rule that will cause lsof to
1320 compile by virtue of its dependency clause. Some Makefiles also
1321 have a dependency that causes the production of a man page that is
1322 ready to install. However, the actions of the install rule will
1323 not cause the lsof executable or its man page to be installed in
1324 any UNIX system-wide directory.
1325
1326 Instead, after the compilation and optional man page production
1327 are completed, the install rule will produce a brief description
1328 of what actions you might add to the install rule. The description
1329 will suggest the possible modes, ownerships, permissions, and
1330 destinations your install rule might employ to install the lsof
1331 executable and man page.
1332
1333 As you form your install rule, keep in mind that lsof usually needs
1334 some type of special permission to do its job. That may be permission
1335 to read memory devices such as /dev/kmem, /dev/mem, or /dev/swap,
1336 or it may be authorization to read entries in the /proc file system.
1337
1338 Memory device access can usually be provided by setting the modes
1339 of the lsof executable so that its effective group identifier when
1340 it runs is the same as the group that has permission to read the
1341 memory devices -- i.e., it is setgid-group. The privileged group
1342 is usually kmem, sys, or system.
1343
1344 Don't overlook using ACLs -- e.g., on AIX or Solaris 8 -- to give
1345 lsof permission to access memory devices. ACLs, coupled to a
1346 separate group like kmem, can be safer than giving lsof setgid
1347 authorization to a commonly used system group.
1348
1349 When lsof needs to read /proc file system entries, it must be
1350 installed with modes that make its effective user identifier root
1351 when it runs -- i.e., it must be setuid-root. If lsof must be
1352 installed setuid-root (only the AIX 5L, PSTAT-based HPUX, and
1353 /proc-based Linux, ports need such power.), then access to memory
1354 devices is automatic (or not needed in the case of /proc-based
1355 Linux).
1356
1357 Your choice of permissions for lsof may also be affected by your
1358 desire to allow anyone to use it or your need to restrict its usage
1359 to specific individuals. You will have to be guided by local policy
1360 and convention in this case.
1361
1362 The next two sections, Setgid Lsof Dialect Versions and Setuid-root
1363 Lsof Dialect Versions, list recommended install permissions.
1364
1365 The system directory where you install the lsof executable is also
1366 open to choice. A traditional place for a tool like lsof is
1367 /usr/local/etc, but recent changes in directory structure organization
1368 suggest that somewhere in /opt may be more suitable.
1369
1370 Bear one other factor in mind when choosing a location for the lsof
1371 executable -- it usually is a shared executable, requiring access
1372 to shared libraries. Thus, locations like /sbin or /usr/sbin are
1373 probably unsuitable.
1374
1375 Once you've chosen a location for the executable you may find that
1376 the location for the man page follows -- e.g., if the executable
1377 goes in /usr/local/etc, then the man page goes in /usr/local/man.
1378 If the executable location doesn't imply a location for the man
1379 page, you'll have to let local custom guide you.
1380
1381
1382 Setuid-root Lsof Dialect Versions
1383 =================================
1384
1385 These dialect versions should be installed with setuid-root
1386 permission -- i.e., the lsof binary should be owned by root and
1387 its setuid execution bit (04000) should be set.
1388
1389 AIX 5L and above for full use of the -X option
1390 Apple Darwin 8.x for Power Macintosh systems
1391 PSTAT-based HP-UX 11.11 and 11.23
1392 /proc-based Linux (generally 2.1.72 and above)
1393
1394
1395 Setgid Lsof Dialect Versions
1396 ============================
1397
1398 These dialect versions should be installed with setgid permission,
1399 owned by the group that can read kernel memory devices such as
1400 /dev/drum, /dev/kmem, /dev/ksyms, /dev/mem, /dev/swap. ACLs may
1401 be another mechanism (e.g., under AIX or Solaris 8) you can use to
1402 grant read permission to the kernel memory devices.
1403
1404 AIX 4.1.[45], 4.2[.1], and 4.3[.123]
1405 Apple Darwin 7.x for Power Macintosh systems
1406 FreeBSD 2.1.6, 2.2[.x], 3.x, 4.x, 5.x, [6789].x and 1[012].x
1407 NetBSD 1.[456], 2.x and 3.x
1408 OpenBSD 2.[89] and 3.[0-9]
1409 Caldera OpenUNIX 8
1410 SCO OpenServer 5.0.[46]
1411 SCO UnixWare 7.0 and 7.1.[0134]
1412 Solaris 2.6, 8, 9 and 10
1413 Ultrix 4.2 (no longer available)
1414
1415 ====================================
1416 Porting lsof 4 to a New UNIX Dialect
1417 ====================================
1418
1419 If you're brave enough to consider this, look at the 00PORTING
1420 file. Please contact me before you start. I might be able to help
1421 you or even do the port myself.
1422
1423 Don't overlook the contrib/ directory in pub/tools/unix/lsof on my
1424 ftp server, lsof.itap.purdue.edu. It contains user-contributed ports
1425 of lsof to dialects I don't distribute, because I can't test new
1426 revisions of lsof on them.
1427
1428
1429 =========================
1430 Quick Start to Using lsof
1431 =========================
1432
1433 For information on how to get started quickly using lsof, consult
1434 the 00QUICKSTART file of the lsof distribution. It cuts past the
1435 formal density of the lsof man page to provide quick examples of
1436 using lsof to solve common open file display problems.
1437
1438
1439 ======================
1440 Cross-configuring Lsof
1441 ======================
1442
1443 Using environment variables it is possible to Configure (and possibly
1444 build) lsof for one UNIX dialect on a different one -- e.g., you
1445 are running Configure on a Linux 2.3 system and you want to Configure
1446 and build lsof for Linux 2.4.
1447
1448 See the 00XCONFIG file of the lsof distribution for a discussion
1449 of how to do this.
1450
1451
1452 ====================================================
1453 Environment Variables Affecting the Configure Script
1454 ====================================================
1455
1456 Configure script actions can be modified by introducing values to
1457 the script via environment variables. In many cases the environment
1458 variable values take the place of test operations the Configure
1459 script makes.
1460
1461 For more information on environment variables that can affect
1462 Configure, consult the 00XCONFIG file of the lsof distribution.
1463 See the General Environment Variables sections for descriptions of
1464 ones that affect all dialects. Consult the Dialect-Specific
1465 Environment Variables section for ones that might affect the dialect
1466 you are trying to configure.
1467
1468
1469 Vic Abell <[email protected]>
1470 February 14, 2018