components/libtorrent/patches/rlibtorrent-01-madvise.patch
author Mike Sullivan <Mike.Sullivan@Oracle.COM>
Thu, 19 May 2011 10:10:26 -0700
changeset 248 3011f7a1ed77
child 6932 ae9e3811b2ec
permissions -rw-r--r--
7046137 move *torrent to userland

--- libtorrent-0.12.2.orig/src/data/memory_chunk.cc	(revision 1060)
+++ libtorrent-0.12.2/src/data/memory_chunk.cc	(working copy)
@@ -41,6 +41,16 @@
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/mman.h>
+#if defined(__sun) && defined(__SVR4)
+/* Ugly hack to make this compile on Solaris with g++. See
+ * http://www.opensolaris.org/jive/thread.jspa?threadID=21035&tstart=0
+ */
+#if (_POSIX_C_SOURCE > 2) || defined(_XPG4_2)
+extern "C" {
+extern int madvise(caddr_t, size_t, int);
+}
+#endif
+#endif
 #include <rak/error_number.h>
 
 #include "torrent/exceptions.h"
--- libtorrent-0.12.2.orig/scripts/common.m4	2008-05-07 08:19:12.000000000 -0400
+++ libtorrent-0.12.2/scripts/common.m4	2008-06-23 17:04:24.567475080 -0400
@@ -170,7 +170,7 @@
   AC_COMPILE_IFELSE(
     [[#include <sys/types.h>
           #include <sys/mman.h>
-          void f() { static char test[1024]; madvise((void *)test, sizeof(test), MADV_NORMAL); }
+          void f() { static char test[1024]; madvise((char *)test, sizeof(test), MADV_NORMAL); }
     ]],
     [
       AC_MSG_RESULT(yes)