| Index: base/logging.cc
|
| diff --git a/base/logging.cc b/base/logging.cc
|
| index cea6edae4a37cef2519ff32045c46c0a3c73e4d0..aaf5c0f9f1f443ea906c7d101dcd37b42e858fcd 100644
|
| --- a/base/logging.cc
|
| +++ b/base/logging.cc
|
| @@ -46,6 +46,14 @@ typedef FILE* FileHandle;
|
| typedef pthread_mutex_t* MutexHandle;
|
| #endif
|
|
|
| +#if defined(OS_FUCHSIA)
|
| +#include <magenta/syscalls.h>
|
| +#include <threads.h>
|
| +#include <unistd.h>
|
| +typedef FILE* FileHandle;
|
| +typedef mtx_t MutexHandle;
|
| +#endif
|
| +
|
| #include <algorithm>
|
| #include <cstring>
|
| #include <ctime>
|
| @@ -67,7 +75,7 @@ typedef pthread_mutex_t* MutexHandle;
|
| #include "base/synchronization/lock_impl.h"
|
| #include "base/threading/platform_thread.h"
|
| #include "base/vlog.h"
|
| -#if defined(OS_POSIX)
|
| +#if defined(OS_POSIX) || defined(OS_FUCHSIA)
|
| #include "base/posix/safe_strerror.h"
|
| #endif
|
|
|
| @@ -131,7 +139,7 @@ LogMessageHandlerFunction log_message_handler = nullptr;
|
| int32_t CurrentProcessId() {
|
| #if defined(OS_WIN)
|
| return GetCurrentProcessId();
|
| -#elif defined(OS_POSIX)
|
| +#elif defined(OS_POSIX) || defined(OS_FUCHSIA)
|
| return getpid();
|
| #endif
|
| }
|
| @@ -153,6 +161,8 @@ uint64_t TickCount() {
|
| static_cast<int64_t>(ts.tv_nsec) / 1000;
|
|
|
| return absolute_micro;
|
| +#elif defined(OS_FUCHSIA)
|
| + return mx_time_get(MX_CLOCK_MONOTONIC) / 1000;
|
| #endif
|
| }
|
|
|
| @@ -178,7 +188,7 @@ PathString GetDefaultLogFile() {
|
| log_name.erase(last_backslash + 1);
|
| log_name += L"debug.log";
|
| return log_name;
|
| -#elif defined(OS_POSIX)
|
| +#elif defined(OS_POSIX) || defined(OS_FUCHSIA)
|
| // On other platforms we just use the current directory.
|
| return PathString("debug.log");
|
| #endif
|
| @@ -830,7 +840,7 @@ typedef DWORD SystemErrorCode;
|
| SystemErrorCode GetLastSystemErrorCode() {
|
| #if defined(OS_WIN)
|
| return ::GetLastError();
|
| -#elif defined(OS_POSIX)
|
| +#elif defined(OS_POSIX) || defined(OS_FUCHSIA)
|
| return errno;
|
| #else
|
| #error Not implemented
|
| @@ -852,7 +862,7 @@ BASE_EXPORT std::string SystemErrorCodeToString(SystemErrorCode error_code) {
|
| return base::StringPrintf("Error (0x%X) while retrieving error. (0x%X)",
|
| GetLastError(), error_code);
|
| }
|
| -#elif defined(OS_POSIX)
|
| +#elif defined(OS_POSIX) || defined(OS_FUCHSIA)
|
| BASE_EXPORT std::string SystemErrorCodeToString(SystemErrorCode error_code) {
|
| return base::safe_strerror(error_code);
|
| }
|
|
|