Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4193)

Unified Diff: base/process/process_info_linux.cc

Issue 21302005: Add CurrentProcessInfo::CreationTime() for Linux (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/base.gypi ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process/process_info_linux.cc
diff --git a/base/process/process_info_win.cc b/base/process/process_info_linux.cc
similarity index 58%
copy from base/process/process_info_win.cc
copy to base/process/process_info_linux.cc
index 5290b760c8ad62c40724c26185d2c22503ccb380..23998ce0632613972bfa3c795aa6a16182a3d6dd 100644
--- a/base/process/process_info_win.cc
+++ b/base/process/process_info_linux.cc
@@ -1,27 +1,28 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/process/process_info.h"
-#include <windows.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
#include "base/basictypes.h"
+#include "base/logging.h"
#include "base/time/time.h"
namespace {
using base::Time;
-// Returns the process creation time, or NULL if an error occurred.
Time* ProcessCreationTimeInternal() {
- FILETIME creation_time = {};
- FILETIME ignore = {};
- if (::GetProcessTimes(::GetCurrentProcess(), &creation_time, &ignore,
- &ignore, &ignore) == false)
+ struct stat result;
+ int rv = stat("/proc/self", &result);
+ DCHECK(!rv);
+ if (rv)
return NULL;
-
- return new Time(Time::FromFileTime(creation_time));
+ return new Time(Time::FromTimeT(result.st_ctime));
willchan no longer on Chromium 2013/07/31 05:01:07 Uh, what's freeing this memory?
James Simonsen 2013/08/02 01:31:40 Nobody. It's a singleton. Are you implying I chan
willchan no longer on Chromium 2013/08/02 05:51:53 No, I screwed up. I thought ProcessCreationTimeInt
}
} // namespace
« no previous file with comments | « base/base.gypi ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698