summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/sys
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/qpid/sys')
-rw-r--r--cpp/src/qpid/sys/SystemInfo.h11
-rwxr-xr-xcpp/src/qpid/sys/posix/SystemInfo.cpp12
2 files changed, 23 insertions, 0 deletions
diff --git a/cpp/src/qpid/sys/SystemInfo.h b/cpp/src/qpid/sys/SystemInfo.h
index 5a116cf8ee..d43fe34b04 100644
--- a/cpp/src/qpid/sys/SystemInfo.h
+++ b/cpp/src/qpid/sys/SystemInfo.h
@@ -63,6 +63,17 @@ namespace SystemInfo {
std::string &version,
std::string &machine);
+ /**
+ * Get the process ID of the current process.
+ */
+ uint32_t getProcessId();
+
+ /**
+ * Get the process ID of the parent of the current process.
+ */
+ uint32_t getParentProcessId();
+
+
}}} // namespace qpid::sys::SystemInfo
#endif /*!QPID_SYS_SYSTEMINFO_H*/
diff --git a/cpp/src/qpid/sys/posix/SystemInfo.cpp b/cpp/src/qpid/sys/posix/SystemInfo.cpp
index 9bbd023e29..938d4861c4 100755
--- a/cpp/src/qpid/sys/posix/SystemInfo.cpp
+++ b/cpp/src/qpid/sys/posix/SystemInfo.cpp
@@ -94,4 +94,16 @@ void SystemInfo::getSystemId (std::string &osName,
}
}
+uint32_t SystemInfo::getProcessId()
+{
+ return (uint32_t) ::getpid();
+}
+
+uint32_t SystemInfo::getParentProcessId()
+{
+ return (uint32_t) ::getppid();
+}
+
+
+
}} // namespace qpid::sys