diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f903e9f..6890786b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -845,6 +845,7 @@ CHECK_FUNCTION_EXISTS(gettid VMIME_HAVE_GETTID) CHECK_FUNCTION_EXISTS(syscall VMIME_HAVE_SYSCALL) CHECK_SYMBOL_EXISTS(SYS_gettid sys/syscall.h VMIME_HAVE_SYSCALL_GETTID) CHECK_SYMBOL_EXISTS(getthrid unistd.h VMIME_HAVE_GETTHRID) +CHECK_SYMBOL_EXISTS(thr_self sys/thr.h VMIME_HAVE_THR_SELF) CHECK_SYMBOL_EXISTS(_lwp_self sys/lwp.h VMIME_HAVE_LWP_SELF) CHECK_SYMBOL_EXISTS(SO_KEEPALIVE sys/socket.h VMIME_HAVE_SO_KEEPALIVE) diff --git a/cmake/config.hpp.cmake b/cmake/config.hpp.cmake index 6cf49b8c..ed486718 100644 --- a/cmake/config.hpp.cmake +++ b/cmake/config.hpp.cmake @@ -77,6 +77,7 @@ typedef unsigned @VMIME_64BIT_TYPE@ vmime_uint64; #cmakedefine01 VMIME_HAVE_SYSCALL #cmakedefine01 VMIME_HAVE_SYSCALL_GETTID #cmakedefine01 VMIME_HAVE_GETTHRID +#cmakedefine01 VMIME_HAVE_THR_SELF #cmakedefine01 VMIME_HAVE_LWP_SELF #cmakedefine01 VMIME_HAVE_GMTIME_S #cmakedefine01 VMIME_HAVE_GMTIME_R diff --git a/src/vmime/platforms/posix/posixHandler.cpp b/src/vmime/platforms/posix/posixHandler.cpp index 148d2169..8becf6ad 100644 --- a/src/vmime/platforms/posix/posixHandler.cpp +++ b/src/vmime/platforms/posix/posixHandler.cpp @@ -48,6 +48,9 @@ #if VMIME_HAVE_SYSCALL # include #endif +#if VMIME_HAVE_THR_SELF +# include +#endif #if VMIME_HAVE_LWP_SELF # include #endif @@ -230,6 +233,10 @@ unsigned int posixHandler::getThreadId() const { return static_cast (::syscall(SYS_gettid)); #elif VMIME_HAVE_GETTHRID // OpenBSD return static_cast (::getthrid()); +#elif VMIME_HAVE_THR_SELF // FreeBSD + long id = 0; + ::thr_self(&id); + return static_cast (id); #elif VMIME_HAVE_LWP_SELF // Solaris return static_cast (::_lwp_self()); #else diff --git a/src/vmime/propertySet.hpp b/src/vmime/propertySet.hpp index 681097d9..7ea31d5e 100644 --- a/src/vmime/propertySet.hpp +++ b/src/vmime/propertySet.hpp @@ -336,7 +336,7 @@ private: void parse(const string& props); - class propFinder : public std::unary_function , bool> { + class propFinder { public: