diff options
| author | Giampaolo Rodola <g.rodola@gmail.com> | 2020-01-14 03:09:25 -0800 |
|---|---|---|
| committer | Giampaolo Rodola <g.rodola@gmail.com> | 2020-01-14 03:09:25 -0800 |
| commit | 5140642a7ac95889222cbcc2a8118ca803f0ae3d (patch) | |
| tree | 5b67381b9fa501f0a135234418b8ed0344cdb462 /psutil/arch | |
| parent | bab3a310ab561bfdd01d44b1d2121daac7469e8f (diff) | |
| download | psutil-5140642a7ac95889222cbcc2a8118ca803f0ae3d.tar.gz | |
print/set syscall origin when raising NSP or AD
Diffstat (limited to 'psutil/arch')
| -rw-r--r-- | psutil/arch/freebsd/specific.c | 8 | ||||
| -rw-r--r-- | psutil/arch/netbsd/specific.c | 10 | ||||
| -rw-r--r-- | psutil/arch/openbsd/specific.c | 6 | ||||
| -rw-r--r-- | psutil/arch/osx/process_info.c | 6 | ||||
| -rw-r--r-- | psutil/arch/windows/process_info.c | 2 | ||||
| -rw-r--r-- | psutil/arch/windows/process_utils.c | 4 | ||||
| -rw-r--r-- | psutil/arch/windows/socks.c | 2 |
7 files changed, 19 insertions, 19 deletions
diff --git a/psutil/arch/freebsd/specific.c b/psutil/arch/freebsd/specific.c index bc267acd..90ea81e8 100644 --- a/psutil/arch/freebsd/specific.c +++ b/psutil/arch/freebsd/specific.c @@ -61,7 +61,7 @@ psutil_kinfo_proc(const pid_t pid, struct kinfo_proc *proc) { // sysctl stores 0 in the size if we can't find the process information. if (size == 0) { - NoSuchProcess(""); + NoSuchProcess("sysctl (size = 0)"); return -1; } return 0; @@ -301,7 +301,7 @@ psutil_proc_exe(PyObject *self, PyObject *args) { if (ret == -1) return NULL; else if (ret == 0) - return NoSuchProcess(""); + return NoSuchProcess("psutil_pid_exists"); else strcpy(pathname, ""); } @@ -358,7 +358,7 @@ psutil_proc_threads(PyObject *self, PyObject *args) { goto error; } if (size == 0) { - NoSuchProcess(""); + NoSuchProcess("sysctl (size = 0)"); goto error; } @@ -374,7 +374,7 @@ psutil_proc_threads(PyObject *self, PyObject *args) { goto error; } if (size == 0) { - NoSuchProcess(""); + NoSuchProcess("sysctl (size = 0)"); goto error; } diff --git a/psutil/arch/netbsd/specific.c b/psutil/arch/netbsd/specific.c index 681b2377..62e09325 100644 --- a/psutil/arch/netbsd/specific.c +++ b/psutil/arch/netbsd/specific.c @@ -72,7 +72,7 @@ psutil_kinfo_proc(pid_t pid, kinfo_proc *proc) { } // sysctl stores 0 in the size if we can't find the process information. if (size == 0) { - NoSuchProcess(""); + NoSuchProcess("sysctl (size = 0)"); return -1; } return 0; @@ -139,7 +139,7 @@ psutil_proc_cwd(PyObject *self, PyObject *args) { free(buf); if (len == -1) { if (errno == ENOENT) - NoSuchProcess(""); + NoSuchProcess("readlink (ENOENT)"); else PyErr_SetFromErrno(PyExc_OSError); return NULL; @@ -195,7 +195,7 @@ psutil_proc_exe(PyObject *self, PyObject *args) { if (ret == -1) return NULL; else if (ret == 0) - return NoSuchProcess(""); + return NoSuchProcess("psutil_pid_exists"); else strcpy(pathname, ""); } @@ -247,7 +247,7 @@ psutil_proc_threads(PyObject *self, PyObject *args) { goto error; } if (size == 0) { - NoSuchProcess(""); + NoSuchProcess("sysctl (size = 0)"); goto error; } @@ -264,7 +264,7 @@ psutil_proc_threads(PyObject *self, PyObject *args) { goto error; } if (size == 0) { - NoSuchProcess(""); + NoSuchProcess("sysctl (size = 0)"); goto error; } diff --git a/psutil/arch/openbsd/specific.c b/psutil/arch/openbsd/specific.c index 33ebdeec..f8d3cf96 100644 --- a/psutil/arch/openbsd/specific.c +++ b/psutil/arch/openbsd/specific.c @@ -67,7 +67,7 @@ psutil_kinfo_proc(pid_t pid, struct kinfo_proc *proc) { } // sysctl stores 0 in the size if we can't find the process information. if (size == 0) { - NoSuchProcess(""); + NoSuchProcess("sysctl (size = 0)"); return -1; } return 0; @@ -242,7 +242,7 @@ psutil_proc_threads(PyObject *self, PyObject *args) { kd = kvm_openfiles(0, 0, 0, O_RDONLY, errbuf); if (! kd) { if (strstr(errbuf, "Permission denied") != NULL) - AccessDenied(""); + AccessDenied("kvm_openfiles"); else PyErr_Format(PyExc_RuntimeError, "kvm_openfiles() syscall failed"); goto error; @@ -253,7 +253,7 @@ psutil_proc_threads(PyObject *self, PyObject *args) { sizeof(*kp), &nentries); if (! kp) { if (strstr(errbuf, "Permission denied") != NULL) - AccessDenied(""); + AccessDenied("kvm_getprocs"); else PyErr_Format(PyExc_RuntimeError, "kvm_getprocs() syscall failed"); goto error; diff --git a/psutil/arch/osx/process_info.c b/psutil/arch/osx/process_info.c index 9877fd6b..47cf864f 100644 --- a/psutil/arch/osx/process_info.c +++ b/psutil/arch/osx/process_info.c @@ -167,7 +167,7 @@ psutil_get_cmdline(long pid) { // In case of zombie process we'll get EINVAL. We translate it // to NSP and _psosx.py will translate it to ZP. if ((errno == EINVAL) && (psutil_pid_exists(pid))) - NoSuchProcess(""); + NoSuchProcess("sysctl"); else PyErr_SetFromErrno(PyExc_OSError); goto error; @@ -259,7 +259,7 @@ psutil_get_environ(long pid) { // In case of zombie process we'll get EINVAL. We translate it // to NSP and _psosx.py will translate it to ZP. if ((errno == EINVAL) && (psutil_pid_exists(pid))) - NoSuchProcess(""); + NoSuchProcess("sysctl"); else PyErr_SetFromErrno(PyExc_OSError); goto error; @@ -359,7 +359,7 @@ psutil_get_kinfo_proc(long pid, struct kinfo_proc *kp) { // sysctl succeeds but len is zero, happens when process has gone away if (len == 0) { - NoSuchProcess(""); + NoSuchProcess("sysctl (len == 0)"); return -1; } return 0; diff --git a/psutil/arch/windows/process_info.c b/psutil/arch/windows/process_info.c index 1c5a3c33..64ff0f0d 100644 --- a/psutil/arch/windows/process_info.c +++ b/psutil/arch/windows/process_info.c @@ -636,7 +636,7 @@ psutil_get_proc_info(DWORD pid, PSYSTEM_PROCESS_INFORMATION *retProcess, } } while ((process = PSUTIL_NEXT_PROCESS(process))); - NoSuchProcess(""); + NoSuchProcess("NtQuerySystemInformation (no PID found)"); goto error; error: diff --git a/psutil/arch/windows/process_utils.c b/psutil/arch/windows/process_utils.c index fd516bea..f6867ca1 100644 --- a/psutil/arch/windows/process_utils.c +++ b/psutil/arch/windows/process_utils.c @@ -142,7 +142,7 @@ psutil_check_phandle(HANDLE hProcess, DWORD pid) { return hProcess; } else if (ret == 0) { - return NoSuchProcess(""); + return NoSuchProcess("psutil_is_phandle_running"); } else if (ret == -1) { if (GetLastError() == ERROR_ACCESS_DENIED) @@ -169,7 +169,7 @@ psutil_handle_from_pid(DWORD pid, DWORD access) { if (pid == 0) { // otherwise we'd get NoSuchProcess - return AccessDenied(""); + return AccessDenied("automatically set for PID 0"); } // needed for GetExitCodeProcess access |= PROCESS_QUERY_LIMITED_INFORMATION; diff --git a/psutil/arch/windows/socks.c b/psutil/arch/windows/socks.c index b316ddb8..5272e127 100644 --- a/psutil/arch/windows/socks.c +++ b/psutil/arch/windows/socks.c @@ -151,7 +151,7 @@ psutil_net_connections(PyObject *self, PyObject *args) { pid_return = psutil_pid_is_running(pid); if (pid_return == 0) { psutil_conn_decref_objs(); - return NoSuchProcess(""); + return NoSuchProcess("psutil_pid_is_running"); } else if (pid_return == -1) { psutil_conn_decref_objs(); |
