20829N/A MungePluginDsoPath(const string& path)
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A return ReplaceAll(path, "netscape", "netsc@pe");
20829N/A UnmungePluginDsoPath(const string& munged)
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A return ReplaceAll(munged, "netsc@pe", "netscape");
20829N/A@@ -212,7 +212,7 @@ PluginModuleChild::Init(const std::string& aPluginFilename,
20829N/A // TODO: use PluginPRLibrary here
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A (NP_PLUGINSHUTDOWN) PR_FindFunctionSymbol(mLibrary, "NP_Shutdown");
20829N/A@@ -242,9 +242,11 @@ PluginModuleChild::Init(const std::string& aPluginFilename,
20829N/A typedef void (*GObjectDisposeFn)(GObject*);
20829N/A typedef gboolean (*GtkWidgetScrollEventFn)(GtkWidget*, GdkEventScroll*);
20829N/A typedef void (*GtkPlugEmbeddedFn)(GtkPlug*);
20829N/A static GObjectDisposeFn real_gtk_plug_dispose;
20829N/A static GtkPlugEmbeddedFn real_gtk_plug_embedded;
20829N/A@@ -1714,7 +1716,7 @@ PluginModuleChild::AnswerNP_GetEntryPoints(NPError* _retval)
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A #elif defined(OS_WIN) || defined(OS_MACOSX)
20829N/A *_retval = mGetEntryPointsFunc(&mFunctions);
20829N/A@@ -1747,7 +1749,7 @@ PluginModuleChild::AnswerNP_Initialize(NativeThreadId* tid, NPError* _retval)
20829N/A SendBackUpXResources(FileDescriptor(xSocketFd, false/*don't close*/));
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A *_retval = mInitializeFunc(&sBrowserFuncs, &mFunctions);
20829N/A #elif defined(OS_WIN) || defined(OS_MACOSX)
20829N/A NP_PLUGINSHUTDOWN mShutdownFunc;
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A NP_PLUGINUNIXINIT mInitializeFunc;
20829N/A #elif defined(OS_WIN) || defined(OS_MACOSX)
20829N/A // Implement the module-level functions from NPAPI; these are
20829N/A // normally resolved directly from the DSO.
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A NPError NP_Initialize(const NPNetscapeFuncs* npnIface,
20829N/A@@ -101,6 +101,9 @@ PluginProcessParent::Launch(PRInt32 timeoutMs)
20829N/A else if (base::PROCESS_ARCH_ARM & pluginLibArchitectures & containerArchitectures) {
20829N/A selectedArchitecture = base::PROCESS_ARCH_ARM;
20829N/A+ else if (base::PROCESS_ARCH_SPARC & pluginLibArchitectures & containerArchitectures) {
20829N/A+ selectedArchitecture = base::PROCESS_ARCH_SPARC;
20829N/A@@ -49,7 +49,9 @@ FORCE_STATIC_LIB = 1
20829N/A+# NB: to stop gcc warnings about exporting template instantiation
20829N/A+OS_CXXFLAGS := $(filter-out -pedantic,$(OS_CXXFLAGS))
20829N/A@@ -132,6 +132,10 @@ Atomic64 Release_Load(volatile const Atomic64* ptr);
20829N/A #elif defined(COMPILER_GCC) && defined(ARCH_CPU_ARM_FAMILY)
20829N/A+#elif defined(COMPILER_SUNPRO) && defined(ARCH_CPU_X86_FAMILY)
20829N/A // Inline cpuid instruction. In PIC compilations, %ebx contains the address
20829N/A // of the global offset table. To avoid breaking such executables, this code
20829N/A // must preserve that register's value across cpuid instructions.
20829N/A+#if defined(__i386__) || defined (__i386)
20829N/A #define cpuid(a, b, c, d, inp) \
20829N/A : "=a" (a), "=D" (b), "=c" (c), "=d" (d) : "a" (inp))
20829N/A+#elif defined (__x86_64__) || defined(__x86_64)
20829N/A #define cpuid(a, b, c, d, inp) \
20829N/A@@ -29,18 +29,18 @@ inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
20829N/A- __asm__ __volatile__("lock; cmpxchgl %1,%2"
20829N/A+ __asm__ __volatile__("lock; cmpxchgl %1,(%2)"
20829N/A- : "q" (new_value), "m" (*ptr), "0" (old_value)
20829N/A+ : "q" (new_value), "r" (ptr), "0" (old_value)
20829N/A inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr,
20829N/A- __asm__ __volatile__("xchgl %1,%0" // The lock prefix is implicit for xchg.
20829N/A+ __asm__ __volatile__("xchgl (%1),%0" // The lock prefix is implicit for xchg.
20829N/A return new_value; // Now it's the previous value.
20829N/A@@ -48,8 +48,8 @@ inline Atomic32 NoBarrier_AtomicExchange(volatile Atomic32* ptr,
20829N/A inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr,
20829N/A- __asm__ __volatile__("lock; xaddl %0,%1"
20829N/A+ __asm__ __volatile__("lock; xaddl %0,(%1)"
20829N/A // temp now holds the old value of *ptr
20829N/A@@ -58,8 +58,8 @@ inline Atomic32 NoBarrier_AtomicIncrement(volatile Atomic32* ptr,
20829N/A inline Atomic32 Barrier_AtomicIncrement(volatile Atomic32* ptr,
20829N/A- __asm__ __volatile__("lock; xaddl %0,%1"
20829N/A+ __asm__ __volatile__("lock; xaddl %0,(%1)"
20829N/A // temp now holds the old value of *ptr
20829N/A@@ -153,18 +153,18 @@ inline Atomic64 NoBarrier_CompareAndSwap(volatile Atomic64* ptr,
20829N/A- __asm__ __volatile__("lock; cmpxchgq %1,%2"
20829N/A+ __asm__ __volatile__("lock; cmpxchgq %1,(%2)"
20829N/A- : "q" (new_value), "m" (*ptr), "0" (old_value)
20829N/A+ : "q" (new_value), "r" (ptr), "0" (old_value)
20829N/A inline Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr,
20829N/A- __asm__ __volatile__("xchgq %1,%0" // The lock prefix is implicit for xchg.
20829N/A+ __asm__ __volatile__("xchgq (%1),%0" // The lock prefix is implicit for xchg.
20829N/A return new_value; // Now it's the previous value.
20829N/A@@ -172,8 +172,8 @@ inline Atomic64 NoBarrier_AtomicExchange(volatile Atomic64* ptr,
20829N/A inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr,
20829N/A- __asm__ __volatile__("lock; xaddq %0,%1"
20829N/A+ __asm__ __volatile__("lock; xaddq %0,(%1)"
20829N/A // temp now contains the previous value of *ptr
20829N/A@@ -182,8 +182,8 @@ inline Atomic64 NoBarrier_AtomicIncrement(volatile Atomic64* ptr,
20829N/A inline Atomic64 Barrier_AtomicIncrement(volatile Atomic64* ptr,
20829N/A- __asm__ __volatile__("lock; xaddq %0,%1"
20829N/A+ __asm__ __volatile__("lock; xaddq %0,(%1)"
20829N/A // temp now contains the previous value of *ptr
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A@@ -21,11 +21,19 @@ bool PathProviderLinux(int key, FilePath* result) {
20829N/A case base::FILE_MODULE: { // TODO(evanm): is this correct?
20829N/A+ if (!(realpath(getexecname(), bin_dir) && bin_dir[0] != '[')) {
20829N/A+ NOTREACHED() << "Unable to get exec name.";
20829N/A+ int bin_dir_size = strlen(bin_dir);
20829N/A if (bin_dir_size < 0 || bin_dir_size > PATH_MAX) {
20829N/A@@ -109,9 +109,15 @@ const int64 kint64max = (( int64) GG_LONGLONG(0x7FFFFFFFFFFFFFFF));
20829N/A # define __STDC_FORMAT_MACROS 1
20829N/A@@ -155,6 +161,7 @@ const int64 kint64max = (( int64) GG_LONGLONG(0x7FFFFFFFFFFFFFFF));
20829N/A // This template function declaration is used in defining arraysize.
20829N/A // Note that the function doesn't need an implementation, as we only
20829N/A+#if !defined(COMPILER_SUNPRO) || __SUNPRO_CC >= 0x5100
20829N/A template <typename T, size_t N>
20829N/A char (&ArraySizeHelper(T (&array)[N]))[N];
20829N/A@@ -167,6 +174,7 @@ char (&ArraySizeHelper(const T (&array)[N]))[N];
20829N/A #define arraysize(array) (sizeof(ArraySizeHelper(array)))
20829N/A // ARRAYSIZE_UNSAFE performs essentially the same calculation as arraysize,
20829N/A // but can be used on anonymous types or types defined inside
20829N/A@@ -209,6 +217,9 @@ char (&ArraySizeHelper(const T (&array)[N]))[N];
20829N/A ((sizeof(a) / sizeof(*(a))) / \
20829N/A static_cast<size_t>(!(sizeof(a) % sizeof(*(a)))))
20829N/A+#if defined(COMPILER_SUNPRO) && __SUNPRO_CC < 0x5100
20829N/A+#define arraysize(array) (ARRAYSIZE_UNSAFE(array))
20829N/A // Use implicit_cast as a safe version of static_cast or const_cast
20829N/A // for upcasting in the type hierarchy (
i.e. casting a pointer to Foo
20829N/A@@ -50,13 +50,13 @@ void Clipboard::DispatchObject(ObjectType type, const ObjectMapParams& params) {
20829N/A-#if defined(OS_WIN) || defined(OS_LINUX)
20829N/A+#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A WriteBitmap(&(params[0].front()), &(params[1].front()));
20829N/A-#endif // defined(OS_WIN) || defined(OS_LINUX)
20829N/A+#endif // defined(OS_WIN) || defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A typedef std::string FormatType;
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A typedef struct _GtkClipboard GtkClipboard;
20829N/A typedef std::map<FormatType, std::pair<char*, size_t> > TargetMap;
20829N/A@@ -179,7 +179,7 @@ class Clipboard {
20829N/A // True if we can create a window.
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A // Data is stored in the |clipboard_data_| map until it is saved to the system
20829N/A // clipboard. The Store* functions save data to the |clipboard_data_| map. The
20829N/A // SetGtkClipboard function replaces whatever is on the system clipboard with
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A@@ -81,7 +81,7 @@ class SignatureVerifier {
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A std::vector<uint8> public_key_info_;
20829N/A@@ -71,7 +73,7 @@ bool DebugUtil::BeingDebugged() {
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A // handling, so we are careful not to use the heap or have side effects.
20829N/A@@ -106,13 +108,17 @@ bool DebugUtil::BeingDebugged() {
20829N/A+#endif // OS_LINUX || OS_SOLARIS
20829N/A void DebugUtil::BreakDebugger() {
20829N/A #if defined(ARCH_CPU_X86_FAMILY)
20829N/A } while (__eintr_result__ == -1 && errno == EINTR); \
20829N/A+ } while (__eintr_result__ == -1 && errno == EINTR); \
20829N/A@@ -29,34 +27,6 @@ const FilePath::CharType kExtensionSeparator = FILE_PATH_LITERAL('.');
20829N/A-void PathComponents(const FilePath& path,
20829N/A- std::vector<FilePath::StringType>* components) {
20829N/A- FilePath::StringType::size_type start = 0;
20829N/A- FilePath::StringType::size_type end =
20829N/A- // If the path starts with a separator, add it to components.
20829N/A- components->push_back(FilePath::StringType(path_str, 0, 1));
20829N/A- while (end != FilePath::StringType::npos) {
20829N/A- FilePath::StringType component =
20829N/A- FilePath::StringType(path_str, start, end - start);
20829N/A- components->push_back(component);
20829N/A- components->push_back(FilePath::StringType(path_str, start));
20829N/A bool EndsWithSeparator(const FilePath& path) {
20829N/A@@ -79,11 +49,6 @@ bool EnsureEndsWithSeparator(FilePath* path) {
20829N/A-void TrimTrailingSeparator(std::wstring* dir) {
20829N/A- while (dir->length() > 1 && EndsWithSeparator(dir))
20829N/A- dir->resize(dir->length() - 1);
20829N/A FilePath::StringType GetFileExtensionFromPath(const FilePath& path) {
20829N/A const FilePath::StringType::size_type last_dot =
20829N/A@@ -160,21 +125,60 @@ bool ContentsEqual(const FilePath& filename1, const FilePath& filename2) {
20829N/A+bool TextContentsEqual(const FilePath& filename1, const FilePath& filename2) {
20829N/A+ // Even if both files aren't openable (and thus, in some sense, "equal"),
20829N/A+ // any unusable file yields a result of "false".
20829N/A+ // Check for mismatched EOF states, or any error state.
20829N/A+ // Trim all '\r' and '\n' characters from the end of the line.
20829N/A+ if (end1 == std::string::npos)
20829N/A+ if (end2 == std::string::npos)
20829N/A bool ReadFileToString(const FilePath& path, std::string* contents) {
20829N/A FILE* file = OpenFile(path, "rb");
20829N/A@@ -207,6 +211,14 @@ bool GetFileSize(const FilePath& file_path, int64* file_size) {
20829N/A+bool IsDot(const FilePath& path) {
20829N/A+bool IsDotDot(const FilePath& path) {
20829N/A@@ -258,6 +270,23 @@ bool ContainsPath(const FilePath &parent, const FilePath& child) {
20829N/A+int64 ComputeDirectorySize(const FilePath& root_path) {
20829N/A+ FileEnumerator file_iter(root_path, true, FileEnumerator::FILES);
20829N/A+ FileEnumerator::FindInfo info;
20829N/A ///////////////////////////////////////////////
20829N/A@@ -265,6 +294,20 @@ MemoryMappedFile::~MemoryMappedFile() {
20829N/A+bool MemoryMappedFile::Initialize(base::PlatformFile file) {
20829N/A+ if (!MapFileToMemoryInternal()) {
20829N/A bool MemoryMappedFile::Initialize(const FilePath& file_name) {
20829N/A@@ -277,6 +320,19 @@ bool MemoryMappedFile::Initialize(const FilePath& file_name) {
20829N/A+bool MemoryMappedFile::MapFileToMemory(const FilePath& file_name) {
20829N/A+ base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ,
20829N/A+ if (file_ == base::kInvalidPlatformFileValue) {
20829N/A+ return MapFileToMemoryInternal();
20829N/A bool MemoryMappedFile::IsValid() {
20829N/A@@ -294,73 +350,33 @@ bool AbsolutePath(std::wstring* path_str) {
20829N/A void AppendToPath(std::wstring* path, const std::wstring& new_ending) {
20829N/A return; // Don't crash in this function in release builds.
20829N/A+ if (!EndsWithSeparator(*path))
20829N/A path->push_back(FilePath::kSeparators[0]);
20829N/A bool CopyDirectory(const std::wstring& from_path, const std::wstring& to_path,
20829N/A return CopyDirectory(FilePath::FromWStringHack(from_path),
20829N/A FilePath::FromWStringHack(to_path),
20829N/A-bool ContentsEqual(const std::wstring& filename1,
20829N/A- const std::wstring& filename2) {
20829N/A- return ContentsEqual(FilePath::FromWStringHack(filename1),
20829N/A- FilePath::FromWStringHack(filename2));
20829N/A-bool CopyFile(const std::wstring& from_path, const std::wstring& to_path) {
20829N/A- return CopyFile(FilePath::FromWStringHack(from_path),
20829N/A- FilePath::FromWStringHack(to_path));
20829N/A-bool CreateDirectory(const std::wstring& full_path) {
20829N/A- return CreateDirectory(FilePath::FromWStringHack(full_path));
20829N/A-bool CreateNewTempDirectory(const std::wstring& prefix,
20829N/A- std::wstring* new_temp_path) {
20829N/A- FilePath::StringType dir_prefix(prefix);
20829N/A- FilePath::StringType dir_prefix = WideToUTF8(prefix);
20829N/A- if (!CreateNewTempDirectory(dir_prefix, &temp_path))
20829N/A-bool CreateTemporaryFileName(std::wstring* temp_file) {
20829N/A- if (!CreateTemporaryFileName(&temp_file_path))
20829N/A bool Delete(const std::wstring& path, bool recursive) {
20829N/A return Delete(FilePath::FromWStringHack(path), recursive);
20829N/A-bool DirectoryExists(const std::wstring& path) {
20829N/A- return DirectoryExists(FilePath::FromWStringHack(path));
20829N/A-bool EndsWithSeparator(std::wstring* path) {
20829N/A- return EndsWithSeparator(FilePath::FromWStringHack(*path));
20829N/A bool EndsWithSeparator(const std::wstring& path) {
20829N/A return EndsWithSeparator(FilePath::FromWStringHack(path));
20829N/A-bool GetCurrentDirectory(std::wstring* path_str) {
20829N/A- if (!GetCurrentDirectory(&path))
20829N/A std::wstring GetFileExtensionFromPath(const std::wstring& path) {
20829N/A FilePath::StringType extension =
20829N/A GetFileExtensionFromPath(FilePath::FromWStringHack(path));
20829N/A@@ -370,44 +386,18 @@ std::wstring GetFileExtensionFromPath(const std::wstring& path) {
20829N/A-bool GetFileInfo(const std::wstring& file_path, FileInfo* results) {
20829N/A- return GetFileInfo(FilePath::FromWStringHack(file_path), results);
20829N/A std::wstring GetFilenameFromPath(const std::wstring& path) {
20829N/A return FilePath::FromWStringHack(path).BaseName().ToWStringHack();
20829N/A-bool GetFileSize(const std::wstring& file_path, int64* file_size) {
20829N/A- return GetFileSize(FilePath::FromWStringHack(file_path), file_size);
20829N/A-bool GetTempDir(std::wstring* path_str) {
20829N/A-bool Move(const std::wstring& from_path, const std::wstring& to_path) {
20829N/A- return Move(FilePath::FromWStringHack(from_path),
20829N/A- FilePath::FromWStringHack(to_path));
20829N/A FILE* OpenFile(const std::wstring& filename, const char* mode) {
20829N/A return OpenFile(FilePath::FromWStringHack(filename), mode);
20829N/A-bool PathExists(const std::wstring& path) {
20829N/A- return PathExists(FilePath::FromWStringHack(path));
20829N/A-bool PathIsWritable(const std::wstring& path) {
20829N/A- return PathIsWritable(FilePath::FromWStringHack(path));
20829N/A int ReadFile(const std::wstring& filename, char* data, int size) {
20829N/A return ReadFile(FilePath::FromWStringHack(filename), data, size);
20829N/A-bool SetCurrentDirectory(const std::wstring& directory) {
20829N/A- return SetCurrentDirectory(FilePath::FromWStringHack(directory));
20829N/A void UpOneDirectory(std::wstring* dir) {
20829N/A FilePath path = FilePath::FromWStringHack(*dir);
20829N/A@@ -429,4 +419,15 @@ void UpOneDirectoryOrEmpty(std::wstring* dir) {
20829N/A int WriteFile(const std::wstring& filename, const char* data, int size) {
20829N/A return WriteFile(FilePath::FromWStringHack(filename), data, size);
20829N/A+///////////////////////////////////////////////
20829N/A+// Note: the main logic is in file_util_<platform>.cc
20829N/A+bool FileEnumerator::ShouldSkip(const FilePath& path) {
20829N/A+ return IsDot(path) || (IsDotDot(path) && !(INCLUDE_DOT_DOT & file_type_));
20829N/A-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
20829N/A+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
20829N/A // Use of this source code is governed by a BSD-style license that can be
20829N/A+#elif defined(ANDROID) || defined(OS_SOLARIS)
20829N/A@@ -38,99 +48,25 @@ namespace file_util {
20829N/A //-----------------------------------------------------------------------------
20829N/A // Functions that operate purely on a path string w/o touching the filesystem:
20829N/A-// Returns a vector of all of the components of the provided path.
20829N/A-void PathComponents(const FilePath& path,
20829N/A- std::vector<FilePath::StringType>* components);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-void PathComponents(const std::wstring& path,
20829N/A- std::vector<std::wstring>* components);
20829N/A // Returns true if the given path ends with a path separator character.
20829N/A bool EndsWithSeparator(const FilePath& path);
20829N/A-// These two versions are both deprecated. TODO(estade): remove them.
20829N/A-bool EndsWithSeparator(std::wstring* path);
20829N/A-bool EndsWithSeparator(const std::wstring& path);
20829N/A // Makes sure that |path| ends with a separator IFF path is a directory that
20829N/A // exists. Returns true if |path| is an existing directory, false otherwise.
20829N/A bool EnsureEndsWithSeparator(FilePath* path);
20829N/A-// Modifies a string by trimming all trailing separators from the end.
20829N/A-// Deprecated. FilePath does this automatically, and if it's constructed from a
20829N/A-// path with a trailing separator, StripTrailingSeparators() may be used.
20829N/A-void TrimTrailingSeparator(std::wstring* dir);
20829N/A-// Strips the topmost directory from the end of 'dir'. Assumes 'dir' does not
20829N/A-// If 'dir' is a root directory, return without change.
20829N/A-// Deprecated. Use FilePath::DirName instead.
20829N/A-void UpOneDirectory(std::wstring* dir);
20829N/A-// Strips the topmost directory from the end of 'dir'. Assumes 'dir' does not
20829N/A-// If 'dir' is a root directory, the result becomes empty string.
20829N/A-// Deprecated. Use FilePath::DirName instead.
20829N/A-void UpOneDirectoryOrEmpty(std::wstring* dir);
20829N/A-// Returns the filename portion of 'path', without any leading \'s or /'s.
20829N/A-// Deprecated. Use FilePath::BaseName instead.
20829N/A-std::wstring GetFilenameFromPath(const std::wstring& path);
20829N/A-// Deprecated compatibility function. Use FilePath::Extension.
20829N/A-FilePath::StringType GetFileExtensionFromPath(const FilePath& path);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-std::wstring GetFileExtensionFromPath(const std::wstring& path);
20829N/A-// Returns the directory component of a path, without the trailing
20829N/A-// path separator, or an empty string on error. The function does not
20829N/A-// check for the existence of the path, so if it is passed a directory
20829N/A-// without the trailing \, it will interpret the last component of the
20829N/A-// path as a file and chomp it. This does not support relative paths.
20829N/A-// path == "C:\Windows\system32\", returns "C:\Windows\system32"
20829N/A-// path == "C:\Windows\system32", returns "C:\Windows"
20829N/A-std::wstring GetDirectoryFromPath(const std::wstring& path);
20829N/A-// Appends new_ending to path, adding a separator between the two if necessary.
20829N/A-void AppendToPath(std::wstring* path, const std::wstring& new_ending);
20829N/A // Convert provided relative path into an absolute path. Returns false on
20829N/A // error. On POSIX, this function fails if the path does not exist.
20829N/A bool AbsolutePath(FilePath* path);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-bool AbsolutePath(std::wstring* path);
20829N/A // Returns true if |parent| contains |child|. Both paths are converted to
20829N/A // absolute paths before doing the comparison.
20829N/A bool ContainsPath(const FilePath& parent, const FilePath& child);
20829N/A-// Deprecated compatibility function. Use FilePath::InsertBeforeExtension.
20829N/A-void InsertBeforeExtension(FilePath* path, const FilePath::StringType& suffix);
20829N/A-// Deprecated compatibility function. Use FilePath::ReplaceExtension.
20829N/A-void ReplaceExtension(FilePath* file_name,
20829N/A- const FilePath::StringType& extension);
20829N/A-// Deprecated temporary compatibility functions.
20829N/A-void InsertBeforeExtension(std::wstring* path, const std::wstring& suffix);
20829N/A-void ReplaceExtension(std::wstring* file_name, const std::wstring& extension);
20829N/A-// Replaces characters in 'file_name' that are illegal for file names with
20829N/A-// 'replace_char'. 'file_name' must not be a full or relative path, but just the
20829N/A-// file name component. Any leading or trailing whitespace in 'file_name' is
20829N/A-void ReplaceIllegalCharacters(std::wstring* file_name, int replace_char);
20829N/A //-----------------------------------------------------------------------------
20829N/A // Functions that involve filesystem access or modification:
20829N/A+// Returns the number of files matching the current path that were
20829N/A // created on or after the given |file_time|. Doesn't count ".." or ".".
20829N/A // Note for POSIX environments: a file created before |file_time|
20829N/A@@ -141,6 +77,13 @@ void ReplaceIllegalCharacters(std::wstring* file_name, int replace_char);
20829N/A int CountFilesCreatedAfter(const FilePath& path,
20829N/A+// Returns the total number of bytes used by all the files under |root_path|.
20829N/A+// If the path does not exist the function returns 0.
20829N/A+// This function is implemented using the FileEnumerator class so it is not
20829N/A+// particularly speedy in any platform.
20829N/A+int64 ComputeDirectorySize(const FilePath& root_path);
20829N/A // Deletes the given path, whether it's a file or a directory.
20829N/A // If it's a directory, it's perfectly happy to delete all of the
20829N/A // directory's contents. Passing true to recursive deletes
20829N/A@@ -150,50 +93,51 @@ int CountFilesCreatedAfter(const FilePath& path,
20829N/A // WARNING: USING THIS WITH recursive==true IS EQUIVALENT
20829N/A // TO "rm -rf", SO USE WITH CAUTION.
20829N/A bool Delete(const FilePath& path, bool recursive);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-bool Delete(const std::wstring& path, bool recursive);
20829N/A+// Schedules to delete the given path, whether it's a file or a directory, until
20829N/A+// the operating system is restarted.
20829N/A+// 2) The directory to be deleted must be empty.
20829N/A+bool DeleteAfterReboot(const FilePath& path);
20829N/A // Moves the given path, whether it's a file or a directory.
20829N/A // If a simple rename is not possible, such as in the case where the paths are
20829N/A // on different volumes, this will attempt to copy and delete. Returns
20829N/A bool Move(const FilePath& from_path, const FilePath& to_path);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-bool Move(const std::wstring& from_path, const std::wstring& to_path);
20829N/A+// Renames file |from_path| to |to_path|. Both paths must be on the same
20829N/A+// volume, or the function will fail. Destination file will be created
20829N/A+// if it doesn't exist. Prefer this function over Move when dealing with
20829N/A+// temporary files. On Windows it preserves attributes of the target file.
20829N/A+bool ReplaceFile(const FilePath& from_path, const FilePath& to_path);
20829N/A // Copies a single file. Use CopyDirectory to copy directories.
20829N/A bool CopyFile(const FilePath& from_path, const FilePath& to_path);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-bool CopyFile(const std::wstring& from_path, const std::wstring& to_path);
20829N/A // Copies the given path, and optionally all subdirectories and their contents
20829N/A // If there are files existing under to_path, always overwrite.
20829N/A // Returns true if successful, false otherwise.
20829N/A-// Dont't use wildcards on the names, it may stop working without notice.
20829N/A+// Don't use wildcards on the names, it may stop working without notice.
20829N/A // If you only need to copy a file use CopyFile, it's faster.
20829N/A bool CopyDirectory(const FilePath& from_path, const FilePath& to_path,
20829N/A-// Deprecated temporary compatibility function.
20829N/A-bool CopyDirectory(const std::wstring& from_path, const std::wstring& to_path,
20829N/A // Returns true if the given path exists on the local filesystem,
20829N/A bool PathExists(const FilePath& path);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-bool PathExists(const std::wstring& path);
20829N/A // Returns true if the given path is writable by the user, false otherwise.
20829N/A bool PathIsWritable(const FilePath& path);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-bool PathIsWritable(const std::wstring& path);
20829N/A // Returns true if the given path exists and is a directory, false otherwise.
20829N/A bool DirectoryExists(const FilePath& path);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-bool DirectoryExists(const std::wstring& path);
20829N/A // Gets the creation time of the given file (expressed in the local timezone),
20829N/A@@ -211,15 +155,14 @@ bool GetFileCreationLocalTimeFromHandle(HANDLE file_handle,
20829N/A // otherwise. If either file can't be read, returns false.
20829N/A bool ContentsEqual(const FilePath& filename1,
20829N/A-// Deprecated temporary compatibility function.
20829N/A-bool ContentsEqual(const std::wstring& filename1,
20829N/A- const std::wstring& filename2);
20829N/A+// Returns true if the contents of the two text files given are equal, false
20829N/A+// otherwise. This routine treats "\r\n" and "\n" as equivalent.
20829N/A+bool TextContentsEqual(const FilePath& filename1, const FilePath& filename2);
20829N/A // Read the file at |path| into |contents|, returning true on success.
20829N/A bool ReadFileToString(const FilePath& path, std::string* contents);
20829N/A-bool ReadFileToString(const std::wstring& path, std::string* contents);
20829N/A // Read exactly |bytes| bytes from file descriptor |fd|, storing the result
20829N/A@@ -230,11 +173,10 @@ bool ReadFromFD(int fd, char* buffer, size_t bytes);
20829N/A // Resolve Windows shortcut (.LNK file)
20829N/A-// Argument path specifies a valid LNK file. On success, return true and put
20829N/A-// the URL into path. If path is a invalid .LNK file, return false.
20829N/A+// This methods tries to resolve a shortcut .LNK file. If the |path| is valid
20829N/A+// returns true and puts the target into the |path|, otherwise returns
20829N/A+// false leaving the path as it is.
20829N/A bool ResolveShortcut(FilePath* path);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-bool ResolveShortcut(std::wstring* path);
20829N/A // Create a Windows shortcut (.LNK file)
20829N/A // This method creates a shortcut link using the information given. Ensure
20829N/A@@ -243,24 +185,32 @@ bool ResolveShortcut(std::wstring* path);
20829N/A // 'source' is the existing file, 'destination' is the new link file to be
20829N/A // created; for best results pass the filename with the .lnk extension.
20829N/A // The 'icon' can specify a dll or exe in which case the icon index is the
20829N/A+// resource id. 'app_id' is the app model id for the shortcut on Win7.
20829N/A // Note that if the shortcut exists it will overwrite it.
20829N/A bool CreateShortcutLink(const wchar_t *source, const wchar_t *destination,
20829N/A const wchar_t *working_dir, const wchar_t *arguments,
20829N/A const wchar_t *description, const wchar_t *icon,
20829N/A+ int icon_index, const wchar_t* app_id);
20829N/A // Update a Windows shortcut (.LNK file). This method assumes the shortcut
20829N/A // link already exists (otherwise false is returned). Ensure you have
20829N/A // initialized COM before calling into this function. Only 'destination'
20829N/A // parameter is required, everything else can be NULL (but if everything else
20829N/A // is NULL no changes are made to the shortcut). 'destination' is the link
20829N/A-// file to be updated. For best results pass the filename with the .lnk
20829N/A+// file to be updated. 'app_id' is the app model id for the shortcut on Win7.
20829N/A+// For best results pass the filename with the .lnk extension.
20829N/A bool UpdateShortcutLink(const wchar_t *source, const wchar_t *destination,
20829N/A const wchar_t *working_dir, const wchar_t *arguments,
20829N/A const wchar_t *description, const wchar_t *icon,
20829N/A+ int icon_index, const wchar_t* app_id);
20829N/A+// Pins a shortcut to the Windows 7 taskbar. The shortcut file must already
20829N/A+// exist and be a shortcut that points to an executable.
20829N/A+bool TaskbarPinShortcutLink(const wchar_t* shortcut);
20829N/A+// Unpins a shortcut from the Windows 7 taskbar. The shortcut must exist and
20829N/A+// already be pinned to the taskbar.
20829N/A+bool TaskbarUnpinShortcutLink(const wchar_t* shortcut);
20829N/A // Return true if the given directory is empty
20829N/A bool IsDirectoryEmpty(const std::wstring& dir_path);
20829N/A@@ -275,21 +225,18 @@ bool CopyAndDeleteDirectory(const FilePath& from_path,
20829N/A // Get the temporary directory provided by the system.
20829N/A bool GetTempDir(FilePath* path);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-bool GetTempDir(std::wstring* path);
20829N/A // Get a temporary directory for shared memory files.
20829N/A // Only useful on POSIX; redirects to GetTempDir() on Windows.
20829N/A bool GetShmemTempDir(FilePath* path);
20829N/A+// Get the home directory. This is more complicated than just getenv("HOME")
20829N/A+// as it knows to fall back on getpwent() etc.
20829N/A // Creates a temporary file. The full path is placed in |path|, and the
20829N/A // function returns true if was successful in creating the file. The file will
20829N/A // be empty and all handles closed after this function returns.
20829N/A-// TODO(erikkay): rename this function and track down all of the callers.
20829N/A-// (Clarification of erik's comment: the intent is to rename the BlahFileName()
20829N/A-// calls into BlahFile(), since they create temp files (not temp filenames).)
20829N/A-bool CreateTemporaryFileName(FilePath* path);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-bool CreateTemporaryFileName(std::wstring* temp_file);
20829N/A+bool CreateTemporaryFile(FilePath* path);
20829N/A // The full path is placed in |path|, and the function returns true if
20829N/A@@ -301,9 +248,16 @@ FILE* CreateAndOpenTemporaryShmemFile(FilePath* path);
20829N/A // Similar to CreateAndOpenTemporaryFile, but the file is created in |dir|.
20829N/A FILE* CreateAndOpenTemporaryFileInDir(const FilePath& dir, FilePath* path);
20829N/A-// Same as CreateTemporaryFileName but the file is created in |dir|.
20829N/A-bool CreateTemporaryFileNameInDir(const std::wstring& dir,
20829N/A+// Same as CreateTemporaryFile but the file is created in |dir|.
20829N/A+bool CreateTemporaryFileInDir(const FilePath& dir,
20829N/A+// Create a directory within another directory.
20829N/A+// Extra characters will be appended to |name_tmpl| to ensure that the
20829N/A+// new directory does not have the same name as an existing directory.
20829N/A+bool CreateTemporaryDirInDir(const FilePath& base_dir,
20829N/A+ const FilePath::StringType& prefix,
20829N/A // Create a new directory under TempPath. If prefix is provided, the new
20829N/A // directory name is in the format of prefixyyyy.
20829N/A@@ -312,21 +266,20 @@ bool CreateTemporaryFileNameInDir(const std::wstring& dir,
20829N/A // If success, return true and output the full path of the directory created.
20829N/A bool CreateNewTempDirectory(const FilePath::StringType& prefix,
20829N/A-// Deprecated temporary compatibility function.
20829N/A-bool CreateNewTempDirectory(const std::wstring& prefix,
20829N/A // Creates a directory, as well as creating any parent directories, if they
20829N/A // don't exist. Returns 'true' on successful creation, or if the directory
20829N/A+// already exists. The directory is only readable by the current user.
20829N/A bool CreateDirectory(const FilePath& full_path);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-bool CreateDirectory(const std::wstring& full_path);
20829N/A // Returns the file size. Returns true on success.
20829N/A bool GetFileSize(const FilePath& file_path, int64* file_size);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-bool GetFileSize(const std::wstring& file_path, int64* file_size);
20829N/A+// Returns true if the given path's base name is ".".
20829N/A+bool IsDot(const FilePath& path);
20829N/A+// Returns true if the given path's base name is "..".
20829N/A+bool IsDotDot(const FilePath& path);
20829N/A // Used to hold information about a given file path. See GetFileInfo below.
20829N/A@@ -336,19 +289,25 @@ struct FileInfo {
20829N/A // True if the file corresponds to a directory.
20829N/A+ // The last modified time of a file.
20829N/A // Add additional fields here as needed.
20829N/A // Returns information about the given file path.
20829N/A bool GetFileInfo(const FilePath& file_path, FileInfo* info);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-bool GetFileInfo(const std::wstring& file_path, FileInfo* info);
20829N/A+// Set the time of the last modification. Useful for unit tests.
20829N/A+bool SetLastModifiedTime(const FilePath& file_path, base::Time last_modified);
20829N/A+// Store inode number of |path| in |inode|. Return true on success.
20829N/A+bool GetInode(const FilePath& path, ino_t* inode);
20829N/A // Wrapper for fopen-like calls. Returns non-NULL FILE* on success.
20829N/A FILE* OpenFile(const FilePath& filename, const char* mode);
20829N/A-// Deprecated temporary compatibility functions.
20829N/A-FILE* OpenFile(const std::string& filename, const char* mode);
20829N/A-FILE* OpenFile(const std::wstring& filename, const char* mode);
20829N/A // Closes file opened by OpenFile. Returns true on success.
20829N/A@@ -360,24 +319,20 @@ bool TruncateFile(FILE* file);
20829N/A // Reads the given number of bytes from the file into the buffer. Returns
20829N/A // the number of read bytes, or -1 on error.
20829N/A int ReadFile(const FilePath& filename, char* data, int size);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-int ReadFile(const std::wstring& filename, char* data, int size);
20829N/A // Writes the given buffer into the file, overwriting any data that was
20829N/A // previously there. Returns the number of bytes written, or -1 on error.
20829N/A int WriteFile(const FilePath& filename, const char* data, int size);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-int WriteFile(const std::wstring& filename, const char* data, int size);
20829N/A+// Append the data to |fd|. Does not close |fd| when done.
20829N/A+int WriteFileDescriptor(const int fd, const char* data, int size);
20829N/A // Gets the current working directory for the process.
20829N/A bool GetCurrentDirectory(FilePath* path);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-bool GetCurrentDirectory(std::wstring* path);
20829N/A // Sets the current working directory for the process.
20829N/A bool SetCurrentDirectory(const FilePath& path);
20829N/A-// Deprecated temporary compatibility function.
20829N/A-bool SetCurrentDirectory(const std::wstring& current_directory);
20829N/A // A class to handle auto-closing of FILE*'s.
20829N/A@@ -391,6 +346,20 @@ class ScopedFILEClose {
20829N/A typedef scoped_ptr_malloc<FILE, ScopedFILEClose> ScopedFILE;
20829N/A+// A class to handle auto-closing of FDs.
20829N/A+ inline void operator()(int* x) const {
20829N/A+typedef scoped_ptr_malloc<int, ScopedFDClose> ScopedFD;
20829N/A // A class for enumerating the files in a provided path. The order of the
20829N/A@@ -408,9 +377,12 @@ class FileEnumerator {
20829N/A // |root_path| is the starting directory to search for. It may or may not end
20829N/A@@ -448,11 +420,40 @@ class FileEnumerator {
20829N/A // Write the file info into |info|.
20829N/A void GetFindInfo(FindInfo* info);
20829N/A+ // Looks inside a FindInfo and determines if it's a directory.
20829N/A+ static bool IsDirectory(const FindInfo& info);
20829N/A+ static FilePath GetFilename(const FindInfo& find_info);
20829N/A+ // Returns true if the given path should be skipped in enumeration.
20829N/A+ bool ShouldSkip(const FilePath& path);
20829N/A+ // Read the filenames in source into the vector of DirectoryEntryInfo's
20829N/A+ static bool ReadDirectory(std::vector<DirectoryEntryInfo>* entries,
20829N/A+ const FilePath& source, bool show_links);
20829N/A+ // The files in the current directory
20829N/A+ std::vector<DirectoryEntryInfo> directory_entries_;
20829N/A+ // The next entry to use from the directory_entries_ vector
20829N/A+ size_t current_directory_entry_;
20829N/A- FilePath pattern_; // Empty when we want to find everything.
20829N/A+ FilePath::StringType pattern_; // Empty when we want to find everything.
20829N/A // Set to true when there is a find operation open. This way, we can lazily
20829N/A // start the operations when the caller calls Next().
20829N/A@@ -462,17 +463,7 @@ class FileEnumerator {
20829N/A // enumerate in the breadth-first search.
20829N/A std::stack<FilePath> pending_paths_;
20829N/A- DISALLOW_EVIL_CONSTRUCTORS(FileEnumerator);
20829N/A+ DISALLOW_COPY_AND_ASSIGN(FileEnumerator);
20829N/A@@ -487,6 +478,9 @@ class MemoryMappedFile {
20829N/A // the file does not exist, or the memory mapping fails, it will return false.
20829N/A // Later we may want to allow the user to specify access.
20829N/A bool Initialize(const FilePath& file_name);
20829N/A+ // As above, but works with an already-opened file. MemoryMappedFile will take
20829N/A+ // ownership of |file| and close it when done.
20829N/A+ bool Initialize(base::PlatformFile file);
20829N/A const uint8* data() const { return data_; }
20829N/A size_t length() const { return length_; }
20829N/A@@ -495,19 +489,19 @@ class MemoryMappedFile {
20829N/A+ // Open the given file and pass it to MapFileToMemoryInternal().
20829N/A+ bool MapFileToMemory(const FilePath& file_name);
20829N/A // Map the file to memory, set data_ to that memory address. Return true on
20829N/A // success, false on any kind of failure. This is a helper for Initialize().
20829N/A- bool MapFileToMemory(const FilePath& file_name);
20829N/A+ bool MapFileToMemoryInternal();
20829N/A // Closes all open handles. Later we may want to make this public.
20829N/A@@ -521,6 +515,66 @@ bool RenameFileAndResetSecurityDescriptor(
20829N/A const FilePath& source_file_path,
20829N/A const FilePath& target_file_path);
20829N/A+// Returns whether the file has been modified since a particular date.
20829N/A+bool HasFileBeenModifiedSince(const FileEnumerator::FindInfo& find_info,
20829N/A+ const base::Time& cutoff_time);
20829N/A+inline bool MakeFileUnreadable(const FilePath& path) {
20829N/A+ PSECURITY_DESCRIPTOR security_descriptor;
20829N/A+ DACL_SECURITY_INFORMATION, NULL, NULL, &old_dacl,
20829N/A+ NULL, &security_descriptor) != ERROR_SUCCESS)
20829N/A+ // Deny Read access for the current user.
20829N/A+ if (SetEntriesInAcl(1, &change, old_dacl, &new_dacl) != ERROR_SUCCESS) {
20829N/A+ LocalFree(security_descriptor);
20829N/A+ SE_FILE_OBJECT, DACL_SECURITY_INFORMATION,
20829N/A+ LocalFree(security_descriptor);
20829N/A+// Deprecated functions have been moved to this separate header file,
20829N/A+// which must be included last after all the above definitions.
20829N/A-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
20829N/A+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
20829N/A // Use of this source code is governed by a BSD-style license that can be
20829N/A+#if defined(OS_OPENBSD) || defined(OS_FREEBSD) || \
20829N/A+ MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5)
20829N/A+typedef struct stat stat_wrapper_t;
20829N/A+static int CallStat(const char *path, stat_wrapper_t *sb) {
20829N/A+typedef struct stat64 stat_wrapper_t;
20829N/A+static int CallStat(const char *path, stat_wrapper_t *sb) {
20829N/A #if defined(GOOGLE_CHROME_BUILD)
20829N/A-std::wstring GetDirectoryFromPath(const std::wstring& path) {
20829N/A- if (EndsWithSeparator(path)) {
20829N/A- base::strlcpy(full_path, WideToUTF8(path).c_str(), arraysize(full_path));
20829N/A- return UTF8ToWide(dirname(full_path));
20829N/A bool AbsolutePath(FilePath* path) {
20829N/A if (realpath(path->value().c_str(), full_path) == NULL)
20829N/A@@ -64,17 +76,30 @@ int CountFilesCreatedAfter(const FilePath& path,
20829N/A+#if !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_FREEBSD) && \
20829N/A+ !defined(OS_OPENBSD) && !defined(OS_SOLARIS)
20829N/A+ #error Port warning: depending on the definition of struct dirent, \
20829N/A+ additional space for pathname may be needed
20829N/A- while (readdir_r(dir, &ent_buf, &ent) == 0 && ent) {
20829N/A+ while (readdir_r(dir, (dirent *)&ent_buf, &ent) == 0 && ent) {
20829N/A if ((strcmp(ent->d_name, ".") == 0) ||
20829N/A (strcmp(ent->d_name, "..") == 0))
20829N/A- LOG(ERROR) << "stat64 failed: " << strerror(errno);
20829N/A+ LOG(ERROR) << "stat64 failed";
20829N/A // Here, we use Time::TimeT(), which discards microseconds. This
20829N/A@@ -106,8 +131,8 @@ int CountFilesCreatedAfter(const FilePath& path,
20829N/A bool Delete(const FilePath& path, bool recursive) {
20829N/A- int test = stat64(path_str, &file_info);
20829N/A+ int test = CallStat(path_str, &file_info);
20829N/A // The Windows version defines this condition as success.
20829N/A bool ret = (errno == ENOENT || errno == ENOTDIR);
20829N/A@@ -118,53 +143,46 @@ bool Delete(const FilePath& path, bool recursive) {
20829N/A- // XXX Need ftsless impl for bionic
20829N/A- int ftsflags = FTS_PHYSICAL | FTS_NOSTAT;
20829N/A- if (base::strlcpy(top_dir, path_str,
20829N/A- arraysize(top_dir)) >= arraysize(top_dir)) {
20829N/A+ std::stack<std::string> directories;
20829N/A+ FileEnumerator traversal(path, true, static_cast<FileEnumerator::FILE_TYPE>(
20829N/A+ FileEnumerator::FILES | FileEnumerator::DIRECTORIES |
20829N/A+ FileEnumerator::SHOW_SYM_LINKS));
20829N/A+ FileEnumerator::FindInfo info;
20829N/A- char* dir_list[2] = { top_dir, NULL };
20829N/A- FTS* fts = fts_open(dir_list, ftsflags, NULL);
20829N/A- FTSENT* fts_ent = fts_read(fts);
20829N/A- while (success && fts_ent != NULL) {
20829N/A- success = (rmdir(fts_ent->fts_accpath) == 0);
20829N/A- success = (unlink(fts_ent->fts_accpath) == 0);
20829N/A bool Move(const FilePath& from_path, const FilePath& to_path) {
20829N/A+ // Windows compatibility: if to_path exists, from_path and to_path
20829N/A+ // must be the same type, either both files, or both directories.
20829N/A+ stat_wrapper_t from_file_info;
20829N/A@@ -175,6 +193,10 @@ bool Move(const FilePath& from_path, const FilePath& to_path) {
20829N/A+bool ReplaceFile(const FilePath& from_path, const FilePath& to_path) {
20829N/A bool CopyDirectory(const FilePath& from_path,
20829N/A@@ -191,116 +213,101 @@ bool CopyDirectory(const FilePath& from_path,
20829N/A- // XXX Need ftsless impl for bionic
20829N/A- char* dir_list[] = { top_dir, NULL };
20829N/A- FTS* fts = fts_open(dir_list, FTS_PHYSICAL | FTS_NOSTAT, NULL);
20829N/A- LOG(ERROR) << "fts_open failed: " << strerror(errno);
20829N/A+ // This function does not properly handle destinations within the source
20829N/A+ FilePath real_to_path = to_path;
20829N/A+ if (PathExists(real_to_path)) {
20829N/A+ if (!AbsolutePath(&real_to_path))
20829N/A+ if (!AbsolutePath(&real_to_path))
20829N/A+ FilePath real_from_path = from_path;
20829N/A+ if (!AbsolutePath(&real_from_path))
20829N/A+ FileEnumerator::FILE_TYPE traverse_type =
20829N/A+ static_cast<FileEnumerator::FILE_TYPE>(FileEnumerator::FILES |
20829N/A+ FileEnumerator::SHOW_SYM_LINKS);
20829N/A+ traverse_type = static_cast<FileEnumerator::FILE_TYPE>(
20829N/A+ traverse_type | FileEnumerator::DIRECTORIES);
20829N/A+ FileEnumerator traversal(from_path, recursive, traverse_type);
20829N/A+ // We have to mimic windows behavior here. |to_path| may not exist yet,
20829N/A+ // start the loop with |to_path|.
20829N/A+ FileEnumerator::FindInfo info;
20829N/A+ LOG(ERROR) << "CopyDirectory() couldn't stat source directory: " <<
20829N/A+ FilePath from_path_base = from_path;
20829N/A+ // If the destination already exists and is a directory, then the
20829N/A+ // top level of source needs to be copied.
20829N/A- while (!error && (ent = fts_read(fts)) != NULL) {
20829N/A- // ent->fts_path is the source path, including from_path, so paste
20829N/A+ // The Windows version of this function assumes that non-recursive calls
20829N/A+ // will always have a directory for from_path.
20829N/A+ // current is the source path, including from_path, so paste
20829N/A // the suffix after from_path onto to_path to create the target_path.
20829N/A // Strip the leading '/' (if any).
20829N/A- case FTS_D: // Preorder directory.
20829N/A- // If we encounter a subdirectory in a non-recursive copy, prune it
20829N/A- if (!recursive && ent->fts_level > 0) {
20829N/A- if (fts_set(fts, ent, FTS_SKIP) != 0)
20829N/A- // Try creating the target dir, continuing on it if it exists already.
20829N/A- // Rely on the user's umask to produce correct permissions.
20829N/A- case FTS_NSOK: // File, no stat info requested.
20829N/A- if (!CopyFile(FilePath(ent->fts_path), target_path))
20829N/A- error = errno ? errno : EINVAL;
20829N/A- case FTS_DP: // Postorder directory.
20829N/A- case FTS_DC: // Directory causing a cycle.
20829N/A- if (fts_set(fts, ent, FTS_SKIP) != 0)
20829N/A- case FTS_DNR: // Directory cannot be read.
20829N/A- case FTS_SLNONE: // Symlink with broken target.
20829N/A- LOG(WARNING) << "CopyDirectory() skipping symbolic link: " <<
20829N/A- case FTS_DEFAULT: // Some other sort of file.
20829N/A- LOG(WARNING) << "CopyDirectory() skipping file of unknown type: " <<
20829N/A- continue; // Hope for the best!
20829N/A+ LOG(ERROR) << "CopyDirectory() couldn't create directory: " <<
20829N/A+ if (!CopyFile(current, target_path)) {
20829N/A+ LOG(ERROR) << "CopyDirectory() couldn't create file: " <<
20829N/A+ LOG(WARNING) << "CopyDirectory() skipping non-regular file: " <<
20829N/A- // fts_read may have returned NULL and set errno to indicate an error.
20829N/A- // If we already have an error, let's use that error instead of the error
20829N/A- LOG(ERROR) << "CopyDirectory(): " << strerror(error);
20829N/A bool PathExists(const FilePath& path) {
20829N/A bool PathIsWritable(const FilePath& path) {
20829N/A- // If the path doesn't exist, test the parent dir.
20829N/A- // If the parent dir doesn't exist, then return false (the path is not
20829N/A@@ -311,8 +318,8 @@ bool PathIsWritable(const FilePath& path) {
20829N/A bool DirectoryExists(const FilePath& path) {
20829N/A@@ -358,10 +365,8 @@ bool ReadFromFD(int fd, char* buffer, size_t bytes) {
20829N/A // Creates and opens a temporary file in |directory|, returning the
20829N/A-// file descriptor. |path| is set to the temporary file path.
20829N/A-// Note TODO(erikkay) comment in header for BlahFileName() calls; the
20829N/A-// intent is to rename these files BlahFile() (since they create
20829N/A-// files, not filenames). This function does NOT unlink() the file.
20829N/A+// file descriptor. |path| is set to the temporary file path.
20829N/A+// This function does NOT unlink() the file.
20829N/A int CreateAndOpenFdForTemporaryFile(FilePath directory, FilePath* path) {
20829N/A const std::string& tmpdir_string = path->value();
20829N/A@@ -371,7 +376,7 @@ int CreateAndOpenFdForTemporaryFile(FilePath directory, FilePath* path) {
20829N/A-bool CreateTemporaryFileName(FilePath* path) {
20829N/A+bool CreateTemporaryFile(FilePath* path) {
20829N/A@@ -398,33 +403,46 @@ FILE* CreateAndOpenTemporaryFileInDir(const FilePath& dir, FilePath* path) {
20829N/A-bool CreateTemporaryFileNameInDir(const std::wstring& dir,
20829N/A+bool CreateTemporaryFileInDir(const FilePath& dir, FilePath* temp_file) {
20829N/A+ int fd = CreateAndOpenFdForTemporaryFile(dir, temp_file);
20829N/A+ return ((fd >= 0) && !close(fd));
20829N/A-bool CreateNewTempDirectory(const FilePath::StringType& prefix,
20829N/A+static bool CreateTemporaryDirInDirImpl(const FilePath& base_dir,
20829N/A+ const FilePath::StringType& name_tmpl,
20829N/A+ << "Directory name template must contain \"XXXXXX\".";
20829N/A // this should be OK since mkdtemp just replaces characters in place
20829N/A- *new_temp_path = FilePath(dtemp);
20829N/A+bool CreateTemporaryDirInDir(const FilePath& base_dir,
20829N/A+ const FilePath::StringType& prefix,
20829N/A+ FilePath::StringType mkdtemp_template = prefix;
20829N/A+ return CreateTemporaryDirInDirImpl(base_dir, mkdtemp_template, new_dir);
20829N/A+bool CreateNewTempDirectory(const FilePath::StringType& prefix,
20829N/A+ return CreateTemporaryDirInDirImpl(tmpdir, kTempFileName, new_temp_path);
20829N/A bool CreateDirectory(const FilePath& full_path) {
20829N/A std::vector<FilePath> subpaths;
20829N/A@@ -440,20 +458,44 @@ bool CreateDirectory(const FilePath& full_path) {
20829N/A // Iterate through the parents and create the missing ones.
20829N/A- if (mkdir(i->value().c_str(), 0777) != 0)
20829N/A+ if (mkdir(i->value().c_str(), 0700) == 0)
20829N/A+ // Mkdir failed, but it might have failed with EEXIST, or some other error
20829N/A+ // due to the the directory appearing out of thin air. This can occur if
20829N/A+ // two processes are trying to create the same file system tree at the same
20829N/A+ // time. Check to see if it exists and make sure it is a directory.
20829N/A bool GetFileInfo(const FilePath& file_path, FileInfo* results) {
20829N/A+bool SetLastModifiedTime(const FilePath& file_path, base::Time last_modified) {
20829N/A+bool GetInode(const FilePath& path, ino_t* inode) {
20829N/A@@ -470,9 +512,10 @@ int ReadFile(const FilePath& filename, char* data, int size) {
20829N/A- int ret_value = HANDLE_EINTR(read(fd, data, size));
20829N/A+ ssize_t bytes_read = HANDLE_EINTR(read(fd, data, size));
20829N/A+ if (int ret = HANDLE_EINTR(close(fd)) < 0)
20829N/A int WriteFile(const FilePath& filename, const char* data, int size) {
20829N/A@@ -480,20 +523,24 @@ int WriteFile(const FilePath& filename, const char* data, int size) {
20829N/A+ int bytes_written = WriteFileDescriptor(fd, data, size);
20829N/A+ if (int ret = HANDLE_EINTR(close(fd)) < 0)
20829N/A+int WriteFileDescriptor(const int fd, const char* data, int size) {
20829N/A ssize_t bytes_written_total = 0;
20829N/A- ssize_t bytes_written_partial =
20829N/A- HANDLE_EINTR(write(fd, data + bytes_written_total,
20829N/A- if (bytes_written_partial < 0) {
20829N/A+ for (ssize_t bytes_written_partial = 0; bytes_written_total < size;
20829N/A+ bytes_written_total += bytes_written_partial) {
20829N/A+ HANDLE_EINTR(write(fd, data + bytes_written_total,
20829N/A+ if (bytes_written_partial < 0)
20829N/A- bytes_written_total += bytes_written_partial;
20829N/A- } while (bytes_written_total < size);
20829N/A@@ -520,10 +567,13 @@ bool SetCurrentDirectory(const FilePath& path) {
20829N/A FileEnumerator::FileEnumerator(const FilePath& root_path,
20829N/A FileEnumerator::FILE_TYPE file_type)
20829N/A+ : current_directory_entry_(0),
20829N/A+ // INCLUDE_DOT_DOT must not be specified if recursive.
20829N/A+ DCHECK(!(recursive && (INCLUDE_DOT_DOT & file_type_)));
20829N/A@@ -531,136 +581,256 @@ FileEnumerator::FileEnumerator(const FilePath& root_path,
20829N/A FileEnumerator::FILE_TYPE file_type,
20829N/A const FilePath::StringType& pattern)
20829N/A+ : current_directory_entry_(0),
20829N/A- // The Windows version of this code only matches against items in the top-most
20829N/A- // directory, and we're comparing fnmatch against full paths, so this is the
20829N/A- // easiest way to get the right pattern.
20829N/A+ // INCLUDE_DOT_DOT must not be specified if recursive.
20829N/A+ DCHECK(!(recursive && (INCLUDE_DOT_DOT & file_type_)));
20829N/A+ // The Windows version of this code appends the pattern to the root_path,
20829N/A+ // potentially only matching against items in the top-most directory.
20829N/A+ pattern_ = FilePath::StringType();
20829N/A FileEnumerator::~FileEnumerator() {
20829N/A void FileEnumerator::GetFindInfo(FindInfo* info) {
20829N/A- memcpy(&(info->stat), fts_ent_->fts_statp, sizeof(info->stat));
20829N/A+ DirectoryEntryInfo* cur_entry = &directory_entries_[current_directory_entry_];
20829N/A+ memcpy(&(info->stat), &(cur_entry->stat), sizeof(info->stat));
20829N/A+bool FileEnumerator::IsDirectory(const FindInfo& info) {
20829N/A+FilePath FileEnumerator::GetFilename(const FindInfo& find_info) {
20829N/A-// As it stands, this method calls itself recursively when the next item of
20829N/A-// the fts enumeration doesn't match (type, pattern, etc.). In the case of
20829N/A-// large directories with many files this can be quite deep.
20829N/A-// TODO(erikkay) - get rid of this recursive pattern
20829N/A FilePath FileEnumerator::Next() {
20829N/A+ // While we've exhausted the entries in the current directory, do the next
20829N/A- // The last find FindFirstFile operation is done, prepare a new one.
20829N/A- // Start a new find operation.
20829N/A- char* dir_list[2] = { top_dir, NULL };
20829N/A- fts_ = fts_open(dir_list, ftsflags, NULL);
20829N/A+ std::vector<DirectoryEntryInfo> entries;
20829N/A+ if (!ReadDirectory(&entries, root_path_, file_type_ & SHOW_SYM_LINKS))
20829N/A+ for (std::vector<DirectoryEntryInfo>::const_iterator
20829N/A- // Level 0 is the top, which is always skipped.
20829N/A- // Patterns are only matched on the items in the top-most directory.
20829N/A- // (see Windows implementation)
20829N/A- if (fts_ent_->fts_info == FTS_D)
20829N/A- fts_set(fts_, fts_ent_, FTS_SKIP);
20829N/A- FilePath cur_file(fts_ent_->fts_path);
20829N/A- if (fts_ent_->fts_info == FTS_D) {
20829N/A- // If not recursive, then prune children.
20829N/A- fts_set(fts_, fts_ent_, FTS_SKIP);
20829N/A- return (file_type_ & FileEnumerator::DIRECTORIES) ? cur_file : Next();
20829N/A- } else if (fts_ent_->fts_info == FTS_F) {
20829N/A- return (file_type_ & FileEnumerator::FILES) ? cur_file : Next();
20829N/A- // TODO(erikkay) - verify that the other fts_info types aren't interesting
20829N/A+bool FileEnumerator::ReadDirectory(std::vector<DirectoryEntryInfo>* entries,
20829N/A+ const FilePath& source, bool show_links) {
20829N/A+#if !defined(OS_LINUX) && !defined(OS_MACOSX) && !defined(OS_FREEBSD) && \
20829N/A+ !defined(OS_OPENBSD) && !defined(OS_SOLARIS)
20829N/A+ #error Port warning: depending on the definition of struct dirent, \
20829N/A+ additional space for pathname may be needed
20829N/A+ while (readdir_r(dir, (dirent *)&dent_buf, &dent) == 0 && dent) {
20829N/A+ // Print the stat() error message unless it was ENOENT and we're
20829N/A+ if (!(errno == ENOENT && !show_links)) {
20829N/A+ LOG(ERROR) << "Couldn't stat "
20829N/A ///////////////////////////////////////////////
20829N/A MemoryMappedFile::MemoryMappedFile()
20829N/A+ : file_(base::kInvalidPlatformFileValue),
20829N/A-bool MemoryMappedFile::MapFileToMemory(const FilePath& file_name) {
20829N/A+bool MemoryMappedFile::MapFileToMemoryInternal() {
20829N/A- if (fstat(file_, &file_stat) == -1)
20829N/A+ if (fstat(file_, &file_stat) == base::kInvalidPlatformFileValue) {
20829N/A+ LOG(ERROR) << "Couldn't fstat " << file_ << ", errno " << errno;
20829N/A- mmap(NULL, length_, PROT_READ, MAP_SHARED, file_, 0));
20829N/A+ (void*)mmap(NULL, length_, PROT_READ, MAP_SHARED, file_, 0));
20829N/A+ LOG(ERROR) << "Couldn't mmap " << file_ << ", errno " << errno;
20829N/A void MemoryMappedFile::CloseHandles() {
20829N/A+ munmap((caddr_t)data_, length_);
20829N/A+ if (file_ != base::kInvalidPlatformFileValue)
20829N/A+ file_ = base::kInvalidPlatformFileValue;
20829N/A+bool HasFileBeenModifiedSince(const FileEnumerator::FindInfo& find_info,
20829N/A+ const base::Time& cutoff_time) {
20829N/A+bool GetTempDir(FilePath* path) {
20829N/A+ const char* tmp = getenv("TMPDIR");
20829N/A+bool GetShmemTempDir(FilePath* path) {
20829N/A+ const char* home_dir = getenv("HOME");
20829N/A+ if (file_util::GetTempDir(&rv))
20829N/A+bool CopyFile(const FilePath& from_path, const FilePath& to_path) {
20829N/A+ const size_t kBufferSize = 32768;
20829N/A+ std::vector<char> buffer(kBufferSize);
20829N/A+ ssize_t bytes_written_per_read = 0;
20829N/A+ ssize_t bytes_written_partial = HANDLE_EINTR(write(
20829N/A+ &buffer[bytes_written_per_read],
20829N/A+ bytes_read - bytes_written_per_read));
20829N/A+ if (bytes_written_partial < 0) {
20829N/A+ bytes_written_per_read += bytes_written_partial;
20829N/A+ } while (bytes_written_per_read < bytes_read);
20829N/A+ if (HANDLE_EINTR(close(infile)) < 0)
20829N/A+ if (HANDLE_EINTR(close(outfile)) < 0)
20829N/A@@ -86,7 +86,7 @@ class FileVersionInfo {
20829N/A explicit FileVersionInfo(NSBundle *bundle);
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A typedef struct _GtkWidget GtkWidget;
20829N/A typedef struct _GtkWindow GtkWindow;
20829N/A typedef struct _cairo_surface cairo_surface_t;
20829N/A@@ -64,7 +64,7 @@ typedef NSView* NativeView;
20829N/A typedef NSWindow* NativeWindow;
20829N/A typedef NSTextField* NativeEditView;
20829N/A typedef CGContext* NativeDrawingContext;
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A typedef GtkWindow* NativeWindow;
20829N/A typedef GtkWidget* NativeEditView;
20829N/A@@ -86,7 +86,7 @@ typedef intptr_t NativeViewId;
20829N/A static inline NativeView NativeViewFromId(NativeViewId id) {
20829N/A return reinterpret_cast<NativeView>(id);
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A // A NativeView on Linux is a GtkWidget*. However, we can't go directly from an
20829N/A // X window ID to a GtkWidget. Thus, functions which handle NativeViewIds from
20829N/A // the renderer have to use Xlib. This is fine since these functions are
20829N/A@@ -94,7 +94,7 @@ static inline NativeView NativeViewFromId(NativeViewId id) {
20829N/A #define NativeViewFromId(x) NATIVE_VIEW_FROM_ID_NOT_AVAILIBLE_ON_LINUX
20829N/A+#endif // defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A // Convert a NativeView to a NativeViewId. See the comments above
20829N/A@@ -102,10 +102,10 @@ static inline NativeView NativeViewFromId(NativeViewId id) {
20829N/A static inline NativeViewId IdFromNativeView(NativeView view) {
20829N/A return reinterpret_cast<NativeViewId>(view);
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A // Not inlined because it involves pulling too many headers.
20829N/A NativeViewId IdFromNativeView(NativeView view);
20829N/A+#endif // defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A@@ -74,7 +74,7 @@ Rect& Rect::operator=(const CGRect& r) {
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A Rect::Rect(const GdkRectangle& r)
20829N/A@@ -126,7 +126,7 @@ RECT Rect::ToRECT() const {
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A GdkRectangle Rect::ToGdkRectangle() const {
20829N/A GdkRectangle r = {x(), y(), width(), height()};
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A typedef struct _GdkRectangle GdkRectangle;
20829N/A explicit Rect(const CGRect& r);
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOALRIS)
20829N/A explicit Rect(const GdkRectangle& r);
20829N/A Rect(const gfx::Point& origin, const gfx::Size& size);
20829N/A Rect& operator=(const RECT& r);
20829N/A Rect& operator=(const CGRect& r);
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A Rect& operator=(const GdkRectangle& r);
20829N/A // Construct an equivalent Win32 RECT object.
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A GdkRectangle ToGdkRectangle() const;
20829N/A // Construct an equivalent CoreGraphics object.
20829N/A@@ -26,6 +26,15 @@ namespace base {
20829N/A // This is a hack to disable the gcc 4.4 warning about hash_map and hash_set
20829N/A // being deprecated. We can get rid of this when we upgrade to VS2008 and we
20829N/A #define ICU_UTIL_DATA_IMPL ICU_UTIL_DATA_SHARED
20829N/A #define ICU_UTIL_DATA_IMPL ICU_UTIL_DATA_STATIC
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A #define ICU_UTIL_DATA_IMPL ICU_UTIL_DATA_FILE
20829N/A // We may not want to port idle_timer to Linux, but we have implemented it
20829N/A // anyway. Define this to 1 to enable the Linux idle timer and then add the
20829N/A // libs that need to be linked (Xss).
20829N/A-#if defined(OS_LINUX) && ENABLE_XSS_SUPPORT
20829N/A+#if (defined(OS_LINUX) || defined(OS_SOLARIS)) && ENABLE_XSS_SUPPORT
20829N/A // We may not want to port idle_timer to Linux, but we have implemented it
20829N/A // anyway. Remove the 0 above if we want it.
20829N/A@@ -54,7 +54,7 @@ bool OSIdleTimeSource(int32 *milliseconds_interval_since_last_event) {
20829N/A kCGAnyInputEventType) * 1000.0;
20829N/A-#elif defined(OS_LINUX) && ENABLE_XSS_SUPPORT
20829N/A+#elif (defined(OS_LINUX) || defined(OS_SOLARIS)) && ENABLE_XSS_SUPPORT
20829N/A@@ -118,7 +118,7 @@ typedef HANDLE MutexHandle;
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A@@ -230,6 +230,8 @@ int32 CurrentThreadId() {
20829N/A@@ -238,7 +240,7 @@ uint64 TickCount() {
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A clock_gettime(CLOCK_MONOTONIC, &ts);
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A@@ -120,9 +120,9 @@ MessageLoop::MessageLoop(Type type)
20829N/A pump_ = base::MessagePumpMac::Create();
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A pump_ = new base::MessagePumpForUI();
20829N/A+#endif // OS_LINUX || OS_SOLARIS
20829N/A pump_ = new base::MessagePumpLibevent();
20829N/A@@ -126,16 +126,22 @@ namespace base {
20829N/A MessagePumpForUI::MessagePumpForUI()
20829N/A context_(g_main_context_default()),
20829N/A // Create our wakeup pipe, which is used to flag when work was scheduled.
20829N/A+ int flags = fcntl(fds[0], F_GETFL, 0);
20829N/A+ fcntl(fds[0], F_SETFL, flags | O_NDELAY);
20829N/A wakeup_gpollfd_->fd = wakeup_pipe_read_;
20829N/A wakeup_gpollfd_->events = G_IO_IN;
20829N/A work_source_ = g_source_new(&WorkSourceFuncs, sizeof(WorkSource));
20829N/A static_cast<WorkSource*>(work_source_)->pump = this;
20829N/A@@ -232,20 +238,19 @@ int MessagePumpForUI::HandlePrepare() {
20829N/A bool MessagePumpForUI::HandleCheck() {
20829N/A if (!state_) // state_ may be null during tests.
20829N/A // We should only ever have a single message on the wakeup pipe, since we
20829N/A // are only signaled when the queue went from empty to non-empty. The glib
20829N/A // poll will tell us whether there was data, so this read shouldn't block.
20829N/A if (wakeup_gpollfd_->revents & G_IO_IN) {
20829N/A- if (HANDLE_EINTR(read(wakeup_pipe_read_, &msg, 1)) != 1 || msg != '!') {
20829N/A- NOTREACHED() << "Error reading from the wakeup pipe.";
20829N/A+ while (HANDLE_EINTR(read(wakeup_pipe_read_, &buf, 32)));
20829N/A // Since we ate the message, we need to record that we have more work,
20829N/A // because HandleCheck() may be called without HandleDispatch being called
20829N/A@@ -299,16 +304,20 @@ void MessagePumpForUI::Quit() {
20829N/A void MessagePumpForUI::ScheduleWork() {
20829N/A // This can be called on any thread, so we don't want to touch any state
20829N/A // variables as we would then need locks all over. This ensures that if
20829N/A // we are sleeping in a poll that we will wake up.
20829N/A+ while (HANDLE_EINTR(read(wakeup_pipe_read_, &buf, 32)));
20829N/A if (HANDLE_EINTR(write(wakeup_pipe_write_, &msg, 1)) != 1) {
20829N/A NOTREACHED() << "Could not write to the UI message loop wakeup pipe!";
20829N/A void MessagePumpForUI::ScheduleDelayedWork(const Time& delayed_work_time) {
20829N/A // We need to wake up the loop in case the poll timeout needs to be
20829N/A // adjusted. This will cause us to try to do work, but that's ok.
20829N/A@@ -26,7 +26,7 @@ typedef char* NativeLibraryFunctionNameType;
20829N/A typedef CFBundleRef NativeLibrary;
20829N/A typedef CFStringRef NativeLibraryFunctionNameType;
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A typedef const char* NativeLibraryFunctionNameType;
20829N/A@@ -82,7 +82,7 @@ class ObserverList {
20829N/A // Add an observer to the list.
20829N/A void AddObserver(ObserverType* obs) {
20829N/A << "Observers can only be added once!";
20829N/A@@ -24,7 +24,7 @@ namespace base {
20829N/A bool PathProviderWin(int key, FilePath* result);
20829N/A bool PathProviderMac(int key, FilePath* result);
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A bool PathProviderLinux(int key, FilePath* result);
20829N/A@@ -80,7 +80,7 @@ static Provider base_provider_mac = {
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A static Provider base_provider_linux = {
20829N/A@@ -92,6 +92,17 @@ static Provider base_provider_linux = {
20829N/A+static Provider base_provider_posix = {
20829N/A@@ -104,7 +115,7 @@ struct PathData {
20829N/A providers = &base_provider_win;
20829N/A providers = &base_provider_mac;
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A providers = &base_provider_linux;
20829N/A@@ -206,6 +217,24 @@ bool PathService::IsOverridden(int key) {
20829N/A+bool PathService::Override(int key, const FilePath& path) {
20829N/A+ PathData* path_data = GetPathData();
20829N/A+ DCHECK(key > base::DIR_CURRENT) << "invalid path key";
20829N/A+ // make sure the directory exists:
20829N/A+ if (!file_util::CreateDirectory(file_path))
20829N/A+ AutoLock scoped_lock(path_data->lock);
20829N/A+ path_data->cache[key] = file_path;
20829N/A bool PathService::Override(int key, const std::wstring& path) {
20829N/A PathData* path_data = GetPathData();
20829N/A@@ -231,8 +260,13 @@ bool PathService::Override(int key, const std::wstring& path) {
20829N/A+bool PathService::SetCurrentDirectory(const FilePath& current_directory) {
20829N/A bool PathService::SetCurrentDirectory(const std::wstring& current_directory) {
20829N/A return file_util::SetCurrentDirectory(current_directory);
20829N/A@@ -48,13 +48,21 @@ class PathService {
20829N/A // WARNING: Consumers of PathService::Get may expect paths to be constant
20829N/A // over the lifetime of the app, so this method should be used with caution.
20829N/A+ static bool Override(int key, const FilePath& path);
20829N/A static bool Override(int key, const std::wstring& path);
20829N/A // Return whether a path was overridden.
20829N/A static bool IsOverridden(int key);
20829N/A+ static bool SetCurrentDirectory(const FilePath& current_directory);
20829N/A static bool SetCurrentDirectory(const std::wstring& current_directory);
20829N/A // To extend the set of supported keys, you can register a path provider,
20829N/A // which is just a function mirroring PathService::Get. The ProviderFunc
20829N/A //------------------------------------------------------------------------------
20829N/A@@ -102,29 +103,23 @@ bool Pickle::ReadBool(void** iter, bool* result) const {
20829N/A bool Pickle::ReadInt16(void** iter, int16* result) const {
20829N/A- *iter = const_cast<char*>(payload());
20829N/A- if (!IteratorHasRoomFor(*iter, sizeof(*result)))
20829N/A- memcpy(result, *iter, sizeof(*result));
20829N/A- UpdateIter(iter, sizeof(*result));
20829N/A bool Pickle::ReadUInt16(void** iter, uint16* result) const {
20829N/A- *iter = const_cast<char*>(payload());
20829N/A- if (!IteratorHasRoomFor(*iter, sizeof(*result)))
20829N/A- memcpy(result, *iter, sizeof(*result));
20829N/A- UpdateIter(iter, sizeof(*result));
20829N/A@@ -22,7 +22,7 @@ typedef void* PlatformThreadHandle; // HANDLE
20829N/A typedef pthread_t PlatformThreadHandle;
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A typedef pid_t PlatformThreadId;
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A@@ -35,6 +38,8 @@ PlatformThreadId PlatformThread::CurrentId() {
20829N/A@@ -44,7 +44,7 @@ namespace base {
20829N/A inline void va_copy(va_list& a, va_list& b) {
20829N/A+#elif defined(COMPILER_MSVC) || defined(COMPILER_SUNPRO)
20829N/A@@ -54,7 +54,7 @@ inline void va_copy(va_list& a, va_list& b) {
20829N/A // use va_list as ref args to a function, as above, breaks some machines.
20829N/A # define base_va_copy(_a, _b) ::va_copy(_a, _b)
20829N/A+# elif defined(COMPILER_MSVC) || defined(COMPILER_SUNPRO)
20829N/A # define base_va_copy(_a, _b) (_a = _b)
20829N/A # error No va_copy for your compiler
20829N/A@@ -67,7 +67,7 @@ inline void va_copy(va_list& a, va_list& b) {
20829N/A // Define an OS-neutral wrapper for shared library entry points
20829N/A-#elif defined(OS_LINUX) || defined(OS_MACOSX)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS) || defined(OS_MACOSX)
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A@@ -62,7 +66,8 @@ enum ProcessArchitecture {
20829N/A static ProcessArchitecture GetCurrentProcessArchitecture()
20829N/A@@ -76,6 +81,8 @@ static ProcessArchitecture GetCurrentProcessArchitecture()
20829N/A currentArchitecture = base::PROCESS_ARCH_PPC;
20829N/A currentArchitecture = base::PROCESS_ARCH_ARM;
20829N/A+ currentArchitecture = base::PROCESS_ARCH_SPARC;
20829N/A@@ -296,7 +303,7 @@ class NamedProcessIterator {
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A std::vector<kinfo_proc> kinfo_procs_;
20829N/A@@ -102,7 +102,7 @@ typedef unsigned long int rlim_t;
20829N/A void CloseSuperfluousFds(const base::InjectiveMultimap& saved_mapping) {
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A static const rlim_t kSystemDefaultMaxFds = 8192;
20829N/A@@ -179,7 +179,7 @@ void CloseSuperfluousFds(const base::InjectiveMultimap& saved_mapping) {
20829N/A // TODO(agl): Remove this function. It's fundamentally broken for multithreaded
20829N/A void SetAllFDsToCloseOnExec() {
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A@@ -136,9 +136,15 @@ bool SharedMemory::FilenameForMemoryName(const std::wstring &memname,
20829N/A if (file_util::GetShmemTempDir(&temp_dir) == false)
20829N/A+ WideToUTF8(memname))).ToWStringHack();
20829N/A@@ -256,7 +262,7 @@ bool SharedMemory::Unmap() {
20829N/A+ munmap((caddr_t)memory_, max_size_);
20829N/A@@ -96,12 +96,17 @@ class StackAllocator : public std::allocator<T> {
20829N/A // and the size requested fits. Otherwise, fall through to the standard
20829N/A pointer allocate(size_type n, void* hint = 0) {
20829N/A+ if (source_ != NULL && !source_->used_stack_buffer_
20829N/A if (source_ != NULL && !source_->used_stack_buffer_
20829N/A source_->used_stack_buffer_ = true;
20829N/A return source_->stack_buffer();
20829N/A- return std::allocator<T>::allocate(n, hint);
20829N/A+ return (pointer)std::allocator<T>::allocate(n, hint);
20829N/A@@ -162,7 +162,9 @@ struct string16_char_traits {
20829N/A // TODO(mark): File this bug with Apple and update this note with a bug number.
20829N/A extern template class std::basic_string<char16, base::string16_char_traits>;
20829N/A typedef std::basic_string<char16, base::string16_char_traits> string16;
20829N/A@@ -113,8 +113,13 @@ class StringPiece {
20829N/A typedef const char* const_iterator;
20829N/A+ typedef std::reverse_iterator<const_iterator, std::random_access_iterator_tag, const value_type> const_reverse_iterator;
20829N/A+ typedef std::reverse_iterator<iterator, std::random_access_iterator_tag, value_type> reverse_iterator;
20829N/A typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
20829N/A typedef std::reverse_iterator<iterator> reverse_iterator;
20829N/A iterator begin() const { return ptr_; }
20829N/A iterator end() const { return ptr_ + length_; }
20829N/A const_reverse_iterator rbegin() const {
20829N/A@@ -503,22 +503,46 @@ std::wstring CollapseWhitespace(const std::wstring& text,
20829N/A std::string WideToASCII(const std::wstring& wide) {
20829N/A std::wstring ASCIIToWide(const std::string& ascii) {
20829N/A std::string UTF16ToASCII(const string16& utf16) {
20829N/A string16 ASCIIToUTF16(const std::string& ascii) {
20829N/A // Latin1 is just the low range of Unicode, so we can copy directly to convert.
20829N/A@@ -734,6 +758,7 @@ bool LowerCaseEqualsASCII(std::wstring::const_iterator a_begin,
20829N/A return DoLowerCaseEqualsASCII(a_begin, a_end, b);
20829N/A bool LowerCaseEqualsASCII(const char* a_begin,
20829N/A@@ -744,6 +769,7 @@ bool LowerCaseEqualsASCII(const wchar_t* a_begin,
20829N/A return DoLowerCaseEqualsASCII(a_begin, a_end, b);
20829N/A bool StartsWithASCII(const std::string& str,
20829N/A@@ -96,7 +96,7 @@ std::wstring SysInfo::GetEnvVar(const wchar_t* var) {
20829N/A std::string SysInfo::OperatingSystemName() {
20829N/A@@ -106,7 +106,7 @@ std::string SysInfo::OperatingSystemName() {
20829N/A std::string SysInfo::OperatingSystemVersion() {
20829N/A@@ -116,7 +116,7 @@ std::string SysInfo::OperatingSystemVersion() {
20829N/A std::string SysInfo::CPUArchitecture() {
20829N/A #elif defined(__linux__) || defined(ANDROID)
20829N/A+#elif defined(__sun) || defined(sun)
20829N/A@@ -242,6 +242,49 @@ PR_ImplodeTime(const PRExplodedTime *exploded)
20829N/A result *= kSecondsToMicroseconds;
20829N/A+#define COUNT_LEAPS(Y) ( ((Y)-1)/4 - ((Y)-1)/100 + ((Y)-1)/400 )
20829N/A+#define COUNT_DAYS(Y) ( ((Y)-1)*365 + COUNT_LEAPS(Y) )
20829N/A+#define DAYS_BETWEEN_YEARS(A, B) (COUNT_DAYS(B) - COUNT_DAYS(A))
20829N/A+#define LL_ADD(r, a, b) ((r) = (a) + (b))
20829N/A+#define LL_SUB(r, a, b) ((r) = (a) - (b))
20829N/A+ PRInt64 secPerDay, usecPerSec;
20829N/A+ /* Normalize first. Do this on our copy */
20829N/A+ PR_NormalizeTime(©, PR_GMTParameters);
20829N/A+ LL_MUL(temp, temp, secPerDay);
20829N/A+ LL_ADD(numSecs64, numSecs64, temp);
20829N/A+ /* apply the GMT and DST offsets */
20829N/A+ LL_SUB(numSecs64, numSecs64, temp);
20829N/A+ LL_SUB(numSecs64, numSecs64, temp);
20829N/A+ LL_MUL(temp, numSecs64, usecPerSec);
20829N/A #error No PR_ImplodeTime implemented on your platform.
20829N/A@@ -62,6 +62,10 @@ class TimeDelta {
20829N/A+ struct timespec ToTimeSpec() const;
20829N/A // Returns the time delta in some unit. The F versions return a floating
20829N/A // point value, the "regular" versions return a rounded-down value.
20829N/A@@ -224,6 +228,10 @@ class Time {
20829N/A static Time FromDoubleT(double dt);
20829N/A+ struct timeval ToTimeVal() const;
20829N/A static Time FromFileTime(FILETIME ft);
20829N/A@@ -62,11 +62,13 @@ Time Time::FromExploded(bool is_local, const Exploded& exploded) {
20829N/A+#if defined(ANDROID) || defined(OS_SOLARIS)
20829N/A@@ -165,7 +167,7 @@ TimeTicks TimeTicks::Now() {
20829N/A // reported in nanoseconds is enough to last nearly 585 years.
20829N/A- defined(_POSIX_MONOTONIC_CLOCK) && _POSIX_MONOTONIC_CLOCK >= 0
20829N/A+ defined(_POSIX_MONOTONIC_CLOCK) && _POSIX_MONOTONIC_CLOCK >= 0 || defined(OS_SOLARIS)
20829N/A if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) {
20829N/A@@ -189,4 +191,25 @@ TimeTicks TimeTicks::HighResNow() {
20829N/A+struct timespec TimeDelta::ToTimeSpec() const {
20829N/A+ int64 microseconds = InMicroseconds();
20829N/A+ if (microseconds >= Time::kMicrosecondsPerSecond) {
20829N/A+ microseconds -= seconds * Time::kMicrosecondsPerSecond;
20829N/A+ microseconds * Time::kNanosecondsPerMicrosecond};
20829N/A+struct timeval Time::ToTimeVal() const {
20829N/A+ int64 us = us_ - kTimeTToMicrosecondsOffset;
20829N/A@@ -804,7 +804,11 @@ void Comparator::SetSubgroupTiebreaker(Selector selector) {
20829N/A void Comparator::ParseKeyphrase(const std::string key_phrase) {
20829N/A+ static std::map<std::string, Selector> key_map;
20829N/A static std::map<const std::string, Selector> key_map;
20829N/A static bool initialized = false;
20829N/A // This file adds defines about the platform we're currently building on.
20829N/A-// OS_WIN / OS_MACOSX / OS_LINUX / OS_POSIX (MACOSX or LINUX)
20829N/A+// OS_WIN / OS_MACOSX / OS_LINUX / OS_SOLARIS / OS_POSIX (MACOSX or LINUX)
20829N/A-// COMPILER_MSVC / COMPILER_GCC
20829N/A+// COMPILER_MSVC / COMPILER_GCC / COMPILER_SUNPRO
20829N/A // ARCH_CPU_X86 / ARCH_CPU_X86_64 / ARCH_CPU_X86_FAMILY (X86 or X86_64)
20829N/A // ARCH_CPU_32_BITS / ARCH_CPU_64_BITS
20829N/A+#elif defined(__sun__) || defined(__sun)
20829N/A // For access to standard POSIX features, use OS_POSIX instead of a more
20829N/A-#if defined(OS_MACOSX) || defined(OS_LINUX)
20829N/A+#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A+#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
20829N/A // or with gcc, run: "echo | gcc -E -dM -"
20829N/A-#if defined(_M_X64) || defined(__x86_64__)
20829N/A+#if defined(_M_X64) || defined(__x86_64__) || defined(__x86_64)
20829N/A-#elif defined(_M_IX86) || defined(__i386__)
20829N/A+#elif defined(_M_IX86) || defined(__i386__) || defined(__i386)
20829N/A #elif defined(__ppc__) || defined(__powerpc__)
20829N/A+#define ARCH_CPU_SPARC_FAMILY 1
20829N/A+#define ARCH_CPU_SPARC_FAMILY 1
20829N/A@@ -14,7 +14,7 @@ namespace chrome {
20829N/A // for system strings only. UI changes should be made in the GRD.
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A const wchar_t kBrowserProcessExecutableName[] = L"chrome";
20829N/A const wchar_t kBrowserProcessExecutableName[] =
20829N/A@@ -26,7 +26,7 @@ const wchar_t kBrowserProcessExecutableName[] =
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A const wchar_t kBrowserProcessExecutablePath[] = L"chrome";
20829N/A const wchar_t kBrowserProcessExecutablePath[] =
20829N/A@@ -113,7 +113,7 @@ bool PathProvider(int key, FilePath* result) {
20829N/A case chrome::DIR_APP_DICTIONARIES:
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A // We can't write into the EXE dir on Linux, so keep dictionaries
20829N/A // alongside the safe browsing database in the user data dir.
20829N/A if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
20829N/A@@ -92,7 +92,7 @@ class Channel::ChannelImpl : public MessageLoopForIO::Watcher {
20829N/A // This is a control message buffer large enough to hold kMaxReadFDs
20829N/A+#if defined(OS_MACOSX) || defined(OS_SOLARIS)
20829N/A // TODO(agl): OSX appears to have non-constant CMSG macros!
20829N/A@@ -289,7 +289,11 @@ class Message : public Pickle {
20829N/A struct Header : Pickle::Header {
20829N/A int32 routing; // ID of the view that this message is destined for
20829N/A msgid_t type; // specifies the user-defined message type
20829N/A@@ -310,7 +314,11 @@ class Message : public Pickle {
20829N/A-#if !(defined(OS_MACOSX) || defined(OS_WIN) || (defined(CHROMIUM_MOZILLA_BUILD) && defined(OS_LINUX) && defined(ARCH_CPU_64_BITS)))
20829N/A+#if !(defined(OS_MACOSX) || defined(OS_WIN) || (defined(CHROMIUM_MOZILLA_BUILD) && (defined(OS_LINUX) || defined(OS_SOLARIS)) && defined(ARCH_CPU_64_BITS)))
20829N/A // There size_t is a synonym for |unsigned long| ...
20829N/A-#endif // if !(defined(OS_LINUX) && defined(ARCH_CPU_64_BITS))
20829N/A+#endif // if !((defined(OS_LINUX) || defined(OS_SOLARIS)) && defined(ARCH_CPU_64_BITS))
20829N/A // On Linux size_t & uint32 can be the same type.
20829N/A-#if !(defined(CHROMIUM_MOZILLA_BUILD) && defined(OS_LINUX) && defined(ARCH_CPU_64_BITS))
20829N/A+#if !(defined(CHROMIUM_MOZILLA_BUILD) && (defined(OS_LINUX) || defined(OS_SOLARIS)) && defined(ARCH_CPU_64_BITS))
20829N/A // int64 is |long int| on 64-bit systems, uint64 is |unsigned long|
20829N/A #endif // ifndef CHROMIUM_MOZILLA_BUILD
20829N/A-#endif // if !(defined(CHROMIUM_MOZILLA_BUILD) && defined(OS_LINUX) && defined(ARCH_CPU_64_BITS))
20829N/A+#endif // if !(defined(CHROMIUM_MOZILLA_BUILD) && (defined(OS_LINUX) || defined(OS_SOLARIS)) && defined(ARCH_CPU_64_BITS))
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A@@ -29,8 +29,8 @@ struct NativeWebKeyboardEvent : public WebKit::WebKeyboardEvent {
20829N/A NativeWebKeyboardEvent(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
20829N/A explicit NativeWebKeyboardEvent(NSEvent *event);
20829N/A- explicit NativeWebKeyboardEvent(const GdkEventKey* event);
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A+ explicit NativeWebKeyboardEvent(c onst GdkEventKey* event);
20829N/A NativeWebKeyboardEvent(const NativeWebKeyboardEvent& event);
20829N/A@@ -42,7 +42,7 @@ struct NativeWebKeyboardEvent : public WebKit::WebKeyboardEvent {
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A@@ -121,7 +121,7 @@ void AutomationProvider::OnMessageFromExternalHost(
20829N/A //--------------------------------------------------------------------------
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A bool ShellIntegration::SetAsDefaultBrowser() {
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A@@ -70,7 +70,7 @@ class TransportDIB {
20829N/A typedef base::SharedMemoryHandle Handle;
20829N/A // On Mac, the inode number of the backing file is used as an id.
20829N/A typedef base::SharedMemoryId Id;
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A typedef int Handle; // These two ints are SysV IPC shared memory keys
20829N/A@@ -100,7 +100,7 @@ class TransportDIB {
20829N/A // wire to give this transport DIB to another process.
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A // Map the shared memory into the X server and return an id for the shared
20829N/A XID MapToX(Display* connection);
20829N/A@@ -112,7 +112,7 @@ class TransportDIB {
20829N/A explicit TransportDIB(base::SharedMemoryHandle dib);
20829N/A base::SharedMemory shared_memory_;
20829N/A+#elif defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A int key_; // SysV shared memory id
20829N/A void* address_; // mapped address
20829N/A XID x_shm_; // X id for the shared segment
20829N/A /* Define if your system supports the epoll system calls */
20829N/A /* Define to 1 if you have the `epoll_ctl' function. */
20829N/A /* Define if your system supports event ports */
20829N/A@@ -57,7 +57,7 @@ static const char* kBrowserThreadNames[BrowserProcessSubThread::ID_COUNT] = {
20829N/A // "Chrome_FileThread", // FILE
20829N/A // "Chrome_HistoryThread", // HISTORY
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A "Gecko_Background_X11Thread", // BACKGROUND_X11
20829N/A@@ -68,7 +68,7 @@ BrowserProcessSubThread* BrowserProcessSubThread::sBrowserThreads[ID_COUNT] = {
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A+#if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A // This thread has a second connection to the X server and is used
20829N/A // to process UI requests when routing the request to the UI
20829N/A@@ -459,7 +459,7 @@ GeckoChildProcessHost::PerformAsyncLaunch(std::vector<std::string> aExtraOpts, b
20829N/A+# if defined(OS_LINUX) || defined(OS_SOLARIS)
20829N/A int childCrashFd, childCrashRemapFd;
20829N/A if (!CrashReporter::CreateNotificationPipeForChild(
20829N/A &childCrashFd, &childCrashRemapFd))
20829N/A@@ -475,7 +475,7 @@ GeckoChildProcessHost::PerformAsyncLaunch(std::vector<std::string> aExtraOpts, b
20829N/A+# endif // OS_LINUX || defined(OS_SOLARIS)
20829N/A@@ -498,6 +498,8 @@ GeckoChildProcessHost::PerformAsyncLaunch(std::vector<std::string> aExtraOpts, b
20829N/A base::LaunchApp(childArgv, mFileMap,
20829N/A #if defined(OS_LINUX) || defined(OS_MACOSX)
20829N/A #ifndef mozilla_ipc_SharedMemorySysV_h
20829N/A #define mozilla_ipc_SharedMemorySysV_h
20829N/A-#if defined(OS_LINUX) && !defined(ANDROID)
20829N/A+#if (defined(OS_LINUX) || defined(OS_SOLARIS)) && !defined(ANDROID)
20829N/A // SysV shared memory isn't available on Windows, but we define the
20829N/A // following macro so that #ifdefs are clearer (compared to #ifdef
20829N/A // Mark the handle as deleted so that, should this process go away, the
20829N/A+#endif // OS_LINUX || OS_SOLARIS
20829N/A #endif // ifndef mozilla_ipc_SharedMemorySysV_h
20829N/A@@ -87,6 +87,10 @@ ifeq ($(OS_ARCH),Linux)
20829N/A IPDLTESTSRCS = $(addsuffix .cpp,$(IPDLTESTS))
20829N/A IPDLTESTHDRS = $(addprefix $(srcdir)/,$(addsuffix .h,$(IPDLTESTS)))
20829N/A@@ -184,6 +184,8 @@ TestShutdownChild::RecvStart()
20829N/A+extern "C" int madvise(caddr_t, size_t, int);
20829N/A // Size to use for PLArena block allocations.
20829N/A static const size_t ARENA_PAGE_SIZE = 4096;
20829N/A@@ -149,6 +149,7 @@ typedef unsigned int uint32_t;
20829N/A+extern "C" int madvise(caddr_t, size_t, int);
20829N/A+extern "C" int madvise(caddr_t, size_t, int);
20829N/A+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
20829N/A+// Use of this source code is governed by a BSD-style license that can be
20829N/A+// We're trying to transition away from paths as wstrings into using
20829N/A+// FilePath objects. This file contains declarations of deprecated
20829N/A+// functions. By hiding them here rather in the main header, we hope
20829N/A+#ifndef BASE_FILE_UTIL_DEPRECATED_H_
20829N/A+#define BASE_FILE_UTIL_DEPRECATED_H_
20829N/A+bool EndsWithSeparator(std::wstring* path);
20829N/A+bool EndsWithSeparator(const std::wstring& path);
20829N/A+// Use FilePath::DirName instead.
20829N/A+void UpOneDirectory(std::wstring* dir);
20829N/A+// Use FilePath::DirName instead.
20829N/A+void UpOneDirectoryOrEmpty(std::wstring* dir);
20829N/A+// Use FilePath::BaseName instead.
20829N/A+std::wstring GetFilenameFromPath(const std::wstring& path);
20829N/A+// Use FilePath::Extension instead.
20829N/A+FilePath::StringType GetFileExtensionFromPath(const FilePath& path);
20829N/A+std::wstring GetFileExtensionFromPath(const std::wstring& path);
20829N/A+bool AbsolutePath(std::wstring* path);
20829N/A+// Use FilePath::InsertBeforeExtension.
20829N/A+void InsertBeforeExtension(FilePath* path, const FilePath::StringType& suffix);
20829N/A+// Use FilePath::ReplaceExtension.
20829N/A+void ReplaceExtension(FilePath* file_name,
20829N/A+ const FilePath::StringType& extension);
20829N/A+bool Delete(const std::wstring& path, bool recursive);
20829N/A+bool CopyDirectory(const std::wstring& from_path, const std::wstring& to_path,
20829N/A+bool ReadFileToString(const std::wstring& path, std::string* contents);
20829N/A+FILE* OpenFile(const std::string& filename, const char* mode);
20829N/A+FILE* OpenFile(const std::wstring& filename, const char* mode);
20829N/A+int ReadFile(const std::wstring& filename, char* data, int size);
20829N/A+int WriteFile(const std::wstring& filename, const char* data, int size);
20829N/A+// Functions successfully deprecated on non-Windows, but Win-specific
20829N/A+// Returns the directory component of a path, without the trailing
20829N/A+// path separator, or an empty string on error. The function does not
20829N/A+// check for the existence of the path, so if it is passed a directory
20829N/A+// without the trailing \, it will interpret the last component of the
20829N/A+// path as a file and chomp it. This does not support relative paths.
20829N/A+// path == "C:\Windows\system32\", returns "C:\Windows\system32"
20829N/A+// path == "C:\Windows\system32", returns "C:\Windows"
20829N/A+// Deprecated. Use FilePath's DirName() instead.
20829N/A+std::wstring GetDirectoryFromPath(const std::wstring& path);
20829N/A+// Appends new_ending to path, adding a separator between the two if necessary.
20829N/A+void AppendToPath(std::wstring* path, const std::wstring& new_ending);
20829N/A+#endif // BASE_FILE_UTIL_DEPRECATED_H_
20829N/A+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
20829N/A+/* ***** BEGIN LICENSE BLOCK *****
20829N/A+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
20829N/A+ * The contents of this file are subject to the Mozilla Public License Version
20829N/A+ * 1.1 (the "License"); you may not use this file except in compliance with
20829N/A+ * the License. You may obtain a copy of the License at
20829N/A+ * Software distributed under the License is distributed on an "AS IS" basis,
20829N/A+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
20829N/A+ * for the specific language governing rights and limitations under the
20829N/A+ * The Original Code is the Netscape Portable Runtime (NSPR).
20829N/A+ * The Initial Developer of the Original Code is
20829N/A+ * Netscape Communications Corporation.
20829N/A+ * Portions created by the Initial Developer are Copyright (C) 1998-2000
20829N/A+ * the Initial Developer. All Rights Reserved.
20829N/A+ * Alternatively, the contents of this file may be used under the terms of
20829N/A+ * either the GNU General Public License Version 2 or later (the "GPL"), or
20829N/A+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
20829N/A+ * in which case the provisions of the GPL or the LGPL are applicable instead
20829N/A+ * of those above. If you wish to allow use of your version of this file only
20829N/A+ * under the terms of either the GPL or the LGPL, and not to allow others to
20829N/A+ * use your version of this file under the terms of the MPL, indicate your
20829N/A+ * decision by deleting the provisions above and replace them with the notice
20829N/A+ * and other provisions required by the GPL or the LGPL. If you do not delete
20829N/A+ * the provisions above, a recipient may use your version of this file under
20829N/A+ * the terms of any one of the MPL, the GPL or the LGPL.
20829N/A+ * ***** END LICENSE BLOCK ***** */
20829N/A+#define PR_AF_INET6 26 /* same as AF_INET6 */
20829N/A+#if defined(sparc) || defined(__sparc)
20829N/A+#elif defined(i386) || defined(__i386)
20829N/A+#define PR_BYTES_PER_WORD_LOG2 3
20829N/A+#define PR_BYTES_PER_DWORD_LOG2 3
20829N/A+#define PR_BITS_PER_BYTE_LOG2 3
20829N/A+#define PR_BITS_PER_SHORT_LOG2 4
20829N/A+#define PR_BITS_PER_INT64_LOG2 6
20829N/A+#define PR_BITS_PER_LONG_LOG2 6
20829N/A+#define PR_BITS_PER_FLOAT_LOG2 5
20829N/A+#define PR_BITS_PER_DOUBLE_LOG2 6
20829N/A+#define PR_BITS_PER_WORD_LOG2 6
20829N/A+#define PR_BYTES_PER_WORD_LOG2 2
20829N/A+#define PR_BYTES_PER_DWORD_LOG2 3
20829N/A+#define PR_BITS_PER_BYTE_LOG2 3
20829N/A+#define PR_BITS_PER_SHORT_LOG2 4
20829N/A+#define PR_BITS_PER_INT64_LOG2 6
20829N/A+#define PR_BITS_PER_LONG_LOG2 5
20829N/A+#define PR_BITS_PER_FLOAT_LOG2 5
20829N/A+#define PR_BITS_PER_DOUBLE_LOG2 6
20829N/A+#define PR_BITS_PER_WORD_LOG2 5
20829N/A+#define BYTES_PER_BYTE PR_BYTES_PER_BYTE
20829N/A+#define BYTES_PER_SHORT PR_BYTES_PER_SHORT
20829N/A+#define BYTES_PER_INT PR_BYTES_PER_INT
20829N/A+#define BYTES_PER_INT64 PR_BYTES_PER_INT64
20829N/A+#define BYTES_PER_LONG PR_BYTES_PER_LONG
20829N/A+#define BYTES_PER_FLOAT PR_BYTES_PER_FLOAT
20829N/A+#define BYTES_PER_DOUBLE PR_BYTES_PER_DOUBLE
20829N/A+#define BYTES_PER_WORD PR_BYTES_PER_WORD
20829N/A+#define BYTES_PER_DWORD PR_BYTES_PER_DWORD
20829N/A+#define BITS_PER_BYTE PR_BITS_PER_BYTE
20829N/A+#define BITS_PER_SHORT PR_BITS_PER_SHORT
20829N/A+#define BITS_PER_INT PR_BITS_PER_INT
20829N/A+#define BITS_PER_INT64 PR_BITS_PER_INT64
20829N/A+#define BITS_PER_LONG PR_BITS_PER_LONG
20829N/A+#define BITS_PER_FLOAT PR_BITS_PER_FLOAT
20829N/A+#define BITS_PER_DOUBLE PR_BITS_PER_DOUBLE
20829N/A+#define BITS_PER_WORD PR_BITS_PER_WORD
20829N/A+#define BITS_PER_BYTE_LOG2 PR_BITS_PER_BYTE_LOG2
20829N/A+#define BITS_PER_SHORT_LOG2 PR_BITS_PER_SHORT_LOG2
20829N/A+#define BITS_PER_INT_LOG2 PR_BITS_PER_INT_LOG2
20829N/A+#define BITS_PER_INT64_LOG2 PR_BITS_PER_INT64_LOG2
20829N/A+#define BITS_PER_LONG_LOG2 PR_BITS_PER_LONG_LOG2
20829N/A+#define BITS_PER_FLOAT_LOG2 PR_BITS_PER_FLOAT_LOG2
20829N/A+#define BITS_PER_DOUBLE_LOG2 PR_BITS_PER_DOUBLE_LOG2
20829N/A+#define BITS_PER_WORD_LOG2 PR_BITS_PER_WORD_LOG2
20829N/A+#define ALIGN_OF_SHORT PR_ALIGN_OF_SHORT
20829N/A+#define ALIGN_OF_INT PR_ALIGN_OF_INT
20829N/A+#define ALIGN_OF_LONG PR_ALIGN_OF_LONG
20829N/A+#define ALIGN_OF_INT64 PR_ALIGN_OF_INT64
20829N/A+#define ALIGN_OF_FLOAT PR_ALIGN_OF_FLOAT
20829N/A+#define ALIGN_OF_DOUBLE PR_ALIGN_OF_DOUBLE
20829N/A+#define ALIGN_OF_POINTER PR_ALIGN_OF_POINTER
20829N/A+#define ALIGN_OF_WORD PR_ALIGN_OF_WORD
20829N/A+#define BYTES_PER_WORD_LOG2 PR_BYTES_PER_WORD_LOG2
20829N/A+#define BYTES_PER_DWORD_LOG2 PR_BYTES_PER_DWORD_LOG2
20829N/A+#define WORDS_PER_DWORD_LOG2 PR_WORDS_PER_DWORD_LOG2
20829N/A+#endif /* NO_NSPR_10_SUPPORT */
20829N/A+#endif /* ifndef nspr_cpucfg___ */
20829N/A+/* Define if clock_gettime is available in libc */
20829N/A+#define DNS_USE_CPU_CLOCK_FOR_ID 1
20829N/A+/* Define is no secure id variant is available */
20829N/A+/* #undef DNS_USE_GETTIMEOFDAY_FOR_ID */
20829N/A+/* Define to 1 if you have the `clock_gettime' function. */
20829N/A+/* Define if your system supports the epoll system calls */
20829N/A+/* Define to 1 if you have the `epoll_ctl' function. */
20829N/A+/* Define if your system supports event ports */
20829N/A+/* Define to 1 if you have the `fcntl' function. */
20829N/A+/* Define to 1 if you have the `getaddrinfo' function. */
20829N/A+/* Define to 1 if you have the `getnameinfo' function. */
20829N/A+/* Define to 1 if you have the `gettimeofday' function. */
20829N/A+/* Define to 1 if you have the `inet_ntop' function. */
20829N/A+/* Define to 1 if you have the `kqueue' function. */
20829N/A+/* Define to 1 if you have the `nsl' library (-lnsl). */
20829N/A+/* Define to 1 if you have the `resolv' library (-lresolv). */
20829N/A+/* Define to 1 if you have the `rt' library (-lrt). */
20829N/A+/* Define to 1 if you have the `socket' library (-lsocket). */
20829N/A+/* #undef HAVE_NETINET_IN6_H */
20829N/A+/* Define to 1 if you have the `poll' function. */
20829N/A+/* Define to 1 if you have the `port_create' function. */
20829N/A+/* Define to 1 if you have the `select' function. */
20829N/A+/* Define to 1 if you have the `sigaction' function. */
20829N/A+/* Define to 1 if you have the `signal' function. */
20829N/A+/* Define to 1 if you have the `strlcpy' function. */
20829N/A+/* Define to 1 if you have the `strsep' function. */
20829N/A+/* Define to 1 if you have the `strtok_r' function. */
20829N/A+/* Define to 1 if you have the `strtoll' function. */
20829N/A+/* Define to 1 if the system has the type `struct in6_addr'. */
20829N/A+/* Define to 1 if the system has the type `uint16_t'. */
20829N/A+/* Define to 1 if the system has the type `uint32_t'. */
20829N/A+/* Define to 1 if the system has the type `uint64_t'. */
20829N/A+/* Define to 1 if the system has the type `uint8_t'. */
20829N/A+/* Define to 1 if you have the `vasprintf' function. */
20829N/A+/* Define if kqueue works correctly with pipes */
20829N/A+/* #undef HAVE_WORKING_KQUEUE */
20829N/A+/* Define to the address where bug reports for this package should be sent. */
20829N/A+/* Define to the full name of this package. */
20829N/A+/* Define to the full name and version of this package. */
20829N/A+/* Define to the one symbol short name of this package. */
20829N/A+/* Define to the version of this package. */
20829N/A+/* The size of `int', as computed by sizeof. */
20829N/A+/* The size of `long', as computed by sizeof. */
20829N/A+/* The size of `long long', as computed by sizeof. */
20829N/A+/* The size of `short', as computed by sizeof. */
20829N/A+/* Define to 1 if you have the ANSI C header files. */
20829N/A+/* Version number of package */
20829N/A+/* Define to appropriate substitue if compiler doesnt have __func__ */
20829N/A+/* Define to empty if `const' does not conform to ANSI C. */
20829N/A+/* Define to `__inline__' or `__inline' if that's what the C compiler
20829N/A+ calls it, or to nothing if 'inline' is not supported under any name. */
20829N/A+/* Define to unsigned int if you dont have it */