summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorpvalchev@google.com <pvalchev@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-10 07:46:43 +0000
committerpvalchev@google.com <pvalchev@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-10 07:46:43 +0000
commit66700d449400266dbfc47c35e1e360efd57e4206 (patch)
tree6b9aa8447c726540bd5a90ea495eb6d12a8b5435 /base
parent62c68bee3e9ced3ba82100d04da274a0cf669f25 (diff)
downloadchromium_src-66700d449400266dbfc47c35e1e360efd57e4206.zip
chromium_src-66700d449400266dbfc47c35e1e360efd57e4206.tar.gz
chromium_src-66700d449400266dbfc47c35e1e360efd57e4206.tar.bz2
BSD port changes for base/ (OS_POSIX/GTK instead of OS_LINUX
where applicable, missing includes, etc) Review URL: http://codereview.chromium.org/774001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41143 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/base.gypi6
-rw-r--r--base/file_util_posix.cc2
-rw-r--r--base/linux_util.cc4
-rw-r--r--base/process_posix.cc5
-rw-r--r--base/process_util.h8
-rw-r--r--base/process_util_posix.cc9
-rw-r--r--base/sys_info_openbsd.cc3
-rw-r--r--base/time_posix.cc2
8 files changed, 23 insertions, 16 deletions
diff --git a/base/base.gypi b/base/base.gypi
index b6bca90..c9d2e08 100644
--- a/base/base.gypi
+++ b/base/base.gypi
@@ -372,7 +372,7 @@
},
# Conditions that are not relevant for Win64 build
'conditions': [
- [ 'OS == "linux" or OS == "freebsd"', {
+ [ 'OS == "linux" or OS == "freebsd" or OS == "openbsd"', {
'conditions': [
[ 'chromeos==1', {
'sources/': [ ['include', '_chromeos\\.cc$'] ]
@@ -417,7 +417,7 @@
'../build/linux/system.gyp:gtk',
],
},],
- [ 'OS == "freebsd"', {
+ [ 'OS == "freebsd" or OS == "openbsd"', {
'sources!': [
'file_watcher_inotify.cc',
],
@@ -602,7 +602,7 @@
},
],
}],
- [ 'OS == "linux" or OS == "freebsd"', {
+ [ 'OS == "linux" or OS == "freebsd" or OS == "openbsd"', {
'targets': [
{
'target_name': 'symbolize',
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
index c6069e6..9ab25a3 100644
--- a/base/file_util_posix.cc
+++ b/base/file_util_posix.cc
@@ -39,7 +39,7 @@
namespace file_util {
-#if defined(OS_FREEBSD) || \
+#if defined(OS_OPENBSD) || defined(OS_FREEBSD) || \
(defined(OS_MACOSX) && \
MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
typedef struct stat stat_wrapper_t;
diff --git a/base/linux_util.cc b/base/linux_util.cc
index 8ac2e49..14c355e 100644
--- a/base/linux_util.cc
+++ b/base/linux_util.cc
@@ -201,7 +201,7 @@ FilePath GetHomeDir(EnvironmentVariableGetter* env) {
std::string GetLinuxDistro() {
#if defined(OS_CHROMEOS)
return linux_distro;
-#else // if defined(OS_LINUX)
+#elif defined(OS_LINUX)
LinuxDistroHelper* distro_state_singleton = LinuxDistroHelper::Get();
LinuxDistroState state = distro_state_singleton->State();
if (STATE_DID_NOT_CHECK == state) {
@@ -231,6 +231,8 @@ std::string GetLinuxDistro() {
// In STATE_CHECK_FINISHED, no more writing to |linux_distro|.
return linux_distro;
}
+#else
+ NOTIMPLEMENTED();
#endif
}
diff --git a/base/process_posix.cc b/base/process_posix.cc
index 29166b9..904884a 100644
--- a/base/process_posix.cc
+++ b/base/process_posix.cc
@@ -2,9 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/process.h"
+
+#include <sys/types.h>
+#include <sys/time.h>
#include <sys/resource.h>
-#include "base/process.h"
#include "base/process_util.h"
namespace base {
diff --git a/base/process_util.h b/base/process_util.h
index a368698..cf4bd01 100644
--- a/base/process_util.h
+++ b/base/process_util.h
@@ -478,16 +478,14 @@ class ProcessMetrics {
int64 last_time_;
int64 last_system_time_;
-#if defined(OS_LINUX)
- // Jiffie count at the last_time_ we updated.
- int last_cpu_;
-#endif
-
#if defined(OS_MACOSX)
// Queries the port provider if it's set.
mach_port_t TaskForPid(ProcessHandle process) const;
PortProvider* port_provider_;
+#elif defined(OS_POSIX)
+ // Jiffie count at the last_time_ we updated.
+ int last_cpu_;
#endif
DISALLOW_EVIL_CONSTRUCTORS(ProcessMetrics);
diff --git a/base/process_util_posix.cc b/base/process_util_posix.cc
index cca07dd..fdac7a2 100644
--- a/base/process_util_posix.cc
+++ b/base/process_util_posix.cc
@@ -269,7 +269,8 @@ void CloseSuperfluousFds(const base::InjectiveMultimap& saved_mapping) {
void SetAllFDsToCloseOnExec() {
#if defined(OS_LINUX)
const char fd_dir[] = "/proc/self/fd";
-#elif defined(OS_MACOSX) || defined(OS_FREEBSD) || defined(OS_SOLARIS)
+#elif defined(OS_MACOSX) || defined(OS_FREEBSD) || defined(OS_OPENBSD) || \
+ defined(OS_SOLARIS)
const char fd_dir[] = "/dev/fd";
#endif
ScopedDIR dir_closer(opendir(fd_dir));
@@ -479,10 +480,10 @@ ProcessMetrics::ProcessMetrics(ProcessHandle process,
: process_(process),
last_time_(0),
last_system_time_(0)
-#if defined(OS_LINUX)
- , last_cpu_(0)
-#elif defined(OS_MACOSX)
+#if defined(OS_MACOSX)
, port_provider_(port_provider)
+#elif defined(OS_POSIX)
+ , last_cpu_(0)
#endif
{
processor_count_ = base::SysInfo::NumberOfProcessors();
diff --git a/base/sys_info_openbsd.cc b/base/sys_info_openbsd.cc
index 5f85888..8877222 100644
--- a/base/sys_info_openbsd.cc
+++ b/base/sys_info_openbsd.cc
@@ -4,6 +4,9 @@
#include "base/sys_info.h"
+#include <sys/param.h>
+#include <sys/sysctl.h>
+
#include "base/logging.h"
namespace base {
diff --git a/base/time_posix.cc b/base/time_posix.cc
index 60771af..2490315 100644
--- a/base/time_posix.cc
+++ b/base/time_posix.cc
@@ -147,7 +147,7 @@ void Time::Explode(bool is_local, Exploded* exploded) const {
// FreeBSD 6 has CLOCK_MONOLITHIC but defines _POSIX_MONOTONIC_CLOCK to -1.
#if (defined(OS_POSIX) && \
defined(_POSIX_MONOTONIC_CLOCK) && _POSIX_MONOTONIC_CLOCK >= 0) || \
- defined(OS_FREEBSD)
+ defined(OS_FREEBSD) || defined(OS_OPENBSD)
// static
TimeTicks TimeTicks::Now() {