summaryrefslogtreecommitdiffstats
path: root/ipc/chromium/src/base
diff options
context:
space:
mode:
Diffstat (limited to 'ipc/chromium/src/base')
-rw-r--r--ipc/chromium/src/base/message_loop.cc4
-rw-r--r--ipc/chromium/src/base/message_pump_glib.cc19
-rw-r--r--ipc/chromium/src/base/message_pump_libevent.cc5
-rw-r--r--ipc/chromium/src/base/platform_thread.h2
-rw-r--r--ipc/chromium/src/base/platform_thread_posix.cc4
-rw-r--r--ipc/chromium/src/base/process_util.h23
-rw-r--r--ipc/chromium/src/base/process_util_linux.cc5
-rw-r--r--ipc/chromium/src/base/process_util_posix.cc4
-rw-r--r--ipc/chromium/src/base/sys_info_posix.cc12
-rw-r--r--ipc/chromium/src/base/time.h11
-rw-r--r--ipc/chromium/src/base/time_posix.cc29
11 files changed, 80 insertions, 38 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..24081bd8b 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>
+#ifdef 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);
+#ifdef OS_SOLARIS
+ int flags = fcntl(fds[0], F_GETFL,0);
+ if (flags == -1)
+ flags = 0;
+ fcntl(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 = '!';
+#ifdef 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..51d3205b8 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>
+#ifdef OS_SOLARIS
+#include <sys/stat.h>
+#endif
#if defined(ANDROID) || defined(OS_POSIX)
#include <unistd.h>
#endif
@@ -21,7 +24,7 @@
#include "mozilla/UniquePtr.h"
// This macro checks that the _EVENT_SIZEOF_* constants defined in
-// ipc/chromiume/src/third_party/<platform>/event2/event-config.h are correct.
+// ipc/chromium/src/third_party/<platform>/event2/event-config.h are correct.
#if defined(_EVENT_SIZEOF_SHORT)
#define CHECK_EVENT_SIZEOF(TYPE, type) \
static_assert(_EVENT_SIZEOF_##TYPE == sizeof(type), \
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..4bb125681 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>
@@ -39,26 +39,7 @@
#include "base/command_line.h"
#include "base/process.h"
-#if defined(OS_WIN)
-typedef PROCESSENTRY32 ProcessEntry;
-typedef IO_COUNTERS IoCounters;
-#elif defined(OS_POSIX)
-// TODO(port): we should not rely on a Win32 structure.
-struct ProcessEntry {
- int pid;
- int ppid;
- char szExeFile[NAME_MAX + 1];
-};
-
-struct IoCounters {
- unsigned long long ReadOperationCount;
- unsigned long long WriteOperationCount;
- unsigned long long OtherOperationCount;
- unsigned long long ReadTransferCount;
- unsigned long long WriteTransferCount;
- unsigned long long OtherTransferCount;
-};
-
+#if defined(OS_POSIX)
#include "base/file_descriptor_shuffle.h"
#endif
diff --git a/ipc/chromium/src/base/process_util_linux.cc b/ipc/chromium/src/base/process_util_linux.cc
index 57388ccb0..a0d5ae816 100644
--- a/ipc/chromium/src/base/process_util_linux.cc
+++ b/ipc/chromium/src/base/process_util_linux.cc
@@ -34,11 +34,6 @@
namespace {
-enum ParsingState {
- KEY_NAME,
- KEY_VALUE
-};
-
static mozilla::EnvironmentLog gProcessLog("MOZ_PROCESS_LOG");
} // namespace
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..632aa2f37 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() {
+#ifndef XP_SOLARIS)
utsname info;
+#else
+ struct utsname info;
+#endif
if (uname(&info) < 0) {
NOTREACHED();
return "";
@@ -129,9 +133,17 @@ std::string SysInfo::OperatingSystemName() {
return std::string(info.sysname);
}
+// Solaris <sys/utsname.h> contains "extern struct utsname utsname;"
+// As a consequence, any use of utsname has to be preceded with struct on
+// Solaris. See Mozilla bugs 758483 and 1353332.
+
// static
std::string SysInfo::CPUArchitecture() {
+#ifndef 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..cee463579 100644
--- a/ipc/chromium/src/base/time.h
+++ b/ipc/chromium/src/base/time.h
@@ -28,7 +28,7 @@
#include "base/basictypes.h"
-#if defined(OS_WIN)
+#ifdef OS_WIN
// For FILETIME in FromFileTime, until it moves to a new converter class.
// See TODO(iyengar) below.
#include <windows.h>
@@ -64,6 +64,10 @@ class TimeDelta {
return delta_;
}
+#ifdef 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,8 +230,11 @@ class Time {
static Time FromDoubleT(double dt);
double ToDoubleT() const;
+#ifdef OS_SOLARIS
+ struct timeval ToTimeVal() const;
+#endif
-#if defined(OS_WIN)
+#ifdef OS_WIN
static Time FromFileTime(FILETIME ft);
FILETIME ToFileTime() const;
#endif
diff --git a/ipc/chromium/src/base/time_posix.cc b/ipc/chromium/src/base/time_posix.cc
index 2eb76a989..5e0a922d9 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(&timestruct);
#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();
}
+#ifdef 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