From e3d7bed8337517a12ddc0f5cab4d173ac794a009 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 2 Feb 2010 15:52:58 +0000 Subject: [PATCH] [packages] rtorrent: update to r1123 (#6624) SVN-Revision: 19499 --- net/rtorrent/Makefile | 4 +- .../patches/110-fix-no-posix_memalign.diff | 64 +++++++++++++++++++ .../patches/111-fix_crash_thread.patch | 9 +++ 3 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 net/rtorrent/patches/110-fix-no-posix_memalign.diff create mode 100644 net/rtorrent/patches/111-fix_crash_thread.patch diff --git a/net/rtorrent/Makefile b/net/rtorrent/Makefile index 58c007c6ed..86b5a149fe 100644 --- a/net/rtorrent/Makefile +++ b/net/rtorrent/Makefile @@ -10,9 +10,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=rtorrent -PKG_REV:=1106 +PKG_REV:=1123 PKG_VERSION:=0.8.6_r$(PKG_REV) -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=svn://rakshasa.no/libtorrent/trunk/rtorrent PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) diff --git a/net/rtorrent/patches/110-fix-no-posix_memalign.diff b/net/rtorrent/patches/110-fix-no-posix_memalign.diff new file mode 100644 index 0000000000..1634e12421 --- /dev/null +++ b/net/rtorrent/patches/110-fix-no-posix_memalign.diff @@ -0,0 +1,64 @@ +Index: rtorrent/rak/allocators.h +=================================================================== +--- rtorrent/rak/allocators.h (revision 1121) ++++ rtorrent/rak/allocators.h (working copy) +@@ -74,17 +74,13 @@ + size_type max_size () const throw() { return std::numeric_limits::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); ++ static pointer alloc_size(size_type size); ++ static void dealloc_size(pointer p, size_type size); + +- return ptr; +- } +- + 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) { ::operator delete((void*)p); } + }; + + +@@ -98,8 +94,38 @@ + return false; + } + ++template ++inline typename cacheline_allocator::pointer cacheline_allocator::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 ++inline void cacheline_allocator::dealloc_size(pointer p, size_type size) { ++#if HAVE_POSIX_MEMALIGN ++ free(p); ++#else ++ free(*(void**)((char*)p + size)); ++#endif ++} ++ ++} ++ + // + // Operator new with custom allocators: + // diff --git a/net/rtorrent/patches/111-fix_crash_thread.patch b/net/rtorrent/patches/111-fix_crash_thread.patch new file mode 100644 index 0000000000..2b26194533 --- /dev/null +++ b/net/rtorrent/patches/111-fix_crash_thread.patch @@ -0,0 +1,9 @@ +--- a/src/thread_base.cc 2010-01-26 09:40:34.000000000 +0300 ++++ b/src/thread_base.cc 2010-01-31 18:38:25.000000000 +0300 +@@ -191,5 +191,5 @@ + void + ThreadBase::queue_item(thread_base_func newFunc) { + m_threadQueue->push_back(newFunc); +- pthread_kill(m_thread, SIGUSR1); ++ if(m_thread != NULL) pthread_kill(m_thread, SIGUSR1); + } -- 2.30.2