From a7964a3fbd41f098349ab7086b2b7e2e55817469 Mon Sep 17 00:00:00 2001 From: Matthew Brandyberry Date: Fri, 2 Oct 2015 11:15:53 -0500 Subject: [PATCH 1/2] Implement GetThreadCount for AIX. --- googletest/src/gtest-port.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/googletest/src/gtest-port.cc b/googletest/src/gtest-port.cc index 3842c415..c2ea6d76 100644 --- a/googletest/src/gtest-port.cc +++ b/googletest/src/gtest-port.cc @@ -58,6 +58,10 @@ # include #endif // GTEST_OS_QNX +#if GTEST_OS_AIX +# include +#endif // GTEST_OS_AIX + #include "gtest/gtest-spi.h" #include "gtest/gtest-message.h" #include "gtest/internal/gtest-internal.h" @@ -146,6 +150,19 @@ size_t GetThreadCount() { } } +#elif GTEST_OS_AIX + +size_t GetThreadCount() { + struct procentry64 entry; + pid_t pid = getpid(); + int status = getprocs64(&entry, sizeof(entry), NULL, 0, &pid, 1); + if (status == 1) { + return entry.pi_thcount; + } else { + return 0; + } +} + #else size_t GetThreadCount() { From bf7e9e8c2bb3892d9b4dedda81c988aad6fea5c7 Mon Sep 17 00:00:00 2001 From: Matthew Brandyberry Date: Fri, 2 Oct 2015 16:38:02 -0500 Subject: [PATCH 2/2] Add include of sys/types.h. --- googletest/src/gtest-port.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/googletest/src/gtest-port.cc b/googletest/src/gtest-port.cc index c2ea6d76..0162fac4 100644 --- a/googletest/src/gtest-port.cc +++ b/googletest/src/gtest-port.cc @@ -60,6 +60,7 @@ #if GTEST_OS_AIX # include +# include #endif // GTEST_OS_AIX #include "gtest/gtest-spi.h"