.SH DESCRIPTION
.B lslocks
lists information about all the currently held file locks in a Linux system.
+.sp
+Note that lslocks also lists OFD (Open File Description) locks, these locks are
+not associated with any process (PID is -1). OFD locks are associated with the
+open file description on which they are acquired. This lock type is available
+since Linux 3.15, see \fBfcntl\fR(2) for more details.
.SH OPTIONS
.TP
.IP "COMMAND"
The command name of the process holding the lock.
.IP "PID"
-The process ID of the process which holds the lock.
+The process ID of the process which holds the lock or -1 for OFDLCK.
.IP "TYPE"
The type of lock; can be FLOCK (created with \fBflock\fR(2)), POSIX
(created with \fBfcntl\fR(2) and \fBlockf\fR(3)) or OFDLCK (created with fcntl(2).
case 4: /* PID */
/*
* If user passed a pid we filter it later when adding
- * to the list, no need to worry now.
+ * to the list, no need to worry now. OFD locks use -1 PID.
*/
l->pid = strtos32_or_err(tok, _("failed to parse pid"));
- l->cmdname = proc_get_command_name(l->pid);
- if (!l->cmdname)
- l->cmdname = xstrdup(_("(unknown)"));
+ if (l->pid > 0) {
+ l->cmdname = proc_get_command_name(l->pid);
+ if (!l->cmdname)
+ l->cmdname = xstrdup(_("(unknown)"));
+ } else
+ l->cmdname = xstrdup(_("(undefined)"));
break;
case 5: /* device major:minor and inode number */