summaryrefslogtreecommitdiff
path: root/psutil
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2016-10-05 01:47:50 +0200
committerGiampaolo Rodola <g.rodola@gmail.com>2016-10-05 01:47:50 +0200
commita0eebb5450f94cefaaa8ba0bfa8db31134cd0536 (patch)
treec7fff8ce3b163ca231cf686e53f6afb6d72a3281 /psutil
parent9ee4e8313834eff0660894fc580c69c0f27c8348 (diff)
downloadpsutil-a0eebb5450f94cefaaa8ba0bfa8db31134cd0536.tar.gz
refactor osx code
Diffstat (limited to 'psutil')
-rw-r--r--psutil/_psutil_osx.c14
-rw-r--r--psutil/arch/osx/process_info.c32
-rw-r--r--psutil/arch/osx/process_info.h1
3 files changed, 0 insertions, 47 deletions
diff --git a/psutil/_psutil_osx.c b/psutil/_psutil_osx.c
index b78035e6..050b9fd0 100644
--- a/psutil/_psutil_osx.c
+++ b/psutil/_psutil_osx.c
@@ -67,20 +67,6 @@ psutil_sys_vminfo(vm_statistics_data_t *vmstat) {
/*
- * Set exception to AccessDenied if pid exists else NoSuchProcess.
- */
-void
-psutil_raise_ad_or_nsp(long pid) {
- int ret;
- ret = psutil_pid_exists(pid);
- if (ret == 0)
- NoSuchProcess();
- else
- AccessDenied();
-}
-
-
-/*
* Return a Python list of all the PIDs running on the system.
*/
static PyObject *
diff --git a/psutil/arch/osx/process_info.c b/psutil/arch/osx/process_info.c
index 4c4ec88d..16de2b8f 100644
--- a/psutil/arch/osx/process_info.c
+++ b/psutil/arch/osx/process_info.c
@@ -24,38 +24,6 @@
/*
- * Return 1 if PID exists in the current process list, else 0, -1
- * on error.
- * TODO: this should live in _psutil_posix.c but for some reason if I
- * move it there I get a "include undefined symbol" error.
- */
-int
-psutil_pid_exists(long pid) {
- int ret;
- if (pid < 0)
- return 0;
- ret = kill(pid , 0);
- if (ret == 0)
- return 1;
- else {
- return 0;
- /*
- // This is how it is handled on other POSIX systems but it causes
- // test_halfway_terminated test to fail with AccessDenied.
- if (ret == ESRCH)
- return 0;
- else if (ret == EPERM)
- return 1;
- else {
- PyErr_SetFromErrno(PyExc_OSError);
- return -1;
- }
- */
- }
-}
-
-
-/*
* Returns a list of all BSD processes on the system. This routine
* allocates the list and puts it in *procList and a count of the
* number of entries in *procCount. You are responsible for freeing
diff --git a/psutil/arch/osx/process_info.h b/psutil/arch/osx/process_info.h
index 8bc10ec1..ec6e0f75 100644
--- a/psutil/arch/osx/process_info.h
+++ b/psutil/arch/osx/process_info.h
@@ -11,7 +11,6 @@ typedef struct kinfo_proc kinfo_proc;
int psutil_get_argmax(void);
int psutil_get_kinfo_proc(pid_t pid, struct kinfo_proc *kp);
int psutil_get_proc_list(kinfo_proc **procList, size_t *procCount);
-int psutil_pid_exists(long pid);
int psutil_proc_pidinfo(long pid, int flavor, void *pti, int size);
PyObject* psutil_get_cmdline(long pid);
PyObject* psutil_get_environ(long pid);