summaryrefslogtreecommitdiff
path: root/psutil/_psbsd.py
Commit message (Collapse)AuthorAgeFilesLines
* NetBSD, cmdline(): add debug message on EINVAL (re. to #2250)Giampaolo Rodola2023-05-021-4/+6
|
* Add CI testing for OpenBSD and NetBSD (#2240)Giampaolo Rodola2023-04-171-2/+2
|
* fix #2238 if cwd() cannot be determined always return "" instead of NoneGiampaolo Rodola2023-04-171-1/+1
|
* BSD: refactor py code related to filtering connectionsGiampaolo Rodola2023-04-161-42/+18
|
* [NetBSD] virtual_memory() metrics are completely wrong (#2235), fixes #2234Giampaolo Rodola2023-04-151-18/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Match values shown by **htop**. This is before. In here: * available mem is almost the same as total (unrealistic) * used is higher than total; there's also a failing test: ``` MEMORY ------ Total : 972.7M Available : 959.1M Percent : 1.4 Used : 1.1G Free : 173.6M Active : 434.3M Inactive : 258.4M Buffers : 509.4M Cached : 692.9M Shared : 0.0B Wired : 280.0K ``` Now: ``` MEMORY ------ Total : 972.7M Available : 538.1M Percent : 44.7 Used : 434.5M Free : 173.6M Active : 434.2M Inactive : 258.4M Buffers : 509.4M Cached : 692.9M Shared : 0.0B Wired : 280.0K ```
* [NetBSD] available mem can be higher than total (#2233)Giampaolo Rodola2023-04-141-10/+19
| | | | | | | | | | | | | | | | | On NetBSD "available" memory can be higher than "total". From now now calculate it exactly the same as Zabbix: https://github.com/zabbix/zabbix/blob/af5e0f80253e585ca7082ca6bc9cc07400afe2a7/src/libs/zbxsysinfo/netbsd/memory.c Fixes https://github.com/giampaolo/psutil/issues/2231 which produced this failure: ``` ====================================================================== FAIL: psutil.tests.test_system.TestMemoryAPIs.test_virtual_memory ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/vagrant/psutil/psutil/tests/test_system.py", line 275, in test_virtual_memory assert 0 <= mem.percent <= 100, mem ^^^^^^^^^^^^^^^^^^^^^^^ AssertionError: svmem(total=1019899904, available=1046573056, percent=-2.6, used=603414528, free=545050624, active=234807296, inactive=133210112, buffers=260288512, cached=368312320, shared=0, wired=294912) ```
* OpenBSD: rewrite net_connections() from scratch (#2230)Giampaolo Rodola2023-04-131-18/+28
|
* OpenBSD is unable to recognize zombie process. (#2229)Giampaolo Rodola2023-04-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | OpenBSD is unable to recognize zombie process. It will raise NoSuchProcess instead of ZombieProcess. Test failure: ====================================================================== ERROR: psutil.tests.test_process.TestProcess.test_zombie_process ---------------------------------------------------------------------- Traceback (most recent call last): File "/vagrant/psutil/psutil/_psbsd.py", line 560, in wrapper return fun(self, *args, **kwargs) File "/vagrant/psutil/psutil/_psbsd.py", line 862, in open_files rawlist = cext.proc_open_files(self.pid) ProcessLookupError: [Errno 3] No such process During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/vagrant/psutil/psutil/tests/test_process.py", line 1312, in test_zombie_process zproc.as_dict() File "/vagrant/psutil/psutil/__init__.py", line 528, in as_dict ret = meth() File "/vagrant/psutil/psutil/__init__.py", line 1142, in open_files return self._proc.open_files() File "/vagrant/psutil/psutil/_psbsd.py", line 565, in wrapper raise NoSuchProcess(self.pid, self._name) psutil.NoSuchProcess: process no longer exists (pid=67013) This happens because OpenBSD is the only BSD defining 2 codes for zombie processes: # According to /usr/include/sys/proc.h SZOMB is unused. # test_zombie_process() shows that SDEAD is the right # equivalent. Also it appears there's no equivalent of # psutil.STATUS_DEAD. SDEAD really means STATUS_ZOMBIE. # cext.SZOMB: _common.STATUS_ZOMBIE, cext.SDEAD: _common.STATUS_ZOMBIE, cext.SZOMB: _common.STATUS_ZOMBIE,
* Add in support for network interface flags. (#2037)Chris Lalancette2022-09-061-2/+5
| | | | Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
* [NetBSD] get data about cached memory usage from /proc/meminfo as well (#2088)Thomas Klausner2022-08-271-0/+2
|
* Fix missing whitespace in try-except caluses (#2127)Ben Raz2022-07-311-2/+2
|
* add flake8-quotes pluginGiampaolo Rodola2022-05-251-1/+1
| | | | Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
* OpenBSD: add support for CPU frequency (#2057)Giampaolo Rodola2022-01-161-24/+30
|
* Automatically sort imports (isort CLI tool) (#2033)Giampaolo Rodola2021-12-141-6/+6
|
* FreeBSD: move CPU C functions in their own cpu.c moduleGiampaolo Rodola2020-12-241-1/+1
|
* Rename cpu_count_physical() to cpu_count_cores()Giampaolo Rodola2020-12-211-6/+5
| | | | | | | | | | This has always been cause of confusion, e.g. see: https://github.com/giampaolo/psutil/pull/1727#issuecomment-698934643 Removed the reference to "physical" from dostrings, functions and test. I still left it in the doc though, as it's more explanatory. Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
* [macOS, UNIX] prefer _SC_PAGESIZE over (partially) deprecated getpagesize() ↵Giampaolo Rodola2020-12-171-4/+1
| | | | | | | | | | | | | | | (#1891) Add a reusable `psutil_getpagesize()` utility common to all UNIXes. Related to #1885 (`getpagesize()` is deprecated on recent macOS, POSIX.1-2001 and possibly other UNIXes). The problem emerged on macOS but `getpagesize()` is also used in FreeBSD, NetBSD, OpenBSD and AIX, so it makes sense to do this in one place only, similarly to Windows which also provide a `psutil_getpagesize()` utility. Follow cPython's `mmapmodule.c` and `resourcemodule.c` lead and rely on `sysconf(_SC_PAGESIZE)` instead, but leave `getpagesize()` in place as last resort/attempt for systems where it's not deprecated and/or they still legitimately rely on it. Also provide a python wrapper so we can test the return value of this C function against Python's stdlib modules. Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
* disk_partitions() maxfile and maxpath (#1863)Giampaolo Rodola2020-10-241-1/+3
|
* [FreeBSD] process resource limits (#1859) (#809)Giampaolo Rodola2020-10-231-0/+12
|
* update doc for #1830 (net_if_stats() isup check if NIC is running)Giampaolo Rodola2020-09-211-1/+1
|
* Implement Process.environ() on *BSD family (#1800) (patch by Armin Gruner)Armin Gruner2020-08-131-5/+8
|
* [macOS] Fix zombie leak detection on (#1766)Giampaolo Rodola2020-05-251-6/+6
|
* OpenBSD fixes (#1673)Giampaolo Rodola2020-01-271-1/+1
|
* Add CI testing for FreeBSD (#1671)Giampaolo Rodola2020-01-241-0/+2
|
* move custom exceptions in _common.pyGiampaolo Rodola2020-01-021-7/+3
|
* PEP-3151: backport FS exceptions to Python 2 (#1544)Giampaolo Rodola2019-06-281-17/+19
|
* fix various testsGiampaolo Rodola2019-06-141-1/+0
|
* #1536: better detection of zombie procGiampaolo Rodola2019-06-141-3/+16
|
* [NetBSD] cmdline() raise ZombieProcess when unable to decode chars (#1536)Giampaolo Rodola2019-06-141-4/+3
| | | | | | | | | * bug #1536 / NetBSD / cmdline: treat EINVAL as 'return []' This happens with unicode test, meaning the C routine it's unable to decode the unicode chars. Also, fix a bug introduced in 1530 (C impl of cwd()) which does not take ENOENT into account.
* Connection family/type are not converted to enums (#1535)Giampaolo Rodola2019-06-141-42/+11
|
* Implement psutil_proc_cwd for NetBSD (#1530)Kamil Rytarowski2019-06-121-4/+1
| | | | Pick KERN_PROC_CWD that is available in 8.99.43 and fallback for older versions to readlink("/proc/$PID/cwd").
* fix #1447: we weren't use @wrap_exceptions around oneshot() (doh\!)Giampaolo Rodola2019-03-031-0/+1
|
* refactorGiampaolo Rodola2019-02-271-15/+10
|
* fix NetBSD: Process.connections() may return incomplete results if using ↵Giampaolo Rodola2019-02-271-3/+3
| | | | oneshot() #1439
* fix #1402: move psutil exceptions back into __init__.pyGiampaolo Rodola2019-02-041-3/+7
|
* #1373: different approach to oneshot() cache (pass Process instances around ↵Giampaolo Rodola2018-12-131-3/+3
| | | | - which is faster)
* give CREDITS to @amanusk for #1369 / #1352 and update docGiampaolo Rodola2018-12-011-7/+5
|
* Add CPU frequency support for FreeBSD (#1369)Alex Manuskin2018-12-011-0/+26
| | | | Add CPU frequency support for FreeBSD (patch by @amanusk)
* FreeBSD adding temperature sensors (WIP) (#1350)Alex Manuskin2018-11-031-0/+18
| | | FreeBSD: add temperature sensors
* refactor hasattr() checks as global constantsGiampaolo Rodola2018-10-161-5/+10
|
* fix #1279: catch and skip ENODEV in net_if_stat()Giampaolo Rodola2018-07-161-6/+12
|
* rename function argGiampaolo Rodola2018-03-241-2/+2
|
* #1174: use TimeoutExpired in wait_pid()Giampaolo Rodola2017-11-131-5/+1
|
* sort imports by nameGiampaolo Rodola2017-11-121-2/+2
|
* Move exceptions to separate file (#1174)wiggin152017-11-121-6/+4
|
* fix #1125: [BSD] net_connections() raises TypeError.Giampaolo Rodola2017-09-081-2/+5
|
* #928: fix possible TypeErrorGiampaolo Rodola2017-08-011-4/+8
|
* fix #928: turn connections()' 'laddr' and 'raddr' into named tuplesGiampaolo Rodola2017-06-231-0/+10
|
* add extra assertGiampaolo Rodola2017-05-161-1/+1
|
* fix #1074: [FreeBSD] sensors_battery() raises OSError in case of no battery.Giampaolo Rodola2017-05-161-1/+5
|