summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-29 00:32:52 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-29 00:32:52 +0000
commite43eddf1a5887c4b249af3daa024c1107ce254a1 (patch)
tree994df09c627978ef3fb93a9fadebd00bebbcb31d
parenta672cb9dce10306f3b149802653dbb554b326a44 (diff)
downloadchromium_src-e43eddf1a5887c4b249af3daa024c1107ce254a1.zip
chromium_src-e43eddf1a5887c4b249af3daa024c1107ce254a1.tar.gz
chromium_src-e43eddf1a5887c4b249af3daa024c1107ce254a1.tar.bz2
Changes to base/ from a combination of FreeBSD and OpenBSD patches.
Review URL: http://codereview.chromium.org/495002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35321 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/allocator/allocator.gyp2
-rw-r--r--base/base.gypi19
-rw-r--r--base/command_line.cc2
-rw-r--r--base/command_line.h2
-rw-r--r--base/debug_util_posix.cc10
-rw-r--r--base/file_util_posix.cc9
-rw-r--r--base/file_util_unittest.cc10
-rw-r--r--base/file_version_info.h2
-rw-r--r--base/gfx/rect.cc14
-rw-r--r--base/i18n/file_util_icu.cc2
-rw-r--r--base/i18n/file_util_icu_unittest.cc2
-rw-r--r--base/i18n/icu_util.cc2
-rw-r--r--base/logging.cc9
-rw-r--r--base/logging.h2
-rw-r--r--base/message_loop.cc14
-rw-r--r--base/message_loop.h12
-rw-r--r--base/message_loop_unittest.cc2
-rw-r--r--base/mime_util.h2
-rw-r--r--base/native_library.h2
-rw-r--r--base/platform_thread_posix.cc5
-rw-r--r--base/process.h10
-rw-r--r--base/process_util_unittest.cc1
-rw-r--r--base/scoped_handle.h2
-rw-r--r--base/sys_info.h2
-rw-r--r--base/sys_info_freebsd.cc2
-rw-r--r--base/sys_info_posix.cc7
-rw-r--r--base/test/test_file_util_posix.cc9
-rw-r--r--base/test/test_suite.h8
-rw-r--r--base/third_party/nspr/prtime.cc2
29 files changed, 99 insertions, 68 deletions
diff --git a/base/allocator/allocator.gyp b/base/allocator/allocator.gyp
index fd33645..78436a7 100644
--- a/base/allocator/allocator.gyp
+++ b/base/allocator/allocator.gyp
@@ -310,7 +310,7 @@
'<(tcmalloc_dir)/src/profiler.cc',
],
}],
- ['OS=="linux"', {
+ ['OS=="linux" or OS=="freebsd"', {
'sources!': [
'<(tcmalloc_dir)/src/system-alloc.h',
'<(tcmalloc_dir)/src/windows/port.cc',
diff --git a/base/base.gypi b/base/base.gypi
index 03c04f7..9421717 100644
--- a/base/base.gypi
+++ b/base/base.gypi
@@ -377,6 +377,14 @@
},
},
],
+ [ 'OS == "linux"', {
+ 'link_settings': {
+ 'libraries': [
+ # We need rt for clock_gettime().
+ '-lrt',
+ ],
+ },
+ }],
],
'dependencies': [
'../build/util/build_util.gyp:lastchange',
@@ -386,12 +394,6 @@
'cflags': [
'-Wno-write-strings',
],
- 'link_settings': {
- 'libraries': [
- # We need rt for clock_gettime().
- '-lrt',
- ],
- },
'export_dependent_settings': [
'../build/linux/system.gyp:gtk',
],
@@ -403,6 +405,11 @@
'sources': [
'directory_watcher_stub.cc',
],
+ 'link_settings': {
+ 'libraries': [
+ '-L/usr/local/lib -lexecinfo',
+ ],
+ },
},
],
[ 'OS == "mac"', {
diff --git a/base/command_line.cc b/base/command_line.cc
index 4e3bb3a..35f839c 100644
--- a/base/command_line.cc
+++ b/base/command_line.cc
@@ -200,7 +200,7 @@ void CommandLine::Init(int argc, const char* const* argv) {
#endif
}
-#if defined(OS_LINUX) || defined(OS_FREEBSD)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
// static
void CommandLine::SetProcTitle() {
// Build a single string which consists of all the arguments separated
diff --git a/base/command_line.h b/base/command_line.h
index 37a6a4e..b49fe0f 100644
--- a/base/command_line.h
+++ b/base/command_line.h
@@ -68,7 +68,7 @@ class CommandLine {
// line, but it still must be called to set up the command line.
static void Init(int argc, const char* const* argv);
-#if defined(OS_LINUX) || defined(OS_FREEBSD)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
// Sets the current process' arguments that show in "ps" etc. to those
// in |current_process_commandline_|. Used by the zygote host so that
// renderers show up with --type=renderer.
diff --git a/base/debug_util_posix.cc b/base/debug_util_posix.cc
index 20916a0..73b756b 100644
--- a/base/debug_util_posix.cc
+++ b/base/debug_util_posix.cc
@@ -172,7 +172,15 @@ bool DebugUtil::BeingDebugged() {
return pid_index < status.size() && status[pid_index] != '0';
}
-#endif // OS_LINUX
+#elif defined(OS_FREEBSD)
+
+bool DebugUtil::BeingDebugged() {
+ // TODO(benl): can we determine this under FreeBSD?
+ NOTIMPLEMENTED();
+ return false;
+}
+
+#endif
// static
void DebugUtil::BreakDebugger() {
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
index cdf7be9..579e79a 100644
--- a/base/file_util_posix.cc
+++ b/base/file_util_posix.cc
@@ -86,8 +86,8 @@ int CountFilesCreatedAfter(const FilePath& path,
DIR* dir = opendir(path.value().c_str());
if (dir) {
#if !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_FREEBSD)
- #error Depending on the definition of struct dirent, additional space for \
- pathname may be needed
+ #error Port warning: depending on the definition of struct dirent, \
+ additional space for pathname may be needed
#endif
struct dirent ent_buf;
struct dirent* ent;
@@ -635,9 +635,10 @@ bool FileEnumerator::ReadDirectory(std::vector<DirectoryEntryInfo>* entries,
return false;
#if !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_FREEBSD)
- #error Depending on the definition of struct dirent, additional space for \
- pathname may be needed
+ #error Port warning: depending on the definition of struct dirent, \
+ additional space for pathname may be needed
#endif
+
struct dirent dent_buf;
struct dirent* dent;
while (readdir_r(dir, &dent_buf, &dent) == 0 && dent) {
diff --git a/base/file_util_unittest.cc b/base/file_util_unittest.cc
index 200c386..35233ba 100644
--- a/base/file_util_unittest.cc
+++ b/base/file_util_unittest.cc
@@ -1373,19 +1373,19 @@ TEST_F(FileUtilTest, Contains) {
EXPECT_FALSE(file_util::ContainsPath(foo, foobar));
EXPECT_FALSE(file_util::ContainsPath(foo, foo));
-// Platform-specific concerns
+ // Platform-specific concerns.
FilePath foo_caps(data_dir.Append(FILE_PATH_LITERAL("FOO")));
#if defined(OS_WIN)
EXPECT_TRUE(file_util::ContainsPath(foo,
foo_caps.Append(FILE_PATH_LITERAL("bar.txt"))));
EXPECT_TRUE(file_util::ContainsPath(foo,
FilePath(foo.value() + FILE_PATH_LITERAL("/bar.txt"))));
-#elif defined(OS_LINUX)
+#elif defined(OS_MACOSX)
+ // We can't really do this test on OS X since the case-sensitivity of the
+ // filesystem is configurable.
+#elif defined(OS_POSIX)
EXPECT_FALSE(file_util::ContainsPath(foo,
foo_caps.Append(FILE_PATH_LITERAL("bar.txt"))));
-#else
- // We can't really do this test on osx since the case-sensitivity of the
- // filesystem is configurable.
#endif
}
diff --git a/base/file_version_info.h b/base/file_version_info.h
index 7e86639..561c324 100644
--- a/base/file_version_info.h
+++ b/base/file_version_info.h
@@ -87,7 +87,7 @@ class FileVersionInfo {
explicit FileVersionInfo(NSBundle *bundle);
NSBundle *bundle_;
-#elif defined(OS_LINUX)
+#elif defined(OS_POSIX)
FileVersionInfo();
#endif
diff --git a/base/gfx/rect.cc b/base/gfx/rect.cc
index 2a35575..961fa03 100644
--- a/base/gfx/rect.cc
+++ b/base/gfx/rect.cc
@@ -8,7 +8,7 @@
#include <windows.h>
#elif defined(OS_MACOSX)
#include <CoreGraphics/CGGeometry.h>
-#elif defined(OS_LINUX)
+#elif defined(OS_POSIX)
#include <gdk/gdk.h>
#endif
@@ -76,7 +76,7 @@ Rect& Rect::operator=(const CGRect& r) {
set_height(r.size.height);
return *this;
}
-#elif defined(OS_LINUX)
+#elif defined(OS_POSIX)
Rect::Rect(const GdkRectangle& r)
: origin_(r.x, r.y) {
set_width(r.width);
@@ -128,15 +128,15 @@ RECT Rect::ToRECT() const {
r.bottom = bottom();
return r;
}
-#elif defined(OS_LINUX)
-GdkRectangle Rect::ToGdkRectangle() const {
- GdkRectangle r = {x(), y(), width(), height()};
- return r;
-}
#elif defined(OS_MACOSX)
CGRect Rect::ToCGRect() const {
return CGRectMake(x(), y(), width(), height());
}
+#elif defined(OS_POSIX)
+GdkRectangle Rect::ToGdkRectangle() const {
+ GdkRectangle r = {x(), y(), width(), height()};
+ return r;
+}
#endif
bool Rect::Contains(int point_x, int point_y) const {
diff --git a/base/i18n/file_util_icu.cc b/base/i18n/file_util_icu.cc
index 4d33e3a..f62a05e 100644
--- a/base/i18n/file_util_icu.cc
+++ b/base/i18n/file_util_icu.cc
@@ -146,7 +146,7 @@ void ReplaceIllegalCharactersInPath(FilePath::StringType* file_name,
// Windows uses UTF-16 encoding for filenames.
U16_NEXT(file_name->data(), cursor, static_cast<int>(file_name->length()),
code_point);
-#elif defined(OS_LINUX)
+#elif defined(OS_POSIX)
// Linux doesn't actually define an encoding. It basically allows anything
// except for a few special ASCII characters.
unsigned char cur_char = static_cast<unsigned char>((*file_name)[cursor++]);
diff --git a/base/i18n/file_util_icu_unittest.cc b/base/i18n/file_util_icu_unittest.cc
index b46fe55..1da8a93 100644
--- a/base/i18n/file_util_icu_unittest.cc
+++ b/base/i18n/file_util_icu_unittest.cc
@@ -35,7 +35,7 @@ class FileUtilICUTest : public PlatformTest {
FilePath test_dir_;
};
-#if defined(OS_LINUX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
// Linux disallows some evil ASCII characters, but passes all non-ASCII.
static const struct goodbad_pair {
diff --git a/base/i18n/icu_util.cc b/base/i18n/icu_util.cc
index bccc1ab..066534c 100644
--- a/base/i18n/icu_util.cc
+++ b/base/i18n/icu_util.cc
@@ -31,7 +31,7 @@
#define ICU_UTIL_DATA_IMPL ICU_UTIL_DATA_SHARED
#elif defined(OS_MACOSX)
#define ICU_UTIL_DATA_IMPL ICU_UTIL_DATA_STATIC
-#elif defined(OS_LINUX)
+#elif defined(OS_POSIX)
#define ICU_UTIL_DATA_IMPL ICU_UTIL_DATA_FILE
#endif
diff --git a/base/logging.cc b/base/logging.cc
index 706dbb1..72630fc 100644
--- a/base/logging.cc
+++ b/base/logging.cc
@@ -18,7 +18,7 @@ typedef HANDLE MutexHandle;
#include <mach/mach.h>
#include <mach/mach_time.h>
#include <mach-o/dyld.h>
-#elif defined(OS_LINUX)
+#elif defined(OS_POSIX)
#include <sys/syscall.h>
#include <time.h>
#endif
@@ -137,6 +137,9 @@ int32 CurrentThreadId() {
return mach_thread_self();
#elif defined(OS_LINUX)
return syscall(__NR_gettid);
+#elif defined(OS_FREEBSD)
+ // TODO(BSD): find a better thread ID
+ return reinterpret_cast<int64>(pthread_self());
#endif
}
@@ -145,7 +148,7 @@ uint64 TickCount() {
return GetTickCount();
#elif defined(OS_MACOSX)
return mach_absolute_time();
-#elif defined(OS_LINUX)
+#elif defined(OS_POSIX)
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
@@ -226,7 +229,7 @@ bool InitializeLogFileHandle() {
return true;
}
-#if defined(OS_LINUX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
int GetLoggingFileDescriptor() {
// No locking needed, since this is only called by the zygote server,
// which is single-threaded.
diff --git a/base/logging.h b/base/logging.h
index cac9ca3..1aa1162 100644
--- a/base/logging.h
+++ b/base/logging.h
@@ -153,7 +153,7 @@ void SetMinLogLevel(int level);
// Gets the current log level.
int GetMinLogLevel();
-#if defined(OS_LINUX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
// Get the file descriptor used for logging.
// Returns -1 if none open.
// Needed by ZygoteManager.
diff --git a/base/message_loop.cc b/base/message_loop.cc
index 9799100..314a7a0 100644
--- a/base/message_loop.cc
+++ b/base/message_loop.cc
@@ -20,7 +20,7 @@
#include "base/message_pump_libevent.h"
#include "base/third_party/valgrind/valgrind.h"
#endif
-#if defined(OS_LINUX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
#include "base/message_pump_glib.h"
#endif
@@ -99,9 +99,9 @@ MessageLoop::MessageLoop(Type type)
if (type_ == TYPE_UI) {
#if defined(OS_MACOSX)
pump_ = base::MessagePumpMac::Create();
-#elif defined(OS_LINUX)
+#else
pump_ = new base::MessagePumpForUI();
-#endif // OS_LINUX
+#endif
} else if (type_ == TYPE_IO) {
pump_ = new base::MessagePumpLibevent();
} else {
@@ -194,7 +194,7 @@ void MessageLoop::RunInternal() {
StartHistogrammer();
-#if defined(OS_WIN) || defined(OS_LINUX)
+#if !defined(OS_MACOSX)
if (state_->dispatcher && type() == TYPE_UI) {
static_cast<base::MessagePumpForUI*>(pump_.get())->
RunWithDispatcher(this, state_->dispatcher);
@@ -487,7 +487,7 @@ MessageLoop::AutoRunState::AutoRunState(MessageLoop* loop) : loop_(loop) {
// Initialize the other fields:
quit_received = false;
-#if defined(OS_WIN) || defined(OS_LINUX)
+#if !defined(OS_MACOSX)
dispatcher = NULL;
#endif
}
@@ -588,7 +588,7 @@ void MessageLoopForUI::PumpOutPendingPaintMessages() {
#endif // defined(OS_WIN)
-#if defined(OS_LINUX) || defined(OS_WIN)
+#if !defined(OS_MACOSX)
void MessageLoopForUI::AddObserver(Observer* observer) {
pump_ui()->AddObserver(observer);
}
@@ -602,7 +602,7 @@ void MessageLoopForUI::Run(Dispatcher* dispatcher) {
state_->dispatcher = dispatcher;
RunHandler();
}
-#endif // defined(OS_LINUX) || defined(OS_WIN)
+#endif // !defined(OS_MACOSX)
//------------------------------------------------------------------------------
// MessageLoopForIO
diff --git a/base/message_loop.h b/base/message_loop.h
index fe28179..0338963 100644
--- a/base/message_loop.h
+++ b/base/message_loop.h
@@ -21,10 +21,10 @@
#include "base/message_pump_win.h"
#elif defined(OS_POSIX)
#include "base/message_pump_libevent.h"
-#endif
-#if defined(OS_LINUX)
+#if !defined(OS_MACOSX)
#include "base/message_pump_glib.h"
#endif
+#endif
// A MessageLoop is used to process events for a particular thread. There is
// at most one MessageLoop instance per thread.
@@ -254,7 +254,7 @@ class MessageLoop : public base::MessagePump::Delegate {
#if defined(OS_WIN)
typedef base::MessagePumpWin::Dispatcher Dispatcher;
typedef base::MessagePumpWin::Observer Observer;
-#elif defined(OS_LINUX)
+#elif !defined(OS_MACOSX)
typedef base::MessagePumpForUI::Dispatcher Dispatcher;
typedef base::MessagePumpForUI::Observer Observer;
#endif
@@ -269,7 +269,7 @@ class MessageLoop : public base::MessagePump::Delegate {
// once it becomes idle.
bool quit_received;
-#if defined(OS_WIN) || defined(OS_LINUX)
+#if !defined(OS_MACOSX)
Dispatcher* dispatcher;
#endif
};
@@ -457,7 +457,7 @@ class MessageLoopForUI : public MessageLoop {
void PumpOutPendingPaintMessages();
#endif
-#if defined(OS_WIN) || defined(OS_LINUX)
+#if !defined(OS_MACOSX)
// Please see message_pump_win/message_pump_glib for definitions of these
// methods.
void AddObserver(Observer* observer);
@@ -469,7 +469,7 @@ class MessageLoopForUI : public MessageLoop {
base::MessagePumpForUI* pump_ui() {
return static_cast<base::MessagePumpForUI*>(pump_.get());
}
-#endif // defined(OS_WIN) || defined(OS_LINUX)
+#endif // defined(OS_MACOSX)
};
// Do not add any member variables to MessageLoopForUI! This is important b/c
diff --git a/base/message_loop_unittest.cc b/base/message_loop_unittest.cc
index 16d1c1a..74491ce 100644
--- a/base/message_loop_unittest.cc
+++ b/base/message_loop_unittest.cc
@@ -1502,4 +1502,4 @@ TEST(MessageLoopTest, FileDescriptorWatcherDoubleStop) {
close(pipefds[1]);
}
-#endif // defined(OS_LINUX)
+#endif // defined(OS_POSIX)
diff --git a/base/mime_util.h b/base/mime_util.h
index 7e1593b..58cb630 100644
--- a/base/mime_util.h
+++ b/base/mime_util.h
@@ -20,7 +20,7 @@ std::string GetFileMimeType(const FilePath& filepath);
// Get the mime type for a byte vector.
std::string GetDataMimeType(const std::string& data);
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_GTK)
// This detects the current GTK theme by calling gtk_settings_get_default().
// It should only be executed on the UI thread and must be called before
// GetMimeIcon().
diff --git a/base/native_library.h b/base/native_library.h
index dc4000b..182b3ed 100644
--- a/base/native_library.h
+++ b/base/native_library.h
@@ -44,7 +44,7 @@ struct NativeLibraryStruct {
};
};
typedef NativeLibraryStruct* NativeLibrary;
-#elif defined(OS_LINUX) || defined(OS_FREEBSD)
+#elif defined(OS_POSIX)
typedef void* NativeLibrary;
#endif // OS_*
diff --git a/base/platform_thread_posix.cc b/base/platform_thread_posix.cc
index 3789715..92a7e22 100644
--- a/base/platform_thread_posix.cc
+++ b/base/platform_thread_posix.cc
@@ -9,7 +9,7 @@
#if defined(OS_MACOSX)
#include <mach/mach.h>
-#elif defined(OS_LINUX)
+#else
#include <sys/syscall.h>
#include <unistd.h>
#endif
@@ -35,6 +35,9 @@ PlatformThreadId PlatformThread::CurrentId() {
return mach_thread_self();
#elif defined(OS_LINUX)
return syscall(__NR_gettid);
+#elif defined(OS_FREEBSD)
+ // TODO(BSD): find a better thread ID
+ return reinterpret_cast<int64>(pthread_self());
#endif
}
diff --git a/base/process.h b/base/process.h
index 53512ce..6ac29e9 100644
--- a/base/process.h
+++ b/base/process.h
@@ -29,7 +29,7 @@ typedef pid_t ProcessId;
const ProcessHandle kNullProcessHandle = 0;
#endif
-#if defined(OS_LINUX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
// saved_priority_ will be set to this to indicate that it's not holding
// a valid value. -20 to 19 are valid process priorities.
const int kUnsetProcessPriority = 256;
@@ -38,13 +38,13 @@ const int kUnsetProcessPriority = 256;
class Process {
public:
Process() : process_(kNullProcessHandle) {
-#if defined(OS_LINUX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
saved_priority_ = kUnsetProcessPriority;
#endif
}
explicit Process(ProcessHandle handle) : process_(handle) {
-#if defined(OS_LINUX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
saved_priority_ = kUnsetProcessPriority;
#endif
}
@@ -57,7 +57,7 @@ class Process {
ProcessHandle handle() const { return process_; }
void set_handle(ProcessHandle handle) {
process_ = handle;
-#if defined(OS_LINUX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
saved_priority_ = kUnsetProcessPriority;
#endif
}
@@ -93,7 +93,7 @@ class Process {
private:
ProcessHandle process_;
-#if defined(OS_LINUX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
// Holds the priority that the process was set to when it was backgrounded.
// If the process wasn't backgrounded it will be kUnsetProcessPriority.
int saved_priority_;
diff --git a/base/process_util_unittest.cc b/base/process_util_unittest.cc
index fe28502..8bbd784 100644
--- a/base/process_util_unittest.cc
+++ b/base/process_util_unittest.cc
@@ -22,6 +22,7 @@
#endif
#if defined(OS_POSIX)
#include <fcntl.h>
+#include <sys/resource.h>
#include <sys/socket.h>
#endif
#if defined(OS_WIN)
diff --git a/base/scoped_handle.h b/base/scoped_handle.h
index 913271d6..0b97ff0 100644
--- a/base/scoped_handle.h
+++ b/base/scoped_handle.h
@@ -11,7 +11,7 @@
#if defined(OS_WIN)
#include "base/scoped_handle_win.h"
-#elif defined(OS_LINUX)
+#elif defined(OS_POSIX) && !defined(OS_MACOSX)
#include "base/scoped_handle_gtk.h"
#endif
diff --git a/base/sys_info.h b/base/sys_info.h
index 7460fe0..415dc81 100644
--- a/base/sys_info.h
+++ b/base/sys_info.h
@@ -67,7 +67,7 @@ class SysInfo {
// allocate.
static size_t VMAllocationGranularity();
-#if defined(OS_LINUX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
// Returns the maximum SysV shared memory segment size.
static size_t MaxSharedMemorySize();
#endif
diff --git a/base/sys_info_freebsd.cc b/base/sys_info_freebsd.cc
index 4d375a7..66ab23b 100644
--- a/base/sys_info_freebsd.cc
+++ b/base/sys_info_freebsd.cc
@@ -4,6 +4,8 @@
#include "base/sys_info.h"
+#include <sys/sysctl.h>
+
#include "base/logging.h"
namespace base {
diff --git a/base/sys_info_posix.cc b/base/sys_info_posix.cc
index af33331..b2526ba 100644
--- a/base/sys_info_posix.cc
+++ b/base/sys_info_posix.cc
@@ -6,7 +6,9 @@
#include <errno.h>
#include <string.h>
+#include <sys/param.h>
#include <sys/statvfs.h>
+#include <sys/sysctl.h>
#include <sys/utsname.h>
#include <unistd.h>
@@ -14,11 +16,6 @@
#include <gdk/gdk.h>
#endif
-#if defined(OS_OPENBSD)
-#include <sys/param.h>
-#include <sys/sysctl.h>
-#endif
-
#include "base/basictypes.h"
#include "base/file_util.h"
#include "base/logging.h"
diff --git a/base/test/test_file_util_posix.cc b/base/test/test_file_util_posix.cc
index 8f7d69d..876e882 100644
--- a/base/test/test_file_util_posix.cc
+++ b/base/test/test_file_util_posix.cc
@@ -5,6 +5,7 @@
#include "base/test/test_file_util.h"
#include <errno.h>
+#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -100,4 +101,12 @@ bool CopyRecursiveDirNoCache(const FilePath& source_dir,
return success;
}
+#if !defined(OS_LINUX) && !defined(OS_MACOSX)
+bool EvictFileFromSystemCache(const FilePath& file) {
+ // There doesn't seem to be a POSIX way to cool the disk cache.
+ NOTIMPLEMENTED();
+ return false;
+}
+#endif
+
} // namespace file_util
diff --git a/base/test/test_suite.h b/base/test/test_suite.h
index 03cbca2..aa006fc 100644
--- a/base/test/test_suite.h
+++ b/base/test/test_suite.h
@@ -23,7 +23,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/multiprocess_func_list.h"
-#if defined(OS_LINUX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
#include <gtk/gtk.h>
#endif
@@ -55,7 +55,7 @@ class TestSuite {
base::EnableTerminationOnHeapCorruption();
CommandLine::Init(argc, argv);
testing::InitGoogleTest(&argc, argv);
-#if defined(OS_LINUX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
g_thread_init(NULL);
gtk_init_check(&argc, &argv);
#endif // defined(OS_LINUX)
@@ -212,13 +212,13 @@ class TestSuite {
icu_util::Initialize();
-#if defined(OS_LINUX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
// Trying to repeatedly initialize and cleanup NSS and NSPR may result in
// a deadlock. Such repeated initialization will happen when using test
// isolation. Prevent problems by initializing NSS here, so that the cleanup
// will be done only on process exit.
base::EnsureNSSInit();
-#endif // defined(OS_LINUX)
+#endif // defined(OS_POSIX) && !defined(OS_MACOSX)
}
virtual void Shutdown() {
diff --git a/base/third_party/nspr/prtime.cc b/base/third_party/nspr/prtime.cc
index 2407884..65f93ee 100644
--- a/base/third_party/nspr/prtime.cc
+++ b/base/third_party/nspr/prtime.cc
@@ -149,7 +149,7 @@ PR_ImplodeTime(const PRExplodedTime *exploded)
result *= kSecondsToMicroseconds;
result += exploded->tm_usec;
return result;
-#elif defined(OS_LINUX) || defined(OS_FREEBSD)
+#elif defined(OS_POSIX)
struct tm exp_tm = {0};
exp_tm.tm_sec = exploded->tm_sec;
exp_tm.tm_min = exploded->tm_min;