fix haiku build

This commit is contained in:
arvidn 2018-02-04 00:57:54 +00:00 committed by Arvid Norberg
parent 1baf5eabdf
commit a0a63341c7
7 changed files with 15 additions and 26 deletions

View File

@ -93,6 +93,12 @@ rule linking ( properties * )
result += <library>netkit <library>gcc ; result += <library>netkit <library>gcc ;
} }
if <target-os>haiku in $(properties)
{
result += <library>libnetwork <library>gcc ;
}
if <target-os>solaris in $(properties) if <target-os>solaris in $(properties)
{ {
result += <library>libsocket <library>libnsl ; result += <library>libsocket <library>libnsl ;
@ -589,6 +595,7 @@ lib dl : : <link>shared <name>dl ;
lib libsocket : : <use>libnsl <name>socket <link>shared <search>/usr/sfw/lib <link>shared ; lib libsocket : : <use>libnsl <name>socket <link>shared <search>/usr/sfw/lib <link>shared ;
lib libnsl : : <name>nsl <link>shared <search>/usr/sfw/lib <link>shared ; lib libnsl : : <name>nsl <link>shared <search>/usr/sfw/lib <link>shared ;
lib libnetwork : : <name>network <link>shared ;
# socket libraries on windows # socket libraries on windows
lib wsock32 : : <name>wsock32 <link>shared ; lib wsock32 : : <name>wsock32 <link>shared ;

View File

@ -49,6 +49,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <iostream> #include <iostream>
#include <atomic> #include <atomic>
#include <array> #include <array>
#include <chrono>
#if BOOST_ASIO_DYN_LINK #if BOOST_ASIO_DYN_LINK
#if BOOST_VERSION >= 104500 #if BOOST_VERSION >= 104500
@ -104,17 +105,6 @@ std::atomic<int> num_suggest(0);
// the number of requests made from suggested pieces // the number of requests made from suggested pieces
std::atomic<int> num_suggested_requests(0); std::atomic<int> num_suggested_requests(0);
void sleep_ms(int milliseconds)
{
#if defined TORRENT_WINDOWS || defined TORRENT_CYGWIN
Sleep(milliseconds);
#elif defined TORRENT_BEOS
snooze_until(system_time() + std::int64_t(milliseconds) * 1000, B_SYSTEM_TIMEBASE);
#else
usleep(milliseconds * 1000);
#endif
}
std::string leaf_path(std::string f) std::string leaf_path(std::string f)
{ {
if (f.empty()) return ""; if (f.empty()) return "";
@ -1096,7 +1086,7 @@ int main(int argc, char* argv[])
else if (test_mode == dual_test) seed = (i & 1); else if (test_mode == dual_test) seed = (i & 1);
conns.push_back(new peer_conn(ios[i % num_threads], ti.num_pieces(), ti.piece_length() / 16 / 1024 conns.push_back(new peer_conn(ios[i % num_threads], ti.num_pieces(), ti.piece_length() / 16 / 1024
, ep, (char const*)&ti.info_hash()[0], seed, churn, corrupt)); , ep, (char const*)&ti.info_hash()[0], seed, churn, corrupt));
sleep_ms(1); std::this_thread::sleep_for(std::chrono::milliseconds(1));
ios[i % num_threads].poll_one(ec); ios[i % num_threads].poll_one(ec);
if (ec) if (ec)
{ {

View File

@ -307,6 +307,7 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef TORRENT_USE_ICONV #ifndef TORRENT_USE_ICONV
#define TORRENT_USE_ICONV 0 #define TORRENT_USE_ICONV 0
#endif #endif
#define TORRENT_USE_MEMALIGN 1
// ==== GNU/Hurd === // ==== GNU/Hurd ===
#elif defined __GNU__ #elif defined __GNU__

View File

@ -35,10 +35,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/assert.hpp" // for print_backtrace #include "libtorrent/assert.hpp" // for print_backtrace
#include <cstdint> #include <cstdint>
#if defined TORRENT_BEOS #if !defined TORRENT_WINDOWS
#include <kernel/OS.h>
#include <stdlib.h> // malloc/free
#elif !defined TORRENT_WINDOWS
#include <cstdlib> // posix_memalign/free #include <cstdlib> // posix_memalign/free
#include <unistd.h> // _SC_PAGESIZE #include <unistd.h> // _SC_PAGESIZE
#endif #endif
@ -119,10 +116,6 @@ namespace libtorrent {
ret = ::memalign(std::size_t(page_size()), std::size_t(bytes)); ret = ::memalign(std::size_t(page_size()), std::size_t(bytes));
#elif defined TORRENT_WINDOWS #elif defined TORRENT_WINDOWS
ret = ::_aligned_malloc(std::size_t(bytes), std::size_t(page_size())); ret = ::_aligned_malloc(std::size_t(bytes), std::size_t(page_size()));
#elif defined TORRENT_BEOS
area_id id = create_area("", &ret, B_ANY_ADDRESS
, (bytes + page_size() - 1) & (page_size() - 1), B_NO_LOCK, B_READ_AREA | B_WRITE_AREA);
if (id < B_OK) return nullptr;
#else #else
ret = valloc(std::size_t(bytes)); ret = valloc(std::size_t(bytes));
#endif #endif
@ -188,10 +181,6 @@ namespace libtorrent {
#ifdef TORRENT_WINDOWS #ifdef TORRENT_WINDOWS
_aligned_free(block); _aligned_free(block);
#elif defined TORRENT_BEOS
area_id id = area_for(block);
if (id < B_OK) return;
delete_area(id);
#else #else
::free(block); ::free(block);
#endif // TORRENT_WINDOWS #endif // TORRENT_WINDOWS

View File

@ -1681,6 +1681,7 @@ constexpr disk_job_flags_t disk_interface::cache_hit;
{ {
TORRENT_ASSERT(r.length <= default_block_size); TORRENT_ASSERT(r.length <= default_block_size);
TORRENT_ASSERT(r.length <= 16 * 1024); TORRENT_ASSERT(r.length <= 16 * 1024);
TORRENT_ASSERT(buf != nullptr);
bool exceeded = false; bool exceeded = false;
disk_buffer_holder buffer(*this, m_disk_cache.allocate_buffer(exceeded, o, "receive buffer"), 0x4000); disk_buffer_holder buffer(*this, m_disk_cache.allocate_buffer(exceeded, o, "receive buffer"), 0x4000);

View File

@ -790,7 +790,7 @@ int _System __libsocket_sysctl(int* mib, u_int namelen, void *oldp, size_t *oldl
udp::resolver::iterator i = r.resolve(udp::resolver::query(boost::asio::ip::host_name(ec), "0"), ec); udp::resolver::iterator i = r.resolve(udp::resolver::query(boost::asio::ip::host_name(ec), "0"), ec);
if (ec) return ret; if (ec) return ret;
ip_interface iface; ip_interface iface;
for (;i != udp::resolver_iterator(); ++i) for (;i != udp::resolver::iterator(); ++i)
{ {
iface.interface_address = i->endpoint().address(); iface.interface_address = i->endpoint().address();
iface.name[0] = '\0'; iface.name[0] = '\0';
@ -815,6 +815,7 @@ int _System __libsocket_sysctl(int* mib, u_int namelen, void *oldp, size_t *oldl
{ {
std::vector<ip_route> ret; std::vector<ip_route> ret;
TORRENT_UNUSED(ios); TORRENT_UNUSED(ios);
TORRENT_UNUSED(ec);
#ifdef TORRENT_BUILD_SIMULATOR #ifdef TORRENT_BUILD_SIMULATOR

View File

@ -6233,7 +6233,7 @@ namespace aux {
template <typename Socket> template <typename Socket>
void set_tos(Socket& s, int v, error_code& ec) void set_tos(Socket& s, int v, error_code& ec)
{ {
#if TORRENT_USE_IPV6 #if TORRENT_USE_IPV6 && defined IPV6_TCLASS
if (s.local_endpoint(ec).address().is_v6()) if (s.local_endpoint(ec).address().is_v6())
s.set_option(traffic_class(char(v)), ec); s.set_option(traffic_class(char(v)), ec);
else if (!ec) else if (!ec)