libzypp  10.5.0
CheckAccessDeleted.h
Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
00005 |                          / /__ | | | | | |                           |
00006 |                         /_____||_| |_| |_|                           |
00007 |                                                                      |
00008 \---------------------------------------------------------------------*/
00012 #ifndef ZYPP_MISC_CHECKACCESSDELETED_H
00013 #define ZYPP_MISC_CHECKACCESSDELETED_H
00014 
00015 #include <iosfwd>
00016 #include <vector>
00017 #include <string>
00018 
00020 namespace zypp
00021 { 
00022 
00034   class CheckAccessDeleted
00035   {
00036 
00037     public:
00041       struct ProcInfo
00042       {
00043         std::string pid;                
00044         std::string ppid;               
00045         std::string puid;               
00046         std::string login;              
00047         std::string command;            
00048         std::vector<std::string> files; 
00049 
00055         std::string service() const;
00056       };
00057 
00058       typedef size_t                                    size_type;
00059       typedef ProcInfo                                  value_type;
00060       typedef std::vector<ProcInfo>::const_iterator     const_iterator;
00061 
00062     public:
00068       CheckAccessDeleted( bool doCheck_r = true )
00069       { if ( doCheck_r ) check(); }
00070 
00071     public:
00084       size_type check( bool verbose_r = false );
00085 
00086       bool empty() const                { return _data.empty(); }
00087       size_type size() const            { return _data.size(); }
00088       const_iterator begin() const      { return _data.begin(); }
00089       const_iterator end() const        { return _data.end(); }
00090 
00091     public:
00097       static std::string findService( const char * command_r );
00099       static std::string findService( const std::string & command_r );
00101       static std::string findService( const Pathname & command_r );
00103       static std::string findService( pid_t pid_r );
00104 
00105     private:
00106       std::vector<ProcInfo> _data;
00107   };
00109 
00111   std::ostream & operator<<( std::ostream & str, const CheckAccessDeleted & obj );
00112 
00114   std::ostream & operator<<( std::ostream & str, const CheckAccessDeleted::ProcInfo & obj );
00115 
00117 } // namespace zypp
00119 #endif // ZYPP_MISC_CHECKACCESSDELETED_H