solaris build fixes

This commit is contained in:
Arvid Norberg 2010-05-02 22:26:43 +00:00
parent cc3c515458
commit 9fd624ecb6
3 changed files with 21 additions and 20 deletions

View File

@ -1551,8 +1551,9 @@ namespace libtorrent
} }
#endif // F_PREALLOCATE #endif // F_PREALLOCATE
int ret;
#if defined TORRENT_LINUX #if defined TORRENT_LINUX
int ret = my_fallocate(m_fd, 0, 0, s); ret = my_fallocate(m_fd, 0, 0, s);
// if we return 0, everything went fine // if we return 0, everything went fine
// the fallocate call succeeded // the fallocate call succeeded
if (ret == 0) return true; if (ret == 0) return true;

View File

@ -364,7 +364,7 @@ int start_tracker()
stop_tracker(); stop_tracker();
{ {
mutex::scoped_lock l(tracker_lock); libtorrent::mutex::scoped_lock l(tracker_lock);
tracker_initialized.clear(l); tracker_initialized.clear(l);
} }
@ -373,7 +373,7 @@ int start_tracker()
tracker_server.reset(new libtorrent::thread(boost::bind(&udp_tracker_thread, &port))); tracker_server.reset(new libtorrent::thread(boost::bind(&udp_tracker_thread, &port)));
{ {
mutex::scoped_lock l(tracker_lock); libtorrent::mutex::scoped_lock l(tracker_lock);
tracker_initialized.wait(l); tracker_initialized.wait(l);
} }
test_sleep(100); test_sleep(100);
@ -438,7 +438,7 @@ void udp_tracker_thread(int* port)
if (ec) if (ec)
{ {
fprintf(stderr, "Error opening listen UDP socket: %s\n", ec.message().c_str()); fprintf(stderr, "Error opening listen UDP socket: %s\n", ec.message().c_str());
mutex::scoped_lock l(tracker_lock); libtorrent::mutex::scoped_lock l(tracker_lock);
tracker_initialized.signal(l); tracker_initialized.signal(l);
return; return;
} }
@ -446,7 +446,7 @@ void udp_tracker_thread(int* port)
if (ec) if (ec)
{ {
fprintf(stderr, "Error binding UDP socket to port 0: %s\n", ec.message().c_str()); fprintf(stderr, "Error binding UDP socket to port 0: %s\n", ec.message().c_str());
mutex::scoped_lock l(tracker_lock); libtorrent::mutex::scoped_lock l(tracker_lock);
tracker_initialized.signal(l); tracker_initialized.signal(l);
return; return;
} }
@ -457,7 +457,7 @@ void udp_tracker_thread(int* port)
fprintf(stderr, "UDP tracker initialized on port %d\n", *port); fprintf(stderr, "UDP tracker initialized on port %d\n", *port);
{ {
mutex::scoped_lock l(tracker_lock); libtorrent::mutex::scoped_lock l(tracker_lock);
tracker_initialized.signal(l); tracker_initialized.signal(l);
} }
@ -477,7 +477,7 @@ void udp_tracker_thread(int* port)
if (ec) if (ec)
{ {
fprintf(stderr, "Error receiving on UDP socket: %s\n", ec.message().c_str()); fprintf(stderr, "Error receiving on UDP socket: %s\n", ec.message().c_str());
mutex::scoped_lock l(tracker_lock); libtorrent::mutex::scoped_lock l(tracker_lock);
tracker_initialized.signal(l); tracker_initialized.signal(l);
return; return;
} }
@ -508,7 +508,7 @@ int start_web_server(bool ssl)
stop_web_server(); stop_web_server();
{ {
mutex::scoped_lock l(web_lock); libtorrent::mutex::scoped_lock l(web_lock);
web_initialized.clear(l); web_initialized.clear(l);
} }
@ -517,7 +517,7 @@ int start_web_server(bool ssl)
web_server.reset(new libtorrent::thread(boost::bind(&web_server_thread, &port, ssl))); web_server.reset(new libtorrent::thread(boost::bind(&web_server_thread, &port, ssl)));
{ {
mutex::scoped_lock l(web_lock); libtorrent::mutex::scoped_lock l(web_lock);
web_initialized.wait(l); web_initialized.wait(l);
} }
@ -571,7 +571,7 @@ void web_server_thread(int* port, bool ssl)
if (ec) if (ec)
{ {
fprintf(stderr, "Error opening listen socket: %s\n", ec.message().c_str()); fprintf(stderr, "Error opening listen socket: %s\n", ec.message().c_str());
mutex::scoped_lock l(web_lock); libtorrent::mutex::scoped_lock l(web_lock);
web_initialized.signal(l); web_initialized.signal(l);
return; return;
} }
@ -579,7 +579,7 @@ void web_server_thread(int* port, bool ssl)
if (ec) if (ec)
{ {
fprintf(stderr, "Error setting listen socket to reuse addr: %s\n", ec.message().c_str()); fprintf(stderr, "Error setting listen socket to reuse addr: %s\n", ec.message().c_str());
mutex::scoped_lock l(web_lock); libtorrent::mutex::scoped_lock l(web_lock);
web_initialized.signal(l); web_initialized.signal(l);
return; return;
} }
@ -587,7 +587,7 @@ void web_server_thread(int* port, bool ssl)
if (ec) if (ec)
{ {
fprintf(stderr, "Error binding listen socket to port 0: %s\n", ec.message().c_str()); fprintf(stderr, "Error binding listen socket to port 0: %s\n", ec.message().c_str());
mutex::scoped_lock l(web_lock); libtorrent::mutex::scoped_lock l(web_lock);
web_initialized.signal(l); web_initialized.signal(l);
return; return;
} }
@ -596,7 +596,7 @@ void web_server_thread(int* port, bool ssl)
if (ec) if (ec)
{ {
fprintf(stderr, "Error listening on socket: %s\n", ec.message().c_str()); fprintf(stderr, "Error listening on socket: %s\n", ec.message().c_str());
mutex::scoped_lock l(web_lock); libtorrent::mutex::scoped_lock l(web_lock);
web_initialized.signal(l); web_initialized.signal(l);
return; return;
} }
@ -606,7 +606,7 @@ void web_server_thread(int* port, bool ssl)
fprintf(stderr, "web server initialized on port %d\n", *port); fprintf(stderr, "web server initialized on port %d\n", *port);
{ {
mutex::scoped_lock l(web_lock); libtorrent::mutex::scoped_lock l(web_lock);
web_initialized.signal(l); web_initialized.signal(l);
} }

View File

@ -148,7 +148,7 @@ struct test_storage : storage_interface
{ {
if (slot == 0 || slot == 5999) if (slot == 0 || slot == 5999)
{ {
mutex::scoped_lock l(m_mutex); libtorrent::mutex::scoped_lock l(m_mutex);
std::cerr << "--- starting job " << slot << " waiting for main thread ---\n" << std::endl; std::cerr << "--- starting job " << slot << " waiting for main thread ---\n" << std::endl;
m_ready = true; m_ready = true;
m_ready_condition.signal(l); m_ready_condition.signal(l);
@ -200,14 +200,14 @@ struct test_storage : storage_interface
void wait_for_ready() void wait_for_ready()
{ {
mutex::scoped_lock l(m_mutex); libtorrent::mutex::scoped_lock l(m_mutex);
while (!m_ready) while (!m_ready)
m_ready_condition.wait(l); m_ready_condition.wait(l);
} }
void start() void start()
{ {
mutex::scoped_lock l(m_mutex); libtorrent::mutex::scoped_lock l(m_mutex);
m_started = true; m_started = true;
m_condition.signal(l); m_condition.signal(l);
} }
@ -215,7 +215,7 @@ struct test_storage : storage_interface
private: private:
condition m_ready_condition; condition m_ready_condition;
condition m_condition; condition m_condition;
mutex m_mutex; libtorrent::mutex m_mutex;
bool m_started; bool m_started;
bool m_ready; bool m_ready;
@ -470,7 +470,7 @@ void run_storage_tests(boost::intrusive_ptr<torrent_info> info
boost::shared_ptr<int> dummy(new int); boost::shared_ptr<int> dummy(new int);
boost::intrusive_ptr<piece_manager> pm = new piece_manager(dummy, info boost::intrusive_ptr<piece_manager> pm = new piece_manager(dummy, info
, test_path, fp, io, default_storage_constructor, storage_mode); , test_path, fp, io, default_storage_constructor, storage_mode);
mutex lock; libtorrent::mutex lock;
error_code ec; error_code ec;
bool done = false; bool done = false;
@ -696,7 +696,7 @@ void test_check_files(std::string const& test_path
boost::shared_ptr<int> dummy(new int); boost::shared_ptr<int> dummy(new int);
boost::intrusive_ptr<piece_manager> pm = new piece_manager(dummy, info boost::intrusive_ptr<piece_manager> pm = new piece_manager(dummy, info
, test_path, fp, io, default_storage_constructor, storage_mode); , test_path, fp, io, default_storage_constructor, storage_mode);
mutex lock; libtorrent::mutex lock;
bool done = false; bool done = false;
lazy_entry frd; lazy_entry frd;