FreeBSD modifications

This commit is contained in:
Aleksandar Fabijanic 2012-09-26 02:51:43 +00:00
parent e7ee78baa5
commit 991fb4a31f
9 changed files with 51 additions and 26 deletions

View File

@ -9,10 +9,14 @@
include $(POCO_BASE)/build/rules/global
# Note: linking order is important, do not change it.
ifeq ($(POCO_CONFIG),FreeBSD)
SYSLIBS += -lssl -lcrypto -lz
else
SYSLIBS += -lssl -lcrypto -lz -ldl
endif
objects = CryptoTestSuite Driver \
CryptoTest RSATest
CryptoTest DigestEngineTest RSATest
target = testrunner
target_version = 1

View File

@ -56,6 +56,9 @@ ThreadPoolTest::~ThreadPoolTest()
void ThreadPoolTest::testThreadPool()
{
#if (POCO_OS == POCO_OS_FREE_BSD)
fail ("TODO! - segfaults on FreeBSD");
#else
ThreadPool pool(2, 3, 3);
pool.setStackSize(1);
@ -147,6 +150,7 @@ void ThreadPoolTest::testThreadPool()
assert (pool.used() == 0);
assert (pool.capacity() == 4);
assert (pool.available() == 4);
#endif // POCO_OS_FREE_BSD
}

View File

@ -289,11 +289,15 @@ void ThreadTest::testThreadStackSize()
assert (stackSize >= thread.getStackSize());
#endif
tmp = MyRunnable::_staticVar;
#if POCO_OS == POCO_OS_FREE_BSD
fail ("FreeBSD segfaults - TODO!");
#else
thread.start(freeFunc, &tmp);
thread.join();
assert (tmp * 2 == MyRunnable::_staticVar);
#endif
thread.setStackSize(0);
assert (0 == thread.getStackSize());
tmp = MyRunnable::_staticVar;
thread.start(freeFunc, &tmp);

View File

@ -250,8 +250,10 @@ void DNS::aierror(int code, const std::string& arg)
case EAI_FAIL:
throw DNSException("Non recoverable DNS error while resolving", arg);
#if !defined(_WIN32) // EAI_NODATA and EAI_NONAME have the same value
#if defined(EAI_NODATA) // deprecated in favor of EAI_NONAME on FreeBSD
case EAI_NODATA:
throw NoAddressFoundException(arg);
#endif
#endif
case EAI_NONAME:
throw HostNotFoundException(arg);

View File

@ -96,6 +96,9 @@ void DatagramSocketTest::testSendToReceiveFrom()
void DatagramSocketTest::testBroadcast()
{
#if (POCO_OS == POCO_OS_FREE_BSD)
fail ("TODO! hangs on FreeBSD");
#else
UDPEchoServer echoServer;
DatagramSocket ss(IPAddress::IPv4);
SocketAddress sa("255.255.255.255", echoServer.port());
@ -116,6 +119,7 @@ void DatagramSocketTest::testBroadcast()
assert (n == 5);
assert (std::string(buffer, n) == "hello");
ss.close();
#endif
}

View File

@ -9,7 +9,11 @@
include $(POCO_BASE)/build/rules/global
# Note: linking order is important, do not change it.
ifeq ($(POCO_CONFIG),FreeBSD)
SYSLIBS += -lssl -lcrypto -lz
else
SYSLIBS += -lssl -lcrypto -lz -ldl
endif
objects = NetSSLTestSuite Driver \
HTTPSClientSessionTest HTTPSClientTestSuite HTTPSServerTest HTTPSServerTestSuite \

View File

@ -389,7 +389,7 @@ private:
mutable int _depth;
bool _eventsEnabled;
mutable Poco::FastMutex _mutex;
mutable Poco::Mutex _mutex;
friend class LayeredConfiguration;
friend class ConfigurationView;

View File

@ -42,7 +42,7 @@
#include "Poco/String.h"
using Poco::FastMutex;
using Poco::Mutex;
using Poco::NotFoundException;
using Poco::SyntaxException;
using Poco::CircularReferenceException;
@ -69,7 +69,7 @@ AbstractConfiguration::~AbstractConfiguration()
bool AbstractConfiguration::hasProperty(const std::string& key) const
{
FastMutex::ScopedLock lock(_mutex);
Mutex::ScopedLock lock(_mutex);
std::string value;
return getRaw(key, value);
@ -90,7 +90,7 @@ bool AbstractConfiguration::has(const std::string& key) const
std::string AbstractConfiguration::getString(const std::string& key) const
{
FastMutex::ScopedLock lock(_mutex);
Mutex::ScopedLock lock(_mutex);
std::string value;
if (getRaw(key, value))
@ -102,7 +102,7 @@ std::string AbstractConfiguration::getString(const std::string& key) const
std::string AbstractConfiguration::getString(const std::string& key, const std::string& defaultValue) const
{
FastMutex::ScopedLock lock(_mutex);
Mutex::ScopedLock lock(_mutex);
std::string value;
if (getRaw(key, value))
@ -114,7 +114,7 @@ std::string AbstractConfiguration::getString(const std::string& key, const std::
std::string AbstractConfiguration::getRawString(const std::string& key) const
{
FastMutex::ScopedLock lock(_mutex);
Mutex::ScopedLock lock(_mutex);
std::string value;
if (getRaw(key, value))
@ -126,7 +126,8 @@ std::string AbstractConfiguration::getRawString(const std::string& key) const
std::string AbstractConfiguration::getRawString(const std::string& key, const std::string& defaultValue) const
{
FastMutex::ScopedLock lock(_mutex);
Mutex::ScopedLock lock(_mutex);
std::string value;
if (getRaw(key, value))
@ -138,7 +139,7 @@ std::string AbstractConfiguration::getRawString(const std::string& key, const st
int AbstractConfiguration::getInt(const std::string& key) const
{
FastMutex::ScopedLock lock(_mutex);
Mutex::ScopedLock lock(_mutex);
std::string value;
if (getRaw(key, value))
@ -150,7 +151,7 @@ int AbstractConfiguration::getInt(const std::string& key) const
int AbstractConfiguration::getInt(const std::string& key, int defaultValue) const
{
FastMutex::ScopedLock lock(_mutex);
Mutex::ScopedLock lock(_mutex);
std::string value;
if (getRaw(key, value))
@ -164,7 +165,7 @@ int AbstractConfiguration::getInt(const std::string& key, int defaultValue) cons
Int64 AbstractConfiguration::getInt64(const std::string& key) const
{
FastMutex::ScopedLock lock(_mutex);
Mutex::ScopedLock lock(_mutex);
std::string value;
if (getRaw(key, value))
@ -176,7 +177,7 @@ Int64 AbstractConfiguration::getInt64(const std::string& key) const
UInt64 AbstractConfiguration::getUInt64(const std::string& key) const
{
FastMutex::ScopedLock lock(_mutex);
Mutex::ScopedLock lock(_mutex);
std::string value;
if (getRaw(key, value))
@ -188,7 +189,7 @@ UInt64 AbstractConfiguration::getUInt64(const std::string& key) const
Int64 AbstractConfiguration::getInt64(const std::string& key, Int64 defaultValue) const
{
FastMutex::ScopedLock lock(_mutex);
Mutex::ScopedLock lock(_mutex);
std::string value;
if (getRaw(key, value))
@ -200,7 +201,7 @@ Int64 AbstractConfiguration::getInt64(const std::string& key, Int64 defaultValue
UInt64 AbstractConfiguration::getUInt64(const std::string& key, UInt64 defaultValue) const
{
FastMutex::ScopedLock lock(_mutex);
Mutex::ScopedLock lock(_mutex);
std::string value;
if (getRaw(key, value))
@ -214,7 +215,7 @@ UInt64 AbstractConfiguration::getUInt64(const std::string& key, UInt64 defaultVa
double AbstractConfiguration::getDouble(const std::string& key) const
{
FastMutex::ScopedLock lock(_mutex);
Mutex::ScopedLock lock(_mutex);
std::string value;
if (getRaw(key, value))
@ -226,7 +227,7 @@ double AbstractConfiguration::getDouble(const std::string& key) const
double AbstractConfiguration::getDouble(const std::string& key, double defaultValue) const
{
FastMutex::ScopedLock lock(_mutex);
Mutex::ScopedLock lock(_mutex);
std::string value;
if (getRaw(key, value))
@ -238,7 +239,7 @@ double AbstractConfiguration::getDouble(const std::string& key, double defaultVa
bool AbstractConfiguration::getBool(const std::string& key) const
{
FastMutex::ScopedLock lock(_mutex);
Mutex::ScopedLock lock(_mutex);
std::string value;
if (getRaw(key, value))
@ -250,7 +251,7 @@ bool AbstractConfiguration::getBool(const std::string& key) const
bool AbstractConfiguration::getBool(const std::string& key, bool defaultValue) const
{
FastMutex::ScopedLock lock(_mutex);
Mutex::ScopedLock lock(_mutex);
std::string value;
if (getRaw(key, value))
@ -282,7 +283,7 @@ void AbstractConfiguration::setUInt(const std::string& key, unsigned int value)
void AbstractConfiguration::setInt64(const std::string& key, Int64 value)
{
FastMutex::ScopedLock lock(_mutex);
Mutex::ScopedLock lock(_mutex);
setRawWithEvent(key, NumberFormatter::format(value));
}
@ -290,7 +291,7 @@ void AbstractConfiguration::setInt64(const std::string& key, Int64 value)
void AbstractConfiguration::setUInt64(const std::string& key, UInt64 value)
{
FastMutex::ScopedLock lock(_mutex);
Mutex::ScopedLock lock(_mutex);
setRawWithEvent(key, NumberFormatter::format(value));
}
@ -311,7 +312,7 @@ void AbstractConfiguration::setBool(const std::string& key, bool value)
void AbstractConfiguration::keys(Keys& range) const
{
FastMutex::ScopedLock lock(_mutex);
Mutex::ScopedLock lock(_mutex);
std::string key;
range.clear();
@ -321,7 +322,7 @@ void AbstractConfiguration::keys(Keys& range) const
void AbstractConfiguration::keys(const std::string& key, Keys& range) const
{
FastMutex::ScopedLock lock(_mutex);
Mutex::ScopedLock lock(_mutex);
range.clear();
enumerate(key, range);
@ -363,7 +364,7 @@ namespace
std::string AbstractConfiguration::expand(const std::string& value) const
{
FastMutex::ScopedLock lock(_mutex);
Mutex::ScopedLock lock(_mutex);
return internalExpand(value);
}
@ -376,7 +377,8 @@ void AbstractConfiguration::remove(const std::string& key)
propertyRemoving(this, key);
}
{
FastMutex::ScopedLock lock(_mutex);
Mutex::ScopedLock lock(_mutex);
removeRaw(key);
}
if (_eventsEnabled)
@ -514,7 +516,7 @@ void AbstractConfiguration::setRawWithEvent(const std::string& key, std::string
propertyChanging(this, kv);
}
{
FastMutex::ScopedLock lock(_mutex);
Mutex::ScopedLock lock(_mutex);
setRaw(key, value);
}
if (_eventsEnabled)

View File

@ -265,6 +265,7 @@ void AbstractConfigurationTest::testSetInt64()
pConf->setInt64("set.bigint1", std::numeric_limits<Int64>::max());
pConf->setInt64("set.bigint2", std::numeric_limits<Int64>::min());
pConf->setInt64("set.biguint", std::numeric_limits<UInt64>::max());
assert (pConf->getInt64("set.bigint1") == std::numeric_limits<Int64>::max());
assert (pConf->getInt64("set.bigint2") == std::numeric_limits<Int64>::min());
assert (pConf->getInt64("set.biguint") == std::numeric_limits<UInt64>::max());