libzypp 17.37.10

CheckAccessDeleted.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
12#ifndef ZYPP_MISC_CHECKACCESSDELETED_H
13#define ZYPP_MISC_CHECKACCESSDELETED_H
14
15#include <iosfwd>
16#include <vector>
17#include <string>
18#include <zypp/Globals.h>
19#include <zypp/Pathname.h>
20#include <zypp/base/PtrTypes.h>
21
23 namespace zypp
24{
25
42 class ZYPP_API CheckAccessDeleted
43 {
44
45 public:
46 class Impl;
50 struct ProcInfo
51 {
52 std::string pid;
53 std::string ppid;
54 std::string puid;
55 std::string login;
56 std::string command;
57 std::vector<std::string> files;
58
63 std::string service() const;
64 };
65
66 using size_type = size_t;
67 using value_type = ProcInfo;
68 using const_iterator = std::vector<ProcInfo>::const_iterator;
69
70 public:
76 CheckAccessDeleted( bool doCheck_r = true );
77
78 public:
91 size_type check( bool verbose_r = false );
92
100 size_type check( const Pathname &lsofOutput_r, bool verbose_r = false );
101
102 bool empty() const;
103 size_type size() const;
104 const_iterator begin() const;
105 const_iterator end() const;
106
111 void setDebugOutputFile (const Pathname &filename_r);
112
113 public:
118 static std::string findService( pid_t pid_r );
119 private:
120 RWCOW_pointer<Impl> _pimpl;
121 };
122
123
125 std::ostream & operator<<( std::ostream & str, const CheckAccessDeleted & obj );
126
128 std::ostream & operator<<( std::ostream & str, const CheckAccessDeleted::ProcInfo & obj );
129
131} // namespace zypp
133#endif // ZYPP_MISC_CHECKACCESSDELETED_H
zypp::CheckAccessDeleted::Impl
Definition CheckAccessDeleted.cc:192
zypp::CheckAccessDeleted
Check for running processes which access deleted executables or libraries.
Definition CheckAccessDeleted.h:43
zypp::CheckAccessDeleted::check
size_type check(bool verbose_r=false)
Check for running processes which access deleted executables or libraries.
Definition CheckAccessDeleted.cc:433
zypp::CheckAccessDeleted::size
size_type size() const
Definition CheckAccessDeleted.cc:509
zypp::CheckAccessDeleted::CheckAccessDeleted
CheckAccessDeleted(bool doCheck_r=true)
Default ctor performs check immediately.
Definition CheckAccessDeleted.cc:371
zypp::CheckAccessDeleted::end
const_iterator end() const
Definition CheckAccessDeleted.cc:519
zypp::CheckAccessDeleted::empty
bool empty() const
Definition CheckAccessDeleted.cc:504
zypp::CheckAccessDeleted::begin
const_iterator begin() const
Definition CheckAccessDeleted.cc:514
zypp::CheckAccessDeleted::size_type
size_t size_type
Definition CheckAccessDeleted.h:66
zypp::CheckAccessDeleted::findService
static std::string findService(pid_t pid_r)
Guess if pid was started by a systemd service script.
Definition CheckAccessDeleted.cc:529
zypp::CheckAccessDeleted::value_type
ProcInfo value_type
Definition CheckAccessDeleted.h:67
zypp::CheckAccessDeleted::const_iterator
std::vector< ProcInfo >::const_iterator const_iterator
Definition CheckAccessDeleted.h:68
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:524
zypp::CheckAccessDeleted::_pimpl
RWCOW_pointer< Impl > _pimpl
Definition CheckAccessDeleted.h:120
zypp::filesystem::Pathname
Pathname.
Definition Pathname.h:47
str
String related utilities and Regular expression matching.
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition Application.cc:20
zypp::operator<<
std::ostream & operator<<(std::ostream &str, const SerialNumber &obj)
Definition SerialNumber.cc:52
zypp::ZYPP_API
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
Definition Arch.h:247
zypp::CheckAccessDeleted::ProcInfo
Data about one running process accessing deleted files.
Definition CheckAccessDeleted.h:51
zypp::CheckAccessDeleted::ProcInfo::service
std::string service() const
Guess if command was started by a systemd service script.
Definition CheckAccessDeleted.cc:536
zypp::CheckAccessDeleted::ProcInfo::pid
std::string pid
process ID
Definition CheckAccessDeleted.h:52
zypp::CheckAccessDeleted::ProcInfo::login
std::string login
process login name
Definition CheckAccessDeleted.h:55
zypp::CheckAccessDeleted::ProcInfo::puid
std::string puid
process user ID
Definition CheckAccessDeleted.h:54
zypp::CheckAccessDeleted::ProcInfo::command
std::string command
process command name
Definition CheckAccessDeleted.h:56
zypp::CheckAccessDeleted::ProcInfo::files
std::vector< std::string > files
list of deleted executables or libraries accessed
Definition CheckAccessDeleted.h:57
zypp::CheckAccessDeleted::ProcInfo::ppid
std::string ppid
parent process ID
Definition CheckAccessDeleted.h:53
zypp::RWCOW_pointer
RW_pointer supporting 'copy on write' functionality.
Definition PtrTypes.h:469
Globals.h
Pathname.h
PtrTypes.h