summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorZdenek Prikryl <zprikryl@redhat.com>2009-02-12 11:50:56 +0100
committerZdenek Prikryl <zprikryl@redhat.com>2009-02-12 11:50:56 +0100
commitaaef16fb6fce63936bc0fd7aca205b7f1b0c9580 (patch)
tree4d784b7fe97d90ce42c5a7c165e9013efed7d71b /lib
parent6259030484be3e11c1d8accf943fd5411cb0d7bb (diff)
downloadabrt-aaef16fb6fce63936bc0fd7aca205b7f1b0c9580.tar.gz
abrt-aaef16fb6fce63936bc0fd7aca205b7f1b0c9580.tar.xz
abrt-aaef16fb6fce63936bc0fd7aca205b7f1b0c9580.zip
for getting proc info and package names there are separate plublic methods
Diffstat (limited to 'lib')
-rw-r--r--lib/Utils/DebugDump.cpp30
-rw-r--r--lib/Utils/DebugDump.h5
2 files changed, 20 insertions, 15 deletions
diff --git a/lib/Utils/DebugDump.cpp b/lib/Utils/DebugDump.cpp
index e0f88c4..09e65ae 100644
--- a/lib/Utils/DebugDump.cpp
+++ b/lib/Utils/DebugDump.cpp
@@ -79,13 +79,6 @@ void CDebugDump::Create(const std::string& pDir)
SaveTime();
}
-void CDebugDump::Create(const std::string& pDir, const std::string& pPID)
-{
- Create(pDir);
- SaveProc(pPID);
-}
-
-
void CDebugDump::Delete(const std::string& pDir)
{
if (!ExistFileDir(pDir))
@@ -253,12 +246,6 @@ void CDebugDump::SaveProc(const std::string& pPID)
SaveText(FILENAME_EXECUTABLE, executable);
}
- CPackages packages;
- while (!packages.SearchFile(executable)) {}
- while (!packages.GetStatus()) {}
- std::string package = packages.GetSearchFileReply();
-
- SaveText(FILENAME_PACKAGE, package);
path = "/proc/"+pPID+"/status";
std::string uid = "";
@@ -273,4 +260,21 @@ void CDebugDump::SaveProc(const std::string& pPID)
ii++;
}
SaveText(FILENAME_UID, uid);
+
+ path = "/proc/"+pPID+"/cmdline";
+ LoadTextFile(path, data);
+ SaveText(FILENAME_CMDLINE, data);
+}
+
+void CDebugDump::SavePackage()
+{
+ std::string executable;
+ std::string package = "";
+ if (Exist(FILENAME_EXECUTABLE))
+ {
+ CPackages packages;
+ LoadText(FILENAME_EXECUTABLE, executable);
+ package = packages.SearchFile("/usr/sbin/acpid");
+ }
+ SaveText(FILENAME_PACKAGE, package);
}
diff --git a/lib/Utils/DebugDump.h b/lib/Utils/DebugDump.h
index 2027bf7..f7e740d 100644
--- a/lib/Utils/DebugDump.h
+++ b/lib/Utils/DebugDump.h
@@ -28,6 +28,7 @@
#define FILENAME_ARCHITECTURE "architecture"
#define FILENAME_KERNEL "kernel"
#define FILENAME_EXECUTABLE "executable"
+#define FILENAME_CMDLINE "cmdline"
#define FILENAME_TIME "time"
#define FILENAME_UID "uid"
#define FILENAME_PACKAGE "package"
@@ -45,7 +46,6 @@ class CDebugDump
void SaveEnvironment();
void SaveTime();
- void SaveProc(const std::string& pPID);
void LoadTextFile(const std::string& pName, std::string& pData);
void LoadBinaryFile(const std::string& pName, char** pData, unsigned int* pSize);
@@ -59,7 +59,8 @@ class CDebugDump
CDebugDump();
void Open(const std::string& pDir);
void Create(const std::string& pDir);
- void Create(const std::string& pDir, const std::string& pPID);
+ void SaveProc(const std::string& pPID);
+ void SavePackage();
void Delete(const std::string& pDir);
bool Exist(const std::string& pFileName);