Author: Pino Toscano <pino@debian.org>
Description: Ignore ENOSYS errors for msync() on Hurd
Due to mlock() issues the mmap allocator is used; that allocator uses msync(),
which is not implemented yet in glibc for Hurd (thus returning ENOSYS).
Temporarly ignore such failures, with the option to not fail on other errors
(in case msync() gets implemented).
Last-Update: 2012-06-03
Forwarded: not-needed
--- a/src/botantools/botan/alloc_mmap/mmap_mem.cpp
+++ b/src/botantools/botan/alloc_mmap/mmap_mem.cpp
@@ -63,6 +63,9 @@ namespace QCA { // WRAPNS_LINE
} // WRAPNS_LINE
#include <fcntl.h>
namespace QCA { // WRAPNS_LINE
+} // WRAPNS_LINE
+#include <errno.h>
+namespace QCA { // WRAPNS_LINE
#ifndef MAP_FAILED
#define MAP_FAILED -1
@@ -158,11 +161,19 @@ void MemoryMapping_Allocator::dealloc_bl
for(u32bit j = 0; j != OVERWRITE_PASSES; j++)
{
std::memset(ptr, PATTERNS[j % sizeof(PATTERNS)], n);
- if(msync(MLOCK_TYPE_CAST ptr, n, MS_SYNC))
+ if(msync(MLOCK_TYPE_CAST ptr, n, MS_SYNC)
+#ifdef __GNU__
+ && errno != ENOSYS
+#endif
+ )
throw MemoryMapping_Failed("Sync operation failed");
}
std::memset(ptr, 0, n);
- if(msync(MLOCK_TYPE_CAST ptr, n, MS_SYNC))
+ if(msync(MLOCK_TYPE_CAST ptr, n, MS_SYNC)
+#ifdef __GNU__
+ && errno != ENOSYS
+#endif
+ )
throw MemoryMapping_Failed("Sync operation failed");
if(munmap(MLOCK_TYPE_CAST ptr, n))