summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2019-07-15 05:14:32 -0400
committerBenoit Foucher <benoit@zeroc.com>2019-07-15 11:14:32 +0200
commit2e60ce8af12b12a8c1aed18c7bea2413016d4004 (patch)
tree4f5f578bb99ea4713cbc1d0e57346b6036c70f10 /cpp/src
parentTest script minor warning fixes (diff)
downloadice-2e60ce8af12b12a8c1aed18c7bea2413016d4004.tar.bz2
ice-2e60ce8af12b12a8c1aed18c7bea2413016d4004.tar.xz
ice-2e60ce8af12b12a8c1aed18c7bea2413016d4004.zip
Port to AIX with g++, xlC_r and xlclang++ (#434)
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/IceGrid/Activator.cpp34
-rw-r--r--cpp/src/IceGrid/IceGridNode.cpp9
-rw-r--r--cpp/src/IceGrid/PlatformInfo.cpp4
-rw-r--r--cpp/src/IceSSL/OpenSSLTransceiverI.cpp15
-rw-r--r--cpp/src/IceUtil/UtilException.cpp2
5 files changed, 55 insertions, 9 deletions
diff --git a/cpp/src/IceGrid/Activator.cpp b/cpp/src/IceGrid/Activator.cpp
index a9a4508e910..9a9fb38af2b 100644
--- a/cpp/src/IceGrid/Activator.cpp
+++ b/cpp/src/IceGrid/Activator.cpp
@@ -641,25 +641,47 @@ Activator::activate(const string& name,
}
vector<gid_t> groups;
+#ifdef _AIX
+ char* grouplist = getgrset(pw->pw_name);
+ if(grouplist == 0)
+ {
+ throw SyscallException(__FILE__, __LINE__, getSystemErrno());
+ }
+ vector<string> grps;
+ if(IceUtilInternal::splitString(grouplist, ",", grps))
+ {
+ for(vector<string>::const_iterator p = grps.begin(); p != grps.end(); ++p)
+ {
+ gid_t group;
+ istringstream is(*p);
+ if(is >> group)
+ {
+ groups.push_back(group);
+ }
+ }
+ }
+ free(grouplist);
+#else
groups.resize(20);
int ngroups = static_cast<int>(groups.size());
-#if defined(__APPLE__)
+# if defined(__APPLE__)
if(getgrouplist(pw->pw_name, static_cast<int>(gid), reinterpret_cast<int*>(&groups[0]), &ngroups) < 0)
-#else
+# else
if(getgrouplist(pw->pw_name, gid, &groups[0], &ngroups) < 0)
-#endif
+# endif
{
groups.resize(static_cast<size_t>(ngroups));
-#if defined(__APPLE__)
+# if defined(__APPLE__)
getgrouplist(pw->pw_name, static_cast<int>(gid), reinterpret_cast<int*>(&groups[0]), &ngroups);
-#else
+# else
getgrouplist(pw->pw_name, gid, &groups[0], &ngroups);
-#endif
+# endif
}
else
{
groups.resize(static_cast<size_t>(ngroups));
}
+#endif
if(groups.size() > NGROUPS_MAX)
{
diff --git a/cpp/src/IceGrid/IceGridNode.cpp b/cpp/src/IceGrid/IceGridNode.cpp
index f80cf673236..9a96452a520 100644
--- a/cpp/src/IceGrid/IceGridNode.cpp
+++ b/cpp/src/IceGrid/IceGridNode.cpp
@@ -32,7 +32,12 @@ using namespace Ice;
using namespace IceInternal;
using namespace IceGrid;
+// Work-around for anonymous namspace bug in xlclang++
+#ifdef __ibmxl__
+namespace IceGridNodeNamespace
+#else
namespace
+#endif
{
class ProcessI : public Process
@@ -110,6 +115,10 @@ setNoIndexingAttribute(const string& path)
}
+#ifdef __ibmxl__
+using namespace IceGridNodeNamespace;
+#endif
+
CollocatedRegistry::CollocatedRegistry(const CommunicatorPtr& com,
const ActivatorPtr& activator,
bool nowarn,
diff --git a/cpp/src/IceGrid/PlatformInfo.cpp b/cpp/src/IceGrid/PlatformInfo.cpp
index 9b265a80eda..5b953d0ebb1 100644
--- a/cpp/src/IceGrid/PlatformInfo.cpp
+++ b/cpp/src/IceGrid/PlatformInfo.cpp
@@ -192,7 +192,7 @@ PlatformInfo::PlatformInfo(const string& prefix,
_last15Total = 0;
#elif defined(_AIX)
struct nlist nl;
- nl.n_name = "avenrun";
+ nl.n_name = const_cast<char*>("avenrun");
nl.n_value = 0;
if(knlist(&nl, 1, sizeof(nl)) == 0)
{
@@ -510,7 +510,7 @@ PlatformInfo::getLoadInfo()
{
long long avenrun[3];
struct nlist nl;
- nl.n_name = "avenrun";
+ nl.n_name = const_cast<char*>("avenrun");
nl.n_value = 0;
if(knlist(&nl, 1, sizeof(nl)) == 0)
{
diff --git a/cpp/src/IceSSL/OpenSSLTransceiverI.cpp b/cpp/src/IceSSL/OpenSSLTransceiverI.cpp
index 8acfe25a67e..d33bb6aaf52 100644
--- a/cpp/src/IceSSL/OpenSSLTransceiverI.cpp
+++ b/cpp/src/IceSSL/OpenSSLTransceiverI.cpp
@@ -553,6 +553,21 @@ OpenSSL::TransceiverI::read(IceInternal::Buffer& buf)
int ret = SSL_read(_ssl, reinterpret_cast<void*>(&*buf.i), packetSize);
if(ret <= 0)
{
+#if defined(_AIX)
+ //
+ // WORKAROUND: OpenSSL SSL_read on AIX sometime ends up reporting a error
+ // with SSL_get_error but there's no error in the error queue. This occurs
+ // when SSL_read needs more data. So we just return SocketOperationRead in
+ // this case.
+ //
+ if(SSL_get_error(_ssl, ret) == SSL_ERROR_SSL && ERR_peek_error() == 0)
+ {
+ if(SSL_want_read(_ssl))
+ {
+ return IceInternal::SocketOperationRead;
+ }
+ }
+#endif
switch(SSL_get_error(_ssl, ret))
{
case SSL_ERROR_NONE:
diff --git a/cpp/src/IceUtil/UtilException.cpp b/cpp/src/IceUtil/UtilException.cpp
index f42b86f89a6..266942bb3de 100644
--- a/cpp/src/IceUtil/UtilException.cpp
+++ b/cpp/src/IceUtil/UtilException.cpp
@@ -43,7 +43,7 @@
# endif
# endif
-# if !defined(__sun) && !defined(__FreeBSD__) && !defined(__MINGW32__) && !defined(ICE_STATIC_LIBS)
+# if !defined(_AIX) && !defined(__sun) && !defined(__FreeBSD__) && !defined(__MINGW32__) && !defined(ICE_STATIC_LIBS)
# include <execinfo.h>
# include <cxxabi.h>
# include <stdint.h>