diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-04-09 17:53:07 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-04-17 10:44:35 +0000 |
commit | 3ffaed019d0772e59d6cdb2d0d32fe4834c31f72 (patch) | |
tree | 6d5ce3a8656c327c767b7b5fc112fb45ad3851f2 /gn/util | |
parent | f72214e77a7392dd062812c1eea4e7339b3ffa30 (diff) | |
download | qtwebengine-chromium-3ffaed019d0772e59d6cdb2d0d32fe4834c31f72.tar.gz |
BASELINE: Update GN
Change-Id: Ie794eb9f8e5c17c6caea72b89ce954c7ad772eaa
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'gn/util')
-rw-r--r-- | gn/util/exe_path.cc | 15 | ||||
-rw-r--r-- | gn/util/semaphore.cc | 2 | ||||
-rw-r--r-- | gn/util/semaphore.h | 4 | ||||
-rw-r--r-- | gn/util/ticks.cc | 8 |
4 files changed, 22 insertions, 7 deletions
diff --git a/gn/util/exe_path.cc b/gn/util/exe_path.cc index f2adab52bcb..2f80d5a1fa1 100644 --- a/gn/util/exe_path.cc +++ b/gn/util/exe_path.cc @@ -13,6 +13,9 @@ #include <mach-o/dyld.h> #elif defined(OS_WIN) #include <windows.h> +#elif defined(OS_FREEBSD) +#include <sys/sysctl.h> +#include <sys/types.h> #endif #if defined(OS_MACOSX) @@ -46,6 +49,18 @@ base::FilePath GetExePath() { return base::FilePath(system_buffer); } +#elif defined(OS_FREEBSD) + +base::FilePath GetExePath() { + int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 }; + char buf[PATH_MAX]; + size_t buf_size = PATH_MAX; + if (sysctl(mib, 4, buf, &buf_size, nullptr, 0) == -1) { + return base::FilePath(); + } + return base::FilePath(buf); +} + #else base::FilePath GetExePath() { diff --git a/gn/util/semaphore.cc b/gn/util/semaphore.cc index 2ae7b7b69c0..d5c82be0738 100644 --- a/gn/util/semaphore.cc +++ b/gn/util/semaphore.cc @@ -36,7 +36,7 @@ void Semaphore::Wait() { } } -#elif defined(OS_LINUX) || defined(OS_AIX) +#elif defined(OS_POSIX) Semaphore::Semaphore(int count) { DCHECK_GE(count, 0); diff --git a/gn/util/semaphore.h b/gn/util/semaphore.h index 2de27594311..92a1df6453f 100644 --- a/gn/util/semaphore.h +++ b/gn/util/semaphore.h @@ -15,7 +15,7 @@ #include <windows.h> #elif defined(OS_MACOSX) #include <mach/mach.h> -#elif defined(OS_LINUX) || defined(OS_AIX) +#elif defined(OS_POSIX) #include <semaphore.h> #else #error Port. @@ -35,7 +35,7 @@ class Semaphore { #if defined(OS_MACOSX) typedef semaphore_t NativeHandle; -#elif defined(OS_LINUX) || defined(OS_AIX) +#elif defined(OS_POSIX) typedef sem_t NativeHandle; #elif defined(OS_WIN) typedef HANDLE NativeHandle; diff --git a/gn/util/ticks.cc b/gn/util/ticks.cc index 2a90c90e310..f26b5d80960 100644 --- a/gn/util/ticks.cc +++ b/gn/util/ticks.cc @@ -11,7 +11,7 @@ #include <windows.h> #elif defined(OS_MACOSX) #include <mach/mach_time.h> -#elif defined(OS_LINUX) || defined(OS_AIX) +#elif defined(OS_POSIX) #include <time.h> #else #error Port. @@ -27,7 +27,7 @@ LARGE_INTEGER g_start; #elif defined(OS_MACOSX) mach_timebase_info_data_t g_timebase; uint64_t g_start; -#elif defined(OS_LINUX) || defined(OS_AIX) +#elif defined(OS_POSIX) uint64_t g_start; #else #error Port. @@ -44,7 +44,7 @@ void Init() { #elif defined(OS_MACOSX) mach_timebase_info(&g_timebase); g_start = (mach_absolute_time() * g_timebase.numer) / g_timebase.denom; -#elif defined(OS_LINUX) || defined(OS_AIX) +#elif defined(OS_POSIX) struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); g_start = static_cast<uint64_t>(ts.tv_sec) * kNano + @@ -74,7 +74,7 @@ Ticks TicksNow() { #elif defined(OS_MACOSX) now = ((mach_absolute_time() * g_timebase.numer) / g_timebase.denom) - g_start; -#elif defined(OS_LINUX) || defined(OS_AIX) +#elif defined(OS_POSIX) struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); now = (static_cast<uint64_t>(ts.tv_sec) * kNano + |