summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola' <g.rodola@gmail.com>2013-03-16 14:24:16 +0000
committerGiampaolo Rodola' <g.rodola@gmail.com>2013-03-16 14:24:16 +0000
commit916385f46d666fbcfab3847155b8af101cdd6d92 (patch)
treea9423fe50f3be94255cb7568f7caab556dd69906
parent106247bce431e49125db4d00d6daebe7d1fe430b (diff)
parentc1293b9de1f5a2d548ce3d7dd1ac87c8120bd644 (diff)
downloadpsutil-916385f46d666fbcfab3847155b8af101cdd6d92.tar.gz
merge heads
-rw-r--r--psutil/_psutil_osx.c28
-rw-r--r--psutil/arch/osx/process_info.c16
-rw-r--r--psutil/arch/osx/process_info.h10
3 files changed, 27 insertions, 27 deletions
diff --git a/psutil/_psutil_osx.c b/psutil/_psutil_osx.c
index 10a733e5..fed7760a 100644
--- a/psutil/_psutil_osx.c
+++ b/psutil/_psutil_osx.c
@@ -81,7 +81,7 @@ get_pid_list(PyObject* self, PyObject* args)
if (retlist == NULL)
return NULL;
- if (get_proc_list(&proclist, &num_processes) != 0) {
+ if (psutil_get_proc_list(&proclist, &num_processes) != 0) {
PyErr_SetString(PyExc_RuntimeError, "failed to retrieve process list.");
goto error;
}
@@ -122,7 +122,7 @@ get_process_name(PyObject* self, PyObject* args)
if (! PyArg_ParseTuple(args, "l", &pid)) {
return NULL;
}
- if (get_kinfo_proc(pid, &kp) == -1) {
+ if (psutil_get_kinfo_proc(pid, &kp) == -1) {
return NULL;
}
return Py_BuildValue("s", kp.kp_proc.p_comm);
@@ -166,7 +166,7 @@ get_process_exe(PyObject* self, PyObject* args)
}
ret = proc_pidpath(pid, &buf, sizeof(buf));
if (ret == 0) {
- if (! pid_exists(pid)) {
+ if (! psutil_pid_exists(pid)) {
return NoSuchProcess();
}
else {
@@ -190,7 +190,7 @@ get_process_cmdline(PyObject* self, PyObject* args)
}
// get the commandline, defined in arch/osx/process_info.c
- arglist = get_arg_list(pid);
+ arglist = psutil_get_arg_list(pid);
return arglist;
}
@@ -206,7 +206,7 @@ get_process_ppid(PyObject* self, PyObject* args)
if (! PyArg_ParseTuple(args, "l", &pid)) {
return NULL;
}
- if (get_kinfo_proc(pid, &kp) == -1) {
+ if (psutil_get_kinfo_proc(pid, &kp) == -1) {
return NULL;
}
return Py_BuildValue("l", (long)kp.kp_eproc.e_ppid);
@@ -224,7 +224,7 @@ get_process_uids(PyObject* self, PyObject* args)
if (! PyArg_ParseTuple(args, "l", &pid)) {
return NULL;
}
- if (get_kinfo_proc(pid, &kp) == -1) {
+ if (psutil_get_kinfo_proc(pid, &kp) == -1) {
return NULL;
}
return Py_BuildValue("lll", (long)kp.kp_eproc.e_pcred.p_ruid,
@@ -244,7 +244,7 @@ get_process_gids(PyObject* self, PyObject* args)
if (! PyArg_ParseTuple(args, "l", &pid)) {
return NULL;
}
- if (get_kinfo_proc(pid, &kp) == -1) {
+ if (psutil_get_kinfo_proc(pid, &kp) == -1) {
return NULL;
}
return Py_BuildValue("lll", (long)kp.kp_eproc.e_pcred.p_rgid,
@@ -264,7 +264,7 @@ get_process_tty_nr(PyObject* self, PyObject* args)
if (! PyArg_ParseTuple(args, "l", &pid)) {
return NULL;
}
- if (get_kinfo_proc(pid, &kp) == -1) {
+ if (psutil_get_kinfo_proc(pid, &kp) == -1) {
return NULL;
}
return Py_BuildValue("i", kp.kp_eproc.e_tdev);
@@ -302,7 +302,7 @@ get_process_memory_maps(PyObject* self, PyObject* args)
err = task_for_pid(mach_task_self(), pid, &task);
if (err != KERN_SUCCESS) {
- if (! pid_exists(pid)) {
+ if (! psutil_pid_exists(pid)) {
NoSuchProcess();
}
else {
@@ -473,7 +473,7 @@ get_process_create_time(PyObject* self, PyObject* args)
if (! PyArg_ParseTuple(args, "l", &pid)) {
return NULL;
}
- if (get_kinfo_proc(pid, &kp) == -1) {
+ if (psutil_get_kinfo_proc(pid, &kp) == -1) {
return NULL;
}
return Py_BuildValue("d", TV2DOUBLE(kp.kp_proc.p_starttime));
@@ -870,7 +870,7 @@ get_process_status(PyObject* self, PyObject* args)
if (! PyArg_ParseTuple(args, "l", &pid)) {
return NULL;
}
- if (get_kinfo_proc(pid, &kp) == -1) {
+ if (psutil_get_kinfo_proc(pid, &kp) == -1) {
return NULL;
}
return Py_BuildValue("i", (int)kp.kp_proc.p_stat);
@@ -908,7 +908,7 @@ get_process_threads(PyObject* self, PyObject* args)
// task_for_pid() requires special privileges
err = task_for_pid(mach_task_self(), pid, &task);
if (err != KERN_SUCCESS) {
- if (! pid_exists(pid)) {
+ if (! psutil_pid_exists(pid)) {
NoSuchProcess();
}
else {
@@ -1092,7 +1092,7 @@ error:
if (errno != 0) {
return PyErr_SetFromErrno(PyExc_OSError);
}
- else if (! pid_exists(pid)) {
+ else if (! psutil_pid_exists(pid)) {
return NoSuchProcess();
}
else {
@@ -1351,7 +1351,7 @@ error:
if (errno != 0) {
return PyErr_SetFromErrno(PyExc_OSError);
}
- else if (! pid_exists(pid) ) {
+ else if (! psutil_pid_exists(pid) ) {
return NoSuchProcess();
}
else {
diff --git a/psutil/arch/osx/process_info.c b/psutil/arch/osx/process_info.c
index 3784a778..0a95fcea 100644
--- a/psutil/arch/osx/process_info.c
+++ b/psutil/arch/osx/process_info.c
@@ -26,7 +26,7 @@
* Return 1 if PID exists in the current process list, else 0.
*/
int
-pid_exists(long pid)
+psutil_pid_exists(long pid)
{
int kill_ret;
@@ -56,7 +56,7 @@ pid_exists(long pid)
* On error, the function returns a BSD errno value.
*/
int
-get_proc_list(kinfo_proc **procList, size_t *procCount)
+psutil_get_proc_list(kinfo_proc **procList, size_t *procCount)
{
/* Declaring mib as const requires use of a cast since the
* sysctl prototype doesn't include the const modifier. */
@@ -123,7 +123,7 @@ get_proc_list(kinfo_proc **procList, size_t *procCount)
/* Read the maximum argument size for processes */
int
-get_argmax()
+psutil_get_argmax()
{
int argmax;
int mib[] = { CTL_KERN, KERN_ARGMAX };
@@ -138,7 +138,7 @@ get_argmax()
/* return process args as a python list */
PyObject*
-get_arg_list(long pid)
+psutil_get_arg_list(long pid)
{
int mib[3];
int nargs;
@@ -157,7 +157,7 @@ get_arg_list(long pid)
}
/* read argmax and allocate memory for argument space. */
- argmax = get_argmax();
+ argmax = psutil_get_argmax();
if (! argmax) {
PyErr_SetFromErrno(PyExc_OSError);
goto error;
@@ -175,7 +175,7 @@ get_arg_list(long pid)
mib[2] = pid;
if (sysctl(mib, 3, procargs, &argmax, NULL, 0) < 0) {
if (EINVAL == errno) { // invalid == access denied OR nonexistent PID
- if ( pid_exists(pid) ) {
+ if ( psutil_pid_exists(pid) ) {
AccessDenied();
} else {
NoSuchProcess();
@@ -236,7 +236,7 @@ error:
int
-get_kinfo_proc(pid_t pid, struct kinfo_proc *kp)
+psutil_get_kinfo_proc(pid_t pid, struct kinfo_proc *kp)
{
int mib[4];
size_t len;
@@ -274,7 +274,7 @@ psutil_proc_pidinfo(long pid, int flavor, void *pti, int size)
{
int ret = proc_pidinfo((int)pid, flavor, 0, pti, size);
if (ret == 0) {
- if (! pid_exists(pid)) {
+ if (! psutil_pid_exists(pid)) {
NoSuchProcess();
return 0;
}
diff --git a/psutil/arch/osx/process_info.h b/psutil/arch/osx/process_info.h
index 78fb3705..4037b30d 100644
--- a/psutil/arch/osx/process_info.h
+++ b/psutil/arch/osx/process_info.h
@@ -12,9 +12,9 @@
typedef struct kinfo_proc kinfo_proc;
-int get_proc_list(kinfo_proc **procList, size_t *procCount);
-int get_kinfo_proc(pid_t pid, struct kinfo_proc *kp);
-int get_argmax(void);
-int pid_exists(long pid);
+int psutil_get_proc_list(kinfo_proc **procList, size_t *procCount);
+int psutil_get_kinfo_proc(pid_t pid, struct kinfo_proc *kp);
+int psutil_get_argmax(void);
+int psutil_pid_exists(long pid);
int psutil_proc_pidinfo(long pid, int flavor, void *pti, int size);
-PyObject* get_arg_list(long pid);
+PyObject* psutil_get_arg_list(long pid);