tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

libtorrent/rtorrent patch for testing



Hi all,
the attached patch does two things:
(1) Allowing building both against a C++11 implementation of STL without
the TR1 stuff. This is primarily using the correct version of the
symbols, but there is an additional change for std::array vs
std::tr1::array with the fill vs assign difference.

(2) Fix the kevent udata type issue again for NetBSD.

I have some reports from #pkgsrc that it builds now with GCC and on
newer OSX.

Joerg
Index: net/libtorrent/distinfo
===================================================================
RCS file: /home/joerg/repo/netbsd/pkgsrc/net/libtorrent/distinfo,v
retrieving revision 1.34
diff -u -p -r1.34 distinfo
--- net/libtorrent/distinfo	15 Jun 2014 22:44:15 -0000	1.34
+++ net/libtorrent/distinfo	10 Oct 2015 18:48:59 -0000
@@ -3,6 +3,64 @@ $NetBSD: distinfo,v 1.34 2014/06/15 22:4
 SHA1 (libtorrent-0.13.4.tar.gz) = 3a3ca87054d020bc376abe2c1ea15bbbaef31131
 RMD160 (libtorrent-0.13.4.tar.gz) = bbf0903c619eaaded93ffe668abd16101882e8fa
 Size (libtorrent-0.13.4.tar.gz) = 768382 bytes
+SHA1 (patch-rak_priority__queue__default.h) = 0a10c7589666cfcbb43f55ff835ec558acda685f
 SHA1 (patch-src_Makefile.am) = e69dd1da8a9736fa45af71cfc167c8b89a7fe648
 SHA1 (patch-src_Makefile.in) = 522fbdb8da913d351fd86aface86aa2d1d86b5cc
 SHA1 (patch-src_data_chunk__list.cpp) = 4b09b093ca5f2abdb7e4d3c1c0bdb9fdfcd4f981
+SHA1 (patch-src_data_chunk__list.h) = 248896cca2c3bd0ade123b6b13a4f5d788443dc5
+SHA1 (patch-src_data_hash__check__queue.h) = 9169b836ab6b8236ae43e1a65d0adfa4ed3a1c1d
+SHA1 (patch-src_data_hash__queue.cc) = 39252f22586ab4fd4bd430cb497f301693e46df2
+SHA1 (patch-src_data_hash__queue.h) = 88b15c8cd5b8fef16e0fc6545913061b1efd0c68
+SHA1 (patch-src_data_hash__queue__node.h) = 993f4ae19e8c5a77a86f154253dba345dc25cd4f
+SHA1 (patch-src_data_hash__torrent.h) = f23ac7b4e20eba1fa8bcea2e43fdb09caf879dee
+SHA1 (patch-src_dht_dht__router.cc) = c7d5359dca65c47100925134ce316beec53fa85e
+SHA1 (patch-src_dht_dht__server.cc) = 948da98996a65d4588d95b936cd41a5e75c9bca7
+SHA1 (patch-src_download_delegator.h) = c8c7a00573fa8307198c98ff4cf92b0acbe7e17d
+SHA1 (patch-src_download_download__main.cc) = aea21077daaa786dace729f7d2faffa2ad435893
+SHA1 (patch-src_download_download__wrapper.cc) = dbbe9068a6f0d6dd50459c5d820737750e5264da
+SHA1 (patch-src_manager.cc) = d284e4eb16373337e896b247bab50a421d0739e0
+SHA1 (patch-src_net_listen.h) = f256f53287fbd855057b5e662f4a62c72036bca7
+SHA1 (patch-src_net_socket__set.h) = 5a507cd7f1f7568a5aca9302e4bb15138a8d225e
+SHA1 (patch-src_net_throttle__internal.cc) = b64b0ec9394eb6b02c4963f76df0c1527685b00e
+SHA1 (patch-src_net_throttle__node.h) = efbc3bf2ede99217fce57d958e9d2cc27d5c4288
+SHA1 (patch-src_protocol_handshake.cc) = 2dd3fd81d014695987b8804a6089d476dc2cffa6
+SHA1 (patch-src_protocol_handshake__manager.h) = 3157a8b85ad095ab0aa45b9c3d9af12fe331801c
+SHA1 (patch-src_protocol_peer__connection__base.cc) = 245be083cc4f353de46bc2c8a29f8c21465cbae1
+SHA1 (patch-src_protocol_request__list.cc) = 4d7dc29d97797131a0191758e608b54f282f18c9
+SHA1 (patch-src_protocol_request__list.h) = 6be4e5d3e5c1305afb6a9be52eb379b9bec66c30
+SHA1 (patch-src_torrent_connection__manager.cc) = 5ac26b7c6993b025582d9f2d215284b47653ca60
+SHA1 (patch-src_torrent_connection__manager.h) = 880b492e8f823e84fba7204623bb1c171ec5651e
+SHA1 (patch-src_torrent_data_download__data.h) = f214774781572c647838373333d5a89221948184
+SHA1 (patch-src_torrent_data_file.cc) = 924a0172971a6ff89be6a2635e0fd6488b9c95c7
+SHA1 (patch-src_torrent_data_transfer__list.cc) = aa0984d834785ebc388ba647e64c29f30d606226
+SHA1 (patch-src_torrent_data_transfer__list.h) = 3fc3fe906ea1b48815a80efd884bbc323934a4e8
+SHA1 (patch-src_torrent_download.cc) = 63514f1fc6b4a7fe5420da181eceb84ab328e732
+SHA1 (patch-src_torrent_download__info.h) = b155e8f196c2aec6589bc842a5de862686c50ceb
+SHA1 (patch-src_torrent_download_choke__group.cc) = c77d108edfa5b36c846391bf03bb6b8c26d524ad
+SHA1 (patch-src_torrent_download_choke__queue.cc) = 6a033c8e994f9e360cce50886db6fd78cdffed00
+SHA1 (patch-src_torrent_download_choke__queue.h) = a7e52b43cf8d2ea4657c9eac25d972f11161447f
+SHA1 (patch-src_torrent_download_group__entry.h) = eeb6fa890fb96baa110ca53a06118c91e9ea7b4c
+SHA1 (patch-src_torrent_download_resource__manager.cc) = 32f6bf85757b7cdf22c7a641ec8c5d8268235152
+SHA1 (patch-src_torrent_http.h) = 70d3ab1496abb63b14e079cef48e2ef6be2faf7b
+SHA1 (patch-src_torrent_peer_client__list.cc) = 2bf4930c2b11d94d96d035a801aadd4d18f9b8ef
+SHA1 (patch-src_torrent_peer_connection__list.cc) = 9a3e9f0c84e8985c6723af491868601d8441f635
+SHA1 (patch-src_torrent_peer_connection__list.h) = a355b36399e38b223450fec3df08792ae8319834
+SHA1 (patch-src_torrent_poll.h) = 383fd6bb2aaac5de5c99cfc80c80b70f8d78fc73
+SHA1 (patch-src_torrent_poll__kqueue.cc) = 294822d85d2a7018c4af9a14d1a5da08f5e9ee4c
+SHA1 (patch-src_torrent_tracker__controller.cc) = e68795f041fa2acd4bb1b8b98d9b3070ee4e6012
+SHA1 (patch-src_torrent_tracker__controller.h) = 8ee41f4e536be4ef21883b8a84e70f886f951e2b
+SHA1 (patch-src_torrent_tracker__list.cc) = a48d20180f08cc5aede25d2b9d0e4a99c19bd29a
+SHA1 (patch-src_torrent_tracker__list.h) = 1b58551c33ef1fa6aeed755a80f654bd1264766c
+SHA1 (patch-src_torrent_utils_extents.h) = cb528a35cbf9d8e609bf5901f3e3bd5dd4c0417f
+SHA1 (patch-src_torrent_utils_log.cc) = 8836ab1bd58b16ea9975fd475b1d638b1db23e16
+SHA1 (patch-src_torrent_utils_log.h) = be360bda5adbc4095cdcc576efe656252f893207
+SHA1 (patch-src_torrent_utils_log__buffer.cc) = 280a497645e01386bb316453e67b4bed268f7081
+SHA1 (patch-src_torrent_utils_log__buffer.h) = baa1fd2c6c614c4483c78d50fea7efecff3bf759
+SHA1 (patch-src_torrent_utils_net.h) = 80c9649107b28fb22a4f2f9f13fa4d596d5d1fb6
+SHA1 (patch-src_torrent_utils_signal__bitfield.h) = 2220cc38d26661f30c3c26e7fae23ba23e3b8147
+SHA1 (patch-src_torrent_utils_thread__base.h) = 33bec58dd6d897b06baa2812dbd871c6b099362e
+SHA1 (patch-src_tracker_tracker__http.cc) = d293547e142b06c60bb5a499f2f2b0c445ebe211
+SHA1 (patch-src_tracker_tracker__udp.cc) = 2c320d0928c6e8580cc4fe6074a777077b03128a
+SHA1 (patch-src_utils_instrumentation.cc) = ba7df2a61068005139cf65c6258b739ae13d5c3a
+SHA1 (patch-src_utils_instrumentation.h) = d440205b4a1ae59f2422dc65bcd9b3b26f0a7958
+SHA1 (patch-src_utils_queue__buckets.h) = 1c3cfa2eed857e886cd37bd1b67d2cee84d87ddd
Index: net/libtorrent/patches/patch-rak_priority__queue__default.h
===================================================================
RCS file: net/libtorrent/patches/patch-rak_priority__queue__default.h
diff -N net/libtorrent/patches/patch-rak_priority__queue__default.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-rak_priority__queue__default.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,32 @@
+$NetBSD$
+
+--- rak/priority_queue_default.h.orig	2015-10-09 16:51:04.000000000 +0000
++++ rak/priority_queue_default.h
+@@ -37,7 +37,18 @@
+ #ifndef RAK_PRIORITY_QUEUE_DEFAULT_H
+ #define RAK_PRIORITY_QUEUE_DEFAULT_H
+ 
++#include <ciso646>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace rak {
++  using std::function;
++}
++#else
+ #include <tr1/functional>
++namespace rak {
++  using std::tr1::function;
++}
++#endif
+ #include <rak/allocators.h>
+ #include <rak/priority_queue.h>
+ #include <rak/timer.h>
+@@ -48,7 +59,7 @@ namespace rak {
+ 
+ class priority_item {
+ public:
+-  typedef std::tr1::function<void (void)> slot_void;
++  typedef function<void (void)> slot_void;
+ 
+   priority_item() {}
+   ~priority_item() {
Index: net/libtorrent/patches/patch-src_data_chunk__list.h
===================================================================
RCS file: net/libtorrent/patches/patch-src_data_chunk__list.h
diff -N net/libtorrent/patches/patch-src_data_chunk__list.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_data_chunk__list.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,35 @@
+$NetBSD$
+
+--- src/data/chunk_list.h.orig	2015-10-09 16:51:04.000000000 +0000
++++ src/data/chunk_list.h
+@@ -39,7 +39,17 @@
+ 
+ #include <string>
+ #include <vector>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::function;
++}
++#else
+ #include <tr1/functional>
++namespace torrent {
++  using std::tr1::function;
++}
++#endif
+ 
+ #include "chunk.h"
+ #include "chunk_handle.h"
+@@ -59,9 +69,9 @@ public:
+   typedef std::vector<ChunkListNode>          base_type;
+   typedef std::vector<ChunkListNode*>         Queue;
+ 
+-  typedef std::tr1::function<Chunk* (uint32_t, int)>    slot_chunk_index;
+-  typedef std::tr1::function<uint64_t ()>               slot_value;
+-  typedef std::tr1::function<void (const std::string&)> slot_string;
++  typedef function<Chunk* (uint32_t, int)>    slot_chunk_index;
++  typedef function<uint64_t ()>               slot_value;
++  typedef function<void (const std::string&)> slot_string;
+ 
+   using base_type::value_type;
+   using base_type::reference;
Index: net/libtorrent/patches/patch-src_data_hash__check__queue.h
===================================================================
RCS file: net/libtorrent/patches/patch-src_data_hash__check__queue.h
diff -N net/libtorrent/patches/patch-src_data_hash__check__queue.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_data_hash__check__queue.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,31 @@
+$NetBSD$
+
+--- src/data/hash_check_queue.h.orig	2015-10-09 16:51:04.000000000 +0000
++++ src/data/hash_check_queue.h
+@@ -39,7 +39,17 @@
+ 
+ #include <deque>
+ #include <pthread.h>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::function;
++}
++#else
+ #include <tr1/functional>
++namespace torrent {
++  using std::tr1::function;
++}
++#endif
+ 
+ #include "rak/allocators.h"
+ 
+@@ -51,7 +61,7 @@ class HashChunk;
+ class lt_cacheline_aligned HashCheckQueue : private std::deque<HashChunk*, rak::cacheline_allocator<HashChunk*> > {
+ public:
+   typedef std::deque<HashChunk*, rak::cacheline_allocator<HashChunk*> > base_type;
+-  typedef std::tr1::function<void (HashChunk*, const HashString&)>      slot_chunk_handle;
++  typedef function<void (HashChunk*, const HashString&)>      slot_chunk_handle;
+ 
+   using base_type::iterator;
+ 
Index: net/libtorrent/patches/patch-src_data_hash__queue.cc
===================================================================
RCS file: net/libtorrent/patches/patch-src_data_hash__queue.cc
diff -N net/libtorrent/patches/patch-src_data_hash__queue.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_data_hash__queue.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,46 @@
+$NetBSD$
+
+--- src/data/hash_queue.cc.orig	2015-10-09 17:54:34.000000000 +0000
++++ src/data/hash_queue.cc
+@@ -57,7 +57,19 @@
+ #define LT_LOG_DATA(data, log_level, log_fmt, ...)                       \
+   lt_log_print_data(LOG_STORAGE_##log_level, data, "hash_queue", log_fmt, __VA_ARGS__);
+ 
+-namespace tr1 { using namespace std::tr1; }
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::bind;
++  namespace placeholders { using namespace std::placeholders; }
++}
++#else
++#include <tr1/functional>
++namespace torrent {
++  using std::tr1::bind;
++  namespace placeholders { using namespace std::tr1::placeholders; }
++}
++#endif
+ 
+ namespace torrent {
+ 
+@@ -87,7 +99,7 @@ HashQueue::HashQueue(thread_disk* thread
+   m_thread_disk(thread) {
+ 
+   pthread_mutex_init(&m_done_chunks_lock, NULL);
+-  m_thread_disk->hash_queue()->slot_chunk_done() = tr1::bind(&HashQueue::chunk_done, this, tr1::placeholders::_1, tr1::placeholders::_2);
++  m_thread_disk->hash_queue()->slot_chunk_done() = bind(&HashQueue::chunk_done, this, placeholders::_1, placeholders::_2);
+ }
+ 
+ 
+@@ -176,9 +188,9 @@ HashQueue::work() {
+     // TODO: This is not optimal as we jump around... Check for front
+     // of HashQueue in done_chunks instead.
+ 
+-    iterator itr = std::find_if(begin(), end(), tr1::bind(std::equal_to<HashChunk*>(),
++    iterator itr = std::find_if(begin(), end(), bind(std::equal_to<HashChunk*>(),
+                                                           hash_chunk,
+-                                                          tr1::bind(&HashQueueNode::get_chunk, tr1::placeholders::_1)));
++                                                          bind(&HashQueueNode::get_chunk, placeholders::_1)));
+ 
+     // TODO: Fix this...
+     if (itr == end())
Index: net/libtorrent/patches/patch-src_data_hash__queue.h
===================================================================
RCS file: net/libtorrent/patches/patch-src_data_hash__queue.h
diff -N net/libtorrent/patches/patch-src_data_hash__queue.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_data_hash__queue.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,31 @@
+$NetBSD$
+
+--- src/data/hash_queue.h.orig	2015-10-09 16:51:04.000000000 +0000
++++ src/data/hash_queue.h
+@@ -40,7 +40,17 @@
+ #include <deque>
+ #include <map>
+ #include <pthread.h>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::function;
++}
++#else
+ #include <tr1/functional>
++namespace torrent {
++  using std::tr1::function;
++}
++#endif
+ 
+ #include "torrent/hash_string.h"
+ #include "hash_queue_node.h"
+@@ -63,7 +73,7 @@ public:
+   typedef std::map<HashChunk*, torrent::HashString> done_chunks_type;
+ 
+   typedef HashQueueNode::slot_done_type   slot_done_type;
+-  typedef std::tr1::function<void (bool)> slot_bool;
++  typedef function<void (bool)> slot_bool;
+ 
+   using base_type::iterator;
+ 
Index: net/libtorrent/patches/patch-src_data_hash__queue__node.h
===================================================================
RCS file: net/libtorrent/patches/patch-src_data_hash__queue__node.h
diff -N net/libtorrent/patches/patch-src_data_hash__queue__node.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_data_hash__queue__node.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,31 @@
+$NetBSD$
+
+--- src/data/hash_queue_node.h.orig	2014-05-14 14:18:48.000000000 +0000
++++ src/data/hash_queue_node.h
+@@ -38,7 +38,17 @@
+ #define LIBTORRENT_DATA_HASH_QUEUE_NODE_H
+ 
+ #include <string>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::function;
++}
++#else
+ #include <tr1/functional>
++namespace torrent {
++  using std::tr1::function;
++}
++#endif
+ #include <inttypes.h>
+ 
+ #include "chunk_handle.h"
+@@ -50,7 +60,7 @@ class download_data;
+ 
+ class HashQueueNode {
+ public:
+-  typedef std::tr1::function<void (ChunkHandle, const char*)> slot_done_type;
++  typedef function<void (ChunkHandle, const char*)> slot_done_type;
+   typedef download_data* id_type;
+ 
+   HashQueueNode(id_type id, HashChunk* c, slot_done_type d) :
Index: net/libtorrent/patches/patch-src_data_hash__torrent.h
===================================================================
RCS file: net/libtorrent/patches/patch-src_data_hash__torrent.h
diff -N net/libtorrent/patches/patch-src_data_hash__torrent.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_data_hash__torrent.h	10 Oct 2015 18:48:56 -0000
@@ -0,0 +1,31 @@
+$NetBSD$
+
+--- src/data/hash_torrent.h.orig	2014-05-14 14:18:48.000000000 +0000
++++ src/data/hash_torrent.h
+@@ -39,7 +39,17 @@
+ 
+ #include <string>
+ #include <inttypes.h>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::function;
++}
++#else
+ #include <tr1/functional>
++namespace torrent {
++  using std::tr1::function;
++}
++#endif
+ #include <rak/priority_queue_default.h>
+ 
+ #include "data/chunk_handle.h"
+@@ -53,7 +63,7 @@ class HashTorrent {
+ public:
+   typedef ranges<uint32_t> Ranges;
+ 
+-  typedef std::tr1::function<void (ChunkHandle)> slot_chunk_handle;
++  typedef function<void (ChunkHandle)> slot_chunk_handle;
+ 
+   HashTorrent(ChunkList* c);
+   ~HashTorrent() { clear(); }
Index: net/libtorrent/patches/patch-src_dht_dht__router.cc
===================================================================
RCS file: net/libtorrent/patches/patch-src_dht_dht__router.cc
diff -N net/libtorrent/patches/patch-src_dht_dht__router.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_dht_dht__router.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,41 @@
+$NetBSD$
+
+--- src/dht/dht_router.cc.orig	2015-10-09 17:55:38.000000000 +0000
++++ src/dht/dht_router.cc
+@@ -51,6 +51,18 @@
+ #include "dht_tracker.h"
+ #include "dht_transaction.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::bind;
++}
++#else
++#include <tr1/functional>
++namespace torrent {
++  using std::tr1::bind;
++}
++#endif
++
+ namespace torrent {
+ 
+ HashString DhtRouter::zero_id;
+@@ -137,7 +149,7 @@ DhtRouter::start(int port) {
+   m_server.start(port);
+ 
+   // Set timeout slot and schedule it to be called immediately for initial bootstrapping if necessary.
+-  m_taskTimeout.slot() = std::tr1::bind(&DhtRouter::receive_timeout_bootstrap, this);
++  m_taskTimeout.slot() = bind(&DhtRouter::receive_timeout_bootstrap, this);
+   priority_queue_insert(&taskScheduler, &m_taskTimeout, (cachedTime + rak::timer::from_seconds(1)).round_seconds());
+ }
+ 
+@@ -416,7 +428,7 @@ DhtRouter::receive_timeout_bootstrap() {
+     delete m_contacts;
+     m_contacts = NULL;
+ 
+-    m_taskTimeout.slot() = std::tr1::bind(&DhtRouter::receive_timeout, this);
++    m_taskTimeout.slot() = bind(&DhtRouter::receive_timeout, this);
+ 
+     if (!m_numRefresh) {
+       // If we're still in the startup, do the usual refreshing too.
Index: net/libtorrent/patches/patch-src_dht_dht__server.cc
===================================================================
RCS file: net/libtorrent/patches/patch-src_dht_dht__server.cc
diff -N net/libtorrent/patches/patch-src_dht_dht__server.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_dht_dht__server.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,36 @@
+$NetBSD$
+
+--- src/dht/dht_server.cc.orig	2015-10-09 17:57:00.000000000 +0000
++++ src/dht/dht_server.cc
+@@ -57,6 +57,18 @@
+ 
+ #include "manager.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::bind;
++}
++#else
++#include <tr1/functional>
++namespace torrent {
++  using std::tr1::bind;
++}
++#endif
++
+ namespace torrent {
+ 
+ const char* DhtServer::queries[] = {
+@@ -155,10 +167,10 @@ DhtServer::start(int port) {
+     throw;
+   }
+ 
+-  m_taskTimeout.slot() = std::tr1::bind(&DhtServer::receive_timeout, this);
++  m_taskTimeout.slot() = bind(&DhtServer::receive_timeout, this);
+ 
+   m_uploadNode.set_list_iterator(m_uploadThrottle->end());
+-  m_uploadNode.slot_activate() = std::tr1::bind(&SocketBase::receive_throttle_up_activate, static_cast<SocketBase*>(this));
++  m_uploadNode.slot_activate() = bind(&SocketBase::receive_throttle_up_activate, static_cast<SocketBase*>(this));
+ 
+   m_downloadNode.set_list_iterator(m_downloadThrottle->end());
+   m_downloadThrottle->insert(&m_downloadNode);
Index: net/libtorrent/patches/patch-src_download_delegator.h
===================================================================
RCS file: net/libtorrent/patches/patch-src_download_delegator.h
diff -N net/libtorrent/patches/patch-src_download_delegator.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_download_delegator.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,33 @@
+$NetBSD$
+
+--- src/download/delegator.h.orig	2015-10-09 16:51:04.000000000 +0000
++++ src/download/delegator.h
+@@ -39,7 +39,17 @@
+ 
+ #include <string>
+ #include <vector>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::function;
++}
++#else
+ #include <tr1/functional>
++namespace torrent {
++  using std::tr1::function;
++}
++#endif
+ 
+ #include "torrent/data/transfer_list.h"
+ 
+@@ -54,8 +64,8 @@ class PeerInfo;
+ 
+ class Delegator {
+ public:
+-  typedef std::tr1::function<uint32_t (PeerChunks*, bool)> slot_peer_chunk;
+-  typedef std::tr1::function<uint32_t (uint32_t)>          slot_size;
++  typedef function<uint32_t (PeerChunks*, bool)> slot_peer_chunk;
++  typedef function<uint32_t (uint32_t)>          slot_size;
+ 
+   static const unsigned int block_size = 1 << 14;
+ 
Index: net/libtorrent/patches/patch-src_download_download__main.cc
===================================================================
RCS file: net/libtorrent/patches/patch-src_download_download__main.cc
diff -N net/libtorrent/patches/patch-src_download_download__main.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_download_download__main.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,74 @@
+$NetBSD$
+
+--- src/download/download_main.cc.orig	2015-10-09 17:59:38.000000000 +0000
++++ src/download/download_main.cc
+@@ -65,11 +65,23 @@
+ #include "download_main.h"
+ #include "download_wrapper.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::bind;
++  namespace placeholders { using namespace std::placeholders; }
++}
++#else
++#include <tr1/functional>
++namespace torrent {
++  using std::tr1::bind;
++  namespace placeholders { using namespace std::tr1::placeholders; }
++}
++#endif
++
+ #define LT_LOG_THIS(log_level, log_fmt, ...)                         \
+   lt_log_print_info(LOG_TORRENT_##log_level, m_ptr->info(), "download", log_fmt, __VA_ARGS__);
+ 
+-namespace tr1 { using namespace std::tr1; }
+-
+ namespace torrent {
+ 
+ DownloadInfo::DownloadInfo() :
+@@ -107,28 +119,28 @@ DownloadMain::DownloadMain() :
+   m_tracker_list = new TrackerList();
+   m_tracker_controller = new TrackerController(m_tracker_list);
+ 
+-  m_tracker_list->slot_success() = tr1::bind(&TrackerController::receive_success, m_tracker_controller, tr1::placeholders::_1, tr1::placeholders::_2);
+-  m_tracker_list->slot_failure() = tr1::bind(&TrackerController::receive_failure, m_tracker_controller, tr1::placeholders::_1, tr1::placeholders::_2);
+-  m_tracker_list->slot_scrape_success() = tr1::bind(&TrackerController::receive_scrape, m_tracker_controller, tr1::placeholders::_1);
+-  m_tracker_list->slot_tracker_enabled()  = tr1::bind(&TrackerController::receive_tracker_enabled, m_tracker_controller, tr1::placeholders::_1);
+-  m_tracker_list->slot_tracker_disabled() = tr1::bind(&TrackerController::receive_tracker_disabled, m_tracker_controller, tr1::placeholders::_1);
++  m_tracker_list->slot_success() = bind(&TrackerController::receive_success, m_tracker_controller, placeholders::_1, placeholders::_2);
++  m_tracker_list->slot_failure() = bind(&TrackerController::receive_failure, m_tracker_controller, placeholders::_1, placeholders::_2);
++  m_tracker_list->slot_scrape_success() = bind(&TrackerController::receive_scrape, m_tracker_controller, placeholders::_1);
++  m_tracker_list->slot_tracker_enabled()  = bind(&TrackerController::receive_tracker_enabled, m_tracker_controller, placeholders::_1);
++  m_tracker_list->slot_tracker_disabled() = bind(&TrackerController::receive_tracker_disabled, m_tracker_controller, placeholders::_1);
+ 
+   m_connectionList = new ConnectionList(this);
+ 
+-  m_delegator.slot_chunk_find() = std::tr1::bind(&ChunkSelector::find, m_chunkSelector, tr1::placeholders::_1, tr1::placeholders::_2);
+-  m_delegator.slot_chunk_size() = std::tr1::bind(&FileList::chunk_index_size, file_list(), tr1::placeholders::_1);
++  m_delegator.slot_chunk_find() = bind(&ChunkSelector::find, m_chunkSelector, placeholders::_1, placeholders::_2);
++  m_delegator.slot_chunk_size() = bind(&FileList::chunk_index_size, file_list(), placeholders::_1);
+ 
+-  m_delegator.transfer_list()->slot_canceled()  = std::tr1::bind(&ChunkSelector::not_using_index, m_chunkSelector, tr1::placeholders::_1);
+-  m_delegator.transfer_list()->slot_queued()    = std::tr1::bind(&ChunkSelector::using_index, m_chunkSelector, tr1::placeholders::_1);
+-  m_delegator.transfer_list()->slot_completed() = std::tr1::bind(&DownloadMain::receive_chunk_done, this, tr1::placeholders::_1);
+-  m_delegator.transfer_list()->slot_corrupt()   = std::tr1::bind(&DownloadMain::receive_corrupt_chunk, this, tr1::placeholders::_1);
++  m_delegator.transfer_list()->slot_canceled()  = bind(&ChunkSelector::not_using_index, m_chunkSelector, placeholders::_1);
++  m_delegator.transfer_list()->slot_queued()    = bind(&ChunkSelector::using_index, m_chunkSelector, placeholders::_1);
++  m_delegator.transfer_list()->slot_completed() = bind(&DownloadMain::receive_chunk_done, this, placeholders::_1);
++  m_delegator.transfer_list()->slot_corrupt()   = bind(&DownloadMain::receive_corrupt_chunk, this, placeholders::_1);
+ 
+-  m_delayDisconnectPeers.slot() = std::tr1::bind(&ConnectionList::disconnect_queued, m_connectionList);
+-  m_taskTrackerRequest.slot() = std::tr1::bind(&DownloadMain::receive_tracker_request, this);
++  m_delayDisconnectPeers.slot() = bind(&ConnectionList::disconnect_queued, m_connectionList);
++  m_taskTrackerRequest.slot() = bind(&DownloadMain::receive_tracker_request, this);
+ 
+   m_chunkList->set_data(file_list()->mutable_data());
+-  m_chunkList->slot_create_chunk() = tr1::bind(&FileList::create_chunk_index, file_list(), tr1::placeholders::_1, tr1::placeholders::_2);
+-  m_chunkList->slot_free_diskspace() = tr1::bind(&FileList::free_diskspace, file_list());
++  m_chunkList->slot_create_chunk() = bind(&FileList::create_chunk_index, file_list(), placeholders::_1, placeholders::_2);
++  m_chunkList->slot_free_diskspace() = bind(&FileList::free_diskspace, file_list());
+ }
+ 
+ DownloadMain::~DownloadMain() {
Index: net/libtorrent/patches/patch-src_download_download__wrapper.cc
===================================================================
RCS file: net/libtorrent/patches/patch-src_download_download__wrapper.cc
diff -N net/libtorrent/patches/patch-src_download_download__wrapper.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_download_download__wrapper.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,80 @@
+$NetBSD$
+
+--- src/download/download_wrapper.cc.orig	2015-10-09 18:02:09.000000000 +0000
++++ src/download/download_wrapper.cc
+@@ -62,11 +62,23 @@
+ 
+ #include "download_wrapper.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::bind;
++  namespace placeholders { using namespace std::placeholders; }
++}
++#else
++#include <tr1/functional>
++namespace torrent {
++  using std::tr1::bind;
++  namespace placeholders { using namespace std::tr1::placeholders; }
++}
++#endif
++
+ #define LT_LOG_STORAGE_ERRORS(log_fmt, ...)                             \
+   lt_log_print_info(LOG_PROTOCOL_STORAGE_ERRORS, this->info(), "storage_errors", log_fmt, __VA_ARGS__);
+ 
+-namespace tr1 { using namespace std::tr1; }
+-
+ namespace torrent {
+ 
+ DownloadWrapper::DownloadWrapper() :
+@@ -76,14 +88,14 @@ DownloadWrapper::DownloadWrapper() :
+   m_hashChecker(NULL),
+   m_connectionType(0) {
+ 
+-  m_main->delay_download_done().slot() = std::tr1::bind(&download_data::call_download_done, data());
++  m_main->delay_download_done().slot() = bind(&download_data::call_download_done, data());
+ 
+   m_main->peer_list()->set_info(info());
+   m_main->tracker_list()->set_info(info());
+-  m_main->tracker_controller()->slot_success() = tr1::bind(&DownloadWrapper::receive_tracker_success, this, tr1::placeholders::_1);
+-  m_main->tracker_controller()->slot_failure() = tr1::bind(&DownloadWrapper::receive_tracker_failed, this, tr1::placeholders::_1);
++  m_main->tracker_controller()->slot_success() = bind(&DownloadWrapper::receive_tracker_success, this, placeholders::_1);
++  m_main->tracker_controller()->slot_failure() = bind(&DownloadWrapper::receive_tracker_failed, this, placeholders::_1);
+ 
+-  m_main->chunk_list()->slot_storage_error() = tr1::bind(&DownloadWrapper::receive_storage_error, this, tr1::placeholders::_1);
++  m_main->chunk_list()->slot_storage_error() = bind(&DownloadWrapper::receive_storage_error, this, placeholders::_1);
+ }
+ 
+ DownloadWrapper::~DownloadWrapper() {
+@@ -112,8 +124,8 @@ DownloadWrapper::initialize(const std::s
+ 
+   info()->mutable_local_id().assign(id.c_str());
+ 
+-  info()->slot_left()      = tr1::bind(&FileList::left_bytes, m_main->file_list());
+-  info()->slot_completed() = tr1::bind(&FileList::completed_bytes, m_main->file_list());
++  info()->slot_left()      = bind(&FileList::left_bytes, m_main->file_list());
++  info()->slot_completed() = bind(&FileList::completed_bytes, m_main->file_list());
+ 
+   file_list()->mutable_data()->mutable_hash().assign(hash.c_str());
+ 
+@@ -123,8 +135,8 @@ DownloadWrapper::initialize(const std::s
+   m_hashChecker = new HashTorrent(m_main->chunk_list());
+ 
+   // Connect various signals and slots.
+-  m_hashChecker->slot_check_chunk() = std::tr1::bind(&DownloadWrapper::check_chunk_hash, this, std::tr1::placeholders::_1);
+-  m_hashChecker->delay_checked().slot() = std::tr1::bind(&DownloadWrapper::receive_initial_hash, this);
++  m_hashChecker->slot_check_chunk() = bind(&DownloadWrapper::check_chunk_hash, this, placeholders::_1);
++  m_hashChecker->delay_checked().slot() = bind(&DownloadWrapper::receive_initial_hash, this);
+ }
+ 
+ void
+@@ -240,7 +252,7 @@ DownloadWrapper::check_chunk_hash(ChunkH
+   ChunkHandle new_handle = m_main->chunk_list()->get(handle.index(), ChunkList::get_blocking);
+   m_main->chunk_list()->release(&handle);
+ 
+-  hash_queue()->push_back(new_handle, data(), tr1::bind(&DownloadWrapper::receive_hash_done, this, tr1::placeholders::_1, tr1::placeholders::_2));
++  hash_queue()->push_back(new_handle, data(), bind(&DownloadWrapper::receive_hash_done, this, placeholders::_1, placeholders::_2));
+ }
+ 
+ void
Index: net/libtorrent/patches/patch-src_manager.cc
===================================================================
RCS file: net/libtorrent/patches/patch-src_manager.cc
diff -N net/libtorrent/patches/patch-src_manager.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_manager.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,54 @@
+$NetBSD$
+
+--- src/manager.cc.orig	2015-10-09 18:29:11.000000000 +0000
++++ src/manager.cc
+@@ -60,7 +60,19 @@
+ 
+ #include "manager.h"
+ 
+-namespace tr1 { using namespace std::tr1; }
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::bind;
++  namespace placeholders { using namespace std::placeholders; }
++}
++#else
++#include <tr1/functional>
++namespace torrent {
++  using std::tr1::bind;
++  namespace placeholders { using namespace std::tr1::placeholders; }
++}
++#endif
+ 
+ namespace torrent {
+ 
+@@ -84,21 +96,21 @@ Manager::Manager() :
+ 
+   m_hashQueue = new HashQueue(&m_main_thread_disk);
+   m_hashQueue->slot_has_work() =
+-    tr1::bind(&thread_base::send_event_signal,
++    bind(&thread_base::send_event_signal,
+               &m_main_thread_main,
+-              m_main_thread_main.signal_bitfield()->add_signal(tr1::bind(&HashQueue::work, m_hashQueue)),
+-              tr1::placeholders::_1);
++              m_main_thread_main.signal_bitfield()->add_signal(bind(&HashQueue::work, m_hashQueue)),
++              placeholders::_1);
+ 
+-  m_taskTick.slot() = std::tr1::bind(&Manager::receive_tick, this);
++  m_taskTick.slot() = bind(&Manager::receive_tick, this);
+ 
+   priority_queue_insert(&taskScheduler, &m_taskTick, cachedTime.round_seconds());
+ 
+   m_handshakeManager->slot_download_id() =
+-    std::tr1::bind(&DownloadManager::find_main, m_downloadManager, std::tr1::placeholders::_1);
++    bind(&DownloadManager::find_main, m_downloadManager, placeholders::_1);
+   m_handshakeManager->slot_download_obfuscated() =
+-    std::tr1::bind(&DownloadManager::find_main_obfuscated, m_downloadManager, std::tr1::placeholders::_1);
++    bind(&DownloadManager::find_main_obfuscated, m_downloadManager, placeholders::_1);
+   m_connectionManager->listen()->slot_accepted() =
+-    std::tr1::bind(&HandshakeManager::add_incoming, m_handshakeManager, std::tr1::placeholders::_1, std::tr1::placeholders::_2);
++    bind(&HandshakeManager::add_incoming, m_handshakeManager, placeholders::_1, placeholders::_2);
+ 
+   // m_resourceManager->push_group("default");
+   // m_resourceManager->group_back()->up_queue()->set_heuristics(choke_queue::HEURISTICS_UPLOAD_LEECH);
Index: net/libtorrent/patches/patch-src_net_listen.h
===================================================================
RCS file: net/libtorrent/patches/patch-src_net_listen.h
diff -N net/libtorrent/patches/patch-src_net_listen.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_net_listen.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,32 @@
+$NetBSD$
+
+--- src/net/listen.h.orig	2015-10-09 16:51:04.000000000 +0000
++++ src/net/listen.h
+@@ -38,7 +38,18 @@
+ #define LIBTORRENT_LISTEN_H
+ 
+ #include <inttypes.h>
++#include <ciso646>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::function;
++}
++#else
+ #include <tr1/functional>
++namespace torrent {
++  using std::tr1::function;
++}
++#endif
+ #include <rak/socket_address.h>
+ 
+ #include "socket_base.h"
+@@ -48,7 +59,7 @@ namespace torrent {
+ 
+ class Listen : public SocketBase {
+ public:
+-  typedef std::tr1::function<void (SocketFd, const rak::socket_address&)> slot_connection;
++  typedef function<void (SocketFd, const rak::socket_address&)> slot_connection;
+ 
+   Listen() : m_port(0) {}
+   ~Listen() { close(); }
Index: net/libtorrent/patches/patch-src_net_socket__set.h
===================================================================
RCS file: net/libtorrent/patches/patch-src_net_socket__set.h
diff -N net/libtorrent/patches/patch-src_net_socket__set.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_net_socket__set.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,20 @@
+$NetBSD$
+
+--- src/net/socket_set.h.orig	2015-10-09 17:48:45.000000000 +0000
++++ 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);
+ 
Index: net/libtorrent/patches/patch-src_net_throttle__internal.cc
===================================================================
RCS file: net/libtorrent/patches/patch-src_net_throttle__internal.cc
diff -N net/libtorrent/patches/patch-src_net_throttle__internal.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_net_throttle__internal.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,32 @@
+$NetBSD$
+
+--- src/net/throttle_internal.cc.orig	2015-10-09 18:05:30.000000000 +0000
++++ src/net/throttle_internal.cc
+@@ -47,6 +47,18 @@
+ 
+ #include "globals.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::bind;
++}
++#else
++#include <tr1/functional>
++namespace torrent {
++  using std::tr1::bind;
++}
++#endif
++
+ namespace torrent {
+ 
+ // Plans:
+@@ -62,7 +74,7 @@ ThrottleInternal::ThrottleInternal(int f
+   m_timeLastTick(cachedTime) {
+ 
+   if (is_root())
+-    m_taskTick.slot() = std::tr1::bind(&ThrottleInternal::receive_tick, this);
++    m_taskTick.slot() = bind(&ThrottleInternal::receive_tick, this);
+ }
+ 
+ ThrottleInternal::~ThrottleInternal() {
Index: net/libtorrent/patches/patch-src_net_throttle__node.h
===================================================================
RCS file: net/libtorrent/patches/patch-src_net_throttle__node.h
diff -N net/libtorrent/patches/patch-src_net_throttle__node.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_net_throttle__node.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,32 @@
+$NetBSD$
+
+--- src/net/throttle_node.h.orig	2015-10-09 16:51:04.000000000 +0000
++++ src/net/throttle_node.h
+@@ -37,7 +37,18 @@
+ #ifndef LIBTORRENT_NET_THROTTLE_NODE_H
+ #define LIBTORRENT_NET_THROTTLE_NODE_H
+ 
++#include <ciso646>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::function;
++}
++#else
+ #include <tr1/functional>
++namespace torrent {
++  using std::tr1::function;
++}
++#endif
+ 
+ #include "torrent/rate.h"
+ 
+@@ -52,7 +63,7 @@ public:
+   typedef ThrottleList::iterator                  iterator;
+   typedef ThrottleList::const_iterator            const_iterator;
+ 
+-  typedef std::tr1::function<void ()> slot_void;
++  typedef function<void ()> slot_void;
+ 
+   ThrottleNode(uint32_t rateSpan) : m_rate(rateSpan)  { clear_quota(); }
+ 
Index: net/libtorrent/patches/patch-src_protocol_handshake.cc
===================================================================
RCS file: net/libtorrent/patches/patch-src_protocol_handshake.cc
diff -N net/libtorrent/patches/patch-src_protocol_handshake.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_protocol_handshake.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,32 @@
+$NetBSD$
+
+--- src/protocol/handshake.cc.orig	2015-10-09 18:07:25.000000000 +0000
++++ src/protocol/handshake.cc
+@@ -55,6 +55,18 @@
+ #include "handshake.h"
+ #include "handshake_manager.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::bind;
++}
++#else
++#include <tr1/functional>
++namespace torrent {
++  using std::tr1::bind;
++}
++#endif
++
+ namespace torrent {
+ 
+ const char* Handshake::m_protocol = "BitTorrent protocol";
+@@ -100,7 +112,7 @@ Handshake::Handshake(SocketFd fd, Handsh
+   m_writeBuffer.reset();      
+ 
+   m_taskTimeout.clear_time();
+-  m_taskTimeout.slot() = std::tr1::bind(&HandshakeManager::receive_timeout, m, this);
++  m_taskTimeout.slot() = bind(&HandshakeManager::receive_timeout, m, this);
+ }
+ 
+ Handshake::~Handshake() {
Index: net/libtorrent/patches/patch-src_protocol_handshake__manager.h
===================================================================
RCS file: net/libtorrent/patches/patch-src_protocol_handshake__manager.h
diff -N net/libtorrent/patches/patch-src_protocol_handshake__manager.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_protocol_handshake__manager.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,31 @@
+$NetBSD$
+
+--- src/protocol/handshake_manager.h.orig	2015-10-09 16:51:04.000000000 +0000
++++ src/protocol/handshake_manager.h
+@@ -39,7 +39,17 @@
+ 
+ #include <string>
+ #include <inttypes.h>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::function;
++}
++#else
+ #include <tr1/functional>
++namespace torrent {
++  using std::tr1::function;
++}
++#endif
+ #include <rak/functional.h>
+ #include <rak/unordered_vector.h>
+ #include <rak/socket_address.h>
+@@ -59,7 +69,7 @@ public:
+   typedef rak::unordered_vector<Handshake*> base_type;
+   typedef uint32_t                          size_type;
+ 
+-  typedef std::tr1::function<DownloadMain* (const char*)> slot_download;
++  typedef function<DownloadMain* (const char*)> slot_download;
+ 
+   // Do not connect to peers with this many or more failed chunks.
+   static const unsigned int max_failed = 3;
Index: net/libtorrent/patches/patch-src_protocol_peer__connection__base.cc
===================================================================
RCS file: net/libtorrent/patches/patch-src_protocol_peer__connection__base.cc
diff -N net/libtorrent/patches/patch-src_protocol_peer__connection__base.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_protocol_peer__connection__base.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,36 @@
+$NetBSD$
+
+--- src/protocol/peer_connection_base.cc.orig	2015-10-09 18:10:51.000000000 +0000
++++ src/protocol/peer_connection_base.cc
+@@ -68,6 +68,18 @@
+ 
+ #include "manager.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::bind;
++}
++#else
++#include <tr1/functional>
++namespace torrent {
++  using std::tr1::bind;
++}
++#endif
++
+ #define LT_LOG_PIECE_EVENTS(log_fmt, ...)                               \
+   lt_log_print_info(LOG_PROTOCOL_PIECE_EVENTS, this->download()->info(), "piece_events", "%40s " log_fmt, this->peer_info()->id_hex(), __VA_ARGS__);
+ 
+@@ -162,10 +174,10 @@ PeerConnectionBase::initialize(DownloadM
+   m_down->set_throttle(throttles.second);
+ 
+   m_peerChunks.upload_throttle()->set_list_iterator(m_up->throttle()->end());
+-  m_peerChunks.upload_throttle()->slot_activate() = std::tr1::bind(&SocketBase::receive_throttle_up_activate, static_cast<SocketBase*>(this));
++  m_peerChunks.upload_throttle()->slot_activate() = bind(&SocketBase::receive_throttle_up_activate, static_cast<SocketBase*>(this));
+ 
+   m_peerChunks.download_throttle()->set_list_iterator(m_down->throttle()->end());
+-  m_peerChunks.download_throttle()->slot_activate() = std::tr1::bind(&SocketBase::receive_throttle_down_activate, static_cast<SocketBase*>(this));
++  m_peerChunks.download_throttle()->slot_activate() = bind(&SocketBase::receive_throttle_down_activate, static_cast<SocketBase*>(this));
+ 
+   request_list()->set_delegator(m_download->delegator());
+   request_list()->set_peer_chunks(&m_peerChunks);
Index: net/libtorrent/patches/patch-src_protocol_request__list.cc
===================================================================
RCS file: net/libtorrent/patches/patch-src_protocol_request__list.cc
diff -N net/libtorrent/patches/patch-src_protocol_request__list.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_protocol_request__list.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- src/protocol/request_list.cc.orig	2015-10-09 19:21:04.000000000 +0000
++++ src/protocol/request_list.cc
+@@ -52,6 +52,8 @@
+ 
+ namespace torrent {
+ 
++const int request_list_constants::bucket_count;
++
+ const instrumentation_enum request_list_constants::instrumentation_added[bucket_count] = {
+   INSTRUMENTATION_TRANSFER_REQUESTS_QUEUED_ADDED,
+   INSTRUMENTATION_TRANSFER_REQUESTS_UNORDERED_ADDED,
Index: net/libtorrent/patches/patch-src_protocol_request__list.h
===================================================================
RCS file: net/libtorrent/patches/patch-src_protocol_request__list.h
diff -N net/libtorrent/patches/patch-src_protocol_request__list.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_protocol_request__list.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,33 @@
+$NetBSD$
+
+--- src/protocol/request_list.h.orig	2015-10-09 17:28:39.000000000 +0000
++++ src/protocol/request_list.h
+@@ -38,6 +38,17 @@
+ #define LIBTORRENT_REQUEST_LIST_H
+ 
+ #include <deque>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::bind;
++}
++#else
++#include <tr1/functional>
++namespace torrent {
++  using std::tr1::bind;
++}
++#endif
+ 
+ #include "torrent/data/block_transfer.h"
+ #include "utils/instrumentation.h"
+@@ -155,8 +166,8 @@ RequestList::RequestList() :
+   m_transfer(NULL),
+   m_affinity(-1),
+   m_last_unordered_position(0) {
+-  m_delay_remove_choked.slot() = std::tr1::bind(&RequestList::delay_remove_choked, this);
+-  m_delay_process_unordered.slot() = std::tr1::bind(&RequestList::delay_process_unordered, this);
++  m_delay_remove_choked.slot() = bind(&RequestList::delay_remove_choked, this);
++  m_delay_process_unordered.slot() = bind(&RequestList::delay_process_unordered, this);
+ }
+ 
+ // TODO: Make sure queued_size is never too small.
Index: net/libtorrent/patches/patch-src_torrent_connection__manager.cc
===================================================================
RCS file: net/libtorrent/patches/patch-src_torrent_connection__manager.cc
diff -N net/libtorrent/patches/patch-src_torrent_connection__manager.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_torrent_connection__manager.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,42 @@
+$NetBSD$
+
+--- src/torrent/connection_manager.cc.orig	2015-10-09 17:39:32.000000000 +0000
++++ src/torrent/connection_manager.cc
+@@ -48,7 +48,19 @@
+ #include "exceptions.h"
+ #include "manager.h"
+ 
+-namespace tr1 { using namespace std::tr1; }
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::bind;
++  namespace placeholders { using namespace std::placeholders; }
++}
++#else
++#include <tr1/functional>
++namespace torrent {
++  using std::tr1::bind;
++  namespace placeholders { using namespace std::tr1::placeholders; }
++}
++#endif
+ 
+ namespace torrent {
+ 
+@@ -102,11 +114,11 @@ ConnectionManager::ConnectionManager() :
+   m_proxyAddress = (new rak::socket_address())->c_sockaddr();
+   rak::socket_address::cast_from(m_proxyAddress)->sa_inet()->clear();
+ 
+-  m_slot_resolver = tr1::bind(&resolve_host,
+-                              tr1::placeholders::_1,
+-                              tr1::placeholders::_2,
+-                              tr1::placeholders::_3,
+-                              tr1::placeholders::_4);
++  m_slot_resolver = bind(&resolve_host,
++                              placeholders::_1,
++                              placeholders::_2,
++                              placeholders::_3,
++                              placeholders::_4);
+ }
+ 
+ ConnectionManager::~ConnectionManager() {
Index: net/libtorrent/patches/patch-src_torrent_connection__manager.h
===================================================================
RCS file: net/libtorrent/patches/patch-src_torrent_connection__manager.h
diff -N net/libtorrent/patches/patch-src_torrent_connection__manager.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_torrent_connection__manager.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,46 @@
+$NetBSD$
+
+--- src/torrent/connection_manager.h.orig	2015-10-09 16:51:04.000000000 +0000
++++ src/torrent/connection_manager.h
+@@ -41,12 +41,23 @@
+ #define LIBTORRENT_CONNECTION_MANAGER_H
+ 
+ #include <list>
++#include <ciso646>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::function;
++}
++#else
++#include <tr1/functional>
++namespace torrent {
++  using std::tr1::function;
++}
++#endif
+ #include <arpa/inet.h>
+ #include <netinet/in.h>
+ #include <netinet/in_systm.h>
+ #include <netinet/ip.h>
+ #include <sys/socket.h>
+-#include <tr1/functional>
+ #include <torrent/common.h>
+ 
+ namespace torrent {
+@@ -98,12 +109,12 @@ public:
+     handshake_retry_encrypted    = 9
+   };
+ 
+-  typedef std::tr1::function<uint32_t (const sockaddr*)>     slot_filter_type;
+-  typedef std::tr1::function<ThrottlePair (const sockaddr*)> slot_throttle_type;
++  typedef function<uint32_t (const sockaddr*)>     slot_filter_type;
++  typedef function<ThrottlePair (const sockaddr*)> slot_throttle_type;
+ 
+   // The sockaddr argument in the result slot call is NULL if the resolve failed, and the int holds the errno.
+-  typedef std::tr1::function<void (const sockaddr*, int)> slot_resolver_result_type;
+-  typedef std::tr1::function<slot_resolver_result_type* (const char*, int, int, slot_resolver_result_type)> slot_resolver_type;
++  typedef function<void (const sockaddr*, int)> slot_resolver_result_type;
++  typedef function<slot_resolver_result_type* (const char*, int, int, slot_resolver_result_type)> slot_resolver_type;
+ 
+   ConnectionManager();
+   ~ConnectionManager();
Index: net/libtorrent/patches/patch-src_torrent_data_download__data.h
===================================================================
RCS file: net/libtorrent/patches/patch-src_torrent_data_download__data.h
diff -N net/libtorrent/patches/patch-src_torrent_data_download__data.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_torrent_data_download__data.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,32 @@
+$NetBSD$
+
+--- src/torrent/data/download_data.h.orig	2015-10-09 16:51:04.000000000 +0000
++++ src/torrent/data/download_data.h
+@@ -37,7 +37,18 @@
+ #ifndef LIBTORRENT_DATA_DOWNLOAD_DATA_H
+ #define LIBTORRENT_DATA_DOWNLOAD_DATA_H
+ 
++#include <ciso646>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::function;
++}
++#else
+ #include <tr1/functional>
++namespace torrent {
++  using std::tr1::function;
++}
++#endif
+ 
+ #include <torrent/common.h>
+ #include <torrent/bitfield.h>
+@@ -57,7 +68,7 @@ public:
+ 
+   typedef void (function_void)(void);
+ 
+-  typedef std::tr1::function<function_void> slot_void;
++  typedef function<function_void> slot_void;
+ 
+   download_data() : m_wanted_chunks(0) {}
+ 
Index: net/libtorrent/patches/patch-src_torrent_data_file.cc
===================================================================
RCS file: net/libtorrent/patches/patch-src_torrent_data_file.cc
diff -N net/libtorrent/patches/patch-src_torrent_data_file.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_torrent_data_file.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,20 @@
+$NetBSD$
+
+--- src/torrent/data/file.cc.orig	2015-10-09 20:40:16.000000000 +0000
++++ src/torrent/data/file.cc
+@@ -50,6 +50,15 @@
+ 
+ namespace torrent {
+ 
++const int File::flag_active;
++const int File::flag_create_queued;
++const int File::flag_resize_queued;
++const int File::flag_fallocate;
++const int File::flag_previously_created;
++
++const int File::flag_prioritize_first;
++const int File::flag_prioritize_last;
++
+ File::File() :
+   m_fd(-1),
+   m_protection(0),
Index: net/libtorrent/patches/patch-src_torrent_data_transfer__list.cc
===================================================================
RCS file: net/libtorrent/patches/patch-src_torrent_data_transfer__list.cc
diff -N net/libtorrent/patches/patch-src_torrent_data_transfer__list.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_torrent_data_transfer__list.cc	10 Oct 2015 18:47:08 -0000
@@ -0,0 +1,33 @@
+$NetBSD$
+
+--- src/torrent/data/transfer_list.cc.orig	2015-10-09 17:24:32.000000000 +0000
++++ src/torrent/data/transfer_list.cc
+@@ -41,6 +41,19 @@
+ #include <set>
+ #include <rak/functional.h>
+ #include <rak/timer.h>
++#include <ciso646>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++namespace torrent {
++  using std::bind;
++  namespace placeholders { using namespace std::placeholders; }
++}
++#else
++#include <tr1/functional>
++namespace torrent {
++  using std::tr1::function;
++  namespace placeholders { using namespace std::tr1::placeholders; }
++}
++#endif
+ 
+ #include "data/chunk.h"
+ #include "peer/peer_info.h"
+@@ -78,7 +91,7 @@ TransferList::find(uint32_t index) const
+ 
+ void
+ TransferList::clear() {
+-  std::for_each(begin(), end(), std::tr1::bind(m_slot_canceled, std::tr1::bind(&BlockList::index, std::tr1::placeholders::_1)));
++  std::for_each(begin(), end(), bind(m_slot_canceled, bind(&BlockList::index, placeholders::_1)));
+   std::for_each(begin(), end(), rak::call_delete<BlockList>());
+ 
+   base_type::clear();
Index: net/libtorrent/patches/patch-src_torrent_data_transfer__list.h
===================================================================
RCS file: net/libtorrent/patches/patch-src_torrent_data_transfer__list.h
diff -N net/libtorrent/patches/patch-src_torrent_data_transfer__list.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_torrent_data_transfer__list.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,34 @@
+$NetBSD$
+
+--- src/torrent/data/transfer_list.h.orig	2015-10-09 16:51:04.000000000 +0000
++++ src/torrent/data/transfer_list.h
+@@ -39,7 +39,18 @@
+ 
+ #include <vector>
+ #include <torrent/common.h>
++#include <ciso646>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::function;
++}
++#else
+ #include <tr1/functional>
++namespace torrent {
++  using std::tr1::function;
++}
++#endif
+ 
+ namespace torrent {
+ 
+@@ -89,8 +100,8 @@ public:
+   void                hash_succeeded(uint32_t index, Chunk* chunk);
+   void                hash_failed(uint32_t index, Chunk* chunk);
+ 
+-  typedef std::tr1::function<void (uint32_t)>  slot_chunk_index;
+-  typedef std::tr1::function<void (PeerInfo*)> slot_peer_info;
++  typedef function<void (uint32_t)>  slot_chunk_index;
++  typedef function<void (PeerInfo*)> slot_peer_info;
+ 
+   slot_chunk_index&   slot_canceled()  { return m_slot_canceled; }
+   slot_chunk_index&   slot_completed() { return m_slot_completed; }
Index: net/libtorrent/patches/patch-src_torrent_download.cc
===================================================================
RCS file: net/libtorrent/patches/patch-src_torrent_download.cc
diff -N net/libtorrent/patches/patch-src_torrent_download.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_torrent_download.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,21 @@
+$NetBSD$
+
+--- src/torrent/download.cc.orig	2015-10-09 20:52:56.000000000 +0000
++++ src/torrent/download.cc
+@@ -72,6 +72,16 @@
+ 
+ namespace torrent {
+ 
++const int DownloadInfo::flag_open;
++const int DownloadInfo::flag_active;
++const int DownloadInfo::flag_compact;
++const int DownloadInfo::flag_accepting_new_peers;
++const int DownloadInfo::flag_accepting_seeders;
++const int DownloadInfo::flag_private;
++const int DownloadInfo::flag_meta_download;
++const int DownloadInfo::flag_pex_enabled;
++const int DownloadInfo::flag_pex_active;
++
+ const DownloadInfo* Download::info() const { return m_ptr->info(); }
+ const download_data* Download::data() const { return m_ptr->data(); }
+ 
Index: net/libtorrent/patches/patch-src_torrent_download__info.h
===================================================================
RCS file: net/libtorrent/patches/patch-src_torrent_download__info.h
diff -N net/libtorrent/patches/patch-src_torrent_download__info.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_torrent_download__info.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,40 @@
+$NetBSD$
+
+--- src/torrent/download_info.h.orig	2014-05-14 14:18:48.000000000 +0000
++++ src/torrent/download_info.h
+@@ -40,7 +40,18 @@
+ #include <list>
+ #include <string>
+ #include <inttypes.h>
++#include <ciso646>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::function;
++}
++#else
+ #include <tr1/functional>
++namespace torrent {
++  using std::tr1::function;
++}
++#endif
+ 
+ #include <torrent/rate.h>
+ #include <torrent/hash_string.h>
+@@ -52,12 +63,12 @@ class DownloadMain;
+ 
+ // This will become a Download 'handle' of kinds.
+ 
+-class DownloadInfo {
++class LIBTORRENT_EXPORT DownloadInfo {
+ public:
+-  typedef std::tr1::function<uint64_t ()>                              slot_stat_type;
++  typedef function<uint64_t ()>                              slot_stat_type;
+ 
+-  typedef std::list<std::tr1::function<void ()> >                      signal_void_type;
+-  typedef std::list<std::tr1::function<void (const std::string&)> >    signal_string_type;
++  typedef std::list<function<void ()> >                      signal_void_type;
++  typedef std::list<function<void (const std::string&)> >    signal_string_type;
+ 
+   enum State {
+     NONE,
Index: net/libtorrent/patches/patch-src_torrent_download_choke__group.cc
===================================================================
RCS file: net/libtorrent/patches/patch-src_torrent_download_choke__group.cc
diff -N net/libtorrent/patches/patch-src_torrent_download_choke__group.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_torrent_download_choke__group.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,52 @@
+$NetBSD$
+
+--- src/torrent/download/choke_group.cc.orig	2015-10-09 16:51:04.000000000 +0000
++++ src/torrent/download/choke_group.cc
+@@ -37,7 +37,21 @@
+ #include "config.h"
+ 
+ #include <algorithm>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::function;
++  using std::bind;
++  namespace placeholders { using namespace std::placeholders; }
++}
++#else
+ #include <tr1/functional>
++namespace torrent {
++  using std::tr1::function;
++  using std::tr1::bind;
++  namespace placeholders { using namespace std::tr1::placeholders; }
++}
++#endif
+ 
+ #include "choke_group.h"
+ #include "choke_queue.h"
+@@ -48,8 +62,6 @@
+ #include "torrent/exceptions.h"
+ #include "download/download_main.h"
+ 
+-namespace tr1 { using namespace std::tr1; }
+-
+ namespace torrent {
+ 
+ choke_group::choke_group() :
+@@ -61,14 +73,14 @@ uint64_t
+ choke_group::up_rate() const {
+   return
+     std::for_each(m_first, m_last, 
+-                  rak::accumulate((uint64_t)0, tr1::bind(&Rate::rate, tr1::bind(&resource_manager_entry::up_rate, tr1::placeholders::_1)))).result;
++                  rak::accumulate((uint64_t)0, bind(&Rate::rate, bind(&resource_manager_entry::up_rate, placeholders::_1)))).result;
+ }
+ 
+ uint64_t
+ choke_group::down_rate() const {
+   return
+     std::for_each(m_first, m_last, 
+-                  rak::accumulate((uint64_t)0, tr1::bind(&Rate::rate, tr1::bind(&resource_manager_entry::down_rate, tr1::placeholders::_1)))).result;
++                  rak::accumulate((uint64_t)0, bind(&Rate::rate, bind(&resource_manager_entry::down_rate, placeholders::_1)))).result;
+ }
+ 
+ }
Index: net/libtorrent/patches/patch-src_torrent_download_choke__queue.cc
===================================================================
RCS file: net/libtorrent/patches/patch-src_torrent_download_choke__queue.cc
diff -N net/libtorrent/patches/patch-src_torrent_download_choke__queue.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_torrent_download_choke__queue.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- src/torrent/download/choke_queue.cc.orig	2015-10-09 16:51:04.000000000 +0000
++++ src/torrent/download/choke_queue.cc
+@@ -40,7 +40,6 @@
+ #include <functional>
+ #include <numeric>
+ #include <cstdlib>
+-#include <tr1/functional>
+ #include <rak/functional.h>
+ 
+ #include "protocol/peer_connection_base.h"
Index: net/libtorrent/patches/patch-src_torrent_download_choke__queue.h
===================================================================
RCS file: net/libtorrent/patches/patch-src_torrent_download_choke__queue.h
diff -N net/libtorrent/patches/patch-src_torrent_download_choke__queue.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_torrent_download_choke__queue.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,36 @@
+$NetBSD$
+
+--- src/torrent/download/choke_queue.h.orig	2015-10-09 16:51:04.000000000 +0000
++++ src/torrent/download/choke_queue.h
+@@ -42,7 +42,18 @@
+ #include <list>
+ #include <vector>
+ #include <inttypes.h>
++#include <ciso646>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::function;
++}
++#else
+ #include <tr1/functional>
++namespace torrent {
++  using std::tr1::function;
++}
++#endif
+ #include <torrent/download/group_entry.h>
+ 
+ namespace torrent {
+@@ -66,9 +77,9 @@ struct group_stats {
+ 
+ class LIBTORRENT_EXPORT choke_queue {
+ public:
+-  typedef std::tr1::function<void (int)>                         slot_unchoke;
+-  typedef std::tr1::function<int ()>                             slot_can_unchoke;
+-  typedef std::tr1::function<bool (PeerConnectionBase*, bool)>   slot_connection;
++  typedef function<void (int)>                         slot_unchoke;
++  typedef function<int ()>                             slot_can_unchoke;
++  typedef function<bool (PeerConnectionBase*, bool)>   slot_connection;
+ 
+   typedef std::vector<weighted_connection>                       container_type;
+   typedef container_type::value_type                             value_type;
Index: net/libtorrent/patches/patch-src_torrent_download_group__entry.h
===================================================================
RCS file: net/libtorrent/patches/patch-src_torrent_download_group__entry.h
diff -N net/libtorrent/patches/patch-src_torrent_download_group__entry.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_torrent_download_group__entry.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,61 @@
+$NetBSD$
+
+--- src/torrent/download/group_entry.h.orig	2015-10-09 16:51:04.000000000 +0000
++++ src/torrent/download/group_entry.h
+@@ -39,7 +39,20 @@
+ 
+ #include <algorithm>
+ #include <vector>
++#include <ciso646>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::bind;
++  namespace placeholders { using namespace std::placeholders; }
++}
++#else
+ #include <tr1/functional>
++namespace torrent {
++  using std::tr1::bind;
++  namespace placeholders { using namespace std::tr1::placeholders; }
++}
++#endif
+ #include <torrent/common.h>
+ #include <torrent/exceptions.h>
+ 
+@@ -104,7 +117,7 @@ private:
+ 
+ inline void group_entry::connection_unchoked(PeerConnectionBase* pcb) {
+   container_type::iterator itr = std::find_if(m_unchoked.begin(), m_unchoked.end(),
+-                                              std::tr1::bind(&weighted_connection::operator==, std::tr1::placeholders::_1, pcb));
++                                              bind(&weighted_connection::operator==, placeholders::_1, pcb));
+ 
+   if (itr != m_unchoked.end()) throw internal_error("group_entry::connection_unchoked(pcb) failed.");
+ 
+@@ -113,7 +126,7 @@ inline void group_entry::connection_unch
+ 
+ inline void group_entry::connection_queued(PeerConnectionBase* pcb) {
+   container_type::iterator itr = std::find_if(m_queued.begin(), m_queued.end(),
+-                                              std::tr1::bind(&weighted_connection::operator==, std::tr1::placeholders::_1, pcb));
++                                              bind(&weighted_connection::operator==, placeholders::_1, pcb));
+ 
+   if (itr != m_queued.end()) throw internal_error("group_entry::connection_queued(pcb) failed.");
+ 
+@@ -123,7 +136,7 @@ inline void group_entry::connection_queu
+ inline void
+ group_entry::connection_choked(PeerConnectionBase* pcb) {
+   container_type::iterator itr = std::find_if(m_unchoked.begin(), m_unchoked.end(),
+-                                              std::tr1::bind(&weighted_connection::operator==, std::tr1::placeholders::_1, pcb));
++                                              bind(&weighted_connection::operator==, placeholders::_1, pcb));
+ 
+   if (itr == m_unchoked.end()) throw internal_error("group_entry::connection_choked(pcb) failed.");
+ 
+@@ -134,7 +147,7 @@ group_entry::connection_choked(PeerConne
+ inline void
+ group_entry::connection_unqueued(PeerConnectionBase* pcb) {
+   container_type::iterator itr = std::find_if(m_queued.begin(), m_queued.end(),
+-                                              std::tr1::bind(&weighted_connection::operator==, std::tr1::placeholders::_1, pcb));
++                                              bind(&weighted_connection::operator==, placeholders::_1, pcb));
+ 
+   if (itr == m_queued.end()) throw internal_error("group_entry::connection_unqueued(pcb) failed.");
+ 
Index: net/libtorrent/patches/patch-src_torrent_download_resource__manager.cc
===================================================================
RCS file: net/libtorrent/patches/patch-src_torrent_download_resource__manager.cc
diff -N net/libtorrent/patches/patch-src_torrent_download_resource__manager.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_torrent_download_resource__manager.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,53 @@
+$NetBSD$
+
+--- src/torrent/download/resource_manager.cc.orig	2015-10-09 16:51:04.000000000 +0000
++++ src/torrent/download/resource_manager.cc
+@@ -38,7 +38,20 @@
+ 
+ #include <algorithm>
+ #include <functional>
++#include <ciso646>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::bind;
++  namespace placeholders { using namespace std::placeholders ; }
++}
++#else
+ #include <tr1/functional>
++namespace torrent {
++  using std::tr1::bind;
++  namespace placeholders { using namespace std::tr1::placeholders ; }
++}
++#endif
+ #include <limits>
+ #include <rak/functional.h>
+ 
+@@ -51,8 +64,6 @@
+ #include "choke_queue.h"
+ #include "resource_manager.h"
+ 
+-namespace tr1 { using namespace std::tr1; }
+-
+ namespace torrent {
+ 
+ const Rate* resource_manager_entry::up_rate() const { return m_download->info()->up_rate(); }
+@@ -73,12 +84,12 @@ ResourceManager::ResourceManager() :
+   choke_base_type::back()->up_queue()->set_heuristics(choke_queue::HEURISTICS_UPLOAD_LEECH);
+   choke_base_type::back()->down_queue()->set_heuristics(choke_queue::HEURISTICS_DOWNLOAD_LEECH);
+ 
+-  choke_base_type::back()->up_queue()->set_slot_unchoke(tr1::bind(&ResourceManager::receive_upload_unchoke, this, tr1::placeholders::_1));
+-  choke_base_type::back()->down_queue()->set_slot_unchoke(tr1::bind(&ResourceManager::receive_download_unchoke, this, tr1::placeholders::_1));
+-  choke_base_type::back()->up_queue()->set_slot_can_unchoke(tr1::bind(&ResourceManager::retrieve_upload_can_unchoke, this));
+-  choke_base_type::back()->down_queue()->set_slot_can_unchoke(tr1::bind(&ResourceManager::retrieve_download_can_unchoke, this));
+-  choke_base_type::back()->up_queue()->set_slot_connection(tr1::bind(&PeerConnectionBase::receive_upload_choke, tr1::placeholders::_1, tr1::placeholders::_2));
+-  choke_base_type::back()->down_queue()->set_slot_connection(tr1::bind(&PeerConnectionBase::receive_download_choke, tr1::placeholders::_1, tr1::placeholders::_2));
++  choke_base_type::back()->up_queue()->set_slot_unchoke(bind(&ResourceManager::receive_upload_unchoke, this, placeholders::_1));
++  choke_base_type::back()->down_queue()->set_slot_unchoke(bind(&ResourceManager::receive_download_unchoke, this, placeholders::_1));
++  choke_base_type::back()->up_queue()->set_slot_can_unchoke(bind(&ResourceManager::retrieve_upload_can_unchoke, this));
++  choke_base_type::back()->down_queue()->set_slot_can_unchoke(bind(&ResourceManager::retrieve_download_can_unchoke, this));
++  choke_base_type::back()->up_queue()->set_slot_connection(bind(&PeerConnectionBase::receive_upload_choke, placeholders::_1, placeholders::_2));
++  choke_base_type::back()->down_queue()->set_slot_connection(bind(&PeerConnectionBase::receive_download_choke, placeholders::_1, placeholders::_2));
+ }
+ 
+ ResourceManager::~ResourceManager() {
Index: net/libtorrent/patches/patch-src_torrent_http.h
===================================================================
RCS file: net/libtorrent/patches/patch-src_torrent_http.h
diff -N net/libtorrent/patches/patch-src_torrent_http.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_torrent_http.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,36 @@
+$NetBSD$
+
+--- src/torrent/http.h.orig	2015-10-09 16:51:04.000000000 +0000
++++ src/torrent/http.h
+@@ -40,7 +40,18 @@
+ #include <string>
+ #include <iosfwd>
+ #include <list>
++#include <ciso646>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::function;
++}
++#else
+ #include <tr1/functional>
++namespace torrent {
++  using std::tr1::function;
++}
++#endif
+ #include <torrent/common.h>
+ 
+ namespace torrent {
+@@ -51,9 +62,9 @@ namespace torrent {
+ // Keep in mind that these objects get reused.
+ class LIBTORRENT_EXPORT Http {
+  public:
+-  typedef std::tr1::function<void ()>                   slot_void;
+-  typedef std::tr1::function<void (const std::string&)> slot_string;
+-  typedef std::tr1::function<Http* (void)>              slot_http;
++  typedef function<void ()>                   slot_void;
++  typedef function<void (const std::string&)> slot_string;
++  typedef function<Http* (void)>              slot_http;
+ 
+   typedef std::list<slot_void>   signal_void;
+   typedef std::list<slot_string> signal_string;
Index: net/libtorrent/patches/patch-src_torrent_peer_client__list.cc
===================================================================
RCS file: net/libtorrent/patches/patch-src_torrent_peer_client__list.cc
diff -N net/libtorrent/patches/patch-src_torrent_peer_client__list.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_torrent_peer_client__list.cc	10 Oct 2015 18:47:30 -0000
@@ -0,0 +1,34 @@
+$NetBSD$
+
+--- src/torrent/peer/client_list.cc.orig	2015-10-09 16:51:04.000000000 +0000
++++ src/torrent/peer/client_list.cc
+@@ -38,7 +38,20 @@
+ 
+ #include <algorithm>
+ #include <rak/string_manip.h>
++#include <ciso646>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::bind;
++  namespace placeholders { using namespace std::placeholders; }
++}
++#else
+ #include <tr1/functional>
++namespace torrent {
++  using std::tr1::function;
++  namespace placeholders { using namespace std::tr1::placeholders; }
++}
++#endif
+ 
+ #include "client_list.h"
+ #include "exceptions.h"
+@@ -227,7 +240,7 @@ ClientList::retrieve_id(ClientInfo* dest
+     return false;
+   }
+ 
+-  const_iterator itr = std::find_if(begin() + 1, end(), std::tr1::bind(&ClientInfo::intersects, *dest, std::tr1::placeholders::_1));
++  const_iterator itr = std::find_if(begin() + 1, end(), bind(&ClientInfo::intersects, *dest, placeholders::_1));
+ 
+   if (itr == end())
+     dest->set_info(begin()->info());
Index: net/libtorrent/patches/patch-src_torrent_peer_connection__list.cc
===================================================================
RCS file: net/libtorrent/patches/patch-src_torrent_peer_connection__list.cc
diff -N net/libtorrent/patches/patch-src_torrent_peer_connection__list.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_torrent_peer_connection__list.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,15 @@
+$NetBSD$
+
+--- src/torrent/peer/connection_list.cc.orig	2015-10-09 20:50:32.000000000 +0000
++++ src/torrent/peer/connection_list.cc
+@@ -59,6 +59,10 @@
+ // peers and connect to new ones if possible.
+ 
+ namespace torrent {
++const int ConnectionList::disconnect_available;
++const int ConnectionList::disconnect_quick;
++const int ConnectionList::disconnect_unwanted;
++const int ConnectionList::disconnect_delayed;
+ 
+ ConnectionList::ConnectionList(DownloadMain* download) :
+   m_download(download), m_minSize(50), m_maxSize(100) {
Index: net/libtorrent/patches/patch-src_torrent_peer_connection__list.h
===================================================================
RCS file: net/libtorrent/patches/patch-src_torrent_peer_connection__list.h
diff -N net/libtorrent/patches/patch-src_torrent_peer_connection__list.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_torrent_peer_connection__list.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,32 @@
+$NetBSD$
+
+--- src/torrent/peer/connection_list.h.orig	2015-10-09 16:51:04.000000000 +0000
++++ src/torrent/peer/connection_list.h
+@@ -39,7 +39,18 @@
+ 
+ #include <list>
+ #include <vector>
++#include <ciso646>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::function;
++}
++#else
+ #include <tr1/functional>
++namespace torrent {
++  using std::tr1::function;
++}
++#endif
+ #include <torrent/common.h>
+ #include <torrent/hash_string.h>
+ 
+@@ -66,7 +77,7 @@ public:
+   typedef std::vector<Peer*>         base_type;
+   typedef std::vector<HashString>    queue_type;
+   typedef uint32_t                   size_type;
+-  typedef std::tr1::function<void (Peer*)> slot_peer_type;
++  typedef function<void (Peer*)> slot_peer_type;
+   typedef std::list<slot_peer_type>        signal_peer_type;
+ 
+   typedef PeerConnectionBase* (*slot_new_conn_type)(bool encrypted);
Index: net/libtorrent/patches/patch-src_torrent_poll.h
===================================================================
RCS file: net/libtorrent/patches/patch-src_torrent_poll.h
diff -N net/libtorrent/patches/patch-src_torrent_poll.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_torrent_poll.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,32 @@
+$NetBSD$
+
+--- src/torrent/poll.h.orig	2015-10-09 16:51:04.000000000 +0000
++++ src/torrent/poll.h
+@@ -37,7 +37,18 @@
+ #ifndef LIBTORRENT_TORRENT_POLL_H
+ #define LIBTORRENT_TORRENT_POLL_H
+ 
++#include <ciso646>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::function;
++}
++#else
+ #include <tr1/functional>
++namespace torrent {
++  using std::tr1::function;
++}
++#endif
+ #include <torrent/common.h>
+ 
+ namespace torrent {
+@@ -46,7 +57,7 @@ class Event;
+ 
+ class LIBTORRENT_EXPORT Poll {
+ public:
+-  typedef std::tr1::function<Poll* ()> slot_poll;
++  typedef function<Poll* ()> slot_poll;
+ 
+   static const int      poll_worker_thread     = 0x1;
+   static const uint32_t flag_waive_global_lock = 0x1;
Index: net/libtorrent/patches/patch-src_torrent_poll__kqueue.cc
===================================================================
RCS file: net/libtorrent/patches/patch-src_torrent_poll__kqueue.cc
diff -N net/libtorrent/patches/patch-src_torrent_poll__kqueue.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_torrent_poll__kqueue.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,54 @@
+$NetBSD$
+
+--- src/torrent/poll_kqueue.cc.orig	2015-10-09 17:44:54.000000000 +0000
++++ src/torrent/poll_kqueue.cc
+@@ -69,6 +69,12 @@ namespace torrent {
+ 
+ #ifdef USE_KQUEUE
+ 
++#ifdef __NetBSD__
++#define CAST_UDATA(x) reinterpret_cast<intptr_t>(x)
++#else
++#define CAST_UDATA(x) x
++#endif
++
+ inline uint32_t
+ PollKQueue::event_mask(Event* e) {
+   assert(e->file_descriptor() != -1);
+@@ -111,7 +117,7 @@ PollKQueue::modify(Event* event, unsigne
+   struct kevent* itr = m_changes + (m_changedEvents++);
+ 
+   assert(event == m_table[event->file_descriptor()].second);
+-  EV_SET(itr, event->file_descriptor(), mask, op, 0, 0, event);
++  EV_SET(itr, event->file_descriptor(), mask, op, 0, 0, CAST_UDATA(event));
+ }
+ 
+ PollKQueue*
+@@ -309,11 +315,11 @@ PollKQueue::close(Event* event) {
+ 
+   // Shouldn't be needed anymore.
+   for (struct kevent *itr = m_events, *last = m_events + m_waitingEvents; itr != last; ++itr)
+-    if (itr->udata == event)
++    if (itr->udata == CAST_UDATA(event))
+       itr->udata = NULL;
+ 
+   m_changedEvents = std::remove_if(m_changes, m_changes + m_changedEvents,
+-                                   rak::equal(event, rak::mem_ref(&kevent::udata))) - m_changes;
++                                   rak::equal(CAST_UDATA(event), rak::mem_ref(&kevent::udata))) - m_changes;
+ }
+ 
+ void
+@@ -335,11 +341,11 @@ PollKQueue::closed(Event* event) {
+ 
+   // Shouldn't be needed anymore.
+   for (struct kevent *itr = m_events, *last = m_events + m_waitingEvents; itr != last; ++itr)
+-    if (itr->udata == event)
++    if (itr->udata == CAST_UDATA(event))
+       itr->udata = NULL;
+ 
+   m_changedEvents = std::remove_if(m_changes, m_changes + m_changedEvents,
+-                                   rak::equal(event, rak::mem_ref(&kevent::udata))) - m_changes;
++                                   rak::equal(CAST_UDATA(event), rak::mem_ref(&kevent::udata))) - m_changes;
+ }
+ 
+ // Use custom defines for EPOLL* to make the below code compile with
Index: net/libtorrent/patches/patch-src_torrent_tracker__controller.cc
===================================================================
RCS file: net/libtorrent/patches/patch-src_torrent_tracker__controller.cc
diff -N net/libtorrent/patches/patch-src_torrent_tracker__controller.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_torrent_tracker__controller.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,34 @@
+$NetBSD$
+
+--- src/torrent/tracker_controller.cc.orig	2015-10-09 17:51:43.000000000 +0000
++++ src/torrent/tracker_controller.cc
+@@ -50,7 +50,17 @@
+ #define LT_LOG_TRACKER(log_level, log_fmt, ...)                         \
+   lt_log_print_info(LOG_TRACKER_##log_level, m_tracker_list->info(), "tracker_controller", log_fmt, __VA_ARGS__);
+ 
+-namespace tr1 { using namespace std::tr1; }
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::bind;
++}
++#else
++#include <tr1/functional>
++namespace torrent {
++  using std::tr1::bind;
++}
++#endif
+ 
+ namespace torrent {
+ 
+@@ -91,8 +101,8 @@ TrackerController::TrackerController(Tra
+   m_tracker_list(trackers),
+   m_private(new tracker_controller_private) {
+ 
+-  m_private->task_timeout.slot() = std::tr1::bind(&TrackerController::do_timeout, this);
+-  m_private->task_scrape.slot() = std::tr1::bind(&TrackerController::do_scrape, this);
++  m_private->task_timeout.slot() = bind(&TrackerController::do_timeout, this);
++  m_private->task_scrape.slot() = bind(&TrackerController::do_scrape, this);
+ }
+ 
+ TrackerController::~TrackerController() {
Index: net/libtorrent/patches/patch-src_torrent_tracker__controller.h
===================================================================
RCS file: net/libtorrent/patches/patch-src_torrent_tracker__controller.h
diff -N net/libtorrent/patches/patch-src_torrent_tracker__controller.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_torrent_tracker__controller.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,37 @@
+$NetBSD$
+
+--- src/torrent/tracker_controller.h.orig	2015-10-09 16:51:04.000000000 +0000
++++ src/torrent/tracker_controller.h
+@@ -38,7 +38,17 @@
+ #define LIBTORRENT_TRACKER_CONTROLLER_H
+ 
+ #include <string>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::function;
++}
++#else
+ #include <tr1/functional>
++namespace torrent {
++  using std::tr1::function;
++}
++#endif
+ #include <torrent/common.h>
+ #include <torrent/tracker.h>
+ 
+@@ -55,10 +65,10 @@ class LIBTORRENT_EXPORT TrackerControlle
+ public:
+   typedef AddressList address_list;
+ 
+-  typedef std::tr1::function<void (void)>               slot_void;
+-  typedef std::tr1::function<void (const std::string&)> slot_string;
+-  typedef std::tr1::function<uint32_t (AddressList*)>   slot_address_list;
+-  typedef std::tr1::function<void (Tracker*)>           slot_tracker;
++  typedef function<void (void)>               slot_void;
++  typedef function<void (const std::string&)> slot_string;
++  typedef function<uint32_t (AddressList*)>   slot_address_list;
++  typedef function<void (Tracker*)>           slot_tracker;
+ 
+   static const int flag_send_update      = 0x1;
+   static const int flag_send_completed   = 0x2;
Index: net/libtorrent/patches/patch-src_torrent_tracker__list.cc
===================================================================
RCS file: net/libtorrent/patches/patch-src_torrent_tracker__list.cc
diff -N net/libtorrent/patches/patch-src_torrent_tracker__list.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_torrent_tracker__list.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,41 @@
+$NetBSD$
+
+--- src/torrent/tracker_list.cc.orig	2015-10-09 17:53:17.000000000 +0000
++++ src/torrent/tracker_list.cc
+@@ -52,11 +52,23 @@
+ #include "tracker.h"
+ #include "tracker_list.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::bind;
++  namespace placeholders { using namespace std::placeholders; }
++}
++#else
++#include <tr1/functional>
++namespace torrent {
++  using std::tr1::bind;
++  namespace placeholders { using namespace std::tr1::placeholders; }
++}
++#endif
++
+ #define LT_LOG_TRACKER(log_level, log_fmt, ...)                         \
+   lt_log_print_info(LOG_TRACKER_##log_level, info(), "tracker_list", log_fmt, __VA_ARGS__);
+ 
+-namespace tr1 { using namespace std::tr1; }
+-
+ namespace torrent {
+ 
+ TrackerList::TrackerList() :
+@@ -220,8 +232,8 @@ TrackerList::insert_url(unsigned int gro
+ 
+ TrackerList::iterator
+ TrackerList::find_url(const std::string& url) {
+-  return std::find_if(begin(), end(), tr1::bind(std::equal_to<std::string>(), url,
+-                                                tr1::bind(&Tracker::url, tr1::placeholders::_1)));
++  return std::find_if(begin(), end(), bind(std::equal_to<std::string>(), url,
++                                                bind(&Tracker::url, placeholders::_1)));
+ }
+ 
+ TrackerList::iterator
Index: net/libtorrent/patches/patch-src_torrent_tracker__list.h
===================================================================
RCS file: net/libtorrent/patches/patch-src_torrent_tracker__list.h
diff -N net/libtorrent/patches/patch-src_torrent_tracker__list.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_torrent_tracker__list.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,35 @@
+$NetBSD$
+
+--- src/torrent/tracker_list.h.orig	2015-10-09 16:51:04.000000000 +0000
++++ src/torrent/tracker_list.h
+@@ -41,7 +41,17 @@
+ #include <string>
+ #include <vector>
+ #include <torrent/common.h>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::function;
++}
++#else
+ #include <tr1/functional>
++namespace torrent {
++  using std::tr1::function;
++}
++#endif
+ 
+ namespace torrent {
+ 
+@@ -64,9 +74,9 @@ public:
+   typedef std::vector<Tracker*> base_type;
+   typedef AddressList           address_list;
+ 
+-  typedef std::tr1::function<void (Tracker*)>                     slot_tracker;
+-  typedef std::tr1::function<void (Tracker*, const std::string&)> slot_string;
+-  typedef std::tr1::function<uint32_t (Tracker*, AddressList*)>   slot_address_list;
++  typedef function<void (Tracker*)>                     slot_tracker;
++  typedef function<void (Tracker*, const std::string&)> slot_string;
++  typedef function<uint32_t (Tracker*, AddressList*)>   slot_address_list;
+ 
+   using base_type::value_type;
+ 
Index: net/libtorrent/patches/patch-src_torrent_utils_extents.h
===================================================================
RCS file: net/libtorrent/patches/patch-src_torrent_utils_extents.h
diff -N net/libtorrent/patches/patch-src_torrent_utils_extents.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_torrent_utils_extents.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,48 @@
+$NetBSD$
+
+--- src/torrent/utils/extents.h.orig	2015-10-09 17:19:53.000000000 +0000
++++ src/torrent/utils/extents.h
+@@ -37,7 +37,20 @@
+ #ifndef LIBTORRENT_UTILS_EXTENTS_H
+ #define LIBTORRENT_UTILS_EXTENTS_H
+ 
++#include <ciso646>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <array>
++namespace torrent {
++  using std::array;
++}
++#define FILL_ARRAY fill
++#else
+ #include <tr1/array>
++namespace torrent {
++  using std::tr1::array;
++}
++#define FILL_ARRAY assign
++#endif
+ 
+ namespace torrent {
+ 
+@@ -48,12 +61,12 @@ struct extents_base {
+   typedef std::pair<extents_base*, Tp> mapped_type;
+   typedef Tp                           mapped_value_type;
+ 
+-  typedef std::tr1::array<mapped_type, TableSize> table_type;
++  typedef array<mapped_type, TableSize> table_type;
+   
+   extents_base(key_type pos, unsigned int mb, mapped_value_type val) :
+-    mask_bits(mb), position(pos) { table.assign(mapped_type(NULL, mapped_value_type())); }
++    mask_bits(mb), position(pos) { table.FILL_ARRAY(mapped_type(NULL, mapped_value_type())); }
+   extents_base(extents_base* parent, typename table_type::const_iterator itr) :
+-    mask_bits(parent->mask_bits - TableBits), position(parent->partition_pos(itr)) { table.assign(mapped_type(NULL, itr->second)); }
++    mask_bits(parent->mask_bits - TableBits), position(parent->partition_pos(itr)) { table.FILL_ARRAY(mapped_type(NULL, itr->second)); }
+   ~extents_base();
+ 
+   bool         is_divisible(key_type key) const { return key % mask_bits == 0; }
+@@ -212,4 +225,6 @@ extents_base<Key, Tp, TableSize, TableBi
+ 
+ }
+ 
++#undef FILL_ARRAY
++
+ #endif
Index: net/libtorrent/patches/patch-src_torrent_utils_log.cc
===================================================================
RCS file: net/libtorrent/patches/patch-src_torrent_utils_log.cc
diff -N net/libtorrent/patches/patch-src_torrent_utils_log.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_torrent_utils_log.cc	10 Oct 2015 18:48:28 -0000
@@ -0,0 +1,143 @@
+$NetBSD$
+
+--- src/torrent/utils/log.cc.orig	2015-10-09 16:51:04.000000000 +0000
++++ src/torrent/utils/log.cc
+@@ -54,8 +54,25 @@
+ #include <fstream>
+ #include <functional>
+ #include <memory>
++#include <ciso646>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::bind;
++  namespace placeholders { using namespace std::placeholders; }
++  using std::shared_ptr;
++}
++#define FILL_ARRAY fill
++#else
+ #include <tr1/functional>
+ #include <tr1/memory>
++namespace torrent {
++  using std::tr1::bind;
++  namespace placeholders { using namespace std::tr1::placeholders; }
++  using std::tr1::shared_ptr;
++}
++#define FILL_ARRAY assign
++#endif
+ 
+ namespace torrent {
+ 
+@@ -147,7 +164,7 @@ log_rebuild_cache() {
+ 
+     log_cache_list::iterator cache_itr = 
+       std::find_if(log_cache.begin(), log_cache.end(),
+-                   std::tr1::bind(&log_cache_entry::equal_outputs, std::tr1::placeholders::_1, use_outputs));
++                   bind(&log_cache_entry::equal_outputs, placeholders::_1, use_outputs));
+     
+     if (cache_itr == log_cache.end()) {
+       cache_itr = log_cache.insert(log_cache.end(), log_cache_entry());
+@@ -187,14 +204,14 @@ log_group::internal_print(const HashStri
+     return;
+ 
+   pthread_mutex_lock(&log_mutex);
+-  std::for_each(m_first, m_last, std::tr1::bind(&log_slot::operator(),
+-                                                std::tr1::placeholders::_1,
+-                                                buffer,
++  std::for_each(m_first, m_last, bind(&log_slot::operator(),
++                                                placeholders::_1,
++                                                (char *)buffer,
+                                                 std::distance(buffer, first),
+                                                 std::distance(log_groups.begin(), this)));
+   if (dump_data != NULL)
+-    std::for_each(m_first, m_last, std::tr1::bind(&log_slot::operator(),
+-                                                  std::tr1::placeholders::_1,
++    std::for_each(m_first, m_last, bind(&log_slot::operator(),
++                                                  placeholders::_1,
+                                                   (const char*)dump_data,
+                                                   dump_size,
+                                                   -1));
+@@ -250,7 +267,7 @@ void
+ log_cleanup() {
+   pthread_mutex_lock(&log_mutex);
+ 
+-  log_groups.assign(log_group());
++  log_groups.FILL_ARRAY(log_group());
+   log_outputs.clear();
+   log_children.clear();
+ 
+@@ -343,7 +360,7 @@ log_remove_child(int group, int child) {
+ }
+ 
+ void
+-log_file_write(std::tr1::shared_ptr<std::ofstream>& outfile, const char* data, size_t length, int group) {
++log_file_write(shared_ptr<std::ofstream>& outfile, const char* data, size_t length, int group) {
+   // Add group name, data, etc as flags.
+ 
+   // Normal groups are nul-terminated strings.
+@@ -362,7 +379,7 @@ log_file_write(std::tr1::shared_ptr<std:
+ }
+ 
+ void
+-log_gz_file_write(std::tr1::shared_ptr<log_gz_output>& outfile, const char* data, size_t length, int group) {
++log_gz_file_write(shared_ptr<log_gz_output>& outfile, const char* data, size_t length, int group) {
+   char buffer[64];
+ 
+   // Normal groups are nul-terminated strings.
+@@ -391,20 +408,20 @@ log_gz_file_write(std::tr1::shared_ptr<l
+ 
+ void
+ log_open_file_output(const char* name, const char* filename) {
+-  std::tr1::shared_ptr<std::ofstream> outfile(new std::ofstream(filename));
++  shared_ptr<std::ofstream> outfile(new std::ofstream(filename));
+ 
+   if (!outfile->good())
+     throw input_error("Could not open log file '" + std::string(filename) + "'.");
+ 
+-  log_open_output(name, std::tr1::bind(&log_file_write, outfile,
+-                                       std::tr1::placeholders::_1,
+-                                       std::tr1::placeholders::_2,
+-                                       std::tr1::placeholders::_3));
++  log_open_output(name, bind(&log_file_write, outfile,
++                                       placeholders::_1,
++                                       placeholders::_2,
++                                       placeholders::_3));
+ }
+ 
+ void
+ log_open_gz_file_output(const char* name, const char* filename) {
+-  std::tr1::shared_ptr<log_gz_output> outfile(new log_gz_output(filename));
++  shared_ptr<log_gz_output> outfile(new log_gz_output(filename));
+ 
+   if (!outfile->is_valid())
+     throw input_error("Could not open log gzip file '" + std::string(filename) + "'.");
+@@ -412,10 +429,10 @@ log_open_gz_file_output(const char* name
+   // if (!outfile->set_buffer(1 << 14))
+   //   throw input_error("Could not set gzip log file buffer size.");
+ 
+-  log_open_output(name, std::tr1::bind(&log_gz_file_write, outfile,
+-                                       std::tr1::placeholders::_1,
+-                                       std::tr1::placeholders::_2,
+-                                       std::tr1::placeholders::_3));
++  log_open_output(name, bind(&log_gz_file_write, outfile,
++                                       placeholders::_1,
++                                       placeholders::_2,
++                                       placeholders::_3));
+ }
+ 
+ log_buffer*
+@@ -423,10 +440,10 @@ log_open_log_buffer(const char* name) {
+   log_buffer* buffer = new log_buffer;
+ 
+   try {
+-    log_open_output(name, std::tr1::bind(&log_buffer::lock_and_push_log, buffer,
+-                                         std::tr1::placeholders::_1,
+-                                         std::tr1::placeholders::_2,
+-                                         std::tr1::placeholders::_3));
++    log_open_output(name, bind(&log_buffer::lock_and_push_log, buffer,
++                                         placeholders::_1,
++                                         placeholders::_2,
++                                         placeholders::_3));
+     return buffer;
+ 
+   } catch (torrent::input_error& e) {
Index: net/libtorrent/patches/patch-src_torrent_utils_log.h
===================================================================
RCS file: net/libtorrent/patches/patch-src_torrent_utils_log.h
diff -N net/libtorrent/patches/patch-src_torrent_utils_log.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_torrent_utils_log.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,47 @@
+$NetBSD$
+
+--- src/torrent/utils/log.h.orig	2015-10-09 16:51:04.000000000 +0000
++++ src/torrent/utils/log.h
+@@ -40,9 +40,23 @@
+ #include <bitset>
+ #include <string>
+ #include <vector>
++#include <torrent/common.h>
++#include <ciso646>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <array>
++#include <functional>
++namespace torrent {
++  using std::array;
++  using std::function;
++}
++#else
+ #include <tr1/array>
+ #include <tr1/functional>
+-#include <torrent/common.h>
++namespace torrent {
++  using std::tr1::array;
++  using std::tr1::function;
++}
++#endif
+ 
+ namespace torrent {
+ 
+@@ -159,7 +173,7 @@ enum {
+ 
+ class log_buffer;
+ 
+-typedef std::tr1::function<void (const char*, unsigned int, int)> log_slot;
++typedef function<void (const char*, unsigned int, int)> log_slot;
+ 
+ class LIBTORRENT_EXPORT log_group {
+ public:
+@@ -205,7 +219,7 @@ private:
+   log_slot*           m_last;
+ };
+ 
+-typedef std::tr1::array<log_group, LOG_GROUP_MAX_SIZE> log_group_list;
++typedef array<log_group, LOG_GROUP_MAX_SIZE> log_group_list;
+ 
+ extern log_group_list  log_groups LIBTORRENT_EXPORT;
+ 
Index: net/libtorrent/patches/patch-src_torrent_utils_log__buffer.cc
===================================================================
RCS file: net/libtorrent/patches/patch-src_torrent_utils_log__buffer.cc
diff -N net/libtorrent/patches/patch-src_torrent_utils_log__buffer.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_torrent_utils_log__buffer.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,39 @@
+$NetBSD$
+
+--- src/torrent/utils/log_buffer.cc.orig	2015-10-09 16:51:04.000000000 +0000
++++ src/torrent/utils/log_buffer.cc
+@@ -39,12 +39,23 @@
+ #include "log_buffer.h"
+ 
+ #include <functional>
++#include <ciso646>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::bind;
++  namespace placeholders { using namespace std::placeholders; }
++}
++#else
+ #include <tr1/functional>
++namespace torrent {
++  using std::tr1::bind;
++  namespace placeholders { using namespace std::tr1::placeholders; }
++}
++#endif
+ 
+ #include "globals.h"
+ 
+-namespace tr1 { using namespace std::tr1; }
+-
+ namespace torrent {
+ 
+ // Rename function/args?
+@@ -53,7 +64,7 @@ log_buffer::find_older(int32_t older_tha
+   if (empty() || !back().is_younger_than(older_than))
+     return end();
+ 
+-  return std::find_if(begin(), end(), tr1::bind(&log_entry::is_younger_or_same, tr1::placeholders::_1, older_than));
++  return std::find_if(begin(), end(), bind(&log_entry::is_younger_or_same, placeholders::_1, older_than));
+ }
+ 
+ void
Index: net/libtorrent/patches/patch-src_torrent_utils_log__buffer.h
===================================================================
RCS file: net/libtorrent/patches/patch-src_torrent_utils_log__buffer.h
diff -N net/libtorrent/patches/patch-src_torrent_utils_log__buffer.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_torrent_utils_log__buffer.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,34 @@
+$NetBSD$
+
+--- src/torrent/utils/log_buffer.h.orig	2015-10-09 16:51:04.000000000 +0000
++++ src/torrent/utils/log_buffer.h
+@@ -40,8 +40,19 @@
+ #include <string>
+ #include <deque>
+ #include <pthread.h>
+-#include <tr1/functional>
+ #include <torrent/common.h>
++#include <ciso646>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::function;
++}
++#else
++#include <tr1/functional>
++namespace torrent {
++  using std::tr1::function;
++}
++#endif
+ 
+ namespace torrent {
+ 
+@@ -60,7 +71,7 @@ struct log_entry {
+ class LIBTORRENT_EXPORT log_buffer : private std::deque<log_entry> {
+ public:
+   typedef std::deque<log_entry>       base_type;
+-  typedef std::tr1::function<void ()> slot_void;
++  typedef function<void ()> slot_void;
+ 
+   using base_type::iterator;
+   using base_type::const_iterator;
Index: net/libtorrent/patches/patch-src_torrent_utils_net.h
===================================================================
RCS file: net/libtorrent/patches/patch-src_torrent_utils_net.h
diff -N net/libtorrent/patches/patch-src_torrent_utils_net.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_torrent_utils_net.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,30 @@
+$NetBSD$
+
+--- src/torrent/utils/net.h.orig	2015-10-09 16:51:04.000000000 +0000
++++ src/torrent/utils/net.h
+@@ -38,12 +38,23 @@
+ #define LIBTORRENT_UTILS_NET_H
+ 
+ #include <netdb.h>
++#include <ciso646>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::function;
++}
++#else
+ #include <tr1/functional>
++namespace torrent {
++  using std::tr1::function;
++}
++#endif
+ 
+ namespace torrent {
+ 
+-typedef std::tr1::function<void (sockaddr*, socklen_t)> slot_ai_success;
+-//typedef std::tr1::function<void (const char*, int)>     slot_ai_failure;
++typedef function<void (sockaddr*, socklen_t)> slot_ai_success;
++//typedef function<void (const char*, int)>     slot_ai_failure;
+ 
+ // Throws address_info_error on lookup failure.
+ addrinfo*   address_info_lookup(const char* hostname, int family, int socktype);
Index: net/libtorrent/patches/patch-src_torrent_utils_signal__bitfield.h
===================================================================
RCS file: net/libtorrent/patches/patch-src_torrent_utils_signal__bitfield.h
diff -N net/libtorrent/patches/patch-src_torrent_utils_signal__bitfield.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_torrent_utils_signal__bitfield.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,32 @@
+$NetBSD$
+
+--- src/torrent/utils/signal_bitfield.h.orig	2015-10-09 16:51:04.000000000 +0000
++++ src/torrent/utils/signal_bitfield.h
+@@ -37,7 +37,18 @@
+ #ifndef LIBTORRENT_UTILS_SIGNAL_BITFIELD_H
+ #define LIBTORRENT_UTILS_SIGNAL_BITFIELD_H
+ 
++#include <ciso646>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::function;
++}
++#else
+ #include <tr1/functional>
++namespace torrent {
++  using std::tr1::function;
++}
++#endif
+ #include <torrent/common.h>
+ 
+ namespace torrent {
+@@ -45,7 +56,7 @@ namespace torrent {
+ class LIBTORRENT_EXPORT lt_cacheline_aligned signal_bitfield {
+ public:
+   typedef uint32_t                    bitfield_type;
+-  typedef std::tr1::function<void ()> slot_type;
++  typedef function<void ()> slot_type;
+   
+   static const unsigned int max_size = 32;
+ 
Index: net/libtorrent/patches/patch-src_torrent_utils_thread__base.h
===================================================================
RCS file: net/libtorrent/patches/patch-src_torrent_utils_thread__base.h
diff -N net/libtorrent/patches/patch-src_torrent_utils_thread__base.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_torrent_utils_thread__base.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,35 @@
+$NetBSD$
+
+--- src/torrent/utils/thread_base.h.orig	2015-10-09 16:51:04.000000000 +0000
++++ src/torrent/utils/thread_base.h
+@@ -41,7 +41,19 @@
+ #include <sys/types.h>
+ #include <torrent/common.h>
+ #include <torrent/utils/signal_bitfield.h>
++
++#include <ciso646>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::function;
++}
++#else
+ #include <tr1/functional>
++namespace torrent {
++  using std::tr1::function;
++}
++#endif
+ 
+ namespace torrent {
+ 
+@@ -51,8 +63,8 @@ class thread_interrupt;
+ class LIBTORRENT_EXPORT lt_cacheline_aligned thread_base {
+ public:
+   typedef void* (*pthread_func)(void*);
+-  typedef std::tr1::function<void ()>     slot_void;
+-  typedef std::tr1::function<uint64_t ()> slot_timer;
++  typedef function<void ()>     slot_void;
++  typedef function<uint64_t ()> slot_timer;
+   typedef class signal_bitfield           signal_type;
+ 
+   enum state_type {
Index: net/libtorrent/patches/patch-src_tracker_tracker__http.cc
===================================================================
RCS file: net/libtorrent/patches/patch-src_tracker_tracker__http.cc
diff -N net/libtorrent/patches/patch-src_tracker_tracker__http.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_tracker_tracker__http.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,44 @@
+$NetBSD$
+
+--- src/tracker/tracker_http.cc.orig	2015-10-09 18:24:32.000000000 +0000
++++ src/tracker/tracker_http.cc
+@@ -58,14 +58,26 @@
+ #include "globals.h"
+ #include "manager.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::bind;
++  namespace placeholders { using namespace std::placeholders; }
++}
++#else
++#include <tr1/functional>
++namespace torrent {
++  using std::tr1::bind;
++  namespace placeholders { using namespace std::tr1::placeholders; }
++}
++#endif
++
+ #define LT_LOG_TRACKER(log_level, log_fmt, ...)                         \
+   lt_log_print_info(LOG_TRACKER_##log_level, m_parent->info(), "tracker", "[%u] " log_fmt, group(), __VA_ARGS__);
+ 
+ #define LT_LOG_TRACKER_DUMP(log_level, log_dump_data, log_dump_size, log_fmt, ...)                   \
+   lt_log_print_info_dump(LOG_TRACKER_##log_level, log_dump_data, log_dump_size, m_parent->info(), "tracker", "[%u] " log_fmt, group(), __VA_ARGS__);
+ 
+-namespace tr1 { using namespace std::tr1; }
+-
+ namespace torrent {
+ 
+ TrackerHttp::TrackerHttp(TrackerList* parent, const std::string& url, int flags) :
+@@ -74,8 +86,8 @@ TrackerHttp::TrackerHttp(TrackerList* pa
+   m_get(Http::slot_factory()()),
+   m_data(NULL) {
+ 
+-  m_get->signal_done().push_back(tr1::bind(&TrackerHttp::receive_done, this));
+-  m_get->signal_failed().push_back(tr1::bind(&TrackerHttp::receive_failed, this, tr1::placeholders::_1));
++  m_get->signal_done().push_back(bind(&TrackerHttp::receive_done, this));
++  m_get->signal_failed().push_back(bind(&TrackerHttp::receive_failed, this, placeholders::_1));
+ 
+   // Haven't considered if this needs any stronger error detection,
+   // can dropping the '?' be used for malicious purposes?
Index: net/libtorrent/patches/patch-src_tracker_tracker__udp.cc
===================================================================
RCS file: net/libtorrent/patches/patch-src_tracker_tracker__udp.cc
diff -N net/libtorrent/patches/patch-src_tracker_tracker__udp.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_tracker_tracker__udp.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,48 @@
+$NetBSD$
+
+--- src/tracker/tracker_udp.cc.orig	2015-10-09 18:26:04.000000000 +0000
++++ src/tracker/tracker_udp.cc
+@@ -55,7 +55,19 @@
+ #include "tracker_udp.h"
+ #include "manager.h"
+ 
+-namespace tr1 { using namespace std::tr1; }
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace torrent {
++  using std::bind;
++  namespace placeholders { using namespace std::placeholders; }
++}
++#else
++#include <tr1/functional>
++namespace torrent {
++  using std::tr1::bind;
++  namespace placeholders { using namespace std::tr1::placeholders; }
++}
++#endif
+ 
+ #define LT_LOG_TRACKER(log_level, log_fmt, ...)                         \
+   lt_log_print_info(LOG_TRACKER_##log_level, m_parent->info(), "tracker", "[%u] " log_fmt, group(), __VA_ARGS__);
+@@ -72,7 +84,7 @@ TrackerUdp::TrackerUdp(TrackerList* pare
+   m_readBuffer(NULL),
+   m_writeBuffer(NULL) {
+ 
+-  m_taskTimeout.slot() = std::tr1::bind(&TrackerUdp::receive_timeout, this);
++  m_taskTimeout.slot() = bind(&TrackerUdp::receive_timeout, this);
+ }
+ 
+ TrackerUdp::~TrackerUdp() {
+@@ -110,10 +122,10 @@ TrackerUdp::send_state(int state) {
+ 
+   m_sendState = state;
+   m_slot_resolver = manager->connection_manager()->resolver()(hostname, PF_INET, SOCK_DGRAM,
+-                                                              tr1::bind(&TrackerUdp::start_announce,
++                                                              bind(&TrackerUdp::start_announce,
+                                                                         this,
+-                                                                        tr1::placeholders::_1,
+-                                                                        tr1::placeholders::_2));
++                                                                        placeholders::_1,
++                                                                        placeholders::_2));
+ }
+ 
+ void
Index: net/libtorrent/patches/patch-src_utils_instrumentation.cc
===================================================================
RCS file: net/libtorrent/patches/patch-src_utils_instrumentation.cc
diff -N net/libtorrent/patches/patch-src_utils_instrumentation.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_utils_instrumentation.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- src/utils/instrumentation.cc.orig	2015-10-09 18:28:00.000000000 +0000
++++ src/utils/instrumentation.cc
+@@ -42,7 +42,7 @@
+ 
+ namespace torrent {
+ 
+-std::tr1::array<int64_t, INSTRUMENTATION_MAX_SIZE> instrumentation_values lt_cacheline_aligned;
++array<int64_t, INSTRUMENTATION_MAX_SIZE> instrumentation_values lt_cacheline_aligned;
+ 
+ inline int64_t
+ instrumentation_fetch_and_clear(instrumentation_enum type) {
Index: net/libtorrent/patches/patch-src_utils_instrumentation.h
===================================================================
RCS file: net/libtorrent/patches/patch-src_utils_instrumentation.h
diff -N net/libtorrent/patches/patch-src_utils_instrumentation.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_utils_instrumentation.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,49 @@
+$NetBSD$
+
+--- src/utils/instrumentation.h.orig	2015-10-09 17:22:58.000000000 +0000
++++ src/utils/instrumentation.h
+@@ -37,7 +37,20 @@
+ #ifndef LIBTORRENT_UTILS_INSTRUMENTATION_H
+ #define LIBTORRENT_UTILS_INSTRUMENTATION_H
+ 
++#include <ciso646>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <array>
++namespace torrent {
++  using std::array;
++}
++#define FILL_ARRAY fill
++#else
+ #include <tr1/array>
++namespace torrent {
++  using std::tr1::array;
++}
++#define FILL_ARRAY assign
++#endif
+ 
+ #include "torrent/common.h"
+ #include "torrent/utils/log.h"
+@@ -105,7 +118,7 @@ enum instrumentation_enum {
+   INSTRUMENTATION_MAX_SIZE
+ };
+ 
+-extern std::tr1::array<int64_t, INSTRUMENTATION_MAX_SIZE> instrumentation_values lt_cacheline_aligned;
++extern array<int64_t, INSTRUMENTATION_MAX_SIZE> instrumentation_values lt_cacheline_aligned;
+ 
+ void instrumentation_initialize();
+ void instrumentation_update(instrumentation_enum type, int64_t change);
+@@ -118,7 +131,7 @@ void instrumentation_reset();
+ 
+ inline void
+ instrumentation_initialize() {
+-  instrumentation_values.assign(int64_t());
++  instrumentation_values.FILL_ARRAY(int64_t());
+ }
+ 
+ inline void
+@@ -130,4 +143,5 @@ instrumentation_update(instrumentation_e
+ 
+ }
+ 
++#undef FILL_ARRAY
+ #endif
Index: net/libtorrent/patches/patch-src_utils_queue__buckets.h
===================================================================
RCS file: net/libtorrent/patches/patch-src_utils_queue__buckets.h
diff -N net/libtorrent/patches/patch-src_utils_queue__buckets.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/libtorrent/patches/patch-src_utils_queue__buckets.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,46 @@
+$NetBSD$
+
+--- src/utils/queue_buckets.h.orig	2015-10-09 16:51:04.000000000 +0000
++++ src/utils/queue_buckets.h
+@@ -39,16 +39,30 @@
+ 
+ #include <algorithm>
+ #include <deque>
++#include <ciso646>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++#include <array>
++namespace torrent {
++  using std::function;
++  using std::array;
++}
++#else
+ #include <tr1/functional>
+ #include <tr1/array>
++namespace torrent {
++  using std::tr1::function;
++  using std::tr1::array;
++}
++#endif
+ 
+ namespace torrent {
+ 
+ template <typename Type, typename Constants>
+-class queue_buckets : private std::tr1::array<std::deque<Type>, Constants::bucket_count> {
++class queue_buckets : private array<std::deque<Type>, Constants::bucket_count> {
+ public:
+   typedef std::deque<Type>                                     queue_type;
+-  typedef std::tr1::array<queue_type, Constants::bucket_count> base_type;
++  typedef array<queue_type, Constants::bucket_count> base_type;
+ 
+   typedef Constants constants;
+ 
+@@ -251,7 +265,7 @@ queue_buckets<Type, Constants>::destroy(
+   instrumentation_update(constants::instrumentation_total[idx], -difference);
+ 
+   // Consider moving these to a temporary dequeue before releasing:
+-  std::for_each(begin, end, std::tr1::function<void (value_type)>(&constants::template destroy<value_type>));
++  std::for_each(begin, end, &Constants::template destroy<value_type>);
+   queue_at(idx).erase(begin, end);
+ }
+ 
Index: net/rtorrent/distinfo
===================================================================
RCS file: /home/joerg/repo/netbsd/pkgsrc/net/rtorrent/distinfo,v
retrieving revision 1.34
diff -u -p -r1.34 distinfo
--- net/rtorrent/distinfo	15 Jun 2014 22:44:15 -0000	1.34
+++ net/rtorrent/distinfo	10 Oct 2015 19:02:53 -0000
@@ -6,6 +6,74 @@ Size (rtorrent-0.9.4.tar.gz) = 601913 by
 SHA1 (patch-ad) = b3b38e1d9d0887711ac54433e948bfc28112b985
 SHA1 (patch-ae) = a370881bfdd8534eb25fcbcff8d258b19797941f
 SHA1 (patch-af) = 842a01cbc75e61092b4d33fe9155a728e7c502e6
-SHA1 (patch-ag) = c0278f1d1ce7f635c5d10542026fc565dcff1927
-SHA1 (patch-src_display_window__file__list.cc) = ba005aa1a12317f190a6ec47277e7545b37f2a1c
-SHA1 (patch-src_signal__handler.cc) = a79d2dcd9a14de1e221ab94d2a14fe70b9b9ce36
+SHA1 (patch-ag) = 973b9a963e1b33227c26e776fd6babede2eb6c73
+SHA1 (patch-rak_functional__fun.h) = 7cd74eeeb9450f810f0b4d8cc8e590cbd0b4f7b2
+SHA1 (patch-rak_priority__queue__default.h) = ad3d8a8e68cda30b895f87ccdde30a35ede66257
+SHA1 (patch-src_command__download.cc) = 18f7ec5453fcba095844ecb34bc1a233b7b51955
+SHA1 (patch-src_command__dynamic.cc) = d2a69a8769d1b454f3b4ac3c4c0620136a3250b3
+SHA1 (patch-src_command__events.cc) = 0316c0c7b225edb0d1d560686af76029ab3c72b9
+SHA1 (patch-src_command__file.cc) = 2249bca5dda442233bdde0e562af37d2724c945f
+SHA1 (patch-src_command__groups.cc) = 04768d2e9257c6ab67202fcccb5ba9d773595f7c
+SHA1 (patch-src_command__helpers.h) = b1203605b92b413ec7a07d783f173db54b7821b2
+SHA1 (patch-src_command__ip.cc) = 898e33c2b0d8074d3074199e597655aa9a83cf1c
+SHA1 (patch-src_command__local.cc) = 16263b6e110035be42ef9da6964493fb12b81614
+SHA1 (patch-src_command__network.cc) = 0901a0d86a82e17dbdf39fe82eb7f71d35068d90
+SHA1 (patch-src_command__peer.cc) = 35e75fb844b8c68bc6cc32df034c1af5a65e8f37
+SHA1 (patch-src_command__scheduler.cc) = 4b211bf480e8b7e2a3964c2c42f337e406797170
+SHA1 (patch-src_command__throttle.cc) = 8e884ce4140af687dbf1e832ec3e38ce92bf70eb
+SHA1 (patch-src_command__tracker.cc) = c9d89f487ef3326afa51467c45174b06e89964ec
+SHA1 (patch-src_command__ui.cc) = affb00b9ad6788f621819e23caa1025f8a342f78
+SHA1 (patch-src_control.cc) = fc5a40dc235bbcefe95d0aac51d1ffa1284eff39
+SHA1 (patch-src_core_curl__get.cc) = 853a886fa81c79fd29d86ba4eef71fbc80f0a3dc
+SHA1 (patch-src_core_curl__stack.cc) = 5ed30215724a9ab9110349dc0114999275bb0338
+SHA1 (patch-src_core_dht__manager.cc) = b96fcf4d38357437d76b3160c5debf520ccb1147
+SHA1 (patch-src_core_download.cc) = 160954c95e0551e1d9fdd15295353631be4c618d
+SHA1 (patch-src_core_download__factory.cc) = d5436313f737b67e92b2db97f25fb494d5c58d51
+SHA1 (patch-src_core_download__factory.h) = 0acc05a5f9f7491547a067e0492cf4d4022de112
+SHA1 (patch-src_core_download__list.cc) = 90b758cfe7444fdc3e431ab3da600df631415496
+SHA1 (patch-src_core_download__slot__map.h) = 1a8fa4226e58750d415a2a4a43b52a7d74f6e90e
+SHA1 (patch-src_core_http__queue.cc) = 8d66c5e07fd4a7915a195e50e18078a048332f5d
+SHA1 (patch-src_core_http__queue.h) = 7f4a2ee6f9c9e65072b48861786ec68835dcdd0c
+SHA1 (patch-src_core_manager.cc) = 2e1cc1711057f48763c0c7265f410e8c87cfdf87
+SHA1 (patch-src_core_view.cc) = be3a298b38a508969972bf1619fd38a2a23ba5d9
+SHA1 (patch-src_core_view.h) = 73416ebb0b7c739f2f839448b1700fa85a9f357b
+SHA1 (patch-src_display_frame.cc) = f45ac3ac088505df4987744e93e318e206229e57
+SHA1 (patch-src_display_manager.cc) = f25fba742a0b7f5884b06dc1d0551b92959dbc42
+SHA1 (patch-src_display_window.cc) = a6ed751c2e3c4d1d6d1ba60a557a38ea289c3de3
+SHA1 (patch-src_display_window__download__list.cc) = 35362ccf4548aa340e68c51cbe0ddf390892bed1
+SHA1 (patch-src_display_window__file__list.cc) = 397f680aa7228a94db0043da28dc63a71973c9ac
+SHA1 (patch-src_display_window__http__queue.cc) = b10aadb2ee127e895ec68681172b83d7aacf2686
+SHA1 (patch-src_display_window__http__queue.h) = 3296a730da417bf92bda92ee691983467b2feeed
+SHA1 (patch-src_display_window__log.cc) = 1208e8534f8e549fe6df871c3f7601b6c3b409f3
+SHA1 (patch-src_input_bindings.h) = 5d2d4f54eb244f3c99695dcbea210a9228b730bc
+SHA1 (patch-src_input_input__event.h) = 83c689a5e1a229e541be8d500f497071c40f747a
+SHA1 (patch-src_input_path__input.h) = d4b137e70627be1fc8021aea566f6ca641382c02
+SHA1 (patch-src_input_text__input.h) = 8fc2ce1a285d88c73c269700207840275b47c95b
+SHA1 (patch-src_option__parser.cc) = 08bbb4cea38f5b4e73def8f3e9739cca6f8de823
+SHA1 (patch-src_option__parser.h) = 4d24a04be79bc2539956f9f8660b6b0c5f470f63
+SHA1 (patch-src_rpc_command.h) = d9689ce6c5a2418ad34344362b3e32ad1ff0c086
+SHA1 (patch-src_rpc_command__scheduler.cc) = db5c95b700f70eb732b64e180a2099de73c515cb
+SHA1 (patch-src_rpc_command__scheduler__item.h) = 7d6791c434c55d9796f4438ba4ff96bb97e828ac
+SHA1 (patch-src_rpc_exec__file.cc) = 22c9c6bd3facd4dc68b572da216230887afebb22
+SHA1 (patch-src_rpc_object__storage.cc) = 0e0079c34e7cd2fc3f86b830c2c151cb4203307e
+SHA1 (patch-src_rpc_object__storage.h) = c748f165fd7d7d3b8f88556e1e3919b19a5345ca
+SHA1 (patch-src_rpc_xmlrpc.h) = 31b38c407d7ec34e09c7aab6be509c797990b2aa
+SHA1 (patch-src_signal__handler.cc) = edc7f570f0d7cadfd275c3534db878358711ac9e
+SHA1 (patch-src_signal__handler.h) = edefb524331fe97c66b09812594914399fc44c50
+SHA1 (patch-src_thread__base.cc) = 60dbb5e7dd31db63ecc23249edaec952a8b1dc8e
+SHA1 (patch-src_ui_download.cc) = 921bdf329785591bb0b6ab623b1c7daf23ca6a1f
+SHA1 (patch-src_ui_download__list.cc) = acb0a52fef94521851ddbbee2139430a031a42fc
+SHA1 (patch-src_ui_download__list.h) = 07db31973a1c0adda21c0a1d4709c96affb13570
+SHA1 (patch-src_ui_element__base.h) = 3779b5ff30c17c4a9edd194a8b105d3467b13c12
+SHA1 (patch-src_ui_element__chunks__seen.cc) = aaa161a9dcaee763d8168289d42c234b6655246d
+SHA1 (patch-src_ui_element__download__list.cc) = 1b0a42e3279ac744ac523f9d80e3915e8ae34d8d
+SHA1 (patch-src_ui_element__file__list.cc) = daffbd9cea3fc8d982d17f84989143cd3c23f302
+SHA1 (patch-src_ui_element__log__complete.cc) = 861950b966d1847b110953037d075180eaf28815
+SHA1 (patch-src_ui_element__menu.cc) = 69c436ab48a557a63c547642873ec7d91edb2f18
+SHA1 (patch-src_ui_element__menu.h) = 90a0d941c0e4099e81ca1aed567a3bbea278533d
+SHA1 (patch-src_ui_element__peer__list.cc) = 3e1c3afc2a3e0241ae7e6857a0a022c9feb91ff9
+SHA1 (patch-src_ui_element__text.cc) = 78db470a2edfa1b4b5aa106af34daa274b6b69d6
+SHA1 (patch-src_ui_element__tracker__list.cc) = ecbcdce2090f95333a52020ae2813208a8b4620f
+SHA1 (patch-src_ui_element__transfer__list.cc) = 957fa615caeeafa271617a72fe6968b17cde5237
+SHA1 (patch-src_ui_root.cc) = 6226ae6e277f642f2a2dfb4a8500ced742caf8f6
+SHA1 (patch-src_utils_list__focus.h) = c3a7c7d9ec22329d96c007ccfdd93f2aad7478e8
Index: net/rtorrent/patches/patch-ag
===================================================================
RCS file: /home/joerg/repo/netbsd/pkgsrc/net/rtorrent/patches/patch-ag,v
retrieving revision 1.6
diff -u -p -r1.6 patch-ag
--- net/rtorrent/patches/patch-ag	15 Jun 2014 22:44:15 -0000	1.6
+++ net/rtorrent/patches/patch-ag	10 Oct 2015 11:17:30 -0000
@@ -4,9 +4,118 @@ Fix handling of command line options.
 
 http://libtorrent.rakshasa.no/ticket/2657
 
---- src/main.cc.orig	2012-03-20 15:09:58.000000000 +0000
+--- src/main.cc.orig	2014-05-14 14:30:51.000000000 +0000
 +++ src/main.cc
-@@ -843,14 +851,14 @@ main(int argc, char** argv) {
+@@ -80,6 +80,16 @@
+ 
+ #include "thread_worker.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++namespace placeholders { using namespace std::placeholders; }
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++namespace placeholders { using namespace std::tr1::placeholders; }
++#endif
++
+ void handle_sigbus(int signum, siginfo_t* sa, void* ptr);
+ void do_panic(int signum);
+ void print_help();
+@@ -94,20 +104,20 @@ parse_options(Control* c, int argc, char
+     OptionParser optionParser;
+ 
+     // Converted.
+-    optionParser.insert_flag('h', std::tr1::bind(&print_help));
+-    optionParser.insert_flag('n', std::tr1::bind(&do_nothing_str, std::tr1::placeholders::_1));
+-    optionParser.insert_flag('D', std::tr1::bind(&do_nothing_str, std::tr1::placeholders::_1));
+-    optionParser.insert_flag('I', std::tr1::bind(&do_nothing_str, std::tr1::placeholders::_1));
+-    optionParser.insert_flag('K', std::tr1::bind(&do_nothing_str, std::tr1::placeholders::_1));
+-
+-    optionParser.insert_option('b', std::tr1::bind(&rpc::call_command_set_string, "network.bind_address.set", std::tr1::placeholders::_1));
+-    optionParser.insert_option('d', std::tr1::bind(&rpc::call_command_set_string, "directory.default.set", std::tr1::placeholders::_1));
+-    optionParser.insert_option('i', std::tr1::bind(&rpc::call_command_set_string, "ip", std::tr1::placeholders::_1));
+-    optionParser.insert_option('p', std::tr1::bind(&rpc::call_command_set_string, "network.port_range.set", std::tr1::placeholders::_1));
+-    optionParser.insert_option('s', std::tr1::bind(&rpc::call_command_set_string, "session", std::tr1::placeholders::_1));
++    optionParser.insert_flag('h', bind(&print_help));
++    optionParser.insert_flag('n', bind(&do_nothing_str, placeholders::_1));
++    optionParser.insert_flag('D', bind(&do_nothing_str, placeholders::_1));
++    optionParser.insert_flag('I', bind(&do_nothing_str, placeholders::_1));
++    optionParser.insert_flag('K', bind(&do_nothing_str, placeholders::_1));
++
++    optionParser.insert_option('b', bind(&rpc::call_command_set_string, "network.bind_address.set", placeholders::_1));
++    optionParser.insert_option('d', bind(&rpc::call_command_set_string, "directory.default.set", placeholders::_1));
++    optionParser.insert_option('i', bind(&rpc::call_command_set_string, "ip", placeholders::_1));
++    optionParser.insert_option('p', bind(&rpc::call_command_set_string, "network.port_range.set", placeholders::_1));
++    optionParser.insert_option('s', bind(&rpc::call_command_set_string, "session", placeholders::_1));
+ 
+-    optionParser.insert_option('O',      std::tr1::bind(&rpc::parse_command_single_std, std::tr1::placeholders::_1));
+-    optionParser.insert_option_list('o', std::tr1::bind(&rpc::call_command_set_std_string, std::tr1::placeholders::_1, std::tr1::placeholders::_2));
++    optionParser.insert_option('O',      bind(&rpc::parse_command_single_std, placeholders::_1));
++    optionParser.insert_option_list('o', bind(&rpc::call_command_set_std_string, placeholders::_1, placeholders::_2));
+ 
+     return optionParser.process(argc, argv);
+ 
+@@ -131,7 +141,7 @@ load_session_torrents(Control* c) {
+ 
+     // Replace with session torrent flag.
+     f->set_session(true);
+-    f->slot_finished(std::tr1::bind(&rak::call_delete_func<core::DownloadFactory>, f));
++    f->slot_finished(bind(&rak::call_delete_func<core::DownloadFactory>, f));
+     f->load(entries.path() + first->d_name);
+     f->commit();
+   }
+@@ -145,7 +155,7 @@ load_arg_torrents(Control* c, char** fir
+ 
+     // Replace with session torrent flag.
+     f->set_start(true);
+-    f->slot_finished(std::tr1::bind(&rak::call_delete_func<core::DownloadFactory>, f));
++    f->slot_finished(bind(&rak::call_delete_func<core::DownloadFactory>, f));
+     f->load(*first);
+     f->commit();
+   }
+@@ -194,12 +204,12 @@ main(int argc, char** argv) {
+     srand48(cachedTime.usec() ^ (getpid() << 16) ^ getppid());
+ 
+     SignalHandler::set_ignore(SIGPIPE);
+-    SignalHandler::set_handler(SIGINT,   std::tr1::bind(&Control::receive_normal_shutdown, control));
+-    SignalHandler::set_handler(SIGTERM,  std::tr1::bind(&Control::receive_quick_shutdown, control));
+-    SignalHandler::set_handler(SIGWINCH, std::tr1::bind(&display::Manager::force_redraw, control->display()));
+-    SignalHandler::set_handler(SIGSEGV,  std::tr1::bind(&do_panic, SIGSEGV));
+-    SignalHandler::set_handler(SIGILL,   std::tr1::bind(&do_panic, SIGILL));
+-    SignalHandler::set_handler(SIGFPE,   std::tr1::bind(&do_panic, SIGFPE));
++    SignalHandler::set_handler(SIGINT,   bind(&Control::receive_normal_shutdown, control));
++    SignalHandler::set_handler(SIGTERM,  bind(&Control::receive_quick_shutdown, control));
++    SignalHandler::set_handler(SIGWINCH, bind(&display::Manager::force_redraw, control->display()));
++    SignalHandler::set_handler(SIGSEGV,  bind(&do_panic, SIGSEGV));
++    SignalHandler::set_handler(SIGILL,   bind(&do_panic, SIGILL));
++    SignalHandler::set_handler(SIGFPE,   bind(&do_panic, SIGFPE));
+ 
+     SignalHandler::set_sigaction_handler(SIGBUS, &handle_sigbus);
+ 
+@@ -211,16 +221,16 @@ main(int argc, char** argv) {
+     // threads. Use '--enable-interrupt-socket' when configuring
+     // LibTorrent to enable this workaround.
+     if (torrent::thread_base::should_handle_sigusr1())
+-      SignalHandler::set_handler(SIGUSR1, std::tr1::bind(&do_nothing));
++      SignalHandler::set_handler(SIGUSR1, bind(&do_nothing));
+ 
+     torrent::log_add_group_output(torrent::LOG_NOTICE, "important");
+     torrent::log_add_group_output(torrent::LOG_INFO, "complete");
+ 
+-    torrent::Poll::slot_create_poll() = std::tr1::bind(&core::create_poll);
++    torrent::Poll::slot_create_poll() = bind(&core::create_poll);
+ 
+     torrent::initialize();
+-    torrent::main_thread()->slot_do_work() = tr1::bind(&client_perform);
+-    torrent::main_thread()->slot_next_timeout() = tr1::bind(&client_next_timeout, control);
++    torrent::main_thread()->slot_do_work() = bind(&client_perform);
++    torrent::main_thread()->slot_next_timeout() = bind(&client_next_timeout, control);
+ 
+     worker_thread = new ThreadWorker();
+     worker_thread->init_thread();
+@@ -828,14 +838,14 @@ main(int argc, char** argv) {
      }
  #endif
  
Index: net/rtorrent/patches/patch-rak_functional__fun.h
===================================================================
RCS file: net/rtorrent/patches/patch-rak_functional__fun.h
diff -N net/rtorrent/patches/patch-rak_functional__fun.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-rak_functional__fun.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,105 @@
+$NetBSD$
+
+--- rak/functional_fun.h.orig	2015-10-09 19:29:35.000000000 +0000
++++ rak/functional_fun.h
+@@ -53,8 +53,17 @@
+ 
+ #include <memory>
+ #include <functional>
+-#include <tr1/functional>
++
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++namespace rak {
++  using std::shared_ptr;
++}
++#else
+ #include <tr1/memory>
++namespace rak {
++  using std::tr1::shared_ptr;
++}
++#endif
+ 
+ namespace rak {
+ 
+@@ -98,13 +107,13 @@ public:
+ 
+   bool                is_valid() const     { return m_base.get() != NULL; }
+ 
+-  void                set(base_type* base) { m_base = std::tr1::shared_ptr<base_type>(base); }
++  void                set(base_type* base) { m_base = shared_ptr<base_type>(base); }
+   base_type*          release()            { return m_base.release(); }
+ 
+   Result operator () ()                    { return (*m_base)(); }
+ 
+ private:
+-  std::tr1::shared_ptr<base_type> m_base;
++  shared_ptr<base_type> m_base;
+ };
+ 
+ template <typename Result, typename Arg1>
+@@ -115,13 +124,13 @@ public:
+ 
+   bool                is_valid() const     { return m_base.get() != NULL; }
+ 
+-  void                set(base_type* base) { m_base = std::tr1::shared_ptr<base_type>(base); }
++  void                set(base_type* base) { m_base = shared_ptr<base_type>(base); }
+   base_type*          release()            { return m_base.release(); }
+ 
+   Result operator () (Arg1 arg1)           { return (*m_base)(arg1); }
+ 
+ private:
+-  std::tr1::shared_ptr<base_type> m_base;
++  shared_ptr<base_type> m_base;
+ };
+ 
+ template <typename Result, typename Arg1, typename Arg2>
+@@ -132,13 +141,13 @@ public:
+ 
+   bool                is_valid() const     { return m_base.get() != NULL; }
+ 
+-  void                set(base_type* base) { m_base = std::tr1::shared_ptr<base_type>(base); }
++  void                set(base_type* base) { m_base = shared_ptr<base_type>(base); }
+   base_type*          release()            { return m_base.release(); }
+ 
+   Result operator () (Arg1 arg1, Arg2 arg2) { return (*m_base)(arg1, arg2); }
+ 
+ private:
+-  std::tr1::shared_ptr<base_type> m_base;
++  shared_ptr<base_type> m_base;
+ };
+ 
+ template <typename Result, typename Arg2>
+@@ -149,7 +158,7 @@ public:
+ 
+   bool                is_valid() const     { return m_base.get() != NULL; }
+ 
+-  void                set(base_type* base) { m_base = std::tr1::shared_ptr<base_type>(base); }
++  void                set(base_type* base) { m_base = shared_ptr<base_type>(base); }
+   base_type*          release()            { return m_base.release(); }
+ 
+   Result operator () (Arg2 arg2)           { return (*m_base)(arg2); }
+@@ -158,7 +167,7 @@ public:
+   Result operator () (Discard discard, Arg2 arg2) { return (*m_base)(arg2); }
+ 
+ private:
+-  std::tr1::shared_ptr<base_type> m_base;
++  shared_ptr<base_type> m_base;
+ };
+ 
+ template <typename Result, typename Arg1, typename Arg2, typename Arg3>
+@@ -169,13 +178,13 @@ public:
+ 
+   bool                is_valid() const     { return m_base.get() != NULL; }
+ 
+-  void                set(base_type* base) { m_base = std::tr1::shared_ptr<base_type>(base); }
++  void                set(base_type* base) { m_base = shared_ptr<base_type>(base); }
+   base_type*          release()            { return m_base.release(); }
+ 
+   Result operator () (Arg1 arg1, Arg2 arg2, Arg3 arg3) { return (*m_base)(arg1, arg2, arg3); }
+ 
+ private:
+-  std::tr1::shared_ptr<base_type> m_base;
++  shared_ptr<base_type> m_base;
+ };
+ 
+ template <typename Result>
Index: net/rtorrent/patches/patch-rak_priority__queue__default.h
===================================================================
RCS file: net/rtorrent/patches/patch-rak_priority__queue__default.h
diff -N net/rtorrent/patches/patch-rak_priority__queue__default.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-rak_priority__queue__default.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,36 @@
+$NetBSD$
+
+--- rak/priority_queue_default.h.orig	2015-10-09 19:29:35.000000000 +0000
++++ rak/priority_queue_default.h
+@@ -37,18 +37,29 @@
+ #ifndef RAK_PRIORITY_QUEUE_DEFAULT_H
+ #define RAK_PRIORITY_QUEUE_DEFAULT_H
+ 
+-#include <tr1/functional>
+ #include <rak/allocators.h>
+ #include <rak/priority_queue.h>
+ #include <rak/timer.h>
+ 
+ #include "torrent/exceptions.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace rak {
++  using std::function;
++}
++#else
++#include <tr1/functional>
++namespace rak {
++  using std::tr1::function;
++}
++#endif
++
+ namespace rak {
+ 
+ class priority_item {
+ public:
+-  typedef std::tr1::function<void (void)> slot_void;
++  typedef function<void (void)> slot_void;
+ 
+   priority_item() {}
+   ~priority_item() {
Index: net/rtorrent/patches/patch-src_command__download.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_command__download.cc
diff -N net/rtorrent/patches/patch-src_command__download.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_command__download.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,407 @@
+$NetBSD$
+
+--- src/command_download.cc.orig	2015-10-09 20:18:20.000000000 +0000
++++ src/command_download.cc
+@@ -69,6 +69,16 @@
+ #include "control.h"
+ #include "command_helpers.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++namespace placeholders { using namespace std::placeholders; }
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++namespace placeholders { using namespace std::tr1::placeholders; }
++#endif
++
+ std::string
+ retrieve_d_base_path(core::Download* download) {
+   if (download->file_list()->is_multi_file())
+@@ -356,7 +366,7 @@ f_multicall(core::Download* download, co
+   if (args.front().is_list())
+     std::transform(args.front().as_list().begin(), args.front().as_list().end(),
+                    std::back_inserter(regex_list),
+-                   tr1::bind(&torrent::Object::as_string_c, tr1::placeholders::_1));
++                   bind(&torrent::Object::as_string_c, placeholders::_1));
+   else if (args.front().is_string() && !args.front().as_string().empty())
+     regex_list.push_back(args.front().as_string());
+   else
+@@ -365,7 +375,7 @@ f_multicall(core::Download* download, co
+   for (torrent::FileList::const_iterator itr = download->file_list()->begin(), last = download->file_list()->end(); itr != last; itr++) {
+     if (use_regex &&
+         std::find_if(regex_list.begin(), regex_list.end(),
+-                     tr1::bind(&rak::regex::operator(), tr1::placeholders::_1, (*itr)->path()->as_string())) == regex_list.end())
++                     bind(&rak::regex::operator(), placeholders::_1, (*itr)->path()->as_string())) == regex_list.end())
+       continue;
+ 
+     torrent::Object::list_type& row = result.insert(result.end(), torrent::Object::create_list())->as_list();
+@@ -581,52 +591,52 @@ d_list_remove(core::Download* download, 
+   return torrent::Object();
+ }
+ 
+-#define CMD2_ON_INFO(func) tr1::bind(&torrent::DownloadInfo::func, tr1::bind(&core::Download::info, tr1::placeholders::_1))
+-#define CMD2_ON_DATA(func) tr1::bind(&torrent::download_data::func, tr1::bind(&core::Download::data, tr1::placeholders::_1))
+-#define CMD2_ON_DL(func) tr1::bind(&torrent::Download::func, tr1::bind(&core::Download::download, tr1::placeholders::_1))
+-#define CMD2_ON_FL(func) tr1::bind(&torrent::FileList::func, tr1::bind(&core::Download::file_list, tr1::placeholders::_1))
+-
+-#define CMD2_BIND_DL tr1::bind(&core::Download::download, tr1::placeholders::_1)
+-#define CMD2_BIND_CL tr1::bind(&core::Download::connection_list, tr1::placeholders::_1)
+-#define CMD2_BIND_FL tr1::bind(&core::Download::file_list, tr1::placeholders::_1)
+-#define CMD2_BIND_PL tr1::bind(&core::Download::c_peer_list, tr1::placeholders::_1)
+-#define CMD2_BIND_TL tr1::bind(&core::Download::tracker_list, tr1::placeholders::_1)
+-#define CMD2_BIND_TC tr1::bind(&core::Download::tracker_controller, tr1::placeholders::_1)
++#define CMD2_ON_INFO(func) bind(&torrent::DownloadInfo::func, bind(&core::Download::info, placeholders::_1))
++#define CMD2_ON_DATA(func) bind(&torrent::download_data::func, bind(&core::Download::data, placeholders::_1))
++#define CMD2_ON_DL(func) bind(&torrent::Download::func, bind(&core::Download::download, placeholders::_1))
++#define CMD2_ON_FL(func) bind(&torrent::FileList::func, bind(&core::Download::file_list, placeholders::_1))
++
++#define CMD2_BIND_DL bind(&core::Download::download, placeholders::_1)
++#define CMD2_BIND_CL bind(&core::Download::connection_list, placeholders::_1)
++#define CMD2_BIND_FL bind(&core::Download::file_list, placeholders::_1)
++#define CMD2_BIND_PL bind(&core::Download::c_peer_list, placeholders::_1)
++#define CMD2_BIND_TL bind(&core::Download::tracker_list, placeholders::_1)
++#define CMD2_BIND_TC bind(&core::Download::tracker_controller, placeholders::_1)
+ 
+-#define CMD2_BIND_INFO tr1::bind(&core::Download::info, tr1::placeholders::_1)
+-#define CMD2_BIND_DATA tr1::bind(&core::Download::data, tr1::placeholders::_1)
++#define CMD2_BIND_INFO bind(&core::Download::info, placeholders::_1)
++#define CMD2_BIND_DATA bind(&core::Download::data, placeholders::_1)
+ 
+ #define CMD2_DL_VAR_VALUE(key, first_key, second_key)                   \
+-  CMD2_DL(key, tr1::bind(&download_get_variable, tr1::placeholders::_1, first_key, second_key)); \
+-  CMD2_DL_VALUE_P(key ".set", tr1::bind(&download_set_variable_value, \
+-                                             tr1::placeholders::_1, tr1::placeholders::_2, \
++  CMD2_DL(key, bind(&download_get_variable, placeholders::_1, first_key, second_key)); \
++  CMD2_DL_VALUE_P(key ".set", bind(&download_set_variable_value, \
++                                             placeholders::_1, placeholders::_2, \
+                                              first_key, second_key));
+ 
+ #define CMD2_DL_VAR_VALUE_PUBLIC(key, first_key, second_key)            \
+-  CMD2_DL(key, tr1::bind(&download_get_variable, tr1::placeholders::_1, first_key, second_key)); \
+-  CMD2_DL_VALUE(key ".set", tr1::bind(&download_set_variable_value, \
+-                                           tr1::placeholders::_1, tr1::placeholders::_2, \
++  CMD2_DL(key, bind(&download_get_variable, placeholders::_1, first_key, second_key)); \
++  CMD2_DL_VALUE(key ".set", bind(&download_set_variable_value, \
++                                           placeholders::_1, placeholders::_2, \
+                                            first_key, second_key));
+ 
+ #define CMD2_DL_TIMESTAMP(key, first_key, second_key)                   \
+-  CMD2_DL(key, tr1::bind(&download_get_variable, tr1::placeholders::_1, first_key, second_key)); \
+-  CMD2_DL_VALUE_P(key ".set", tr1::bind(&download_set_variable_value, \
+-                                             tr1::placeholders::_1, tr1::placeholders::_2, \
++  CMD2_DL(key, bind(&download_get_variable, placeholders::_1, first_key, second_key)); \
++  CMD2_DL_VALUE_P(key ".set", bind(&download_set_variable_value, \
++                                             placeholders::_1, placeholders::_2, \
+                                              first_key, second_key)); \
+-  CMD2_DL_VALUE_P(key ".set_if_z", tr1::bind(&download_set_variable_value_ifz, \
+-                                             tr1::placeholders::_1, tr1::placeholders::_2, \
++  CMD2_DL_VALUE_P(key ".set_if_z", bind(&download_set_variable_value_ifz, \
++                                             placeholders::_1, placeholders::_2, \
+                                              first_key, second_key));   \
+ 
+ #define CMD2_DL_VAR_STRING(key, first_key, second_key)                   \
+-  CMD2_DL(key, tr1::bind(&download_get_variable, tr1::placeholders::_1, first_key, second_key)); \
+-  CMD2_DL_STRING_P(key ".set", tr1::bind(&download_set_variable_string, \
+-                                              tr1::placeholders::_1, tr1::placeholders::_2, \
++  CMD2_DL(key, bind(&download_get_variable, placeholders::_1, first_key, second_key)); \
++  CMD2_DL_STRING_P(key ".set", bind(&download_set_variable_string, \
++                                              placeholders::_1, placeholders::_2, \
+                                               first_key, second_key));
+ 
+ #define CMD2_DL_VAR_STRING_PUBLIC(key, first_key, second_key)                   \
+-  CMD2_DL(key, tr1::bind(&download_get_variable, tr1::placeholders::_1, first_key, second_key)); \
+-  CMD2_DL_STRING(key ".set", tr1::bind(&download_set_variable_string, \
+-                                            tr1::placeholders::_1, tr1::placeholders::_2, \
++  CMD2_DL(key, bind(&download_get_variable, placeholders::_1, first_key, second_key)); \
++  CMD2_DL_STRING(key ".set", bind(&download_set_variable_string, \
++                                            placeholders::_1, placeholders::_2, \
+                                             first_key, second_key));
+ 
+ int64_t            cg_d_group(core::Download* download);
+@@ -635,12 +645,12 @@ void               cg_d_group_set(core::
+ 
+ void
+ initialize_command_download() {
+-  CMD2_DL("d.hash",          tr1::bind(&rak::transform_hex_str<torrent::HashString>, CMD2_ON_INFO(hash)));
+-  CMD2_DL("d.local_id",      tr1::bind(&rak::transform_hex_str<torrent::HashString>, CMD2_ON_INFO(local_id)));
+-  CMD2_DL("d.local_id_html", tr1::bind(&rak::copy_escape_html_str<torrent::HashString>, CMD2_ON_INFO(local_id)));
+-  CMD2_DL("d.bitfield",      tr1::bind(&retrieve_d_bitfield, tr1::placeholders::_1));
+-  CMD2_DL("d.base_path",     tr1::bind(&retrieve_d_base_path, tr1::placeholders::_1));
+-  CMD2_DL("d.base_filename", tr1::bind(&retrieve_d_base_filename, tr1::placeholders::_1));
++  CMD2_DL("d.hash",          bind(&rak::transform_hex_str<torrent::HashString>, CMD2_ON_INFO(hash)));
++  CMD2_DL("d.local_id",      bind(&rak::transform_hex_str<torrent::HashString>, CMD2_ON_INFO(local_id)));
++  CMD2_DL("d.local_id_html", bind(&rak::copy_escape_html_str<torrent::HashString>, CMD2_ON_INFO(local_id)));
++  CMD2_DL("d.bitfield",      bind(&retrieve_d_bitfield, placeholders::_1));
++  CMD2_DL("d.base_path",     bind(&retrieve_d_base_path, placeholders::_1));
++  CMD2_DL("d.base_filename", bind(&retrieve_d_base_filename, placeholders::_1));
+ 
+   CMD2_DL("d.name",          CMD2_ON_INFO(name));
+   CMD2_DL("d.creation_date", CMD2_ON_INFO(creation_date));
+@@ -650,19 +660,19 @@ initialize_command_download() {
+   // Network related:
+   //
+ 
+-  CMD2_DL         ("d.up.rate",       tr1::bind(&torrent::Rate::rate,  CMD2_ON_INFO(up_rate)));
+-  CMD2_DL         ("d.up.total",      tr1::bind(&torrent::Rate::total, CMD2_ON_INFO(up_rate)));
+-  CMD2_DL         ("d.down.rate",     tr1::bind(&torrent::Rate::rate,  CMD2_ON_INFO(down_rate)));
+-  CMD2_DL         ("d.down.total",    tr1::bind(&torrent::Rate::total, CMD2_ON_INFO(down_rate)));
+-  CMD2_DL         ("d.skip.rate",     tr1::bind(&torrent::Rate::rate,  CMD2_ON_INFO(skip_rate)));
+-  CMD2_DL         ("d.skip.total",    tr1::bind(&torrent::Rate::total, CMD2_ON_INFO(skip_rate)));
++  CMD2_DL         ("d.up.rate",       bind(&torrent::Rate::rate,  CMD2_ON_INFO(up_rate)));
++  CMD2_DL         ("d.up.total",      bind(&torrent::Rate::total, CMD2_ON_INFO(up_rate)));
++  CMD2_DL         ("d.down.rate",     bind(&torrent::Rate::rate,  CMD2_ON_INFO(down_rate)));
++  CMD2_DL         ("d.down.total",    bind(&torrent::Rate::total, CMD2_ON_INFO(down_rate)));
++  CMD2_DL         ("d.skip.rate",     bind(&torrent::Rate::rate,  CMD2_ON_INFO(skip_rate)));
++  CMD2_DL         ("d.skip.total",    bind(&torrent::Rate::total, CMD2_ON_INFO(skip_rate)));
+ 
+   CMD2_DL         ("d.peer_exchange",     CMD2_ON_INFO(is_pex_enabled));
+-  CMD2_DL_VALUE_V ("d.peer_exchange.set", tr1::bind(&torrent::Download::set_pex_enabled, CMD2_BIND_DL, tr1::placeholders::_2));
++  CMD2_DL_VALUE_V ("d.peer_exchange.set", bind(&torrent::Download::set_pex_enabled, CMD2_BIND_DL, placeholders::_2));
+ 
+-  CMD2_DL_LIST    ("d.create_link", tr1::bind(&apply_d_change_link, tr1::placeholders::_1, tr1::placeholders::_2, 0));
+-  CMD2_DL_LIST    ("d.delete_link", tr1::bind(&apply_d_change_link, tr1::placeholders::_1, tr1::placeholders::_2, 1));
+-  CMD2_DL         ("d.delete_tied", tr1::bind(&apply_d_delete_tied, tr1::placeholders::_1));
++  CMD2_DL_LIST    ("d.create_link", bind(&apply_d_change_link, placeholders::_1, placeholders::_2, 0));
++  CMD2_DL_LIST    ("d.delete_link", bind(&apply_d_change_link, placeholders::_1, placeholders::_2, 1));
++  CMD2_DL         ("d.delete_tied", bind(&apply_d_delete_tied, placeholders::_1));
+ 
+   CMD2_FUNC_SINGLE("d.start",     "d.hashing_failed.set=0 ;view.set_visible=started");
+   CMD2_FUNC_SINGLE("d.stop",      "view.set_visible=stopped");
+@@ -676,36 +686,36 @@ initialize_command_download() {
+ 
+   CMD2_DL         ("d.is_open",               CMD2_ON_INFO(is_open));
+   CMD2_DL         ("d.is_active",             CMD2_ON_INFO(is_active));
+-  CMD2_DL         ("d.is_hash_checked",       tr1::bind(&torrent::Download::is_hash_checked, CMD2_BIND_DL));
+-  CMD2_DL         ("d.is_hash_checking",      tr1::bind(&torrent::Download::is_hash_checking, CMD2_BIND_DL));
+-  CMD2_DL         ("d.is_multi_file",         tr1::bind(&torrent::FileList::is_multi_file, CMD2_BIND_FL));
++  CMD2_DL         ("d.is_hash_checked",       bind(&torrent::Download::is_hash_checked, CMD2_BIND_DL));
++  CMD2_DL         ("d.is_hash_checking",      bind(&torrent::Download::is_hash_checking, CMD2_BIND_DL));
++  CMD2_DL         ("d.is_multi_file",         bind(&torrent::FileList::is_multi_file, CMD2_BIND_FL));
+   CMD2_DL         ("d.is_private",            CMD2_ON_INFO(is_private));
+   CMD2_DL         ("d.is_pex_active",         CMD2_ON_INFO(is_pex_active));
+   CMD2_DL         ("d.is_partially_done",     CMD2_ON_DATA(is_partially_done));
+   CMD2_DL         ("d.is_not_partially_done", CMD2_ON_DATA(is_not_partially_done));
+ 
+-  CMD2_DL_V       ("d.resume",     tr1::bind(&core::DownloadList::resume_default, control->core()->download_list(), tr1::placeholders::_1));
+-  CMD2_DL_V       ("d.pause",      tr1::bind(&core::DownloadList::pause_default, control->core()->download_list(), tr1::placeholders::_1));
+-  CMD2_DL_V       ("d.open",       tr1::bind(&core::DownloadList::open_throw, control->core()->download_list(), tr1::placeholders::_1));
+-  CMD2_DL_V       ("d.close",      tr1::bind(&core::DownloadList::close_throw, control->core()->download_list(), tr1::placeholders::_1));
+-  CMD2_DL_V       ("d.close.directly", tr1::bind(&core::DownloadList::close_directly, control->core()->download_list(), tr1::placeholders::_1));
+-  CMD2_DL_V       ("d.erase",      tr1::bind(&core::DownloadList::erase_ptr, control->core()->download_list(), tr1::placeholders::_1));
+-  CMD2_DL_V       ("d.check_hash", tr1::bind(&core::DownloadList::check_hash, control->core()->download_list(), tr1::placeholders::_1));
++  CMD2_DL_V       ("d.resume",     bind(&core::DownloadList::resume_default, control->core()->download_list(), placeholders::_1));
++  CMD2_DL_V       ("d.pause",      bind(&core::DownloadList::pause_default, control->core()->download_list(), placeholders::_1));
++  CMD2_DL_V       ("d.open",       bind(&core::DownloadList::open_throw, control->core()->download_list(), placeholders::_1));
++  CMD2_DL_V       ("d.close",      bind(&core::DownloadList::close_throw, control->core()->download_list(), placeholders::_1));
++  CMD2_DL_V       ("d.close.directly", bind(&core::DownloadList::close_directly, control->core()->download_list(), placeholders::_1));
++  CMD2_DL_V       ("d.erase",      bind(&core::DownloadList::erase_ptr, control->core()->download_list(), placeholders::_1));
++  CMD2_DL_V       ("d.check_hash", bind(&core::DownloadList::check_hash, control->core()->download_list(), placeholders::_1));
+ 
+-  CMD2_DL         ("d.save_resume",       tr1::bind(&core::DownloadStore::save_resume, control->core()->download_store(), tr1::placeholders::_1));
+-  CMD2_DL         ("d.save_full_session", tr1::bind(&core::DownloadStore::save_full, control->core()->download_store(), tr1::placeholders::_1));
++  CMD2_DL         ("d.save_resume",       bind(&core::DownloadStore::save_resume, control->core()->download_store(), placeholders::_1));
++  CMD2_DL         ("d.save_full_session", bind(&core::DownloadStore::save_full, control->core()->download_store(), placeholders::_1));
+ 
+   CMD2_DL_V       ("d.update_priorities", CMD2_ON_DL(update_priorities));
+ 
+-  CMD2_DL_STRING_V("add_peer",   tr1::bind(&apply_d_add_peer, tr1::placeholders::_1, tr1::placeholders::_2));
++  CMD2_DL_STRING_V("add_peer",   bind(&apply_d_add_peer, placeholders::_1, placeholders::_2));
+ 
+   //
+   // Custom settings:
+   //
+ 
+-  CMD2_DL_STRING("d.custom",       tr1::bind(&retrieve_d_custom, tr1::placeholders::_1, tr1::placeholders::_2));
+-  CMD2_DL_STRING("d.custom_throw", tr1::bind(&retrieve_d_custom_throw, tr1::placeholders::_1, tr1::placeholders::_2));
+-  CMD2_DL_LIST  ("d.custom.set",   tr1::bind(&apply_d_custom, tr1::placeholders::_1, tr1::placeholders::_2));
++  CMD2_DL_STRING("d.custom",       bind(&retrieve_d_custom, placeholders::_1, placeholders::_2));
++  CMD2_DL_STRING("d.custom_throw", bind(&retrieve_d_custom_throw, placeholders::_1, placeholders::_2));
++  CMD2_DL_LIST  ("d.custom.set",   bind(&apply_d_custom, placeholders::_1, placeholders::_2));
+ 
+   CMD2_DL_VAR_STRING_PUBLIC("d.custom1", "rtorrent", "custom1");
+   CMD2_DL_VAR_STRING_PUBLIC("d.custom2", "rtorrent", "custom2");
+@@ -750,68 +760,68 @@ initialize_command_download() {
+   CMD2_DL_TIMESTAMP("d.timestamp.started",      "rtorrent", "timestamp.started");
+   CMD2_DL_TIMESTAMP("d.timestamp.finished",     "rtorrent", "timestamp.finished");
+ 
+-  CMD2_DL       ("d.connection_current",     tr1::bind(&torrent::option_as_string, torrent::OPTION_CONNECTION_TYPE, CMD2_ON_DL(connection_type)));
+-  CMD2_DL_STRING("d.connection_current.set", tr1::bind(&apply_d_connection_type, tr1::placeholders::_1, tr1::placeholders::_2));
++  CMD2_DL       ("d.connection_current",     bind(&torrent::option_as_string, torrent::OPTION_CONNECTION_TYPE, CMD2_ON_DL(connection_type)));
++  CMD2_DL_STRING("d.connection_current.set", bind(&apply_d_connection_type, placeholders::_1, placeholders::_2));
+ 
+   CMD2_DL_VAR_STRING("d.connection_leech",      "rtorrent", "connection_leech");
+   CMD2_DL_VAR_STRING("d.connection_seed",       "rtorrent", "connection_seed");
+ 
+-  CMD2_DL       ("d.up.choke_heuristics",       tr1::bind(&torrent::option_as_string, torrent::OPTION_CHOKE_HEURISTICS, CMD2_ON_DL(upload_choke_heuristic)));
+-  CMD2_DL_STRING("d.up.choke_heuristics.set",   tr1::bind(&apply_d_choke_heuristics, tr1::placeholders::_1, tr1::placeholders::_2, false));
+-  CMD2_DL       ("d.down.choke_heuristics",     tr1::bind(&torrent::option_as_string, torrent::OPTION_CHOKE_HEURISTICS, CMD2_ON_DL(download_choke_heuristic)));
+-  CMD2_DL_STRING("d.down.choke_heuristics.set", tr1::bind(&apply_d_choke_heuristics, tr1::placeholders::_1, tr1::placeholders::_2, true));
++  CMD2_DL       ("d.up.choke_heuristics",       bind(&torrent::option_as_string, torrent::OPTION_CHOKE_HEURISTICS, CMD2_ON_DL(upload_choke_heuristic)));
++  CMD2_DL_STRING("d.up.choke_heuristics.set",   bind(&apply_d_choke_heuristics, placeholders::_1, placeholders::_2, false));
++  CMD2_DL       ("d.down.choke_heuristics",     bind(&torrent::option_as_string, torrent::OPTION_CHOKE_HEURISTICS, CMD2_ON_DL(download_choke_heuristic)));
++  CMD2_DL_STRING("d.down.choke_heuristics.set", bind(&apply_d_choke_heuristics, placeholders::_1, placeholders::_2, true));
+ 
+   CMD2_DL_VAR_STRING("d.up.choke_heuristics.leech", "rtorrent", "choke_heuristics.up.leech");
+   CMD2_DL_VAR_STRING("d.up.choke_heuristics.seed",  "rtorrent", "choke_heuristics.up.seed");
+   CMD2_DL_VAR_STRING("d.down.choke_heuristics.leech", "rtorrent", "choke_heuristics.down.leech");
+   CMD2_DL_VAR_STRING("d.down.choke_heuristics.seed",  "rtorrent", "choke_heuristics.down.seed");
+ 
+-  CMD2_DL         ("d.hashing_failed",     tr1::bind(&core::Download::is_hash_failed, tr1::placeholders::_1));
+-  CMD2_DL_VALUE_V ("d.hashing_failed.set", tr1::bind(&core::Download::set_hash_failed, tr1::placeholders::_1, tr1::placeholders::_2));
++  CMD2_DL         ("d.hashing_failed",     bind(&core::Download::is_hash_failed, placeholders::_1));
++  CMD2_DL_VALUE_V ("d.hashing_failed.set", bind(&core::Download::set_hash_failed, placeholders::_1, placeholders::_2));
+ 
+-  CMD2_DL         ("d.views",                  tr1::bind(&download_get_variable, tr1::placeholders::_1, "rtorrent", "views"));
+-  CMD2_DL         ("d.views.has",              tr1::bind(&d_list_has, tr1::placeholders::_1, tr1::placeholders::_2, "rtorrent", "views"));
+-  CMD2_DL         ("d.views.remove",           tr1::bind(&d_list_remove, tr1::placeholders::_1, tr1::placeholders::_2, "rtorrent", "views"));
+-  CMD2_DL         ("d.views.push_back",        tr1::bind(&d_list_push_back, tr1::placeholders::_1, tr1::placeholders::_2, "rtorrent", "views"));
+-  CMD2_DL         ("d.views.push_back_unique", tr1::bind(&d_list_push_back_unique, tr1::placeholders::_1, tr1::placeholders::_2, "rtorrent", "views"));
++  CMD2_DL         ("d.views",                  bind(&download_get_variable, placeholders::_1, "rtorrent", "views"));
++  CMD2_DL         ("d.views.has",              bind(&d_list_has, placeholders::_1, placeholders::_2, "rtorrent", "views"));
++  CMD2_DL         ("d.views.remove",           bind(&d_list_remove, placeholders::_1, placeholders::_2, "rtorrent", "views"));
++  CMD2_DL         ("d.views.push_back",        bind(&d_list_push_back, placeholders::_1, placeholders::_2, "rtorrent", "views"));
++  CMD2_DL         ("d.views.push_back_unique", bind(&d_list_push_back_unique, placeholders::_1, placeholders::_2, "rtorrent", "views"));
+ 
+   // This command really needs to be improved, so we have proper
+   // logging support.
+-  CMD2_DL         ("d.message",     tr1::bind(&core::Download::message, tr1::placeholders::_1));
+-  CMD2_DL_STRING_V("d.message.set", tr1::bind(&core::Download::set_message, tr1::placeholders::_1, tr1::placeholders::_2));
++  CMD2_DL         ("d.message",     bind(&core::Download::message, placeholders::_1));
++  CMD2_DL_STRING_V("d.message.set", bind(&core::Download::set_message, placeholders::_1, placeholders::_2));
+ 
+   CMD2_DL         ("d.max_file_size",       CMD2_ON_FL(max_file_size));
+-  CMD2_DL_VALUE_V ("d.max_file_size.set",   tr1::bind(&torrent::FileList::set_max_file_size, CMD2_BIND_FL, tr1::placeholders::_2));
++  CMD2_DL_VALUE_V ("d.max_file_size.set",   bind(&torrent::FileList::set_max_file_size, CMD2_BIND_FL, placeholders::_2));
+ 
+-  CMD2_DL         ("d.peers_min",           tr1::bind(&torrent::ConnectionList::min_size, CMD2_BIND_CL));
+-  CMD2_DL_VALUE_V ("d.peers_min.set",       tr1::bind(&torrent::ConnectionList::set_min_size, CMD2_BIND_CL, tr1::placeholders::_2));
+-  CMD2_DL         ("d.peers_max",           tr1::bind(&torrent::ConnectionList::max_size, CMD2_BIND_CL));
+-  CMD2_DL_VALUE_V ("d.peers_max.set",       tr1::bind(&torrent::ConnectionList::set_max_size, CMD2_BIND_CL, tr1::placeholders::_2));
+-  CMD2_DL         ("d.uploads_max",         tr1::bind(&torrent::Download::uploads_max, CMD2_BIND_DL));
+-  CMD2_DL_VALUE_V ("d.uploads_max.set",     tr1::bind(&torrent::Download::set_uploads_max, CMD2_BIND_DL, tr1::placeholders::_2));
+-  CMD2_DL         ("d.uploads_min",         tr1::bind(&torrent::Download::uploads_min, CMD2_BIND_DL));
+-  CMD2_DL_VALUE_V ("d.uploads_min.set",     tr1::bind(&torrent::Download::set_uploads_min, CMD2_BIND_DL, tr1::placeholders::_2));
+-  CMD2_DL         ("d.downloads_max",         tr1::bind(&torrent::Download::downloads_max, CMD2_BIND_DL));
+-  CMD2_DL_VALUE_V ("d.downloads_max.set",     tr1::bind(&torrent::Download::set_downloads_max, CMD2_BIND_DL, tr1::placeholders::_2));
+-  CMD2_DL         ("d.downloads_min",         tr1::bind(&torrent::Download::downloads_min, CMD2_BIND_DL));
+-  CMD2_DL_VALUE_V ("d.downloads_min.set",     tr1::bind(&torrent::Download::set_downloads_min, CMD2_BIND_DL, tr1::placeholders::_2));
+-  CMD2_DL         ("d.peers_connected",     tr1::bind(&torrent::ConnectionList::size, CMD2_BIND_CL));
+-  CMD2_DL         ("d.peers_not_connected", tr1::bind(&torrent::PeerList::available_list_size, CMD2_BIND_PL));
++  CMD2_DL         ("d.peers_min",           bind(&torrent::ConnectionList::min_size, CMD2_BIND_CL));
++  CMD2_DL_VALUE_V ("d.peers_min.set",       bind(&torrent::ConnectionList::set_min_size, CMD2_BIND_CL, placeholders::_2));
++  CMD2_DL         ("d.peers_max",           bind(&torrent::ConnectionList::max_size, CMD2_BIND_CL));
++  CMD2_DL_VALUE_V ("d.peers_max.set",       bind(&torrent::ConnectionList::set_max_size, CMD2_BIND_CL, placeholders::_2));
++  CMD2_DL         ("d.uploads_max",         bind(&torrent::Download::uploads_max, CMD2_BIND_DL));
++  CMD2_DL_VALUE_V ("d.uploads_max.set",     bind(&torrent::Download::set_uploads_max, CMD2_BIND_DL, placeholders::_2));
++  CMD2_DL         ("d.uploads_min",         bind(&torrent::Download::uploads_min, CMD2_BIND_DL));
++  CMD2_DL_VALUE_V ("d.uploads_min.set",     bind(&torrent::Download::set_uploads_min, CMD2_BIND_DL, placeholders::_2));
++  CMD2_DL         ("d.downloads_max",         bind(&torrent::Download::downloads_max, CMD2_BIND_DL));
++  CMD2_DL_VALUE_V ("d.downloads_max.set",     bind(&torrent::Download::set_downloads_max, CMD2_BIND_DL, placeholders::_2));
++  CMD2_DL         ("d.downloads_min",         bind(&torrent::Download::downloads_min, CMD2_BIND_DL));
++  CMD2_DL_VALUE_V ("d.downloads_min.set",     bind(&torrent::Download::set_downloads_min, CMD2_BIND_DL, placeholders::_2));
++  CMD2_DL         ("d.peers_connected",     bind(&torrent::ConnectionList::size, CMD2_BIND_CL));
++  CMD2_DL         ("d.peers_not_connected", bind(&torrent::PeerList::available_list_size, CMD2_BIND_PL));
+ 
+   CMD2_DL         ("d.peers_complete",      CMD2_ON_DL(peers_complete));
+   CMD2_DL         ("d.peers_accounted",     CMD2_ON_DL(peers_accounted));
+ 
+-  CMD2_DL_V       ("d.disconnect.seeders",        tr1::bind(&torrent::ConnectionList::erase_seeders, CMD2_BIND_CL));
++  CMD2_DL_V       ("d.disconnect.seeders",        bind(&torrent::ConnectionList::erase_seeders, CMD2_BIND_CL));
+ 
+   CMD2_DL         ("d.accepting_seeders",         CMD2_ON_INFO(is_accepting_seeders));
+-  CMD2_DL_V       ("d.accepting_seeders.enable",  tr1::bind(&torrent::DownloadInfo::public_set_flags,   CMD2_BIND_INFO, torrent::DownloadInfo::flag_accepting_seeders));
+-  CMD2_DL_V       ("d.accepting_seeders.disable", tr1::bind(&torrent::DownloadInfo::public_unset_flags, CMD2_BIND_INFO, torrent::DownloadInfo::flag_accepting_seeders));
++  CMD2_DL_V       ("d.accepting_seeders.enable",  bind(&torrent::DownloadInfo::public_set_flags,   CMD2_BIND_INFO, torrent::DownloadInfo::flag_accepting_seeders));
++  CMD2_DL_V       ("d.accepting_seeders.disable", bind(&torrent::DownloadInfo::public_unset_flags, CMD2_BIND_INFO, torrent::DownloadInfo::flag_accepting_seeders));
+ 
+-  CMD2_DL         ("d.throttle_name",     tr1::bind(&download_get_variable, tr1::placeholders::_1, "rtorrent", "throttle_name"));
+-  CMD2_DL_STRING_V("d.throttle_name.set", tr1::bind(&core::Download::set_throttle_name, tr1::placeholders::_1, tr1::placeholders::_2));
++  CMD2_DL         ("d.throttle_name",     bind(&download_get_variable, placeholders::_1, "rtorrent", "throttle_name"));
++  CMD2_DL_STRING_V("d.throttle_name.set", bind(&core::Download::set_throttle_name, placeholders::_1, placeholders::_2));
+ 
+   CMD2_DL         ("d.bytes_done",     CMD2_ON_DL(bytes_done));
+-  CMD2_DL         ("d.ratio",          tr1::bind(&retrieve_d_ratio, tr1::placeholders::_1));
++  CMD2_DL         ("d.ratio",          bind(&retrieve_d_ratio, placeholders::_1));
+   CMD2_DL         ("d.chunks_hashed",  CMD2_ON_DL(chunks_hashed));
+   CMD2_DL         ("d.free_diskspace", CMD2_ON_FL(free_diskspace));
+ 
+@@ -822,7 +832,7 @@ initialize_command_download() {
+   CMD2_DL         ("d.size_pex",       CMD2_ON_DL(size_pex));
+   CMD2_DL         ("d.max_size_pex",   CMD2_ON_DL(max_size_pex));
+ 
+-  CMD2_DL         ("d.chunks_seen",      tr1::bind(&d_chunks_seen, tr1::placeholders::_1));
++  CMD2_DL         ("d.chunks_seen",      bind(&d_chunks_seen, placeholders::_1));
+ 
+   CMD2_DL         ("d.completed_bytes",  CMD2_ON_FL(completed_bytes));
+   CMD2_DL         ("d.completed_chunks", CMD2_ON_FL(completed_chunks));
+@@ -830,42 +840,42 @@ initialize_command_download() {
+ 
+   CMD2_DL         ("d.wanted_chunks",    CMD2_ON_DATA(wanted_chunks));
+ 
+-  CMD2_DL_V       ("d.tracker_announce",     tr1::bind(&torrent::Download::manual_request, CMD2_BIND_DL, false)); 
+-  CMD2_DL         ("d.tracker_numwant",      tr1::bind(&torrent::TrackerList::numwant, CMD2_BIND_TL));
+-  CMD2_DL_VALUE_V ("d.tracker_numwant.set",  tr1::bind(&torrent::TrackerList::set_numwant, CMD2_BIND_TL, tr1::placeholders::_2));
++  CMD2_DL_V       ("d.tracker_announce",     bind(&torrent::Download::manual_request, CMD2_BIND_DL, false)); 
++  CMD2_DL         ("d.tracker_numwant",      bind(&torrent::TrackerList::numwant, CMD2_BIND_TL));
++  CMD2_DL_VALUE_V ("d.tracker_numwant.set",  bind(&torrent::TrackerList::set_numwant, CMD2_BIND_TL, placeholders::_2));
+   // TODO: Deprecate 'd.tracker_focus'.
+-  CMD2_DL         ("d.tracker_focus",        tr1::bind(&core::Download::tracker_list_size, tr1::placeholders::_1));
+-  CMD2_DL         ("d.tracker_size",         tr1::bind(&core::Download::tracker_list_size, tr1::placeholders::_1));
++  CMD2_DL         ("d.tracker_focus",        bind(&core::Download::tracker_list_size, placeholders::_1));
++  CMD2_DL         ("d.tracker_size",         bind(&core::Download::tracker_list_size, placeholders::_1));
+ 
+-  CMD2_DL_LIST    ("d.tracker.insert",       tr1::bind(&download_tracker_insert, tr1::placeholders::_1, tr1::placeholders::_2));
+-  CMD2_DL_VALUE_V ("d.tracker.send_scrape",  tr1::bind(&torrent::TrackerController::scrape_request, CMD2_BIND_TC, tr1::placeholders::_2));
++  CMD2_DL_LIST    ("d.tracker.insert",       bind(&download_tracker_insert, placeholders::_1, placeholders::_2));
++  CMD2_DL_VALUE_V ("d.tracker.send_scrape",  bind(&torrent::TrackerController::scrape_request, CMD2_BIND_TC, placeholders::_2));
+ 
+   CMD2_DL         ("d.directory",          CMD2_ON_FL(root_dir));
+-  CMD2_DL_STRING_V("d.directory.set",      tr1::bind(&apply_d_directory, tr1::placeholders::_1, tr1::placeholders::_2));
++  CMD2_DL_STRING_V("d.directory.set",      bind(&apply_d_directory, placeholders::_1, placeholders::_2));
+   CMD2_DL         ("d.directory_base",     CMD2_ON_FL(root_dir));
+-  CMD2_DL_STRING_V("d.directory_base.set", tr1::bind(&core::Download::set_root_directory, tr1::placeholders::_1, tr1::placeholders::_2));
++  CMD2_DL_STRING_V("d.directory_base.set", bind(&core::Download::set_root_directory, placeholders::_1, placeholders::_2));
+ 
+-  CMD2_DL         ("d.priority",     tr1::bind(&core::Download::priority, tr1::placeholders::_1));
+-  CMD2_DL         ("d.priority_str", tr1::bind(&retrieve_d_priority_str, tr1::placeholders::_1));
+-  CMD2_DL_VALUE_V ("d.priority.set", tr1::bind(&core::Download::set_priority, tr1::placeholders::_1, tr1::placeholders::_2));
++  CMD2_DL         ("d.priority",     bind(&core::Download::priority, placeholders::_1));
++  CMD2_DL         ("d.priority_str", bind(&retrieve_d_priority_str, placeholders::_1));
++  CMD2_DL_VALUE_V ("d.priority.set", bind(&core::Download::set_priority, placeholders::_1, placeholders::_2));
+ 
+-  // CMD2_DL         ("d.group",     tr1::bind(&torrent::resource_manager_entry::group,
+-  //                                           tr1::bind(&torrent::ResourceManager::entry_at, torrent::resource_manager(),
+-  //                                                     tr1::bind(&core::Download::main, tr1::placeholders::_1))));
++  // CMD2_DL         ("d.group",     bind(&torrent::resource_manager_entry::group,
++  //                                           bind(&torrent::ResourceManager::entry_at, torrent::resource_manager(),
++  //                                                     bind(&core::Download::main, placeholders::_1))));
+ 
+-  // CMD2_DL_V       ("d.group.set", tr1::bind(&torrent::ResourceManager::set_group,
++  // CMD2_DL_V       ("d.group.set", bind(&torrent::ResourceManager::set_group,
+   //                                           torrent::resource_manager(),
+-  //                                           tr1::bind(&torrent::ResourceManager::find_throw, torrent::resource_manager(),
+-  //                                                     tr1::bind(&core::Download::main, tr1::placeholders::_1)),
++  //                                           bind(&torrent::ResourceManager::find_throw, torrent::resource_manager(),
++  //                                                     bind(&core::Download::main, placeholders::_1)),
+   //                                           CG_GROUP_INDEX()));
+ 
+-  CMD2_DL         ("d.group",      tr1::bind(&cg_d_group, tr1::placeholders::_1));
+-  CMD2_DL         ("d.group.name", tr1::bind(&cg_d_group, tr1::placeholders::_1));
+-  CMD2_DL_V       ("d.group.set",  tr1::bind(&cg_d_group_set, tr1::placeholders::_1, tr1::placeholders::_2));
+-
+-  CMD2_DL_LIST    ("f.multicall", tr1::bind(&f_multicall, tr1::placeholders::_1, tr1::placeholders::_2));
+-  CMD2_DL_LIST    ("p.multicall", tr1::bind(&p_multicall, tr1::placeholders::_1, tr1::placeholders::_2));
+-  CMD2_DL_LIST    ("t.multicall", tr1::bind(&t_multicall, tr1::placeholders::_1, tr1::placeholders::_2));
++  CMD2_DL         ("d.group",      bind(&cg_d_group, placeholders::_1));
++  CMD2_DL         ("d.group.name", bind(&cg_d_group, placeholders::_1));
++  CMD2_DL_V       ("d.group.set",  bind(&cg_d_group_set, placeholders::_1, placeholders::_2));
++
++  CMD2_DL_LIST    ("f.multicall", bind(&f_multicall, placeholders::_1, placeholders::_2));
++  CMD2_DL_LIST    ("p.multicall", bind(&p_multicall, placeholders::_1, placeholders::_2));
++  CMD2_DL_LIST    ("t.multicall", bind(&t_multicall, placeholders::_1, placeholders::_2));
+ 
+-  CMD2_ANY_LIST   ("p.call_target", tr1::bind(&p_call_target, tr1::placeholders::_2));
++  CMD2_ANY_LIST   ("p.call_target", bind(&p_call_target, placeholders::_2));
+ }
Index: net/rtorrent/patches/patch-src_command__dynamic.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_command__dynamic.cc
diff -N net/rtorrent/patches/patch-src_command__dynamic.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_command__dynamic.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,133 @@
+$NetBSD$
+
+--- src/command_dynamic.cc.orig	2015-10-09 20:35:25.000000000 +0000
++++ src/command_dynamic.cc
+@@ -44,6 +44,16 @@
+ #include "command_helpers.h"
+ #include "rpc/parse.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++namespace placeholders { using namespace std::placeholders; }
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++namespace placeholders { using namespace std::tr1::placeholders; }
++#endif
++
+ std::string
+ system_method_generate_command(torrent::Object::list_const_iterator first, torrent::Object::list_const_iterator last) {
+   std::string command;
+@@ -158,15 +168,15 @@ system_method_insert_object(const torren
+ 
+     rpc::commands.insert_slot<rpc::command_base_is_type<rpc::command_base_call<rpc::target_type> >::type>
+       (create_new_key(rawKey),
+-       tr1::bind(&rpc::object_storage::call_function_str, control->object_storage(),
+-                 rawKey, tr1::placeholders::_1, tr1::placeholders::_2),
++       bind(&rpc::object_storage::call_function_str, control->object_storage(),
++                 rawKey, placeholders::_1, placeholders::_2),
+        &rpc::command_base_call<rpc::target_type>,
+        cmd_flags, NULL, NULL);
+ 
+   } else {
+     rpc::commands.insert_slot<rpc::command_base_is_type<rpc::command_base_call<rpc::target_type> >::type>
+       (create_new_key(rawKey),
+-       tr1::bind(&rpc::object_storage::get_str, control->object_storage(), rawKey),
++       bind(&rpc::object_storage::get_str, control->object_storage(), rawKey),
+        &rpc::command_base_call<rpc::target_type>,
+        cmd_flags, NULL, NULL);
+   }
+@@ -175,7 +185,7 @@ system_method_insert_object(const torren
+   // if (flags & rpc::object_storage::flag_rlookup) {
+   //   rpc::commands.insert_slot<rpc::command_base_is_type<rpc::command_base_call_string<rpc::target_type> >::type>
+   //     (create_new_key<9>(rawKey, ".rlookup"),
+-  //      tr1::bind(&rpc::object_storage::rlookup_obj_list, control->object_storage(), rawKey),
++  //      bind(&rpc::object_storage::rlookup_obj_list, control->object_storage(), rawKey),
+   //      &rpc::command_base_call_string<rpc::target_type>,
+   //      cmd_flags, NULL, NULL);
+   // }
+@@ -189,21 +199,21 @@ system_method_insert_object(const torren
+     case rpc::object_storage::flag_bool_type:
+       rpc::commands.insert_slot<rpc::command_base_is_type<rpc::command_base_call_value<rpc::target_type> >::type>
+         (create_new_key<5>(rawKey, ".set"),
+-         tr1::bind(&rpc::object_storage::set_str_bool, control->object_storage(), rawKey, tr1::placeholders::_2),
++         bind(&rpc::object_storage::set_str_bool, control->object_storage(), rawKey, placeholders::_2),
+          &rpc::command_base_call_value<rpc::target_type>,
+          cmd_flags, NULL, NULL);
+       break;
+     case rpc::object_storage::flag_value_type:
+       rpc::commands.insert_slot<rpc::command_base_is_type<rpc::command_base_call_value<rpc::target_type> >::type>
+         (create_new_key<5>(rawKey, ".set"),
+-         tr1::bind(&rpc::object_storage::set_str_value, control->object_storage(), rawKey, tr1::placeholders::_2),
++         bind(&rpc::object_storage::set_str_value, control->object_storage(), rawKey, placeholders::_2),
+          &rpc::command_base_call_value<rpc::target_type>,
+          cmd_flags, NULL, NULL);
+       break;
+     case rpc::object_storage::flag_string_type:
+       rpc::commands.insert_slot<rpc::command_base_is_type<rpc::command_base_call_string<rpc::target_type> >::type>
+         (create_new_key<5>(rawKey, ".set"),
+-         tr1::bind(&rpc::object_storage::set_str_string, control->object_storage(), rawKey, tr1::placeholders::_2),
++         bind(&rpc::object_storage::set_str_string, control->object_storage(), rawKey, placeholders::_2),
+          &rpc::command_base_call_string<rpc::target_type>,
+          cmd_flags, NULL, NULL);
+       break;
+@@ -434,38 +444,38 @@ cmd_catch(rpc::target_type target, const
+ }
+ 
+ #define CMD2_METHOD_INSERT(key, flags) \
+-  CMD2_ANY_LIST(key, tr1::bind(&system_method_insert_object, tr1::placeholders::_2, flags));
++  CMD2_ANY_LIST(key, bind(&system_method_insert_object, placeholders::_2, flags));
+ 
+ void
+ initialize_command_dynamic() {
+   CMD2_VAR_BOOL    ("method.use_deprecated", true);
+   CMD2_VAR_VALUE   ("method.use_intermediate", 1);
+ 
+-  CMD2_ANY_LIST    ("method.insert",             tr1::bind(&system_method_insert, tr1::placeholders::_2));
+-  CMD2_ANY_LIST    ("method.insert.value",       tr1::bind(&system_method_insert_object, tr1::placeholders::_2, rpc::object_storage::flag_value_type));
++  CMD2_ANY_LIST    ("method.insert",             bind(&system_method_insert, placeholders::_2));
++  CMD2_ANY_LIST    ("method.insert.value",       bind(&system_method_insert_object, placeholders::_2, rpc::object_storage::flag_value_type));
+ 
+   CMD2_METHOD_INSERT("method.insert.simple",     rpc::object_storage::flag_function_type);
+   CMD2_METHOD_INSERT("method.insert.c_simple",   rpc::object_storage::flag_constant | rpc::object_storage::flag_function_type);
+   CMD2_METHOD_INSERT("method.insert.s_c_simple", rpc::object_storage::flag_static |
+                      rpc::object_storage::flag_constant |rpc::object_storage::flag_function_type);
+ 
+-  CMD2_ANY_STRING  ("method.erase",     tr1::bind(&system_method_erase, tr1::placeholders::_2));
+-  CMD2_ANY_LIST    ("method.redirect",  tr1::bind(&system_method_redirect, tr1::placeholders::_2));
+-  CMD2_ANY_STRING  ("method.get",       tr1::bind(&rpc::object_storage::get_str, control->object_storage(),
+-                                                       tr1::placeholders::_2));
+-  CMD2_ANY_LIST    ("method.set",       tr1::bind(&system_method_set_function, tr1::placeholders::_2));
+-
+-  CMD2_ANY_STRING  ("method.const",        tr1::bind(&rpc::object_storage::has_flag_str, control->object_storage(),
+-                                                      tr1::placeholders::_2, rpc::object_storage::flag_constant));
+-  CMD2_ANY_STRING_V("method.const.enable", tr1::bind(&rpc::object_storage::enable_flag_str, control->object_storage(),
+-                                                     tr1::placeholders::_2, rpc::object_storage::flag_constant));
+-
+-  CMD2_ANY_LIST    ("method.has_key",   tr1::bind(&system_method_has_key, tr1::placeholders::_2));
+-  CMD2_ANY_LIST    ("method.set_key",   tr1::bind(&system_method_set_key, tr1::placeholders::_2));
+-  CMD2_ANY_STRING  ("method.list_keys", tr1::bind(&system_method_list_keys, tr1::placeholders::_2));
++  CMD2_ANY_STRING  ("method.erase",     bind(&system_method_erase, placeholders::_2));
++  CMD2_ANY_LIST    ("method.redirect",  bind(&system_method_redirect, placeholders::_2));
++  CMD2_ANY_STRING  ("method.get",       bind(&rpc::object_storage::get_str, control->object_storage(),
++                                                       placeholders::_2));
++  CMD2_ANY_LIST    ("method.set",       bind(&system_method_set_function, placeholders::_2));
++
++  CMD2_ANY_STRING  ("method.const",        bind(&rpc::object_storage::has_flag_str, control->object_storage(),
++                                                      placeholders::_2, rpc::object_storage::flag_constant));
++  CMD2_ANY_STRING_V("method.const.enable", bind(&rpc::object_storage::enable_flag_str, control->object_storage(),
++                                                     placeholders::_2, rpc::object_storage::flag_constant));
++
++  CMD2_ANY_LIST    ("method.has_key",   bind(&system_method_has_key, placeholders::_2));
++  CMD2_ANY_LIST    ("method.set_key",   bind(&system_method_set_key, placeholders::_2));
++  CMD2_ANY_STRING  ("method.list_keys", bind(&system_method_list_keys, placeholders::_2));
+ 
+-  CMD2_ANY_STRING  ("method.rlookup",       tr1::bind(&rpc::object_storage::rlookup_obj_list, control->object_storage(), tr1::placeholders::_2));
+-  CMD2_ANY_STRING_V("method.rlookup.clear", tr1::bind(&rpc::object_storage::rlookup_clear, control->object_storage(), tr1::placeholders::_2));
++  CMD2_ANY_STRING  ("method.rlookup",       bind(&rpc::object_storage::rlookup_obj_list, control->object_storage(), placeholders::_2));
++  CMD2_ANY_STRING_V("method.rlookup.clear", bind(&rpc::object_storage::rlookup_clear, control->object_storage(), placeholders::_2));
+ 
+-  CMD2_ANY         ("catch", tr1::bind(&cmd_catch, tr1::placeholders::_1, tr1::placeholders::_2));
++  CMD2_ANY         ("catch", bind(&cmd_catch, placeholders::_1, placeholders::_2));
+ }
Index: net/rtorrent/patches/patch-src_command__events.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_command__events.cc
diff -N net/rtorrent/patches/patch-src_command__events.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_command__events.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,75 @@
+$NetBSD$
+
+--- src/command_events.cc.orig	2015-10-09 20:25:47.000000000 +0000
++++ src/command_events.cc
+@@ -59,6 +59,16 @@
+ 
+ #include "thread_worker.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++namespace placeholders { using namespace std::placeholders; }
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++namespace placeholders { using namespace std::tr1::placeholders; }
++#endif
++
+ torrent::Object
+ apply_on_ratio(const torrent::Object& rawArgs) {
+   const std::string& groupName = rawArgs.as_string();
+@@ -307,31 +317,31 @@ d_multicall(const torrent::Object::list_
+ 
+ void
+ initialize_command_events() {
+-  CMD2_ANY_STRING  ("on_ratio",        tr1::bind(&apply_on_ratio, tr1::placeholders::_2));
++  CMD2_ANY_STRING  ("on_ratio",        bind(&apply_on_ratio, placeholders::_2));
+ 
+-  CMD2_ANY         ("start_tied",      tr1::bind(&apply_start_tied));
+-  CMD2_ANY         ("stop_untied",     tr1::bind(&apply_stop_untied));
+-  CMD2_ANY         ("close_untied",    tr1::bind(&apply_close_untied));
+-  CMD2_ANY         ("remove_untied",   tr1::bind(&apply_remove_untied));
+-
+-  CMD2_ANY_LIST    ("schedule2",        tr1::bind(&apply_schedule, tr1::placeholders::_2));
+-  CMD2_ANY_STRING_V("schedule_remove2", tr1::bind(&rpc::CommandScheduler::erase_str, control->command_scheduler(), tr1::placeholders::_2));
+-
+-  CMD2_ANY_STRING_V("import",          tr1::bind(&apply_import, tr1::placeholders::_2));
+-  CMD2_ANY_STRING_V("try_import",      tr1::bind(&apply_try_import, tr1::placeholders::_2));
+-
+-  CMD2_ANY_LIST    ("load.normal",        tr1::bind(&apply_load, tr1::placeholders::_2, core::Manager::create_quiet | core::Manager::create_tied));
+-  CMD2_ANY_LIST    ("load.verbose",       tr1::bind(&apply_load, tr1::placeholders::_2, core::Manager::create_tied));
+-  CMD2_ANY_LIST    ("load.start",         tr1::bind(&apply_load, tr1::placeholders::_2,
++  CMD2_ANY         ("start_tied",      bind(&apply_start_tied));
++  CMD2_ANY         ("stop_untied",     bind(&apply_stop_untied));
++  CMD2_ANY         ("close_untied",    bind(&apply_close_untied));
++  CMD2_ANY         ("remove_untied",   bind(&apply_remove_untied));
++
++  CMD2_ANY_LIST    ("schedule2",        bind(&apply_schedule, placeholders::_2));
++  CMD2_ANY_STRING_V("schedule_remove2", bind(&rpc::CommandScheduler::erase_str, control->command_scheduler(), placeholders::_2));
++
++  CMD2_ANY_STRING_V("import",          bind(&apply_import, placeholders::_2));
++  CMD2_ANY_STRING_V("try_import",      bind(&apply_try_import, placeholders::_2));
++
++  CMD2_ANY_LIST    ("load.normal",        bind(&apply_load, placeholders::_2, core::Manager::create_quiet | core::Manager::create_tied));
++  CMD2_ANY_LIST    ("load.verbose",       bind(&apply_load, placeholders::_2, core::Manager::create_tied));
++  CMD2_ANY_LIST    ("load.start",         bind(&apply_load, placeholders::_2,
+                                                          core::Manager::create_quiet | core::Manager::create_tied | core::Manager::create_start));
+-  CMD2_ANY_LIST    ("load.start_verbose", tr1::bind(&apply_load, tr1::placeholders::_2, core::Manager::create_tied  | core::Manager::create_start));
+-  CMD2_ANY_LIST    ("load.raw",           tr1::bind(&apply_load, tr1::placeholders::_2, core::Manager::create_quiet | core::Manager::create_raw_data));
+-  CMD2_ANY_LIST    ("load.raw_verbose",   tr1::bind(&apply_load, tr1::placeholders::_2, core::Manager::create_raw_data));
+-  CMD2_ANY_LIST    ("load.raw_start",     tr1::bind(&apply_load, tr1::placeholders::_2,
++  CMD2_ANY_LIST    ("load.start_verbose", bind(&apply_load, placeholders::_2, core::Manager::create_tied  | core::Manager::create_start));
++  CMD2_ANY_LIST    ("load.raw",           bind(&apply_load, placeholders::_2, core::Manager::create_quiet | core::Manager::create_raw_data));
++  CMD2_ANY_LIST    ("load.raw_verbose",   bind(&apply_load, placeholders::_2, core::Manager::create_raw_data));
++  CMD2_ANY_LIST    ("load.raw_start",     bind(&apply_load, placeholders::_2,
+                                                          core::Manager::create_quiet | core::Manager::create_start | core::Manager::create_raw_data));
+ 
+-  CMD2_ANY_VALUE   ("close_low_diskspace", tr1::bind(&apply_close_low_diskspace, tr1::placeholders::_2));
++  CMD2_ANY_VALUE   ("close_low_diskspace", bind(&apply_close_low_diskspace, placeholders::_2));
+ 
+-  CMD2_ANY_LIST    ("download_list",       tr1::bind(&apply_download_list, tr1::placeholders::_2));
+-  CMD2_ANY_LIST    ("d.multicall2",        tr1::bind(&d_multicall, tr1::placeholders::_2));
++  CMD2_ANY_LIST    ("download_list",       bind(&apply_download_list, placeholders::_2));
++  CMD2_ANY_LIST    ("d.multicall2",        bind(&d_multicall, placeholders::_2));
+ }
Index: net/rtorrent/patches/patch-src_command__file.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_command__file.cc
diff -N net/rtorrent/patches/patch-src_command__file.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_command__file.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,103 @@
+$NetBSD$
+
+--- src/command_file.cc.orig	2015-10-09 20:33:56.000000000 +0000
++++ src/command_file.cc
+@@ -48,6 +48,16 @@
+ #include "control.h"
+ #include "command_helpers.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++namespace placeholders { using namespace std::placeholders; }
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++namespace placeholders { using namespace std::tr1::placeholders; }
++#endif
++
+ void
+ apply_f_set_priority(torrent::File* file, uint32_t value) {
+   if (value > torrent::PRIORITY_HIGH)
+@@ -100,45 +110,45 @@ apply_fi_filename_last(torrent::FileList
+ 
+ void
+ initialize_command_file() {
+-  CMD2_FILE("f.is_created",             tr1::bind(&torrent::File::is_created, tr1::placeholders::_1));
+-  CMD2_FILE("f.is_open",                tr1::bind(&torrent::File::is_open, tr1::placeholders::_1));
++  CMD2_FILE("f.is_created",             bind(&torrent::File::is_created, placeholders::_1));
++  CMD2_FILE("f.is_open",                bind(&torrent::File::is_open, placeholders::_1));
+ 
+-  CMD2_FILE("f.is_create_queued",       tr1::bind(&torrent::File::is_create_queued, tr1::placeholders::_1));
+-  CMD2_FILE("f.is_resize_queued",       tr1::bind(&torrent::File::is_resize_queued, tr1::placeholders::_1));
++  CMD2_FILE("f.is_create_queued",       bind(&torrent::File::is_create_queued, placeholders::_1));
++  CMD2_FILE("f.is_resize_queued",       bind(&torrent::File::is_resize_queued, placeholders::_1));
+ 
+-  CMD2_FILE_VALUE_V("f.set_create_queued",   tr1::bind(&torrent::File::set_flags,   tr1::placeholders::_1, torrent::File::flag_create_queued));
+-  CMD2_FILE_VALUE_V("f.set_resize_queued",   tr1::bind(&torrent::File::set_flags,   tr1::placeholders::_1, torrent::File::flag_resize_queued));
+-  CMD2_FILE_VALUE_V("f.unset_create_queued", tr1::bind(&torrent::File::unset_flags, tr1::placeholders::_1, torrent::File::flag_create_queued));
+-  CMD2_FILE_VALUE_V("f.unset_resize_queued", tr1::bind(&torrent::File::unset_flags, tr1::placeholders::_1, torrent::File::flag_resize_queued));
+-
+-  CMD2_FILE  ("f.prioritize_first",         tr1::bind(&torrent::File::has_flags,   tr1::placeholders::_1, torrent::File::flag_prioritize_first));
+-  CMD2_FILE_V("f.prioritize_first.enable",  tr1::bind(&torrent::File::set_flags,   tr1::placeholders::_1, torrent::File::flag_prioritize_first));
+-  CMD2_FILE_V("f.prioritize_first.disable", tr1::bind(&torrent::File::unset_flags, tr1::placeholders::_1, torrent::File::flag_prioritize_first));
+-  CMD2_FILE  ("f.prioritize_last",          tr1::bind(&torrent::File::has_flags,   tr1::placeholders::_1, torrent::File::flag_prioritize_last));
+-  CMD2_FILE_V("f.prioritize_last.enable",   tr1::bind(&torrent::File::set_flags,   tr1::placeholders::_1, torrent::File::flag_prioritize_last));
+-  CMD2_FILE_V("f.prioritize_last.disable",  tr1::bind(&torrent::File::unset_flags, tr1::placeholders::_1, torrent::File::flag_prioritize_last));
+-
+-  CMD2_FILE("f.size_bytes",             tr1::bind(&torrent::File::size_bytes, tr1::placeholders::_1));
+-  CMD2_FILE("f.size_chunks",            tr1::bind(&torrent::File::size_chunks, tr1::placeholders::_1));
+-  CMD2_FILE("f.completed_chunks",       tr1::bind(&torrent::File::completed_chunks, tr1::placeholders::_1));
+-
+-  CMD2_FILE("f.offset",                 tr1::bind(&torrent::File::offset, tr1::placeholders::_1));
+-  CMD2_FILE("f.range_first",            tr1::bind(&torrent::File::range_first, tr1::placeholders::_1));
+-  CMD2_FILE("f.range_second",           tr1::bind(&torrent::File::range_second, tr1::placeholders::_1));
+-
+-  CMD2_FILE("f.priority",               tr1::bind(&torrent::File::priority, tr1::placeholders::_1));
+-  CMD2_FILE_VALUE_V("f.priority.set",   tr1::bind(&apply_f_set_priority, tr1::placeholders::_1, tr1::placeholders::_2));
+-
+-  CMD2_FILE("f.path",                   tr1::bind(&apply_f_path, tr1::placeholders::_1));
+-  CMD2_FILE("f.path_components",        tr1::bind(&apply_f_path_components, tr1::placeholders::_1));
+-  CMD2_FILE("f.path_depth",             tr1::bind(&apply_f_path_depth, tr1::placeholders::_1));
+-  CMD2_FILE("f.frozen_path",            tr1::bind(&torrent::File::frozen_path, tr1::placeholders::_1));
++  CMD2_FILE_VALUE_V("f.set_create_queued",   bind(&torrent::File::set_flags,   placeholders::_1, torrent::File::flag_create_queued));
++  CMD2_FILE_VALUE_V("f.set_resize_queued",   bind(&torrent::File::set_flags,   placeholders::_1, torrent::File::flag_resize_queued));
++  CMD2_FILE_VALUE_V("f.unset_create_queued", bind(&torrent::File::unset_flags, placeholders::_1, torrent::File::flag_create_queued));
++  CMD2_FILE_VALUE_V("f.unset_resize_queued", bind(&torrent::File::unset_flags, placeholders::_1, torrent::File::flag_resize_queued));
++
++  CMD2_FILE  ("f.prioritize_first",         bind(&torrent::File::has_flags,   placeholders::_1, torrent::File::flag_prioritize_first));
++  CMD2_FILE_V("f.prioritize_first.enable",  bind(&torrent::File::set_flags,   placeholders::_1, torrent::File::flag_prioritize_first));
++  CMD2_FILE_V("f.prioritize_first.disable", bind(&torrent::File::unset_flags, placeholders::_1, torrent::File::flag_prioritize_first));
++  CMD2_FILE  ("f.prioritize_last",          bind(&torrent::File::has_flags,   placeholders::_1, torrent::File::flag_prioritize_last));
++  CMD2_FILE_V("f.prioritize_last.enable",   bind(&torrent::File::set_flags,   placeholders::_1, torrent::File::flag_prioritize_last));
++  CMD2_FILE_V("f.prioritize_last.disable",  bind(&torrent::File::unset_flags, placeholders::_1, torrent::File::flag_prioritize_last));
++
++  CMD2_FILE("f.size_bytes",             bind(&torrent::File::size_bytes, placeholders::_1));
++  CMD2_FILE("f.size_chunks",            bind(&torrent::File::size_chunks, placeholders::_1));
++  CMD2_FILE("f.completed_chunks",       bind(&torrent::File::completed_chunks, placeholders::_1));
++
++  CMD2_FILE("f.offset",                 bind(&torrent::File::offset, placeholders::_1));
++  CMD2_FILE("f.range_first",            bind(&torrent::File::range_first, placeholders::_1));
++  CMD2_FILE("f.range_second",           bind(&torrent::File::range_second, placeholders::_1));
++
++  CMD2_FILE("f.priority",               bind(&torrent::File::priority, placeholders::_1));
++  CMD2_FILE_VALUE_V("f.priority.set",   bind(&apply_f_set_priority, placeholders::_1, placeholders::_2));
++
++  CMD2_FILE("f.path",                   bind(&apply_f_path, placeholders::_1));
++  CMD2_FILE("f.path_components",        bind(&apply_f_path_components, placeholders::_1));
++  CMD2_FILE("f.path_depth",             bind(&apply_f_path_depth, placeholders::_1));
++  CMD2_FILE("f.frozen_path",            bind(&torrent::File::frozen_path, placeholders::_1));
+ 
+-  CMD2_FILE("f.match_depth_prev",       tr1::bind(&torrent::File::match_depth_prev, tr1::placeholders::_1));
+-  CMD2_FILE("f.match_depth_next",       tr1::bind(&torrent::File::match_depth_next, tr1::placeholders::_1));
++  CMD2_FILE("f.match_depth_prev",       bind(&torrent::File::match_depth_prev, placeholders::_1));
++  CMD2_FILE("f.match_depth_next",       bind(&torrent::File::match_depth_next, placeholders::_1));
+ 
+-  CMD2_FILE("f.last_touched",           tr1::bind(&torrent::File::last_touched, tr1::placeholders::_1));
++  CMD2_FILE("f.last_touched",           bind(&torrent::File::last_touched, placeholders::_1));
+ 
+-  CMD2_FILEITR("fi.filename_last",      tr1::bind(&apply_fi_filename_last, tr1::placeholders::_1));
+-  CMD2_FILEITR("fi.is_file",            tr1::bind(&torrent::FileListIterator::is_file, tr1::placeholders::_1));
++  CMD2_FILEITR("fi.filename_last",      bind(&apply_fi_filename_last, placeholders::_1));
++  CMD2_FILEITR("fi.is_file",            bind(&torrent::FileListIterator::is_file, placeholders::_1));
+ }
Index: net/rtorrent/patches/patch-src_command__groups.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_command__groups.cc
diff -N net/rtorrent/patches/patch-src_command__groups.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_command__groups.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,126 @@
+$NetBSD$
+
+--- src/command_groups.cc.orig	2015-10-09 20:33:11.000000000 +0000
++++ src/command_groups.cc
+@@ -52,6 +52,16 @@
+ // For cg_d_group.
+ #include "core/download.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++namespace placeholders { using namespace std::placeholders; }
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++namespace placeholders { using namespace std::tr1::placeholders; }
++#endif
++
+ // A hack to allow testing of the new choke_group API without the
+ // working parts present.
+ #define USE_CHOKE_GROUP 0
+@@ -264,8 +274,8 @@ apply_cg_tracker_mode_set(const torrent:
+   return torrent::Object();
+ }
+ 
+-#define CG_GROUP_AT()          tr1::bind(&cg_get_group, tr1::placeholders::_2)
+-#define CHOKE_GROUP(direction) tr1::bind(direction, CG_GROUP_AT())
++#define CG_GROUP_AT()          bind(&cg_get_group, placeholders::_2)
++#define CHOKE_GROUP(direction) bind(direction, CG_GROUP_AT())
+ 
+ /*
+ 
+@@ -336,54 +346,54 @@ options.
+ void
+ initialize_command_groups() {
+   // Move somewhere else?
+-  CMD2_ANY         ("strings.choke_heuristics",          tr1::bind(&torrent::option_list_strings, torrent::OPTION_CHOKE_HEURISTICS));
+-  CMD2_ANY         ("strings.choke_heuristics.upload",   tr1::bind(&torrent::option_list_strings, torrent::OPTION_CHOKE_HEURISTICS_UPLOAD));
+-  CMD2_ANY         ("strings.choke_heuristics.download", tr1::bind(&torrent::option_list_strings, torrent::OPTION_CHOKE_HEURISTICS_DOWNLOAD));
+-  CMD2_ANY         ("strings.tracker_mode",              tr1::bind(&torrent::option_list_strings, torrent::OPTION_TRACKER_MODE));
++  CMD2_ANY         ("strings.choke_heuristics",          bind(&torrent::option_list_strings, torrent::OPTION_CHOKE_HEURISTICS));
++  CMD2_ANY         ("strings.choke_heuristics.upload",   bind(&torrent::option_list_strings, torrent::OPTION_CHOKE_HEURISTICS_UPLOAD));
++  CMD2_ANY         ("strings.choke_heuristics.download", bind(&torrent::option_list_strings, torrent::OPTION_CHOKE_HEURISTICS_DOWNLOAD));
++  CMD2_ANY         ("strings.tracker_mode",              bind(&torrent::option_list_strings, torrent::OPTION_TRACKER_MODE));
+ 
+-  CMD2_ANY         ("choke_group.list",                tr1::bind(&apply_cg_list));
+-  CMD2_ANY_STRING  ("choke_group.insert",              tr1::bind(&apply_cg_insert, tr1::placeholders::_2));
++  CMD2_ANY         ("choke_group.list",                bind(&apply_cg_list));
++  CMD2_ANY_STRING  ("choke_group.insert",              bind(&apply_cg_insert, placeholders::_2));
+ 
+ #if USE_CHOKE_GROUP
+-  CMD2_ANY         ("choke_group.size",                tr1::bind(&torrent::ResourceManager::group_size, torrent::resource_manager()));
+-  CMD2_ANY_STRING  ("choke_group.index_of",            tr1::bind(&torrent::ResourceManager::group_index_of, torrent::resource_manager(), tr1::placeholders::_2));
++  CMD2_ANY         ("choke_group.size",                bind(&torrent::ResourceManager::group_size, torrent::resource_manager()));
++  CMD2_ANY_STRING  ("choke_group.index_of",            bind(&torrent::ResourceManager::group_index_of, torrent::resource_manager(), placeholders::_2));
+ #else
+   apply_cg_insert("default");
+ 
+-  CMD2_ANY         ("choke_group.size",                tr1::bind(&std::vector<torrent::choke_group*>::size, cg_list_hack));
+-  CMD2_ANY_STRING  ("choke_group.index_of",            tr1::bind(&apply_cg_index_of, tr1::placeholders::_2));
++  CMD2_ANY         ("choke_group.size",                bind(&std::vector<torrent::choke_group*>::size, cg_list_hack));
++  CMD2_ANY_STRING  ("choke_group.index_of",            bind(&apply_cg_index_of, placeholders::_2));
+ #endif
+ 
+   // Commands specific for a group. Supports as the first argument the
+   // name, the index or a negative index.
+-  CMD2_ANY         ("choke_group.general.size",        tr1::bind(&torrent::choke_group::size, CG_GROUP_AT()));
++  CMD2_ANY         ("choke_group.general.size",        bind(&torrent::choke_group::size, CG_GROUP_AT()));
+ 
+-  CMD2_ANY         ("choke_group.tracker.mode",        tr1::bind(&torrent::option_as_string, torrent::OPTION_TRACKER_MODE,
+-                                                                 tr1::bind(&torrent::choke_group::tracker_mode, CG_GROUP_AT())));
+-  CMD2_ANY_LIST    ("choke_group.tracker.mode.set",    tr1::bind(&apply_cg_tracker_mode_set, tr1::placeholders::_2));
+-
+-  CMD2_ANY         ("choke_group.up.rate",             tr1::bind(&torrent::choke_group::up_rate, CG_GROUP_AT()));
+-  CMD2_ANY         ("choke_group.down.rate",           tr1::bind(&torrent::choke_group::down_rate, CG_GROUP_AT()));
+-
+-  CMD2_ANY         ("choke_group.up.max.unlimited",    tr1::bind(&torrent::choke_queue::is_unlimited, CHOKE_GROUP(&torrent::choke_group::up_queue)));
+-  CMD2_ANY         ("choke_group.up.max",              tr1::bind(&torrent::choke_queue::max_unchoked_signed, CHOKE_GROUP(&torrent::choke_group::up_queue)));
+-  CMD2_ANY_LIST    ("choke_group.up.max.set",          tr1::bind(&apply_cg_max_set, tr1::placeholders::_2, true));
+-
+-  CMD2_ANY         ("choke_group.up.total",            tr1::bind(&torrent::choke_queue::size_total, CHOKE_GROUP(&torrent::choke_group::up_queue)));
+-  CMD2_ANY         ("choke_group.up.queued",           tr1::bind(&torrent::choke_queue::size_queued, CHOKE_GROUP(&torrent::choke_group::up_queue)));
+-  CMD2_ANY         ("choke_group.up.unchoked",         tr1::bind(&torrent::choke_queue::size_unchoked, CHOKE_GROUP(&torrent::choke_group::up_queue)));
+-  CMD2_ANY         ("choke_group.up.heuristics",       tr1::bind(&torrent::option_as_string, torrent::OPTION_CHOKE_HEURISTICS,
+-                                                                 tr1::bind(&torrent::choke_queue::heuristics, CHOKE_GROUP(&torrent::choke_group::up_queue))));
+-  CMD2_ANY_LIST    ("choke_group.up.heuristics.set",   tr1::bind(&apply_cg_heuristics_set, tr1::placeholders::_2, true));
+-
+-  CMD2_ANY         ("choke_group.down.max.unlimited",  tr1::bind(&torrent::choke_queue::is_unlimited, CHOKE_GROUP(&torrent::choke_group::down_queue)));
+-  CMD2_ANY         ("choke_group.down.max",            tr1::bind(&torrent::choke_queue::max_unchoked_signed, CHOKE_GROUP(&torrent::choke_group::down_queue)));
+-  CMD2_ANY_LIST    ("choke_group.down.max.set",        tr1::bind(&apply_cg_max_set, tr1::placeholders::_2, false));
+-
+-  CMD2_ANY         ("choke_group.down.total",          tr1::bind(&torrent::choke_queue::size_total, CHOKE_GROUP(&torrent::choke_group::down_queue)));
+-  CMD2_ANY         ("choke_group.down.queued",         tr1::bind(&torrent::choke_queue::size_queued, CHOKE_GROUP(&torrent::choke_group::down_queue)));
+-  CMD2_ANY         ("choke_group.down.unchoked",       tr1::bind(&torrent::choke_queue::size_unchoked, CHOKE_GROUP(&torrent::choke_group::down_queue)));
+-  CMD2_ANY         ("choke_group.down.heuristics",     tr1::bind(&torrent::option_as_string, torrent::OPTION_CHOKE_HEURISTICS,
+-                                                                 tr1::bind(&torrent::choke_queue::heuristics, CHOKE_GROUP(&torrent::choke_group::down_queue))));
+-  CMD2_ANY_LIST    ("choke_group.down.heuristics.set", tr1::bind(&apply_cg_heuristics_set, tr1::placeholders::_2, false));
++  CMD2_ANY         ("choke_group.tracker.mode",        bind(&torrent::option_as_string, torrent::OPTION_TRACKER_MODE,
++                                                                 bind(&torrent::choke_group::tracker_mode, CG_GROUP_AT())));
++  CMD2_ANY_LIST    ("choke_group.tracker.mode.set",    bind(&apply_cg_tracker_mode_set, placeholders::_2));
++
++  CMD2_ANY         ("choke_group.up.rate",             bind(&torrent::choke_group::up_rate, CG_GROUP_AT()));
++  CMD2_ANY         ("choke_group.down.rate",           bind(&torrent::choke_group::down_rate, CG_GROUP_AT()));
++
++  CMD2_ANY         ("choke_group.up.max.unlimited",    bind(&torrent::choke_queue::is_unlimited, CHOKE_GROUP(&torrent::choke_group::up_queue)));
++  CMD2_ANY         ("choke_group.up.max",              bind(&torrent::choke_queue::max_unchoked_signed, CHOKE_GROUP(&torrent::choke_group::up_queue)));
++  CMD2_ANY_LIST    ("choke_group.up.max.set",          bind(&apply_cg_max_set, placeholders::_2, true));
++
++  CMD2_ANY         ("choke_group.up.total",            bind(&torrent::choke_queue::size_total, CHOKE_GROUP(&torrent::choke_group::up_queue)));
++  CMD2_ANY         ("choke_group.up.queued",           bind(&torrent::choke_queue::size_queued, CHOKE_GROUP(&torrent::choke_group::up_queue)));
++  CMD2_ANY         ("choke_group.up.unchoked",         bind(&torrent::choke_queue::size_unchoked, CHOKE_GROUP(&torrent::choke_group::up_queue)));
++  CMD2_ANY         ("choke_group.up.heuristics",       bind(&torrent::option_as_string, torrent::OPTION_CHOKE_HEURISTICS,
++                                                                 bind(&torrent::choke_queue::heuristics, CHOKE_GROUP(&torrent::choke_group::up_queue))));
++  CMD2_ANY_LIST    ("choke_group.up.heuristics.set",   bind(&apply_cg_heuristics_set, placeholders::_2, true));
++
++  CMD2_ANY         ("choke_group.down.max.unlimited",  bind(&torrent::choke_queue::is_unlimited, CHOKE_GROUP(&torrent::choke_group::down_queue)));
++  CMD2_ANY         ("choke_group.down.max",            bind(&torrent::choke_queue::max_unchoked_signed, CHOKE_GROUP(&torrent::choke_group::down_queue)));
++  CMD2_ANY_LIST    ("choke_group.down.max.set",        bind(&apply_cg_max_set, placeholders::_2, false));
++
++  CMD2_ANY         ("choke_group.down.total",          bind(&torrent::choke_queue::size_total, CHOKE_GROUP(&torrent::choke_group::down_queue)));
++  CMD2_ANY         ("choke_group.down.queued",         bind(&torrent::choke_queue::size_queued, CHOKE_GROUP(&torrent::choke_group::down_queue)));
++  CMD2_ANY         ("choke_group.down.unchoked",       bind(&torrent::choke_queue::size_unchoked, CHOKE_GROUP(&torrent::choke_group::down_queue)));
++  CMD2_ANY         ("choke_group.down.heuristics",     bind(&torrent::option_as_string, torrent::OPTION_CHOKE_HEURISTICS,
++                                                                 bind(&torrent::choke_queue::heuristics, CHOKE_GROUP(&torrent::choke_group::down_queue))));
++  CMD2_ANY_LIST    ("choke_group.down.heuristics.set", bind(&apply_cg_heuristics_set, placeholders::_2, false));
+ }
Index: net/rtorrent/patches/patch-src_command__helpers.h
===================================================================
RCS file: net/rtorrent/patches/patch-src_command__helpers.h
diff -N net/rtorrent/patches/patch-src_command__helpers.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_command__helpers.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,74 @@
+$NetBSD$
+
+--- src/command_helpers.h.orig	2015-10-09 20:24:03.000000000 +0000
++++ src/command_helpers.h
+@@ -41,8 +41,6 @@
+ #include "rpc/parse_commands.h"
+ #include "rpc/object_storage.h"
+ 
+-namespace tr1 { using namespace std::tr1; }
+-
+ void initialize_commands();
+ 
+ //
+@@ -100,43 +98,43 @@ void initialize_commands();
+ 
+ #define CMD2_VAR_BOOL(key, value)                                       \
+   control->object_storage()->insert_c_str(key, int64_t(value), rpc::object_storage::flag_bool_type); \
+-  CMD2_ANY(key, tr1::bind(&rpc::object_storage::get, control->object_storage(), \
++  CMD2_ANY(key, bind(&rpc::object_storage::get, control->object_storage(), \
+                                torrent::raw_string::from_c_str(key)));  \
+-  CMD2_ANY_VALUE(key ".set", tr1::bind(&rpc::object_storage::set_bool, control->object_storage(), \
+-                                            torrent::raw_string::from_c_str(key), tr1::placeholders::_2));
++  CMD2_ANY_VALUE(key ".set", bind(&rpc::object_storage::set_bool, control->object_storage(), \
++                                            torrent::raw_string::from_c_str(key), placeholders::_2));
+ 
+ #define CMD2_VAR_VALUE(key, value)                                      \
+   control->object_storage()->insert_c_str(key, int64_t(value), rpc::object_storage::flag_value_type); \
+-  CMD2_ANY(key, tr1::bind(&rpc::object_storage::get, control->object_storage(), \
++  CMD2_ANY(key, bind(&rpc::object_storage::get, control->object_storage(), \
+                                torrent::raw_string::from_c_str(key)));  \
+-  CMD2_ANY_VALUE(key ".set", tr1::bind(&rpc::object_storage::set_value, control->object_storage(), \
+-                                            torrent::raw_string::from_c_str(key), tr1::placeholders::_2));
++  CMD2_ANY_VALUE(key ".set", bind(&rpc::object_storage::set_value, control->object_storage(), \
++                                            torrent::raw_string::from_c_str(key), placeholders::_2));
+ 
+ #define CMD2_VAR_STRING(key, value)                                     \
+   control->object_storage()->insert_c_str(key, value, rpc::object_storage::flag_string_type); \
+-  CMD2_ANY(key, tr1::bind(&rpc::object_storage::get, control->object_storage(), \
++  CMD2_ANY(key, bind(&rpc::object_storage::get, control->object_storage(), \
+                                torrent::raw_string::from_c_str(key)));  \
+-  CMD2_ANY_STRING(key ".set", tr1::bind(&rpc::object_storage::set_string, control->object_storage(), \
+-                                             torrent::raw_string::from_c_str(key), tr1::placeholders::_2));
++  CMD2_ANY_STRING(key ".set", bind(&rpc::object_storage::set_string, control->object_storage(), \
++                                             torrent::raw_string::from_c_str(key), placeholders::_2));
+ 
+ 
+ #define CMD2_VAR_C_STRING(key, value)                                   \
+   control->object_storage()->insert_c_str(key, value, rpc::object_storage::flag_string_type); \
+-  CMD2_ANY(key, tr1::bind(&rpc::object_storage::get, control->object_storage(), \
++  CMD2_ANY(key, bind(&rpc::object_storage::get, control->object_storage(), \
+                                torrent::raw_string::from_c_str(key)));
+ 
+ #define CMD2_VAR_LIST(key)                                              \
+   control->object_storage()->insert_c_str(key, torrent::Object::create_list(), rpc::object_storage::flag_list_type); \
+-  CMD2_ANY(key, tr1::bind(&rpc::object_storage::get, control->object_storage(), \
++  CMD2_ANY(key, bind(&rpc::object_storage::get, control->object_storage(), \
+                                torrent::raw_string::from_c_str(key)));  \
+-  CMD2_ANY_LIST(key ".set", tr1::bind(&rpc::object_storage::set_list, control->object_storage(), \
+-                                           torrent::raw_string::from_c_str(key), tr1::placeholders::_2)); \
+-  CMD2_ANY_VOID(key ".push_back", tr1::bind(&rpc::object_storage::list_push_back, control->object_storage(), \
+-                                                 torrent::raw_string::from_c_str(key), tr1::placeholders::_2));
++  CMD2_ANY_LIST(key ".set", bind(&rpc::object_storage::set_list, control->object_storage(), \
++                                           torrent::raw_string::from_c_str(key), placeholders::_2)); \
++  CMD2_ANY_VOID(key ".push_back", bind(&rpc::object_storage::list_push_back, control->object_storage(), \
++                                                 torrent::raw_string::from_c_str(key), placeholders::_2));
+ 
+ #define CMD2_FUNC_SINGLE(key, cmds)                                     \
+-  CMD2_ANY(key, tr1::bind(&rpc::command_function_call_object, torrent::Object(torrent::raw_string::from_c_str(cmds)), \
+-                               tr1::placeholders::_1, tr1::placeholders::_2));
++  CMD2_ANY(key, bind(&rpc::command_function_call_object, torrent::Object(torrent::raw_string::from_c_str(cmds)), \
++                               placeholders::_1, placeholders::_2));
+ 
+ #define CMD2_REDIRECT(from_key, to_key) \
+   rpc::commands.create_redirect(from_key, to_key, rpc::CommandMap::flag_public_xmlrpc | rpc::CommandMap::flag_dont_delete);
Index: net/rtorrent/patches/patch-src_command__ip.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_command__ip.cc
diff -N net/rtorrent/patches/patch-src_command__ip.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_command__ip.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,51 @@
+$NetBSD$
+
+--- src/command_ip.cc.orig	2015-10-09 20:32:30.000000000 +0000
++++ src/command_ip.cc
+@@ -45,6 +45,16 @@
+ #include "globals.h"
+ #include "command_helpers.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++namespace placeholders { using namespace std::placeholders; }
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++namespace placeholders { using namespace std::tr1::placeholders; }
++#endif
++
+ void
+ ipv4_filter_parse(const char* address, int value) {
+   uint32_t ip_values[4] = { 0, 0, 0, 0 };
+@@ -281,17 +291,17 @@ apply_ipv4_filter_dump() {
+ 
+ void
+ initialize_command_ip() {
+-  CMD2_ANY         ("strings.ip_filter",       tr1::bind(&torrent::option_list_strings, torrent::OPTION_IP_FILTER));
+-  CMD2_ANY         ("strings.ip_tos",          tr1::bind(&torrent::option_list_strings, torrent::OPTION_IP_TOS));
++  CMD2_ANY         ("strings.ip_filter",       bind(&torrent::option_list_strings, torrent::OPTION_IP_FILTER));
++  CMD2_ANY         ("strings.ip_tos",          bind(&torrent::option_list_strings, torrent::OPTION_IP_TOS));
+ 
+-  CMD2_ANY_STRING  ("ip_tables.insert_table",  tr1::bind(&apply_ip_tables_insert_table, tr1::placeholders::_2));
+-  CMD2_ANY_STRING  ("ip_tables.size_data",     tr1::bind(&apply_ip_tables_size_data, tr1::placeholders::_2));
+-  CMD2_ANY_LIST    ("ip_tables.get",           tr1::bind(&apply_ip_tables_get, tr1::placeholders::_2));
+-  CMD2_ANY_LIST    ("ip_tables.add_address",   tr1::bind(&apply_ip_tables_add_address, tr1::placeholders::_2));
+-
+-  CMD2_ANY         ("ipv4_filter.size_data",   tr1::bind(&apply_ipv4_filter_size_data));
+-  CMD2_ANY_STRING  ("ipv4_filter.get",         tr1::bind(&apply_ipv4_filter_get, tr1::placeholders::_2));
+-  CMD2_ANY_LIST    ("ipv4_filter.add_address", tr1::bind(&apply_ipv4_filter_add_address, tr1::placeholders::_2));
+-  CMD2_ANY_LIST    ("ipv4_filter.load",        tr1::bind(&apply_ipv4_filter_load, tr1::placeholders::_2));
+-  CMD2_ANY_LIST    ("ipv4_filter.dump",        tr1::bind(&apply_ipv4_filter_dump));
++  CMD2_ANY_STRING  ("ip_tables.insert_table",  bind(&apply_ip_tables_insert_table, placeholders::_2));
++  CMD2_ANY_STRING  ("ip_tables.size_data",     bind(&apply_ip_tables_size_data, placeholders::_2));
++  CMD2_ANY_LIST    ("ip_tables.get",           bind(&apply_ip_tables_get, placeholders::_2));
++  CMD2_ANY_LIST    ("ip_tables.add_address",   bind(&apply_ip_tables_add_address, placeholders::_2));
++
++  CMD2_ANY         ("ipv4_filter.size_data",   bind(&apply_ipv4_filter_size_data));
++  CMD2_ANY_STRING  ("ipv4_filter.get",         bind(&apply_ipv4_filter_get, placeholders::_2));
++  CMD2_ANY_LIST    ("ipv4_filter.add_address", bind(&apply_ipv4_filter_add_address, placeholders::_2));
++  CMD2_ANY_LIST    ("ipv4_filter.load",        bind(&apply_ipv4_filter_load, placeholders::_2));
++  CMD2_ANY_LIST    ("ipv4_filter.dump",        bind(&apply_ipv4_filter_dump));
+ }
Index: net/rtorrent/patches/patch-src_command__local.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_command__local.cc
diff -N net/rtorrent/patches/patch-src_command__local.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_command__local.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,184 @@
+$NetBSD$
+
+--- src/command_local.cc.orig	2015-10-09 20:27:16.000000000 +0000
++++ src/command_local.cc
+@@ -64,6 +64,16 @@
+ #include "control.h"
+ #include "command_helpers.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++namespace placeholders { using namespace std::placeholders; }
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++namespace placeholders { using namespace std::tr1::placeholders; }
++#endif
++
+ typedef torrent::ChunkManager CM_t;
+ typedef torrent::FileManager  FM_t;
+ 
+@@ -314,8 +324,8 @@ initialize_command_local() {
+   core::DownloadList*    dList = control->core()->download_list();
+   core::DownloadStore*   dStore = control->core()->download_store();
+ 
+-  CMD2_ANY         ("system.hostname", tr1::bind(&system_hostname));
+-  CMD2_ANY         ("system.pid",      tr1::bind(&getpid));
++  CMD2_ANY         ("system.hostname", bind(&system_hostname));
++  CMD2_ANY         ("system.pid",      bind(&getpid));
+ 
+   CMD2_VAR_C_STRING("system.api_version",           (int64_t)API_VERSION);
+   CMD2_VAR_C_STRING("system.client_version",        PACKAGE_VERSION);
+@@ -325,54 +335,54 @@ initialize_command_local() {
+   CMD2_VAR_VALUE   ("system.file.split_size",       -1);
+   CMD2_VAR_STRING  ("system.file.split_suffix",     ".part");
+ 
+-  CMD2_ANY         ("system.file_status_cache.size",   tr1::bind(&utils::FileStatusCache::size,
++  CMD2_ANY         ("system.file_status_cache.size",   bind(&utils::FileStatusCache::size,
+                                                                       (utils::FileStatusCache::base_type*)control->core()->file_status_cache()));
+-  CMD2_ANY_V       ("system.file_status_cache.prune",  tr1::bind(&utils::FileStatusCache::prune, control->core()->file_status_cache()));
++  CMD2_ANY_V       ("system.file_status_cache.prune",  bind(&utils::FileStatusCache::prune, control->core()->file_status_cache()));
+ 
+   CMD2_VAR_BOOL    ("file.prioritize_toc",          0);
+   CMD2_VAR_LIST    ("file.prioritize_toc.first");
+   CMD2_VAR_LIST    ("file.prioritize_toc.last");
+ 
+-  CMD2_ANY         ("system.files.opened_counter",     tr1::bind(&FM_t::files_opened_counter, fileManager));
+-  CMD2_ANY         ("system.files.closed_counter",     tr1::bind(&FM_t::files_closed_counter, fileManager));
+-  CMD2_ANY         ("system.files.failed_counter",     tr1::bind(&FM_t::files_failed_counter, fileManager));
+-
+-  CMD2_ANY         ("system.time",                     tr1::bind(&rak::timer::seconds, &cachedTime));
+-  CMD2_ANY         ("system.time_seconds",             tr1::bind(&rak::timer::current_seconds));
+-  CMD2_ANY         ("system.time_usec",                tr1::bind(&rak::timer::current_usec));
+-
+-  CMD2_ANY_VALUE_V ("system.umask.set",                tr1::bind(&umask, tr1::placeholders::_2));
+-
+-  CMD2_ANY         ("system.cwd",                      tr1::bind(&system_get_cwd));
+-  CMD2_ANY_STRING  ("system.cwd.set",                  tr1::bind(&system_set_cwd, tr1::placeholders::_2));
+-
+-  CMD2_ANY         ("pieces.sync.always_safe",         tr1::bind(&CM_t::safe_sync, chunkManager));
+-  CMD2_ANY_VALUE_V ("pieces.sync.always_safe.set",     tr1::bind(&CM_t::set_safe_sync, chunkManager, tr1::placeholders::_2));
+-  CMD2_ANY         ("pieces.sync.safe_free_diskspace", tr1::bind(&CM_t::safe_free_diskspace, chunkManager));
+-  CMD2_ANY         ("pieces.sync.timeout",             tr1::bind(&CM_t::timeout_sync, chunkManager));
+-  CMD2_ANY_VALUE_V ("pieces.sync.timeout.set",         tr1::bind(&CM_t::set_timeout_sync, chunkManager, tr1::placeholders::_2));
+-  CMD2_ANY         ("pieces.sync.timeout_safe",        tr1::bind(&CM_t::timeout_safe_sync, chunkManager));
+-  CMD2_ANY_VALUE_V ("pieces.sync.timeout_safe.set",    tr1::bind(&CM_t::set_timeout_safe_sync, chunkManager, tr1::placeholders::_2));
+-  CMD2_ANY         ("pieces.sync.queue_size",          tr1::bind(&CM_t::sync_queue_size, chunkManager));
+-
+-  CMD2_ANY         ("pieces.preload.type",             tr1::bind(&CM_t::preload_type, chunkManager));
+-  CMD2_ANY_VALUE_V ("pieces.preload.type.set",         tr1::bind(&CM_t::set_preload_type, chunkManager, tr1::placeholders::_2));
+-  CMD2_ANY         ("pieces.preload.min_size",         tr1::bind(&CM_t::preload_min_size, chunkManager));
+-  CMD2_ANY_VALUE_V ("pieces.preload.min_size.set",     tr1::bind(&CM_t::set_preload_min_size, chunkManager, tr1::placeholders::_2));
+-  CMD2_ANY         ("pieces.preload.min_rate",         tr1::bind(&CM_t::preload_required_rate, chunkManager));
+-  CMD2_ANY_VALUE_V ("pieces.preload.min_rate.set",     tr1::bind(&CM_t::set_preload_required_rate, chunkManager, tr1::placeholders::_2));
+-
+-  CMD2_ANY         ("pieces.memory.current",           tr1::bind(&CM_t::memory_usage, chunkManager));
+-  CMD2_ANY         ("pieces.memory.sync_queue",        tr1::bind(&CM_t::sync_queue_memory_usage, chunkManager));
+-  CMD2_ANY         ("pieces.memory.block_count",       tr1::bind(&CM_t::memory_block_count, chunkManager));
+-  CMD2_ANY         ("pieces.memory.max",               tr1::bind(&CM_t::max_memory_usage, chunkManager));
+-  CMD2_ANY_VALUE_V ("pieces.memory.max.set",           tr1::bind(&CM_t::set_max_memory_usage, chunkManager, tr1::placeholders::_2));
+-  CMD2_ANY         ("pieces.stats_preloaded",          tr1::bind(&CM_t::stats_preloaded, chunkManager));
+-  CMD2_ANY         ("pieces.stats_not_preloaded",      tr1::bind(&CM_t::stats_not_preloaded, chunkManager));
++  CMD2_ANY         ("system.files.opened_counter",     bind(&FM_t::files_opened_counter, fileManager));
++  CMD2_ANY         ("system.files.closed_counter",     bind(&FM_t::files_closed_counter, fileManager));
++  CMD2_ANY         ("system.files.failed_counter",     bind(&FM_t::files_failed_counter, fileManager));
++
++  CMD2_ANY         ("system.time",                     bind(&rak::timer::seconds, &cachedTime));
++  CMD2_ANY         ("system.time_seconds",             bind(&rak::timer::current_seconds));
++  CMD2_ANY         ("system.time_usec",                bind(&rak::timer::current_usec));
++
++  CMD2_ANY_VALUE_V ("system.umask.set",                bind(&umask, placeholders::_2));
++
++  CMD2_ANY         ("system.cwd",                      bind(&system_get_cwd));
++  CMD2_ANY_STRING  ("system.cwd.set",                  bind(&system_set_cwd, placeholders::_2));
++
++  CMD2_ANY         ("pieces.sync.always_safe",         bind(&CM_t::safe_sync, chunkManager));
++  CMD2_ANY_VALUE_V ("pieces.sync.always_safe.set",     bind(&CM_t::set_safe_sync, chunkManager, placeholders::_2));
++  CMD2_ANY         ("pieces.sync.safe_free_diskspace", bind(&CM_t::safe_free_diskspace, chunkManager));
++  CMD2_ANY         ("pieces.sync.timeout",             bind(&CM_t::timeout_sync, chunkManager));
++  CMD2_ANY_VALUE_V ("pieces.sync.timeout.set",         bind(&CM_t::set_timeout_sync, chunkManager, placeholders::_2));
++  CMD2_ANY         ("pieces.sync.timeout_safe",        bind(&CM_t::timeout_safe_sync, chunkManager));
++  CMD2_ANY_VALUE_V ("pieces.sync.timeout_safe.set",    bind(&CM_t::set_timeout_safe_sync, chunkManager, placeholders::_2));
++  CMD2_ANY         ("pieces.sync.queue_size",          bind(&CM_t::sync_queue_size, chunkManager));
++
++  CMD2_ANY         ("pieces.preload.type",             bind(&CM_t::preload_type, chunkManager));
++  CMD2_ANY_VALUE_V ("pieces.preload.type.set",         bind(&CM_t::set_preload_type, chunkManager, placeholders::_2));
++  CMD2_ANY         ("pieces.preload.min_size",         bind(&CM_t::preload_min_size, chunkManager));
++  CMD2_ANY_VALUE_V ("pieces.preload.min_size.set",     bind(&CM_t::set_preload_min_size, chunkManager, placeholders::_2));
++  CMD2_ANY         ("pieces.preload.min_rate",         bind(&CM_t::preload_required_rate, chunkManager));
++  CMD2_ANY_VALUE_V ("pieces.preload.min_rate.set",     bind(&CM_t::set_preload_required_rate, chunkManager, placeholders::_2));
++
++  CMD2_ANY         ("pieces.memory.current",           bind(&CM_t::memory_usage, chunkManager));
++  CMD2_ANY         ("pieces.memory.sync_queue",        bind(&CM_t::sync_queue_memory_usage, chunkManager));
++  CMD2_ANY         ("pieces.memory.block_count",       bind(&CM_t::memory_block_count, chunkManager));
++  CMD2_ANY         ("pieces.memory.max",               bind(&CM_t::max_memory_usage, chunkManager));
++  CMD2_ANY_VALUE_V ("pieces.memory.max.set",           bind(&CM_t::set_max_memory_usage, chunkManager, placeholders::_2));
++  CMD2_ANY         ("pieces.stats_preloaded",          bind(&CM_t::stats_preloaded, chunkManager));
++  CMD2_ANY         ("pieces.stats_not_preloaded",      bind(&CM_t::stats_not_preloaded, chunkManager));
+ 
+-  CMD2_ANY         ("pieces.stats.total_size",         tr1::bind(&apply_pieces_stats_total_size));
++  CMD2_ANY         ("pieces.stats.total_size",         bind(&apply_pieces_stats_total_size));
+ 
+-  CMD2_ANY         ("pieces.hash.queue_size",          tr1::bind(&torrent::hash_queue_size));
++  CMD2_ANY         ("pieces.hash.queue_size",          bind(&torrent::hash_queue_size));
+   CMD2_VAR_BOOL    ("pieces.hash.on_completion",       true);
+ 
+   CMD2_VAR_STRING  ("directory.default",       "./");
+@@ -381,13 +391,13 @@ initialize_command_local() {
+   CMD2_VAR_BOOL    ("session.use_lock",        true);
+   CMD2_VAR_BOOL    ("session.on_completion",   true);
+ 
+-  CMD2_ANY         ("session.path",            tr1::bind(&core::DownloadStore::path, dStore));
+-  CMD2_ANY_STRING_V("session.path.set",        tr1::bind(&core::DownloadStore::set_path, dStore, tr1::placeholders::_2));
++  CMD2_ANY         ("session.path",            bind(&core::DownloadStore::path, dStore));
++  CMD2_ANY_STRING_V("session.path.set",        bind(&core::DownloadStore::set_path, dStore, placeholders::_2));
+ 
+-  CMD2_ANY_V       ("session.save",            tr1::bind(&core::DownloadList::session_save, dList));
++  CMD2_ANY_V       ("session.save",            bind(&core::DownloadList::session_save, dList));
+ 
+ #define CMD2_EXECUTE(key, flags)                                         \
+-  CMD2_ANY(key, tr1::bind(&rpc::ExecFile::execute_object, &rpc::execFile, tr1::placeholders::_2, flags));
++  CMD2_ANY(key, bind(&rpc::ExecFile::execute_object, &rpc::execFile, placeholders::_2, flags));
+ 
+   CMD2_EXECUTE     ("execute2",                rpc::ExecFile::flag_expand_tilde | rpc::ExecFile::flag_throw);
+   CMD2_EXECUTE     ("execute.throw",           rpc::ExecFile::flag_expand_tilde | rpc::ExecFile::flag_throw);
+@@ -401,25 +411,25 @@ initialize_command_local() {
+   CMD2_EXECUTE     ("execute.capture",         rpc::ExecFile::flag_throw | rpc::ExecFile::flag_expand_tilde | rpc::ExecFile::flag_capture);
+   CMD2_EXECUTE     ("execute.capture_nothrow", rpc::ExecFile::flag_expand_tilde | rpc::ExecFile::flag_capture);
+ 
+-  CMD2_ANY_LIST    ("log.open_file",    tr1::bind(&apply_log_open_file, tr1::placeholders::_2));
+-  CMD2_ANY_LIST    ("log.open_gz_file", tr1::bind(&apply_log_open_gz_file, tr1::placeholders::_2));
+-  CMD2_ANY_LIST    ("log.add_output",   tr1::bind(&apply_log_add_output, tr1::placeholders::_2));
+-
+-  CMD2_ANY_STRING  ("log.execute",    tr1::bind(&apply_log, tr1::placeholders::_2, 0));
+-  CMD2_ANY_STRING  ("log.vmmap.dump", tr1::bind(&log_vmmap_dump, tr1::placeholders::_2));
+-  CMD2_ANY_STRING_V("log.xmlrpc",     tr1::bind(&ThreadWorker::set_xmlrpc_log, worker_thread, tr1::placeholders::_2));
++  CMD2_ANY_LIST    ("log.open_file",    bind(&apply_log_open_file, placeholders::_2));
++  CMD2_ANY_LIST    ("log.open_gz_file", bind(&apply_log_open_gz_file, placeholders::_2));
++  CMD2_ANY_LIST    ("log.add_output",   bind(&apply_log_add_output, placeholders::_2));
++
++  CMD2_ANY_STRING  ("log.execute",    bind(&apply_log, placeholders::_2, 0));
++  CMD2_ANY_STRING  ("log.vmmap.dump", bind(&log_vmmap_dump, placeholders::_2));
++  CMD2_ANY_STRING_V("log.xmlrpc",     bind(&ThreadWorker::set_xmlrpc_log, worker_thread, placeholders::_2));
+ 
+-  CMD2_ANY_LIST    ("file.append",    tr1::bind(&cmd_file_append, tr1::placeholders::_2));
++  CMD2_ANY_LIST    ("file.append",    bind(&cmd_file_append, placeholders::_2));
+ 
+   // TODO: Convert to new command types:
+   *rpc::command_base::argument(0) = "placeholder.0";
+   *rpc::command_base::argument(1) = "placeholder.1";
+   *rpc::command_base::argument(2) = "placeholder.2";
+   *rpc::command_base::argument(3) = "placeholder.3";
+-  CMD2_ANY_P("argument.0", tr1::bind(&rpc::command_base::argument_ref, 0));
+-  CMD2_ANY_P("argument.1", tr1::bind(&rpc::command_base::argument_ref, 1));
+-  CMD2_ANY_P("argument.2", tr1::bind(&rpc::command_base::argument_ref, 2));
+-  CMD2_ANY_P("argument.3", tr1::bind(&rpc::command_base::argument_ref, 3));
++  CMD2_ANY_P("argument.0", bind(&rpc::command_base::argument_ref, 0));
++  CMD2_ANY_P("argument.1", bind(&rpc::command_base::argument_ref, 1));
++  CMD2_ANY_P("argument.2", bind(&rpc::command_base::argument_ref, 2));
++  CMD2_ANY_P("argument.3", bind(&rpc::command_base::argument_ref, 3));
+ 
+-  CMD2_ANY_LIST  ("group.insert", tr1::bind(&group_insert, tr1::placeholders::_2));
++  CMD2_ANY_LIST  ("group.insert", bind(&group_insert, placeholders::_2));
+ }
Index: net/rtorrent/patches/patch-src_command__network.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_command__network.cc
diff -N net/rtorrent/patches/patch-src_command__network.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_command__network.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,148 @@
+$NetBSD$
+
+--- src/command_network.cc.orig	2015-10-09 20:24:50.000000000 +0000
++++ src/command_network.cc
+@@ -62,7 +62,15 @@
+ #include "control.h"
+ #include "command_helpers.h"
+ 
+-namespace tr1 { using namespace std::tr1; }
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++namespace placeholders { using namespace std::placeholders; }
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++namespace placeholders { using namespace std::tr1::placeholders; }
++#endif
+ 
+ torrent::Object
+ apply_encryption(const torrent::Object::list_type& args) {
+@@ -126,10 +134,10 @@ xmlrpc_find_peer(core::Download* downloa
+ void
+ initialize_xmlrpc() {
+   rpc::xmlrpc.initialize();
+-  rpc::xmlrpc.slot_find_download() = tr1::bind(&core::DownloadList::find_hex_ptr, control->core()->download_list(), tr1::placeholders::_1);
+-  rpc::xmlrpc.slot_find_file() = tr1::bind(&xmlrpc_find_file, tr1::placeholders::_1, tr1::placeholders::_2);
+-  rpc::xmlrpc.slot_find_tracker() = tr1::bind(&xmlrpc_find_tracker, tr1::placeholders::_1, tr1::placeholders::_2);
+-  rpc::xmlrpc.slot_find_peer() = tr1::bind(&xmlrpc_find_peer, tr1::placeholders::_1, tr1::placeholders::_2);
++  rpc::xmlrpc.slot_find_download() = bind(&core::DownloadList::find_hex_ptr, control->core()->download_list(), placeholders::_1);
++  rpc::xmlrpc.slot_find_file() = bind(&xmlrpc_find_file, placeholders::_1, placeholders::_2);
++  rpc::xmlrpc.slot_find_tracker() = bind(&xmlrpc_find_tracker, placeholders::_1, placeholders::_2);
++  rpc::xmlrpc.slot_find_peer() = bind(&xmlrpc_find_peer, placeholders::_1, placeholders::_2);
+ 
+   unsigned int count = 0;
+ 
+@@ -238,23 +246,23 @@ initialize_command_network() {
+   torrent::FileManager* fileManager = torrent::file_manager();
+   core::CurlStack* httpStack = control->core()->http_stack();
+ 
+-  CMD2_ANY         ("strings.connection_type", tr1::bind(&torrent::option_list_strings, torrent::OPTION_CONNECTION_TYPE));
+-  CMD2_ANY         ("strings.encryption",      tr1::bind(&torrent::option_list_strings, torrent::OPTION_ENCRYPTION));
++  CMD2_ANY         ("strings.connection_type", bind(&torrent::option_list_strings, torrent::OPTION_CONNECTION_TYPE));
++  CMD2_ANY         ("strings.encryption",      bind(&torrent::option_list_strings, torrent::OPTION_ENCRYPTION));
+ 
+-  // CMD2_ANY_STRING  ("encoding_list",    tr1::bind(&apply_encoding_list, tr1::placeholders::_2));
+-  CMD2_ANY_STRING  ("encoding.add", tr1::bind(&apply_encoding_list, tr1::placeholders::_2));
++  // CMD2_ANY_STRING  ("encoding_list",    bind(&apply_encoding_list, placeholders::_2));
++  CMD2_ANY_STRING  ("encoding.add", bind(&apply_encoding_list, placeholders::_2));
+ 
+   // Isn't port_open used?
+   CMD2_VAR_BOOL    ("network.port_open",   true);
+   CMD2_VAR_BOOL    ("network.port_random", true);
+   CMD2_VAR_STRING  ("network.port_range",  "6881-6999");
+ 
+-  CMD2_ANY         ("network.listen.port",        tr1::bind(&torrent::ConnectionManager::listen_port, cm));
+-  CMD2_ANY         ("network.listen.backlog",     tr1::bind(&torrent::ConnectionManager::listen_backlog, cm));
+-  CMD2_ANY_VALUE_V ("network.listen.backlog.set", tr1::bind(&torrent::ConnectionManager::set_listen_backlog, cm, tr1::placeholders::_2));
++  CMD2_ANY         ("network.listen.port",        bind(&torrent::ConnectionManager::listen_port, cm));
++  CMD2_ANY         ("network.listen.backlog",     bind(&torrent::ConnectionManager::listen_backlog, cm));
++  CMD2_ANY_VALUE_V ("network.listen.backlog.set", bind(&torrent::ConnectionManager::set_listen_backlog, cm, placeholders::_2));
+ 
+   CMD2_VAR_BOOL    ("protocol.pex",            true);
+-  CMD2_ANY_LIST    ("protocol.encryption.set", tr1::bind(&apply_encryption, tr1::placeholders::_2));
++  CMD2_ANY_LIST    ("protocol.encryption.set", bind(&apply_encryption, placeholders::_2));
+ 
+   CMD2_VAR_STRING  ("protocol.connection.leech", "leech");
+   CMD2_VAR_STRING  ("protocol.connection.seed",  "seed");
+@@ -264,43 +272,43 @@ initialize_command_network() {
+   CMD2_VAR_STRING  ("protocol.choke_heuristics.down.leech", "download_leech");
+   CMD2_VAR_STRING  ("protocol.choke_heuristics.down.seed",  "download_leech");
+ 
+-  CMD2_ANY         ("network.http.capath",                tr1::bind(&core::CurlStack::http_capath, httpStack));
+-  CMD2_ANY_STRING_V("network.http.capath.set",            tr1::bind(&core::CurlStack::set_http_capath, httpStack, tr1::placeholders::_2));
+-  CMD2_ANY         ("network.http.cacert",                tr1::bind(&core::CurlStack::http_cacert, httpStack));
+-  CMD2_ANY_STRING_V("network.http.cacert.set",            tr1::bind(&core::CurlStack::set_http_cacert, httpStack, tr1::placeholders::_2));
+-  CMD2_ANY         ("network.http.proxy_address",         tr1::bind(&core::CurlStack::http_proxy, httpStack));
+-  CMD2_ANY_STRING_V("network.http.proxy_address.set",     tr1::bind(&core::CurlStack::set_http_proxy, httpStack, tr1::placeholders::_2));
+-  CMD2_ANY         ("network.http.max_open",              tr1::bind(&core::CurlStack::max_active, httpStack));
+-  CMD2_ANY_VALUE_V ("network.http.max_open.set",          tr1::bind(&core::CurlStack::set_max_active, httpStack, tr1::placeholders::_2));
+-  CMD2_ANY         ("network.http.ssl_verify_peer",       tr1::bind(&core::CurlStack::ssl_verify_peer, httpStack));
+-  CMD2_ANY_VALUE_V ("network.http.ssl_verify_peer.set",   tr1::bind(&core::CurlStack::set_ssl_verify_peer, httpStack, tr1::placeholders::_2));
+-  CMD2_ANY         ("network.http.dns_cache_timeout",     tr1::bind(&core::CurlStack::dns_timeout, httpStack));
+-  CMD2_ANY_VALUE_V ("network.http.dns_cache_timeout.set", tr1::bind(&core::CurlStack::set_dns_timeout, httpStack, tr1::placeholders::_2));
+-
+-  CMD2_ANY         ("network.send_buffer.size",        tr1::bind(&torrent::ConnectionManager::send_buffer_size, cm));
+-  CMD2_ANY_VALUE_V ("network.send_buffer.size.set",    tr1::bind(&torrent::ConnectionManager::set_send_buffer_size, cm, tr1::placeholders::_2));
+-  CMD2_ANY         ("network.receive_buffer.size",     tr1::bind(&torrent::ConnectionManager::receive_buffer_size, cm));
+-  CMD2_ANY_VALUE_V ("network.receive_buffer.size.set", tr1::bind(&torrent::ConnectionManager::set_receive_buffer_size, cm, tr1::placeholders::_2));
+-  CMD2_ANY_STRING  ("network.tos.set",                 tr1::bind(&apply_tos, tr1::placeholders::_2));
+-
+-  CMD2_ANY         ("network.bind_address",        tr1::bind(&core::Manager::bind_address, control->core()));
+-  CMD2_ANY_STRING_V("network.bind_address.set",    tr1::bind(&core::Manager::set_bind_address, control->core(), tr1::placeholders::_2));
+-  CMD2_ANY         ("network.local_address",       tr1::bind(&core::Manager::local_address, control->core()));
+-  CMD2_ANY_STRING_V("network.local_address.set",   tr1::bind(&core::Manager::set_local_address, control->core(), tr1::placeholders::_2));
+-  CMD2_ANY         ("network.proxy_address",       tr1::bind(&core::Manager::proxy_address, control->core()));
+-  CMD2_ANY_STRING_V("network.proxy_address.set",   tr1::bind(&core::Manager::set_proxy_address, control->core(), tr1::placeholders::_2));
+-
+-  CMD2_ANY         ("network.max_open_files",       tr1::bind(&torrent::FileManager::max_open_files, fileManager));
+-  CMD2_ANY_VALUE_V ("network.max_open_files.set",   tr1::bind(&torrent::FileManager::set_max_open_files, fileManager, tr1::placeholders::_2));
+-  CMD2_ANY         ("network.open_sockets",         tr1::bind(&torrent::ConnectionManager::size, cm));
+-  CMD2_ANY         ("network.max_open_sockets",     tr1::bind(&torrent::ConnectionManager::max_size, cm));
+-  CMD2_ANY_VALUE_V ("network.max_open_sockets.set", tr1::bind(&torrent::ConnectionManager::set_max_size, cm, tr1::placeholders::_2));
++  CMD2_ANY         ("network.http.capath",                bind(&core::CurlStack::http_capath, httpStack));
++  CMD2_ANY_STRING_V("network.http.capath.set",            bind(&core::CurlStack::set_http_capath, httpStack, placeholders::_2));
++  CMD2_ANY         ("network.http.cacert",                bind(&core::CurlStack::http_cacert, httpStack));
++  CMD2_ANY_STRING_V("network.http.cacert.set",            bind(&core::CurlStack::set_http_cacert, httpStack, placeholders::_2));
++  CMD2_ANY         ("network.http.proxy_address",         bind(&core::CurlStack::http_proxy, httpStack));
++  CMD2_ANY_STRING_V("network.http.proxy_address.set",     bind(&core::CurlStack::set_http_proxy, httpStack, placeholders::_2));
++  CMD2_ANY         ("network.http.max_open",              bind(&core::CurlStack::max_active, httpStack));
++  CMD2_ANY_VALUE_V ("network.http.max_open.set",          bind(&core::CurlStack::set_max_active, httpStack, placeholders::_2));
++  CMD2_ANY         ("network.http.ssl_verify_peer",       bind(&core::CurlStack::ssl_verify_peer, httpStack));
++  CMD2_ANY_VALUE_V ("network.http.ssl_verify_peer.set",   bind(&core::CurlStack::set_ssl_verify_peer, httpStack, placeholders::_2));
++  CMD2_ANY         ("network.http.dns_cache_timeout",     bind(&core::CurlStack::dns_timeout, httpStack));
++  CMD2_ANY_VALUE_V ("network.http.dns_cache_timeout.set", bind(&core::CurlStack::set_dns_timeout, httpStack, placeholders::_2));
++
++  CMD2_ANY         ("network.send_buffer.size",        bind(&torrent::ConnectionManager::send_buffer_size, cm));
++  CMD2_ANY_VALUE_V ("network.send_buffer.size.set",    bind(&torrent::ConnectionManager::set_send_buffer_size, cm, placeholders::_2));
++  CMD2_ANY         ("network.receive_buffer.size",     bind(&torrent::ConnectionManager::receive_buffer_size, cm));
++  CMD2_ANY_VALUE_V ("network.receive_buffer.size.set", bind(&torrent::ConnectionManager::set_receive_buffer_size, cm, placeholders::_2));
++  CMD2_ANY_STRING  ("network.tos.set",                 bind(&apply_tos, placeholders::_2));
++
++  CMD2_ANY         ("network.bind_address",        bind(&core::Manager::bind_address, control->core()));
++  CMD2_ANY_STRING_V("network.bind_address.set",    bind(&core::Manager::set_bind_address, control->core(), placeholders::_2));
++  CMD2_ANY         ("network.local_address",       bind(&core::Manager::local_address, control->core()));
++  CMD2_ANY_STRING_V("network.local_address.set",   bind(&core::Manager::set_local_address, control->core(), placeholders::_2));
++  CMD2_ANY         ("network.proxy_address",       bind(&core::Manager::proxy_address, control->core()));
++  CMD2_ANY_STRING_V("network.proxy_address.set",   bind(&core::Manager::set_proxy_address, control->core(), placeholders::_2));
++
++  CMD2_ANY         ("network.max_open_files",       bind(&torrent::FileManager::max_open_files, fileManager));
++  CMD2_ANY_VALUE_V ("network.max_open_files.set",   bind(&torrent::FileManager::set_max_open_files, fileManager, placeholders::_2));
++  CMD2_ANY         ("network.open_sockets",         bind(&torrent::ConnectionManager::size, cm));
++  CMD2_ANY         ("network.max_open_sockets",     bind(&torrent::ConnectionManager::max_size, cm));
++  CMD2_ANY_VALUE_V ("network.max_open_sockets.set", bind(&torrent::ConnectionManager::set_max_size, cm, placeholders::_2));
+ 
+-  CMD2_ANY_STRING  ("network.scgi.open_port",   tr1::bind(&apply_scgi, tr1::placeholders::_2, 1));
+-  CMD2_ANY_STRING  ("network.scgi.open_local",  tr1::bind(&apply_scgi, tr1::placeholders::_2, 2));
++  CMD2_ANY_STRING  ("network.scgi.open_port",   bind(&apply_scgi, placeholders::_2, 1));
++  CMD2_ANY_STRING  ("network.scgi.open_local",  bind(&apply_scgi, placeholders::_2, 2));
+   CMD2_VAR_BOOL    ("network.scgi.dont_route",  false);
+ 
+-  CMD2_ANY_STRING  ("network.xmlrpc.dialect.set",    tr1::bind(&apply_xmlrpc_dialect, tr1::placeholders::_2));
+-  CMD2_ANY         ("network.xmlrpc.size_limit",     tr1::bind(&rpc::XmlRpc::size_limit));
+-  CMD2_ANY_VALUE_V ("network.xmlrpc.size_limit.set", tr1::bind(&rpc::XmlRpc::set_size_limit, tr1::placeholders::_2));
++  CMD2_ANY_STRING  ("network.xmlrpc.dialect.set",    bind(&apply_xmlrpc_dialect, placeholders::_2));
++  CMD2_ANY         ("network.xmlrpc.size_limit",     bind(&rpc::XmlRpc::size_limit));
++  CMD2_ANY_VALUE_V ("network.xmlrpc.size_limit.set", bind(&rpc::XmlRpc::set_size_limit, placeholders::_2));
+ }
Index: net/rtorrent/patches/patch-src_command__peer.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_command__peer.cc
diff -N net/rtorrent/patches/patch-src_command__peer.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_command__peer.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,91 @@
+$NetBSD$
+
+--- src/command_peer.cc.orig	2015-10-09 20:27:53.000000000 +0000
++++ src/command_peer.cc
+@@ -53,6 +53,16 @@
+ #include "control.h"
+ #include "command_helpers.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++namespace placeholders { using namespace std::placeholders; }
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++namespace placeholders { using namespace std::tr1::placeholders; }
++#endif
++
+ torrent::Object
+ retrieve_p_id(torrent::Peer* peer) {
+   const torrent::HashString* hashString = &peer->id();
+@@ -97,37 +107,37 @@ retrieve_p_completed_percent(torrent::Pe
+ 
+ void
+ initialize_command_peer() {
+-  CMD2_PEER("p.id",                tr1::bind(&retrieve_p_id, tr1::placeholders::_1));
+-  CMD2_PEER("p.id_html",           tr1::bind(&retrieve_p_id_html, tr1::placeholders::_1));
+-  CMD2_PEER("p.client_version",    tr1::bind(&retrieve_p_client_version, tr1::placeholders::_1));
+-
+-  CMD2_PEER("p.options_str",       tr1::bind(&retrieve_p_options_str, tr1::placeholders::_1));
+-
+-  CMD2_PEER("p.is_encrypted",      tr1::bind(&torrent::Peer::is_encrypted, tr1::placeholders::_1));
+-  CMD2_PEER("p.is_incoming",       tr1::bind(&torrent::Peer::is_incoming, tr1::placeholders::_1));
+-  CMD2_PEER("p.is_obfuscated",     tr1::bind(&torrent::Peer::is_obfuscated, tr1::placeholders::_1));
+-  CMD2_PEER("p.is_snubbed",        tr1::bind(&torrent::Peer::is_snubbed, tr1::placeholders::_1));
+-
+-  CMD2_PEER("p.is_unwanted",       tr1::bind(&torrent::PeerInfo::is_unwanted,  tr1::bind(&torrent::Peer::peer_info, tr1::placeholders::_1)));
+-  CMD2_PEER("p.is_preferred",      tr1::bind(&torrent::PeerInfo::is_preferred, tr1::bind(&torrent::Peer::peer_info, tr1::placeholders::_1)));
+-
+-  CMD2_PEER("p.address",           tr1::bind(&retrieve_p_address, tr1::placeholders::_1));
+-  CMD2_PEER("p.port",              tr1::bind(&retrieve_p_port, tr1::placeholders::_1));
+-
+-  CMD2_PEER("p.completed_percent", tr1::bind(&retrieve_p_completed_percent, tr1::placeholders::_1));
+-
+-  CMD2_PEER("p.up_rate",           tr1::bind(&torrent::Rate::rate,  tr1::bind(&torrent::Peer::up_rate, tr1::placeholders::_1)));
+-  CMD2_PEER("p.up_total",          tr1::bind(&torrent::Rate::total, tr1::bind(&torrent::Peer::up_rate, tr1::placeholders::_1)));
+-  CMD2_PEER("p.down_rate",         tr1::bind(&torrent::Rate::rate,  tr1::bind(&torrent::Peer::down_rate, tr1::placeholders::_1)));
+-  CMD2_PEER("p.down_total",        tr1::bind(&torrent::Rate::total, tr1::bind(&torrent::Peer::down_rate, tr1::placeholders::_1)));
+-  CMD2_PEER("p.peer_rate",         tr1::bind(&torrent::Rate::rate,  tr1::bind(&torrent::Peer::peer_rate, tr1::placeholders::_1)));
+-  CMD2_PEER("p.peer_total",        tr1::bind(&torrent::Rate::total, tr1::bind(&torrent::Peer::peer_rate, tr1::placeholders::_1)));
+-
+-  CMD2_PEER        ("p.snubbed",     tr1::bind(&torrent::Peer::is_snubbed,  tr1::placeholders::_1));
+-  CMD2_PEER_VALUE_V("p.snubbed.set", tr1::bind(&torrent::Peer::set_snubbed, tr1::placeholders::_1, tr1::placeholders::_2));
+-  CMD2_PEER        ("p.banned",      tr1::bind(&torrent::Peer::is_banned,   tr1::placeholders::_1));
+-  CMD2_PEER_VALUE_V("p.banned.set",  tr1::bind(&torrent::Peer::set_banned,  tr1::placeholders::_1, tr1::placeholders::_2));
++  CMD2_PEER("p.id",                bind(&retrieve_p_id, placeholders::_1));
++  CMD2_PEER("p.id_html",           bind(&retrieve_p_id_html, placeholders::_1));
++  CMD2_PEER("p.client_version",    bind(&retrieve_p_client_version, placeholders::_1));
++
++  CMD2_PEER("p.options_str",       bind(&retrieve_p_options_str, placeholders::_1));
++
++  CMD2_PEER("p.is_encrypted",      bind(&torrent::Peer::is_encrypted, placeholders::_1));
++  CMD2_PEER("p.is_incoming",       bind(&torrent::Peer::is_incoming, placeholders::_1));
++  CMD2_PEER("p.is_obfuscated",     bind(&torrent::Peer::is_obfuscated, placeholders::_1));
++  CMD2_PEER("p.is_snubbed",        bind(&torrent::Peer::is_snubbed, placeholders::_1));
++
++  CMD2_PEER("p.is_unwanted",       bind(&torrent::PeerInfo::is_unwanted,  bind(&torrent::Peer::peer_info, placeholders::_1)));
++  CMD2_PEER("p.is_preferred",      bind(&torrent::PeerInfo::is_preferred, bind(&torrent::Peer::peer_info, placeholders::_1)));
++
++  CMD2_PEER("p.address",           bind(&retrieve_p_address, placeholders::_1));
++  CMD2_PEER("p.port",              bind(&retrieve_p_port, placeholders::_1));
++
++  CMD2_PEER("p.completed_percent", bind(&retrieve_p_completed_percent, placeholders::_1));
++
++  CMD2_PEER("p.up_rate",           bind(&torrent::Rate::rate,  bind(&torrent::Peer::up_rate, placeholders::_1)));
++  CMD2_PEER("p.up_total",          bind(&torrent::Rate::total, bind(&torrent::Peer::up_rate, placeholders::_1)));
++  CMD2_PEER("p.down_rate",         bind(&torrent::Rate::rate,  bind(&torrent::Peer::down_rate, placeholders::_1)));
++  CMD2_PEER("p.down_total",        bind(&torrent::Rate::total, bind(&torrent::Peer::down_rate, placeholders::_1)));
++  CMD2_PEER("p.peer_rate",         bind(&torrent::Rate::rate,  bind(&torrent::Peer::peer_rate, placeholders::_1)));
++  CMD2_PEER("p.peer_total",        bind(&torrent::Rate::total, bind(&torrent::Peer::peer_rate, placeholders::_1)));
++
++  CMD2_PEER        ("p.snubbed",     bind(&torrent::Peer::is_snubbed,  placeholders::_1));
++  CMD2_PEER_VALUE_V("p.snubbed.set", bind(&torrent::Peer::set_snubbed, placeholders::_1, placeholders::_2));
++  CMD2_PEER        ("p.banned",      bind(&torrent::Peer::is_banned,   placeholders::_1));
++  CMD2_PEER_VALUE_V("p.banned.set",  bind(&torrent::Peer::set_banned,  placeholders::_1, placeholders::_2));
+ 
+-  CMD2_PEER_V("p.disconnect",         tr1::bind(&torrent::Peer::disconnect, tr1::placeholders::_1, 0));
+-  CMD2_PEER_V("p.disconnect_delayed", tr1::bind(&torrent::Peer::disconnect, tr1::placeholders::_1, torrent::ConnectionList::disconnect_delayed));
++  CMD2_PEER_V("p.disconnect",         bind(&torrent::Peer::disconnect, placeholders::_1, 0));
++  CMD2_PEER_V("p.disconnect_delayed", bind(&torrent::Peer::disconnect, placeholders::_1, torrent::ConnectionList::disconnect_delayed));
+ }
Index: net/rtorrent/patches/patch-src_command__scheduler.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_command__scheduler.cc
diff -N net/rtorrent/patches/patch-src_command__scheduler.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_command__scheduler.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,32 @@
+$NetBSD$
+
+--- src/command_scheduler.cc.orig	2015-10-09 20:34:30.000000000 +0000
++++ src/command_scheduler.cc
+@@ -48,6 +48,16 @@
+ #include "control.h"
+ #include "command_helpers.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++namespace placeholders { using namespace std::placeholders; }
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++namespace placeholders { using namespace std::tr1::placeholders; }
++#endif
++
+ torrent::Object
+ cmd_scheduler_simple_added(core::Download* download) {
+   unsigned int numActive = (*control->view_manager()->find("active"))->size_visible();
+@@ -115,7 +125,7 @@ void
+ initialize_command_scheduler() {
+   CMD2_VAR_VALUE("scheduler.max_active", int64_t(-1));
+ 
+-  CMD2_DL("scheduler.simple.added",   tr1::bind(&cmd_scheduler_simple_added, tr1::placeholders::_1));
+-  CMD2_DL("scheduler.simple.removed", tr1::bind(&cmd_scheduler_simple_removed, tr1::placeholders::_1));
+-  CMD2_DL("scheduler.simple.update",  tr1::bind(&cmd_scheduler_simple_update, tr1::placeholders::_1));
++  CMD2_DL("scheduler.simple.added",   bind(&cmd_scheduler_simple_added, placeholders::_1));
++  CMD2_DL("scheduler.simple.removed", bind(&cmd_scheduler_simple_removed, placeholders::_1));
++  CMD2_DL("scheduler.simple.update",  bind(&cmd_scheduler_simple_update, placeholders::_1));
+ }
Index: net/rtorrent/patches/patch-src_command__throttle.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_command__throttle.cc
diff -N net/rtorrent/patches/patch-src_command__throttle.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_command__throttle.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,86 @@
+$NetBSD$
+
+--- src/command_throttle.cc.orig	2015-10-09 20:30:26.000000000 +0000
++++ src/command_throttle.cc
+@@ -51,6 +51,16 @@
+ #include "control.h"
+ #include "command_helpers.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++namespace placeholders { using namespace std::placeholders; }
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++namespace placeholders { using namespace std::tr1::placeholders; }
++#endif
++
+ std::pair<uint32_t, uint32_t>
+ parse_address_range(const torrent::Object::list_type& args, torrent::Object::list_type::const_iterator itr) {
+   unsigned int prefixWidth, ret;
+@@ -173,8 +183,8 @@ throttle_update(const char* variable, in
+ 
+ void
+ initialize_command_throttle() {
+-  CMD2_ANY         ("throttle.unchoked_uploads",   tr1::bind(&torrent::ResourceManager::currently_upload_unchoked, torrent::resource_manager()));
+-  CMD2_ANY         ("throttle.unchoked_downloads", tr1::bind(&torrent::ResourceManager::currently_download_unchoked, torrent::resource_manager()));
++  CMD2_ANY         ("throttle.unchoked_uploads",   bind(&torrent::ResourceManager::currently_upload_unchoked, torrent::resource_manager()));
++  CMD2_ANY         ("throttle.unchoked_downloads", bind(&torrent::ResourceManager::currently_download_unchoked, torrent::resource_manager()));
+ 
+   CMD2_VAR_VALUE   ("throttle.min_peers.normal", 100);
+   CMD2_VAR_VALUE   ("throttle.max_peers.normal", 200);
+@@ -196,31 +206,31 @@ initialize_command_throttle() {
+   CMD2_REDIRECT_GENERIC("throttle.max_downloads.div",    "throttle.max_downloads.div._val");
+   CMD2_REDIRECT_GENERIC("throttle.max_downloads.global", "throttle.max_downloads.global._val");
+ 
+-  CMD2_ANY_VALUE   ("throttle.max_uploads.div.set",      tr1::bind(&throttle_update, "throttle.max_uploads.div._val.set", tr1::placeholders::_2));
+-  CMD2_ANY_VALUE   ("throttle.max_uploads.global.set",   tr1::bind(&throttle_update, "throttle.max_uploads.global._val.set", tr1::placeholders::_2));
+-  CMD2_ANY_VALUE   ("throttle.max_downloads.div.set",    tr1::bind(&throttle_update, "throttle.max_downloads.div._val.set", tr1::placeholders::_2));
+-  CMD2_ANY_VALUE   ("throttle.max_downloads.global.set", tr1::bind(&throttle_update, "throttle.max_downloads.global._val.set", tr1::placeholders::_2));
++  CMD2_ANY_VALUE   ("throttle.max_uploads.div.set",      bind(&throttle_update, "throttle.max_uploads.div._val.set", placeholders::_2));
++  CMD2_ANY_VALUE   ("throttle.max_uploads.global.set",   bind(&throttle_update, "throttle.max_uploads.global._val.set", placeholders::_2));
++  CMD2_ANY_VALUE   ("throttle.max_downloads.div.set",    bind(&throttle_update, "throttle.max_downloads.div._val.set", placeholders::_2));
++  CMD2_ANY_VALUE   ("throttle.max_downloads.global.set", bind(&throttle_update, "throttle.max_downloads.global._val.set", placeholders::_2));
+ 
+   // TODO: Move the logic into some libtorrent function.
+-  CMD2_ANY         ("throttle.global_up.rate",              tr1::bind(&torrent::Rate::rate, torrent::up_rate()));
+-  CMD2_ANY         ("throttle.global_up.total",             tr1::bind(&torrent::Rate::total, torrent::up_rate()));
+-  CMD2_ANY         ("throttle.global_up.max_rate",          tr1::bind(&torrent::Throttle::max_rate, torrent::up_throttle_global()));
+-  CMD2_ANY_VALUE_V ("throttle.global_up.max_rate.set",      tr1::bind(&ui::Root::set_up_throttle_i64, control->ui(), tr1::placeholders::_2));
+-  CMD2_ANY_VALUE_KB("throttle.global_up.max_rate.set_kb",   tr1::bind(&ui::Root::set_up_throttle_i64, control->ui(), tr1::placeholders::_2));
+-  CMD2_ANY         ("throttle.global_down.rate",            tr1::bind(&torrent::Rate::rate, torrent::down_rate()));
+-  CMD2_ANY         ("throttle.global_down.total",           tr1::bind(&torrent::Rate::total, torrent::down_rate()));
+-  CMD2_ANY         ("throttle.global_down.max_rate",        tr1::bind(&torrent::Throttle::max_rate, torrent::down_throttle_global()));
+-  CMD2_ANY_VALUE_V ("throttle.global_down.max_rate.set",    tr1::bind(&ui::Root::set_down_throttle_i64, control->ui(), tr1::placeholders::_2));
+-  CMD2_ANY_VALUE_KB("throttle.global_down.max_rate.set_kb", tr1::bind(&ui::Root::set_down_throttle_i64, control->ui(), tr1::placeholders::_2));
++  CMD2_ANY         ("throttle.global_up.rate",              bind(&torrent::Rate::rate, torrent::up_rate()));
++  CMD2_ANY         ("throttle.global_up.total",             bind(&torrent::Rate::total, torrent::up_rate()));
++  CMD2_ANY         ("throttle.global_up.max_rate",          bind(&torrent::Throttle::max_rate, torrent::up_throttle_global()));
++  CMD2_ANY_VALUE_V ("throttle.global_up.max_rate.set",      bind(&ui::Root::set_up_throttle_i64, control->ui(), placeholders::_2));
++  CMD2_ANY_VALUE_KB("throttle.global_up.max_rate.set_kb",   bind(&ui::Root::set_up_throttle_i64, control->ui(), placeholders::_2));
++  CMD2_ANY         ("throttle.global_down.rate",            bind(&torrent::Rate::rate, torrent::down_rate()));
++  CMD2_ANY         ("throttle.global_down.total",           bind(&torrent::Rate::total, torrent::down_rate()));
++  CMD2_ANY         ("throttle.global_down.max_rate",        bind(&torrent::Throttle::max_rate, torrent::down_throttle_global()));
++  CMD2_ANY_VALUE_V ("throttle.global_down.max_rate.set",    bind(&ui::Root::set_down_throttle_i64, control->ui(), placeholders::_2));
++  CMD2_ANY_VALUE_KB("throttle.global_down.max_rate.set_kb", bind(&ui::Root::set_down_throttle_i64, control->ui(), placeholders::_2));
+ 
+   // Temporary names, need to change this to accept real rates rather
+   // than kB.
+-  CMD2_ANY_LIST    ("throttle.up",                          tr1::bind(&apply_throttle, tr1::placeholders::_2, true));
+-  CMD2_ANY_LIST    ("throttle.down",                        tr1::bind(&apply_throttle, tr1::placeholders::_2, false));
+-  CMD2_ANY_LIST    ("throttle.ip",                          tr1::bind(&apply_address_throttle, tr1::placeholders::_2));
+-
+-  CMD2_ANY_STRING  ("throttle.up.max",    tr1::bind(&retrieve_throttle_info, tr1::placeholders::_2, throttle_info_up | throttle_info_max));
+-  CMD2_ANY_STRING  ("throttle.up.rate",   tr1::bind(&retrieve_throttle_info, tr1::placeholders::_2, throttle_info_up | throttle_info_rate));
+-  CMD2_ANY_STRING  ("throttle.down.max",  tr1::bind(&retrieve_throttle_info, tr1::placeholders::_2, throttle_info_down | throttle_info_max));
+-  CMD2_ANY_STRING  ("throttle.down.rate", tr1::bind(&retrieve_throttle_info, tr1::placeholders::_2, throttle_info_down | throttle_info_rate));
++  CMD2_ANY_LIST    ("throttle.up",                          bind(&apply_throttle, placeholders::_2, true));
++  CMD2_ANY_LIST    ("throttle.down",                        bind(&apply_throttle, placeholders::_2, false));
++  CMD2_ANY_LIST    ("throttle.ip",                          bind(&apply_address_throttle, placeholders::_2));
++
++  CMD2_ANY_STRING  ("throttle.up.max",    bind(&retrieve_throttle_info, placeholders::_2, throttle_info_up | throttle_info_max));
++  CMD2_ANY_STRING  ("throttle.up.rate",   bind(&retrieve_throttle_info, placeholders::_2, throttle_info_up | throttle_info_rate));
++  CMD2_ANY_STRING  ("throttle.down.max",  bind(&retrieve_throttle_info, placeholders::_2, throttle_info_down | throttle_info_max));
++  CMD2_ANY_STRING  ("throttle.down.rate", bind(&retrieve_throttle_info, placeholders::_2, throttle_info_down | throttle_info_rate));
+ }
Index: net/rtorrent/patches/patch-src_command__tracker.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_command__tracker.cc
diff -N net/rtorrent/patches/patch-src_command__tracker.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_command__tracker.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,123 @@
+$NetBSD$
+
+--- src/command_tracker.cc.orig	2015-10-09 20:31:53.000000000 +0000
++++ src/command_tracker.cc
+@@ -51,6 +51,16 @@
+ #include "command_helpers.h"
+ #include "core/dht_manager.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++namespace placeholders { using namespace std::placeholders; }
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++namespace placeholders { using namespace std::tr1::placeholders; }
++#endif
++
+ void
+ tracker_set_enabled(torrent::Tracker* tracker, bool state) {
+   if (state)
+@@ -111,59 +121,59 @@ apply_enable_trackers(int64_t arg) {
+ 
+ void
+ initialize_command_tracker() {
+-  CMD2_TRACKER        ("t.is_open",           tr1::bind(&torrent::Tracker::is_busy, tr1::placeholders::_1));
+-  CMD2_TRACKER        ("t.is_enabled",        tr1::bind(&torrent::Tracker::is_enabled, tr1::placeholders::_1));
+-  CMD2_TRACKER        ("t.is_usable",         tr1::bind(&torrent::Tracker::is_usable, tr1::placeholders::_1));
+-  CMD2_TRACKER        ("t.is_busy",           tr1::bind(&torrent::Tracker::is_busy, tr1::placeholders::_1));
+-  CMD2_TRACKER        ("t.is_extra_tracker",  tr1::bind(&torrent::Tracker::is_extra_tracker, tr1::placeholders::_1));
+-  CMD2_TRACKER        ("t.can_scrape",        tr1::bind(&torrent::Tracker::can_scrape, tr1::placeholders::_1));
+-
+-  CMD2_TRACKER_V      ("t.enable",            tr1::bind(&torrent::Tracker::enable, tr1::placeholders::_1));
+-  CMD2_TRACKER_V      ("t.disable",           tr1::bind(&torrent::Tracker::disable, tr1::placeholders::_1));
+-
+-  CMD2_TRACKER_VALUE_V("t.is_enabled.set",    tr1::bind(&tracker_set_enabled, tr1::placeholders::_1, tr1::placeholders::_2));
+-
+-  CMD2_TRACKER        ("t.url",               tr1::bind(&torrent::Tracker::url, tr1::placeholders::_1));
+-  CMD2_TRACKER        ("t.group",             tr1::bind(&torrent::Tracker::group, tr1::placeholders::_1));
+-  CMD2_TRACKER        ("t.type",              tr1::bind(&torrent::Tracker::type, tr1::placeholders::_1));
+-  CMD2_TRACKER        ("t.id",                tr1::bind(&torrent::Tracker::tracker_id, tr1::placeholders::_1));
+-
+-  CMD2_TRACKER        ("t.latest_event",      tr1::bind(&torrent::Tracker::latest_event, tr1::placeholders::_1));
+-  CMD2_TRACKER        ("t.latest_new_peers",  tr1::bind(&torrent::Tracker::latest_new_peers, tr1::placeholders::_1));
+-  CMD2_TRACKER        ("t.latest_sum_peers",  tr1::bind(&torrent::Tracker::latest_sum_peers, tr1::placeholders::_1));
++  CMD2_TRACKER        ("t.is_open",           bind(&torrent::Tracker::is_busy, placeholders::_1));
++  CMD2_TRACKER        ("t.is_enabled",        bind(&torrent::Tracker::is_enabled, placeholders::_1));
++  CMD2_TRACKER        ("t.is_usable",         bind(&torrent::Tracker::is_usable, placeholders::_1));
++  CMD2_TRACKER        ("t.is_busy",           bind(&torrent::Tracker::is_busy, placeholders::_1));
++  CMD2_TRACKER        ("t.is_extra_tracker",  bind(&torrent::Tracker::is_extra_tracker, placeholders::_1));
++  CMD2_TRACKER        ("t.can_scrape",        bind(&torrent::Tracker::can_scrape, placeholders::_1));
++
++  CMD2_TRACKER_V      ("t.enable",            bind(&torrent::Tracker::enable, placeholders::_1));
++  CMD2_TRACKER_V      ("t.disable",           bind(&torrent::Tracker::disable, placeholders::_1));
++
++  CMD2_TRACKER_VALUE_V("t.is_enabled.set",    bind(&tracker_set_enabled, placeholders::_1, placeholders::_2));
++
++  CMD2_TRACKER        ("t.url",               bind(&torrent::Tracker::url, placeholders::_1));
++  CMD2_TRACKER        ("t.group",             bind(&torrent::Tracker::group, placeholders::_1));
++  CMD2_TRACKER        ("t.type",              bind(&torrent::Tracker::type, placeholders::_1));
++  CMD2_TRACKER        ("t.id",                bind(&torrent::Tracker::tracker_id, placeholders::_1));
++
++  CMD2_TRACKER        ("t.latest_event",      bind(&torrent::Tracker::latest_event, placeholders::_1));
++  CMD2_TRACKER        ("t.latest_new_peers",  bind(&torrent::Tracker::latest_new_peers, placeholders::_1));
++  CMD2_TRACKER        ("t.latest_sum_peers",  bind(&torrent::Tracker::latest_sum_peers, placeholders::_1));
+ 
+   // Time since last connection, connection attempt.
+ 
+-  CMD2_TRACKER        ("t.normal_interval",   tr1::bind(&torrent::Tracker::normal_interval, tr1::placeholders::_1));
+-  CMD2_TRACKER        ("t.min_interval",      tr1::bind(&torrent::Tracker::min_interval, tr1::placeholders::_1));
++  CMD2_TRACKER        ("t.normal_interval",   bind(&torrent::Tracker::normal_interval, placeholders::_1));
++  CMD2_TRACKER        ("t.min_interval",      bind(&torrent::Tracker::min_interval, placeholders::_1));
+ 
+-  CMD2_TRACKER        ("t.activity_time_next", tr1::bind(&torrent::Tracker::activity_time_next, tr1::placeholders::_1));
+-  CMD2_TRACKER        ("t.activity_time_last", tr1::bind(&torrent::Tracker::activity_time_last, tr1::placeholders::_1));
++  CMD2_TRACKER        ("t.activity_time_next", bind(&torrent::Tracker::activity_time_next, placeholders::_1));
++  CMD2_TRACKER        ("t.activity_time_last", bind(&torrent::Tracker::activity_time_last, placeholders::_1));
+ 
+-  CMD2_TRACKER        ("t.success_time_next", tr1::bind(&torrent::Tracker::success_time_next, tr1::placeholders::_1));
+-  CMD2_TRACKER        ("t.success_time_last", tr1::bind(&torrent::Tracker::success_time_last, tr1::placeholders::_1));
+-  CMD2_TRACKER        ("t.success_counter",   tr1::bind(&torrent::Tracker::success_counter, tr1::placeholders::_1));
++  CMD2_TRACKER        ("t.success_time_next", bind(&torrent::Tracker::success_time_next, placeholders::_1));
++  CMD2_TRACKER        ("t.success_time_last", bind(&torrent::Tracker::success_time_last, placeholders::_1));
++  CMD2_TRACKER        ("t.success_counter",   bind(&torrent::Tracker::success_counter, placeholders::_1));
+ 
+-  CMD2_TRACKER        ("t.failed_time_next",  tr1::bind(&torrent::Tracker::failed_time_next, tr1::placeholders::_1));
+-  CMD2_TRACKER        ("t.failed_time_last",  tr1::bind(&torrent::Tracker::failed_time_last, tr1::placeholders::_1));
+-  CMD2_TRACKER        ("t.failed_counter",    tr1::bind(&torrent::Tracker::failed_counter, tr1::placeholders::_1));
++  CMD2_TRACKER        ("t.failed_time_next",  bind(&torrent::Tracker::failed_time_next, placeholders::_1));
++  CMD2_TRACKER        ("t.failed_time_last",  bind(&torrent::Tracker::failed_time_last, placeholders::_1));
++  CMD2_TRACKER        ("t.failed_counter",    bind(&torrent::Tracker::failed_counter, placeholders::_1));
+ 
+-  CMD2_TRACKER        ("t.scrape_time_last",  tr1::bind(&torrent::Tracker::scrape_time_last, tr1::placeholders::_1));
+-  CMD2_TRACKER        ("t.scrape_counter",    tr1::bind(&torrent::Tracker::scrape_counter, tr1::placeholders::_1));
++  CMD2_TRACKER        ("t.scrape_time_last",  bind(&torrent::Tracker::scrape_time_last, placeholders::_1));
++  CMD2_TRACKER        ("t.scrape_counter",    bind(&torrent::Tracker::scrape_counter, placeholders::_1));
+ 
+-  CMD2_TRACKER        ("t.scrape_complete",   tr1::bind(&torrent::Tracker::scrape_complete, tr1::placeholders::_1));
+-  CMD2_TRACKER        ("t.scrape_incomplete", tr1::bind(&torrent::Tracker::scrape_incomplete, tr1::placeholders::_1));
+-  CMD2_TRACKER        ("t.scrape_downloaded", tr1::bind(&torrent::Tracker::scrape_downloaded, tr1::placeholders::_1));
++  CMD2_TRACKER        ("t.scrape_complete",   bind(&torrent::Tracker::scrape_complete, placeholders::_1));
++  CMD2_TRACKER        ("t.scrape_incomplete", bind(&torrent::Tracker::scrape_incomplete, placeholders::_1));
++  CMD2_TRACKER        ("t.scrape_downloaded", bind(&torrent::Tracker::scrape_downloaded, placeholders::_1));
+ 
+-  CMD2_ANY_VALUE      ("trackers.enable",     tr1::bind(&apply_enable_trackers, int64_t(1)));
+-  CMD2_ANY_VALUE      ("trackers.disable",    tr1::bind(&apply_enable_trackers, int64_t(0)));
++  CMD2_ANY_VALUE      ("trackers.enable",     bind(&apply_enable_trackers, int64_t(1)));
++  CMD2_ANY_VALUE      ("trackers.disable",    bind(&apply_enable_trackers, int64_t(0)));
+   CMD2_VAR_VALUE      ("trackers.numwant",    -1);
+   CMD2_VAR_BOOL       ("trackers.use_udp",    true);
+ 
+-  CMD2_ANY_STRING_V   ("dht.mode.set",          tr1::bind(&core::DhtManager::set_mode, control->dht_manager(), tr1::placeholders::_2));
++  CMD2_ANY_STRING_V   ("dht.mode.set",          bind(&core::DhtManager::set_mode, control->dht_manager(), placeholders::_2));
+   CMD2_VAR_VALUE      ("dht.port",              int64_t(6881));
+-  CMD2_ANY_STRING     ("dht.add_node",          tr1::bind(&apply_dht_add_node, tr1::placeholders::_2));
+-  CMD2_ANY            ("dht.statistics",        tr1::bind(&core::DhtManager::dht_statistics, control->dht_manager()));
+-  CMD2_ANY            ("dht.throttle.name",     tr1::bind(&core::DhtManager::throttle_name, control->dht_manager()));
+-  CMD2_ANY_STRING_V   ("dht.throttle.name.set", tr1::bind(&core::DhtManager::set_throttle_name, control->dht_manager(), tr1::placeholders::_2));
++  CMD2_ANY_STRING     ("dht.add_node",          bind(&apply_dht_add_node, placeholders::_2));
++  CMD2_ANY            ("dht.statistics",        bind(&core::DhtManager::dht_statistics, control->dht_manager()));
++  CMD2_ANY            ("dht.throttle.name",     bind(&core::DhtManager::throttle_name, control->dht_manager()));
++  CMD2_ANY_STRING_V   ("dht.throttle.name.set", bind(&core::DhtManager::set_throttle_name, control->dht_manager(), placeholders::_2));
+ }
Index: net/rtorrent/patches/patch-src_command__ui.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_command__ui.cc
diff -N net/rtorrent/patches/patch-src_command__ui.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_command__ui.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,120 @@
+$NetBSD$
+
+--- src/command_ui.cc.orig	2015-10-09 20:29:49.000000000 +0000
++++ src/command_ui.cc
+@@ -52,6 +52,16 @@
+ #include "control.h"
+ #include "command_helpers.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++namespace placeholders { using namespace std::placeholders; }
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++namespace placeholders { using namespace std::tr1::placeholders; }
++#endif
++
+ typedef void (core::ViewManager::*view_event_slot)(const std::string&, const torrent::Object&);
+ 
+ torrent::Object
+@@ -518,41 +528,41 @@ void
+ initialize_command_ui() {
+   CMD2_VAR_STRING("keys.layout", "qwerty");
+ 
+-  CMD2_ANY_STRING("view.add", object_convert_void(tr1::bind(&core::ViewManager::insert_throw, control->view_manager(), tr1::placeholders::_2)));
++  CMD2_ANY_STRING("view.add", object_convert_void(bind(&core::ViewManager::insert_throw, control->view_manager(), placeholders::_2)));
+ 
+-  CMD2_ANY_L   ("view.list",          tr1::bind(&apply_view_list));
+-  CMD2_ANY_LIST("view.set",           tr1::bind(&apply_view_set, tr1::placeholders::_2));
++  CMD2_ANY_L   ("view.list",          bind(&apply_view_list));
++  CMD2_ANY_LIST("view.set",           bind(&apply_view_set, placeholders::_2));
+ 
+-  CMD2_ANY_LIST("view.filter",        tr1::bind(&apply_view_event, &core::ViewManager::set_filter, tr1::placeholders::_2));
+-  CMD2_ANY_LIST("view.filter_on",     tr1::bind(&apply_view_filter_on, tr1::placeholders::_2));
++  CMD2_ANY_LIST("view.filter",        bind(&apply_view_event, &core::ViewManager::set_filter, placeholders::_2));
++  CMD2_ANY_LIST("view.filter_on",     bind(&apply_view_filter_on, placeholders::_2));
+ 
+-  CMD2_ANY_LIST("view.sort",          tr1::bind(&apply_view_sort, tr1::placeholders::_2));
+-  CMD2_ANY_LIST("view.sort_new",      tr1::bind(&apply_view_event, &core::ViewManager::set_sort_new, tr1::placeholders::_2));
+-  CMD2_ANY_LIST("view.sort_current",  tr1::bind(&apply_view_event, &core::ViewManager::set_sort_current, tr1::placeholders::_2));
++  CMD2_ANY_LIST("view.sort",          bind(&apply_view_sort, placeholders::_2));
++  CMD2_ANY_LIST("view.sort_new",      bind(&apply_view_event, &core::ViewManager::set_sort_new, placeholders::_2));
++  CMD2_ANY_LIST("view.sort_current",  bind(&apply_view_event, &core::ViewManager::set_sort_current, placeholders::_2));
+ 
+-  CMD2_ANY_LIST("view.event_added",   tr1::bind(&apply_view_event, &core::ViewManager::set_event_added, tr1::placeholders::_2));
+-  CMD2_ANY_LIST("view.event_removed", tr1::bind(&apply_view_event, &core::ViewManager::set_event_removed, tr1::placeholders::_2));
++  CMD2_ANY_LIST("view.event_added",   bind(&apply_view_event, &core::ViewManager::set_event_added, placeholders::_2));
++  CMD2_ANY_LIST("view.event_removed", bind(&apply_view_event, &core::ViewManager::set_event_removed, placeholders::_2));
+ 
+   // Cleanup and add . to view.
+ 
+-  CMD2_ANY_STRING("view.size",              tr1::bind(&cmd_view_size, tr1::placeholders::_2));
+-  CMD2_ANY_STRING("view.size_not_visible",  tr1::bind(&cmd_view_size_not_visible, tr1::placeholders::_2));
+-  CMD2_ANY_STRING("view.persistent",        tr1::bind(&cmd_view_persistent, tr1::placeholders::_2));
+-
+-  CMD2_ANY_STRING_V("view.filter_all",      tr1::bind(&core::View::filter, tr1::bind(&core::ViewManager::find_ptr_throw, control->view_manager(), tr1::placeholders::_2)));
+-
+-  CMD2_DL_STRING ("view.filter_download", tr1::bind(&cmd_view_filter_download, tr1::placeholders::_1, tr1::placeholders::_2));
+-  CMD2_DL_STRING ("view.set_visible",     tr1::bind(&cmd_view_set_visible,     tr1::placeholders::_1, tr1::placeholders::_2));
+-  CMD2_DL_STRING ("view.set_not_visible", tr1::bind(&cmd_view_set_not_visible, tr1::placeholders::_1, tr1::placeholders::_2));
++  CMD2_ANY_STRING("view.size",              bind(&cmd_view_size, placeholders::_2));
++  CMD2_ANY_STRING("view.size_not_visible",  bind(&cmd_view_size_not_visible, placeholders::_2));
++  CMD2_ANY_STRING("view.persistent",        bind(&cmd_view_persistent, placeholders::_2));
++
++  CMD2_ANY_STRING_V("view.filter_all",      bind(&core::View::filter, bind(&core::ViewManager::find_ptr_throw, control->view_manager(), placeholders::_2)));
++
++  CMD2_DL_STRING ("view.filter_download", bind(&cmd_view_filter_download, placeholders::_1, placeholders::_2));
++  CMD2_DL_STRING ("view.set_visible",     bind(&cmd_view_set_visible,     placeholders::_1, placeholders::_2));
++  CMD2_DL_STRING ("view.set_not_visible", bind(&cmd_view_set_not_visible, placeholders::_1, placeholders::_2));
+ 
+   // Commands that affect the default rtorrent UI.
+-  CMD2_DL        ("ui.unfocus_download",   tr1::bind(&cmd_ui_unfocus_download, tr1::placeholders::_1));
+-  CMD2_ANY_STRING("ui.current_view.set",   tr1::bind(&cmd_ui_set_view, tr1::placeholders::_2));
++  CMD2_DL        ("ui.unfocus_download",   bind(&cmd_ui_unfocus_download, placeholders::_1));
++  CMD2_ANY_STRING("ui.current_view.set",   bind(&cmd_ui_set_view, placeholders::_2));
+ 
+   // Move.
+   CMD2_ANY("print", &apply_print);
+   CMD2_ANY("cat",   &apply_cat);
+-  CMD2_ANY("if",    tr1::bind(&apply_if, tr1::placeholders::_1, tr1::placeholders::_2, 0));
++  CMD2_ANY("if",    bind(&apply_if, placeholders::_1, placeholders::_2, 0));
+   CMD2_ANY("not",   &apply_not);
+   CMD2_ANY("false", &apply_false);
+   CMD2_ANY("and",   &apply_and);
+@@ -560,22 +570,22 @@ initialize_command_ui() {
+ 
+   // A temporary command for handling stuff until we get proper
+   // support for seperation of commands and literals.
+-  CMD2_ANY("branch", tr1::bind(&apply_if, tr1::placeholders::_1, tr1::placeholders::_2, 1));
++  CMD2_ANY("branch", bind(&apply_if, placeholders::_1, placeholders::_2, 1));
+ 
+   CMD2_ANY_LIST("less",    &apply_less);
+   CMD2_ANY_LIST("greater", &apply_greater);
+   CMD2_ANY_LIST("equal",   &apply_equal);
+ 
+-  CMD2_ANY_VALUE("convert.gm_time",      tr1::bind(&apply_to_time, tr1::placeholders::_2, 0));
+-  CMD2_ANY_VALUE("convert.gm_date",      tr1::bind(&apply_to_time, tr1::placeholders::_2, 0x2));
+-  CMD2_ANY_VALUE("convert.time",         tr1::bind(&apply_to_time, tr1::placeholders::_2, 0x1));
+-  CMD2_ANY_VALUE("convert.date",         tr1::bind(&apply_to_time, tr1::placeholders::_2, 0x1 | 0x2));
+-  CMD2_ANY_VALUE("convert.elapsed_time", tr1::bind(&apply_to_elapsed_time, tr1::placeholders::_2));
+-  CMD2_ANY_VALUE("convert.kb",           tr1::bind(&apply_to_kb, tr1::placeholders::_2));
+-  CMD2_ANY_VALUE("convert.mb",           tr1::bind(&apply_to_mb, tr1::placeholders::_2));
+-  CMD2_ANY_VALUE("convert.xb",           tr1::bind(&apply_to_xb, tr1::placeholders::_2));
+-  CMD2_ANY_VALUE("convert.throttle",     tr1::bind(&apply_to_throttle, tr1::placeholders::_2));
++  CMD2_ANY_VALUE("convert.gm_time",      bind(&apply_to_time, placeholders::_2, 0));
++  CMD2_ANY_VALUE("convert.gm_date",      bind(&apply_to_time, placeholders::_2, 0x2));
++  CMD2_ANY_VALUE("convert.time",         bind(&apply_to_time, placeholders::_2, 0x1));
++  CMD2_ANY_VALUE("convert.date",         bind(&apply_to_time, placeholders::_2, 0x1 | 0x2));
++  CMD2_ANY_VALUE("convert.elapsed_time", bind(&apply_to_elapsed_time, placeholders::_2));
++  CMD2_ANY_VALUE("convert.kb",           bind(&apply_to_kb, placeholders::_2));
++  CMD2_ANY_VALUE("convert.mb",           bind(&apply_to_mb, placeholders::_2));
++  CMD2_ANY_VALUE("convert.xb",           bind(&apply_to_xb, placeholders::_2));
++  CMD2_ANY_VALUE("convert.throttle",     bind(&apply_to_throttle, placeholders::_2));
+ 
+-  CMD2_ANY_LIST ("elapsed.less",         tr1::bind(&apply_elapsed_less, tr1::placeholders::_2));
+-  CMD2_ANY_LIST ("elapsed.greater",      tr1::bind(&apply_elapsed_greater, tr1::placeholders::_2));
++  CMD2_ANY_LIST ("elapsed.less",         bind(&apply_elapsed_less, placeholders::_2));
++  CMD2_ANY_LIST ("elapsed.greater",      bind(&apply_elapsed_greater, placeholders::_2));
+ }
Index: net/rtorrent/patches/patch-src_control.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_control.cc
diff -N net/rtorrent/patches/patch-src_control.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_control.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,33 @@
+$NetBSD$
+
+--- src/control.cc.orig	2015-10-09 20:35:01.000000000 +0000
++++ src/control.cc
+@@ -59,6 +59,16 @@
+ 
+ #include "control.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++namespace placeholders { using namespace std::placeholders; }
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++namespace placeholders { using namespace std::tr1::placeholders; }
++#endif
++
+ Control::Control() :
+   m_ui(new ui::Root()),
+   m_display(new display::Manager()),
+@@ -76,9 +86,9 @@ Control::Control() :
+   m_viewManager = new core::ViewManager();
+   m_dhtManager  = new core::DhtManager();
+ 
+-  m_inputStdin->slot_pressed(std::tr1::bind(&input::Manager::pressed, m_input, std::tr1::placeholders::_1));
++  m_inputStdin->slot_pressed(bind(&input::Manager::pressed, m_input, placeholders::_1));
+ 
+-  m_taskShutdown.slot() = std::tr1::bind(&Control::handle_shutdown, this);
++  m_taskShutdown.slot() = bind(&Control::handle_shutdown, this);
+ 
+   m_commandScheduler->set_slot_error_message(rak::mem_fn(m_core, &core::Manager::push_log_std));
+ }
Index: net/rtorrent/patches/patch-src_core_curl__get.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_core_curl__get.cc
diff -N net/rtorrent/patches/patch-src_core_curl__get.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_core_curl__get.cc	10 Oct 2015 19:00:03 -0000
@@ -0,0 +1,32 @@
+$NetBSD$
+
+--- src/core/curl_get.cc.orig	2015-10-09 19:45:31.000000000 +0000
++++ src/core/curl_get.cc
+@@ -45,6 +45,18 @@
+ #include "curl_get.h"
+ #include "curl_stack.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace core {
++  using std::bind;
++}
++#else
++#include <tr1/functional>
++namespace core {
++  using std::tr1::bind;
++}
++#endif
++
+ namespace core {
+ 
+ size_t
+@@ -82,7 +94,7 @@ CurlGet::start() {
+ 
+     // Normally libcurl should handle the timeout. But sometimes that doesn't
+     // work right so we do a fallback timeout that just aborts the transfer.
+-    m_taskTimeout.slot() = std::tr1::bind(&CurlGet::receive_timeout, this);
++    m_taskTimeout.slot() = bind(&CurlGet::receive_timeout, this);
+     priority_queue_erase(&taskScheduler, &m_taskTimeout);
+     priority_queue_insert(&taskScheduler, &m_taskTimeout, cachedTime + rak::timer::from_seconds(m_timeout + 5));
+   }
Index: net/rtorrent/patches/patch-src_core_curl__stack.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_core_curl__stack.cc
diff -N net/rtorrent/patches/patch-src_core_curl__stack.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_core_curl__stack.cc	10 Oct 2015 19:00:23 -0000
@@ -0,0 +1,32 @@
+$NetBSD$
+
+--- src/core/curl_stack.cc.orig	2015-10-09 19:45:49.000000000 +0000
++++ src/core/curl_stack.cc
+@@ -45,6 +45,18 @@
+ #include "curl_socket.h"
+ #include "curl_stack.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace core {
++  using std::bind;
++}
++#else
++#include <tr1/functional>
++namespace core {
++  using std::tr1::bind;
++}
++#endif
++
+ namespace core {
+ 
+ CurlStack::CurlStack() :
+@@ -54,7 +66,7 @@ CurlStack::CurlStack() :
+   m_ssl_verify_peer(true),
+   m_dns_timeout(60) {
+ 
+-  m_taskTimeout.slot() = std::tr1::bind(&CurlStack::receive_timeout, this);
++  m_taskTimeout.slot() = bind(&CurlStack::receive_timeout, this);
+ 
+ #if (LIBCURL_VERSION_NUM >= 0x071000)
+   curl_multi_setopt((CURLM*)m_handle, CURLMOPT_TIMERDATA, this);
Index: net/rtorrent/patches/patch-src_core_dht__manager.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_core_dht__manager.cc
diff -N net/rtorrent/patches/patch-src_core_dht__manager.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_core_dht__manager.cc	10 Oct 2015 19:00:42 -0000
@@ -0,0 +1,41 @@
+$NetBSD$
+
+--- src/core/dht_manager.cc.orig	2015-10-09 19:43:35.000000000 +0000
++++ src/core/dht_manager.cc
+@@ -54,6 +54,18 @@
+ #include "download_store.h"
+ #include "manager.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace core {
++  using std::bind;
++}
++#else
++#include <tr1/functional>
++namespace core {
++  using std::tr1::bind;
++}
++#endif
++
+ namespace core {
+ 
+ const char* DhtManager::dht_settings[dht_settings_num] = { "disable", "off", "auto", "on" };
+@@ -114,7 +126,7 @@ DhtManager::start_dht() {
+     torrent::dht_manager()->start(port);
+     torrent::dht_manager()->reset_statistics();
+ 
+-    m_updateTimeout.slot() = std::tr1::bind(&DhtManager::update, this);
++    m_updateTimeout.slot() = bind(&DhtManager::update, this);
+     priority_queue_insert(&taskScheduler, &m_updateTimeout, (cachedTime + rak::timer::from_seconds(60)).round_seconds());
+ 
+     m_dhtPrevCycle = 0;
+@@ -197,7 +209,7 @@ DhtManager::update() {
+         break;
+       
+     if (itr == end) {
+-      m_stopTimeout.slot() = std::tr1::bind(&DhtManager::stop_dht, this);
++      m_stopTimeout.slot() = bind(&DhtManager::stop_dht, this);
+       priority_queue_insert(&taskScheduler, &m_stopTimeout, (cachedTime + rak::timer::from_seconds(15 * 60)).round_seconds());
+     }
+   }
Index: net/rtorrent/patches/patch-src_core_download.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_core_download.cc
diff -N net/rtorrent/patches/patch-src_core_download.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_core_download.cc	10 Oct 2015 19:02:13 -0000
@@ -0,0 +1,36 @@
+$NetBSD$
+
+--- src/core/download.cc.orig	2015-10-09 19:44:20.000000000 +0000
++++ src/core/download.cc
+@@ -53,6 +53,20 @@
+ #include "download.h"
+ #include "manager.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace core {
++  using std::bind;
++  namespace placeholders { using namespace std::placeholders; }
++}
++#else
++#include <tr1/functional>
++namespace core {
++  using std::tr1::bind;
++  namespace placeholders { using namespace std::tr1::placeholders; }
++}
++#endif
++
+ namespace core {
+ 
+ Download::Download(download_type d) :
+@@ -62,8 +76,8 @@ Download::Download(download_type d) :
+   m_resumeFlags(~uint32_t()),
+   m_group(0) {
+ 
+-  m_download.info()->signal_tracker_success().push_back(tr1::bind(&Download::receive_tracker_msg, this, ""));
+-  m_download.info()->signal_tracker_failed().push_back(tr1::bind(&Download::receive_tracker_msg, this, tr1::placeholders::_1));
++  m_download.info()->signal_tracker_success().push_back(bind(&Download::receive_tracker_msg, this, ""));
++  m_download.info()->signal_tracker_failed().push_back(bind(&Download::receive_tracker_msg, this, placeholders::_1));
+ }
+ 
+ Download::~Download() {
Index: net/rtorrent/patches/patch-src_core_download__factory.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_core_download__factory.cc
diff -N net/rtorrent/patches/patch-src_core_download__factory.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_core_download__factory.cc	10 Oct 2015 19:02:17 -0000
@@ -0,0 +1,55 @@
+$NetBSD$
+
+--- src/core/download_factory.cc.orig	2015-10-09 19:29:35.000000000 +0000
++++ src/core/download_factory.cc
+@@ -41,7 +41,6 @@
+ #include <sstream>
+ #include <stdexcept>
+ #include <rak/path.h>
+-#include <tr1/functional>
+ #include <torrent/utils/log.h>
+ #include <torrent/utils/resume.h>
+ #include <torrent/object.h>
+@@ -62,6 +61,20 @@
+ #include "download_factory.h"
+ #include "download_store.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace core {
++  using std::bind;
++  namespace placeholders { using namespace std::placeholders; }
++}
++#else
++#include <tr1/functional>
++namespace core {
++  using std::tr1::bind;
++  namespace placeholders { using namespace std::tr1::placeholders; }
++}
++#endif
++
+ namespace core {
+ 
+ bool
+@@ -107,8 +120,8 @@ DownloadFactory::DownloadFactory(Manager
+   m_printLog(true),
+   m_isFile(false) {
+ 
+-  m_taskLoad.slot() = std::tr1::bind(&DownloadFactory::receive_load, this);
+-  m_taskCommit.slot() = std::tr1::bind(&DownloadFactory::receive_commit, this);
++  m_taskLoad.slot() = bind(&DownloadFactory::receive_load, this);
++  m_taskCommit.slot() = bind(&DownloadFactory::receive_commit, this);
+ 
+   // m_variables["connection_leech"] = rpc::call_command("protocol.connection.leech");
+   // m_variables["connection_seed"]  = rpc::call_command("protocol.connection.seed");
+@@ -158,8 +171,8 @@ DownloadFactory::receive_load() {
+     m_stream = new std::stringstream;
+     HttpQueue::iterator itr = m_manager->http_queue()->insert(m_uri, m_stream);
+ 
+-    (*itr)->signal_done().push_front(std::tr1::bind(&DownloadFactory::receive_loaded, this));
+-    (*itr)->signal_failed().push_front(std::tr1::bind(&DownloadFactory::receive_failed, this, std::tr1::placeholders::_1));
++    (*itr)->signal_done().push_front(bind(&DownloadFactory::receive_loaded, this));
++    (*itr)->signal_failed().push_front(bind(&DownloadFactory::receive_failed, this, placeholders::_1));
+ 
+     m_variables["tied_to_file"] = (int64_t)false;
+ 
Index: net/rtorrent/patches/patch-src_core_download__factory.h
===================================================================
RCS file: net/rtorrent/patches/patch-src_core_download__factory.h
diff -N net/rtorrent/patches/patch-src_core_download__factory.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_core_download__factory.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,35 @@
+$NetBSD$
+
+--- src/core/download_factory.h.orig	2015-10-09 19:29:35.000000000 +0000
++++ src/core/download_factory.h
+@@ -44,17 +44,28 @@
+ #include <iosfwd>
+ #include <rak/priority_queue_default.h>
+ #include <torrent/object.h>
+-#include <tr1/functional>
+ 
+ #include "http_queue.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace core {
++  using std::function;
++}
++#else
++#include <tr1/functional>
++namespace core {
++  using std::tr1::function;
++}
++#endif
++
+ namespace core {
+ 
+ class Manager;
+ 
+ class DownloadFactory {
+ public:
+-  typedef std::tr1::function<void ()> slot_void;
++  typedef function<void ()> slot_void;
+   typedef std::vector<std::string> command_list_type;
+ 
+   // Do not destroy this object while it is in a HttpQueue.
Index: net/rtorrent/patches/patch-src_core_download__list.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_core_download__list.cc
diff -N net/rtorrent/patches/patch-src_core_download__list.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_core_download__list.cc	10 Oct 2015 19:02:25 -0000
@@ -0,0 +1,34 @@
+$NetBSD$
+
+--- src/core/download_list.cc.orig	2015-10-09 19:46:09.000000000 +0000
++++ src/core/download_list.cc
+@@ -64,6 +64,18 @@
+ #include "download_list.h"
+ #include "download_store.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace core {
++  using std::bind;
++}
++#else
++#include <tr1/functional>
++namespace core {
++  using std::tr1::bind;
++}
++#endif
++
+ #define DL_TRIGGER_EVENT(download, event_name) \
+   rpc::commands.call_catch(event_name, rpc::make_target(download), torrent::Object(), "Event '" event_name "' failed: ");
+ 
+@@ -180,8 +192,8 @@ DownloadList::insert(Download* download)
+   lt_log_print_info(torrent::LOG_TORRENT_INFO, download->info(), "download_list", "Inserting download.");
+ 
+   try {
+-    (*itr)->data()->slot_initial_hash()        = tr1::bind(&DownloadList::hash_done, this, download);
+-    (*itr)->data()->slot_download_done()       = tr1::bind(&DownloadList::received_finished, this, download);
++    (*itr)->data()->slot_initial_hash()        = bind(&DownloadList::hash_done, this, download);
++    (*itr)->data()->slot_download_done()       = bind(&DownloadList::received_finished, this, download);
+ 
+     // This needs to be separated into two different calls to ensure
+     // the download remains in the view.
Index: net/rtorrent/patches/patch-src_core_download__slot__map.h
===================================================================
RCS file: net/rtorrent/patches/patch-src_core_download__slot__map.h
diff -N net/rtorrent/patches/patch-src_core_download__slot__map.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_core_download__slot__map.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,33 @@
+$NetBSD$
+
+--- src/core/download_slot_map.h.orig	2015-10-09 19:29:35.000000000 +0000
++++ src/core/download_slot_map.h
+@@ -39,15 +39,26 @@
+ 
+ #include <map>
+ #include <string>
++
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace core {
++  using std::function;
++}
++#else
+ #include <tr1/functional>
++namespace core {
++  using std::tr1::function;
++}
++#endif
+ 
+ #include "download.h"
+ 
+ namespace core {
+ 
+-class DownloadSlotMap : public std::map<std::string, std::tr1::function<void (Download*)> > {
++class DownloadSlotMap : public std::map<std::string, function<void (Download*)> > {
+ public:
+-  typedef std::tr1::function<void (Download*)> slot_download;
++  typedef function<void (Download*)> slot_download;
+   typedef std::map<std::string, slot_download> Base;
+   
+   void                insert(const std::string& key, slot_download s) { Base::operator[](key) = s; }
Index: net/rtorrent/patches/patch-src_core_http__queue.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_core_http__queue.cc
diff -N net/rtorrent/patches/patch-src_core_http__queue.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_core_http__queue.cc	10 Oct 2015 19:02:31 -0000
@@ -0,0 +1,34 @@
+$NetBSD$
+
+--- src/core/http_queue.cc.orig	2015-10-09 19:43:57.000000000 +0000
++++ src/core/http_queue.cc
+@@ -44,6 +44,18 @@
+ #include "http_queue.h"
+ #include "curl_get.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace core {
++  using std::bind;
++}
++#else
++#include <tr1/functional>
++namespace core {
++  using std::tr1::bind;
++}
++#endif
++
+ namespace core {
+ 
+ HttpQueue::iterator
+@@ -56,8 +68,8 @@ HttpQueue::insert(const std::string& url
+ 
+   iterator signal_itr = base_type::insert(end(), h.get());
+ 
+-  h->signal_done().push_back(std::tr1::bind(&HttpQueue::erase, this, signal_itr));
+-  h->signal_failed().push_back(std::tr1::bind(&HttpQueue::erase, this, signal_itr));
++  h->signal_done().push_back(bind(&HttpQueue::erase, this, signal_itr));
++  h->signal_failed().push_back(bind(&HttpQueue::erase, this, signal_itr));
+ 
+   (*signal_itr)->start();
+ 
Index: net/rtorrent/patches/patch-src_core_http__queue.h
===================================================================
RCS file: net/rtorrent/patches/patch-src_core_http__queue.h
diff -N net/rtorrent/patches/patch-src_core_http__queue.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_core_http__queue.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,34 @@
+$NetBSD$
+
+--- src/core/http_queue.h.orig	2015-10-09 19:29:35.000000000 +0000
++++ src/core/http_queue.h
+@@ -39,7 +39,18 @@
+ 
+ #include <list>
+ #include <iosfwd>
++
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace core {
++  using std::function;
++}
++#else
+ #include <tr1/functional>
++namespace core {
++  using std::tr1::function;
++}
++#endif
+ 
+ namespace core {
+ 
+@@ -48,8 +59,8 @@ class CurlGet;
+ class HttpQueue : private std::list<CurlGet*> {
+ public:
+   typedef std::list<CurlGet*>                 base_type;
+-  typedef std::tr1::function<CurlGet* ()>     slot_factory;
+-  typedef std::tr1::function<void (CurlGet*)> slot_curl_get;
++  typedef function<CurlGet* ()>     slot_factory;
++  typedef function<void (CurlGet*)> slot_curl_get;
+   typedef std::list<slot_curl_get>            signal_curl_get;
+ 
+   using base_type::iterator;
Index: net/rtorrent/patches/patch-src_core_manager.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_core_manager.cc
diff -N net/rtorrent/patches/patch-src_core_manager.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_core_manager.cc	10 Oct 2015 19:02:36 -0000
@@ -0,0 +1,78 @@
+$NetBSD$
+
+--- src/core/manager.cc.orig	2015-10-09 19:42:16.000000000 +0000
++++ src/core/manager.cc
+@@ -72,7 +72,26 @@
+ #include "poll_manager.h"
+ #include "view.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
+ namespace core {
++  using std::bind;
++  namespace placeholders { using namespace std::placeholders; }
++}
++#else
++#include <tr1/functional>
++namespace core {
++  using std::tr1::bind;
++  namespace placeholders { using namespace std::tr1::placeholders; }
++}
++#endif
++
++namespace core {
++
++const int Manager::create_start;
++const int Manager::create_tied;
++const int Manager::create_quiet;
++const int Manager::create_raw_data;
+ 
+ void
+ Manager::push_log(const char* msg) {
+@@ -113,7 +132,7 @@ Manager::set_hashing_view(View* v) {
+     throw torrent::internal_error("Manager::set_hashing_view(...) received NULL or is already set.");
+ 
+   m_hashingView = v;
+-  m_hashingView->signal_changed().push_back(std::tr1::bind(&Manager::receive_hashing_changed, this));
++  m_hashingView->signal_changed().push_back(bind(&Manager::receive_hashing_changed, this));
+ }
+ 
+ torrent::ThrottlePair
+@@ -133,7 +152,7 @@ Manager::get_throttle(const std::string&
+ void
+ Manager::set_address_throttle(uint32_t begin, uint32_t end, torrent::ThrottlePair throttles) {
+   m_addressThrottles.set_merge(begin, end, throttles);
+-  torrent::connection_manager()->address_throttle() = tr1::bind(&core::Manager::get_address_throttle, control->core(), tr1::placeholders::_1);
++  torrent::connection_manager()->address_throttle() = bind(&core::Manager::get_address_throttle, control->core(), placeholders::_1);
+ }
+ 
+ torrent::ThrottlePair
+@@ -144,8 +163,8 @@ Manager::get_address_throttle(const sock
+ // Most of this should be possible to move out.
+ void
+ Manager::initialize_second() {
+-  torrent::Http::slot_factory() = std::tr1::bind(&CurlStack::new_object, m_httpStack);
+-  m_httpQueue->set_slot_factory(std::tr1::bind(&CurlStack::new_object, m_httpStack));
++  torrent::Http::slot_factory() = bind(&CurlStack::new_object, m_httpStack);
++  m_httpQueue->set_slot_factory(bind(&CurlStack::new_object, m_httpStack));
+ 
+   CurlStack::global_init();
+ }
+@@ -330,7 +349,7 @@ Manager::try_create_download(const std::
+ 
+   f->set_start(flags & create_start);
+   f->set_print_log(!(flags & create_quiet));
+-  f->slot_finished(std::tr1::bind(&rak::call_delete_func<core::DownloadFactory>, f));
++  f->slot_finished(bind(&rak::call_delete_func<core::DownloadFactory>, f));
+ 
+   if (flags & create_raw_data)
+     f->load_raw_data(uri);
+@@ -354,7 +373,7 @@ Manager::try_create_download_from_meta_d
+ 
+   f->set_start(meta.get_key_value("start"));
+   f->set_print_log(meta.get_key_value("print_log"));
+-  f->slot_finished(std::tr1::bind(&rak::call_delete_func<core::DownloadFactory>, f));
++  f->slot_finished(bind(&rak::call_delete_func<core::DownloadFactory>, f));
+ 
+   // Bit of a waste to create the bencode repesentation here
+   // only to have the DownloadFactory decode it.
Index: net/rtorrent/patches/patch-src_core_view.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_core_view.cc
diff -N net/rtorrent/patches/patch-src_core_view.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_core_view.cc	10 Oct 2015 19:02:40 -0000
@@ -0,0 +1,48 @@
+$NetBSD$
+
+--- src/core/view.cc.orig	2015-10-09 19:47:50.000000000 +0000
++++ src/core/view.cc
+@@ -51,6 +51,20 @@
+ #include "manager.h"
+ #include "view.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace core {
++  using std::bind;
++  namespace placeholders { using namespace std::placeholders; }
++}
++#else
++#include <tr1/functional>
++namespace core {
++  using std::tr1::bind;
++  namespace placeholders { using namespace std::tr1::placeholders; }
++}
++#endif
++
+ namespace core {
+ 
+ // Also add focus thingie here?
+@@ -177,7 +191,7 @@ View::initialize(const std::string& name
+   m_focus = 0;
+ 
+   set_last_changed(rak::timer());
+-  m_delayChanged.slot() = std::tr1::bind(&View::emit_changed_now, this);
++  m_delayChanged.slot() = bind(&View::emit_changed_now, this);
+ }
+ 
+ void
+@@ -282,11 +296,11 @@ View::filter() {
+   // perhaps always clear them, thus not throwing anything.
+   if (!m_event_removed.is_empty())
+     std::for_each(changed.begin(), splitChanged,
+-                  tr1::bind(&rpc::call_object_d_nothrow, m_event_removed, tr1::placeholders::_1));
++                  bind(&rpc::call_object_d_nothrow, m_event_removed, placeholders::_1));
+ 
+   if (!m_event_added.is_empty())
+     std::for_each(changed.begin(), splitChanged,
+-                  tr1::bind(&rpc::call_object_d_nothrow, m_event_added, tr1::placeholders::_1));
++                  bind(&rpc::call_object_d_nothrow, m_event_added, placeholders::_1));
+ 
+   emit_changed();
+ }
Index: net/rtorrent/patches/patch-src_core_view.h
===================================================================
RCS file: net/rtorrent/patches/patch-src_core_view.h
diff -N net/rtorrent/patches/patch-src_core_view.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_core_view.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,31 @@
+$NetBSD$
+
+--- src/core/view.h.orig	2015-10-09 19:29:35.000000000 +0000
++++ src/core/view.h
+@@ -53,7 +53,17 @@
+ #include <vector>
+ #include <rak/timer.h>
+ #include <torrent/object.h>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace core {
++  using std::function;
++}
++#else
+ #include <tr1/functional>
++namespace core {
++  using std::tr1::function;
++}
++#endif
+ 
+ #include "globals.h"
+ 
+@@ -64,7 +74,7 @@ class Download;
+ class View : private std::vector<Download*> {
+ public:
+   typedef std::vector<Download*>      base_type;
+-  typedef std::tr1::function<void ()> slot_void;
++  typedef function<void ()> slot_void;
+   typedef std::list<slot_void>        signal_void;
+ 
+   using base_type::iterator;
Index: net/rtorrent/patches/patch-src_display_frame.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_display_frame.cc
diff -N net/rtorrent/patches/patch-src_display_frame.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_display_frame.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,56 @@
+$NetBSD$
+
+--- src/display/frame.cc.orig	2015-10-09 19:29:35.000000000 +0000
++++ src/display/frame.cc
+@@ -38,10 +38,24 @@
+ 
+ #include <algorithm>
+ #include <functional>
+-#include <tr1/functional>
+ #include <rak/algorithm.h>
+ #include <torrent/exceptions.h>
+ 
++#include <ciso646>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace display {
++  using std::bind;
++  namespace placeholders { using namespace std::placeholders; }
++}
++#else
++#include <tr1/functional>
++namespace display {
++  using std::tr1::bind;
++  namespace placeholders { using namespace std::tr1::placeholders; }
++}
++#endif
++
+ #include "frame.h"
+ #include "window.h"
+ 
+@@ -367,9 +381,9 @@ Frame::balance_row(uint32_t x, uint32_t 
+   //
+   // Else if we're short, only give each what they require.
+   std::stable_sort(dynamicFrames, dynamicFrames + dynamicSize,
+-                   std::tr1::bind(std::greater<extent_type>(),
+-                                  std::tr1::bind(&dynamic_min_height, std::tr1::placeholders::_1),
+-                                  std::tr1::bind(&dynamic_min_height, std::tr1::placeholders::_2)));
++                   bind(std::greater<extent_type>(),
++                                  bind(&dynamic_min_height, placeholders::_1),
++                                  bind(&dynamic_min_height, placeholders::_2)));
+ 
+   bool retry;
+ 
+@@ -442,9 +456,9 @@ Frame::balance_column(uint32_t x, uint32
+   //
+   // Else if we're short, only give each what they require.
+   std::stable_sort(dynamicFrames, dynamicFrames + dynamicSize,
+-                   std::tr1::bind(std::greater<extent_type>(),
+-                                  std::tr1::bind(&dynamic_min_width, std::tr1::placeholders::_1),
+-                                  std::tr1::bind(&dynamic_min_width, std::tr1::placeholders::_2)));
++                   bind(std::greater<extent_type>(),
++                                  bind(&dynamic_min_width, placeholders::_1),
++                                  bind(&dynamic_min_width, placeholders::_2)));
+ 
+   bool retry;
+ 
Index: net/rtorrent/patches/patch-src_display_manager.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_display_manager.cc
diff -N net/rtorrent/patches/patch-src_display_manager.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_display_manager.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,30 @@
+$NetBSD$
+
+--- src/display/manager.cc.orig	2015-10-09 19:49:53.000000000 +0000
++++ src/display/manager.cc
+@@ -45,12 +45,24 @@
+ #include "manager.h"
+ #include "window.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace display {
++  using std::bind;
++}
++#else
++#include <tr1/functional>
++namespace display {
++  using std::tr1::bind;
++}
++#endif
++
+ namespace display {
+ 
+ Manager::Manager() :
+   m_forceRedraw(false) {
+ 
+-  m_taskUpdate.slot() = std::tr1::bind(&Manager::receive_update, this);
++  m_taskUpdate.slot() = bind(&Manager::receive_update, this);
+ }
+ 
+ Manager::~Manager() {
Index: net/rtorrent/patches/patch-src_display_window.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_display_window.cc
diff -N net/rtorrent/patches/patch-src_display_window.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_display_window.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,32 @@
+$NetBSD$
+
+--- src/display/window.cc.orig	2015-10-09 19:49:06.000000000 +0000
++++ src/display/window.cc
+@@ -40,6 +40,18 @@
+ 
+ #include "window.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace display {
++  using std::bind;
++}
++#else
++#include <tr1/functional>
++namespace display {
++  using std::tr1::bind;
++}
++#endif
++
+ namespace display {
+ 
+ Window::SlotTimer  Window::m_slotSchedule;
+@@ -59,7 +71,7 @@ Window::Window(Canvas* canvas, int flags
+   m_maxWidth(maxWidth),
+   m_maxHeight(maxHeight) {
+ 
+-  m_taskUpdate.slot() = std::tr1::bind(&Window::redraw, this);
++  m_taskUpdate.slot() = bind(&Window::redraw, this);
+ }
+ 
+ Window::~Window() {
Index: net/rtorrent/patches/patch-src_display_window__download__list.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_display_window__download__list.cc
diff -N net/rtorrent/patches/patch-src_display_window__download__list.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_display_window__download__list.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,32 @@
+$NetBSD$
+
+--- src/display/window_download_list.cc.orig	2015-10-09 19:53:09.000000000 +0000
++++ src/display/window_download_list.cc
+@@ -46,6 +46,18 @@
+ #include "utils.h"
+ #include "window_download_list.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace display {
++  using std::bind;
++}
++#else
++#include <tr1/functional>
++namespace display {
++  using std::tr1::bind;
++}
++#endif
++
+ namespace display {
+ 
+ WindowDownloadList::WindowDownloadList() :
+@@ -68,7 +80,7 @@ WindowDownloadList::set_view(core::View*
+   m_view = l;
+ 
+   if (m_view != NULL)
+-    m_changed_itr = m_view->signal_changed().insert(m_view->signal_changed().begin(), std::tr1::bind(&Window::mark_dirty, this));
++    m_changed_itr = m_view->signal_changed().insert(m_view->signal_changed().begin(), bind(&Window::mark_dirty, this));
+ }
+ 
+ void
Index: net/rtorrent/patches/patch-src_display_window__file__list.cc
===================================================================
RCS file: /home/joerg/repo/netbsd/pkgsrc/net/rtorrent/patches/patch-src_display_window__file__list.cc,v
retrieving revision 1.3
diff -u -p -r1.3 patch-src_display_window__file__list.cc
--- net/rtorrent/patches/patch-src_display_window__file__list.cc	18 Sep 2013 16:33:08 -0000	1.3
+++ net/rtorrent/patches/patch-src_display_window__file__list.cc	10 Oct 2015 11:17:30 -0000
@@ -1,6 +1,6 @@
 $NetBSD: patch-src_display_window__file__list.cc,v 1.3 2013/09/18 16:33:08 joerg Exp $
 
---- src/display/window_file_list.cc.orig	2012-02-14 03:32:01.000000000 +0000
+--- src/display/window_file_list.cc.orig	2014-05-14 14:30:51.000000000 +0000
 +++ src/display/window_file_list.cc
 @@ -36,6 +36,7 @@
  
Index: net/rtorrent/patches/patch-src_display_window__http__queue.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_display_window__http__queue.cc
diff -N net/rtorrent/patches/patch-src_display_window__http__queue.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_display_window__http__queue.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,43 @@
+$NetBSD$
+
+--- src/display/window_http_queue.cc.orig	2015-10-09 19:51:10.000000000 +0000
++++ src/display/window_http_queue.cc
+@@ -45,6 +45,20 @@
+ #include "rak/functional.h"
+ #include "window_http_queue.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace display {
++  using std::bind;
++  namespace placeholders { using namespace std::placeholders; }
++}
++#else
++#include <tr1/functional>
++namespace display {
++  using std::tr1::bind;
++  namespace placeholders { using namespace std::tr1::placeholders; }
++}
++#endif
++
+ namespace display {
+ 
+ WindowHttpQueue::WindowHttpQueue(core::HttpQueue* q) :
+@@ -53,13 +67,13 @@ WindowHttpQueue::WindowHttpQueue(core::H
+   
+   set_active(false);
+   m_connInsert = m_queue->signal_insert().insert(m_queue->signal_insert().end(),
+-                                                 std::tr1::bind(&WindowHttpQueue::receive_insert,
++                                                 bind(&WindowHttpQueue::receive_insert,
+                                                                 this,
+-                                                                std::tr1::placeholders::_1));
++                                                                placeholders::_1));
+   m_connErase  = m_queue->signal_erase().insert(m_queue->signal_insert().end(),
+-                                                std::tr1::bind(&WindowHttpQueue::receive_erase,
++                                                bind(&WindowHttpQueue::receive_erase,
+                                                                this,
+-                                                               std::tr1::placeholders::_1));
++                                                               placeholders::_1));
+ }
+ 
+ void
Index: net/rtorrent/patches/patch-src_display_window__http__queue.h
===================================================================
RCS file: net/rtorrent/patches/patch-src_display_window__http__queue.h
diff -N net/rtorrent/patches/patch-src_display_window__http__queue.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_display_window__http__queue.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,32 @@
+$NetBSD$
+
+--- src/display/window_http_queue.h.orig	2015-10-09 19:29:35.000000000 +0000
++++ src/display/window_http_queue.h
+@@ -37,7 +37,18 @@
+ #ifndef RTORRENT_DISPLAY_WINDOW_HTTP_QUEUE_H
+ #define RTORRENT_DISPLAY_WINDOW_HTTP_QUEUE_H
+ 
++#include <ciso646>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace display {
++  using std::function;
++}
++#else
+ #include <tr1/functional>
++namespace display {
++  using std::tr1::function;
++}
++#endif
+ 
+ #include "window.h"
+ 
+@@ -50,7 +61,7 @@ namespace display {
+ 
+ class WindowHttpQueue : public Window {
+ public:
+-  typedef std::tr1::function<void (core::CurlGet*)> slot_curl_get;
++  typedef function<void (core::CurlGet*)> slot_curl_get;
+   typedef std::list<slot_curl_get>                  signal_curl_get;
+ 
+   WindowHttpQueue(core::HttpQueue* q);
Index: net/rtorrent/patches/patch-src_display_window__log.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_display_window__log.cc
diff -N net/rtorrent/patches/patch-src_display_window__log.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_display_window__log.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,37 @@
+$NetBSD$
+
+--- src/display/window_log.cc.orig	2015-10-09 19:51:43.000000000 +0000
++++ src/display/window_log.cc
+@@ -44,17 +44,29 @@
+ #include "utils.h"
+ #include "window_log.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace display {
++  using std::bind;
++}
++#else
++#include <tr1/functional>
++namespace display {
++  using std::tr1::bind;
++}
++#endif
++
+ namespace display {
+ 
+ WindowLog::WindowLog(torrent::log_buffer* l) :
+   Window(new Canvas, 0, 0, 0, extent_full, extent_static),
+   m_log(l) {
+ 
+-  m_taskUpdate.slot() = std::tr1::bind(&WindowLog::receive_update, this);
++  m_taskUpdate.slot() = bind(&WindowLog::receive_update, this);
+ 
+-  unsigned int signal_index = torrent::main_thread()->signal_bitfield()->add_signal(std::tr1::bind(&WindowLog::receive_update, this));
++  unsigned int signal_index = torrent::main_thread()->signal_bitfield()->add_signal(bind(&WindowLog::receive_update, this));
+ 
+-  m_log->lock_and_set_update_slot(std::tr1::bind(&torrent::thread_base::send_event_signal, torrent::main_thread(), signal_index, false));
++  m_log->lock_and_set_update_slot(bind(&torrent::thread_base::send_event_signal, torrent::main_thread(), signal_index, false));
+ }
+ 
+ WindowLog::~WindowLog() {
Index: net/rtorrent/patches/patch-src_input_bindings.h
===================================================================
RCS file: net/rtorrent/patches/patch-src_input_bindings.h
diff -N net/rtorrent/patches/patch-src_input_bindings.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_input_bindings.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,32 @@
+$NetBSD$
+
+--- src/input/bindings.h.orig	2015-10-09 19:29:35.000000000 +0000
++++ src/input/bindings.h
+@@ -38,15 +38,25 @@
+ #define RTORRENT_INPUT_BINDINGS_H
+ 
+ #include <map>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace input {
++  using std::function;
++}
++#else
+ #include <tr1/functional>
++namespace input {
++  using std::tr1::function;
++}
++#endif
+ 
+ #include "display/attributes.h"
+ 
+ namespace input {
+ 
+-class Bindings : private std::map<int, std::tr1::function<void ()> > {
++class Bindings : private std::map<int, function<void ()> > {
+ public:
+-  typedef std::tr1::function<void ()> slot_void;
++  typedef function<void ()> slot_void;
+   typedef std::map<int, slot_void>    base_type;
+ 
+   using base_type::iterator;
Index: net/rtorrent/patches/patch-src_input_input__event.h
===================================================================
RCS file: net/rtorrent/patches/patch-src_input_input__event.h
diff -N net/rtorrent/patches/patch-src_input_input__event.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_input_input__event.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,30 @@
+$NetBSD$
+
+--- src/input/input_event.h.orig	2015-10-09 19:29:35.000000000 +0000
++++ src/input/input_event.h
+@@ -39,13 +39,24 @@
+ 
+ #include <torrent/event.h>
+ #include <torrent/poll.h>
++#include <ciso646>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace input {
++  using std::function;
++}
++#else
+ #include <tr1/functional>
++namespace input {
++  using std::tr1::function;
++}
++#endif
+ 
+ namespace input {
+ 
+ class InputEvent : public torrent::Event {
+ public:
+-  typedef std::tr1::function<void (int)> slot_int;
++  typedef function<void (int)> slot_int;
+ 
+   InputEvent(int fd) { m_fileDesc = fd; }
+ 
Index: net/rtorrent/patches/patch-src_input_path__input.h
===================================================================
RCS file: net/rtorrent/patches/patch-src_input_path__input.h
diff -N net/rtorrent/patches/patch-src_input_path__input.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_input_path__input.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,40 @@
+$NetBSD$
+
+--- src/input/path_input.h.orig	2015-10-09 19:29:35.000000000 +0000
++++ src/input/path_input.h
+@@ -38,11 +38,23 @@
+ #define RTORRENT_INPUT_PATH_INPUT_H
+ 
+ #include <list>
+-#include <tr1/functional>
+ 
+ #include "utils/directory.h"
+ #include "text_input.h"
+ 
++#include <ciso646>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace input {
++  using std::function;
++}
++#else
++#include <tr1/functional>
++namespace input {
++  using std::tr1::function;
++}
++#endif
++
+ namespace input {
+ 
+ class PathInput : public TextInput {
+@@ -50,8 +62,8 @@ public:
+   typedef utils::Directory::iterator              directory_itr;
+   typedef std::pair<directory_itr, directory_itr> range_type;
+ 
+-  typedef std::tr1::function<void ()>                             slot_void;
+-  typedef std::tr1::function<void (directory_itr, directory_itr)> slot_itr_itr;
++  typedef function<void ()>                             slot_void;
++  typedef function<void (directory_itr, directory_itr)> slot_itr_itr;
+   typedef std::list<slot_void>                                    signal_void;
+   typedef std::list<slot_itr_itr>                                 signal_itr_itr;
+ 
Index: net/rtorrent/patches/patch-src_input_text__input.h
===================================================================
RCS file: net/rtorrent/patches/patch-src_input_text__input.h
diff -N net/rtorrent/patches/patch-src_input_text__input.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_input_text__input.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,30 @@
+$NetBSD$
+
+--- src/input/text_input.h.orig	2015-10-09 19:50:26.000000000 +0000
++++ src/input/text_input.h
+@@ -41,12 +41,24 @@
+ 
+ #include "bindings.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace input {
++  using std::function;
++}
++#else
++#include <tr1/functional>
++namespace input {
++  using std::tr1::function;
++}
++#endif
++
+ namespace input {
+ 
+ class TextInput : private std::string {
+ public:
+   typedef std::string                 Base;
+-  typedef std::tr1::function<void ()> slot_void;
++  typedef function<void ()> slot_void;
+ 
+   using Base::c_str;
+   using Base::empty;
Index: net/rtorrent/patches/patch-src_option__parser.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_option__parser.cc
diff -N net/rtorrent/patches/patch-src_option__parser.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_option__parser.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,36 @@
+$NetBSD$
+
+--- src/option_parser.cc.orig	2015-10-09 20:36:05.000000000 +0000
++++ src/option_parser.cc
+@@ -45,6 +45,15 @@
+ #include <unistd.h>
+ 
+ #include "option_parser.h"
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++namespace placeholders { using namespace std::placeholders; }
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++namespace placeholders { using namespace std::tr1::placeholders; }
++#endif
+ 
+ void
+ OptionParser::insert_flag(char c, slot_string s) {
+@@ -60,13 +69,13 @@ OptionParser::insert_option(char c, slot
+ 
+ void
+ OptionParser::insert_option_list(char c, slot_string_pair s) {
+-  m_container[c].m_slot = std::tr1::bind(&OptionParser::call_option_list, s, std::tr1::placeholders::_1);
++  m_container[c].m_slot = bind(&OptionParser::call_option_list, s, placeholders::_1);
+   m_container[c].m_useOption = true;
+ }
+ 
+ void
+ OptionParser::insert_int_pair(char c, slot_int_pair s) {
+-  m_container[c].m_slot = std::tr1::bind(&OptionParser::call_int_pair, s, std::tr1::placeholders::_1);
++  m_container[c].m_slot = bind(&OptionParser::call_int_pair, s, placeholders::_1);
+   m_container[c].m_useOption = true;
+ }
+ 
Index: net/rtorrent/patches/patch-src_option__parser.h
===================================================================
RCS file: net/rtorrent/patches/patch-src_option__parser.h
diff -N net/rtorrent/patches/patch-src_option__parser.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_option__parser.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,34 @@
+$NetBSD$
+
+--- src/option_parser.h.orig	2015-10-09 19:29:35.000000000 +0000
++++ src/option_parser.h
+@@ -39,15 +39,26 @@
+ 
+ #include <map>
+ #include <string>
++
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace rtorrent {
++  using std::function;
++}
++#else
+ #include <tr1/functional>
++namespace rtorrent {
++  using std::tr1::function;
++}
++#endif
+ 
+ // Throws std::runtime_error upon receiving bad input.
+ 
+ class OptionParser {
+ public:
+-  typedef std::tr1::function<void (const std::string&)>                     slot_string;
+-  typedef std::tr1::function<void (const std::string&, const std::string&)> slot_string_pair;
+-  typedef std::tr1::function<void (int, int)>                               slot_int_pair;
++  typedef rtorrent::function<void (const std::string&)>                     slot_string;
++  typedef rtorrent::function<void (const std::string&, const std::string&)> slot_string_pair;
++  typedef rtorrent::function<void (int, int)>                               slot_int_pair;
+ 
+   void                insert_flag(char c, slot_string s);
+   void                insert_option(char c, slot_string s);
Index: net/rtorrent/patches/patch-src_rpc_command.h
===================================================================
RCS file: net/rtorrent/patches/patch-src_rpc_command.h
diff -N net/rtorrent/patches/patch-src_rpc_command.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_rpc_command.h	10 Oct 2015 19:01:43 -0000
@@ -0,0 +1,45 @@
+$NetBSD$
+
+--- src/rpc/command.h.orig	2015-10-09 19:29:35.000000000 +0000
++++ src/rpc/command.h
+@@ -41,13 +41,19 @@
+ #include <limits>
+ #include <inttypes.h>
+ #include <torrent/object.h>
+-#include <tr1/functional>
+ 
+ #include <torrent/object.h>
+ #include <torrent/data/file_list_iterator.h>
+ 
+-// Move into config.h or something.
+-namespace tr1 { using namespace std::tr1; }
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++namespace rpc {
++  using std::function;
++}
++#else
++namespace rpc {
++  using std::tr1::function;
++}
++#endif
+ 
+ namespace core {
+   class Download;
+@@ -111,7 +117,7 @@ typedef rt_triple<int, void*, void*> tar
+ class command_base;
+ 
+ typedef const torrent::Object (*command_base_call_type)(command_base*, target_type, const torrent::Object&);
+-typedef tr1::function<torrent::Object (target_type, const torrent::Object&)> base_function;
++typedef function<torrent::Object (target_type, const torrent::Object&)> base_function;
+ 
+ template <typename tmpl> struct command_base_is_valid {};
+ template <command_base_call_type tmpl_func> struct command_base_is_type {};
+@@ -250,7 +256,7 @@ command_base::_call(command_base* cmd, t
+ }
+ 
+ #define COMMAND_BASE_TEMPLATE_TYPE(func_type, func_parm)                \
+-  template <typename T, int proper = target_type_id<T>::proper_type> struct func_type { typedef tr1::function<func_parm> type; }; \
++  template <typename T, int proper = target_type_id<T>::proper_type> struct func_type { typedef function<func_parm> type; }; \
+                                                                         \
+   template <> struct command_base_is_valid<func_type<target_type>::type>                { static const int value = 1; }; \
+   template <> struct command_base_is_valid<func_type<core::Download*>::type>            { static const int value = 1; }; \
Index: net/rtorrent/patches/patch-src_rpc_command__scheduler.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_rpc_command__scheduler.cc
diff -N net/rtorrent/patches/patch-src_rpc_command__scheduler.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_rpc_command__scheduler.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,32 @@
+$NetBSD$
+
+--- src/rpc/command_scheduler.cc.orig	2015-10-09 19:55:12.000000000 +0000
++++ src/rpc/command_scheduler.cc
+@@ -47,6 +47,18 @@
+ #include "command_scheduler_item.h"
+ #include "parse_commands.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace rpc {
++  using std::bind;
++}
++#else
++#include <tr1/functional>
++namespace rpc {
++  using std::tr1::bind;
++}
++#endif
++
+ namespace rpc {
+ 
+ CommandScheduler::~CommandScheduler() {
+@@ -71,7 +83,7 @@ CommandScheduler::insert(const std::stri
+     delete *itr;
+ 
+   *itr = new CommandSchedulerItem(key);
+-  (*itr)->slot() = std::tr1::bind(&CommandScheduler::call_item, this, *itr);
++  (*itr)->slot() = bind(&CommandScheduler::call_item, this, *itr);
+ 
+   return itr;
+ }
Index: net/rtorrent/patches/patch-src_rpc_command__scheduler__item.h
===================================================================
RCS file: net/rtorrent/patches/patch-src_rpc_command__scheduler__item.h
diff -N net/rtorrent/patches/patch-src_rpc_command__scheduler__item.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_rpc_command__scheduler__item.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,33 @@
+$NetBSD$
+
+--- src/rpc/command_scheduler_item.h.orig	2015-10-09 19:29:35.000000000 +0000
++++ src/rpc/command_scheduler_item.h
+@@ -39,14 +39,26 @@
+ 
+ #include "globals.h"
+ 
+-#include <tr1/functional>
+ #include <torrent/object.h>
+ 
++#include <ciso646>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace rpc {
++  using std::function;
++}
++#else
++#include <tr1/functional>
++namespace rpc {
++  using std::tr1::function;
++}
++#endif
++
+ namespace rpc {
+ 
+ class CommandSchedulerItem {
+ public:
+-  typedef std::tr1::function<void ()> slot_void;
++  typedef function<void ()> slot_void;
+ 
+   CommandSchedulerItem(const std::string& key) : m_key(key), m_interval(0) {}
+   ~CommandSchedulerItem();
Index: net/rtorrent/patches/patch-src_rpc_exec__file.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_rpc_exec__file.cc
diff -N net/rtorrent/patches/patch-src_rpc_exec__file.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_rpc_exec__file.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,18 @@
+$NetBSD$
+
+--- src/rpc/exec_file.cc.orig	2015-10-09 20:47:38.000000000 +0000
++++ src/rpc/exec_file.cc
+@@ -50,6 +50,13 @@
+ 
+ namespace rpc {
+ 
++const unsigned int ExecFile::max_args;
++const unsigned int ExecFile::buffer_size;
++const int ExecFile::flag_expand_tilde;
++const int ExecFile::flag_throw;
++const int ExecFile::flag_capture;
++const int ExecFile::flag_background;
++
+ // Close m_logFd.
+ 
+ int
Index: net/rtorrent/patches/patch-src_rpc_object__storage.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_rpc_object__storage.cc
diff -N net/rtorrent/patches/patch-src_rpc_object__storage.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_rpc_object__storage.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,51 @@
+$NetBSD$
+
+--- src/rpc/object_storage.cc.orig	2015-10-09 19:54:44.000000000 +0000
++++ src/rpc/object_storage.cc
+@@ -42,7 +42,37 @@
+ #include "parse.h"
+ #include "parse_commands.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
+ namespace rpc {
++  using std::bind;
++  namespace placeholders { using namespace std::placeholders; }
++}
++#else
++#include <tr1/functional>
++namespace rpc {
++  using std::tr1::bind;
++  namespace placeholders { using namespace std::tr1::placeholders; }
++}
++#endif
++
++namespace rpc {
++
++const unsigned int object_storage::flag_generic_type;
++const unsigned int object_storage::flag_bool_type;
++const unsigned int object_storage::flag_value_type;
++const unsigned int object_storage::flag_string_type;
++const unsigned int object_storage::flag_list_type;
++const unsigned int object_storage::flag_function_type;
++const unsigned int object_storage::flag_multi_type;
++
++const unsigned int object_storage::mask_type;
++const unsigned int object_storage::flag_constant;
++const unsigned int object_storage::flag_static;
++const unsigned int object_storage::flag_private;
++const unsigned int object_storage::flag_rlookup;
++
++const size_t object_storage::key_size;
+ 
+ object_storage::local_iterator
+ object_storage::find_local(const torrent::raw_string& key) {
+@@ -245,7 +275,7 @@ object_storage::rlookup_list(const std::
+   
+   if (r_itr != m_rlookup.end())
+     std::transform(r_itr->second.begin(), r_itr->second.end(), std::back_inserter(result),
+-                   std::tr1::bind(&key_type::c_str, std::tr1::bind(rak::mem_ptr(&value_type::first), std::tr1::placeholders::_1)));
++                   bind(&key_type::c_str, bind(rak::mem_ptr(&value_type::first), placeholders::_1)));
+ 
+   return result;
+ }
Index: net/rtorrent/patches/patch-src_rpc_object__storage.h
===================================================================
RCS file: net/rtorrent/patches/patch-src_rpc_object__storage.h
diff -N net/rtorrent/patches/patch-src_rpc_object__storage.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_rpc_object__storage.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,39 @@
+$NetBSD$
+
+--- src/rpc/object_storage.h.orig	2015-10-09 19:46:46.000000000 +0000
++++ src/rpc/object_storage.h
+@@ -42,13 +42,24 @@
+ #define RTORRENT_RPC_OBJECT_STORAGE_H
+ 
+ #include <cstring>
+-#include <tr1/unordered_map>
+ #include <torrent/object.h>
+ 
+ #include "rak/unordered_vector.h"
+ #include "command.h"
+ #include "fixed_key.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <unordered_map>
++namespace rpc {
++  using std::unordered_map;
++}
++#else
++#include <tr1/unordered_map>
++namespace rpc {
++  using std::tr1::unordered_map;
++}
++#endif
++
+ namespace rpc {
+ 
+ struct object_storage_node {
+@@ -56,7 +67,7 @@ struct object_storage_node {
+   char            flags;
+ };
+ 
+-typedef std::tr1::unordered_map<fixed_key_type<64>, object_storage_node, hash_fixed_key_type> object_storage_base_type;
++typedef unordered_map<fixed_key_type<64>, object_storage_node, hash_fixed_key_type> object_storage_base_type;
+ 
+ class object_storage : private object_storage_base_type {
+ public:
Index: net/rtorrent/patches/patch-src_rpc_xmlrpc.h
===================================================================
RCS file: net/rtorrent/patches/patch-src_rpc_xmlrpc.h
diff -N net/rtorrent/patches/patch-src_rpc_xmlrpc.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_rpc_xmlrpc.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,44 @@
+$NetBSD$
+
+--- src/rpc/xmlrpc.h.orig	2015-10-09 19:29:35.000000000 +0000
++++ src/rpc/xmlrpc.h
+@@ -37,9 +37,21 @@
+ #ifndef RTORRENT_RPC_XMLRPC_H
+ #define RTORRENT_RPC_XMLRPC_H
+ 
+-#include <tr1/functional>
+ #include <torrent/hash_string.h>
+ 
++#include <ciso646>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace rpc {
++  using std::function;
++}
++#else
++#include <tr1/functional>
++namespace rpc {
++  using std::tr1::function;
++}
++#endif
++
+ namespace core {
+   class Download;
+ }
+@@ -54,11 +66,11 @@ namespace rpc {
+ 
+ class XmlRpc {
+ public:
+-  typedef std::tr1::function<core::Download* (const char*)>                 slot_download;
+-  typedef std::tr1::function<torrent::File* (core::Download*, uint32_t)>    slot_file;
+-  typedef std::tr1::function<torrent::Tracker* (core::Download*, uint32_t)> slot_tracker;
+-  typedef std::tr1::function<torrent::Peer* (core::Download*, const torrent::HashString&)> slot_peer;
+-  typedef std::tr1::function<bool (const char*, uint32_t)>                  slot_write;
++  typedef function<core::Download* (const char*)>                 slot_download;
++  typedef function<torrent::File* (core::Download*, uint32_t)>    slot_file;
++  typedef function<torrent::Tracker* (core::Download*, uint32_t)> slot_tracker;
++  typedef function<torrent::Peer* (core::Download*, const torrent::HashString&)> slot_peer;
++  typedef function<bool (const char*, uint32_t)>                  slot_write;
+ 
+   static const int dialect_generic = 0;
+   static const int dialect_i8      = 1;
Index: net/rtorrent/patches/patch-src_signal__handler.cc
===================================================================
RCS file: /home/joerg/repo/netbsd/pkgsrc/net/rtorrent/patches/patch-src_signal__handler.cc,v
retrieving revision 1.3
diff -u -p -r1.3 patch-src_signal__handler.cc
--- net/rtorrent/patches/patch-src_signal__handler.cc	18 Sep 2013 16:33:09 -0000	1.3
+++ net/rtorrent/patches/patch-src_signal__handler.cc	10 Oct 2015 11:17:30 -0000
@@ -1,6 +1,6 @@
 $NetBSD: patch-src_signal__handler.cc,v 1.3 2013/09/18 16:33:09 joerg Exp $
 
---- src/signal_handler.cc.orig	2012-03-29 13:06:11.000000000 +0000
+--- src/signal_handler.cc.orig	2014-05-14 14:30:51.000000000 +0000
 +++ src/signal_handler.cc
 @@ -38,6 +38,7 @@
  
Index: net/rtorrent/patches/patch-src_signal__handler.h
===================================================================
RCS file: net/rtorrent/patches/patch-src_signal__handler.h
diff -N net/rtorrent/patches/patch-src_signal__handler.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_signal__handler.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,29 @@
+$NetBSD$
+
+--- src/signal_handler.h.orig	2015-10-09 19:29:35.000000000 +0000
++++ src/signal_handler.h
+@@ -38,11 +38,23 @@
+ #define RTORRENT_SIGNAL_HANDLER_H
+ 
+ #include <signal.h>
++
++#include <ciso646>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace rtorrent {
++  using std::function;
++}
++#else
+ #include <tr1/functional>
++namespace rtorrent {
++  using std::tr1::function;
++}
++#endif
+ 
+ class SignalHandler {
+ public:
+-  typedef std::tr1::function<void ()> slot_void;
++  typedef rtorrent::function<void ()> slot_void;
+ 
+   // typedef void (*handler_slot)(int, siginfo_t *info, ucontext_t *uap);
+   typedef void (*handler_slot)(int, siginfo_t*, void*);
Index: net/rtorrent/patches/patch-src_thread__base.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_thread__base.cc
diff -N net/rtorrent/patches/patch-src_thread__base.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_thread__base.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,28 @@
+$NetBSD$
+
+--- src/thread_base.cc.orig	2015-10-09 20:36:31.000000000 +0000
++++ src/thread_base.cc
+@@ -53,6 +53,14 @@
+ #include "control.h"
+ #include "core/manager.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++#endif
++
+ // Temporarly injected into config.h.
+ /* temp hack */
+ //#define lt_cacheline_aligned __attribute__((__aligned__(128)))
+@@ -109,7 +117,7 @@ public:
+ void throw_shutdown_exception() { throw torrent::shutdown_exception(); }
+ 
+ ThreadBase::ThreadBase() {
+-  m_taskShutdown.slot() = std::tr1::bind(&throw_shutdown_exception);
++  m_taskShutdown.slot() = bind(&throw_shutdown_exception);
+ 
+   m_threadQueue = new thread_queue_hack;
+ }
Index: net/rtorrent/patches/patch-src_ui_download.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_ui_download.cc
diff -N net/rtorrent/patches/patch-src_ui_download.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_ui_download.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,162 @@
+$NetBSD$
+
+--- src/ui/download.cc.orig	2015-10-09 19:58:35.000000000 +0000
++++ src/ui/download.cc
+@@ -66,6 +66,18 @@
+ #include "element_chunks_seen.h"
+ #include "element_transfer_list.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace ui {
++  using std::bind;
++}
++#else
++#include <tr1/functional>
++namespace ui {
++  using std::tr1::bind;
++}
++#endif
++
+ namespace ui {
+ 
+ Download::Download(core::Download* d) :
+@@ -84,13 +96,13 @@ Download::Download(core::Download* d) :
+   m_uiArray[DISPLAY_CHUNKS_SEEN]   = new ElementChunksSeen(d);
+   m_uiArray[DISPLAY_TRANSFER_LIST] = new ElementTransferList(d);
+ 
+-  m_uiArray[DISPLAY_MENU]->slot_exit(std::tr1::bind(&slot_type::operator(), &m_slot_exit));
+-  m_uiArray[DISPLAY_PEER_LIST]->slot_exit(std::tr1::bind(&Download::activate_display_menu, this, DISPLAY_PEER_LIST));
+-  m_uiArray[DISPLAY_INFO]->slot_exit(std::tr1::bind(&Download::activate_display_menu, this, DISPLAY_INFO));
+-  m_uiArray[DISPLAY_FILE_LIST]->slot_exit(std::tr1::bind(&Download::activate_display_menu, this, DISPLAY_FILE_LIST));
+-  m_uiArray[DISPLAY_TRACKER_LIST]->slot_exit(std::tr1::bind(&Download::activate_display_menu, this, DISPLAY_TRACKER_LIST));
+-  m_uiArray[DISPLAY_CHUNKS_SEEN]->slot_exit(std::tr1::bind(&Download::activate_display_menu, this, DISPLAY_CHUNKS_SEEN));
+-  m_uiArray[DISPLAY_TRANSFER_LIST]->slot_exit(std::tr1::bind(&Download::activate_display_menu, this, DISPLAY_TRANSFER_LIST));
++  m_uiArray[DISPLAY_MENU]->slot_exit(bind(&slot_type::operator(), &m_slot_exit));
++  m_uiArray[DISPLAY_PEER_LIST]->slot_exit(bind(&Download::activate_display_menu, this, DISPLAY_PEER_LIST));
++  m_uiArray[DISPLAY_INFO]->slot_exit(bind(&Download::activate_display_menu, this, DISPLAY_INFO));
++  m_uiArray[DISPLAY_FILE_LIST]->slot_exit(bind(&Download::activate_display_menu, this, DISPLAY_FILE_LIST));
++  m_uiArray[DISPLAY_TRACKER_LIST]->slot_exit(bind(&Download::activate_display_menu, this, DISPLAY_TRACKER_LIST));
++  m_uiArray[DISPLAY_CHUNKS_SEEN]->slot_exit(bind(&Download::activate_display_menu, this, DISPLAY_CHUNKS_SEEN));
++  m_uiArray[DISPLAY_TRANSFER_LIST]->slot_exit(bind(&Download::activate_display_menu, this, DISPLAY_TRANSFER_LIST));
+ 
+   bind_keys();
+ }
+@@ -109,30 +121,30 @@ Download::create_menu() {
+   ElementMenu* element = new ElementMenu;
+ 
+   element->push_back("Peer list",
+-                     std::tr1::bind(&Download::activate_display_focus, this, DISPLAY_PEER_LIST),
+-                     std::tr1::bind(&Download::activate_display_menu, this, DISPLAY_PEER_LIST));
++                     bind(&Download::activate_display_focus, this, DISPLAY_PEER_LIST),
++                     bind(&Download::activate_display_menu, this, DISPLAY_PEER_LIST));
+   element->push_back("Info",
+-                     std::tr1::bind(&Download::activate_display_focus, this, DISPLAY_INFO),
+-                     std::tr1::bind(&Download::activate_display_menu, this, DISPLAY_INFO));
++                     bind(&Download::activate_display_focus, this, DISPLAY_INFO),
++                     bind(&Download::activate_display_menu, this, DISPLAY_INFO));
+   element->push_back("File list",
+-                     std::tr1::bind(&Download::activate_display_focus, this, DISPLAY_FILE_LIST),
+-                     std::tr1::bind(&Download::activate_display_menu, this, DISPLAY_FILE_LIST));
++                     bind(&Download::activate_display_focus, this, DISPLAY_FILE_LIST),
++                     bind(&Download::activate_display_menu, this, DISPLAY_FILE_LIST));
+   element->push_back("Tracker list",
+-                     std::tr1::bind(&Download::activate_display_focus, this, DISPLAY_TRACKER_LIST),
+-                     std::tr1::bind(&Download::activate_display_menu, this, DISPLAY_TRACKER_LIST));
++                     bind(&Download::activate_display_focus, this, DISPLAY_TRACKER_LIST),
++                     bind(&Download::activate_display_menu, this, DISPLAY_TRACKER_LIST));
+   element->push_back("Chunks seen",
+-                     std::tr1::bind(&Download::activate_display_focus, this, DISPLAY_CHUNKS_SEEN),
+-                     std::tr1::bind(&Download::activate_display_menu, this, DISPLAY_CHUNKS_SEEN));
++                     bind(&Download::activate_display_focus, this, DISPLAY_CHUNKS_SEEN),
++                     bind(&Download::activate_display_menu, this, DISPLAY_CHUNKS_SEEN));
+   element->push_back("Transfer list",
+-                     std::tr1::bind(&Download::activate_display_focus, this, DISPLAY_TRANSFER_LIST),
+-                     std::tr1::bind(&Download::activate_display_menu, this, DISPLAY_TRANSFER_LIST));
++                     bind(&Download::activate_display_focus, this, DISPLAY_TRANSFER_LIST),
++                     bind(&Download::activate_display_menu, this, DISPLAY_TRANSFER_LIST));
+ 
+   element->set_entry(0, false);
+ 
+-  m_bindings['p'] = std::tr1::bind(&ElementMenu::set_entry_trigger, element, 0);
+-  m_bindings['o'] = std::tr1::bind(&ElementMenu::set_entry_trigger, element, 1);
+-  m_bindings['i'] = std::tr1::bind(&ElementMenu::set_entry_trigger, element, 2);
+-  m_bindings['u'] = std::tr1::bind(&ElementMenu::set_entry_trigger, element, 3);
++  m_bindings['p'] = bind(&ElementMenu::set_entry_trigger, element, 0);
++  m_bindings['o'] = bind(&ElementMenu::set_entry_trigger, element, 1);
++  m_bindings['i'] = bind(&ElementMenu::set_entry_trigger, element, 2);
++  m_bindings['u'] = bind(&ElementMenu::set_entry_trigger, element, 3);
+ 
+   return element;
+ }
+@@ -375,40 +387,40 @@ Download::adjust_up_throttle(int throttl
+ 
+ void
+ Download::bind_keys() {
+-  m_bindings['1'] = std::tr1::bind(&Download::receive_min_uploads, this, -1);
+-  m_bindings['2'] = std::tr1::bind(&Download::receive_min_uploads, this, 1);
+-  m_bindings['3'] = std::tr1::bind(&Download::receive_max_uploads, this, -1);
+-  m_bindings['4'] = std::tr1::bind(&Download::receive_max_uploads, this, 1);
+-  m_bindings['!'] = std::tr1::bind(&Download::receive_min_downloads, this, -1);
+-  m_bindings['@'] = std::tr1::bind(&Download::receive_min_downloads, this, 1);
+-  m_bindings['#'] = std::tr1::bind(&Download::receive_max_downloads, this, -1);
+-  m_bindings['$'] = std::tr1::bind(&Download::receive_max_downloads, this, 1);
+-  m_bindings['5'] = std::tr1::bind(&Download::receive_min_peers, this, -5);
+-  m_bindings['6'] = std::tr1::bind(&Download::receive_min_peers, this, 5);
+-  m_bindings['7'] = std::tr1::bind(&Download::receive_max_peers, this, -5);
+-  m_bindings['8'] = std::tr1::bind(&Download::receive_max_peers, this, 5);
+-  m_bindings['+'] = std::tr1::bind(&Download::receive_next_priority, this);
+-  m_bindings['-'] = std::tr1::bind(&Download::receive_prev_priority, this);
++  m_bindings['1'] = bind(&Download::receive_min_uploads, this, -1);
++  m_bindings['2'] = bind(&Download::receive_min_uploads, this, 1);
++  m_bindings['3'] = bind(&Download::receive_max_uploads, this, -1);
++  m_bindings['4'] = bind(&Download::receive_max_uploads, this, 1);
++  m_bindings['!'] = bind(&Download::receive_min_downloads, this, -1);
++  m_bindings['@'] = bind(&Download::receive_min_downloads, this, 1);
++  m_bindings['#'] = bind(&Download::receive_max_downloads, this, -1);
++  m_bindings['$'] = bind(&Download::receive_max_downloads, this, 1);
++  m_bindings['5'] = bind(&Download::receive_min_peers, this, -5);
++  m_bindings['6'] = bind(&Download::receive_min_peers, this, 5);
++  m_bindings['7'] = bind(&Download::receive_max_peers, this, -5);
++  m_bindings['8'] = bind(&Download::receive_max_peers, this, 5);
++  m_bindings['+'] = bind(&Download::receive_next_priority, this);
++  m_bindings['-'] = bind(&Download::receive_prev_priority, this);
+ 
+-  m_bindings['t'] = std::tr1::bind(&torrent::Download::manual_request, m_download->download(), false);
+-  m_bindings['T'] = std::tr1::bind(&torrent::Download::manual_request, m_download->download(), true);
++  m_bindings['t'] = bind(&torrent::Download::manual_request, m_download->download(), false);
++  m_bindings['T'] = bind(&torrent::Download::manual_request, m_download->download(), true);
+ 
+   const char* keys = control->ui()->get_throttle_keys();
+ 
+-  m_bindings[keys[ 0]] = std::tr1::bind(&Download::adjust_up_throttle, this, 1);
+-  m_bindings[keys[ 1]] = std::tr1::bind(&Download::adjust_up_throttle, this, -1);
+-  m_bindings[keys[ 2]] = std::tr1::bind(&Download::adjust_down_throttle, this, 1);
+-  m_bindings[keys[ 3]] = std::tr1::bind(&Download::adjust_down_throttle, this, -1);
+-
+-  m_bindings[keys[ 4]] = std::tr1::bind(&Download::adjust_up_throttle, this, 5);
+-  m_bindings[keys[ 5]] = std::tr1::bind(&Download::adjust_up_throttle, this, -5);
+-  m_bindings[keys[ 6]] = std::tr1::bind(&Download::adjust_down_throttle, this, 5);
+-  m_bindings[keys[ 7]] = std::tr1::bind(&Download::adjust_down_throttle, this, -5);
+-
+-  m_bindings[keys[ 8]] = std::tr1::bind(&Download::adjust_up_throttle, this, 50);
+-  m_bindings[keys[ 9]] = std::tr1::bind(&Download::adjust_up_throttle, this, -50);
+-  m_bindings[keys[10]] = std::tr1::bind(&Download::adjust_down_throttle, this, 50);
+-  m_bindings[keys[11]] = std::tr1::bind(&Download::adjust_down_throttle, this, -50);
++  m_bindings[keys[ 0]] = bind(&Download::adjust_up_throttle, this, 1);
++  m_bindings[keys[ 1]] = bind(&Download::adjust_up_throttle, this, -1);
++  m_bindings[keys[ 2]] = bind(&Download::adjust_down_throttle, this, 1);
++  m_bindings[keys[ 3]] = bind(&Download::adjust_down_throttle, this, -1);
++
++  m_bindings[keys[ 4]] = bind(&Download::adjust_up_throttle, this, 5);
++  m_bindings[keys[ 5]] = bind(&Download::adjust_up_throttle, this, -5);
++  m_bindings[keys[ 6]] = bind(&Download::adjust_down_throttle, this, 5);
++  m_bindings[keys[ 7]] = bind(&Download::adjust_down_throttle, this, -5);
++
++  m_bindings[keys[ 8]] = bind(&Download::adjust_up_throttle, this, 50);
++  m_bindings[keys[ 9]] = bind(&Download::adjust_up_throttle, this, -50);
++  m_bindings[keys[10]] = bind(&Download::adjust_down_throttle, this, 50);
++  m_bindings[keys[11]] = bind(&Download::adjust_down_throttle, this, -50);
+ }
+ 
+ }
Index: net/rtorrent/patches/patch-src_ui_download__list.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_ui_download__list.cc
diff -N net/rtorrent/patches/patch-src_ui_download__list.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_ui_download__list.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,92 @@
+$NetBSD$
+
+--- src/ui/download_list.cc.orig	2015-10-09 19:57:29.000000000 +0000
++++ src/ui/download_list.cc
+@@ -65,6 +65,20 @@
+ #include "element_string_list.h"
+ #include "root.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace ui {
++  using std::bind;
++  namespace placeholders { using namespace std::placeholders; }
++}
++#else
++#include <tr1/functional>
++namespace ui {
++  using std::tr1::bind;
++  namespace placeholders { using namespace std::tr1::placeholders; }
++}
++#endif
++
+ namespace ui {
+ 
+ DownloadList::DownloadList() :
+@@ -191,7 +205,7 @@ DownloadList::activate_display(Display d
+       Download* download = new Download(*current_view()->focus());
+ 
+       download->activate(m_frame);
+-      download->slot_exit(std::tr1::bind(&DownloadList::activate_display, this, DISPLAY_DOWNLOAD_LIST));
++      download->slot_exit(bind(&DownloadList::activate_display, this, DISPLAY_DOWNLOAD_LIST));
+     
+       m_uiArray[DISPLAY_DOWNLOAD] = download;
+       break;
+@@ -268,18 +282,18 @@ DownloadList::receive_view_input(Input t
+ 
+   ElementStringList* esl = dynamic_cast<ElementStringList*>(m_uiArray[DISPLAY_STRING_LIST]);
+ 
+-  input->signal_show_next().push_back(std::tr1::bind(&DownloadList::activate_display, this, DISPLAY_STRING_LIST));
+-  input->signal_show_next().push_back(std::tr1::bind(&ElementStringList::next_screen, esl));
++  input->signal_show_next().push_back(bind(&DownloadList::activate_display, this, DISPLAY_STRING_LIST));
++  input->signal_show_next().push_back(bind(&ElementStringList::next_screen, esl));
+ 
+-  input->signal_show_range().push_back(std::tr1::bind(&DownloadList::activate_display, this, DISPLAY_STRING_LIST));
+-  input->signal_show_range().push_back(std::tr1::bind(&ElementStringList::set_range_dirent<utils::Directory::iterator>,
++  input->signal_show_range().push_back(bind(&DownloadList::activate_display, this, DISPLAY_STRING_LIST));
++  input->signal_show_range().push_back(bind(&ElementStringList::set_range_dirent<utils::Directory::iterator>,
+                                                       esl,
+-                                                      std::tr1::placeholders::_1,
+-                                                      std::tr1::placeholders::_2));
++                                                      placeholders::_1,
++                                                      placeholders::_2));
+ 
+-  input->bindings()['\n']      = std::tr1::bind(&DownloadList::receive_exit_input, this, type);
+-  input->bindings()[KEY_ENTER] = std::tr1::bind(&DownloadList::receive_exit_input, this, type);
+-  input->bindings()['\x07']    = std::tr1::bind(&DownloadList::receive_exit_input, this, INPUT_NONE);
++  input->bindings()['\n']      = bind(&DownloadList::receive_exit_input, this, type);
++  input->bindings()[KEY_ENTER] = bind(&DownloadList::receive_exit_input, this, type);
++  input->bindings()['\x07']    = bind(&DownloadList::receive_exit_input, this, INPUT_NONE);
+ 
+   control->ui()->enable_input(title, input);
+ }
+@@ -340,20 +354,20 @@ DownloadList::receive_exit_input(Input t
+ 
+ void
+ DownloadList::setup_keys() {
+-  m_bindings['\x7f']        = std::tr1::bind(&DownloadList::receive_view_input, this, INPUT_LOAD_DEFAULT);
+-  m_bindings[KEY_BACKSPACE] = std::tr1::bind(&DownloadList::receive_view_input, this, INPUT_LOAD_DEFAULT);
+-  m_bindings['\n']          = std::tr1::bind(&DownloadList::receive_view_input, this, INPUT_LOAD_MODIFIED);
+-  m_bindings[KEY_ENTER]     = std::tr1::bind(&DownloadList::receive_view_input, this, INPUT_LOAD_MODIFIED);
+-  m_bindings['\x0F']        = std::tr1::bind(&DownloadList::receive_view_input, this, INPUT_CHANGE_DIRECTORY);
+-  m_bindings['X' - '@']     = std::tr1::bind(&DownloadList::receive_view_input, this, INPUT_COMMAND);
++  m_bindings['\x7f']        = bind(&DownloadList::receive_view_input, this, INPUT_LOAD_DEFAULT);
++  m_bindings[KEY_BACKSPACE] = bind(&DownloadList::receive_view_input, this, INPUT_LOAD_DEFAULT);
++  m_bindings['\n']          = bind(&DownloadList::receive_view_input, this, INPUT_LOAD_MODIFIED);
++  m_bindings[KEY_ENTER]     = bind(&DownloadList::receive_view_input, this, INPUT_LOAD_MODIFIED);
++  m_bindings['\x0F']        = bind(&DownloadList::receive_view_input, this, INPUT_CHANGE_DIRECTORY);
++  m_bindings['X' - '@']     = bind(&DownloadList::receive_view_input, this, INPUT_COMMAND);
+ 
+   m_uiArray[DISPLAY_LOG]->bindings()[KEY_LEFT] =
+     m_uiArray[DISPLAY_LOG]->bindings()['B' - '@'] =
+-    m_uiArray[DISPLAY_LOG]->bindings()[' '] = std::tr1::bind(&DownloadList::activate_display, this, DISPLAY_DOWNLOAD_LIST);
++    m_uiArray[DISPLAY_LOG]->bindings()[' '] = bind(&DownloadList::activate_display, this, DISPLAY_DOWNLOAD_LIST);
+ 
+   m_uiArray[DISPLAY_DOWNLOAD_LIST]->bindings()[KEY_RIGHT] =
+-    m_uiArray[DISPLAY_DOWNLOAD_LIST]->bindings()['F' - '@'] = std::tr1::bind(&DownloadList::activate_display, this, DISPLAY_DOWNLOAD);
+-  m_uiArray[DISPLAY_DOWNLOAD_LIST]->bindings()['l'] = std::tr1::bind(&DownloadList::activate_display, this, DISPLAY_LOG);
++    m_uiArray[DISPLAY_DOWNLOAD_LIST]->bindings()['F' - '@'] = bind(&DownloadList::activate_display, this, DISPLAY_DOWNLOAD);
++  m_uiArray[DISPLAY_DOWNLOAD_LIST]->bindings()['l'] = bind(&DownloadList::activate_display, this, DISPLAY_LOG);
+ }
+ 
+ }
Index: net/rtorrent/patches/patch-src_ui_download__list.h
===================================================================
RCS file: net/rtorrent/patches/patch-src_ui_download__list.h
diff -N net/rtorrent/patches/patch-src_ui_download__list.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_ui_download__list.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,33 @@
+$NetBSD$
+
+--- src/ui/download_list.h.orig	2015-10-09 20:03:28.000000000 +0000
++++ src/ui/download_list.h
+@@ -41,6 +41,19 @@
+ #include "globals.h"
+ #include "display/manager.h"
+ 
++#include <ciso646>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace ui {
++  using std::function;
++}
++#else
++#include <tr1/functional>
++namespace ui {
++  using std::tr1::function;
++}
++#endif
++
+ class Control;
+ 
+ namespace core {
+@@ -71,7 +84,7 @@ public:
+   typedef display::WindowLog                       WLog;
+   typedef display::WindowLogComplete               WLogComplete;
+ 
+-  typedef std::tr1::function<void (const std::string&)> slot_string;
++  typedef function<void (const std::string&)> slot_string;
+ 
+   typedef enum {
+     DISPLAY_DOWNLOAD,
Index: net/rtorrent/patches/patch-src_ui_element__base.h
===================================================================
RCS file: net/rtorrent/patches/patch-src_ui_element__base.h
diff -N net/rtorrent/patches/patch-src_ui_element__base.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_ui_element__base.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,32 @@
+$NetBSD$
+
+--- src/ui/element_base.h.orig	2015-10-09 19:52:18.000000000 +0000
++++ src/ui/element_base.h
+@@ -39,6 +39,18 @@
+ 
+ #include "input/bindings.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace ui {
++  using std::function;
++}
++#else
++#include <tr1/functional>
++namespace ui {
++  using std::tr1::function;
++}
++#endif
++
+ namespace display {
+   class Frame;
+   class Window;
+@@ -48,7 +60,7 @@ namespace ui {
+ 
+ class ElementBase {
+ public:
+-  typedef std::tr1::function<void ()> slot_type;
++  typedef function<void ()> slot_type;
+ 
+   ElementBase() : m_frame(NULL), m_focus(false) {}
+   virtual ~ElementBase() {}
Index: net/rtorrent/patches/patch-src_ui_element__chunks__seen.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_ui_element__chunks__seen.cc
diff -N net/rtorrent/patches/patch-src_ui_element__chunks__seen.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_ui_element__chunks__seen.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,41 @@
+$NetBSD$
+
+--- src/ui/element_chunks_seen.cc.orig	2015-10-09 20:15:30.000000000 +0000
++++ src/ui/element_chunks_seen.cc
+@@ -45,6 +45,18 @@
+ #include "control.h"
+ #include "element_chunks_seen.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace ui {
++  using std::bind;
++}
++#else
++#include <tr1/functional>
++namespace ui {
++  using std::tr1::bind;
++}
++#endif
++
+ namespace ui {
+ 
+ ElementChunksSeen::ElementChunksSeen(core::Download* d) :
+@@ -52,12 +64,12 @@ ElementChunksSeen::ElementChunksSeen(cor
+   m_window(NULL),
+   m_focus(0) {
+ 
+-  m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = std::tr1::bind(&slot_type::operator(), &m_slot_exit);
++  m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = bind(&slot_type::operator(), &m_slot_exit);
+ 
+-  m_bindings[KEY_DOWN]  = m_bindings['N' - '@'] = std::tr1::bind(&ElementChunksSeen::receive_next, this);
+-  m_bindings[KEY_UP]    = m_bindings['P' - '@'] = std::tr1::bind(&ElementChunksSeen::receive_prev, this);
+-  m_bindings[KEY_NPAGE] = std::tr1::bind(&ElementChunksSeen::receive_pagenext, this);
+-  m_bindings[KEY_PPAGE] = std::tr1::bind(&ElementChunksSeen::receive_pageprev, this);
++  m_bindings[KEY_DOWN]  = m_bindings['N' - '@'] = bind(&ElementChunksSeen::receive_next, this);
++  m_bindings[KEY_UP]    = m_bindings['P' - '@'] = bind(&ElementChunksSeen::receive_prev, this);
++  m_bindings[KEY_NPAGE] = bind(&ElementChunksSeen::receive_pagenext, this);
++  m_bindings[KEY_PPAGE] = bind(&ElementChunksSeen::receive_pageprev, this);
+ }
+ 
+ void
Index: net/rtorrent/patches/patch-src_ui_element__download__list.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_ui_element__download__list.cc
diff -N net/rtorrent/patches/patch-src_ui_element__download__list.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_ui_element__download__list.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,89 @@
+$NetBSD$
+
+--- src/ui/element_download_list.cc.orig	2015-10-09 20:01:19.000000000 +0000
++++ src/ui/element_download_list.cc
+@@ -52,6 +52,18 @@
+ #include "control.h"
+ #include "element_download_list.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace ui {
++  using std::bind;
++}
++#else
++#include <tr1/functional>
++namespace ui {
++  using std::tr1::bind;
++}
++#endif
++
+ namespace ui {
+ 
+ ElementDownloadList::ElementDownloadList() :
+@@ -63,42 +75,42 @@ ElementDownloadList::ElementDownloadList
+   if (m_view == NULL)
+     throw torrent::internal_error("View \"main\" must be present to initialize the main display.");
+ 
+-  m_bindings['\x13'] = std::tr1::bind(&ElementDownloadList::receive_command, this, "d.start=");
+-  m_bindings['\x04'] = std::tr1::bind(&ElementDownloadList::receive_command, this, "branch=d.state=,d.stop=,d.erase=");
+-  m_bindings['\x0B'] = std::tr1::bind(&ElementDownloadList::receive_command, this, "d.ignore_commands.set=1; d.stop=; d.close=");
+-  m_bindings['\x12'] = std::tr1::bind(&ElementDownloadList::receive_command, this, "d.complete.set=0; d.check_hash=");
+-  m_bindings['\x05'] = std::tr1::bind(&ElementDownloadList::receive_command, this,
++  m_bindings['\x13'] = bind(&ElementDownloadList::receive_command, this, "d.start=");
++  m_bindings['\x04'] = bind(&ElementDownloadList::receive_command, this, "branch=d.state=,d.stop=,d.erase=");
++  m_bindings['\x0B'] = bind(&ElementDownloadList::receive_command, this, "d.ignore_commands.set=1; d.stop=; d.close=");
++  m_bindings['\x12'] = bind(&ElementDownloadList::receive_command, this, "d.complete.set=0; d.check_hash=");
++  m_bindings['\x05'] = bind(&ElementDownloadList::receive_command, this,
+                                       "f.multicall=,f.set_create_queued=0,f.set_resize_queued=0; print=\"Queued create/resize of files in torrent.\"");
+ 
+-  m_bindings['+']    = std::tr1::bind(&ElementDownloadList::receive_next_priority, this);
+-  m_bindings['-']    = std::tr1::bind(&ElementDownloadList::receive_prev_priority, this);
+-  m_bindings['T'-'@']= std::tr1::bind(&ElementDownloadList::receive_cycle_throttle, this);
+-  m_bindings['I']    = std::tr1::bind(&ElementDownloadList::receive_command, this,
++  m_bindings['+']    = bind(&ElementDownloadList::receive_next_priority, this);
++  m_bindings['-']    = bind(&ElementDownloadList::receive_prev_priority, this);
++  m_bindings['T'-'@']= bind(&ElementDownloadList::receive_cycle_throttle, this);
++  m_bindings['I']    = bind(&ElementDownloadList::receive_command, this,
+                                   "branch=d.ignore_commands=,"
+                                   "{d.ignore_commands.set=0, print=\"Torrent set to heed commands.\"},"
+                                   "{d.ignore_commands.set=1, print=\"Torrent set to ignore commands.\"}");
+-  m_bindings['B'-'@']= std::tr1::bind(&ElementDownloadList::receive_command, this,
++  m_bindings['B'-'@']= bind(&ElementDownloadList::receive_command, this,
+                                   "branch=d.is_active=,"
+                                   "{print=\"Cannot enable initial seeding on an active download.\"},"
+                                   "{d.connection_seed.set=initial_seed, print=\"Enabled initial seeding for the selected download.\"}");
+ 
+-  m_bindings['U']    = std::tr1::bind(&ElementDownloadList::receive_command, this,
++  m_bindings['U']    = bind(&ElementDownloadList::receive_command, this,
+                                       "d.delete_tied=; print=\"Cleared tied to file association for the selected download.\"");
+ 
+   // These should also be commands.
+-  m_bindings['1']           = std::tr1::bind(&ElementDownloadList::receive_change_view, this, "main");
+-  m_bindings['2']           = std::tr1::bind(&ElementDownloadList::receive_change_view, this, "name");
+-  m_bindings['3']           = std::tr1::bind(&ElementDownloadList::receive_change_view, this, "started");
+-  m_bindings['4']           = std::tr1::bind(&ElementDownloadList::receive_change_view, this, "stopped");
+-  m_bindings['5']           = std::tr1::bind(&ElementDownloadList::receive_change_view, this, "complete");
+-  m_bindings['6']           = std::tr1::bind(&ElementDownloadList::receive_change_view, this, "incomplete");
+-  m_bindings['7']           = std::tr1::bind(&ElementDownloadList::receive_change_view, this, "hashing");
+-  m_bindings['8']           = std::tr1::bind(&ElementDownloadList::receive_change_view, this, "seeding");
+-  m_bindings['9']           = std::tr1::bind(&ElementDownloadList::receive_change_view, this, "leeching");
+-  m_bindings['0']           = std::tr1::bind(&ElementDownloadList::receive_change_view, this, "active");
++  m_bindings['1']           = bind(&ElementDownloadList::receive_change_view, this, "main");
++  m_bindings['2']           = bind(&ElementDownloadList::receive_change_view, this, "name");
++  m_bindings['3']           = bind(&ElementDownloadList::receive_change_view, this, "started");
++  m_bindings['4']           = bind(&ElementDownloadList::receive_change_view, this, "stopped");
++  m_bindings['5']           = bind(&ElementDownloadList::receive_change_view, this, "complete");
++  m_bindings['6']           = bind(&ElementDownloadList::receive_change_view, this, "incomplete");
++  m_bindings['7']           = bind(&ElementDownloadList::receive_change_view, this, "hashing");
++  m_bindings['8']           = bind(&ElementDownloadList::receive_change_view, this, "seeding");
++  m_bindings['9']           = bind(&ElementDownloadList::receive_change_view, this, "leeching");
++  m_bindings['0']           = bind(&ElementDownloadList::receive_change_view, this, "active");
+ 
+-  m_bindings[KEY_UP]   = m_bindings['P' - '@'] = std::tr1::bind(&ElementDownloadList::receive_prev, this);
+-  m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = std::tr1::bind(&ElementDownloadList::receive_next, this);
++  m_bindings[KEY_UP]   = m_bindings['P' - '@'] = bind(&ElementDownloadList::receive_prev, this);
++  m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = bind(&ElementDownloadList::receive_next, this);
+ }
+ 
+ void
Index: net/rtorrent/patches/patch-src_ui_element__file__list.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_ui_element__file__list.cc
diff -N net/rtorrent/patches/patch-src_ui_element__file__list.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_ui_element__file__list.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,59 @@
+$NetBSD$
+
+--- src/ui/element_file_list.cc.orig	2015-10-09 20:09:40.000000000 +0000
++++ src/ui/element_file_list.cc
+@@ -51,6 +51,18 @@
+ #include "element_file_list.h"
+ #include "element_text.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace ui {
++  using std::bind;
++}
++#else
++#include <tr1/functional>
++namespace ui {
++  using std::tr1::bind;
++}
++#endif
++
+ namespace ui {
+ 
+ ElementFileList::ElementFileList(core::Download* d) :
+@@ -63,17 +75,17 @@ ElementFileList::ElementFileList(core::D
+   m_selected(iterator(d->download()->file_list()->begin())),
+   m_collapsed(false) {
+ 
+-  m_bindings[KEY_LEFT]  = m_bindings['B' - '@'] = std::tr1::bind(&slot_type::operator(), &m_slot_exit);
+-  m_bindings[KEY_RIGHT] = m_bindings['F' - '@'] = std::tr1::bind(&ElementFileList::receive_select, this);
++  m_bindings[KEY_LEFT]  = m_bindings['B' - '@'] = bind(&slot_type::operator(), &m_slot_exit);
++  m_bindings[KEY_RIGHT] = m_bindings['F' - '@'] = bind(&ElementFileList::receive_select, this);
+ 
+-  m_bindings[' '] = std::tr1::bind(&ElementFileList::receive_priority, this);
+-  m_bindings['*'] = std::tr1::bind(&ElementFileList::receive_change_all, this);
+-  m_bindings['/'] = std::tr1::bind(&ElementFileList::receive_collapse, this);
+-  m_bindings[KEY_NPAGE] = std::tr1::bind(&ElementFileList::receive_pagenext, this);
+-  m_bindings[KEY_PPAGE] = std::tr1::bind(&ElementFileList::receive_pageprev, this);
++  m_bindings[' '] = bind(&ElementFileList::receive_priority, this);
++  m_bindings['*'] = bind(&ElementFileList::receive_change_all, this);
++  m_bindings['/'] = bind(&ElementFileList::receive_collapse, this);
++  m_bindings[KEY_NPAGE] = bind(&ElementFileList::receive_pagenext, this);
++  m_bindings[KEY_PPAGE] = bind(&ElementFileList::receive_pageprev, this);
+ 
+-  m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = std::tr1::bind(&ElementFileList::receive_next, this);
+-  m_bindings[KEY_UP]   = m_bindings['P' - '@'] = std::tr1::bind(&ElementFileList::receive_prev, this);
++  m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = bind(&ElementFileList::receive_next, this);
++  m_bindings[KEY_UP]   = m_bindings['P' - '@'] = bind(&ElementFileList::receive_prev, this);
+ }
+ 
+ inline ElementText*
+@@ -117,7 +129,7 @@ ElementFileList::activate(display::Frame
+   m_window->set_focused(focus);
+ 
+   m_elementInfo = element_file_list_create_info();
+-  m_elementInfo->slot_exit(std::tr1::bind(&ElementFileList::activate_display, this, DISPLAY_LIST));
++  m_elementInfo->slot_exit(bind(&ElementFileList::activate_display, this, DISPLAY_LIST));
+   m_elementInfo->set_target(rpc::make_target(&m_selected));
+ 
+   m_frame = frame;
Index: net/rtorrent/patches/patch-src_ui_element__log__complete.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_ui_element__log__complete.cc
diff -N net/rtorrent/patches/patch-src_ui_element__log__complete.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_ui_element__log__complete.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,34 @@
+$NetBSD$
+
+--- src/ui/element_log_complete.cc.orig	2015-10-09 20:15:03.000000000 +0000
++++ src/ui/element_log_complete.cc
+@@ -48,15 +48,27 @@
+ #include "control.h"
+ #include "element_log_complete.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace ui {
++  using std::bind;
++}
++#else
++#include <tr1/functional>
++namespace ui {
++  using std::tr1::bind;
++}
++#endif
++
+ namespace ui {
+ 
+ ElementLogComplete::ElementLogComplete(torrent::log_buffer* l) :
+   m_window(NULL),
+   m_log(l) {
+ 
+-  unsigned int signal_index = torrent::main_thread()->signal_bitfield()->add_signal(std::tr1::bind(&ElementLogComplete::received_update, this));
++  unsigned int signal_index = torrent::main_thread()->signal_bitfield()->add_signal(bind(&ElementLogComplete::received_update, this));
+ 
+-  m_log->lock_and_set_update_slot(std::tr1::bind(&torrent::thread_base::send_event_signal, torrent::main_thread(), signal_index, false));
++  m_log->lock_and_set_update_slot(bind(&torrent::thread_base::send_event_signal, torrent::main_thread(), signal_index, false));
+ }
+ 
+ void
Index: net/rtorrent/patches/patch-src_ui_element__menu.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_ui_element__menu.cc
diff -N net/rtorrent/patches/patch-src_ui_element__menu.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_ui_element__menu.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,39 @@
+$NetBSD$
+
+--- src/ui/element_menu.cc.orig	2015-10-09 20:04:44.000000000 +0000
++++ src/ui/element_menu.cc
+@@ -46,6 +46,18 @@
+ #include "control.h"
+ #include "element_menu.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace ui {
++  using std::bind;
++}
++#else
++#include <tr1/functional>
++namespace ui {
++  using std::tr1::bind;
++}
++#endif
++
+ namespace ui {
+ 
+ inline void
+@@ -72,11 +84,11 @@ ElementMenu::ElementMenu() :
+   m_entry(entry_invalid) {
+ 
+   // Move bindings into a function that defines default bindings.
+-  m_bindings[KEY_LEFT]  = m_bindings['B' - '@'] = std::tr1::bind(&slot_type::operator(), &m_slot_exit);
+-  m_bindings[KEY_RIGHT] = m_bindings['F' - '@'] = std::tr1::bind(&ElementMenu::entry_select, this);
++  m_bindings[KEY_LEFT]  = m_bindings['B' - '@'] = bind(&slot_type::operator(), &m_slot_exit);
++  m_bindings[KEY_RIGHT] = m_bindings['F' - '@'] = bind(&ElementMenu::entry_select, this);
+ 
+-  m_bindings[KEY_UP]   = m_bindings['P' - '@'] = std::tr1::bind(&ElementMenu::entry_prev, this);
+-  m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = std::tr1::bind(&ElementMenu::entry_next, this);
++  m_bindings[KEY_UP]   = m_bindings['P' - '@'] = bind(&ElementMenu::entry_prev, this);
++  m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = bind(&ElementMenu::entry_next, this);
+ }
+ 
+ ElementMenu::~ElementMenu() {
Index: net/rtorrent/patches/patch-src_ui_element__menu.h
===================================================================
RCS file: net/rtorrent/patches/patch-src_ui_element__menu.h
diff -N net/rtorrent/patches/patch-src_ui_element__menu.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_ui_element__menu.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,35 @@
+$NetBSD$
+
+--- src/ui/element_menu.h.orig	2015-10-09 20:04:13.000000000 +0000
++++ src/ui/element_menu.h
+@@ -41,6 +41,19 @@
+ 
+ #include "element_base.h"
+ 
++#include <ciso646>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace ui {
++  using std::function;
++}
++#else
++#include <tr1/functional>
++namespace ui {
++  using std::tr1::function;
++}
++#endif
++
+ namespace display {
+   class WindowText;
+   class TextElementStringBase;
+@@ -51,8 +64,8 @@ namespace ui {
+ struct ElementMenuEntry {
+   display::TextElementStringBase* m_element;
+ 
+-  std::tr1::function<void ()>     m_slotFocus;
+-  std::tr1::function<void ()>     m_slotSelect;
++  function<void ()>     m_slotFocus;
++  function<void ()>     m_slotSelect;
+ };
+ 
+ class ElementMenu : public ElementBase, public std::vector<ElementMenuEntry> {
Index: net/rtorrent/patches/patch-src_ui_element__peer__list.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_ui_element__peer__list.cc
diff -N net/rtorrent/patches/patch-src_ui_element__peer__list.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_ui_element__peer__list.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,59 @@
+$NetBSD$
+
+--- src/ui/element_peer_list.cc.orig	2015-10-09 20:06:31.000000000 +0000
++++ src/ui/element_peer_list.cc
+@@ -53,6 +53,20 @@
+ #include "element_peer_list.h"
+ #include "element_text.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace ui {
++  using std::bind;
++  namespace placeholders { using namespace std::placeholders; }
++}
++#else
++#include <tr1/functional>
++namespace ui {
++  using std::tr1::bind;
++  namespace placeholders { using namespace std::tr1::placeholders; }
++}
++#endif
++
+ namespace ui {
+ 
+ ElementPeerList::ElementPeerList(core::Download* d) :
+@@ -67,23 +81,23 @@ ElementPeerList::ElementPeerList(core::D
+   torrent::ConnectionList* connection_list = m_download->download()->connection_list();
+ 
+   m_peer_connected = connection_list->signal_connected().insert(connection_list->signal_connected().end(),
+-                                                                tr1::bind(&ElementPeerList::receive_peer_connected, this, tr1::placeholders::_1));
++                                                                bind(&ElementPeerList::receive_peer_connected, this, placeholders::_1));
+   m_peer_disconnected = connection_list->signal_disconnected().insert(connection_list->signal_disconnected().end(),
+-                                                                      tr1::bind(&ElementPeerList::receive_peer_disconnected, this, tr1::placeholders::_1));
++                                                                      bind(&ElementPeerList::receive_peer_disconnected, this, placeholders::_1));
+ 
+   m_windowList  = new display::WindowPeerList(m_download, &m_list, &m_listItr);
+   m_elementInfo = create_info();
+ 
+-  m_elementInfo->slot_exit(std::tr1::bind(&ElementPeerList::activate_display, this, DISPLAY_LIST));
++  m_elementInfo->slot_exit(bind(&ElementPeerList::activate_display, this, DISPLAY_LIST));
+ 
+-  m_bindings['k']       = std::tr1::bind(&ElementPeerList::receive_disconnect_peer, this);
+-  m_bindings['*']       = std::tr1::bind(&ElementPeerList::receive_snub_peer, this);
+-  m_bindings['B']       = std::tr1::bind(&ElementPeerList::receive_ban_peer, this);
+-  m_bindings[KEY_LEFT]  = m_bindings['B' - '@'] = std::tr1::bind(&slot_type::operator(), &m_slot_exit);
+-  m_bindings[KEY_RIGHT] = m_bindings['F' - '@'] = std::tr1::bind(&ElementPeerList::activate_display, this, DISPLAY_INFO);
++  m_bindings['k']       = bind(&ElementPeerList::receive_disconnect_peer, this);
++  m_bindings['*']       = bind(&ElementPeerList::receive_snub_peer, this);
++  m_bindings['B']       = bind(&ElementPeerList::receive_ban_peer, this);
++  m_bindings[KEY_LEFT]  = m_bindings['B' - '@'] = bind(&slot_type::operator(), &m_slot_exit);
++  m_bindings[KEY_RIGHT] = m_bindings['F' - '@'] = bind(&ElementPeerList::activate_display, this, DISPLAY_INFO);
+ 
+-  m_bindings[KEY_UP]   = m_bindings['P' - '@'] = std::tr1::bind(&ElementPeerList::receive_prev, this);
+-  m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = std::tr1::bind(&ElementPeerList::receive_next, this);
++  m_bindings[KEY_UP]   = m_bindings['P' - '@'] = bind(&ElementPeerList::receive_prev, this);
++  m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = bind(&ElementPeerList::receive_next, this);
+ }
+ 
+ ElementPeerList::~ElementPeerList() {
Index: net/rtorrent/patches/patch-src_ui_element__text.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_ui_element__text.cc
diff -N net/rtorrent/patches/patch-src_ui_element__text.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_ui_element__text.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,39 @@
+$NetBSD$
+
+--- src/ui/element_text.cc.orig	2015-10-09 20:17:10.000000000 +0000
++++ src/ui/element_text.cc
+@@ -46,6 +46,18 @@
+ #include "control.h"
+ #include "element_text.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace ui {
++  using std::bind;
++}
++#else
++#include <tr1/functional>
++namespace ui {
++  using std::tr1::bind;
++}
++#endif
++
+ namespace ui {
+ 
+ ElementText::ElementText(rpc::target_type target) :
+@@ -54,11 +66,11 @@ ElementText::ElementText(rpc::target_typ
+   m_columnWidth(0) {
+ 
+   // Move bindings into a function that defines default bindings.
+-  m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = std::tr1::bind(&slot_type::operator(), &m_slot_exit);
++  m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = bind(&slot_type::operator(), &m_slot_exit);
+ 
+-//   m_bindings[KEY_UP]    = std::tr1::bind(this, &ElementText::entry_prev);
+-//   m_bindings[KEY_DOWN]  = std::tr1::bind(this, &ElementText::entry_next);
+-//   m_bindings[KEY_RIGHT] = m_bindings['F' - '@'] = std::tr1::bind(this, &ElementText::entry_select);
++//   m_bindings[KEY_UP]    = bind(this, &ElementText::entry_prev);
++//   m_bindings[KEY_DOWN]  = bind(this, &ElementText::entry_next);
++//   m_bindings[KEY_RIGHT] = m_bindings['F' - '@'] = bind(this, &ElementText::entry_select);
+ }
+ 
+ ElementText::~ElementText() {
Index: net/rtorrent/patches/patch-src_ui_element__tracker__list.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_ui_element__tracker__list.cc
diff -N net/rtorrent/patches/patch-src_ui_element__tracker__list.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_ui_element__tracker__list.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,42 @@
+$NetBSD$
+
+--- src/ui/element_tracker_list.cc.orig	2015-10-09 20:07:22.000000000 +0000
++++ src/ui/element_tracker_list.cc
+@@ -47,6 +47,18 @@
+ #include "control.h"
+ #include "element_tracker_list.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace ui {
++  using std::bind;
++}
++#else
++#include <tr1/functional>
++namespace ui {
++  using std::tr1::bind;
++}
++#endif
++
+ namespace ui {
+ 
+ ElementTrackerList::ElementTrackerList(core::Download* d) :
+@@ -54,13 +66,13 @@ ElementTrackerList::ElementTrackerList(c
+   m_window(NULL),
+   m_focus(0) {
+ 
+-  m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = std::tr1::bind(&slot_type::operator(), &m_slot_exit);
++  m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = bind(&slot_type::operator(), &m_slot_exit);
+ 
+-  m_bindings[' ']      = std::tr1::bind(&ElementTrackerList::receive_cycle_group, this);
+-  m_bindings['*']      = std::tr1::bind(&ElementTrackerList::receive_disable, this);
++  m_bindings[' ']      = bind(&ElementTrackerList::receive_cycle_group, this);
++  m_bindings['*']      = bind(&ElementTrackerList::receive_disable, this);
+ 
+-  m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = std::tr1::bind(&ElementTrackerList::receive_next, this);
+-  m_bindings[KEY_UP]   = m_bindings['P' - '@'] = std::tr1::bind(&ElementTrackerList::receive_prev, this);
++  m_bindings[KEY_DOWN] = m_bindings['N' - '@'] = bind(&ElementTrackerList::receive_next, this);
++  m_bindings[KEY_UP]   = m_bindings['P' - '@'] = bind(&ElementTrackerList::receive_prev, this);
+ }
+ 
+ void
Index: net/rtorrent/patches/patch-src_ui_element__transfer__list.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_ui_element__transfer__list.cc
diff -N net/rtorrent/patches/patch-src_ui_element__transfer__list.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_ui_element__transfer__list.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,41 @@
+$NetBSD$
+
+--- src/ui/element_transfer_list.cc.orig	2015-10-09 19:56:54.000000000 +0000
++++ src/ui/element_transfer_list.cc
+@@ -45,6 +45,18 @@
+ #include "control.h"
+ #include "element_transfer_list.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace ui {
++  using std::bind;
++}
++#else
++#include <tr1/functional>
++namespace ui {
++  using std::tr1::bind;
++}
++#endif
++
+ namespace ui {
+ 
+ ElementTransferList::ElementTransferList(core::Download* d) :
+@@ -52,12 +64,12 @@ ElementTransferList::ElementTransferList
+   m_window(NULL),
+   m_focus(0) {
+ 
+-  m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = std::tr1::bind(&slot_type::operator(), &m_slot_exit);
++  m_bindings[KEY_LEFT] = m_bindings['B' - '@'] = bind(&slot_type::operator(), &m_slot_exit);
+ 
+-  m_bindings[KEY_DOWN]  = std::tr1::bind(&ElementTransferList::receive_next, this);
+-  m_bindings[KEY_UP]    = std::tr1::bind(&ElementTransferList::receive_prev, this);
+-  m_bindings[KEY_NPAGE] = std::tr1::bind(&ElementTransferList::receive_pagenext, this);
+-  m_bindings[KEY_PPAGE] = std::tr1::bind(&ElementTransferList::receive_pageprev, this);
++  m_bindings[KEY_DOWN]  = bind(&ElementTransferList::receive_next, this);
++  m_bindings[KEY_UP]    = bind(&ElementTransferList::receive_prev, this);
++  m_bindings[KEY_NPAGE] = bind(&ElementTransferList::receive_pagenext, this);
++  m_bindings[KEY_PPAGE] = bind(&ElementTransferList::receive_pageprev, this);
+ }
+ 
+ void
Index: net/rtorrent/patches/patch-src_ui_root.cc
===================================================================
RCS file: net/rtorrent/patches/patch-src_ui_root.cc
diff -N net/rtorrent/patches/patch-src_ui_root.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_ui_root.cc	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,83 @@
+$NetBSD$
+
+--- src/ui/root.cc.orig	2015-10-09 20:02:02.000000000 +0000
++++ src/ui/root.cc
+@@ -57,6 +57,18 @@
+ 
+ #include "root.h"
+ 
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace ui {
++  using std::bind;
++}
++#else
++#include <tr1/functional>
++namespace ui {
++  using std::tr1::bind;
++}
++#endif
++
+ namespace ui {
+ 
+ Root::Root() :
+@@ -140,23 +152,23 @@ Root::setup_keys() {
+ 
+   const char* keys = get_throttle_keys();
+ 
+-  m_bindings[keys[ 0]]      = std::tr1::bind(&Root::adjust_up_throttle, this, 1);
+-  m_bindings[keys[ 1]]      = std::tr1::bind(&Root::adjust_up_throttle, this, -1);
+-  m_bindings[keys[ 2]]      = std::tr1::bind(&Root::adjust_down_throttle, this, 1);
+-  m_bindings[keys[ 3]]      = std::tr1::bind(&Root::adjust_down_throttle, this, -1);
+-
+-  m_bindings[keys[ 4]]      = std::tr1::bind(&Root::adjust_up_throttle, this, 5);
+-  m_bindings[keys[ 5]]      = std::tr1::bind(&Root::adjust_up_throttle, this, -5);
+-  m_bindings[keys[ 6]]      = std::tr1::bind(&Root::adjust_down_throttle, this, 5);
+-  m_bindings[keys[ 7]]      = std::tr1::bind(&Root::adjust_down_throttle, this, -5);
+-
+-  m_bindings[keys[ 8]]      = std::tr1::bind(&Root::adjust_up_throttle, this, 50);
+-  m_bindings[keys[ 9]]      = std::tr1::bind(&Root::adjust_up_throttle, this, -50);
+-  m_bindings[keys[10]]      = std::tr1::bind(&Root::adjust_down_throttle, this, 50);
+-  m_bindings[keys[11]]      = std::tr1::bind(&Root::adjust_down_throttle, this, -50);
++  m_bindings[keys[ 0]]      = bind(&Root::adjust_up_throttle, this, 1);
++  m_bindings[keys[ 1]]      = bind(&Root::adjust_up_throttle, this, -1);
++  m_bindings[keys[ 2]]      = bind(&Root::adjust_down_throttle, this, 1);
++  m_bindings[keys[ 3]]      = bind(&Root::adjust_down_throttle, this, -1);
++
++  m_bindings[keys[ 4]]      = bind(&Root::adjust_up_throttle, this, 5);
++  m_bindings[keys[ 5]]      = bind(&Root::adjust_up_throttle, this, -5);
++  m_bindings[keys[ 6]]      = bind(&Root::adjust_down_throttle, this, 5);
++  m_bindings[keys[ 7]]      = bind(&Root::adjust_down_throttle, this, -5);
++
++  m_bindings[keys[ 8]]      = bind(&Root::adjust_up_throttle, this, 50);
++  m_bindings[keys[ 9]]      = bind(&Root::adjust_up_throttle, this, -50);
++  m_bindings[keys[10]]      = bind(&Root::adjust_down_throttle, this, 50);
++  m_bindings[keys[11]]      = bind(&Root::adjust_down_throttle, this, -50);
+ 
+-  m_bindings['\x0C']        = std::tr1::bind(&display::Manager::force_redraw, m_control->display()); // ^L
+-  m_bindings['\x11']        = std::tr1::bind(&Control::receive_normal_shutdown, m_control); // ^Q
++  m_bindings['\x0C']        = bind(&display::Manager::force_redraw, m_control->display()); // ^L
++  m_bindings['\x11']        = bind(&Control::receive_normal_shutdown, m_control); // ^Q
+ }
+ 
+ void
+@@ -234,7 +246,7 @@ Root::enable_input(const std::string& ti
+   if (m_windowInput->input() != NULL)
+     throw torrent::internal_error("Root::enable_input(...) m_windowInput->input() != NULL.");
+ 
+-  input->slot_dirty(std::tr1::bind(&WInput::mark_dirty, m_windowInput));
++  input->slot_dirty(bind(&WInput::mark_dirty, m_windowInput));
+ 
+   m_windowStatusbar->set_active(false);
+ 
+@@ -243,8 +255,8 @@ Root::enable_input(const std::string& ti
+   m_windowInput->set_title(title);
+   m_windowInput->set_focus(true);
+ 
+-  input->bindings()['\x0C'] = std::tr1::bind(&display::Manager::force_redraw, m_control->display()); // ^L
+-  input->bindings()['\x11'] = std::tr1::bind(&Control::receive_normal_shutdown, m_control); // ^Q
++  input->bindings()['\x0C'] = bind(&display::Manager::force_redraw, m_control->display()); // ^L
++  input->bindings()['\x11'] = bind(&Control::receive_normal_shutdown, m_control); // ^Q
+ 
+   control->input()->set_text_input(input);
+   control->display()->adjust_layout();
Index: net/rtorrent/patches/patch-src_utils_list__focus.h
===================================================================
RCS file: net/rtorrent/patches/patch-src_utils_list__focus.h
diff -N net/rtorrent/patches/patch-src_utils_list__focus.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ net/rtorrent/patches/patch-src_utils_list__focus.h	10 Oct 2015 11:17:30 -0000
@@ -0,0 +1,32 @@
+$NetBSD$
+
+--- src/utils/list_focus.h.orig	2015-10-09 19:29:35.000000000 +0000
++++ src/utils/list_focus.h
+@@ -37,7 +37,18 @@
+ #ifndef RTORRENT_UTILS_LIST_FOCUS_H
+ #define RTORRENT_UTILS_LIST_FOCUS_H
+ 
++#include <ciso646>
++#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
++#include <functional>
++namespace utils {
++  using std::function;
++}
++#else
+ #include <tr1/functional>
++namespace utils {
++  using std::tr1::function;
++}
++#endif
+ 
+ namespace utils {
+ 
+@@ -47,7 +58,7 @@ template <typename Base>
+ class ListFocus {
+ public:
+   typedef Base                        base_type;
+-  typedef std::tr1::function<void ()> slot_void;
++  typedef function<void ()> slot_void;
+   typedef std::list<slot_void>        signal_void;
+ 
+   typedef typename base_type::iterator               iterator;


Home | Main Index | Thread Index | Old Index