aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrobot-piglet <robot-piglet@yandex-team.com>2024-11-01 13:54:19 +0300
committerrobot-piglet <robot-piglet@yandex-team.com>2024-11-01 14:04:17 +0300
commite42e79626dbffb8764a75cb3ed9959fd6a4efc28 (patch)
tree2ee89f3b3c71b92dc224f0de2a2ff9658f83ec94
parentac1a5780f758fa4c1d47fb64dfdc68e782941ad3 (diff)
downloadydb-e42e79626dbffb8764a75cb3ed9959fd6a4efc28.tar.gz
Intermediate changes
commit_hash:1d613636857a58335914ab92cd9f66a38d1be0a8
-rw-r--r--contrib/python/psutil/py3/.dist-info/METADATA28
-rw-r--r--contrib/python/psutil/py3/psutil/__init__.py49
-rw-r--r--contrib/python/psutil/py3/psutil/_psaix.py4
-rw-r--r--contrib/python/psutil/py3/psutil/_psbsd.py4
-rw-r--r--contrib/python/psutil/py3/psutil/_pslinux.py9
-rw-r--r--contrib/python/psutil/py3/psutil/_psosx.py2
-rw-r--r--contrib/python/psutil/py3/psutil/_pssunos.py2
-rw-r--r--contrib/python/psutil/py3/psutil/_psutil_common.c2
-rw-r--r--contrib/python/psutil/py3/psutil/_psutil_common.h2
-rw-r--r--contrib/python/psutil/py3/psutil/_psutil_linux.c4
-rw-r--r--contrib/python/psutil/py3/psutil/_psutil_osx.c4
-rw-r--r--contrib/python/psutil/py3/psutil/_psutil_posix.c10
-rw-r--r--contrib/python/psutil/py3/psutil/_psutil_windows.c4
-rw-r--r--contrib/python/psutil/py3/psutil/_pswindows.py6
-rw-r--r--contrib/python/psutil/py3/psutil/arch/linux/net.c4
-rw-r--r--contrib/python/psutil/py3/psutil/arch/osx/cpu.c2
-rw-r--r--contrib/python/psutil/py3/psutil/arch/osx/proc.c17
-rw-r--r--contrib/python/psutil/py3/psutil/arch/windows/proc.c20
-rw-r--r--contrib/python/psutil/py3/psutil/arch/windows/proc_handles.c18
-rw-r--r--contrib/python/psutil/py3/psutil/arch/windows/proc_info.c8
-rw-r--r--contrib/python/psutil/py3/psutil/arch/windows/proc_utils.c6
-rw-r--r--contrib/python/psutil/py3/psutil/arch/windows/security.c12
-rw-r--r--contrib/python/psutil/py3/psutil/arch/windows/services.c22
-rw-r--r--contrib/python/psutil/py3/psutil/arch/windows/sys.c14
-rw-r--r--contrib/python/psutil/py3/psutil/arch/windows/wmi.c4
-rw-r--r--contrib/python/psutil/py3/ya.make4
26 files changed, 165 insertions, 96 deletions
diff --git a/contrib/python/psutil/py3/.dist-info/METADATA b/contrib/python/psutil/py3/.dist-info/METADATA
index 193553c957..0c277d56c8 100644
--- a/contrib/python/psutil/py3/.dist-info/METADATA
+++ b/contrib/python/psutil/py3/.dist-info/METADATA
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: psutil
-Version: 6.0.0
+Version: 6.1.0
Summary: Cross-platform lib for process and system monitoring in Python.
Home-page: https://github.com/giampaolo/psutil
Author: Giampaolo Rodola
@@ -55,12 +55,28 @@ Classifier: Topic :: Utilities
Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*
Description-Content-Type: text/x-rst
License-File: LICENSE
+Provides-Extra: dev
+Requires-Dist: black ; extra == 'dev'
+Requires-Dist: check-manifest ; extra == 'dev'
+Requires-Dist: coverage ; extra == 'dev'
+Requires-Dist: packaging ; extra == 'dev'
+Requires-Dist: pylint ; extra == 'dev'
+Requires-Dist: pyperf ; extra == 'dev'
+Requires-Dist: pypinfo ; extra == 'dev'
+Requires-Dist: pytest-cov ; extra == 'dev'
+Requires-Dist: requests ; extra == 'dev'
+Requires-Dist: rstcheck ; extra == 'dev'
+Requires-Dist: ruff ; extra == 'dev'
+Requires-Dist: sphinx ; extra == 'dev'
+Requires-Dist: sphinx-rtd-theme ; extra == 'dev'
+Requires-Dist: toml-sort ; extra == 'dev'
+Requires-Dist: twine ; extra == 'dev'
+Requires-Dist: virtualenv ; extra == 'dev'
+Requires-Dist: wheel ; extra == 'dev'
Provides-Extra: test
-Requires-Dist: ipaddress ; (python_version < "3.0") and extra == 'test'
-Requires-Dist: mock ; (python_version < "3.0") and extra == 'test'
-Requires-Dist: enum34 ; (python_version <= "3.4") and extra == 'test'
-Requires-Dist: pywin32 ; (sys_platform == "win32") and extra == 'test'
-Requires-Dist: wmi ; (sys_platform == "win32") and extra == 'test'
+Requires-Dist: pytest ; extra == 'test'
+Requires-Dist: pytest-xdist ; extra == 'test'
+Requires-Dist: setuptools ; extra == 'test'
| |downloads| |stars| |forks| |contributors| |coverage|
| |version| |py-versions| |packages| |license|
diff --git a/contrib/python/psutil/py3/psutil/__init__.py b/contrib/python/psutil/py3/psutil/__init__.py
index 3a503503cc..aabf715921 100644
--- a/contrib/python/psutil/py3/psutil/__init__.py
+++ b/contrib/python/psutil/py3/psutil/__init__.py
@@ -214,7 +214,7 @@ if hasattr(_psplatform.Process, "rlimit"):
AF_LINK = _psplatform.AF_LINK
__author__ = "Giampaolo Rodola'"
-__version__ = "6.0.0"
+__version__ = "6.1.0"
version_info = tuple([int(num) for num in __version__.split('.')])
_timer = getattr(time, 'monotonic', time.time)
@@ -350,13 +350,13 @@ class Process(object): # noqa: UP004
self._last_sys_cpu_times = None
self._last_proc_cpu_times = None
self._exitcode = _SENTINEL
- # cache creation time for later use in is_running() method
+ self._ident = (self.pid, None)
try:
- self.create_time()
+ self._ident = self._get_ident()
except AccessDenied:
- # We should never get here as AFAIK we're able to get
- # process creation time on all platforms even as a
- # limited user.
+ # This should happen on Windows only, since we use the fast
+ # create time method. AFAIK, on all other platforms we are
+ # able to get create time for all PIDs.
pass
except ZombieProcess:
# Zombies can still be queried by this class (although
@@ -368,11 +368,32 @@ class Process(object): # noqa: UP004
raise NoSuchProcess(pid, msg=msg)
else:
self._gone = True
- # This pair is supposed to identify a Process instance
- # univocally over time (the PID alone is not enough as
- # it might refer to a process whose PID has been reused).
- # This will be used later in __eq__() and is_running().
- self._ident = (self.pid, self._create_time)
+
+ def _get_ident(self):
+ """Return a (pid, uid) tuple which is supposed to identify a
+ Process instance univocally over time. The PID alone is not
+ enough, as it can be assigned to a new process after this one
+ terminates, so we add process creation time to the mix. We need
+ this in order to prevent killing the wrong process later on.
+ This is also known as PID reuse or PID recycling problem.
+
+ The reliability of this strategy mostly depends on
+ create_time() precision, which is 0.01 secs on Linux. The
+ assumption is that, after a process terminates, the kernel
+ won't reuse the same PID after such a short period of time
+ (0.01 secs). Technically this is inherently racy, but
+ practically it should be good enough.
+ """
+ if WINDOWS:
+ # Use create_time() fast method in order to speedup
+ # `process_iter()`. This means we'll get AccessDenied for
+ # most ADMIN processes, but that's fine since it means
+ # we'll also get AccessDenied on kill().
+ # https://github.com/giampaolo/psutil/issues/2366#issuecomment-2381646555
+ self._create_time = self._proc.create_time(fast_only=True)
+ return (self.pid, self._create_time)
+ else:
+ return (self.pid, self.create_time())
def __str__(self):
info = collections.OrderedDict()
@@ -417,10 +438,10 @@ class Process(object): # noqa: UP004
# (so it has a ctime), then it turned into a zombie. It's
# important to do this because is_running() depends on
# __eq__.
- pid1, ctime1 = self._ident
- pid2, ctime2 = other._ident
+ pid1, ident1 = self._ident
+ pid2, ident2 = other._ident
if pid1 == pid2:
- if ctime1 and not ctime2:
+ if ident1 and not ident2:
try:
return self.status() == STATUS_ZOMBIE
except Error:
diff --git a/contrib/python/psutil/py3/psutil/_psaix.py b/contrib/python/psutil/py3/psutil/_psaix.py
index f48425eb8a..2ccc638bce 100644
--- a/contrib/python/psutil/py3/psutil/_psaix.py
+++ b/contrib/python/psutil/py3/psutil/_psaix.py
@@ -349,7 +349,7 @@ def wrap_exceptions(fun):
class Process:
"""Wrapper class around underlying C implementation."""
- __slots__ = ["pid", "_name", "_ppid", "_procfs_path", "_cache"]
+ __slots__ = ["_cache", "_name", "_ppid", "_procfs_path", "pid"]
def __init__(self, pid):
self.pid = pid
@@ -539,7 +539,7 @@ class Process:
)
if "no such process" in stderr.lower():
raise NoSuchProcess(self.pid, self._name)
- procfiles = re.findall(r"(\d+): S_IFREG.*\s*.*name:(.*)\n", stdout)
+ procfiles = re.findall(r"(\d+): S_IFREG.*name:(.*)\n", stdout)
retlist = []
for fd, path in procfiles:
path = path.strip()
diff --git a/contrib/python/psutil/py3/psutil/_psbsd.py b/contrib/python/psutil/py3/psutil/_psbsd.py
index 4d49cf98bd..deffe50b09 100644
--- a/contrib/python/psutil/py3/psutil/_psbsd.py
+++ b/contrib/python/psutil/py3/psutil/_psbsd.py
@@ -10,7 +10,7 @@ import functools
import os
from collections import defaultdict
from collections import namedtuple
-from xml.etree import ElementTree
+from xml.etree import ElementTree # noqa ICN001
from . import _common
from . import _psposix
@@ -640,7 +640,7 @@ def wrap_exceptions_procfs(inst):
class Process:
"""Wrapper class around underlying C implementation."""
- __slots__ = ["pid", "_name", "_ppid", "_cache"]
+ __slots__ = ["_cache", "_name", "_ppid", "pid"]
def __init__(self, pid):
self.pid = pid
diff --git a/contrib/python/psutil/py3/psutil/_pslinux.py b/contrib/python/psutil/py3/psutil/_pslinux.py
index 8e389e49ce..0dac5fec94 100644
--- a/contrib/python/psutil/py3/psutil/_pslinux.py
+++ b/contrib/python/psutil/py3/psutil/_pslinux.py
@@ -1735,7 +1735,7 @@ def wrap_exceptions(fun):
class Process:
"""Linux process implementation."""
- __slots__ = ["pid", "_name", "_ppid", "_procfs_path", "_cache"]
+ __slots__ = ["_cache", "_name", "_ppid", "_procfs_path", "pid"]
def __init__(self, pid):
self.pid = pid
@@ -1799,7 +1799,12 @@ class Process:
ret['children_stime'] = fields[14]
ret['create_time'] = fields[19]
ret['cpu_num'] = fields[36]
- ret['blkio_ticks'] = fields[39] # aka 'delayacct_blkio_ticks'
+ try:
+ ret['blkio_ticks'] = fields[39] # aka 'delayacct_blkio_ticks'
+ except IndexError:
+ # https://github.com/giampaolo/psutil/issues/2455
+ debug("can't get blkio_ticks, set iowait to 0")
+ ret['blkio_ticks'] = 0
return ret
diff --git a/contrib/python/psutil/py3/psutil/_psosx.py b/contrib/python/psutil/py3/psutil/_psosx.py
index 41263fd735..ed9b319de7 100644
--- a/contrib/python/psutil/py3/psutil/_psosx.py
+++ b/contrib/python/psutil/py3/psutil/_psosx.py
@@ -361,7 +361,7 @@ def wrap_exceptions(fun):
class Process:
"""Wrapper class around underlying C implementation."""
- __slots__ = ["pid", "_name", "_ppid", "_cache"]
+ __slots__ = ["_cache", "_name", "_ppid", "pid"]
def __init__(self, pid):
self.pid = pid
diff --git a/contrib/python/psutil/py3/psutil/_pssunos.py b/contrib/python/psutil/py3/psutil/_pssunos.py
index 1c0b96e9e9..5536d35079 100644
--- a/contrib/python/psutil/py3/psutil/_pssunos.py
+++ b/contrib/python/psutil/py3/psutil/_pssunos.py
@@ -387,7 +387,7 @@ def wrap_exceptions(fun):
class Process:
"""Wrapper class around underlying C implementation."""
- __slots__ = ["pid", "_name", "_ppid", "_procfs_path", "_cache"]
+ __slots__ = ["_cache", "_name", "_ppid", "_procfs_path", "pid"]
def __init__(self, pid):
self.pid = pid
diff --git a/contrib/python/psutil/py3/psutil/_psutil_common.c b/contrib/python/psutil/py3/psutil/_psutil_common.c
index 76b197917b..941f6bff1b 100644
--- a/contrib/python/psutil/py3/psutil/_psutil_common.c
+++ b/contrib/python/psutil/py3/psutil/_psutil_common.c
@@ -90,7 +90,7 @@ PyErr_SetFromWindowsErr(int winerr) {
* message.
*/
PyObject *
-PyErr_SetFromOSErrnoWithSyscall(const char *syscall) {
+psutil_PyErr_SetFromOSErrnoWithSyscall(const char *syscall) {
char fullmsg[1024];
#ifdef PSUTIL_WINDOWS
diff --git a/contrib/python/psutil/py3/psutil/_psutil_common.h b/contrib/python/psutil/py3/psutil/_psutil_common.h
index 20c03ebd7c..2cdfa9d4d6 100644
--- a/contrib/python/psutil/py3/psutil/_psutil_common.h
+++ b/contrib/python/psutil/py3/psutil/_psutil_common.h
@@ -97,7 +97,7 @@ static const int PSUTIL_CONN_NONE = 128;
PyObject* AccessDenied(const char *msg);
PyObject* NoSuchProcess(const char *msg);
-PyObject* PyErr_SetFromOSErrnoWithSyscall(const char *syscall);
+PyObject* psutil_PyErr_SetFromOSErrnoWithSyscall(const char *syscall);
// ====================================================================
// --- Global utils
diff --git a/contrib/python/psutil/py3/psutil/_psutil_linux.c b/contrib/python/psutil/py3/psutil/_psutil_linux.c
index 292e1c5524..46244c5792 100644
--- a/contrib/python/psutil/py3/psutil/_psutil_linux.c
+++ b/contrib/python/psutil/py3/psutil/_psutil_linux.c
@@ -78,6 +78,10 @@ static PyMethodDef mod_methods[] = {
if (mod == NULL)
INITERR;
+#ifdef Py_GIL_DISABLED
+ PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);
+#endif
+
if (PyModule_AddIntConstant(mod, "version", PSUTIL_VERSION)) INITERR;
if (PyModule_AddIntConstant(mod, "DUPLEX_HALF", DUPLEX_HALF)) INITERR;
if (PyModule_AddIntConstant(mod, "DUPLEX_FULL", DUPLEX_FULL)) INITERR;
diff --git a/contrib/python/psutil/py3/psutil/_psutil_osx.c b/contrib/python/psutil/py3/psutil/_psutil_osx.c
index 4aa11d1700..09fa267a98 100644
--- a/contrib/python/psutil/py3/psutil/_psutil_osx.c
+++ b/contrib/python/psutil/py3/psutil/_psutil_osx.c
@@ -91,6 +91,10 @@ static PyMethodDef mod_methods[] = {
if (mod == NULL)
INITERR;
+#ifdef Py_GIL_DISABLED
+ PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);
+#endif
+
if (psutil_setup() != 0)
INITERR;
diff --git a/contrib/python/psutil/py3/psutil/_psutil_posix.c b/contrib/python/psutil/py3/psutil/_psutil_posix.c
index ad0d4b17ee..7e6eaac46c 100644
--- a/contrib/python/psutil/py3/psutil/_psutil_posix.c
+++ b/contrib/python/psutil/py3/psutil/_psutil_posix.c
@@ -148,7 +148,7 @@ psutil_pid_exists(pid_t pid) {
void
psutil_raise_for_pid(long pid, char *syscall) {
if (errno != 0)
- PyErr_SetFromOSErrnoWithSyscall(syscall);
+ psutil_PyErr_SetFromOSErrnoWithSyscall(syscall);
else if (psutil_pid_exists(pid) == 0)
NoSuchProcess(syscall);
else
@@ -470,14 +470,14 @@ psutil_net_if_flags(PyObject *self, PyObject *args) {
sock = socket(AF_INET, SOCK_DGRAM, 0);
if (sock == -1) {
- PyErr_SetFromOSErrnoWithSyscall("socket(SOCK_DGRAM)");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("socket(SOCK_DGRAM)");
goto error;
}
PSUTIL_STRNCPY(ifr.ifr_name, nic_name, sizeof(ifr.ifr_name));
ret = ioctl(sock, SIOCGIFFLAGS, &ifr);
if (ret == -1) {
- PyErr_SetFromOSErrnoWithSyscall("ioctl(SIOCGIFFLAGS)");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("ioctl(SIOCGIFFLAGS)");
goto error;
}
@@ -913,6 +913,10 @@ static PyMethodDef mod_methods[] = {
if (mod == NULL)
INITERR;
+#ifdef Py_GIL_DISABLED
+ PyUnstable_Module_SetGIL(mod, Py_MOD_GIL_NOT_USED);
+#endif
+
#if defined(PSUTIL_BSD) || \
defined(PSUTIL_OSX) || \
defined(PSUTIL_SUNOS) || \
diff --git a/contrib/python/psutil/py3/psutil/_psutil_windows.c b/contrib/python/psutil/py3/psutil/_psutil_windows.c
index bb6e12ff80..0c221bdc23 100644
--- a/contrib/python/psutil/py3/psutil/_psutil_windows.c
+++ b/contrib/python/psutil/py3/psutil/_psutil_windows.c
@@ -165,6 +165,10 @@ void init_psutil_windows(void)
if (module == NULL)
INITERROR;
+#ifdef Py_GIL_DISABLED
+ PyUnstable_Module_SetGIL(module, Py_MOD_GIL_NOT_USED);
+#endif
+
if (psutil_setup() != 0)
INITERROR;
if (psutil_set_se_debug() != 0)
diff --git a/contrib/python/psutil/py3/psutil/_pswindows.py b/contrib/python/psutil/py3/psutil/_pswindows.py
index 0ba511b901..e4550c3914 100644
--- a/contrib/python/psutil/py3/psutil/_pswindows.py
+++ b/contrib/python/psutil/py3/psutil/_pswindows.py
@@ -762,7 +762,7 @@ def retry_error_partial_copy(fun):
class Process:
"""Wrapper class around underlying C implementation."""
- __slots__ = ["pid", "_name", "_ppid", "_cache"]
+ __slots__ = ["_cache", "_name", "_ppid", "pid"]
def __init__(self, pid):
self.pid = pid
@@ -982,7 +982,7 @@ class Process:
return py2_strencode(domain) + '\\' + py2_strencode(user)
@wrap_exceptions
- def create_time(self):
+ def create_time(self, fast_only=False):
# Note: proc_times() not put under oneshot() 'cause create_time()
# is already cached by the main Process class.
try:
@@ -990,6 +990,8 @@ class Process:
return created
except OSError as err:
if is_permission_err(err):
+ if fast_only:
+ raise
debug("attempting create_time() fallback (slower)")
return self._proc_info()[pinfo_map['create_time']]
raise
diff --git a/contrib/python/psutil/py3/psutil/arch/linux/net.c b/contrib/python/psutil/py3/psutil/arch/linux/net.c
index d193e94087..6d2785ee63 100644
--- a/contrib/python/psutil/py3/psutil/arch/linux/net.c
+++ b/contrib/python/psutil/py3/psutil/arch/linux/net.c
@@ -71,7 +71,7 @@ psutil_net_if_duplex_speed(PyObject* self, PyObject* args) {
sock = socket(AF_INET, SOCK_DGRAM, 0);
if (sock == -1)
- return PyErr_SetFromOSErrnoWithSyscall("socket()");
+ return psutil_PyErr_SetFromOSErrnoWithSyscall("socket()");
PSUTIL_STRNCPY(ifr.ifr_name, nic_name, sizeof(ifr.ifr_name));
// duplex and speed
@@ -102,7 +102,7 @@ psutil_net_if_duplex_speed(PyObject* self, PyObject* args) {
speed = 0;
}
else {
- PyErr_SetFromOSErrnoWithSyscall("ioctl(SIOCETHTOOL)");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("ioctl(SIOCETHTOOL)");
goto error;
}
}
diff --git a/contrib/python/psutil/py3/psutil/arch/osx/cpu.c b/contrib/python/psutil/py3/psutil/arch/osx/cpu.c
index 3759dda44e..a353153641 100644
--- a/contrib/python/psutil/py3/psutil/arch/osx/cpu.c
+++ b/contrib/python/psutil/py3/psutil/arch/osx/cpu.c
@@ -247,7 +247,7 @@ psutil_cpu_freq(PyObject *self, PyObject *args) {
mib[1] = HW_CPU_FREQ;
if (sysctl(mib, 2, &curr, &len, NULL, 0) < 0)
- return PyErr_SetFromOSErrnoWithSyscall("sysctl(HW_CPU_FREQ)");
+ return psutil_PyErr_SetFromOSErrnoWithSyscall("sysctl(HW_CPU_FREQ)");
if (sysctlbyname("hw.cpufrequency_min", &min, &size, NULL, 0))
psutil_debug("sysctl('hw.cpufrequency_min') failed (set to 0)");
diff --git a/contrib/python/psutil/py3/psutil/arch/osx/proc.c b/contrib/python/psutil/py3/psutil/arch/osx/proc.c
index 2cdb9911c0..136311ecee 100644
--- a/contrib/python/psutil/py3/psutil/arch/osx/proc.c
+++ b/contrib/python/psutil/py3/psutil/arch/osx/proc.c
@@ -77,7 +77,7 @@ psutil_get_proc_list(kinfo_proc **procList, size_t *procCount) {
while (lim-- > 0) {
size = 0;
if (sysctl((int *)mib, 3, NULL, &size, NULL, 0) == -1) {
- PyErr_SetFromOSErrnoWithSyscall("sysctl(KERN_PROC_ALL)");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("sysctl(KERN_PROC_ALL)");
return 1;
}
size2 = size + (size >> 3); // add some
@@ -100,7 +100,7 @@ psutil_get_proc_list(kinfo_proc **procList, size_t *procCount) {
err = errno;
free(ptr);
if (err != ENOMEM) {
- PyErr_SetFromOSErrnoWithSyscall("sysctl(KERN_PROC_ALL)");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("sysctl(KERN_PROC_ALL)");
return 1;
}
}
@@ -132,7 +132,7 @@ psutil_sysctl_argmax() {
if (sysctl(mib, 2, &argmax, &size, NULL, 0) == 0)
return argmax;
- PyErr_SetFromOSErrnoWithSyscall("sysctl(KERN_ARGMAX)");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("sysctl(KERN_ARGMAX)");
return 0;
}
@@ -164,7 +164,7 @@ psutil_sysctl_procargs(pid_t pid, char *procargs, size_t *argmax) {
AccessDenied("sysctl(KERN_PROCARGS2) -> EIO");
return 1;
}
- PyErr_SetFromOSErrnoWithSyscall("sysctl(KERN_PROCARGS2)");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("sysctl(KERN_PROCARGS2)");
return 1;
}
return 0;
@@ -186,7 +186,7 @@ psutil_get_kinfo_proc(pid_t pid, struct kinfo_proc *kp) {
// now read the data from sysctl
if (sysctl(mib, 4, kp, &len, NULL, 0) == -1) {
// raise an exception and throw errno as the error
- PyErr_SetFromOSErrnoWithSyscall("sysctl");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("sysctl");
return -1;
}
@@ -605,8 +605,9 @@ psutil_proc_memory_uss(PyObject *self, PyObject *args) {
len = sizeof(cpu_type);
if (sysctlbyname("sysctl.proc_cputype", &cpu_type, &len, NULL, 0) != 0) {
- return PyErr_SetFromOSErrnoWithSyscall(
- "sysctlbyname('sysctl.proc_cputype')");
+ return psutil_PyErr_SetFromOSErrnoWithSyscall(
+ "sysctlbyname('sysctl.proc_cputype')"
+ );
}
// Roughly based on libtop_update_vm_regions in
@@ -977,7 +978,7 @@ psutil_proc_net_connections(PyObject *self, PyObject *args) {
// check for inet_ntop failures
if (errno != 0) {
- PyErr_SetFromOSErrnoWithSyscall("inet_ntop()");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("inet_ntop()");
goto error;
}
diff --git a/contrib/python/psutil/py3/psutil/arch/windows/proc.c b/contrib/python/psutil/py3/psutil/arch/windows/proc.c
index af3df267ac..05fb502557 100644
--- a/contrib/python/psutil/py3/psutil/arch/windows/proc.c
+++ b/contrib/python/psutil/py3/psutil/arch/windows/proc.c
@@ -116,7 +116,7 @@ psutil_proc_kill(PyObject *self, PyObject *args) {
// https://github.com/giampaolo/psutil/issues/1099
// http://bugs.python.org/issue14252
if (GetLastError() != ERROR_ACCESS_DENIED) {
- PyErr_SetFromOSErrnoWithSyscall("TerminateProcess");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("TerminateProcess");
return NULL;
}
}
@@ -151,7 +151,7 @@ psutil_proc_wait(PyObject *self, PyObject *args) {
Py_RETURN_NONE;
}
else {
- PyErr_SetFromOSErrnoWithSyscall("OpenProcess");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("OpenProcess");
return NULL;
}
}
@@ -163,7 +163,7 @@ psutil_proc_wait(PyObject *self, PyObject *args) {
// handle return code
if (retVal == WAIT_FAILED) {
- PyErr_SetFromOSErrnoWithSyscall("WaitForSingleObject");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("WaitForSingleObject");
CloseHandle(hProcess);
return NULL;
}
@@ -185,7 +185,7 @@ psutil_proc_wait(PyObject *self, PyObject *args) {
// process is gone so we can get its process exit code. The PID
// may still stick around though but we'll handle that from Python.
if (GetExitCodeProcess(hProcess, &ExitCode) == 0) {
- PyErr_SetFromOSErrnoWithSyscall("GetExitCodeProcess");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("GetExitCodeProcess");
CloseHandle(hProcess);
return NULL;
}
@@ -598,7 +598,7 @@ psutil_proc_threads(PyObject *self, PyObject *args) {
hThreadSnap = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);
if (hThreadSnap == INVALID_HANDLE_VALUE) {
- PyErr_SetFromOSErrnoWithSyscall("CreateToolhelp32Snapshot");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("CreateToolhelp32Snapshot");
goto error;
}
@@ -606,7 +606,7 @@ psutil_proc_threads(PyObject *self, PyObject *args) {
te32.dwSize = sizeof(THREADENTRY32);
if (! Thread32First(hThreadSnap, &te32)) {
- PyErr_SetFromOSErrnoWithSyscall("Thread32First");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("Thread32First");
goto error;
}
@@ -626,7 +626,7 @@ psutil_proc_threads(PyObject *self, PyObject *args) {
rc = GetThreadTimes(hThread, &ftDummy, &ftDummy, &ftKernel,
&ftUser);
if (rc == 0) {
- PyErr_SetFromOSErrnoWithSyscall("GetThreadTimes");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("GetThreadTimes");
goto error;
}
@@ -702,7 +702,7 @@ _psutil_user_token_from_pid(DWORD pid) {
return NULL;
if (!OpenProcessToken(hProcess, TOKEN_QUERY, &hToken)) {
- PyErr_SetFromOSErrnoWithSyscall("OpenProcessToken");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("OpenProcessToken");
goto error;
}
@@ -721,7 +721,7 @@ _psutil_user_token_from_pid(DWORD pid) {
continue;
}
else {
- PyErr_SetFromOSErrnoWithSyscall("GetTokenInformation");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("GetTokenInformation");
goto error;
}
}
@@ -797,7 +797,7 @@ psutil_proc_username(PyObject *self, PyObject *args) {
goto error;
}
else {
- PyErr_SetFromOSErrnoWithSyscall("LookupAccountSidW");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("LookupAccountSidW");
goto error;
}
}
diff --git a/contrib/python/psutil/py3/psutil/arch/windows/proc_handles.c b/contrib/python/psutil/py3/psutil/arch/windows/proc_handles.c
index 30e7cd2d84..01ef6a425e 100644
--- a/contrib/python/psutil/py3/psutil/arch/windows/proc_handles.c
+++ b/contrib/python/psutil/py3/psutil/arch/windows/proc_handles.c
@@ -156,7 +156,7 @@ psutil_threaded_get_filename(HANDLE hFile) {
hThread = CreateThread(
NULL, 0, (LPTHREAD_START_ROUTINE)psutil_get_filename, &hFile, 0, NULL);
if (hThread == NULL) {
- PyErr_SetFromOSErrnoWithSyscall("CreateThread");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("CreateThread");
return 1;
}
@@ -168,7 +168,7 @@ psutil_threaded_get_filename(HANDLE hFile) {
psutil_debug(
"get handle name thread timed out after %i ms", THREAD_TIMEOUT);
if (TerminateThread(hThread, 0) == 0) {
- PyErr_SetFromOSErrnoWithSyscall("TerminateThread");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("TerminateThread");
CloseHandle(hThread);
return 1;
}
@@ -179,26 +179,28 @@ psutil_threaded_get_filename(HANDLE hFile) {
if (dwWait == WAIT_FAILED) {
psutil_debug("WaitForSingleObject -> WAIT_FAILED");
if (TerminateThread(hThread, 0) == 0) {
- PyErr_SetFromOSErrnoWithSyscall(
- "WaitForSingleObject -> WAIT_FAILED -> TerminateThread");
+ psutil_PyErr_SetFromOSErrnoWithSyscall(
+ "WaitForSingleObject -> WAIT_FAILED -> TerminateThread"
+ );
CloseHandle(hThread);
return 1;
}
- PyErr_SetFromOSErrnoWithSyscall("WaitForSingleObject");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("WaitForSingleObject");
CloseHandle(hThread);
return 1;
}
if (GetExitCodeThread(hThread, &threadRetValue) == 0) {
if (TerminateThread(hThread, 0) == 0) {
- PyErr_SetFromOSErrnoWithSyscall(
- "GetExitCodeThread (failed) -> TerminateThread");
+ psutil_PyErr_SetFromOSErrnoWithSyscall(
+ "GetExitCodeThread (failed) -> TerminateThread"
+ );
CloseHandle(hThread);
return 1;
}
CloseHandle(hThread);
- PyErr_SetFromOSErrnoWithSyscall("GetExitCodeThread");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("GetExitCodeThread");
return 1;
}
CloseHandle(hThread);
diff --git a/contrib/python/psutil/py3/psutil/arch/windows/proc_info.c b/contrib/python/psutil/py3/psutil/arch/windows/proc_info.c
index 5d16b8133d..9e0caf3442 100644
--- a/contrib/python/psutil/py3/psutil/arch/windows/proc_info.c
+++ b/contrib/python/psutil/py3/psutil/arch/windows/proc_info.c
@@ -41,7 +41,7 @@ psutil_get_process_region_size(HANDLE hProcess, LPCVOID src, SIZE_T *psize) {
MEMORY_BASIC_INFORMATION info;
if (!VirtualQueryEx(hProcess, src, &info, sizeof(info))) {
- PyErr_SetFromOSErrnoWithSyscall("VirtualQueryEx");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("VirtualQueryEx");
return -1;
}
@@ -67,7 +67,7 @@ psutil_convert_winerr(ULONG err, char* syscall) {
AccessDenied(fullmsg);
}
else {
- PyErr_SetFromOSErrnoWithSyscall(syscall);
+ psutil_PyErr_SetFromOSErrnoWithSyscall(syscall);
}
}
@@ -226,7 +226,7 @@ psutil_get_process_data(DWORD pid,
// 32 bit case. Check if the target is also 32 bit.
if (!IsWow64Process(GetCurrentProcess(), &weAreWow64) ||
!IsWow64Process(hProcess, &theyAreWow64)) {
- PyErr_SetFromOSErrnoWithSyscall("IsWow64Process");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("IsWow64Process");
goto error;
}
@@ -594,7 +594,7 @@ psutil_proc_cmdline(PyObject *self, PyObject *args, PyObject *kwdict) {
// attempt to parse the command line using Win32 API
szArglist = CommandLineToArgvW(data, &nArgs);
if (szArglist == NULL) {
- PyErr_SetFromOSErrnoWithSyscall("CommandLineToArgvW");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("CommandLineToArgvW");
goto error;
}
diff --git a/contrib/python/psutil/py3/psutil/arch/windows/proc_utils.c b/contrib/python/psutil/py3/psutil/arch/windows/proc_utils.c
index 77b6dbf1e8..1ebb76c448 100644
--- a/contrib/python/psutil/py3/psutil/arch/windows/proc_utils.c
+++ b/contrib/python/psutil/py3/psutil/arch/windows/proc_utils.c
@@ -103,7 +103,7 @@ psutil_check_phandle(HANDLE hProcess, DWORD pid, int check_exit_code) {
}
return NULL;
}
- PyErr_SetFromOSErrnoWithSyscall("OpenProcess");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("OpenProcess");
return NULL;
}
@@ -129,7 +129,7 @@ psutil_check_phandle(HANDLE hProcess, DWORD pid, int check_exit_code) {
SetLastError(0);
return hProcess;
}
- PyErr_SetFromOSErrnoWithSyscall("GetExitCodeProcess");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("GetExitCodeProcess");
CloseHandle(hProcess);
return NULL;
}
@@ -151,7 +151,7 @@ psutil_handle_from_pid(DWORD pid, DWORD access) {
hProcess = OpenProcess(access, FALSE, pid);
if ((hProcess == NULL) && (GetLastError() == ERROR_ACCESS_DENIED)) {
- PyErr_SetFromOSErrnoWithSyscall("OpenProcess");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("OpenProcess");
return NULL;
}
diff --git a/contrib/python/psutil/py3/psutil/arch/windows/security.c b/contrib/python/psutil/py3/psutil/arch/windows/security.c
index 7e400a2541..07d2399849 100644
--- a/contrib/python/psutil/py3/psutil/arch/windows/security.c
+++ b/contrib/python/psutil/py3/psutil/arch/windows/security.c
@@ -21,7 +21,7 @@ psutil_set_privilege(HANDLE hToken, LPCTSTR Privilege, BOOL bEnablePrivilege) {
DWORD cbPrevious = sizeof(TOKEN_PRIVILEGES);
if (! LookupPrivilegeValue(NULL, Privilege, &luid)) {
- PyErr_SetFromOSErrnoWithSyscall("LookupPrivilegeValue");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("LookupPrivilegeValue");
return 1;
}
@@ -38,7 +38,7 @@ psutil_set_privilege(HANDLE hToken, LPCTSTR Privilege, BOOL bEnablePrivilege) {
&tpPrevious,
&cbPrevious))
{
- PyErr_SetFromOSErrnoWithSyscall("AdjustTokenPrivileges");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("AdjustTokenPrivileges");
return 1;
}
@@ -60,7 +60,7 @@ psutil_set_privilege(HANDLE hToken, LPCTSTR Privilege, BOOL bEnablePrivilege) {
NULL,
NULL))
{
- PyErr_SetFromOSErrnoWithSyscall("AdjustTokenPrivileges");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("AdjustTokenPrivileges");
return 1;
}
@@ -79,18 +79,18 @@ psutil_get_thisproc_token() {
if (GetLastError() == ERROR_NO_TOKEN)
{
if (! ImpersonateSelf(SecurityImpersonation)) {
- PyErr_SetFromOSErrnoWithSyscall("ImpersonateSelf");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("ImpersonateSelf");
return NULL;
}
if (! OpenProcessToken(
me, TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &hToken))
{
- PyErr_SetFromOSErrnoWithSyscall("OpenProcessToken");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("OpenProcessToken");
return NULL;
}
}
else {
- PyErr_SetFromOSErrnoWithSyscall("OpenProcessToken");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("OpenProcessToken");
return NULL;
}
}
diff --git a/contrib/python/psutil/py3/psutil/arch/windows/services.c b/contrib/python/psutil/py3/psutil/arch/windows/services.c
index fa3e646e51..4931e9d66d 100644
--- a/contrib/python/psutil/py3/psutil/arch/windows/services.c
+++ b/contrib/python/psutil/py3/psutil/arch/windows/services.c
@@ -24,12 +24,12 @@ psutil_get_service_handler(char *service_name, DWORD scm_access, DWORD access)
sc = OpenSCManager(NULL, NULL, scm_access);
if (sc == NULL) {
- PyErr_SetFromOSErrnoWithSyscall("OpenSCManager");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("OpenSCManager");
return NULL;
}
hService = OpenService(sc, service_name, access);
if (hService == NULL) {
- PyErr_SetFromOSErrnoWithSyscall("OpenService");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("OpenService");
CloseServiceHandle(sc);
return NULL;
}
@@ -113,7 +113,7 @@ psutil_winservice_enumerate(PyObject *self, PyObject *args) {
sc = OpenSCManager(NULL, NULL, SC_MANAGER_ENUMERATE_SERVICE);
if (sc == NULL) {
- PyErr_SetFromOSErrnoWithSyscall("OpenSCManager");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("OpenSCManager");
return NULL;
}
@@ -211,13 +211,13 @@ psutil_winservice_query_config(PyObject *self, PyObject *args) {
bytesNeeded = 0;
QueryServiceConfigW(hService, NULL, 0, &bytesNeeded);
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
- PyErr_SetFromOSErrnoWithSyscall("QueryServiceConfigW");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("QueryServiceConfigW");
goto error;
}
qsc = (QUERY_SERVICE_CONFIGW *)malloc(bytesNeeded);
ok = QueryServiceConfigW(hService, qsc, bytesNeeded, &bytesNeeded);
if (ok == 0) {
- PyErr_SetFromOSErrnoWithSyscall("QueryServiceConfigW");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("QueryServiceConfigW");
goto error;
}
@@ -303,7 +303,7 @@ psutil_winservice_query_status(PyObject *self, PyObject *args) {
return Py_BuildValue("s", "");
}
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
- PyErr_SetFromOSErrnoWithSyscall("QueryServiceStatusEx");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("QueryServiceStatusEx");
goto error;
}
ssp = (SERVICE_STATUS_PROCESS *)HeapAlloc(
@@ -317,7 +317,7 @@ psutil_winservice_query_status(PyObject *self, PyObject *args) {
ok = QueryServiceStatusEx(hService, SC_STATUS_PROCESS_INFO, (LPBYTE)ssp,
bytesNeeded, &bytesNeeded);
if (ok == 0) {
- PyErr_SetFromOSErrnoWithSyscall("QueryServiceStatusEx");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("QueryServiceStatusEx");
goto error;
}
@@ -375,7 +375,7 @@ psutil_winservice_query_descr(PyObject *self, PyObject *args) {
return Py_BuildValue("s", "");
}
if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
- PyErr_SetFromOSErrnoWithSyscall("QueryServiceConfig2W");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("QueryServiceConfig2W");
goto error;
}
@@ -383,7 +383,7 @@ psutil_winservice_query_descr(PyObject *self, PyObject *args) {
ok = QueryServiceConfig2W(hService, SERVICE_CONFIG_DESCRIPTION,
(LPBYTE)scd, bytesNeeded, &bytesNeeded);
if (ok == 0) {
- PyErr_SetFromOSErrnoWithSyscall("QueryServiceConfig2W");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("QueryServiceConfig2W");
goto error;
}
@@ -429,7 +429,7 @@ psutil_winservice_start(PyObject *self, PyObject *args) {
}
ok = StartService(hService, 0, NULL);
if (ok == 0) {
- PyErr_SetFromOSErrnoWithSyscall("StartService");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("StartService");
goto error;
}
@@ -466,7 +466,7 @@ psutil_winservice_stop(PyObject *self, PyObject *args) {
ok = ControlService(hService, SERVICE_CONTROL_STOP, &ssp);
Py_END_ALLOW_THREADS
if (ok == 0) {
- PyErr_SetFromOSErrnoWithSyscall("ControlService");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("ControlService");
goto error;
}
diff --git a/contrib/python/psutil/py3/psutil/arch/windows/sys.c b/contrib/python/psutil/py3/psutil/arch/windows/sys.c
index 3e12e71b72..ada684f6f9 100644
--- a/contrib/python/psutil/py3/psutil/arch/windows/sys.c
+++ b/contrib/python/psutil/py3/psutil/arch/windows/sys.c
@@ -70,7 +70,7 @@ psutil_users(PyObject *self, PyObject *args) {
// On Windows Nano server, the Wtsapi32 API can be present, but return WinError 120.
return py_retlist;
}
- PyErr_SetFromOSErrnoWithSyscall("WTSEnumerateSessionsW");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("WTSEnumerateSessionsW");
goto error;
}
@@ -93,7 +93,9 @@ psutil_users(PyObject *self, PyObject *args) {
bytes = 0;
if (WTSQuerySessionInformationW(hServer, sessionId, WTSUserName,
&buffer_user, &bytes) == 0) {
- PyErr_SetFromOSErrnoWithSyscall("WTSQuerySessionInformationW");
+ psutil_PyErr_SetFromOSErrnoWithSyscall(
+ "WTSQuerySessionInformationW"
+ );
goto error;
}
if (bytes <= 2)
@@ -103,7 +105,9 @@ psutil_users(PyObject *self, PyObject *args) {
bytes = 0;
if (WTSQuerySessionInformationW(hServer, sessionId, WTSClientAddress,
&buffer_addr, &bytes) == 0) {
- PyErr_SetFromOSErrnoWithSyscall("WTSQuerySessionInformationW");
+ psutil_PyErr_SetFromOSErrnoWithSyscall(
+ "WTSQuerySessionInformationW"
+ );
goto error;
}
@@ -130,7 +134,9 @@ psutil_users(PyObject *self, PyObject *args) {
bytes = 0;
if (WTSQuerySessionInformationW(hServer, sessionId, WTSSessionInfo,
&buffer_info, &bytes) == 0) {
- PyErr_SetFromOSErrnoWithSyscall("WTSQuerySessionInformationW");
+ psutil_PyErr_SetFromOSErrnoWithSyscall(
+ "WTSQuerySessionInformationW"
+ );
goto error;
}
wts_info = (PWTSINFOW)buffer_info;
diff --git a/contrib/python/psutil/py3/psutil/arch/windows/wmi.c b/contrib/python/psutil/py3/psutil/arch/windows/wmi.c
index fc7a66529e..2cf7e8a59b 100644
--- a/contrib/python/psutil/py3/psutil/arch/windows/wmi.c
+++ b/contrib/python/psutil/py3/psutil/arch/windows/wmi.c
@@ -80,7 +80,7 @@ psutil_init_loadavg_counter(PyObject *self, PyObject *args) {
event = CreateEventW(NULL, FALSE, FALSE, L"LoadUpdateEvent");
if (event == NULL) {
- PyErr_SetFromOSErrnoWithSyscall("CreateEventW");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("CreateEventW");
return NULL;
}
@@ -100,7 +100,7 @@ psutil_init_loadavg_counter(PyObject *self, PyObject *args) {
WT_EXECUTEDEFAULT);
if (ret == 0) {
- PyErr_SetFromOSErrnoWithSyscall("RegisterWaitForSingleObject");
+ psutil_PyErr_SetFromOSErrnoWithSyscall("RegisterWaitForSingleObject");
return NULL;
}
diff --git a/contrib/python/psutil/py3/ya.make b/contrib/python/psutil/py3/ya.make
index ec62842832..004095087c 100644
--- a/contrib/python/psutil/py3/ya.make
+++ b/contrib/python/psutil/py3/ya.make
@@ -2,7 +2,7 @@
PY3_LIBRARY()
-VERSION(6.0.0)
+VERSION(6.1.0)
LICENSE(BSD-3-Clause)
@@ -27,7 +27,7 @@ NO_CHECK_IMPORTS(
NO_UTIL()
CFLAGS(
- -DPSUTIL_VERSION=600
+ -DPSUTIL_VERSION=610
)
SRCS(