upgrade libtorrent and rtorrent
authorLuka Perkov <luka@openwrt.org>
Wed, 13 Apr 2011 22:07:14 +0000 (22:07 +0000)
committerLuka Perkov <luka@openwrt.org>
Wed, 13 Apr 2011 22:07:14 +0000 (22:07 +0000)
SVN-Revision: 26652

13 files changed:
libs/libtorrent/Makefile
libs/libtorrent/patches/100-fix_cross_compile.patch
libs/libtorrent/patches/110-fix-no-posix_memalign.diff [deleted file]
libs/libtorrent/patches/110-fix-no-posix_memalign.patch [new file with mode: 0644]
libs/libtorrent/patches/120-fix-ipv6_socket_datagram.diff [deleted file]
libs/libtorrent/patches/120-fix-ipv6_socket_datagram.patch [new file with mode: 0644]
libs/libtorrent/patches/121-fix-socket_set-template.diff [deleted file]
libs/libtorrent/patches/121-fix-socket_set-template.patch [new file with mode: 0644]
libs/libtorrent/patches/122-fix-uintptr_t-use.patch
net/rtorrent/Makefile
net/rtorrent/patches/100-fix_cross_compile.patch
net/rtorrent/patches/110-fix-no-posix_memalign.diff [deleted file]
net/rtorrent/patches/110-fix-no-posix_memalign.patch [new file with mode: 0644]

index 40b38371c2a6dd60917c5002f8c6de8b73074717..5bafdcabe9d284ebae3c639c2ec92d57500a265c 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2007-2010 OpenWrt.org
+# Copyright (C) 2007-2011 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -8,9 +8,9 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=libtorrent
-PKG_REV:=1189
+PKG_REV:=1209
 PKG_VERSION:=0.12.6_r$(PKG_REV)
-PKG_RELEASE:=3
+PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=svn://rakshasa.no/libtorrent/trunk/libtorrent
@@ -29,6 +29,7 @@ define Package/libtorrent
   TITLE:=Rakshasa's BitTorrent library
   URL:=http://libtorrent.rakshasa.no/
   DEPENDS:=+libopenssl +libsigcxx @!LINUX_2_4
+  MAINTAINER:=Luka Perkov <openwrt@lukaperkov.net>
 endef
 
 define Package/libtorrent/description
@@ -39,14 +40,9 @@ define Package/libtorrent/description
  the speed of the official client.
 endef
 
-ifneq ($(CONFIG_GCC_VERSION_3_4)$(CONFIG_GCC_VERSION_4_1),)
-  TARGET_CPPFLAGS += -fno-strict-aliasing
-endif
-
-TARGET_CPPFLAGS += -fno-inline
+TARGET_CPPFLAGS += -fno-strict-aliasing -fno-inline
 TARGET_LDFLAGS += $(LIBGCC_S)
 
-# XXX: rtorrent needs encryption (--enable-openssl)
 CONFIGURE_ARGS+= \
        --enable-shared \
        --enable-static \
index ab5bca19f03ce58707e34d11756d8abb67745b75..8f0fbb912fff8e43d784c43660e0def100742303 100644 (file)
@@ -1,5 +1,7 @@
---- a/configure.ac
-+++ b/configure.ac
+Index: libtorrent-0.12.6_r1209/configure.ac
+===================================================================
+--- libtorrent-0.12.6_r1209.orig/configure.ac  2011-03-27 12:23:16.000000000 +0200
++++ libtorrent-0.12.6_r1209/configure.ac       2011-04-13 16:33:17.487339738 +0200
 @@ -17,7 +17,6 @@
  
  AM_INIT_AUTOMAKE
  AC_DISABLE_STATIC
  
  AM_DISABLE_STATIC
-@@ -117,5 +116,4 @@
+@@ -118,5 +117,4 @@
        src/protocol/Makefile
        src/tracker/Makefile
        src/utils/Makefile
 -        test/Makefile
  ])
---- a/Makefile.am
-+++ b/Makefile.am
+Index: libtorrent-0.12.6_r1209/Makefile.am
+===================================================================
+--- libtorrent-0.12.6_r1209.orig/Makefile.am   2010-03-01 20:04:58.000000000 +0100
++++ libtorrent-0.12.6_r1209/Makefile.am        2011-04-13 16:33:17.487339738 +0200
 @@ -1,4 +1,4 @@
 -SUBDIRS = src test
 +SUBDIRS = src
diff --git a/libs/libtorrent/patches/110-fix-no-posix_memalign.diff b/libs/libtorrent/patches/110-fix-no-posix_memalign.diff
deleted file mode 100644 (file)
index d0c1e43..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
---- a/rak/allocators.h
-+++ b/rak/allocators.h
-@@ -74,17 +74,13 @@ public:
-   size_type max_size () const throw() { return std::numeric_limits<size_t>::max() / sizeof(T); }
-   pointer allocate(size_type num, const_void_pointer hint = 0) { return alloc_size(num*sizeof(T)); }
-+  void deallocate (pointer p, size_type num) { dealloc_size(p, num*sizeof(T)); }
--  static pointer alloc_size(size_type size) {
--    pointer ptr = NULL;
--    int __UNUSED result = posix_memalign((void**)&ptr, LT_SMP_CACHE_BYTES, size);
--
--    return ptr;
--  }
-+  static pointer alloc_size(size_type size);
-+  static void dealloc_size(pointer p, size_type size);
-   void construct (pointer p, const T& value) { new((void*)p)T(value); }
-   void destroy (pointer p) { p->~T(); }
--  void deallocate (pointer p, size_type num) { free((void*)p); }
- };
-@@ -98,6 +94,36 @@ bool operator!= (const cacheline_allocator<T1>&, const cacheline_allocator<T2>&)
-   return false;
- }
-+template <class T>
-+inline typename cacheline_allocator<T>::pointer cacheline_allocator<T>::alloc_size(size_type size) {
-+  pointer ptr;
-+
-+#if HAVE_POSIX_MEMALIGN
-+  if (posix_memalign((void**)&ptr, LT_SMP_CACHE_BYTES, size))
-+    return NULL;
-+#else
-+  char* org = (char*)malloc(size + sizeof(void*) + LT_SMP_CACHE_BYTES - 1);
-+  if (org == NULL)
-+    return NULL;
-+
-+  ptr = (pointer)((uintptr_t)(org + LT_SMP_CACHE_BYTES - 1) & ~(LT_SMP_CACHE_BYTES - 1));
-+
-+  // store originally allocated pointer for later free() at the end of the allocated data
-+  *(void**)((char*)ptr + size) = org;
-+#endif
-+
-+  return ptr;
-+}
-+
-+template <class T>
-+inline void cacheline_allocator<T>::dealloc_size(pointer p, size_type size) {
-+#if HAVE_POSIX_MEMALIGN
-+  free(p);
-+#else
-+  free(*(void**)((char*)p + size));
-+#endif
-+}
-+
- }
- //
diff --git a/libs/libtorrent/patches/110-fix-no-posix_memalign.patch b/libs/libtorrent/patches/110-fix-no-posix_memalign.patch
new file mode 100644 (file)
index 0000000..b99a0d1
--- /dev/null
@@ -0,0 +1,62 @@
+Index: libtorrent-0.12.6_r1209/rak/allocators.h
+===================================================================
+--- libtorrent-0.12.6_r1209.orig/rak/allocators.h      2010-11-10 12:40:28.000000000 +0100
++++ libtorrent-0.12.6_r1209/rak/allocators.h   2011-04-13 16:33:28.179339669 +0200
+@@ -74,17 +74,13 @@
+   size_type max_size () const throw() { return std::numeric_limits<size_t>::max() / sizeof(T); }
+   pointer allocate(size_type num, const_void_pointer hint = 0) { return alloc_size(num*sizeof(T)); }
++  void deallocate (pointer p, size_type num) { dealloc_size(p, num*sizeof(T)); }
+-  static pointer alloc_size(size_type size) {
+-    pointer ptr = NULL;
+-    int __UNUSED result = posix_memalign((void**)&ptr, LT_SMP_CACHE_BYTES, size);
+-
+-    return ptr;
+-  }
++  static pointer alloc_size(size_type size);
++  static void dealloc_size(pointer p, size_type size);
+   void construct (pointer p, const T& value) { new((void*)p)T(value); }
+   void destroy (pointer p) { p->~T(); }
+-  void deallocate (pointer p, size_type num) { free((void*)p); }
+ };
+@@ -98,6 +94,36 @@
+   return false;
+ }
++template <class T>
++inline typename cacheline_allocator<T>::pointer cacheline_allocator<T>::alloc_size(size_type size) {
++  pointer ptr;
++
++#if HAVE_POSIX_MEMALIGN
++  if (posix_memalign((void**)&ptr, LT_SMP_CACHE_BYTES, size))
++    return NULL;
++#else
++  char* org = (char*)malloc(size + sizeof(void*) + LT_SMP_CACHE_BYTES - 1);
++  if (org == NULL)
++    return NULL;
++
++  ptr = (pointer)((uintptr_t)(org + LT_SMP_CACHE_BYTES - 1) & ~(LT_SMP_CACHE_BYTES - 1));
++
++  // store originally allocated pointer for later free() at the end of the allocated data
++  *(void**)((char*)ptr + size) = org;
++#endif
++
++  return ptr;
++}
++
++template <class T>
++inline void cacheline_allocator<T>::dealloc_size(pointer p, size_type size) {
++#if HAVE_POSIX_MEMALIGN
++  free(p);
++#else
++  free(*(void**)((char*)p + size));
++#endif
++}
++
+ }
+ //
diff --git a/libs/libtorrent/patches/120-fix-ipv6_socket_datagram.diff b/libs/libtorrent/patches/120-fix-ipv6_socket_datagram.diff
deleted file mode 100644 (file)
index 1a46627..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
---- a/src/net/socket_datagram.cc
-+++ b/src/net/socket_datagram.cc
-@@ -73,6 +73,23 @@ SocketDatagram::write_datagram(const voi
-   int r;
-   if (sa != NULL) {
-+#ifdef RAK_USE_INET6
-+    if (m_ipv6_socket && sa->family() == rak::socket_address::pf_inet) {
-+      uint32_t addr32[4];
-+      sockaddr_in6 mapped_addr;
-+      memset(&mapped_addr, 0, sizeof(mapped_addr));
-+      mapped_addr.sin6_family = AF_INET6;
-+      addr32[0] = 0;
-+      addr32[1] = 0;
-+      addr32[2] = htonl(0xffff);
-+      addr32[3] = sa->sa_inet()->address_n();
-+      memcpy(mapped_addr.sin6_addr.s6_addr, addr32, sizeof(uint32_t) * 4);
-+      mapped_addr.sin6_port = sa->sa_inet()->port_n();
-+      r = ::sendto(m_fileDesc, buffer, length, 0, (sockaddr*)&mapped_addr, sizeof(mapped_addr));
-+    } else if (m_ipv6_socket && sa->family() == rak::socket_address::pf_inet6) {
-+      r = ::sendto(m_fileDesc, buffer, length, 0, sa->sa_inet6()->c_sockaddr(), sizeof(rak::socket_address_inet6));
-+    } else
-+#endif
-     r = ::sendto(m_fileDesc, buffer, length, 0, sa->sa_inet()->c_sockaddr(), sizeof(rak::socket_address_inet));
-   } else {
-     r = ::send(m_fileDesc, buffer, length, 0);
diff --git a/libs/libtorrent/patches/120-fix-ipv6_socket_datagram.patch b/libs/libtorrent/patches/120-fix-ipv6_socket_datagram.patch
new file mode 100644 (file)
index 0000000..745f689
--- /dev/null
@@ -0,0 +1,28 @@
+Index: libtorrent-0.12.6_r1209/src/net/socket_datagram.cc
+===================================================================
+--- libtorrent-0.12.6_r1209.orig/src/net/socket_datagram.cc    2008-07-05 14:13:12.000000000 +0200
++++ libtorrent-0.12.6_r1209/src/net/socket_datagram.cc 2011-04-13 16:33:33.266840379 +0200
+@@ -73,6 +73,23 @@
+   int r;
+   if (sa != NULL) {
++#ifdef RAK_USE_INET6
++    if (m_ipv6_socket && sa->family() == rak::socket_address::pf_inet) {
++      uint32_t addr32[4];
++      sockaddr_in6 mapped_addr;
++      memset(&mapped_addr, 0, sizeof(mapped_addr));
++      mapped_addr.sin6_family = AF_INET6;
++      addr32[0] = 0;
++      addr32[1] = 0;
++      addr32[2] = htonl(0xffff);
++      addr32[3] = sa->sa_inet()->address_n();
++      memcpy(mapped_addr.sin6_addr.s6_addr, addr32, sizeof(uint32_t) * 4);
++      mapped_addr.sin6_port = sa->sa_inet()->port_n();
++      r = ::sendto(m_fileDesc, buffer, length, 0, (sockaddr*)&mapped_addr, sizeof(mapped_addr));
++    } else if (m_ipv6_socket && sa->family() == rak::socket_address::pf_inet6) {
++      r = ::sendto(m_fileDesc, buffer, length, 0, sa->sa_inet6()->c_sockaddr(), sizeof(rak::socket_address_inet6));
++    } else
++#endif
+     r = ::sendto(m_fileDesc, buffer, length, 0, sa->sa_inet()->c_sockaddr(), sizeof(rak::socket_address_inet));
+   } else {
+     r = ::send(m_fileDesc, buffer, length, 0);
diff --git a/libs/libtorrent/patches/121-fix-socket_set-template.diff b/libs/libtorrent/patches/121-fix-socket_set-template.diff
deleted file mode 100644 (file)
index 8fa8304..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
---- a/src/net/socket_set.h
-+++ b/src/net/socket_set.h
-@@ -53,12 +53,12 @@ namespace torrent {
- // Propably should rename to EventSet...
--class SocketSet : private std::vector<Event*, rak::cacheline_allocator<> > {
-+class SocketSet : private std::vector<Event*, rak::cacheline_allocator<Event*> > {
- public:
-   typedef uint32_t    size_type;
--  typedef std::vector<Event*, rak::cacheline_allocator<> > base_type;
--  typedef std::vector<size_type, rak::cacheline_allocator<> > Table;
-+  typedef std::vector<Event*, rak::cacheline_allocator<Event*> > base_type;
-+  typedef std::vector<size_type, rak::cacheline_allocator<size_type> > Table;
-   static const size_type npos = static_cast<size_type>(-1);
diff --git a/libs/libtorrent/patches/121-fix-socket_set-template.patch b/libs/libtorrent/patches/121-fix-socket_set-template.patch
new file mode 100644 (file)
index 0000000..12ce9b2
--- /dev/null
@@ -0,0 +1,20 @@
+Index: libtorrent-0.12.6_r1209/src/net/socket_set.h
+===================================================================
+--- libtorrent-0.12.6_r1209.orig/src/net/socket_set.h  2011-02-12 13:20:09.000000000 +0100
++++ libtorrent-0.12.6_r1209/src/net/socket_set.h       2011-04-13 16:33:38.567388959 +0200
+@@ -53,12 +53,12 @@
+ // Propably should rename to EventSet...
+-class SocketSet : private std::vector<Event*, rak::cacheline_allocator<> > {
++class SocketSet : private std::vector<Event*, rak::cacheline_allocator<Event*> > {
+ public:
+   typedef uint32_t    size_type;
+-  typedef std::vector<Event*, rak::cacheline_allocator<> > base_type;
+-  typedef std::vector<size_type, rak::cacheline_allocator<> > Table;
++  typedef std::vector<Event*, rak::cacheline_allocator<Event*> > base_type;
++  typedef std::vector<size_type, rak::cacheline_allocator<size_type> > Table;
+   static const size_type npos = static_cast<size_type>(-1);
index ce19e0158ca3985ad1f6e85aad15d110717240b2..8d2500dd974ec6db6475a8aee6f18f246d1e26b8 100644 (file)
@@ -1,13 +1,7 @@
-fix the following build error on octeon & ppc
-
-In file included from ../../rak/priority_queue_default.h:41,
-                 from ./../dht/dht_router.h:40,
-                 from tracker_dht.cc:42:
-../../rak/allocators.h: In static member function 'static T* rak::cacheline_allocator<T>::alloc_size(size_t)':
-../../rak/allocators.h:109: error: 'uintptr_t' was not declared in this scope
-
---- a/rak/allocators.h
-+++ b/rak/allocators.h
+Index: libtorrent-0.12.6_r1209/rak/allocators.h
+===================================================================
+--- libtorrent-0.12.6_r1209.orig/rak/allocators.h      2011-04-13 16:33:28.179339669 +0200
++++ libtorrent-0.12.6_r1209/rak/allocators.h   2011-04-13 16:33:48.454840573 +0200
 @@ -41,6 +41,7 @@
  
  #include <cstddef>
index 3a0804b1e8c9d32bf9628e556f4c6b2e019eaf8c..969b0e99f05eac8ff9c644b751f85093c3e04547 100644 (file)
@@ -1,17 +1,16 @@
 #
-# Copyright (C) 2007-2010 OpenWrt.org
+# Copyright (C) 2007-2011 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
 #
-#
 
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=rtorrent
-PKG_REV:=1189
+PKG_REV:=1209
 PKG_VERSION:=0.8.6_r$(PKG_REV)
-PKG_RELEASE:=2
+PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=svn://rakshasa.no/libtorrent/trunk/rtorrent
@@ -31,6 +30,7 @@ define Package/rtorrent
   TITLE:=BitTorrent client for ncurses
   URL:=http://libtorrent.rakshasa.no/
   DEPENDS:=+libcurl +libtorrent +libncurses +libsigcxx +xmlrpc-c-server +libpthread
+  MAINTAINER:=Luka Perkov <openwrt@lukaperkov.net>
 endef
 
 define Package/rtorrent/description
@@ -40,10 +40,7 @@ define Package/rtorrent/description
  based clients in an ncurses client.
 endef
 
-ifneq ($(CONFIG_GCC_VERSION_3_4)$(CONFIG_GCC_VERSION_4_1),)
-TARGET_CPPFLAGS += -fno-strict-aliasing
-endif
-
+TARGET_CPPFLAGS += -fno-strict-aliasing -fno-inline
 TARGET_LDFLAGS += -lpthread -Wl,-rpath-link=$(STAGING_DIR)/usr/lib
 
 CONFIGURE_ARGS+= \
@@ -53,7 +50,7 @@ CONFIGURE_ARGS+= \
        --with-xmlrpc-c
 
 define Build/Configure
-       (cd $(PKG_BUILD_DIR); ./autogen.sh );
+       ( cd $(PKG_BUILD_DIR); ./autogen.sh );
        $(call Build/Configure/Default)
 endef
 
index 00bd91eb2c833e8e4e3fe976539feb342f412773..2ad192d85b371bffb60fabcd1a56f40cd1b1b54a 100644 (file)
@@ -1,5 +1,7 @@
---- a/configure.ac
-+++ b/configure.ac
+Index: rtorrent-0.8.6_r1209/configure.ac
+===================================================================
+--- rtorrent-0.8.6_r1209.orig/configure.ac     2010-10-05 05:36:14.000000000 +0200
++++ rtorrent-0.8.6_r1209/configure.ac  2011-04-13 16:29:48.619340344 +0200
 @@ -2,7 +2,6 @@
  
  AM_INIT_AUTOMAKE
        src/utils/Makefile
 -        test/Makefile
  ])
---- a/Makefile.am
-+++ b/Makefile.am
+Index: rtorrent-0.8.6_r1209/Makefile.am
+===================================================================
+--- rtorrent-0.8.6_r1209.orig/Makefile.am      2010-03-19 10:33:25.000000000 +0100
++++ rtorrent-0.8.6_r1209/Makefile.am   2011-04-13 16:29:48.619340344 +0200
 @@ -1,7 +1,4 @@
 -SUBDIRS = \
 -      doc \
  
  EXTRA_DIST= \
        autogen.sh \
---- a/scripts/common.m4
-+++ b/scripts/common.m4
-@@ -209,7 +209,7 @@ dnl   Need to fix this so that it uses t
+Index: rtorrent-0.8.6_r1209/scripts/common.m4
+===================================================================
+--- rtorrent-0.8.6_r1209.orig/scripts/common.m4        2009-12-19 22:36:44.000000000 +0100
++++ rtorrent-0.8.6_r1209/scripts/common.m4     2011-04-13 16:29:48.619340344 +0200
+@@ -209,7 +209,7 @@
  AC_DEFUN([TORRENT_CHECK_EXECINFO], [
    AC_MSG_CHECKING(for execinfo.h)
  
diff --git a/net/rtorrent/patches/110-fix-no-posix_memalign.diff b/net/rtorrent/patches/110-fix-no-posix_memalign.diff
deleted file mode 100644 (file)
index e4d3745..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-diff --git a/rak/allocators.h b/rak/allocators.h
-index 0a1b711..2d7b98e 100644
---- a/rak/allocators.h
-+++ b/rak/allocators.h
-@@ -42,6 +42,7 @@
- #include <cstddef>
- #include <limits>
- #include <stdlib.h>
-+#include <stdint.h>
- #include <sys/types.h>
- namespace rak {
-@@ -74,17 +75,13 @@ public:
-   size_type max_size () const throw() { return std::numeric_limits<size_t>::max() / sizeof(T); }
-   pointer allocate(size_type num, const_void_pointer hint = 0) { return alloc_size(num*sizeof(T)); }
-+  void deallocate (pointer p, size_type num) { dealloc_size(p, num*sizeof(T)); }
--  static pointer alloc_size(size_type size) {
--    pointer ptr = NULL;
--    int __UNUSED result = posix_memalign((void**)&ptr, LT_SMP_CACHE_BYTES, size);
--
--    return ptr;
--  }
-+  static pointer alloc_size(size_type size);
-+  static void dealloc_size(pointer p, size_type size);
-   void construct (pointer p, const T& value) { new((void*)p)T(value); }
-   void destroy (pointer p) { p->~T(); }
--  void deallocate (pointer p, size_type num) { free((void*)p); }
- };
-@@ -98,6 +95,36 @@ bool operator!= (const cacheline_allocator<T1>&, const cacheline_allocator<T2>&)
-   return false;
- }
-+template <class T>
-+inline typename cacheline_allocator<T>::pointer cacheline_allocator<T>::alloc_size(size_type size) {
-+  pointer ptr;
-+
-+#if HAVE_POSIX_MEMALIGN
-+  if (posix_memalign((void**)&ptr, LT_SMP_CACHE_BYTES, size))
-+    return NULL;
-+#else
-+  char* org = (char*)malloc(size + sizeof(void*) + LT_SMP_CACHE_BYTES - 1);
-+  if (org == NULL)
-+    return NULL;
-+
-+  ptr = (pointer)((uintptr_t)(org + LT_SMP_CACHE_BYTES - 1) & ~(LT_SMP_CACHE_BYTES - 1));
-+
-+  // store originally allocated pointer for later free() at the end of the allocated data
-+  *(void**)((char*)ptr + size) = org;
-+#endif
-+
-+  return ptr;
-+}
-+
-+template <class T>
-+inline void cacheline_allocator<T>::dealloc_size(pointer p, size_type size) {
-+#if HAVE_POSIX_MEMALIGN
-+  free(p);
-+#else
-+  free(*(void**)((char*)p + size));
-+#endif
-+}
-+
- }
- //
diff --git a/net/rtorrent/patches/110-fix-no-posix_memalign.patch b/net/rtorrent/patches/110-fix-no-posix_memalign.patch
new file mode 100644 (file)
index 0000000..baf3429
--- /dev/null
@@ -0,0 +1,70 @@
+Index: rtorrent-0.8.6_r1209/rak/allocators.h
+===================================================================
+--- rtorrent-0.8.6_r1209.orig/rak/allocators.h 2010-11-10 12:40:28.000000000 +0100
++++ rtorrent-0.8.6_r1209/rak/allocators.h      2011-04-13 16:30:02.370840196 +0200
+@@ -42,6 +42,7 @@
+ #include <cstddef>
+ #include <limits>
+ #include <stdlib.h>
++#include <stdint.h>
+ #include <sys/types.h>
+ namespace rak {
+@@ -74,17 +75,13 @@
+   size_type max_size () const throw() { return std::numeric_limits<size_t>::max() / sizeof(T); }
+   pointer allocate(size_type num, const_void_pointer hint = 0) { return alloc_size(num*sizeof(T)); }
++  void deallocate (pointer p, size_type num) { dealloc_size(p, num*sizeof(T)); }
+-  static pointer alloc_size(size_type size) {
+-    pointer ptr = NULL;
+-    int __UNUSED result = posix_memalign((void**)&ptr, LT_SMP_CACHE_BYTES, size);
+-
+-    return ptr;
+-  }
++  static pointer alloc_size(size_type size);
++  static void dealloc_size(pointer p, size_type size);
+   void construct (pointer p, const T& value) { new((void*)p)T(value); }
+   void destroy (pointer p) { p->~T(); }
+-  void deallocate (pointer p, size_type num) { free((void*)p); }
+ };
+@@ -98,6 +95,36 @@
+   return false;
+ }
++template <class T>
++inline typename cacheline_allocator<T>::pointer cacheline_allocator<T>::alloc_size(size_type size) {
++  pointer ptr;
++
++#if HAVE_POSIX_MEMALIGN
++  if (posix_memalign((void**)&ptr, LT_SMP_CACHE_BYTES, size))
++    return NULL;
++#else
++  char* org = (char*)malloc(size + sizeof(void*) + LT_SMP_CACHE_BYTES - 1);
++  if (org == NULL)
++    return NULL;
++
++  ptr = (pointer)((uintptr_t)(org + LT_SMP_CACHE_BYTES - 1) & ~(LT_SMP_CACHE_BYTES - 1));
++
++  // store originally allocated pointer for later free() at the end of the allocated data
++  *(void**)((char*)ptr + size) = org;
++#endif
++
++  return ptr;
++}
++
++template <class T>
++inline void cacheline_allocator<T>::dealloc_size(pointer p, size_type size) {
++#if HAVE_POSIX_MEMALIGN
++  free(p);
++#else
++  free(*(void**)((char*)p + size));
++#endif
++}
++
+ }
+ //