1LSLK(8)                     System Manager's Manual                    LSLK(8)
2
3
4

NOTICE

6       !!!NOTICE!!!   !!!NOTICE!!!   !!!NOTICE!!!   !!!NOTICE!!!   !!!NOTICE!!!!
7       !                                                                       !
8       ! Revision 1.29 represents the end of life for lslk.  I don't have time !
9       ! to support it.  Please don't report bugs to me.  I will politely      !
10       ! decline to work on them.                                              !
11       !                                                                       !
12       ! Vic Abell <abe@purdue.edu>, July 11, 2001                             !
13       !                                                                       !
14       !!!NOTICE!!!   !!!NOTICE!!!   !!!NOTICE!!!   !!!NOTICE!!!   !!!NOTICE!!!!
15

NAME

17       lslk - list local locks
18

SYNOPSIS

20       lslk [ -abhnOvw ] [ -i i ] [ -k k ] [ -p p ] [ -S [t] ] [ paths ]
21

DESCRIPTION

23       Lslk  revision  1.29  lists  information about locks held on files with
24       local inodes on systems running the following UNIX dialects:
25
26            AIX 3.2.5, 4.1.4, 4.2[.1], and AIX 4.3[.[12]]
27            DEC OSF/1, Digital UNIX, and Tru64 UNIX [2345].[01] and 3.2
28            Linux
29            SCO OpenDesktop or OpenServer 3.0 and 5.0.[0245]
30            Sequent PTX 2.1.9, 4.2.1, 4.3, and 4.4
31            Solaris 2.[345], 2.5.1, 2.6, 7, and 8 (excluding Veritas
32               VxFS local files)
33            SunOS 4.1.3
34
35       The lock may belong to a process on the local system or to a process on
36       an  NFS  client  system  to  which  the  local system is an NFS server.
37       Notes: Linux and PTX 2.1.9 lslk don't  report  on  locks  held  by  NFS
38       clients;  Solaris  lslk  won't  report locks held on local Veritas VxFS
39       files.
40

OPTIONS

42       In the absence of any options, lslk lists all locks associated with the
43       local files of the system.
44
45       When  selection options are specified, the listing of all locks is dis‐
46       abled, and the selection options are ORed together.  Only locks meeting
47       any selection criterion are listed.
48
49       When  the -a option is specified, the listing of all locks is disabled,
50       and the selection options are ANDed together.  Only locks that meet all
51       selection criteria are listed.
52
53       -a       This  option  causes  list  selection  options to be ANDed, as
54                described above.
55
56       -b       This option causes lslk to avoid kernel functions  that  might
57                block - lstat(2), readlink(2), and stat(2).
58
59                See  the  BLOCKS  AND TIMEOUTS and AVOIDING KERNEL BLOCKS sec‐
60                tions for information on using this option.
61
62       -i i     This option selects the listing of locks whose owning  process
63                is on the Internet host whose name or network address is i.
64
65                Multiple addresses may be declared with multiple -i i options.
66
67       -k k     This  option specifies k as an alternate to the default kernel
68                name list file path.  The default kernel name list  file  path
69                is listed in the -h help output.
70
71                It  may  be necessary to specify an alternate kernel name list
72                path when the file at the default path isn't the booted kernel
73                -- e.g., the default is /vmunix, but the booted kernel file is
74                /vmunix.new.
75
76                Unless lslk accesses the correct kernel name list file, it may
77                derive incorrect addresses for symbols in kernel memory, caus‐
78                ing it to fail.
79
80       -n       This option inhibits the conversion of network host  names  to
81                network  addresses  and the conversion of network addresses to
82                network host names.
83
84                This option may be useful when the host name to address trans‐
85                lation service (e.g., the Domain Name Server) is slow or inop‐
86                erative.
87
88                If you use this option on hosts whose kernel lock  table  con‐
89                tains only host names - e.g., SCO or Solaris - or you use this
90                option and also select the listing of  locks  by  an  Internet
91                network address with the -i i option, lslk will not be able to
92                locate any locks with the specified network address, nor  will
93                it  be able to report network addresses in its output.  The -n
94                option inhibits the necessary conversion of kernel lock  table
95                host names to network addresses.
96
97       -O       This  option  directs  lslk  to bypass the strategy it uses to
98                avoid being blocked by some kernel operations  -  i.e.,  doing
99                them  in  forked child processes.  See the BLOCKS AND TIMEOUTS
100                and AVOIDING KERNEL BLOCKS sections for  more  information  on
101                kernel operations that may block lslk.
102
103       -p p     This  option selects the listing of locks whose owning process
104                IDentification (PID) numbers are in the comma-separated  list,
105                p.
106
107       -S [t]   This  option  specifies an optional time-out seconds value for
108                kernel functions - lstat(2), readlink(2), and stat(2)  -  that
109                might  otherwise  deadlock.   The  minimum  for  t is two; the
110                default, fifteen; when no value is specified, the  default  is
111                used.
112
113                See the BLOCKS AND TIMEOUTS section for more information.
114
115       -v       When  this option is specified, lslk lists version information
116                - i.e., where, when and how it was constructed.
117
118       -w       This option suppresses non-fatal warning messages.
119
120       paths    This option specifies a list of file path names for which lslk
121                is to list lock information.
122

OUTPUT

124       Lslk lists the information for each lock on a separate line in the fol‐
125       lowing columns.  (The columns are dynamically sized.)
126
127       SRC     indicates the source of the process holding the lock.
128
129               If the source is a local process,  its  command  name  is  dis‐
130               played,  or  ``(unknown)''  if the command name can't be deter‐
131               mined.
132
133               If the source is a remote process, the  host  name  or  network
134               number where the remote process executes is displayed.
135
136       PID     is the Process IDentification number of the process holding the
137               lock.
138
139       DEV     is the device (major and minor numbers)  on  which  the  locked
140               file resides.
141
142       INUM    is the inode number of the locked file.
143
144       SZ      is the size of the locked file.
145
146       TY      is the lock type:
147                         r    read;
148                         rw   read and write;
149                         w    write;
150                         ?    unknown.
151
152       M       is  the mandatory state of the lock: 0 if none; 1 if set.  (See
153               chmod(1)).
154
155       ST      is the relative byte offset of the lock.
156
157       WH      is the starting offset (``whence'') of the lock.
158
159       END     is the ending offset of the lock.
160
161       LEN     is the length of the lock.
162
163       NAME    is the name of the locked file, if it was specified as  a  path
164               argument.
165
166               If  there  is  no  path argument name, then the mount point and
167               device paths of the  file  system  on  which  the  locked  file
168               resides are displayed.
169

BLOCKS AND TIMEOUTS

171       Lslk  can  be blocked by some kernel functions that it uses - lstat(2),
172       readlink(2), and stat(2).  These functions are stalled in  the  kernel,
173       for  example,  when  the  hosts  where  mounted NFS file systems reside
174       become inaccessible.
175
176       Lslk attempts to break these blocks with timers  and  child  processes,
177       but  the  techniques are not wholly reliable.  When lslk does manage to
178       break a block, it will report the break with  an  error  message.   The
179       messages may be suppressed with the -w option.
180
181       The  default  timeout value may be displayed with the -h option, and it
182       may be changed with the -S [t] option.  The minimum for t is  two  sec‐
183       onds,  but you should avoid small values, since slow system responsive‐
184       ness can cause short timeouts to expire unexpectedly and  perhaps  stop
185       lslk before it can produce any output.
186
187       When lslk has to break a block during its access of mounted file system
188       information, it normally  continues,  although  with  less  information
189       available to display about open files.
190
191       Lslk  can  also be directed to avoid the protection of timers and child
192       processes when using the kernel functions that might block by  specify‐
193       ing  the  -O  option.  While this will allow lslk to start up with less
194       overhead, it exposes lslk completely  to  the  kernel  situations  that
195       might block it.  Use this option cautiously.
196

AVOIDING KERNEL BLOCKS

198       You  can use the -b option to tell lslk to avoid using kernel functions
199       that would block.  Some cautions apply.
200
201       First, using this option  usually  requires  that  your  system  supply
202       alternate device numbers in place of the device numbers that lslk would
203       normally obtain with the lstat(2) and stat(2)  kernel  functions.   See
204       the  ALTERNATE DEVICE NUMBERS section for more information on alternate
205       device numbers.
206
207       Second, you can't specify the names of files you want  lslk  to  locate
208       locks for unless they're file system names.  This is because lslk needs
209       to know the device and inode numbers of files listed with names in  the
210       lslk  options,  and  the  -b  option prevents lslk from obtaining them.
211       Moreover, since lslk only has device numbers for the file systems  that
212       have  alternates,  its  ability to locate locks on file systems depends
213       completely on the availability and accuracy of the alternates.   If  no
214       alternates  are  available, or if they're incorrect, lslk won't be able
215       to locate locks on the named file systems.
216
217       Third, if the names of your file system directories that  lslk  obtains
218       from  your  system's mount table are symbolic links, lslk won't be able
219       to resolve the links.  This is because the -b  option  causes  lslk  to
220       avoid  the  kernel  readlink(2)  function  it  uses to resolve symbolic
221       links.
222
223       Finally, using the -b option causes lslk to issue warning messages when
224       it  needs  to use the kernel functions that the -b option directs it to
225       avoid.  You can suppress these messages by specifying  the  -w  option,
226       but  if  you do, you won't see the alternate device numbers reported in
227       the warning messages.
228

ALTERNATE DEVICE NUMBERS

230       On some dialects, when lslk has to break a block because it  can't  get
231       information  about  a  mounted file system via the lstat(2) and stat(2)
232       kernel functions, or because you specified  the  -b  option,  lslk  can
233       obtain  some of the information it needs - the device number and possi‐
234       bly the file system type - from the system mount table.  When  that  is
235       possible,  lslk  will  report  the device number it obtained.  (You can
236       suppress the report by specifying the -w option.)
237
238       You can assist this process if your mount table is  supported  with  an
239       /etc/mtab  or /etc/mnttab file that contains an options field by adding
240       a ``dev=xxxx'' field for mount points that do not  have  one  in  their
241       options strings.
242
243       The  ``xxxx'' portion of the field is the hexadecimal value of the file
244       system's device number.  (Consult the st_dev field of the output of the
245       lstat(2) and stat(2) functions for the appropriate values for your file
246       systems.)  Here's an example from a Solaris 2.5 /etc/mnttab for  a  UFS
247       file system:
248
249            ... ufs suid,rw,dev=80001f ...
250
251       Some  dialects  that  do not use an ASCII /etc/mtab or /etc/mnttab file
252       for the mount table may still provide an alternative device  number  in
253       their  internal  mount  tables.   This includes AIX, DEC OSF/1, Digital
254       UNIX, and Tru64 UNIX.  Lslk knows how to obtain the alternative  device
255       number  for  these dialects and uses it when its attempt to lstat(2) or
256       stat(2) the file system is blocked.
257
258       If you're not sure your dialect supplies alternate device  numbers  for
259       file  systems from its mount table, use this lslk incantation to see if
260       it reports any alternate device numbers:
261
262              lslk -b
263
264       Look for standard error file warning  messages  that  begin  ``assuming
265       "dev=xxxx" from ...''.
266

DIAGNOSTICS

268       Errors are identified with messages on the standard error file.
269
270       Lslk  returns a one (1) if an error was detected or if it couldn't list
271       lock information for all the names that were specified.
272

EXAMPLES

274       To list all locks, use:
275
276              lslk
277
278       To list locks from the host ``klaatu'' in the local domain, use:
279
280              lslk -i klaatu
281
282       To list locks from  the  hosts  helios.cc.purdue.edu  and  vic1.cc.pur‐
283       due.edu, use:
284
285              lslk -i helios.cc.purdue.edu -i vic1.cc.purdue.edu
286
287       To list locks held by processes 1234 and 56789, use:
288
289              lslk -p 1234,56789
290
291       To list all locks held by process 1234 on host klaatu, use:
292
293              lslk -p 1234 -a -i klaatu
294

PERMISSION

296       Lslk  must  have  permission  to access the system memory files - e.g.,
297       /dev/kmem and /dev/mem.  Permission to do that is granted when the lslk
298       process  is run from a root shell, or when its ``setgid'' group matches
299       the group (e.g., ``sys'') that can read the system memory files.
300

BUGS

302       Perhaps it should be possible to specify the host  on  which  a  search
303       target PID is located.
304
305       DEC  OSF/1,  Digital UNIX, and Tru64 UNIX lslk won't find locks applied
306       with the flock(2) function.   It  will  find  locks  applied  with  the
307       fcntl(2) and lockf(3) functions.
308
309       Linux lslk will not report locks held by NFS clients.  It may have dif‐
310       ficulty reporting locks held on dynamic inodes (e.g.,  for  the  Win-95
311       file system type, smbfs).
312
313              Solaris  lslk  won't find locks held on local Veritas VxFS files
314              by local or remote processes.
315

FILES

317       /dev/kmem    kernel virtual memory device
318
319       /dev/mem     physical memory device
320

AUTHORS

322       Lslk was written by Victor A. Abell <abe@purdue.edu> of the Purdue Uni‐
323       versity Computing Center (PUCC).
324
325       Chris  Eleveld  <chris@sector7.com>  did  the  DEC OSF/1, Digital UNIX,
326       Linux, and Tru64 UNIX ports.
327

SEE ALSO

329       chmod(1),   fcntl(2),   fcntl(5),   flock(3B),   lockd(1M),   lstat(2),
330       lockf(3C), readlink(2), stat(2).
331
332
333
334                                 Revision-1.29                         LSLK(8)
Impressum