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

Unified Diff: third_party/psutil/psutil/arch/bsd/process_info.c

Issue 8159001: Update third_party/psutil and fix the licence issue with it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove the suppression and unnecessary files. Created 9 years, 2 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
Index: third_party/psutil/psutil/arch/bsd/process_info.c
diff --git a/third_party/psutil/psutil/arch/bsd/process_info.c b/third_party/psutil/psutil/arch/bsd/process_info.c
index 64004c9307998ab83a21966a087e06727ad5959f..d3006461db7226da8f19425529d3919dcfe9ba3b 100644
--- a/third_party/psutil/psutil/arch/bsd/process_info.c
+++ b/third_party/psutil/psutil/arch/bsd/process_info.c
@@ -1,5 +1,9 @@
/*
- * $Id: process_info.c 772 2010-11-03 13:51:11Z g.rodola $
+ * $Id: process_info.c 1142 2011-10-05 18:45:49Z g.rodola $
+ *
+ * Copyright (c) 2009, Jay Loden, Giampaolo Rodola'. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
*
* Helper functions related to fetching process information. Used by _psutil_bsd
* module methods.
@@ -242,3 +246,25 @@ get_arg_list(long pid)
return retlist;
}
+
+/*
+ * Return 1 if PID exists in the current process list, else 0.
+ */
+int
+pid_exists(long pid)
+{
+ int kill_ret;
+ if (pid < 0) {
+ return 0;
+ }
+
+ // if kill returns success of permission denied we know it's a valid PID
+ kill_ret = kill(pid , 0);
+ if ((0 == kill_ret) || (EPERM == errno)) {
+ return 1;
+ }
+
+ // otherwise return 0 for PID not found
+ return 0;
+}
+
« no previous file with comments | « third_party/psutil/psutil/arch/bsd/process_info.h ('k') | third_party/psutil/psutil/arch/mswindows/ntextapi.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698