Incorporated Debian patches (#4380)

* Debian: Use null as device file as console might not be there

* Debian: Add GNU Hurd support

* Debian: Includes not available on Hurd

* Debian: Disable SHA2 test on platforms where it's broken

* Debian: Set POCO_NO_FPENVIRONMENT for armel

---------

Co-authored-by: Jochen Sprickerhof <git@jochen.sprickerhof.de>
This commit is contained in:
Matej Kenda 2024-01-04 20:34:13 +01:00 committed by Aleksandar Fabijanic
parent 48d7a3ede1
commit 02683ea7f1
6 changed files with 72 additions and 7 deletions

View File

@ -240,6 +240,11 @@
#endif #endif
#ifdef __SOFTFP__
#define POCO_NO_FPENVIRONMENT
#endif
#if defined(__clang__) #if defined(__clang__)
#define POCO_COMPILER_CLANG #define POCO_COMPILER_CLANG
#define POCO_HAVE_CXXABI_H #define POCO_HAVE_CXXABI_H

View File

@ -15,7 +15,7 @@
#include "Poco/Clock.h" #include "Poco/Clock.h"
#include "Poco/Exception.h" #include "Poco/Exception.h"
#include "Poco/Timestamp.h" #include "Poco/Timestamp.h"
#if defined(__MACH__) #if defined(__APPLE__)
#include <mach/mach.h> #include <mach/mach.h>
#include <mach/clock.h> #include <mach/clock.h>
#elif defined(POCO_OS_FAMILY_UNIX) #elif defined(POCO_OS_FAMILY_UNIX)
@ -104,7 +104,7 @@ void Clock::update()
} }
else throw Poco::SystemException("cannot get system clock"); else throw Poco::SystemException("cannot get system clock");
#elif defined(__MACH__) #elif defined(__APPLE__)
clock_serv_t cs; clock_serv_t cs;
mach_timespec_t ts; mach_timespec_t ts;
@ -155,7 +155,7 @@ Clock::ClockDiff Clock::accuracy()
} }
else throw Poco::SystemException("cannot get system clock accuracy"); else throw Poco::SystemException("cannot get system clock accuracy");
#elif defined(__MACH__) #elif defined(__APPLE__)
clock_serv_t cs; clock_serv_t cs;
int nanosecs; int nanosecs;
@ -204,7 +204,7 @@ bool Clock::monotonic()
return true; return true;
#elif defined(__MACH__) #elif defined(__APPLE__)
return true; return true;

View File

@ -327,6 +327,54 @@ void EnvironmentImpl::nodeIdImpl(NodeId& id)
} // namespace Poco } // namespace Poco
#elif defined(__GNU__)
//
// GNU Hurd
//
#include <sys/ioctl.h>
#include <net/if.h>
#include <unistd.h>
#include <netinet/in.h>
namespace Poco {
void EnvironmentImpl::nodeIdImpl(NodeId& id)
{
std::memset(&id, 0, sizeof(id));
struct ifreq ifr;
struct ifconf ifc;
char buf[1024];
int sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
if (sock == -1) return;
ifc.ifc_len = sizeof(buf);
ifc.ifc_buf = buf;
if (ioctl(sock, SIOCGIFCONF, &ifc) == -1) return;
struct ifreq* it = ifc.ifc_req;
const struct ifreq* const end = it + (ifc.ifc_len / sizeof(struct ifreq));
for (; it != end; ++it) {
std::strcpy(ifr.ifr_name, it->ifr_name);
if (ioctl(sock, SIOCGIFFLAGS, &ifr) == 0) {
if (! (ifr.ifr_flags & IFF_LOOPBACK)) { // don't count loopback
if (ioctl(sock, SIOCGIFHWADDR, &ifr) == 0) {
std::memcpy(&id, ifr.ifr_hwaddr.sa_data, sizeof(id));
break;
}
}
}
else return;
}
}
} // namespace Poco
#elif defined(POCO_OS_FAMILY_UNIX) #elif defined(POCO_OS_FAMILY_UNIX)
// //
// General Unix // General Unix

View File

@ -56,7 +56,7 @@ MutexImpl::MutexImpl()
#endif #endif
pthread_mutexattr_t attr; pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr); pthread_mutexattr_init(&attr);
#if defined(PTHREAD_MUTEX_RECURSIVE_NP) #if defined(PTHREAD_MUTEX_RECURSIVE_NP) && !defined(__GNU__)
pthread_mutexattr_settype_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP); pthread_mutexattr_settype_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
#elif !defined(POCO_VXWORKS) #elif !defined(POCO_VXWORKS)
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
@ -81,7 +81,7 @@ MutexImpl::MutexImpl(bool fast)
#endif #endif
pthread_mutexattr_t attr; pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr); pthread_mutexattr_init(&attr);
#if defined(PTHREAD_MUTEX_RECURSIVE_NP) #if defined(PTHREAD_MUTEX_RECURSIVE_NP) && !defined(__GNU__)
pthread_mutexattr_settype_np(&attr, fast ? PTHREAD_MUTEX_NORMAL_NP : PTHREAD_MUTEX_RECURSIVE_NP); pthread_mutexattr_settype_np(&attr, fast ? PTHREAD_MUTEX_NORMAL_NP : PTHREAD_MUTEX_RECURSIVE_NP);
#elif !defined(POCO_VXWORKS) #elif !defined(POCO_VXWORKS)
pthread_mutexattr_settype(&attr, fast ? PTHREAD_MUTEX_NORMAL : PTHREAD_MUTEX_RECURSIVE); pthread_mutexattr_settype(&attr, fast ? PTHREAD_MUTEX_NORMAL : PTHREAD_MUTEX_RECURSIVE);

View File

@ -229,7 +229,7 @@ void FileTest::testFileAttributes3()
#if POCO_OS==POCO_OS_CYGWIN #if POCO_OS==POCO_OS_CYGWIN
File f("/dev/tty"); File f("/dev/tty");
#else #else
File f("/dev/console"); File f("/dev/null");
#endif #endif
#elif defined(POCO_OS_FAMILY_WINDOWS) #elif defined(POCO_OS_FAMILY_WINDOWS)
File f("CON"); File f("CON");

View File

@ -34,6 +34,9 @@ SHA2EngineTest::~SHA2EngineTest()
void SHA2EngineTest::testSHA224() void SHA2EngineTest::testSHA224()
{ {
#if defined(__sparc_v9__) || defined(__ppc64__) || defined(__powerpc__) || defined(__s390x__) || defined(__hppa__)
return;
#endif
SHA2Engine engine(SHA2Engine::SHA_224); SHA2Engine engine(SHA2Engine::SHA_224);
engine.update(""); engine.update("");
@ -56,6 +59,9 @@ void SHA2EngineTest::testSHA224()
void SHA2EngineTest::testSHA256() void SHA2EngineTest::testSHA256()
{ {
#if defined(__sparc_v9__) || defined(__ppc64__) || defined(__powerpc__) || defined(__s390x__) || defined(__hppa__)
return;
#endif
SHA2Engine engine(SHA2Engine::SHA_256); SHA2Engine engine(SHA2Engine::SHA_256);
engine.update(""); engine.update("");
@ -78,6 +84,9 @@ void SHA2EngineTest::testSHA256()
void SHA2EngineTest::testSHA384() void SHA2EngineTest::testSHA384()
{ {
#if defined(__sparc_v9__) || defined(__ppc64__) || defined(__powerpc__) || defined(__s390x__) || defined(__hppa__)
return;
#endif
SHA2Engine engine(SHA2Engine::SHA_384); SHA2Engine engine(SHA2Engine::SHA_384);
engine.update(""); engine.update("");
@ -100,6 +109,9 @@ void SHA2EngineTest::testSHA384()
void SHA2EngineTest::testSHA512() void SHA2EngineTest::testSHA512()
{ {
#if defined(__sparc_v9__) || defined(__ppc64__) || defined(__powerpc__) || defined(__s390x__) || defined(__hppa__)
return;
#endif
SHA2Engine engine(SHA2Engine::SHA_512); SHA2Engine engine(SHA2Engine::SHA_512);
engine.update(""); engine.update("");