diff options
Diffstat (limited to 'ipc/chromium/src/base')
-rw-r--r-- | ipc/chromium/src/base/message_loop.cc | 4 | ||||
-rw-r--r-- | ipc/chromium/src/base/message_pump_glib.cc | 19 | ||||
-rw-r--r-- | ipc/chromium/src/base/message_pump_libevent.cc | 3 | ||||
-rw-r--r-- | ipc/chromium/src/base/platform_thread.h | 2 | ||||
-rw-r--r-- | ipc/chromium/src/base/platform_thread_posix.cc | 4 | ||||
-rw-r--r-- | ipc/chromium/src/base/process_util.h | 2 | ||||
-rw-r--r-- | ipc/chromium/src/base/process_util_posix.cc | 4 | ||||
-rw-r--r-- | ipc/chromium/src/base/sys_info_posix.cc | 8 | ||||
-rw-r--r-- | ipc/chromium/src/base/time.h | 7 | ||||
-rw-r--r-- | ipc/chromium/src/base/time_posix.cc | 29 |
10 files changed, 72 insertions, 10 deletions
diff --git a/ipc/chromium/src/base/message_loop.cc b/ipc/chromium/src/base/message_loop.cc index 3c794b276..638018feb 100644 --- a/ipc/chromium/src/base/message_loop.cc +++ b/ipc/chromium/src/base/message_loop.cc @@ -21,7 +21,7 @@ #if defined(OS_POSIX) #include "base/message_pump_libevent.h" #endif -#if defined(OS_LINUX) || defined(OS_BSD) +#if defined(OS_LINUX) || defined(OS_BSD) || defined (OS_SOLARIS) #if defined(MOZ_WIDGET_GTK) #include "base/message_pump_glib.h" #endif @@ -149,7 +149,7 @@ MessageLoop::MessageLoop(Type type, nsIThread* aThread) if (type_ == TYPE_UI) { #if defined(OS_MACOSX) pump_ = base::MessagePumpMac::Create(); -#elif defined(OS_LINUX) || defined(OS_BSD) +#elif defined(OS_LINUX) || defined(OS_BSD) || defined(OS_SOLARIS) pump_ = new base::MessagePumpForUI(); #endif // OS_LINUX } else if (type_ == TYPE_IO) { diff --git a/ipc/chromium/src/base/message_pump_glib.cc b/ipc/chromium/src/base/message_pump_glib.cc index 36ebfdd69..a5e719c72 100644 --- a/ipc/chromium/src/base/message_pump_glib.cc +++ b/ipc/chromium/src/base/message_pump_glib.cc @@ -9,6 +9,9 @@ #include <fcntl.h> #include <math.h> +#if defined(OS_SOLARIS) +#include <unistd.h> +#endif #include <gtk/gtk.h> #include <glib.h> @@ -131,6 +134,12 @@ MessagePumpForUI::MessagePumpForUI() // Create our wakeup pipe, which is used to flag when work was scheduled. int fds[2]; CHECK(pipe(fds) == 0); +#if defined(OS_SOLARIS) + int flags = fcntl(fds[0], F_GETFL,0); + if (flags == -1) + flags = 0; + fntl(fds[0], F_SETFL, flags | O_NDELAY); +#endif wakeup_pipe_read_ = fds[0]; wakeup_pipe_write_ = fds[1]; wakeup_gpollfd_->fd = wakeup_pipe_read_; @@ -238,11 +247,15 @@ bool MessagePumpForUI::HandleCheck() { // whether there was data, so this read shouldn't block. if (wakeup_gpollfd_->revents & G_IO_IN) { pipe_full_ = false; - +#ifndef OS_SOLARIS char msg; if (HANDLE_EINTR(read(wakeup_pipe_read_, &msg, 1)) != 1 || msg != '!') { NOTREACHED() << "Error reading from the wakeup pipe."; } +#else + char buf[32]; + while (HANDLE_EINTR(read(wakeup_pipe_read_, &buf, 32))); +#endif // Since we ate the message, we need to record that we have more work, // because HandleCheck() may be called without HandleDispatch being called // afterwards. @@ -311,6 +324,10 @@ void MessagePumpForUI::ScheduleWork() { // variables as we would then need locks all over. This ensures that if // we are sleeping in a poll that we will wake up. char msg = '!'; +#if defined(OS_SOLARIS) + char buf[32]; + while (HANDLE_EINTR(read(wakeup_pipe_read_, &buf, 32))); +#endif if (HANDLE_EINTR(write(wakeup_pipe_write_, &msg, 1)) != 1) { NOTREACHED() << "Could not write to the UI message loop wakeup pipe!"; } diff --git a/ipc/chromium/src/base/message_pump_libevent.cc b/ipc/chromium/src/base/message_pump_libevent.cc index 3cca238c1..daba7c2fe 100644 --- a/ipc/chromium/src/base/message_pump_libevent.cc +++ b/ipc/chromium/src/base/message_pump_libevent.cc @@ -8,6 +8,9 @@ #include <errno.h> #include <fcntl.h> +#if defined(OS_SOLARIS) +#include <sys/stat.h> +#endif #if defined(ANDROID) || defined(OS_POSIX) #include <unistd.h> #endif diff --git a/ipc/chromium/src/base/platform_thread.h b/ipc/chromium/src/base/platform_thread.h index 727a13a84..3432128a6 100644 --- a/ipc/chromium/src/base/platform_thread.h +++ b/ipc/chromium/src/base/platform_thread.h @@ -24,7 +24,7 @@ typedef void* PlatformThreadHandle; // HANDLE #elif defined(OS_POSIX) #include <pthread.h> typedef pthread_t PlatformThreadHandle; -#if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(__GLIBC__) +#if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_SOLARIS) || defined(__GLIBC__) #include <unistd.h> typedef pid_t PlatformThreadId; #elif defined(OS_BSD) diff --git a/ipc/chromium/src/base/platform_thread_posix.cc b/ipc/chromium/src/base/platform_thread_posix.cc index 4acd95f23..fdb2d9200 100644 --- a/ipc/chromium/src/base/platform_thread_posix.cc +++ b/ipc/chromium/src/base/platform_thread_posix.cc @@ -49,7 +49,7 @@ PlatformThreadId PlatformThread::CurrentId() { return port; #elif defined(OS_LINUX) return syscall(__NR_gettid); -#elif defined(OS_OPENBSD) || defined(__GLIBC__) +#elif defined(OS_OPENBSD) || defined(OS_SOLARIS) || defined(__GLIBC__) return (intptr_t) (pthread_self()); #elif defined(OS_NETBSD) return _lwp_self(); @@ -103,6 +103,8 @@ void PlatformThread::SetName(const char* name) { pthread_setname_np(pthread_self(), "%s", (void *)name); #elif defined(OS_BSD) && !defined(__GLIBC__) pthread_set_name_np(pthread_self(), name); +#elif defined(OS_SOLARIS) + pthread_setname_np(pthread_self(), name); #else #endif } diff --git a/ipc/chromium/src/base/process_util.h b/ipc/chromium/src/base/process_util.h index 4df1f29fb..2b257b587 100644 --- a/ipc/chromium/src/base/process_util.h +++ b/ipc/chromium/src/base/process_util.h @@ -19,7 +19,7 @@ #ifndef STDOUT_FILENO #define STDOUT_FILENO 1 #endif -#elif defined(OS_LINUX) || defined(__GLIBC__) +#elif defined(OS_LINUX) || defined(OS_SOLARIS) || defined(__GLIBC__) #include <dirent.h> #include <limits.h> #include <sys/types.h> diff --git a/ipc/chromium/src/base/process_util_posix.cc b/ipc/chromium/src/base/process_util_posix.cc index ade3ebe5e..3eb952a32 100644 --- a/ipc/chromium/src/base/process_util_posix.cc +++ b/ipc/chromium/src/base/process_util_posix.cc @@ -117,7 +117,7 @@ void CloseSuperfluousFds(const base::InjectiveMultimap& saved_mapping) { #if defined(ANDROID) static const rlim_t kSystemDefaultMaxFds = 1024; static const char kFDDir[] = "/proc/self/fd"; -#elif defined(OS_LINUX) +#elif defined(OS_LINUX) || defined(OS_SOLARIS) static const rlim_t kSystemDefaultMaxFds = 8192; static const char kFDDir[] = "/proc/self/fd"; #elif defined(OS_MACOSX) @@ -209,7 +209,7 @@ void CloseSuperfluousFds(const base::InjectiveMultimap& saved_mapping) { // TODO(agl): Remove this function. It's fundamentally broken for multithreaded // apps. void SetAllFDsToCloseOnExec() { -#if defined(OS_LINUX) +#if defined(OS_LINUX) || defined(OS_SOLARIS) const char fd_dir[] = "/proc/self/fd"; #elif defined(OS_MACOSX) || defined(OS_BSD) const char fd_dir[] = "/dev/fd"; diff --git a/ipc/chromium/src/base/sys_info_posix.cc b/ipc/chromium/src/base/sys_info_posix.cc index 81ec78053..1b88883eb 100644 --- a/ipc/chromium/src/base/sys_info_posix.cc +++ b/ipc/chromium/src/base/sys_info_posix.cc @@ -121,7 +121,11 @@ std::wstring SysInfo::GetEnvVar(const wchar_t* var) { // static std::string SysInfo::OperatingSystemName() { +#if !defined(XP_SOLARIS) utsname info; +#else + struct utsname info; +#endif if (uname(&info) < 0) { NOTREACHED(); return ""; @@ -131,7 +135,11 @@ std::string SysInfo::OperatingSystemName() { // static std::string SysInfo::CPUArchitecture() { +#if !defined(XP_SOLARIS) utsname info; +#else + struct utsname info; +#endif if (uname(&info) < 0) { NOTREACHED(); return ""; diff --git a/ipc/chromium/src/base/time.h b/ipc/chromium/src/base/time.h index 55bc7b451..6a5c92d14 100644 --- a/ipc/chromium/src/base/time.h +++ b/ipc/chromium/src/base/time.h @@ -64,6 +64,10 @@ class TimeDelta { return delta_; } +#if defined(OS_SOLARIS) + struct timespec ToTimeSpec() const; +#endif + // Returns the time delta in some unit. The F versions return a floating // point value, the "regular" versions return a rounded-down value. int InDays() const; @@ -226,6 +230,9 @@ class Time { static Time FromDoubleT(double dt); double ToDoubleT() const; +#if defined(OS_SOLARIS) + struct timeval ToTimeVal() const; +#endif #if defined(OS_WIN) static Time FromFileTime(FILETIME ft); diff --git a/ipc/chromium/src/base/time_posix.cc b/ipc/chromium/src/base/time_posix.cc index 2eb76a989..419cc8afb 100644 --- a/ipc/chromium/src/base/time_posix.cc +++ b/ipc/chromium/src/base/time_posix.cc @@ -67,11 +67,13 @@ Time Time::FromExploded(bool is_local, const Exploded& exploded) { timestruct.tm_wday = exploded.day_of_week; // mktime/timegm ignore this timestruct.tm_yday = 0; // mktime/timegm ignore this timestruct.tm_isdst = -1; // attempt to figure it out +#ifndef OS_SOLARIS timestruct.tm_gmtoff = 0; // not a POSIX field, so mktime/timegm ignore timestruct.tm_zone = NULL; // not a POSIX field, so mktime/timegm ignore +#endif time_t seconds; -#ifdef ANDROID +#if defined(ANDROID) || defined(OS_SOLARIS) seconds = mktime(×truct); #else if (is_local) @@ -175,7 +177,7 @@ TimeTicks TimeTicks::Now() { // With numer and denom = 1 (the expected case), the 64-bit absolute time // reported in nanoseconds is enough to last nearly 585 years. -#elif defined(OS_OPENBSD) || defined(OS_POSIX) && \ +#elif defined(OS_OPENBSD) || defined(OS_SOLARIS) || defined(OS_POSIX) && \ defined(_POSIX_MONOTONIC_CLOCK) && _POSIX_MONOTONIC_CLOCK >= 0 struct timespec ts; @@ -200,4 +202,27 @@ TimeTicks TimeTicks::HighResNow() { return Now(); } +#if defined(OS_SOLARIS) +struct timespec TimeDelta::ToTimeSpec() const { + int64_t microseconds = InMicroseconds(); + time_t seconds = 0; + if (microseconds >= Time::kMicrosecondsPerSecond) { + seconds = InSeconds(); + microseconds -= seconds * Time::kMicrosecondsPerSecond; + } + struct timespec result = + {seconds, + microseconds * Time::kNanosecondsPerMicrosecond}; + return result; +} + +struct timeval Time::ToTimeVal() const { + struct timeval result; + int64_t us = us_ - kTimeTToMicrosecondsOffset; + result.tv_sec = us / Time::kMicrosecondsPerSecond; + result.tv_usec = us % Time::kMicrosecondsPerSecond; + return result; +} +#endif + } // namespace base |