CernVM-FS  2.12.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
cmd_lsof.cc
Go to the documentation of this file.
1 
6 #include "cmd_lsof.h"
7 
8 #include <string>
9 #include <vector>
10 
11 #include "util/logging.h"
12 #include "util/posix.h"
13 
14 int publish::CmdLsof::Main(const Options &options) {
15  std::string path = options.plain_args()[0].value_str;
16  std::vector<LsofEntry> entries = Lsof(path);
17  for (unsigned i = 0; i < entries.size(); ++i) {
18  LogCvmfs(kLogCvmfs, kLogStdout, "%s %s",
19  entries[i].read_only ? "ro" : "rw", entries[i].path.c_str());
20  }
21  return 0;
22 }
const std::vector< Argument > & plain_args() const
Definition: command.h:137
virtual int Main(const Options &options)
Definition: cmd_lsof.cc:14
std::vector< LsofEntry > Lsof(const std::string &path)
Definition: posix.cc:1510
CVMFS_EXPORT void LogCvmfs(const LogSource source, const int mask, const char *format,...)
Definition: logging.cc:528