Differential D18757 Diff 52594 www/qt5-webengine/files/patch-src_3rdparty_chromium_base_process_process__info__linux.cc
Changeset View
Changeset View
Standalone View
Standalone View
www/qt5-webengine/files/patch-src_3rdparty_chromium_base_process_process__info__linux.cc
--- src/3rdparty/chromium/base/process/process_info_linux.cc.orig 2017-01-26 00:49:07 UTC | --- src/3rdparty/chromium/base/process/process_info_linux.cc.orig 2018-11-13 18:25:11 UTC | ||||
+++ src/3rdparty/chromium/base/process/process_info_linux.cc | +++ src/3rdparty/chromium/base/process/process_info_linux.cc | ||||
@@ -11,10 +11,28 @@ | @@ -11,10 +11,28 @@ | ||||
#include "base/process/process_handle.h" | #include "base/process/process_handle.h" | ||||
#include "base/time/time.h" | #include "base/time/time.h" | ||||
+#if defined(__FreeBSD__) || defined(__DragonFly__) | +#if defined(__FreeBSD__) || defined(__DragonFly__) | ||||
+#include <sys/types.h> | +#include <sys/types.h> | ||||
+#include <sys/sysctl.h> | +#include <sys/sysctl.h> | ||||
+#include <sys/user.h> | +#include <sys/user.h> | ||||
+#endif | +#endif | ||||
+ | + | ||||
namespace base { | namespace base { | ||||
// static | // static | ||||
const Time CurrentProcessInfo::CreationTime() { | const Time CurrentProcessInfo::CreationTime() { | ||||
+#if defined(__FreeBSD__) || defined(__DragonFly__) | +#if defined(__FreeBSD__) || defined(__DragonFly__) | ||||
+ int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid() }; | + int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid() }; | ||||
+ struct kinfo_proc proc; | + struct kinfo_proc proc; | ||||
+ size_t len = sizeof(struct kinfo_proc); | + size_t len = sizeof(struct kinfo_proc); | ||||
+ if (sysctl(mib, arraysize(mib), &proc, &len, NULL, 0) < 0) | + if (sysctl(mib, arraysize(mib), &proc, &len, NULL, 0) < 0) | ||||
+ return Time(); | + return Time(); | ||||
+#if defined(__DragonFly__) | +#if defined(__DragonFly__) | ||||
+ return Time::FromTimeVal(proc.kp_start); | + return Time::FromTimeVal(proc.kp_start); | ||||
+#else | +#else | ||||
+ return Time::FromTimeVal(proc.ki_start); | + return Time::FromTimeVal(proc.ki_start); | ||||
+#endif | +#endif | ||||
+#else | +#else | ||||
ProcessHandle pid = GetCurrentProcessHandle(); | |||||
int64_t start_ticks = | int64_t start_ticks = | ||||
internal::ReadProcStatsAndGetFieldAsInt64(pid, internal::VM_STARTTIME); | internal::ReadProcSelfStatsAndGetFieldAsInt64(internal::VM_STARTTIME); | ||||
@@ -23,6 +41,7 @@ const Time CurrentProcessInfo::CreationT | if (!start_ticks) | ||||
Time boot_time = internal::GetBootTime(); | @@ -24,6 +42,7 @@ const Time CurrentProcessInfo::CreationTime() { | ||||
DCHECK(!boot_time.is_null()); | if (boot_time.is_null()) | ||||
return Time(); | |||||
return Time(boot_time + start_offset); | return Time(boot_time + start_offset); | ||||
+#endif | +#endif | ||||
} | } | ||||
} // namespace base | } // namespace base |