diff -Naur rtorrent-0.8.5/rak/socket_address.h rtorrent-0.8.5-haiku/rak/socket_address.h
--- rtorrent-0.8.5/rak/socket_address.h	2008-05-07 12:19:12.000000000 +0000
+++ rtorrent-0.8.5-haiku/rak/socket_address.h	2009-11-25 04:04:38.000000000 +0000
@@ -55,6 +55,8 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 
+typedef unsigned short  sa_family_t;
+
 namespace rak {
 
 class socket_address_inet;
diff -Naur rtorrent-0.8.5/src/display/canvas.cc rtorrent-0.8.5-haiku/src/display/canvas.cc
--- rtorrent-0.8.5/src/display/canvas.cc	2008-08-26 20:33:50.000000000 +0000
+++ rtorrent-0.8.5-haiku/src/display/canvas.cc	2009-11-25 04:10:37.000000000 +0000
@@ -38,7 +38,7 @@
 
 #include <unistd.h>
 #include <sys/ioctl.h>
-#include <sys/termios.h>
+#include <termios.h>
 #include <torrent/exceptions.h>
 
 #include "canvas.h"
diff -Naur rtorrent-0.8.5/src/display/window_file_list.cc rtorrent-0.8.5-haiku/src/display/window_file_list.cc
--- rtorrent-0.8.5/src/display/window_file_list.cc	2008-11-16 15:55:08.000000000 +0000
+++ rtorrent-0.8.5-haiku/src/display/window_file_list.cc	2009-11-25 17:26:03.000000000 +0000
@@ -46,6 +46,8 @@
 #include "ui/element_file_list.h"
 
 #include "window_file_list.h"
+#include <wchar.h>
+typedef std::basic_string<wchar_t> StdWString;
 
 namespace display {
 
@@ -59,7 +61,7 @@
 
 // Convert std::string to std::wstring of given width (in screen positions),
 // taking into account that some characters may be occupying two screen positions.
-std::wstring
+StdWString
 wstring_width(const std::string& i_str, int width) {
   wchar_t result[width + 1];
   size_t length = std::mbstowcs(result, i_str.c_str(), width);
diff -Naur rtorrent-0.8.5/src/input/path_input.cc rtorrent-0.8.5-haiku/src/input/path_input.cc
--- rtorrent-0.8.5/src/input/path_input.cc	2008-05-07 12:19:11.000000000 +0000
+++ rtorrent-0.8.5-haiku/src/input/path_input.cc	2009-11-25 17:27:41.000000000 +0000
@@ -42,7 +42,8 @@
 #include <rak/path.h>
 
 #include <sys/types.h>
-#include <sys/dir.h>
+#include <dirent.h>
+#include <sys/stat.h>
 
 #include "path_input.h"
 
@@ -72,7 +73,7 @@
 
 struct _transform_filename {
   void operator () (utils::directory_entry& entry) {
-    if (entry.d_type == DT_DIR)
+    if (S_ISDIR(entry.d_type))
       entry.d_name += '/';
   }
 };
diff -Naur rtorrent-0.8.5/src/signal_handler.cc rtorrent-0.8.5-haiku/src/signal_handler.cc
--- rtorrent-0.8.5/src/signal_handler.cc	2008-05-07 12:19:11.000000000 +0000
+++ rtorrent-0.8.5-haiku/src/signal_handler.cc	2009-11-25 12:17:33.000000000 +0000
@@ -107,8 +107,8 @@
     return "Timer signal";
   case SIGTERM:
     return "Termination signal";
-  case SIGBUS:
-    return "Bus error";
+//  case SIGBUS:
+//    return "Bus error";
   default:
     return "Unlisted";
   }
diff -Naur rtorrent-0.8.5/src/signal_handler.h rtorrent-0.8.5-haiku/src/signal_handler.h
--- rtorrent-0.8.5/src/signal_handler.h	2008-05-07 12:19:11.000000000 +0000
+++ rtorrent-0.8.5-haiku/src/signal_handler.h	2009-11-25 12:15:35.000000000 +0000
@@ -37,7 +37,7 @@
 #ifndef RTORRENT_SIGNAL_HANDLER_H
 #define RTORRENT_SIGNAL_HANDLER_H
 
-#include <sys/signal.h>
+#include <signal.h>
 #include <sigc++/functors/slot.h>
 
 class SignalHandler {
diff -Naur rtorrent-0.8.5/src/utils/directory.cc rtorrent-0.8.5-haiku/src/utils/directory.cc
--- rtorrent-0.8.5/src/utils/directory.cc	2008-05-07 12:19:11.000000000 +0000
+++ rtorrent-0.8.5-haiku/src/utils/directory.cc	2009-11-25 17:28:40.000000000 +0000
@@ -39,6 +39,7 @@
 #include <algorithm>
 #include <functional>
 #include <dirent.h>
+#include <sys/stat.h>
 #include <rak/path.h>
 #include <torrent/exceptions.h>
 
@@ -69,6 +70,7 @@
     return false;
 
   struct dirent* entry;
+  struct stat st;
 
   while ((entry = readdir(d)) != NULL) {
     if ((flags & update_hide_dot) && entry->d_name[0] == '.')
@@ -78,7 +80,8 @@
 
     itr->d_fileno = entry->d_fileno;
     itr->d_reclen = entry->d_reclen;
-    itr->d_type   = entry->d_type;
+    lstat(rak::path_expand(m_path).c_str(), &st);
+    itr->d_type   = st.st_mode;
 
 #ifdef DIRENT_NAMLEN_EXISTS_FOOBAR
     itr->d_name   = std::string(entry->d_name, entry->d_name + entry->d_namlen);
diff -Naur rtorrent-0.8.5/src/utils/directory.h rtorrent-0.8.5-haiku/src/utils/directory.h
--- rtorrent-0.8.5/src/utils/directory.h	2008-05-07 12:19:11.000000000 +0000
+++ rtorrent-0.8.5-haiku/src/utils/directory.h	2009-11-25 11:29:12.000000000 +0000
@@ -41,6 +41,8 @@
 #include <vector>
 #include <inttypes.h>
 
+#define d_fileno d_ino
+
 namespace utils {
 
 struct directory_entry {
