libzypp  17.25.1
CheckAccessDeleted.cc
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #include <iostream>
13 #include <fstream>
14 #include <unordered_set>
15 #include <iterator>
16 #include <stdio.h>
17 #include <zypp/base/LogTools.h>
18 #include <zypp/base/String.h>
19 #include <zypp/base/Gettext.h>
20 #include <zypp/base/Exception.h>
21 
22 #include <zypp/PathInfo.h>
23 #include <zypp/ExternalProgram.h>
24 #include <zypp/base/Regex.h>
25 #include <zypp/base/IOStream.h>
26 #include <zypp/base/InputStream.h>
28 
30 
31 using std::endl;
32 
33 #undef ZYPP_BASE_LOGGER_LOGGROUP
34 #define ZYPP_BASE_LOGGER_LOGGROUP "zypp::misc"
35 
37 namespace zypp
38 {
39 
41  namespace
42  {
43  //
44  // lsof output lines are a sequence of NUL terminated fields,
45  // where the 1st char determines the fields type.
46  //
47  // (pcuL) pid command userid loginname
48  // (ftkn).filedescriptor type linkcount filename
49  //
51 
53  typedef std::pair<std::string,std::unordered_set<std::string>> CacheEntry;
54 
61  struct FilterRunsInContainer
62  {
63  private:
64 
65  enum Type {
66  IGNORE,
67  HOST,
68  CONTAINER
69  };
70 
76  Type in_our_root( const Pathname &path ) const {
77 
78  const PathInfo procInfoStat( path );
79 
80  // if we can not stat the file continue to the next one
81  if ( procInfoStat.error() ) return IGNORE;
82 
83  // if the file was unlinked ignore it
84  if ( procInfoStat.nlink() == 0 )
85  return IGNORE;
86 
87  // get the file the link points to, if that fails continue to the next
88  const Pathname linkTarget = filesystem::readlink( path );
89  if ( linkTarget.empty() ) return IGNORE;
90 
91  // get stat info for the target file
92  const PathInfo linkStat( linkTarget );
93 
94  // Non-existent path means it's not reachable by us.
95  if ( !linkStat.isExist() )
96  return CONTAINER;
97 
98  // If the file exists, it could simply mean it exists in and outside a container, check inode to be safe
99  if ( linkStat.ino() != procInfoStat.ino())
100  return CONTAINER;
101 
102  // If the inode is the same, it could simply mean it exists in and outside a container but on different devices, check to be safe
103  if ( linkStat.dev() != procInfoStat.dev() )
104  return CONTAINER;
105 
106  // assume HOST if all tests fail
107  return HOST;
108  }
109 
110  public:
111 
115  bool operator()( const pid_t pid ) const {
116 
117  // first check the exe file
118  const Pathname pidDir = Pathname("/proc") / asString(pid);
119  const Pathname exeFile = pidDir / "exe";
120 
121  auto res = in_our_root( exeFile );
122  if ( res > IGNORE )
123  return res == CONTAINER;
124 
125  // if IGNORE was returned we need to continue testing all the files in /proc/<pid>/map_files until we hopefully
126  // find a still existing file. If all tests fail we will simply assume this pid is running on the HOST
127 
128  // a map of all already tested files, each file can be mapped multiple times and we do not want to check them more than once
129  std::unordered_set<std::string> tested;
130 
131  // iterate over all the entries in /proc/<pid>/map_files
132  filesystem::dirForEach( pidDir / "map_files", [ this, &tested, &res ]( const Pathname & dir_r, const char *const & name_r ){
133 
134  // some helpers to make the code more self explanatory
135  constexpr bool contloop = true;
136  constexpr bool stoploop = false;
137 
138  const Pathname entryName = dir_r / name_r;
139 
140  // get the links target file and check if we alreadys know it, also if we can not read link information we skip the file
141  const Pathname linkTarget = filesystem::readlink( entryName );
142  if ( linkTarget.empty() || !tested.insert( linkTarget.asString() ).second ) return contloop;
143 
144  // try to get file type
145  const auto mappedFileType = in_our_root( entryName );
146 
147  // if we got something, remember the value and stop the loop
148  if ( mappedFileType > IGNORE ) {
149  res = mappedFileType;
150  return stoploop;
151  }
152  return contloop;
153  });
154 
155  // if res is still IGNORE we did not find a explicit answer. So to be safe we assume its running on the host
156  if ( res == IGNORE )
157  return false; // can't tell for sure, lets assume host
158 
159  return res == CONTAINER;
160  }
161 
162  FilterRunsInContainer() {}
163  };
164 
165 
171  bool lsofNoOptKi()
172  {
173  using target::rpm::librpmDb;
174  // RpmDb access is blocked while the Target is not initialized.
175  // Launching the Target just for this query would be an overkill.
176  struct TmpUnblock {
177  TmpUnblock()
178  : _wasBlocked( librpmDb::isBlocked() )
179  { if ( _wasBlocked ) librpmDb::unblockAccess(); }
180  ~TmpUnblock()
181  { if ( _wasBlocked ) librpmDb::blockAccess(); }
182  private:
183  bool _wasBlocked;
184  } tmpUnblock;
185 
186  librpmDb::db_const_iterator it;
187  return( it.findPackage( "lsof" ) && it->tag_edition() < Edition("4.90") && !it->tag_provides().count( Capability("backported-option-Ki") ) );
188  }
189 
190  } //namespace
192 
194  {
195  public:
197 
198  bool addDataIf( const CacheEntry & cache_r, std::vector<std::string> *debMap = nullptr );
199  void addCacheIf( CacheEntry & cache_r, const std::string & line_r, std::vector<std::string> *debMap = nullptr );
200 
201  std::map<pid_t,CacheEntry> filterInput( externalprogram::ExternalDataSource &source );
202  CheckAccessDeleted::size_type createProcInfo( const std::map<pid_t,CacheEntry> &in );
203 
204  std::vector<CheckAccessDeleted::ProcInfo> _data;
205  bool _fromLsofFileMode = false; // Set if we currently process data from a debug file
206  bool _verbose = false;
207 
208  std::map<pid_t,std::vector<std::string>> debugMap; //will contain all used lsof files after filtering
210  };
211 
213  {
214  Impl *myClone = new Impl( *this );
215  return myClone;
216  }
217 
222  inline bool CheckAccessDeleted::Impl::addDataIf( const CacheEntry & cache_r, std::vector<std::string> *debMap )
223  {
224  const auto & filelist( cache_r.second );
225 
226  if ( filelist.empty() )
227  return false;
228 
229  // at least one file access so keep it:
230  _data.push_back( CheckAccessDeleted::ProcInfo() );
231  CheckAccessDeleted::ProcInfo & pinfo( _data.back() );
232  pinfo.files.insert( pinfo.files.begin(), filelist.begin(), filelist.end() );
233 
234  const std::string & pline( cache_r.first );
235  std::string commandname; // pinfo.command if still needed...
236  std::ostringstream pLineStr; //rewrite the first line in debug cache
237  for_( ch, pline.begin(), pline.end() )
238  {
239  switch ( *ch )
240  {
241  case 'p':
242  pinfo.pid = &*(ch+1);
243  if ( debMap )
244  pLineStr <<&*(ch)<<'\0';
245  break;
246  case 'R':
247  pinfo.ppid = &*(ch+1);
248  if ( debMap )
249  pLineStr <<&*(ch)<<'\0';
250  break;
251  case 'u':
252  pinfo.puid = &*(ch+1);
253  if ( debMap )
254  pLineStr <<&*(ch)<<'\0';
255  break;
256  case 'L':
257  pinfo.login = &*(ch+1);
258  if ( debMap )
259  pLineStr <<&*(ch)<<'\0';
260  break;
261  case 'c':
262  if ( pinfo.command.empty() ) {
263  commandname = &*(ch+1);
264  // the lsof command name might be truncated, so we prefer /proc/<pid>/exe
265  if (!_fromLsofFileMode)
266  pinfo.command = filesystem::readlink( Pathname("/proc")/pinfo.pid/"exe" ).basename();
267  if ( pinfo.command.empty() )
268  pinfo.command = std::move(commandname);
269  if ( debMap )
270  pLineStr <<'c'<<pinfo.command<<'\0';
271  }
272  break;
273  }
274  if ( *ch == '\n' ) break; // end of data
275  do { ++ch; } while ( *ch != '\0' ); // skip to next field
276  }
277 
278  //replace the data in the debug cache as well
279  if ( debMap ) {
280  pLineStr<<endl;
281  debMap->front() = pLineStr.str();
282  }
283 
284  //entry was added
285  return true;
286  }
287 
288 
294  inline void CheckAccessDeleted::Impl::addCacheIf( CacheEntry & cache_r, const std::string & line_r, std::vector<std::string> *debMap )
295  {
296  const char * f = 0;
297  const char * t = 0;
298  const char * n = 0;
299 
300  for_( ch, line_r.c_str(), ch+line_r.size() )
301  {
302  switch ( *ch )
303  {
304  case 'k':
305  if ( *(ch+1) != '0' ) // skip non-zero link counts
306  return;
307  break;
308  case 'f':
309  f = ch+1;
310  break;
311  case 't':
312  t = ch+1;
313  break;
314  case 'n':
315  n = ch+1;
316  break;
317  }
318  if ( *ch == '\n' ) break; // end of data
319  do { ++ch; } while ( *ch != '\0' ); // skip to next field
320  }
321 
322  if ( !t || !f || !n )
323  return; // wrong filedescriptor/type/name
324 
325  if ( !( ( *t == 'R' && *(t+1) == 'E' && *(t+2) == 'G' && *(t+3) == '\0' )
326  || ( *t == 'D' && *(t+1) == 'E' && *(t+2) == 'L' && *(t+3) == '\0' ) ) )
327  return; // wrong type
328 
329  if ( !( ( *f == 'm' && *(f+1) == 'e' && *(f+2) == 'm' && *(f+3) == '\0' )
330  || ( *f == 't' && *(f+1) == 'x' && *(f+2) == 't' && *(f+3) == '\0' )
331  || ( *f == 'D' && *(f+1) == 'E' && *(f+2) == 'L' && *(f+3) == '\0' )
332  || ( *f == 'l' && *(f+1) == 't' && *(f+2) == 'x' && *(f+3) == '\0' ) ) )
333  return; // wrong filedescriptor type
334 
335  if ( str::contains( n, "(stat: Permission denied)" ) )
336  return; // Avoid reporting false positive due to insufficient permission.
337 
338  if ( ! _verbose )
339  {
340  if ( ! ( str::contains( n, "/lib" ) || str::contains( n, "bin/" ) ) )
341  return; // Try to avoid reporting false positive unless verbose.
342  }
343 
344  if ( *f == 'm' || *f == 'D' ) // skip some wellknown nonlibrary memorymapped files
345  {
346  static const char * black[] = {
347  "/SYSV"
348  , "/var/"
349  , "/dev/"
350  , "/tmp/"
351  , "/proc/"
352  , "/memfd:"
353  };
354  for_( it, arrayBegin( black ), arrayEnd( black ) )
355  {
356  if ( str::hasPrefix( n, *it ) )
357  return;
358  }
359  }
360  // Add if no duplicate
361  if ( debMap && cache_r.second.find(n) == cache_r.second.end() ) {
362  debMap->push_back(line_r);
363  }
364  cache_r.second.insert( n );
365  }
366 
368  : _pimpl(new Impl)
369  {
370  if ( doCheck_r ) check();
371  }
372 
373  CheckAccessDeleted::size_type CheckAccessDeleted::check( const Pathname &lsofOutput_r, bool verbose_r )
374  {
375  _pimpl->_verbose = verbose_r;
376  _pimpl->_fromLsofFileMode = true;
377 
378  FILE *inFile = fopen( lsofOutput_r.c_str(), "r" );
379  if ( !inFile ) {
380  ZYPP_THROW( Exception( str::Format("Opening input file %1% failed.") % lsofOutput_r.c_str() ) );
381  }
382 
383  //inFile is closed by ExternalDataSource
384  externalprogram::ExternalDataSource inSource( inFile, nullptr );
385  auto cache = _pimpl->filterInput( inSource );
386  return _pimpl->createProcInfo( cache );
387  }
388 
390  {
391  // cachemap: PID => (deleted files)
392  // NOTE: omit PIDs running in a (lxc/docker) container
393  std::map<pid_t,CacheEntry> cachemap;
394 
395  bool debugEnabled = !_debugFile.empty();
396 
397  pid_t cachepid = 0;
398  FilterRunsInContainer runsInLXC;
399  for( std::string line = source.receiveLine( 30 * 1000 ); ! line.empty(); line = source.receiveLine( 30 * 1000 ) )
400  {
401  // NOTE: line contains '\0' separeated fields!
402  if ( line[0] == 'p' )
403  {
404  str::strtonum( line.c_str()+1, cachepid ); // line is "p<PID>\0...."
405  if ( _fromLsofFileMode || !runsInLXC( cachepid ) ) {
406  if ( debugEnabled ) {
407  auto &pidMad = debugMap[cachepid];
408  if ( pidMad.empty() )
409  debugMap[cachepid].push_back( line );
410  else
411  debugMap[cachepid].front() = line;
412  }
413  cachemap[cachepid].first.swap( line );
414  } else {
415  cachepid = 0; // ignore this pid
416  }
417  }
418  else if ( cachepid )
419  {
420  auto &dbgMap = debugMap[cachepid];
421  addCacheIf( cachemap[cachepid], line, debugEnabled ? &dbgMap : nullptr);
422  }
423  }
424  return cachemap;
425  }
426 
428  {
429  static const char* argv[] = { "lsof", "-n", "-FpcuLRftkn0", "-K", "i", NULL };
430  if ( lsofNoOptKi() )
431  argv[3] = NULL;
432 
433  _pimpl->_verbose = verbose_r;
434  _pimpl->_fromLsofFileMode = false;
435 
437  std::map<pid_t,CacheEntry> cachemap;
438 
439  try {
440  cachemap = _pimpl->filterInput( prog );
441  } catch ( const io::TimeoutException &e ) {
442  ZYPP_CAUGHT( e );
443  prog.close();
444  ZYPP_THROW ( Exception( "Reading data from 'lsof' timed out.") );
445  }
446 
447  int ret = prog.close();
448  if ( ret != 0 )
449  {
450  if ( ret == 129 )
451  {
452  ZYPP_THROW( Exception(_("Please install package 'lsof' first.") ) );
453  }
454  Exception err( str::Format("Executing 'lsof' failed (%1%).") % ret );
455  err.remember( prog.execError() );
456  ZYPP_THROW( err );
457  }
458 
459  return _pimpl->createProcInfo( cachemap );
460  }
461 
463  {
464  std::ofstream debugFileOut;
465  bool debugEnabled = false;
466  if ( !_debugFile.empty() ) {
467  debugFileOut.open( _debugFile.c_str() );
468  debugEnabled = debugFileOut.is_open();
469 
470  if ( !debugEnabled ) {
471  ERR<<"Unable to open debug file: "<<_debugFile<<endl;
472  }
473  }
474 
475  _data.clear();
476  for ( const auto &cached : in )
477  {
478  if (!debugEnabled)
479  addDataIf( cached.second);
480  else {
481  std::vector<std::string> *mapPtr = nullptr;
482 
483  auto dbgInfo = debugMap.find(cached.first);
484  if ( dbgInfo != debugMap.end() )
485  mapPtr = &(dbgInfo->second);
486 
487  if( !addDataIf( cached.second, mapPtr ) )
488  continue;
489 
490  for ( const std::string &dbgLine: dbgInfo->second ) {
491  debugFileOut.write( dbgLine.c_str(), dbgLine.length() );
492  }
493  }
494  }
495  return _data.size();
496  }
497 
499  {
500  return _pimpl->_data.empty();
501  }
502 
504  {
505  return _pimpl->_data.size();
506  }
507 
509  {
510  return _pimpl->_data.begin();
511  }
512 
514  {
515  return _pimpl->_data.end();
516  }
517 
519  {
520  _pimpl->_debugFile = filename_r;
521  }
522 
523  std::string CheckAccessDeleted::findService( pid_t pid_r )
524  {
525  ProcInfo p;
526  p.pid = str::numstring( pid_r );
527  return p.service();
528  }
529 
531  {
532  static const str::regex rx( "[0-9]+:name=systemd:/system.slice/(.*/)?(.*).service$" );
533  str::smatch what;
534  std::string ret;
535  iostr::simpleParseFile( InputStream( Pathname("/proc")/pid/"cgroup" ),
536  [&]( int num_r, std::string line_r )->bool
537  {
538  if ( str::regex_match( line_r, what, rx ) )
539  {
540  ret = what[2];
541  return false; // stop after match
542  }
543  return true;
544  } );
545  return ret;
546  }
547 
548  /******************************************************************
549  **
550  ** FUNCTION NAME : operator<<
551  ** FUNCTION TYPE : std::ostream &
552  */
553  std::ostream & operator<<( std::ostream & str, const CheckAccessDeleted & obj )
554  {
555  return dumpRange( str << "CheckAccessDeleted ",
556  obj.begin(),
557  obj.end() );
558  }
559 
560  /******************************************************************
561  **
562  ** FUNCTION NAME : operator<<
563  ** FUNCTION TYPE : std::ostream &
564  */
565  std::ostream & operator<<( std::ostream & str, const CheckAccessDeleted::ProcInfo & obj )
566  {
567  if ( obj.pid.empty() )
568  return str << "<NoProc>";
569 
570  return dumpRangeLine( str << obj.command
571  << '<' << obj.pid
572  << '|' << obj.ppid
573  << '|' << obj.puid
574  << '|' << obj.login
575  << '>',
576  obj.files.begin(),
577  obj.files.end() );
578  }
579 
581 } // namespace zypp
ExternalProgram.h
zypp::CheckAccessDeleted::const_iterator
std::vector< ProcInfo >::const_iterator const_iterator
Definition: CheckAccessDeleted.h:67
PathInfo.h
zypp::CheckAccessDeleted
Check for running processes which access deleted executables or libraries.
Definition: CheckAccessDeleted.h:41
zypp::CheckAccessDeleted::Impl::_fromLsofFileMode
bool _fromLsofFileMode
Definition: CheckAccessDeleted.cc:205
zypp::CheckAccessDeleted::findService
static std::string findService(pid_t pid_r)
Guess if pid was started by a systemd service script.
Definition: CheckAccessDeleted.cc:523
zypp::Exception
Base class for Exception.
Definition: Exception.h:145
zypp::CheckAccessDeleted::setDebugOutputFile
void setDebugOutputFile(const Pathname &filename_r)
Writes all filtered process entries that make it into the final set into a file specified by filename...
Definition: CheckAccessDeleted.cc:518
zypp::dumpRange
std::ostream & dumpRange(std::ostream &str, TIterator begin, TIterator end, const std::string &intro="{", const std::string &pfx="\n ", const std::string &sep="\n ", const std::string &sfx="\n", const std::string &extro="}")
Print range defined by iterators (multiline style).
Definition: LogTools.h:91
arrayBegin
#define arrayBegin(A)
Simple C-array iterator.
Definition: Easy.h:41
ZYPP_THROW
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
Definition: Exception.h:392
zypp::iostr::simpleParseFile
int simpleParseFile(std::istream &str_r, ParseFlags flags_r, function< bool(int, std::string)> consume_r)
Simple lineparser optionally trimming and skipping comments.
Definition: IOStream.cc:123
zypp::CheckAccessDeleted::begin
const_iterator begin() const
Definition: CheckAccessDeleted.cc:508
zypp::CheckAccessDeleted::empty
bool empty() const
Definition: CheckAccessDeleted.cc:498
zypp::ExternalProgram
Execute a program and give access to its io An object of this class encapsulates the execution of an ...
Definition: ExternalProgram.h:59
zypp::CheckAccessDeleted::Impl::addCacheIf
void addCacheIf(CacheEntry &cache_r, const std::string &line_r, std::vector< std::string > *debMap=nullptr)
Add file to cache if it refers to a deleted executable or library file:
Definition: CheckAccessDeleted.cc:294
IOStream.h
zypp::CheckAccessDeleted::ProcInfo::login
std::string login
process login name
Definition: CheckAccessDeleted.h:54
zypp::ExternalProgram::execError
const std::string & execError() const
Some detail telling why the execution failed, if it failed.
Definition: ExternalProgram.h:186
zypp::CheckAccessDeleted::ProcInfo::ppid
std::string ppid
parent process ID
Definition: CheckAccessDeleted.h:52
zypp::CheckAccessDeleted::ProcInfo::service
std::string service() const
Guess if command was started by a systemd service script.
Definition: CheckAccessDeleted.cc:530
zypp::CheckAccessDeleted::operator<<
std::ostream & operator<<(std::ostream &str, const CheckAccessDeleted &obj)
Definition: CheckAccessDeleted.cc:552
zypp::dumpRangeLine
std::ostream & dumpRangeLine(std::ostream &str, TIterator begin, TIterator end)
Print range defined by iterators (single line style).
Definition: LogTools.h:114
LogTools.h
Exception.h
zypp::CheckAccessDeleted::check
size_type check(bool verbose_r=false)
Check for running processes which access deleted executables or libraries.
Definition: CheckAccessDeleted.cc:427
zypp::Exception::remember
void remember(const Exception &old_r)
Store an other Exception as history.
Definition: Exception.cc:105
zypp::CheckAccessDeleted::end
const_iterator end() const
Definition: CheckAccessDeleted.cc:513
CheckAccessDeleted.h
zypp::filesystem::Pathname::c_str
const char * c_str() const
String representation.
Definition: Pathname.h:110
zypp::CheckAccessDeleted::Impl::_data
std::vector< CheckAccessDeleted::ProcInfo > _data
Definition: CheckAccessDeleted.cc:204
zypp::str::contains
bool contains(const C_Str &str_r, const C_Str &val_r)
Locate substring case sensitive.
Definition: String.h:987
zypp::CheckAccessDeleted::size_type
size_t size_type
Definition: CheckAccessDeleted.h:65
zypp::CheckAccessDeleted::Impl
Definition: CheckAccessDeleted.cc:193
_
#define _(MSG)
Definition: Gettext.h:37
zypp::CheckAccessDeleted::_pimpl
RWCOW_pointer< Impl > _pimpl
Definition: CheckAccessDeleted.h:119
zypp::InputStream
Helper to create and pass std::istream.
Definition: InputStream.h:56
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
_data
std::list< PublicKeyData > _data
Definition: KeyRing.cc:145
zypp::CheckAccessDeleted::Impl::clone
CheckAccessDeleted::Impl * clone() const
Definition: CheckAccessDeleted.cc:212
zypp::str::numstring
std::string numstring(char n, int w=0)
Definition: String.h:286
zypp::ExternalProgram::Discard_Stderr
Definition: ExternalProgram.h:72
Regex.h
librpmDb.h
zypp::CheckAccessDeleted::ProcInfo::puid
std::string puid
process user ID
Definition: CheckAccessDeleted.h:53
zypp::CheckAccessDeleted::Impl::_debugFile
Pathname _debugFile
Definition: CheckAccessDeleted.cc:209
zypp::ExternalProgram::close
int close()
Wait for the progamm to complete.
Definition: ExternalProgram.cc:456
zypp::CheckAccessDeleted::ProcInfo::command
std::string command
process command name
Definition: CheckAccessDeleted.h:55
zypp::str::smatch
Regular expression match result.
Definition: Regex.h:160
zypp::CheckAccessDeleted::CheckAccessDeleted
CheckAccessDeleted(bool doCheck_r=true)
Default ctor performs check immediately.
Definition: CheckAccessDeleted.cc:367
zypp::asString
std::string asString(const DefaultIntegral< Tp, TInitial > &obj)
Definition: DefaultIntegral.h:98
zypp::CheckAccessDeleted::Impl::filterInput
std::map< pid_t, CacheEntry > filterInput(externalprogram::ExternalDataSource &source)
Definition: CheckAccessDeleted.cc:389
Gettext.h
for_
#define for_(IT, BEG, END)
Convenient for-loops using iterator.
Definition: Easy.h:28
zypp::filesystem::Pathname::empty
bool empty() const
Test for an empty path.
Definition: Pathname.h:114
zypp::CheckAccessDeleted::Impl::createProcInfo
CheckAccessDeleted::size_type createProcInfo(const std::map< pid_t, CacheEntry > &in)
Definition: CheckAccessDeleted.cc:462
zypp::CheckAccessDeleted::Impl::_verbose
bool _verbose
Definition: CheckAccessDeleted.cc:206
zypp::externalprogram::ExternalDataSource::receiveLine
std::string receiveLine()
Read one line from the input stream.
Definition: ExternalDataSource.cc:115
String.h
zypp::filesystem::Pathname
Pathname.
Definition: Pathname.h:44
arrayEnd
#define arrayEnd(A)
Definition: Easy.h:43
zypp::CheckAccessDeleted::ProcInfo::files
std::vector< std::string > files
list of deleted executables or libraries accessed
Definition: CheckAccessDeleted.h:56
ERR
#define ERR
Definition: Logger.h:81
zypp::CheckAccessDeleted::ProcInfo::pid
std::string pid
process ID
Definition: CheckAccessDeleted.h:51
InputStream.h
zypp::str::Format
Convenient building of std::string with boost::format. Basically a boost::format autoconvertible to s...
Definition: String.h:249
zypp::io::TimeoutException
Definition: IOTools.h:35
zypp::str::regex_match
bool regex_match(const std::string &s, smatch &matches, const regex &regex)
\relates regex \ingroup ZYPP_STR_REGEX \relates regex \ingroup ZYPP_STR_REGEX
Definition: Regex.h:70
zypp::CheckAccessDeleted::Impl::addDataIf
bool addDataIf(const CacheEntry &cache_r, std::vector< std::string > *debMap=nullptr)
Add cache to data if the process is accessing deleted files.
Definition: CheckAccessDeleted.cc:222
str
String related utilities and Regular expression matching.
zypp::CheckAccessDeleted::Impl::debugMap
std::map< pid_t, std::vector< std::string > > debugMap
Definition: CheckAccessDeleted.cc:208
zypp::CheckAccessDeleted::size
size_type size() const
Definition: CheckAccessDeleted.cc:503
zypp::str::hasPrefix
bool hasPrefix(const C_Str &str_r, const C_Str &prefix_r)
Return whether str_r has prefix prefix_r.
Definition: String.h:1023
ZYPP_CAUGHT
#define ZYPP_CAUGHT(EXCPT)
Drops a logline telling the Exception was caught (in order to handle it).
Definition: Exception.h:396
zypp::str::regex
Regular expression.
Definition: Regex.h:94
zypp::filesystem::dirForEach
int dirForEach(const Pathname &dir_r, function< bool(const Pathname &, const char *const)> fnc_r)
Invoke callback function fnc_r for each entry in directory dir_r.
Definition: PathInfo.cc:537
zypp::str::strtonum
TInt strtonum(const C_Str &str)
Parsing numbers from string.
Definition: String.h:385
zypp::externalprogram::ExternalDataSource
Bidirectional stream to external data.
Definition: ExternalDataSource.h:27
zypp::CheckAccessDeleted::ProcInfo
Data about one running process accessing deleted files.
Definition: CheckAccessDeleted.h:49
zypp::filesystem::readlink
int readlink(const Pathname &symlink_r, Pathname &target_r)
Like 'readlink'.
Definition: PathInfo.cc:872