Errors are identified with messages on the standard error file.
Lsof returns a one (1) if any error was detected, including the
failure to locate command names, file names, Internet addresses
or files, login names, NFS files, PIDs, PGIDs, or UIDs it was
asked to list. If the -V
option is specified, lsof will indicate
the search items it failed to list.
It returns a zero (0) if no errors were detected and if it was
able to list some information about all the specified search
arguments.
When lsof cannot open access to /dev (or /devices) or one of its
subdirectories, or get information on a file in them with
stat(2), it issues a warning message and continues. That lsof
will issue warning messages about inaccessible files in /dev (or
/devices) is indicated in its help output - requested with the -h
or >B -? options - with the message:
Inaccessible /dev warnings are enabled.
The warning message may be suppressed with the -w
option. It may
also have been suppressed by the system administrator when lsof
was compiled by the setting of the WARNDEVACCESS definition. In
this case, the output from the help options will include the
message:
Inaccessible /dev warnings are disabled.
Inaccessible device warning messages usually disappear after lsof
has created a working device cache file.