mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-08 03:02:30 +00:00
Solaris compatibility fixes.
This commit is contained in:
@@ -36,10 +36,11 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <ncurses.h>
|
||||
|
||||
#include "input_event.h"
|
||||
|
||||
//ncurses.h must be included last since sys/mman.h on Solaris munges ERR.
|
||||
#include <ncurses.h>
|
||||
|
||||
namespace input {
|
||||
|
||||
void
|
||||
|
||||
+11
-1
@@ -42,7 +42,13 @@
|
||||
#include <rak/path.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/dir.h>
|
||||
|
||||
#ifdef __sun__
|
||||
#include <dirent.h>
|
||||
#include <sys/stat.h>
|
||||
#else
|
||||
#include <sys/dir.h>
|
||||
#endif
|
||||
|
||||
#include "path_input.h"
|
||||
|
||||
@@ -72,7 +78,11 @@ PathInput::pressed(int key) {
|
||||
|
||||
struct _transform_filename {
|
||||
void operator () (utils::directory_entry& entry) {
|
||||
#ifdef __sun__
|
||||
if (entry.d_type & S_IFDIR)
|
||||
#else
|
||||
if (entry.d_type == DT_DIR)
|
||||
#endif
|
||||
entry.d_name += '/';
|
||||
}
|
||||
};
|
||||
|
||||
@@ -88,7 +88,12 @@ SCgi::open_named(const std::string& filename) {
|
||||
char buffer[sizeof(sockaddr_un) + filename.size()];
|
||||
sockaddr_un* sa = reinterpret_cast<sockaddr_un*>(buffer);
|
||||
|
||||
#ifdef __sun__
|
||||
sa->sun_family = AF_UNIX;
|
||||
#else
|
||||
sa->sun_family = AF_LOCAL;
|
||||
#endif
|
||||
|
||||
std::memcpy(sa->sun_path, filename.c_str(), filename.size() + 1);
|
||||
|
||||
if (!get_fd().open_local())
|
||||
|
||||
@@ -41,6 +41,11 @@
|
||||
#include "rak/error_number.h"
|
||||
#include "signal_handler.h"
|
||||
|
||||
#ifdef __sun__
|
||||
#include <iso/signal_iso.h>
|
||||
//extern "C" void (*signal (int sig, void (*disp)(int)))(int);
|
||||
#endif
|
||||
|
||||
SignalHandler::Slot SignalHandler::m_handlers[HIGHEST_SIGNAL];
|
||||
|
||||
void
|
||||
|
||||
@@ -42,6 +42,10 @@
|
||||
#include <rak/path.h>
|
||||
#include <torrent/exceptions.h>
|
||||
|
||||
#ifdef __sun__
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#include "directory.h"
|
||||
|
||||
namespace utils {
|
||||
@@ -69,6 +73,9 @@ Directory::update(int flags) {
|
||||
return false;
|
||||
|
||||
struct dirent* entry;
|
||||
#ifdef __sun__
|
||||
struct stat s;
|
||||
#endif
|
||||
|
||||
while ((entry = readdir(d)) != NULL) {
|
||||
if ((flags & update_hide_dot) && entry->d_name[0] == '.')
|
||||
@@ -76,9 +83,16 @@ Directory::update(int flags) {
|
||||
|
||||
iterator itr = base_type::insert(end(), value_type());
|
||||
|
||||
#ifdef __sun__
|
||||
stat(entry->d_name, &s);
|
||||
itr->d_fileno = entry->d_ino;
|
||||
itr->d_reclen = 0;
|
||||
itr->d_type = s.st_mode;
|
||||
#else
|
||||
itr->d_fileno = entry->d_fileno;
|
||||
itr->d_reclen = entry->d_reclen;
|
||||
itr->d_type = entry->d_type;
|
||||
#endif
|
||||
|
||||
#ifdef DIRENT_NAMLEN_EXISTS_FOOBAR
|
||||
itr->d_name = std::string(entry->d_name, entry->d_name + entry->d_namlen);
|
||||
|
||||
@@ -49,7 +49,7 @@ struct directory_entry {
|
||||
|
||||
// The name and types should match POSIX.
|
||||
uint32_t d_fileno;
|
||||
uint32_t d_reclen;
|
||||
uint32_t d_reclen; //Not used. Messes with Solaris.
|
||||
uint8_t d_type;
|
||||
|
||||
std::string d_name;
|
||||
|
||||
Reference in New Issue
Block a user