zypp::CheckAccessDeleted Class Reference

Check for running processes which access deleted executables or libraries. More...

#include <CheckAccessDeleted.h>

List of all members.

Classes

struct  ProcInfo
 Data about one running process accessing deleted files. More...

Public Types

typedef size_t size_type
typedef ProcInfo value_type
typedef std::vector< ProcInfo >
::const_iterator 
const_iterator

Public Member Functions

 CheckAccessDeleted (bool doCheck_r=true)
 Default ctor performs check immediately.
size_type check (bool verbose_r=false)
 Check for running processes which access deleted executables or libraries.
bool empty () const
size_type size () const
const_iterator begin () const
const_iterator end () const

Static Public Member Functions

static std::string findService (const char *command_r)
 Guess if command was started by an /etc/init.d/ script.
static std::string findService (const std::string &command_r)
static std::string findService (const Pathname &command_r)
static std::string findService (pid_t pid_r)

Private Attributes

std::vector< ProcInfo_data

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &str, const CheckAccessDeleted &obj)


Detailed Description

Check for running processes which access deleted executables or libraries.

Executed after commit, this gives a hint which processes/services need to be restarted.

Per default upon construtcion or explicit call to check, information about running processes which access deleted files or libraries is collected and provided as a ProcInfo container.

Definition at line 34 of file CheckAccessDeleted.h.


Member Typedef Documentation

Definition at line 58 of file CheckAccessDeleted.h.

Definition at line 59 of file CheckAccessDeleted.h.

Definition at line 60 of file CheckAccessDeleted.h.


Constructor & Destructor Documentation

zypp::CheckAccessDeleted::CheckAccessDeleted ( bool  doCheck_r = true  )  [inline]

Default ctor performs check immediately.

Pass false and the initial check is omitted.

Exceptions:
Exception if check throws.
See also:
check.

Definition at line 68 of file CheckAccessDeleted.h.

References check().


Member Function Documentation

CheckAccessDeleted::size_type zypp::CheckAccessDeleted::check ( bool  verbose_r = false  ) 

Check for running processes which access deleted executables or libraries.

Per default check will try guess and collect executables and libraries only by looking at the files path and name. (e.g named lib* or located in *bin/).

A verbose check will omit this test and collect all processes uning any deleted file.

Returns:
the number of processes found.
Exceptions:
Exception On error collecting the data (e.g. no lsof installed)

Definition at line 173 of file CheckAccessDeleted.cc.

References _data, zypp::ExternalProgram::close(), zypp::ExternalProgram::Discard_Stderr, zypp::ExternalProgram::execError(), zypp::str::form(), zypp::CheckAccessDeleted::ProcInfo::pid, zypp::externalprogram::ExternalDataSource::receiveLine(), zypp::Exception::remember(), and ZYPP_THROW.

Referenced by CheckAccessDeleted().

bool zypp::CheckAccessDeleted::empty (  )  const [inline]

Definition at line 86 of file CheckAccessDeleted.h.

References _data.

size_type zypp::CheckAccessDeleted::size (  )  const [inline]

Definition at line 87 of file CheckAccessDeleted.h.

References _data.

const_iterator zypp::CheckAccessDeleted::begin (  )  const [inline]

Definition at line 88 of file CheckAccessDeleted.h.

References _data.

Referenced by zypp::operator<<().

const_iterator zypp::CheckAccessDeleted::end (  )  const [inline]

Definition at line 89 of file CheckAccessDeleted.h.

References _data.

Referenced by zypp::operator<<().

std::string zypp::CheckAccessDeleted::findService ( const char *  command_r  )  [static]

Guess if command was started by an /etc/init.d/ script.

The name of an /etc/init.d/ script that might be used to restart the command. command may be specifies by name, full path or pid.

Warning:
This is just a guess.

Definition at line 217 of file CheckAccessDeleted.cc.

Referenced by findService().

std::string zypp::CheckAccessDeleted::findService ( const std::string &  command_r  )  [static]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 220 of file CheckAccessDeleted.cc.

References findService().

std::string zypp::CheckAccessDeleted::findService ( const Pathname &  command_r  )  [static]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 211 of file CheckAccessDeleted.cc.

References zypp::CheckAccessDeleted::ProcInfo::command, and zypp::CheckAccessDeleted::ProcInfo::service().

std::string zypp::CheckAccessDeleted::findService ( pid_t  pid_r  )  [static]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 223 of file CheckAccessDeleted.cc.

References findService(), zypp::str::numstring(), and zypp::filesystem::readlink().


Friends And Related Function Documentation

std::ostream & operator<< ( std::ostream &  str,
const CheckAccessDeleted obj 
) [related]

Stream output

Definition at line 269 of file CheckAccessDeleted.cc.


Member Data Documentation

std::vector<ProcInfo> zypp::CheckAccessDeleted::_data [private]

Definition at line 106 of file CheckAccessDeleted.h.

Referenced by begin(), check(), empty(), end(), and size().


The documentation for this class was generated from the following files:

doxygen