Control: notfixed -1 0.9.2-4
Control: found -1 0.9.2-4

Carsten Schoenert <[email protected]> writes:

> It seems you have forgotten to attach the patch. :-)

Oops.  Perhaps I should have replied via Thunderbird. ;-)
Here's the patch for real now.

-- 
Aaron M. Ucko, KB1CJC (amu at alum.mit.edu, ucko at debian.org)
http://www.mit.edu/~amu/ | http://stuff.mit.edu/cgi/finger/[email protected]

From: Carsten Schoenert <[email protected]>
Date: Tue, 8 Aug 2017 16:56:14 -0400
Subject: adding alternative getThreadId() implementation

On platforms which doesn't have syscall function and no syscall_getpid
symbol a own created type needs to be added for using.

Patch is taken from
http://code.bsd64.org/browse/freebsd/ports/head/mail/libvmime/files/patch-src__vmime__platforms__posix__posixHandler.cpp
---
 src/vmime/platforms/posix/posixHandler.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: libvmime/src/vmime/platforms/posix/posixHandler.cpp
===================================================================
--- libvmime.orig/src/vmime/platforms/posix/posixHandler.cpp
+++ libvmime/src/vmime/platforms/posix/posixHandler.cpp
@@ -47,6 +47,12 @@
 #	include <sys/syscall.h>
 #endif
 
+#ifdef __MACH__
+extern "C" {
+#	include <mach.h>
+}
+#endif
+
 #include <netdb.h>
 
 #include <string.h>
@@ -239,8 +245,14 @@ unsigned int posixHandler::getThreadId()
 	return static_cast <unsigned int>(::gettid());
 #elif VMIME_HAVE_SYSCALL && VMIME_HAVE_SYSCALL_GETTID
 	return static_cast <unsigned int>(::syscall(SYS_gettid));
+#elif __MACH__
+	mach_port_t id = mach_thread_self();
+	mach_port_deallocate(mach_task_self(), id);
+	return id;
 #else
-	#error We have no implementation of getThreadId() for this platform!
+	long id;
+	::syscall(SYS_thr_self, &id);
+	return static_cast <unsigned int>(id);
 #endif
 }
 

Reply via email to