The PID column may be printed as −1 for locks that are not tied to a
process or are inaccessible to lslocks (e.g., permission constraints).
The libsmartcols filter engine does not support negative integers, so
PID = −1 cannot be compared reliably.
Attach the PID as cell userdata only when PID >= 0, and use that value
for filter evaluation. Rows with PID = −1 are thus excluded from PID
comparisons.
No change to printed output.
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
The default output is subject to change. So whenever possible, you should avoid using default output in your scripts.
+For OFD locks, the PID column may show -1. Such lines cannot be
+selected by the filter, because the current filter engine does not
+support negative numbers.
+
== AUTHORS
mailto:dave@gnu.org[Davidlohr Bueso]
break;
case COL_PID:
xasprintf(&str, "%d", l->pid);
+ if (l->pid >= 0)
+ *rawdata = (uint64_t)l->pid;
break;
case COL_TYPE:
xasprintf(&str, "%s", l->type);
scols_column_set_json_type(col, json_type);
}
- if (id == COL_SIZE && !bytes) {
+ if ((id == COL_SIZE && !bytes) || id == COL_PID) {
scols_column_set_data_type(col, SCOLS_DATA_U64);
scols_column_set_data_func(col, get_u64_cell, NULL);
}