1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
Description: Implement support for GNU Hurd
Author: Petter Reinholdtsen <pere@hungry.com>
Forwarded: https://github.com/pocoproject/poco/pull/5293
Last-Update: 2026-04-04
Reviewed-By: Petter Reinholdtsen <pere@hungry.com>
--- poco-1.14.2.orig/Foundation/include/Poco/Platform.h
+++ poco-1.14.2/Foundation/include/Poco/Platform.h
@@ -39,6 +39,7 @@
#define POCO_OS_CYGWIN 0x000d
#define POCO_OS_NACL 0x000e
#define POCO_OS_ANDROID 0x000f
+#define POCO_OS_GNU_HURD 0x0010
#define POCO_OS_UNKNOWN_UNIX 0x00ff
#define POCO_OS_WINDOWS_NT 0x1001
#define POCO_OS_VMS 0x2001
@@ -97,6 +98,9 @@
#elif defined(POCO_VXWORKS)
#define POCO_OS_FAMILY_UNIX 1
#define POCO_OS POCO_OS_VXWORKS
+#elif defined(__gnu_hurd__)
+ #define POCO_OS_FAMILY_UNIX 1
+ #define POCO_OS POCO_OS_GNU_HURD
#elif defined(unix) || defined(__unix) || defined(__unix__)
#define POCO_OS_FAMILY_UNIX 1
#define POCO_OS POCO_OS_UNKNOWN_UNIX
--- poco-1.14.2.orig/Foundation/include/Poco/Types.h
+++ poco-1.14.2/Foundation/include/Poco/Types.h
@@ -54,7 +54,7 @@ using UIntPtr = std::uintptr_t;
#if defined(__LP64__)
#define POCO_PTR_IS_64_BIT 1
#define POCO_LONG_IS_64_BIT 1
- #if POCO_OS == POCO_OS_LINUX || POCO_OS == POCO_OS_FREE_BSD || POCO_OS == POCO_OS_ANDROID || POCO_OS == POCO_OS_AIX || POCO_OS == POCO_OS_QNX || POCO_OS == POCO_OS_SOLARIS
+ #if POCO_OS == POCO_OS_LINUX || POCO_OS == POCO_OS_FREE_BSD || POCO_OS == POCO_OS_ANDROID || POCO_OS == POCO_OS_AIX || POCO_OS == POCO_OS_QNX || POCO_OS == POCO_OS_SOLARIS || POCO_OS == POCO_OS_GNU_HURD
#define POCO_INT64_IS_LONG 1
#endif
#endif
--- poco-1.14.2.orig/Foundation/src/Thread_POSIX.cpp
+++ poco-1.14.2/Foundation/src/Thread_POSIX.cpp
@@ -104,7 +104,10 @@ namespace
pthread_setname_np(truncName(threadName).c_str()); // __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2)
#endif
#endif // __MAC_OS_X_VERSION_MIN_REQUIRED
-#elif (POCO_OS == POCO_OS_QNX)
+#elif (POCO_OS == POCO_OS_QNX || POCO_OS == POCO_OS_GNU_HURD)
+ #if POCO_OS == POCO_OS_GNU_HURD
+ #define _NTO_THREAD_NAME_MAX POCO_MAX_THREAD_NAME_LEN
+ #endif
pthread_setname_np(pthread_self(), truncName(threadName, _NTO_THREAD_NAME_MAX).c_str());
#else
prctl(PR_SET_NAME, truncName(threadName).c_str());
@@ -128,7 +131,7 @@ namespace
pthread_getname_np(pthread_self(), name, nameSize + 1);
#endif
#endif // __MAC_OS_X_VERSION_MIN_REQUIRED
-#elif (POCO_OS == POCO_OS_QNX)
+#elif (POCO_OS == POCO_OS_QNX || POCO_OS == POCO_OS_GNU_HURD)
pthread_getname_np(pthread_self(), name, nameSize);
#else
prctl(PR_GET_NAME, name);
--- poco-1.14.2.orig/Net/src/SocketImpl.cpp
+++ poco-1.14.2/Net/src/SocketImpl.cpp
@@ -56,7 +56,7 @@
#endif
-#if POCO_OS == POCO_OS_LINUX && defined(POCO_HAVE_SENDFILE) && !defined(POCO_EMSCRIPTEN)
+#if (POCO_OS == POCO_OS_LINUX && defined(POCO_HAVE_SENDFILE) && !defined(POCO_EMSCRIPTEN)) || defined(POCO_OS_GNU_HURD)
#include <sys/sendfile.h>
#endif
@@ -1488,11 +1488,11 @@ namespace
std::streamoff sendFileUnix(poco_socket_t sd, FileIOS::NativeHandle fd, std::streamoff offset, std::streamsize count)
{
std::streamoff sent = 0;
- #ifdef __USE_LARGEFILE64
+ #if defined(__USE_LARGEFILE64) && !defined(POCO_OS_GNU_HURD)
off_t noffset = offset;
sent = sendfile64(sd, fd, &noffset, count);
#else
- #if POCO_OS == POCO_OS_LINUX && !defined(POCO_EMSCRIPTEN)
+ #if (POCO_OS == POCO_OS_LINUX && !defined(POCO_EMSCRIPTEN) ) || defined(POCO_OS_GNU_HURD)
off_t noffset = offset;
sent = sendfile(sd, fd, &noffset, count);
#elif POCO_OS == POCO_OS_MAC_OS_X
|