diff options
author | Jose <jose@zeroc.com> | 2016-05-09 23:03:21 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2016-05-09 23:03:21 +0200 |
commit | 3e685a12bfd92a4ffd86c808ba0f34df907de5c8 (patch) | |
tree | 2ef8fb8e028d4f14d1516a98f2a18dbadb46a5d7 /cpp | |
parent | Update to latest gradle builder (diff) | |
parent | AIX port (diff) | |
download | ice-3e685a12bfd92a4ffd86c808ba0f34df907de5c8.tar.bz2 ice-3e685a12bfd92a4ffd86c808ba0f34df907de5c8.tar.xz ice-3e685a12bfd92a4ffd86c808ba0f34df907de5c8.zip |
Merge remote-tracking branch 'origin/3.6'
Diffstat (limited to 'cpp')
34 files changed, 451 insertions, 161 deletions
diff --git a/cpp/BuildInstructionsAIX.md b/cpp/BuildInstructionsAIX.md new file mode 100644 index 00000000000..cda7de3ab76 --- /dev/null +++ b/cpp/BuildInstructionsAIX.md @@ -0,0 +1,207 @@ +# Building Ice for C++ on AIX + +This document provides step-by-step instructions for building Ice for C++ +from sources on AIX. + +## Unsupported Platform + +AIX is currently an unsupported platform. Only minimal testing was performed +on AIX, and there is no guarantee future releases of Ice will build or run +on this platform. + +## Recommended Operating System and C++ Compiler + + - AIX 6.1, AIX 7.1 + - IBM XL C/C++ 12.1 with latest Fix Pack + - 32 bit or 64 bit + +## Build Pre-Requisites + +Before building Ice, you need to install or build a number of third-party +packages that Ice depends on, and install some build tools. + +### Third-Party Packages + +Ice depends on several open-source packages: Berkeley DB 5.3, bzip2 1.0, +expat 2.x, mcpp 2.7.2 (+patches) and OpenSSL. + +OpenSSL is a system package on AIX. RPM packages for bzip2 and expat are +available in the [AIX Toolbox for Linux Applications][1]. You can install +them as follows: + +``` +# As root +rpm -i ftp://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/bzip2/bzip2-1.0.5-3.aix5.3.ppc.rpm +rpm -i ftp://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/expat/expat-2.0.1-2.aix5.3.ppc.rpm +rpm -i ftp://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/expat/expat-devel-2.0.1-2.aix5.3.ppc.rpm + +``` + +Berkeley DB and mcpp must be built from sources, as described below. + +### Build Tools + +You need GNU make (gmake) to build Ice: +``` +# As root +rpm -i ftp://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/make/make-4.1-2.aix6.1.ppc.rpm +``` + +The preferred way to retrieve the Ice and mcpp source distributions is with +git. A RPM for git is available from [bullfreeware.com][2]. + +You also need wget, GNU tar and GNU patch to retrieve and build Berkeley DB: +``` +# As root +rpm -i ftp://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/wget/wget-1.9.1-1.aix5.1.ppc.rpm +rpm -i ftp://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/tar/tar-1.22-1.aix6.1.ppc.rpm +rpm -i ftp://public.dhe.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/patch/patch-2.5.4-4.aix4.3.ppc.rpm +``` + +### Building mcpp from Sources + +If building 64-bit binaries, set `OBJECT_MODE` to 64: +``` +export OBJECT_MODE=64 +``` +Otherwise, leave `OBJECT_MODE` unset. + +Then clone the zeroc-ice/mcpp repository and build with gmake: +``` +git clone https://github.com/zeroc-ice/mcpp.git +cd mcpp +gmake +``` + +This build creates a static library, `lib/libmcpp.a`. `libmcpp.a` is used +only when building Ice from sources, and does not need to be installed. + +### Building Berkeley DB from Sources + +#### Download Sources + +Download the Berkeley DB 5.3.28 source archive from [Oracle][3] or ZeroC. You +may use the distribution with encryption or without encryption. Since Ice does +not use Berkeley DB's encryption features, we recommend downloading the +no-encryption (-NC) source archive: + +``` +wget http://zeroc.com/download/berkeley-db/db-5.3.28.NC.tar.gz +``` + +Then unpack this archive: +``` +gtar xzf db-5.3.28.NC.tar.gz +``` + +#### Patch + +Patch Berkeley DB with GNU patch: +``` +wget http://zeroc.com/download/berkeley-db/berkeley-db.5.3.28.patch +cd db-5.3.28.NC +/opt/freeware/bin/patch -p0 < ../berkeley-db.5.3.28.patch +``` + +#### Configure + +If building 64-bit binaries, set `OBJECT_MODE` to 64: +``` +export OBJECT_MODE=64 +``` +Otherwise, leave `OBJECT_MODE` unset. + +Then configure Berkeley DB with C++ support, and set the installation prefix, +for example: +``` +cd build_unix +../dist/configure --enable-cxx --prefix=/opt/db53 +``` + +#### Build and Install +``` +gmake +... + +# run gmake install as root or change permissions on /opt/db53 before install +gmake install +``` + +## Building Ice for C++ + +### Clone zeroc-ice/ice + +``` +git clone -b 3.6 https://github.com/zeroc-ice/ice.git +cd ice/cpp +``` + +### Configure + +Edit `config/Make.rules` to establish your build configuration. The comments +in the file provide more information. + +Make sure to set `DB_HOME` to your Berkeley DB 5.3 installation directory +(`/opt/db53` if built as described above), and `MCPP_HOME` to your mcpp build +directory (for example `$(HOME)/builds/mcpp`). + +`LP64` is not used on AIX. To build 64 bit binaries, set the environment +variable `OBJECT_MODE` to 64: +``` +export OBJECT_MODE=64 +``` +Otherwise, leave this environment variable unset. + +### Build + +Use the gmake `-j` option to speed up the build: + +``` +gmake -j8 +``` + +This builds the Ice core libraries, services, and tests. + +### Install + +``` +gmake install +``` + +This installs Ice for C++ in the directory specified by `prefix` in +`config/Make.rules`. By default, all Ice binaries embed the library path +`prefix/lib:$DB_HOME/lib:/usr/lib`. + +After installation, make sure that the `prefix/bin` directory is in your `PATH`. + +### Run the Test Suite (Optional) + +Python is required to run the test suite. You can install Python as follows: +``` +# As root +rpm -i ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/python/python-2.7.10-1.aix6.1.ppc.rpm +rpm -i ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/python/python-tools-2.7.10-1.aix6.1.ppc.rpm +rpm -i ftp://ftp.software.ibm.com/aix/freeSoftware/aixtoolbox/RPMS/ppc/python/python-devel-2.7.10-1.aix6.1.ppc.rpm +``` + +Additionally, the Glacier2 tests require the Python module `passlib`, available +from the Python Package Index: +``` +# As root +wget https://bootstrap.pypa.io/get-pip.py +python get-pip.py +export PATH=/opt/freeware/bin:$PATH +pip install passlib +``` + +Then run the test suite with: +``` +python allTests.py +``` + +If everything worked out, you should see lots of `ok` messages. In case of a +failure, the tests abort with `failed`. + +[1]: http://www-03.ibm.com/systems/power/software/aix/linux +[2]: http://www.bullfreeware.com +[3]: http://www.oracle.com/technetwork/database/database-technologies/berkeleydb/downloads/index.html diff --git a/cpp/include/Ice/SlicedData.h b/cpp/include/Ice/SlicedData.h index beffe4b0a5b..597cd0e5f02 100644 --- a/cpp/include/Ice/SlicedData.h +++ b/cpp/include/Ice/SlicedData.h @@ -77,11 +77,14 @@ public: // // Unknown sliced object holds instance of unknown type. // -class ICE_API UnknownSlicedObject -#ifdef ICE_CPP11_MAPPING - : public ValueHelper<UnknownSlicedObject, Value> +class ICE_API UnknownSlicedObject : +#if defined(ICE_CPP11_MAPPING) + public ValueHelper<UnknownSlicedObject, Value> +#elif defined(__IBMCPP__) +// xlC does not handle properly the public/private multiple inheritance from Object + public IceInternal::GCObject #else - : public virtual Object, private IceInternal::GCObject + virtual public Object, private IceInternal::GCObject #endif { public: diff --git a/cpp/include/IceUtil/Config.h b/cpp/include/IceUtil/Config.h index 08e52b9db40..37fa7f033d3 100644 --- a/cpp/include/IceUtil/Config.h +++ b/cpp/include/IceUtil/Config.h @@ -182,6 +182,16 @@ # include <TargetConditionals.h> #endif +#if defined(_AIX) && defined(_LARGE_FILES) + // defines macros such as open that we want to use consistently everywhere +# include <fcntl.h> +#endif + +#ifdef __IBMCPP__ +// TODO: better fix for this warning +# pragma report(disable, "1540-0198") // private inheritance without private keyword +#endif + // // The Ice version. // diff --git a/cpp/src/Glacier2CryptPermissionsVerifier/CryptPermissionsVerifierI.cpp b/cpp/src/Glacier2CryptPermissionsVerifier/CryptPermissionsVerifierI.cpp index af9630db528..9bc1ea38a5c 100644 --- a/cpp/src/Glacier2CryptPermissionsVerifier/CryptPermissionsVerifierI.cpp +++ b/cpp/src/Glacier2CryptPermissionsVerifier/CryptPermissionsVerifierI.cpp @@ -14,8 +14,9 @@ #include <IceUtil/FileUtil.h> #include <IceUtil/StringUtil.h> #include <IceUtil/InputUtil.h> +#include <IceUtil/Mutex.h> -#if defined(__GLIBC__) +#if defined(__GLIBC__) || defined(_AIX) # include <crypt.h> #elif defined(__APPLE__) # include <CoreFoundation/CoreFoundation.h> @@ -44,6 +45,7 @@ public: private: const map<string, string> _passwords; + IceUtil::Mutex _cryptMutex; // for old thread-unsafe crypt() }; class CryptPermissionsVerifierPlugin : public Ice::Plugin @@ -51,12 +53,12 @@ class CryptPermissionsVerifierPlugin : public Ice::Plugin public: CryptPermissionsVerifierPlugin(const CommunicatorPtr&); - + virtual void initialize(); virtual void destroy(); private: - + CommunicatorPtr _communicator; }; @@ -165,7 +167,7 @@ CryptPermissionsVerifierI::checkPermissions(const string& userId, const string& struct crypt_data data; data.initialized = 0; return p->second == crypt_r(password.c_str(), salt.c_str(), &data); -#elif defined(__APPLE__) || defined(_WIN32) +#elif defined(__APPLE__) || defined(_WIN32) // // Pbkdf2 string format: // @@ -174,7 +176,7 @@ CryptPermissionsVerifierI::checkPermissions(const string& userId, const string& // size_t beg = 0; size_t end = 0; - + // // Determine the digest algorithm // @@ -373,7 +375,7 @@ CryptPermissionsVerifierI::checkPermissions(const string& userId, const string& vector<BYTE> passwordBuffer(password.begin(), password.end()); - DWORD status = BCryptDeriveKeyPBKDF2(algorithmHandle, &passwordBuffer[0], + DWORD status = BCryptDeriveKeyPBKDF2(algorithmHandle, &passwordBuffer[0], static_cast<DWORD>(passwordBuffer.size()), &saltBuffer[0], saltLength, rounds, &checksumBuffer1[0], static_cast<DWORD>(checksumLength), 0); @@ -388,7 +390,7 @@ CryptPermissionsVerifierI::checkPermissions(const string& userId, const string& DWORD checksumBuffer2Length = checksumLength; vector<BYTE> checksumBuffer2(checksumLength); - if(!CryptStringToBinary(checksum.c_str(), static_cast<DWORD>(checksum.size()), + if(!CryptStringToBinary(checksum.c_str(), static_cast<DWORD>(checksum.size()), CRYPT_STRING_BASE64, &checksumBuffer2[0], &checksumBuffer2Length, 0, 0)) { @@ -397,7 +399,17 @@ CryptPermissionsVerifierI::checkPermissions(const string& userId, const string& return checksumBuffer1 == checksumBuffer2; # endif #else -# error Password hashing not implemented + // Fallback to plain crypt() - DES-style + + if(p->second.size() != 13) + { + return false; + } + string salt = p->second.substr(0, 2); + + IceUtil::Mutex::Lock lock(_cryptMutex); + return p->second == crypt(password.c_str(), salt.c_str()); + #endif } @@ -412,13 +424,13 @@ CryptPermissionsVerifierPlugin::initialize() { const string prefix = "Glacier2CryptPermissionsVerifier."; const PropertyDict props = _communicator->getProperties()->getPropertiesForPrefix(prefix); - + if(!props.empty()) { ObjectAdapterPtr adapter = _communicator->createObjectAdapter(""); // colloc-only adapter - + // Each prop represents a property to set + the associated password file - + for(PropertyDict::const_iterator p = props.begin(); p != props.end(); ++p) { string name = p->first.substr(prefix.size()); @@ -426,9 +438,9 @@ CryptPermissionsVerifierPlugin::initialize() id.name = IceUtil::generateUUID(); id.category = "Glacier2CryptPermissionsVerifier"; ObjectPrx prx = adapter->add(new CryptPermissionsVerifierI(retrievePasswordMap(p->second)), id); - _communicator->getProperties()->setProperty(name, _communicator->proxyToString(prx)); + _communicator->getProperties()->setProperty(name, _communicator->proxyToString(prx)); } - + adapter->activate(); } } @@ -463,7 +475,7 @@ createCryptPermissionsVerifier(const CommunicatorPtr& communicator, const string out << "Plugin " << name << ": too many arguments"; return 0; } - + return new CryptPermissionsVerifierPlugin(communicator); } diff --git a/cpp/src/Ice/ConnectionFactory.cpp b/cpp/src/Ice/ConnectionFactory.cpp index 78370ed4b50..43dc7f670ce 100644 --- a/cpp/src/Ice/ConnectionFactory.cpp +++ b/cpp/src/Ice/ConnectionFactory.cpp @@ -875,26 +875,10 @@ IceInternal::OutgoingConnectionFactory::ConnectCallback::connectionStartFailed(c const LocalException& ex) { assert(_iter != _connectors.end()); - - if(_observer) - { - _observer->failed(ex.ice_id()); - _observer->detach(); - } - - _factory->handleConnectionException(ex, _hasMore || _iter != _connectors.end() - 1); - if(dynamic_cast<const Ice::CommunicatorDestroyedException*>(&ex)) // No need to continue. - { - _factory->finishGetConnection(_connectors, ex, shared_from_this()); - } - else if(++_iter != _connectors.end()) // Try the next connector. + if(connectionStartFailedImpl(ex)) { nextConnector(); } - else - { - _factory->finishGetConnection(_connectors, ex, shared_from_this()); - } } // @@ -1020,39 +1004,46 @@ IceInternal::OutgoingConnectionFactory::ConnectCallback::getConnection() void IceInternal::OutgoingConnectionFactory::ConnectCallback::nextConnector() { - Ice::ConnectionIPtr connection; - try + while(true) { - const CommunicatorObserverPtr& obsv = _factory->_instance->initializationData().observer; - if(obsv) + try { - _observer = obsv->getConnectionEstablishmentObserver(_iter->endpoint, _iter->connector->toString()); - if(_observer) + const CommunicatorObserverPtr& obsv = _factory->_instance->initializationData().observer; + if(obsv) { - _observer->attach(); + _observer = obsv->getConnectionEstablishmentObserver(_iter->endpoint, _iter->connector->toString()); + if(_observer) + { + _observer->attach(); + } } - } - assert(_iter != _connectors.end()); + assert(_iter != _connectors.end()); - if(_instance->traceLevels()->network >= 2) - { - Trace out(_instance->initializationData().logger, _instance->traceLevels()->networkCat); - out << "trying to establish " << _iter->endpoint->protocol() << " connection to " - << _iter->connector->toString(); + if(_instance->traceLevels()->network >= 2) + { + Trace out(_instance->initializationData().logger, _instance->traceLevels()->networkCat); + out << "trying to establish " << _iter->endpoint->protocol() << " connection to " + << _iter->connector->toString(); + } + Ice::ConnectionIPtr connection = _factory->createConnection(_iter->connector->connect(), *_iter); + connection->start(ICE_SHARED_FROM_THIS); } - connection = _factory->createConnection(_iter->connector->connect(), *_iter); - connection->start(ICE_SHARED_FROM_THIS); - } - catch(const Ice::LocalException& ex) - { - if(_instance->traceLevels()->network >= 2) + catch(const Ice::LocalException& ex) { - Trace out(_instance->initializationData().logger, _instance->traceLevels()->networkCat); - out << "failed to establish " << _iter->endpoint->protocol() << " connection to " - << _iter->connector->toString() << "\n" << ex; + if(_instance->traceLevels()->network >= 2) + { + Trace out(_instance->initializationData().logger, _instance->traceLevels()->networkCat); + out << "failed to establish " << _iter->endpoint->protocol() << " connection to " + << _iter->connector->toString() << "\n" << ex; + } + + if(connectionStartFailedImpl(ex)) + { + continue; // More connectors to try, continue. + } } - connectionStartFailed(connection, ex); + break; } } @@ -1111,6 +1102,31 @@ IceInternal::OutgoingConnectionFactory::ConnectCallback::operator<(const Connect return this < &rhs; } +bool +IceInternal::OutgoingConnectionFactory::ConnectCallback::connectionStartFailedImpl(const Ice::LocalException& ex) +{ + if(_observer) + { + _observer->failed(ex.ice_id()); + _observer->detach(); + } + + _factory->handleConnectionException(ex, _hasMore || _iter != _connectors.end() - 1); + if(dynamic_cast<const Ice::CommunicatorDestroyedException*>(&ex)) // No need to continue. + { + _factory->finishGetConnection(_connectors, ex, ICE_SHARED_FROM_THIS); + } + else if(++_iter != _connectors.end()) // Try the next connector. + { + return true; + } + else + { + _factory->finishGetConnection(_connectors, ex, ICE_SHARED_FROM_THIS); + } + return false; +} + void IceInternal::IncomingConnectionFactory::activate() { diff --git a/cpp/src/Ice/ConnectionFactory.h b/cpp/src/Ice/ConnectionFactory.h index 1838d213d51..578c728559b 100644 --- a/cpp/src/Ice/ConnectionFactory.h +++ b/cpp/src/Ice/ConnectionFactory.h @@ -119,6 +119,8 @@ private: private: + bool connectionStartFailedImpl(const Ice::LocalException&); + const InstancePtr _instance; const OutgoingConnectionFactoryPtr _factory; const std::vector<EndpointIPtr> _endpoints; diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp index a5d3d74f206..089a8ee0871 100644 --- a/cpp/src/Ice/Instance.cpp +++ b/cpp/src/Ice/Instance.cpp @@ -63,7 +63,7 @@ # include <sys/types.h> #endif -#if defined(__linux) || defined(__sun) +#if defined(__linux) || defined(__sun) || defined(_AIX) # include <grp.h> // for initgroups #endif diff --git a/cpp/src/Ice/Network.cpp b/cpp/src/Ice/Network.cpp index 402471be2ef..d1da40b9b51 100644 --- a/cpp/src/Ice/Network.cpp +++ b/cpp/src/Ice/Network.cpp @@ -1286,7 +1286,6 @@ IceInternal::fdToLocalAddress(SOCKET fd, Address& addr) socklen_t len = static_cast<socklen_t>(sizeof(sockaddr_storage)); if(getsockname(fd, &addr.sa, &len) == SOCKET_ERROR) { - closeSocketNoThrow(fd); SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; @@ -1320,7 +1319,6 @@ IceInternal::fdToRemoteAddress(SOCKET fd, Address& addr) } else { - closeSocketNoThrow(fd); SocketException ex(__FILE__, __LINE__); ex.error = getSocketErrno(); throw ex; @@ -2339,12 +2337,20 @@ repeatConnect: // port as the server). // Address localAddr; - fdToLocalAddress(fd, localAddr); - if(compareAddress(addr, localAddr) == 0) + try { - ConnectionRefusedException ex(__FILE__, __LINE__); - ex.error = 0; // No appropriate errno - throw ex; + fdToLocalAddress(fd, localAddr); + if(compareAddress(addr, localAddr) == 0) + { + ConnectionRefusedException ex(__FILE__, __LINE__); + ex.error = 0; // No appropriate errno + throw ex; + } + } + catch(const LocalException&) + { + closeSocketNoThrow(fd); + throw; } #endif return true; diff --git a/cpp/src/Ice/PluginManagerI.cpp b/cpp/src/Ice/PluginManagerI.cpp index e7b75bd4ade..e70012fd391 100644 --- a/cpp/src/Ice/PluginManagerI.cpp +++ b/cpp/src/Ice/PluginManagerI.cpp @@ -479,6 +479,12 @@ Ice::PluginManagerI::loadPlugin(const string& name, const string& pluginSpec, St ex.reason = out.str(); throw ex; } + +#ifdef __IBMCPP__ + // xlC warns when casting a void* to function pointer +# pragma report(disable, "1540-0216") +#endif + factory = reinterpret_cast<PluginFactory>(sym); } diff --git a/cpp/src/Ice/RetryQueue.cpp b/cpp/src/Ice/RetryQueue.cpp index 9c81aa1bead..f74988f65a9 100644 --- a/cpp/src/Ice/RetryQueue.cpp +++ b/cpp/src/Ice/RetryQueue.cpp @@ -116,7 +116,7 @@ IceInternal::RetryQueue::destroy() Lock sync(*this); assert(_instance); - set<RetryTaskPtr>::const_iterator p = _requests.begin(); + set<RetryTaskPtr>::iterator p = _requests.begin(); while(p != _requests.end()) { if(_instance->timer()->cancel(*p)) diff --git a/cpp/src/Ice/StreamSocket.cpp b/cpp/src/Ice/StreamSocket.cpp index e11d5709aa4..fa3761f5fa0 100644 --- a/cpp/src/Ice/StreamSocket.cpp +++ b/cpp/src/Ice/StreamSocket.cpp @@ -32,10 +32,18 @@ StreamSocket::StreamSocket(const ProtocolInstancePtr& instance, #ifndef ICE_USE_IOCP if(doConnect(_fd, _proxy ? _proxy->getAddress() : _addr, sourceAddr)) { - _state = StateConnected; + _state = _proxy ? StateProxyWrite : StateConnected; } #endif - _desc = fdToString(_fd, _proxy, _addr); + try + { + _desc = fdToString(_fd, _proxy, _addr); + } + catch(const Ice::Exception&) + { + closeSocketNoThrow(_fd); + throw; + } } StreamSocket::StreamSocket(const ProtocolInstancePtr& instance, SOCKET fd) : @@ -48,7 +56,15 @@ StreamSocket::StreamSocket(const ProtocolInstancePtr& instance, SOCKET fd) : #endif { init(); - _desc = fdToString(fd); + try + { + _desc = fdToString(fd); + } + catch(const Ice::Exception&) + { + closeSocketNoThrow(fd); + throw; + } } StreamSocket::~StreamSocket() diff --git a/cpp/src/Ice/WSConnector.h b/cpp/src/Ice/WSConnector.h index 17c002a8db0..3c26a06ab45 100644 --- a/cpp/src/Ice/WSConnector.h +++ b/cpp/src/Ice/WSConnector.h @@ -33,12 +33,12 @@ public: virtual bool operator!=(const Connector&) const; virtual bool operator<(const Connector&) const; -private: WSConnector(const ProtocolInstancePtr&, const ConnectorPtr&, const std::string&, int, const std::string&); virtual ~WSConnector(); - friend class WSEndpoint; +private: + const ProtocolInstancePtr _instance; const ConnectorPtr _delegate; const std::string _host; diff --git a/cpp/src/IceBox/ServiceManagerI.cpp b/cpp/src/IceBox/ServiceManagerI.cpp index 31f176bd46f..e7b4a7fac99 100644 --- a/cpp/src/IceBox/ServiceManagerI.cpp +++ b/cpp/src/IceBox/ServiceManagerI.cpp @@ -670,6 +670,11 @@ IceBox::ServiceManagerI::start(const string& service, const string& entryPoint, // // Invoke the factory function. // +#ifdef __IBMCPP__ + // xlC warns when casting a void* to function pointer +# pragma report(disable, "1540-0216") +#endif + SERVICE_FACTORY factory = reinterpret_cast<SERVICE_FACTORY>(sym); try { diff --git a/cpp/src/IceGrid/Activator.cpp b/cpp/src/IceGrid/Activator.cpp index 3127ed47f83..b9aafc93d7b 100644 --- a/cpp/src/IceGrid/Activator.cpp +++ b/cpp/src/IceGrid/Activator.cpp @@ -37,7 +37,7 @@ #endif #endif -#if defined(__linux) || defined(__sun) +#if defined(__linux) || defined(__sun) || defined(_AIX) # include <grp.h> // for initgroups #endif diff --git a/cpp/src/IceGridLib/PluginFacadeI.cpp b/cpp/src/IceGridLib/PluginFacadeI.cpp index 6bcd4f92358..0b1748a852b 100644 --- a/cpp/src/IceGridLib/PluginFacadeI.cpp +++ b/cpp/src/IceGridLib/PluginFacadeI.cpp @@ -18,7 +18,7 @@ using namespace IceGrid; namespace { -RegistryPluginFacadePtr pluginFacade; +RegistryPluginFacade* pluginFacade = 0; }; @@ -38,5 +38,13 @@ IceGrid::getRegistryPluginFacade() void IceGrid::setRegistryPluginFacade(const RegistryPluginFacadePtr& facade) { - pluginFacade = facade; + if(pluginFacade) + { + pluginFacade->__decRef(); + } + pluginFacade = facade.get(); + if(pluginFacade) + { + pluginFacade->__incRef(); + } } diff --git a/cpp/src/Slice/Python.cpp b/cpp/src/Slice/Python.cpp index 09a17a93b4a..4343456efb2 100644 --- a/cpp/src/Slice/Python.cpp +++ b/cpp/src/Slice/Python.cpp @@ -665,6 +665,10 @@ Slice::Python::compile(int argc, char* argv[]) } FileTracker::instance()->addFile(file); + // + // Python magic comment to set the file encoding, it must be first or second line + // + out << "# -*- coding: utf-8 -*-\n"; printHeader(out); printGeneratedHeader(out, base + ".ice", "#"); // diff --git a/cpp/src/Slice/PythonUtil.cpp b/cpp/src/Slice/PythonUtil.cpp index 699bd08ef97..eb637229825 100644 --- a/cpp/src/Slice/PythonUtil.cpp +++ b/cpp/src/Slice/PythonUtil.cpp @@ -518,17 +518,7 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) // ClassList allBases = p->allBases(); StringList ids; -#if defined(__IBMCPP__) && defined(NDEBUG) -// -// VisualAge C++ 6.0 does not see that ClassDef is a Contained, -// when inlining is on. The code below issues a warning: better -// than an error! -// - transform(allBases.begin(), allBases.end(), back_inserter(ids), - IceUtil::constMemFun<string,ClassDef>(&Contained::scoped)); -#else transform(allBases.begin(), allBases.end(), back_inserter(ids), IceUtil::constMemFun(&Contained::scoped)); -#endif StringList other; other.push_back(scoped); other.push_back("::Ice::Object"); diff --git a/cpp/src/Slice/RubyUtil.cpp b/cpp/src/Slice/RubyUtil.cpp index 97f82811dcf..d262e416f05 100644 --- a/cpp/src/Slice/RubyUtil.cpp +++ b/cpp/src/Slice/RubyUtil.cpp @@ -245,17 +245,7 @@ Slice::Ruby::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) // ClassList allBases = p->allBases(); StringList ids; -#if defined(__IBMCPP__) && defined(NDEBUG) -// -// VisualAge C++ 6.0 does not see that ClassDef is a Contained, -// when inlining is on. The code below issues a warning: better -// than an error! -// - transform(allBases.begin(), allBases.end(), back_inserter(ids), - IceUtil::constMemFun<string,ClassDef>(&Contained::scoped)); -#else transform(allBases.begin(), allBases.end(), back_inserter(ids), IceUtil::constMemFun(&Contained::scoped)); -#endif StringList other; other.push_back(scoped); other.push_back("::Ice::Object"); diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 0203ff1f965..ff29afac5d8 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -2726,16 +2726,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) ClassList allBases = p->allBases(); StringList ids; -#if defined(__IBMCPP__) && defined(NDEBUG) -// -// VisualAge C++ 6.0 does not see that ClassDef is a Contained, -// when inlining is on. The code below issues a warning: better -// than an error! -// - transform(allBases.begin(), allBases.end(), back_inserter(ids), ::IceUtil::constMemFun<string,ClassDef>(&Contained::scoped)); -#else transform(allBases.begin(), allBases.end(), back_inserter(ids), ::IceUtil::constMemFun(&Contained::scoped)); -#endif StringList other; other.push_back(p->scoped()); other.push_back("::Ice::Object"); @@ -2849,16 +2840,9 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) if(!allOps.empty()) { StringList allOpNames; -#if defined(__IBMCPP__) && defined(NDEBUG) -// -// See comment for transform above -// - transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), - ::IceUtil::constMemFun<string,Operation>(&Contained::name)); -#else transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), ::IceUtil::constMemFun(&Contained::name)); -#endif + allOpNames.push_back("ice_id"); allOpNames.push_back("ice_ids"); allOpNames.push_back("ice_isA"); diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp index 98f7ccd3be6..29f89889873 100644 --- a/cpp/src/slice2cs/Gen.cpp +++ b/cpp/src/slice2cs/Gen.cpp @@ -415,18 +415,7 @@ Slice::CsVisitor::writeDispatchAndMarshalling(const ClassDefPtr& p) StringList ids; ClassList bases = p->bases(); bool hasBaseClass = !bases.empty() && !bases.front()->isInterface(); - -#if defined(__IBMCPP__) && defined(NDEBUG) - // - // VisualAge C++ 6.0 does not see that ClassDef is a Contained, - // when inlining is on. The code below issues a warning: better - // than an error! - // - transform(allBases.begin(), allBases.end(), back_inserter(ids), constMemFun<string,ClassDef>(&Contained::scoped)); -#else transform(allBases.begin(), allBases.end(), back_inserter(ids), constMemFun(&Contained::scoped)); -#endif - StringList other; other.push_back(p->scoped()); other.push_back("::Ice::Object"); @@ -831,14 +820,7 @@ Slice::CsVisitor::writeDispatchAndMarshalling(const ClassDefPtr& p) if(!allOps.empty() || (!p->isInterface() && !hasBaseClass)) { StringList allOpNames; -#if defined(__IBMCPP__) && defined(NDEBUG) - // - // See comment for transform above - // - transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), constMemFun<string,Operation>(&Contained::name)); -#else transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), constMemFun(&Contained::name)); -#endif allOpNames.push_back("ice_id"); allOpNames.push_back("ice_ids"); allOpNames.push_back("ice_isA"); @@ -5428,16 +5410,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) string scoped = p->scoped(); ClassList allBases = p->allBases(); StringList ids; -#if defined(__IBMCPP__) && defined(NDEBUG) - // - // VisualAge C++ 6.0 does not see that ClassDef is a Contained, - // when inlining is on. The code below issues a warning: better - // than an error! - // - transform(allBases.begin(), allBases.end(), back_inserter(ids), ::IceUtil::constMemFun<string,ClassDef>(&Contained::scoped)); -#else transform(allBases.begin(), allBases.end(), back_inserter(ids), ::IceUtil::constMemFun(&Contained::scoped)); -#endif StringList other; other.push_back(p->scoped()); other.push_back("::Ice::Object"); diff --git a/cpp/src/slice2js/Gen.cpp b/cpp/src/slice2js/Gen.cpp index 573d0180c67..9e55b8b65f2 100644 --- a/cpp/src/slice2js/Gen.cpp +++ b/cpp/src/slice2js/Gen.cpp @@ -1294,17 +1294,7 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p) _out << ", undefined"; } -#if defined(__IBMCPP__) && defined(NDEBUG) - // - // VisualAge C++ 6.0 does not see that ClassDef is a Contained, - // when inlining is on. The code below issues a warning: better - // than an error! - // - transform(allBases.begin(), allBases.end(), back_inserter(ids), - ::IceUtil::constMemFun<string,ClassDef>(&Contained::scoped)); -#else transform(allBases.begin(), allBases.end(), back_inserter(ids), ::IceUtil::constMemFun(&Contained::scoped)); -#endif StringList other; other.push_back(scoped); other.push_back("::Ice::Object"); diff --git a/cpp/test/Ice/optional/AllTests.cpp b/cpp/test/Ice/optional/AllTests.cpp index 1cdde0cbce3..0caeaf6704c 100644 --- a/cpp/test/Ice/optional/AllTests.cpp +++ b/cpp/test/Ice/optional/AllTests.cpp @@ -663,6 +663,16 @@ allTests(const Ice::CommunicatorPtr& communicator, bool) test(20 == r->gg2Opt.get()->a); test("gg1" == r->gg1->a); + initial->opVoid(); + + out = Ice::createOutputStream(communicator); + out->startEncapsulation(); + out->write(1, IceUtil::Optional<int>(15)); + out->write(2, IceUtil::Optional<string>("test")); + out->endEncapsulation(); + out->finished(inEncaps); + test(initial->ice_invoke("opVoid", Ice::Normal, inEncaps, outEncaps)); + cout << "ok" << endl; cout << "testing marshalling of large containers with fixed size elements..." << flush; diff --git a/cpp/test/Ice/optional/Test.ice b/cpp/test/Ice/optional/Test.ice index 77a0c41665e..87061a2f317 100644 --- a/cpp/test/Ice/optional/Test.ice +++ b/cpp/test/Ice/optional/Test.ice @@ -232,7 +232,7 @@ class Initial optional(1) string opString(optional(2) string p1, out optional(3) string p3); ["cpp:view-type:Util::string_view"] optional(1) string - opCustomString(["cpp:view-type:Util::string_view"] optional(2) string p1, + opCustomString(["cpp:view-type:Util::string_view"] optional(2) string p1, out ["cpp:view-type:Util::string_view"] optional(3) string p3); optional(1) MyEnum opMyEnum(optional(2) MyEnum p1, out optional(3) MyEnum p3); @@ -303,9 +303,11 @@ class Initial void sendOptionalClass(bool req, optional(1) OneOptional o); void returnOptionalClass(bool req, out optional(1) OneOptional o); - + G opG(G g); + void opVoid(); + bool supportsRequiredParams(); bool supportsJavaSerializable(); diff --git a/cpp/test/Ice/optional/TestAMD.ice b/cpp/test/Ice/optional/TestAMD.ice index ed96f12362c..bac3d41df7f 100644 --- a/cpp/test/Ice/optional/TestAMD.ice +++ b/cpp/test/Ice/optional/TestAMD.ice @@ -233,7 +233,7 @@ class Initial optional(1) string opString(optional(2) string p1, out optional(3) string p3); ["cpp:view-type:Util::string_view"] optional(1) string - opCustomString(["cpp:view-type:Util::string_view"] optional(2) string p1, + opCustomString(["cpp:view-type:Util::string_view"] optional(2) string p1, out ["cpp:view-type:Util::string_view"] optional(3) string p3); optional(1) MyEnum opMyEnum(optional(2) MyEnum p1, out optional(3) MyEnum p3); @@ -304,9 +304,11 @@ class Initial void sendOptionalClass(bool req, optional(1) OneOptional o); void returnOptionalClass(bool req, out optional(1) OneOptional o); - + G opG(G g); + void opVoid(); + bool supportsRequiredParams(); bool supportsJavaSerializable(); diff --git a/cpp/test/Ice/optional/TestAMDI.cpp b/cpp/test/Ice/optional/TestAMDI.cpp index 86959335d4e..fea753dfbdd 100644 --- a/cpp/test/Ice/optional/TestAMDI.cpp +++ b/cpp/test/Ice/optional/TestAMDI.cpp @@ -385,6 +385,13 @@ InitialI::opG_async(const ::Test::AMD_Initial_opGPtr& cb, } void +InitialI::opVoid_async(const ::Test::AMD_Initial_opVoidPtr& cb, + const Ice::Current&) +{ + cb->ice_response(); +} + +void InitialI::supportsRequiredParams_async(const ::Test::AMD_Initial_supportsRequiredParamsPtr& cb, const Ice::Current&) { diff --git a/cpp/test/Ice/optional/TestAMDI.h b/cpp/test/Ice/optional/TestAMDI.h index 4b34ba72b7e..83c12fe1f08 100644 --- a/cpp/test/Ice/optional/TestAMDI.h +++ b/cpp/test/Ice/optional/TestAMDI.h @@ -190,11 +190,14 @@ public: virtual void returnOptionalClass_async(const ::Test::AMD_Initial_returnOptionalClassPtr&, bool, const Ice::Current&); - + virtual void opG_async(const ::Test::AMD_Initial_opGPtr&, const ::Test::GPtr&, const Ice::Current&); + virtual void opVoid_async(const ::Test::AMD_Initial_opVoidPtr&, + const Ice::Current&); + virtual void supportsRequiredParams_async(const ::Test::AMD_Initial_supportsRequiredParamsPtr&, const Ice::Current&); diff --git a/cpp/test/Ice/optional/TestI.cpp b/cpp/test/Ice/optional/TestI.cpp index c3018841afd..bbf68c7bfc2 100644 --- a/cpp/test/Ice/optional/TestI.cpp +++ b/cpp/test/Ice/optional/TestI.cpp @@ -389,6 +389,11 @@ InitialI::opG(const GPtr& g, const Ice::Current&) return g; } +void +InitialI::opVoid(const Ice::Current&) +{ +} + bool InitialI::supportsRequiredParams(const Ice::Current&) { diff --git a/cpp/test/Ice/optional/TestI.h b/cpp/test/Ice/optional/TestI.h index 07a0b01d3cd..f9e77621e25 100644 --- a/cpp/test/Ice/optional/TestI.h +++ b/cpp/test/Ice/optional/TestI.h @@ -184,9 +184,11 @@ public: virtual void sendOptionalClass(bool, const IceUtil::Optional<Test::OneOptionalPtr>&, const Ice::Current&); virtual void returnOptionalClass(bool, IceUtil::Optional<Test::OneOptionalPtr>&, const Ice::Current&); - + virtual ::Test::GPtr opG(const ::Test::GPtr& g, const Ice::Current&); + virtual void opVoid(const Ice::Current&); + virtual bool supportsRequiredParams(const Ice::Current&); virtual bool supportsJavaSerializable(const Ice::Current&); diff --git a/cpp/test/Ice/properties/run.py b/cpp/test/Ice/properties/run.py index a7513acf4f5..c77d767545b 100755 --- a/cpp/test/Ice/properties/run.py +++ b/cpp/test/Ice/properties/run.py @@ -9,7 +9,7 @@ # # ********************************************************************** -import os, sys +import os, sys, locale path = [ ".", "..", "../..", "../../..", "../../../..", "../../../../.." ] head = os.path.dirname(sys.argv[0]) @@ -23,6 +23,13 @@ import TestUtil client = os.path.join(os.getcwd(), TestUtil.getTestExecutable("client")) +if TestUtil.isAIX(): + encoding = locale.getdefaultlocale()[1] + if encoding != "UTF-8": + print("Please set LC_ALL to xx_xx.UTF-8, for example FR_FR.UTF-8") + print("Skipping test") + sys.exit(0) + # # Write config # diff --git a/cpp/test/Ice/stringConverter/Client.cpp b/cpp/test/Ice/stringConverter/Client.cpp index 401570a2a89..a4626b615e4 100644 --- a/cpp/test/Ice/stringConverter/Client.cpp +++ b/cpp/test/Ice/stringConverter/Client.cpp @@ -61,6 +61,28 @@ main(int argc, char* argv[]) IceUtil::setProcessStringConverter(new IceUtil::IconvStringConverter<char>("iso815")); } IceUtil::setProcessWstringConverter(new IceUtil::IconvStringConverter<wchar_t>("ucs4")); + +#elif defined(_AIX) + + // Always big-endian + + if(useLocale) + { + IceUtil::setProcessStringConverter(new IceUtil::IconvStringConverter<char>()); + } + else + { + IceUtil::setProcessStringConverter(new IceUtil::IconvStringConverter<char>("ISO8859-15")); + } + + if(sizeof(wchar_t) == 4) + { + IceUtil::setProcessWstringConverter(new IceUtil::IconvStringConverter<wchar_t>("UTF-32")); + } + else + { + IceUtil::setProcessWstringConverter(new IceUtil::IconvStringConverter<wchar_t>("UTF-16")); + } #else if(useLocale) diff --git a/cpp/test/IceGrid/replicaGroup/RegistryPlugin.cpp b/cpp/test/IceGrid/replicaGroup/RegistryPlugin.cpp index 9fcc117d627..6172e9e689e 100644 --- a/cpp/test/IceGrid/replicaGroup/RegistryPlugin.cpp +++ b/cpp/test/IceGrid/replicaGroup/RegistryPlugin.cpp @@ -52,8 +52,11 @@ public: { test(_facade->getApplicationInfo(_facade->getAdapterApplication(*p)).descriptor.name == "Test"); test(_facade->getServerInfo(_facade->getAdapterServer(*p)).application == "Test"); - test(_facade->getNodeInfo(_facade->getAdapterNode(*p)).name == "localnode"); + test(_facade->getNodeInfo(_facade->getAdapterNode(*p)).name == "localnode"); +#ifndef _AIX + // On AIX, icegridnode needs read permissions on /dev/kmem test(_facade->getNodeLoad(_facade->getAdapterNode(*p)).avg1 >= 0.0); +#endif test(_facade->getAdapterInfo(*p)[0].replicaGroupId == id); test(_facade->getPropertyForAdapter(*p, "Identity") == id); } diff --git a/cpp/test/IceSSL/configuration/AllTests.cpp b/cpp/test/IceSSL/configuration/AllTests.cpp index 3fc92e581f1..3313424859a 100644 --- a/cpp/test/IceSSL/configuration/AllTests.cpp +++ b/cpp/test/IceSSL/configuration/AllTests.cpp @@ -2046,9 +2046,9 @@ allTests(const CommunicatorPtr& communicator, const string& testDir, bool p12, b #endif // - // No DSA support in Secure Transport. + // No DSA support in Secure Transport / AIX 7.1 // -#ifndef ICE_USE_SECURE_TRANSPORT +#if !defined(ICE_USE_SECURE_TRANSPORT) && !defined(_AIX) { // @@ -3214,6 +3214,9 @@ allTests(const CommunicatorPtr& communicator, const string& testDir, bool p12, b #endif } +#ifndef _AIX + // On AIX 6.1, the default root certificates don't validate demo.zeroc.com + cout << "testing system CAs... " << flush; { InitializationData initData; @@ -3257,6 +3260,7 @@ allTests(const CommunicatorPtr& communicator, const string& testDir, bool p12, b comm->destroy(); } cout << "ok" << endl; +#endif if(shutdown) { diff --git a/cpp/test/IceSSL/configuration/run.py b/cpp/test/IceSSL/configuration/run.py index 07e001c4fdc..fea76d43f3f 100755 --- a/cpp/test/IceSSL/configuration/run.py +++ b/cpp/test/IceSSL/configuration/run.py @@ -43,7 +43,7 @@ if TestUtil.isDarwin(): os.system("security create-keychain -p password %s" % keychainPath) for cert in ["s_rsa_ca1.p12", "c_rsa_ca1.p12"]: os.system("security import %s -f pkcs12 -A -P password -k %s" % (os.path.join(certsPath, cert), keychainPath)) -elif TestUtil.isLinux(): +elif TestUtil.isLinux() or TestUtil.isAIX(): # # Create copies of the CA certificates named after the subject # hash. This is used by the tests to find the CA certificates in diff --git a/cpp/test/Slice/headers/run.py b/cpp/test/Slice/headers/run.py index cd2633927ad..53f4982b0e4 100755 --- a/cpp/test/Slice/headers/run.py +++ b/cpp/test/Slice/headers/run.py @@ -37,6 +37,7 @@ os.symlink("a3.ice", os.path.join("slices", "dir1", "linktoa3.ice")) os.symlink("dir2", os.path.join("slices", "linktodir2")) slice2cpp = TestUtil.getSliceTranslator() +TestUtil.addLdPath(TestUtil.getCppLibDir()) basedir = os.path.dirname(os.path.abspath(__file__)) slicedir = TestUtil.getSliceDir() |