summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2018-06-26 16:57:36 -0700
committerGitHub <noreply@github.com>2018-06-26 16:57:36 -0700
commit2f60e997fc1c500e0c245979bbecf2761f36e820 (patch)
tree5459ce3b71fad107ec41c8b720811a8110a3380d
parent7a3ed446447ec845a7d03b32233b4ed7b48f3c26 (diff)
downloadpsutil-2f60e997fc1c500e0c245979bbecf2761f36e820.tar.gz
Rename OSX to macOS (#1298)
rename OSX to macOS
-rw-r--r--.ci/README2
-rwxr-xr-x.ci/travis/run.sh2
-rw-r--r--.coveragerc2
-rw-r--r--.travis.yml2
-rw-r--r--CREDITS4
-rw-r--r--DEVGUIDE.rst10
-rw-r--r--HISTORY.rst99
-rw-r--r--IDEAS6
-rw-r--r--INSTALL.rst6
-rw-r--r--MANIFEST.in12
-rw-r--r--Makefile2
-rw-r--r--README.rst6
-rw-r--r--docs/index.rst57
-rw-r--r--psutil/__init__.py37
-rw-r--r--psutil/_common.py9
-rw-r--r--psutil/_exceptions.py2
-rw-r--r--psutil/_psmacos.py (renamed from psutil/_psosx.py)10
-rw-r--r--psutil/_psutil_bsd.c2
-rw-r--r--psutil/_psutil_macos.c (renamed from psutil/_psutil_osx.c)32
-rw-r--r--psutil/_psutil_posix.c20
-rw-r--r--psutil/arch/macos/process_info.c (renamed from psutil/arch/osx/process_info.c)6
-rw-r--r--psutil/arch/macos/process_info.h (renamed from psutil/arch/osx/process_info.h)0
-rw-r--r--psutil/arch/macos/smc.c (renamed from psutil/arch/osx/smc.c)0
-rw-r--r--psutil/arch/macos/smc.h (renamed from psutil/arch/osx/smc.h)0
-rw-r--r--psutil/tests/README.rst2
-rw-r--r--psutil/tests/__init__.py8
-rwxr-xr-xpsutil/tests/test_connections.py10
-rwxr-xr-xpsutil/tests/test_contracts.py22
-rwxr-xr-xpsutil/tests/test_macos.py (renamed from psutil/tests/test_osx.py)12
-rwxr-xr-xpsutil/tests/test_memory_leaks.py10
-rwxr-xr-xpsutil/tests/test_posix.py10
-rwxr-xr-xpsutil/tests/test_process.py24
-rwxr-xr-xpsutil/tests/test_system.py12
-rwxr-xr-xpsutil/tests/test_unicode.py6
-rwxr-xr-xscripts/internal/bench_oneshot.py2
-rwxr-xr-xscripts/internal/print_announce.py6
-rwxr-xr-xscripts/iotop.py2
-rwxr-xr-xscripts/pmap.py2
-rwxr-xr-xscripts/procsmem.py2
-rwxr-xr-xsetup.py16
40 files changed, 245 insertions, 229 deletions
diff --git a/.ci/README b/.ci/README
index 86b72afb..810fe638 100644
--- a/.ci/README
+++ b/.ci/README
@@ -1,3 +1,3 @@
This directory contains support scripts for Travis and Appveyor continuous
integration services.
-Travis is used to run tests on Linux and OSX, Appveyor runs tests on Windows.
+Travis is used to run tests on Linux and macOS, Appveyor runs tests on Windows.
diff --git a/.ci/travis/run.sh b/.ci/travis/run.sh
index 1501387a..06cc5b7e 100755
--- a/.ci/travis/run.sh
+++ b/.ci/travis/run.sh
@@ -5,7 +5,7 @@ set -x
PYVER=`python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))'`
-# setup OSX
+# setup macOS
if [[ "$(uname -s)" == 'Darwin' ]]; then
if which pyenv > /dev/null; then
eval "$(pyenv init -)"
diff --git a/.coveragerc b/.coveragerc
index 7d3f185f..c6772e95 100644
--- a/.coveragerc
+++ b/.coveragerc
@@ -21,7 +21,7 @@ exclude_lines =
if LITTLE_ENDIAN:
if NETBSD
if OPENBSD
- if OSX
+ if MACOS
if ppid_map is None:
if PY3:
if SUNOS
diff --git a/.travis.yml b/.travis.yml
index 9289eb6b..86cc73ec 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -9,7 +9,7 @@ matrix:
- python: 3.4
- python: 3.5
- python: 3.6
- # OSX
+ # macOS
- language: generic
os: osx
env: PYVER=py27
diff --git a/CREDITS b/CREDITS
index fd4f53d6..89a91008 100644
--- a/CREDITS
+++ b/CREDITS
@@ -34,7 +34,7 @@ Github usernames of people to CC on github when in need of help.
- glebius, Gleb Smirnoff (#1013)
- sunpoet, Po-Chuan Hsieh (pkg maintainer, #1105)
- kostikbel, Konstantin Belousov (#1105)
-- OSX:
+- macOS:
- whitlockjc, Jeremy Whitlock
- Windows:
- mrjefftang, Jeff Tang
@@ -65,7 +65,7 @@ I: 340, 529, 616, 653, 654, 648, 641
N: Jeremy Whitlock
E: jcscoobyrs@gmail.com
-D: great help with OSX C development.
+D: great help with macOS C development.
I: 125, 150, 174, 206
N: Landry Breuil
diff --git a/DEVGUIDE.rst b/DEVGUIDE.rst
index 2d48ced2..f604480e 100644
--- a/DEVGUIDE.rst
+++ b/DEVGUIDE.rst
@@ -139,10 +139,10 @@ All of the services listed below are automatically run on ``git push``.
Unit tests
----------
-Tests are automatically run for every GIT push on **Linux**, **OSX** and
+Tests are automatically run for every GIT push on **Linux**, **macOS** and
**Windows** by using:
-- `Travis <https://travis-ci.org/giampaolo/psutil>`_ (Linux, OSX)
+- `Travis <https://travis-ci.org/giampaolo/psutil>`_ (Linux, macOS)
- `Appveyor <https://ci.appveyor.com/project/giampaolo/psutil>`_ (Windows)
Test files controlling these are
@@ -153,15 +153,15 @@ Both services run psutil test suite against all supported python version
(2.6 - 3.6).
Two icons in the home page (README) always show the build status:
-.. image:: https://img.shields.io/travis/giampaolo/psutil/master.svg?maxAge=3600&label=Linux%20/%20OSX
+.. image:: https://img.shields.io/travis/giampaolo/psutil/master.svg?maxAge=3600&label=Linux%20/%20macOS
:target: https://travis-ci.org/giampaolo/psutil
- :alt: Linux tests (Travis)
+ :alt: Linux and macOS tests (Travis)
.. image:: https://img.shields.io/appveyor/ci/giampaolo/psutil/master.svg?maxAge=3600&label=Windows
:target: https://ci.appveyor.com/project/giampaolo/psutil
:alt: Windows tests (Appveyor)
-OSX, BSD, AIX and Solaris are currently tested manually (sigh!).
+BSD, AIX and Solaris are currently tested manually.
Test coverage
-------------
diff --git a/HISTORY.rst b/HISTORY.rst
index 3ba71314..67f967ed 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -7,14 +7,16 @@ XXXX-XX-XX
**Enhancements**
-- 1284_: [OSX] added support for sensors_temperatures() and sensors_fans().
+- 1284_: [macOS] added support for sensors_temperatures() and sensors_fans().
(patch by Alex Manuskin)
+- 1286_: [macOS] psutil.OSX constant is now deprecated in favor of new
+ psutil.MACOS.
**Bug fixes**
-- 1209_: [OSX] Process.memory_maps() may fail with EINVAL due to poor
+- 1209_: [macOS] Process.memory_maps() may fail with EINVAL due to poor
task_for_pid() syscall. AccessDenied is now raised instead.
-- 1278_: [OSX] Process.threads() incorrectly return microseconds instead of
+- 1278_: [macOS] Process.threads() incorrectly return microseconds instead of
seconds. (patch by Nikhil Marathe)
5.4.6
@@ -101,7 +103,7 @@ XXXX-XX-XX
**Bug fixes**
-- 1193_: pids() may return False on OSX.
+- 1193_: pids() may return False on macOS.
5.4.2
=====
@@ -112,7 +114,7 @@ XXXX-XX-XX
- 1173_: introduced PSUTIL_DEBUG environment variable which can be set in order
to print useful debug messages on stderr (useful in case of nasty errors).
-- 1177_: added support for sensors_battery() on OSX. (patch by Arnon Yaari)
+- 1177_: added support for sensors_battery() on macOS. (patch by Arnon Yaari)
- 1183_: Process.children() is 2x faster on UNIX and 2.4x faster on Linux.
- 1188_: deprecated method Process.memory_info_ex() now warns by using
FutureWarning instead of DeprecationWarning.
@@ -126,8 +128,8 @@ XXXX-XX-XX
- 1179_: [Linux] Process.cmdline() is now able to splits cmdline args for
misbehaving processes which overwrite /proc/pid/cmdline and use spaces
instead of null bytes as args separator.
-- 1181_: [OSX] Process.memory_maps() may raise ENOENT.
-- 1187_: [OSX] pids() does not return PID 0 on recent OSX versions.
+- 1181_: [macOS] Process.memory_maps() may raise ENOENT.
+- 1187_: [macOS] pids() does not return PID 0 on recent macOS versions.
5.4.1
=====
@@ -164,7 +166,7 @@ XXXX-XX-XX
- 1009_: [Linux] sensors_temperatures() may crash with IOError.
- 1012_: [Windows] disk_io_counters()'s read_time and write_time were expressed
in tens of micro seconds instead of milliseconds.
-- 1127_: [OSX] invalid reference counting in Process.open_files() may lead to
+- 1127_: [macOS] invalid reference counting in Process.open_files() may lead to
segfault. (patch by Jakub Bacic)
- 1129_: [Linux] sensors_fans() may crash with IOError. (patch by Sebastian
Saip)
@@ -236,14 +238,14 @@ XXXX-XX-XX
cards installed.
- 1021_: [Linux] open_files() may erroneously raise NoSuchProcess instead of
skipping a file which gets deleted while open files are retrieved.
-- 1029_: [OSX, FreeBSD] Process.connections('unix') on Python 3 doesn't
+- 1029_: [macOS, FreeBSD] Process.connections('unix') on Python 3 doesn't
properly handle unicode paths and may raise UnicodeDecodeError.
-- 1033_: [OSX, FreeBSD] memory leak for net_connections() and
+- 1033_: [macOS, FreeBSD] memory leak for net_connections() and
Process.connections() when retrieving UNIX sockets (kind='unix').
- 1040_: fixed many unicode related issues such as UnicodeDecodeError on
Python 3 + UNIX and invalid encoded data on Windows.
- 1042_: [FreeBSD] psutil won't compile on FreeBSD 12.
-- 1044_: [OSX] different Process methods incorrectly raise AccessDenied for
+- 1044_: [macOS] different Process methods incorrectly raise AccessDenied for
zombie processes.
- 1046_: [Windows] disk_partitions() on Windows overrides user's SetErrorMode.
- 1047_: [Windows] Process username(): memory leak in case exception is thrown.
@@ -345,7 +347,8 @@ XXXX-XX-XX
**Bug fixes**
- 872_: [Linux] can now compile on Linux by using MUSL C library.
-- 985_: [Windows] Fix a crash in `Process.open_files` when the worker thread for `NtQueryObject` times out.
+- 985_: [Windows] Fix a crash in `Process.open_files` when the worker thread
+ for `NtQueryObject` times out.
- 986_: [Linux] Process.cwd() may raise NoSuchProcess instead of ZombieProcess.
5.1.3
@@ -485,8 +488,8 @@ XXXX-XX-XX
**Bug fixes**
-- 514_: [OSX] possibly fix Process.memory_maps() segfault (critical!).
-- 783_: [OSX] Process.status() may erroneously return "running" for zombie
+- 514_: [macOS] possibly fix Process.memory_maps() segfault (critical!).
+- 783_: [macOS] Process.status() may erroneously return "running" for zombie
processes.
- 798_: [Windows] Process.open_files() returns and empty list on Windows 10.
- 825_: [Linux] cpu_affinity; fix possible double close and use of unopened
@@ -499,12 +502,12 @@ XXXX-XX-XX
- 906_: [BSD] disk_partitions(all=False) returned an empty list. Now the
argument is ignored and all partitions are always returned.
- 907_: [FreeBSD] Process.exe() may fail with OSError(ENOENT).
-- 908_: [OSX, BSD] different process methods could errounesuly mask the real
+- 908_: [macOS, BSD] different process methods could errounesuly mask the real
error for high-privileged PIDs and raise NoSuchProcess and AccessDenied
instead of OSError and RuntimeError.
-- 909_: [OSX] Process open_files() and connections() methods may raise
+- 909_: [macOS] Process open_files() and connections() methods may raise
OSError with no exception set if process is gone.
-- 916_: [OSX] fix many compilation warnings.
+- 916_: [macOS] fix many compilation warnings.
4.3.1
=====
@@ -585,7 +588,7 @@ XXXX-XX-XX
- 777_: [Linux] Process.open_files() on Linux return 3 new fields: position,
mode and flags.
- 779_: Process.cpu_times() returns two new fields, 'children_user' and
- 'children_system' (always set to 0 on OSX and Windows).
+ 'children_system' (always set to 0 on macOS and Windows).
- 789_: [Windows] psutil.cpu_times() return two new fields: "interrupt" and
"dpc". Same for psutil.cpu_times_percent().
- 792_: new psutil.cpu_stats() function returning number of CPU ctx switches
@@ -597,10 +600,10 @@ XXXX-XX-XX
provides it.
- 776_: [Linux] Process.cpu_affinity() may erroneously raise NoSuchProcess.
(patch by wxwright)
-- 780_: [OSX] psutil does not compile with some gcc versions.
+- 780_: [macOS] psutil does not compile with some gcc versions.
- 786_: net_if_addrs() may report incomplete MAC addresses.
- 788_: [NetBSD] virtual_memory()'s buffers and shared values were set to 0.
-- 790_: [OSX] psutil won't compile on OSX 10.4.
+- 790_: [macOS] psutil won't compile on macOS 10.4.
4.0.0
=====
@@ -613,11 +616,11 @@ XXXX-XX-XX
- 660_: [Windows] make.bat is smarter in finding alternative VS install
locations. (patch by mpderbec)
- 732_: Process.environ(). (patch by Frank Benkstein)
-- 753_: [Linux, OSX, Windows] Process USS and PSS (Linux) "real" memory stats.
+- 753_: [Linux, macOS, Windows] Process USS and PSS (Linux) "real" memory stats.
(patch by Eric Rahm)
- 755_: Process.memory_percent() "memtype" parameter.
- 758_: tests now live in psutil namespace.
-- 760_: expose OS constants (psutil.LINUX, psutil.OSX, etc.)
+- 760_: expose OS constants (psutil.LINUX, psutil.macOS, etc.)
- 756_: [Linux] disk_io_counters() return 2 new fields: read_merged_count and
write_merged_count.
- 762_: new scripts/procsmem.py script.
@@ -734,7 +737,7 @@ XXXX-XX-XX
- 644_: [Windows] added support for CTRL_C_EVENT and CTRL_BREAK_EVENT signals
to use with Process.send_signal().
-- 648_: CI test integration for OSX. (patch by Jeff Tang)
+- 648_: CI test integration for macOS. (patch by Jeff Tang)
- 663_: [UNIX] net_if_addrs() now returns point-to-point (VPNs) addresses.
- 655_: [Windows] different issues regarding unicode handling were fixed. On
Python 2 all APIs returning a string will now return an encoded version of it
@@ -1253,7 +1256,7 @@ DeprecationWarning.
- 374_: [Windows] negative memory usage reported if process uses a lot of
memory.
- 379_: [Linux] Process.get_memory_maps() may raise ValueError.
-- 394_: [OSX] Mapped memory regions report incorrect file name.
+- 394_: [macOS] Mapped memory regions report incorrect file name.
- 404_: [Linux] sched_*affinity() are implicitly declared. (patch by Arfrever)
**API changes**
@@ -1302,16 +1305,16 @@ DeprecationWarning.
certain exotic Linux flavors having an incomplete /proc interface.
If that's the case we now set the unretrievable stats to 0 and raise a
RuntimeWarning.
-- 315_: [OSX] fix some compilation warnings.
+- 315_: [macOS] fix some compilation warnings.
- 317_: [Windows] cannot set process CPU affinity above 31 cores.
- 319_: [Linux] process get_memory_maps() raises KeyError 'Anonymous' on Debian
squeeze.
- 321_: [UNIX] Process.ppid property is no longer cached as the kernel may set
the ppid to 1 in case of a zombie process.
-- 323_: [OSX] disk_io_counters()'s read_time and write_time parameters were
+- 323_: [macOS] disk_io_counters()'s read_time and write_time parameters were
reporting microseconds not milliseconds. (patch by Gregory Szorc)
- 331_: Process cmdline is no longer cached after first acces as it may change.
-- 333_: [OSX] Leak of Mach ports on OS X (patch by rsesek@google.com)
+- 333_: [macOS] Leak of Mach ports on macOS (patch by rsesek@google.com)
- 337_: [Linux] process methods not working because of a poor /proc
implementation will raise NotImplementedError rather than RuntimeError
and Process.as_dict() will not blow up. (patch by Curtin1060)
@@ -1324,7 +1327,7 @@ DeprecationWarning.
- 338_: [Linux] disk_io_counters() fails to find some disks.
- 351_: [Windows] if psutil is compiled with mingw32 (provided installers for
py2.4 and py2.5 are) disk_io_counters() will fail. (Patch by m.malycha)
-- 353_: [OSX] get_users() returns an empty list on OSX 10.8.
+- 353_: [macOS] get_users() returns an empty list on macOS 10.8.
- 356_: Process.parent now checks whether parent PID has been reused in which
case returns None.
- 365_: Process.set_nice() should check PID has not been reused by another
@@ -1370,11 +1373,11 @@ DeprecationWarning.
- 216_: [POSIX] get_connections() UNIX sockets support.
- 220_: [FreeBSD] get_connections() has been rewritten in C and no longer
requires lsof.
-- 222_: [OSX] add support for process cwd.
+- 222_: [macOS] add support for process cwd.
- 261_: process extended memory info.
-- 295_: [OSX] process executable path is now determined by asking the OS
+- 295_: [macOS] process executable path is now determined by asking the OS
instead of being guessed from process cmdline.
-- 297_: [OSX] the Process methods below were always raising AccessDenied for
+- 297_: [macOS] the Process methods below were always raising AccessDenied for
any process except the current one. Now this is no longer true. Also
they are 2.5x faster.
- name
@@ -1407,8 +1410,8 @@ DeprecationWarning.
- active [POSIX]
- inactive [POSIX]
- buffers (BSD, Linux)
- - cached (BSD, OSX)
- - wired (OSX, BSD)
+ - cached (BSD, macOS)
+ - wired (macOS, BSD)
- shared [FreeBSD]
New psutil.swap_memory() provides:
- total
@@ -1425,7 +1428,7 @@ DeprecationWarning.
**Bug fixes**
-- 298_: [OSX and BSD] memory leak in get_num_fds().
+- 298_: [macOS and BSD] memory leak in get_num_fds().
- 299_: potential memory leak every time PyList_New(0) is used.
- 303_: [Windows] potential heap corruption in get_num_threads() and
get_status() Process methods.
@@ -1480,7 +1483,7 @@ DeprecationWarning.
- 245_: [POSIX] Process.wait() incrementally consumes less CPU cycles.
- 257_: [Windows] removed Windows 2000 support.
- 258_: [Linux] Process.get_memory_info() is now 0.5x faster.
-- 260_: process's mapped memory regions. (Windows patch by wj32.64, OSX patch
+- 260_: process's mapped memory regions. (Windows patch by wj32.64, macOS patch
by Jeremy Whitlock)
- 262_: [Windows] psutil.disk_partitions() was slow due to inspecting the
floppy disk drive also when "all" argument was False.
@@ -1503,7 +1506,7 @@ DeprecationWarning.
- 193_: psutil.Popen constructor can throw an exception if the spawned process
terminates quickly.
-- 240_: [OSX] incorrect use of free() for Process.get_connections().
+- 240_: [macOS] incorrect use of free() for Process.get_connections().
- 244_: [POSIX] Process.wait() can hog CPU resources if called against a
process which is not our children.
- 248_: [Linux] psutil.network_io_counters() might return erroneous NIC names.
@@ -1511,7 +1514,7 @@ DeprecationWarning.
processes owned by another user. It now raises AccessDenied instead.
- 266_: [Windows] psutil.get_pid_list() only shows 1024 processes.
(patch by Amoser)
-- 267_: [OSX] Process.get_connections() - an erroneous remote address was
+- 267_: [macOS] Process.get_connections() - an erroneous remote address was
returned. (Patch by Amoser)
- 272_: [Linux] Porcess.get_open_files() - potential race condition can lead to
unexpected NoSuchProcess exception. Also, we can get incorrect reports
@@ -1542,7 +1545,7 @@ DeprecationWarning.
**Bug fixes**
- 228_: some example scripts were not working with python 3.
-- 230_: [Windows / OSX] memory leak in Process.get_connections().
+- 230_: [Windows / macOS] memory leak in Process.get_connections().
- 232_: [Linux] psutil.phymem_usage() can report erroneous values which are
different than "free" command.
- 236_: [Windows] memory/handle leak in Process's get_memory_info(),
@@ -1555,12 +1558,12 @@ DeprecationWarning.
**Enhancements**
-- 150_: network I/O counters. (OSX and Windows patch by Jeremy Whitlock)
+- 150_: network I/O counters. (macOS and Windows patch by Jeremy Whitlock)
- 154_: [FreeBSD] add support for process getcwd()
- 157_: [Windows] provide installer for Python 3.2 64-bit.
- 198_: Process.wait(timeout=0) can now be used to make wait() return
immediately.
-- 206_: disk I/O counters. (OSX and Windows patch by Jeremy Whitlock)
+- 206_: disk I/O counters. (macOS and Windows patch by Jeremy Whitlock)
- 213_: examples/iotop.py script.
- 217_: Process.get_connections() now has a "kind" argument to filter
for connections with different criteria.
@@ -1571,7 +1574,7 @@ DeprecationWarning.
**Bug fixes**
-- 135_: [OSX] psutil cannot create Process object.
+- 135_: [macOS] psutil cannot create Process object.
- 144_: [Linux] no longer support 0 special PID.
- 188_: [Linux] psutil import error on Linux ARM architectures.
- 194_: [POSIX] psutil.Process.get_cpu_percent() now reports a percentage over
@@ -1613,7 +1616,7 @@ DeprecationWarning.
- 166_: get_memory_info() leaks handles hogging system resources.
- 168_: psutil.cpu_percent() returns erroneous results when used in
non-blocking mode. (patch by Philip Roberts)
-- 178_: OSX - Process.get_threads() leaks memory
+- 178_: macOS - Process.get_threads() leaks memory
- 180_: [Windows] Process's get_num_threads() and get_threads() methods can
raise NoSuchProcess exception while process still exists.
@@ -1638,14 +1641,14 @@ DeprecationWarning.
- 147_: per-process I/O nice (priority) - Linux only.
- 148_: psutil.Popen class which tidies up subprocess.Popen and psutil.Process
in a unique interface.
-- 152_: [OSX] get_process_open_files() implementation has been rewritten
+- 152_: [macOS] get_process_open_files() implementation has been rewritten
in C and no longer relies on lsof resulting in a 3x speedup.
-- 153_: [OSX] get_process_connection() implementation has been rewritten
+- 153_: [macOS] get_process_connection() implementation has been rewritten
in C and no longer relies on lsof resulting in a 3x speedup.
**Bug fixes**
-- 83_: process cmdline is empty on OSX 64-bit.
+- 83_: process cmdline is empty on macOS 64-bit.
- 130_: a race condition can cause IOError exception be raised on
Linux if process disappears between open() and subsequent read() calls.
- 145_: WindowsError was raised instead of psutil.AccessDenied when using
@@ -1697,7 +1700,7 @@ DeprecationWarning.
left behind every time Process class was instantiated.
- 111_: path and name Process properties report truncated or erroneous
values on UNIX.
-- 120_: cpu_percent() always returning 100% on OS X.
+- 120_: cpu_percent() always returning 100% on macOS.
- 112_: uid and gid properties don't change if process changes effective
user/group id at some point.
- 126_: ppid, uid, gid, name, exe, cmdline and create_time properties are
@@ -1746,7 +1749,7 @@ DeprecationWarning.
available
- 58_: is_running() is now called before kill() to make sure we are going
to kill the correct process.
-- 73_: virtual memory size reported on OS X includes shared library size
+- 73_: virtual memory size reported on macOS includes shared library size
- 77_: NoSuchProcess wasn't raised on Process.create_time if kill() was
used first.
@@ -1770,7 +1773,7 @@ DeprecationWarning.
**Bug fixes**
- 36_: [Windows] NoSuchProcess not raised when accessing timing methods.
-- 40_: test_get_cpu_times() failing on FreeBSD and OS X.
+- 40_: test_get_cpu_times() failing on FreeBSD and macOS.
- 42_: [Windows] get_memory_percent() raises AccessDenied.
0.1.1
diff --git a/IDEAS b/IDEAS
index 90372698..8190d48b 100644
--- a/IDEAS
+++ b/IDEAS
@@ -18,7 +18,7 @@ PLATFORMS
FEATURES
========
-- #371: sensors_temperatures() at least for OSX.
+- #371: sensors_temperatures() at least for macOS.
- #669: Windows / net_if_addrs(): return broadcast addr.
@@ -27,7 +27,7 @@ FEATURES
- #772: extended net_io_counters() metrics.
-- #900: wheels for OSX and Linux.
+- #900: wheels for macOS and Linux.
- #922: extended net_io_stats() info.
@@ -51,7 +51,7 @@ FEATURES
Linux: yes
Others: ?
-- Process.threads(): thread names; patch for OSX available at:
+- Process.threads(): thread names; patch for macOS available at:
https://code.google.com/p/plcrashreporter/issues/detail?id=65
Sample code:
https://github.com/janmojzis/pstree/blob/master/proc_kvm.c
diff --git a/INSTALL.rst b/INSTALL.rst
index 4ceb0c19..6644fb37 100644
--- a/INSTALL.rst
+++ b/INSTALL.rst
@@ -10,7 +10,7 @@ On Linux or via wget:
wget https://bootstrap.pypa.io/get-pip.py -O - | python
-On OSX or via curl:
+On macOS or via curl:
.. code-block:: bash
@@ -61,8 +61,8 @@ RedHat / CentOS:
If you're on Python 3 use ``python3-dev`` and ``python3-pip`` instead.
-OSX
-===
+macOS
+=====
Install `Xcode <https://developer.apple.com/downloads/?name=Xcode>`__
first, then:
diff --git a/MANIFEST.in b/MANIFEST.in
index 26d678fc..c6d8c550 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -28,7 +28,7 @@ include psutil/_exceptions.py
include psutil/_psaix.py
include psutil/_psbsd.py
include psutil/_pslinux.py
-include psutil/_psosx.py
+include psutil/_psmacos.py
include psutil/_psposix.py
include psutil/_pssunos.py
include psutil/_psutil_aix.c
@@ -36,7 +36,7 @@ include psutil/_psutil_bsd.c
include psutil/_psutil_common.c
include psutil/_psutil_common.h
include psutil/_psutil_linux.c
-include psutil/_psutil_osx.c
+include psutil/_psutil_macos.c
include psutil/_psutil_posix.c
include psutil/_psutil_posix.h
include psutil/_psutil_sunos.c
@@ -55,14 +55,16 @@ include psutil/arch/freebsd/specific.c
include psutil/arch/freebsd/specific.h
include psutil/arch/freebsd/sys_socks.c
include psutil/arch/freebsd/sys_socks.h
+include psutil/arch/macos/process_info.c
+include psutil/arch/macos/process_info.h
+include psutil/arch/macos/smc.c
+include psutil/arch/macos/smc.h
include psutil/arch/netbsd/socks.c
include psutil/arch/netbsd/socks.h
include psutil/arch/netbsd/specific.c
include psutil/arch/netbsd/specific.h
include psutil/arch/openbsd/specific.c
include psutil/arch/openbsd/specific.h
-include psutil/arch/osx/process_info.c
-include psutil/arch/osx/process_info.h
include psutil/arch/solaris/environ.c
include psutil/arch/solaris/environ.h
include psutil/arch/solaris/v10/ifaddrs.c
@@ -86,9 +88,9 @@ include psutil/tests/test_bsd.py
include psutil/tests/test_connections.py
include psutil/tests/test_contracts.py
include psutil/tests/test_linux.py
+include psutil/tests/test_macos.py
include psutil/tests/test_memory_leaks.py
include psutil/tests/test_misc.py
-include psutil/tests/test_osx.py
include psutil/tests/test_posix.py
include psutil/tests/test_process.py
include psutil/tests/test_sunos.py
diff --git a/Makefile b/Makefile
index 51047383..58c0d396 100644
--- a/Makefile
+++ b/Makefile
@@ -142,7 +142,7 @@ test-posix: ## POSIX specific tests.
test-platform: ## Run specific platform tests only.
${MAKE} install
- $(TEST_PREFIX) $(PYTHON) psutil/tests/test_`$(PYTHON) -c 'import psutil; print([x.lower() for x in ("LINUX", "BSD", "OSX", "SUNOS", "WINDOWS", "AIX") if getattr(psutil, x)][0])'`.py
+ $(TEST_PREFIX) $(PYTHON) psutil/tests/test_`$(PYTHON) -c 'import psutil; print([x.lower() for x in ("LINUX", "BSD", "MACOS", "SUNOS", "WINDOWS", "AIX") if getattr(psutil, x)][0])'`.py
test-memleaks: ## Memory leak tests.
${MAKE} install
diff --git a/README.rst b/README.rst
index 0852b1ce..abd5816c 100644
--- a/README.rst
+++ b/README.rst
@@ -1,4 +1,4 @@
-.. image:: https://img.shields.io/travis/giampaolo/psutil/master.svg?maxAge=3600&label=Linux%20/%20OSX
+.. image:: https://img.shields.io/travis/giampaolo/psutil/master.svg?maxAge=3600&label=Linux%20/%20macOS
:target: https://travis-ci.org/giampaolo/psutil
:alt: Linux tests (Travis)
@@ -56,7 +56,7 @@ psutil currently supports the following platforms:
- **Linux**
- **Windows**
-- **OSX**,
+- **macOS**,
- **FreeBSD, OpenBSD**, **NetBSD**
- **Sun Solaris**
- **AIX**
@@ -307,7 +307,7 @@ Process management
>>>
>>> p.memory_info()
pmem(rss=10915840, vms=67608576, shared=3313664, text=2310144, lib=0, data=7262208, dirty=0)
- >>> p.memory_full_info() # "real" USS memory usage (Linux, OSX, Win only)
+ >>> p.memory_full_info() # "real" USS memory usage (Linux, macOS, Win only)
pfullmem(rss=10199040, vms=52133888, shared=3887104, text=2867200, lib=0, data=5967872, dirty=0, uss=6545408, pss=6872064, swap=0)
>>> p.memory_percent()
0.7823
diff --git a/docs/index.rst b/docs/index.rst
index 208f59e9..47167d76 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -32,7 +32,7 @@ psutil currently supports the following platforms:
- **Linux**
- **Windows**
-- **OSX**,
+- **macOS**,
- **FreeBSD, OpenBSD**, **NetBSD**
- **Sun Solaris**
- **AIX**
@@ -235,7 +235,7 @@ CPU
scpufreq(current=1703.609, min=800.0, max=3500.0),
scpufreq(current=1754.289, min=800.0, max=3500.0)]
- Availability: Linux, OSX, Windows
+ Availability: Linux, macOS, Windows
.. versionadded:: 5.1.0
@@ -272,7 +272,7 @@ Memory
- **shared** *(Linux, BSD)*: memory that may be simultaneously accessed by
multiple processes.
- **slab** *(Linux)*: in-kernel data structures cache.
- - **wired** *(BSD, OSX)*: memory that is marked to always stay in RAM. It is
+ - **wired** *(BSD, macOS)*: memory that is marked to always stay in RAM. It is
never moved to disk.
The sum of **used** and **available** does not necessarily equal **total**.
@@ -345,7 +345,7 @@ Disks
On Windows it is determined via
`GetDriveType <http://msdn.microsoft.com/en-us/library/aa364939(v=vs.85).aspx>`__
and can be either ``"removable"``, ``"fixed"``, ``"remote"``, ``"cdrom"``,
- ``"unmounted"`` or ``"ramdisk"``. On OSX and BSD it is retrieved via
+ ``"unmounted"`` or ``"ramdisk"``. On macOS and BSD it is retrieved via
`getfsstat(2) <http://www.manpagez.com/man/2/getfsstat/>`__. See
`disk_usage.py <https://github.com/giampaolo/psutil/blob/master/scripts/disk_usage.py>`__
script providing an example usage.
@@ -462,7 +462,7 @@ Network
- **errout**: total number of errors while sending
- **dropin**: total number of incoming packets which were dropped
- **dropout**: total number of outgoing packets which were dropped (always 0
- on OSX and BSD)
+ on macOS and BSD)
If *pernic* is ``True`` return the same information for every network
interface installed on the system as a dictionary with network interface
@@ -555,7 +555,7 @@ Network
| ``"all"`` | the sum of all the possible families and protocols |
+----------------+-----------------------------------------------------+
- On OSX and AIX this function requires root privileges.
+ On macOS and AIX this function requires root privileges.
To get per-process connections use :meth:`Process.connections`.
Also, see
`netstat.py sample script <https://github.com/giampaolo/psutil/blob/master/scripts/netstat.py>`__.
@@ -570,7 +570,7 @@ Network
...]
.. note::
- (OSX and AIX) :class:`psutil.AccessDenied` is always raised unless running
+ (macOS and AIX) :class:`psutil.AccessDenied` is always raised unless running
as root. This is a limitation of the OS and ``lsof`` does the same.
.. note::
@@ -698,11 +698,11 @@ Sensors
See also `temperatures.py <https://github.com/giampaolo/psutil/blob/master/scripts/temperatures.py>`__ and `sensors.py <https://github.com/giampaolo/psutil/blob/master/scripts/sensors.py>`__
for an example application.
- Availability: Linux, OSX
+ Availability: Linux, macOS
.. versionadded:: 5.1.0
- .. versionchanged:: 5.5.0: added OSX support
+ .. versionchanged:: 5.5.0: added macOS support
.. warning::
@@ -724,11 +724,11 @@ Sensors
See also `fans.py <https://github.com/giampaolo/psutil/blob/master/scripts/fans.py>`__ and `sensors.py <https://github.com/giampaolo/psutil/blob/master/scripts/sensors.py>`__
for an example application.
- Availability: Linux, OSX
+ Availability: Linux, macOS
.. versionadded:: 5.2.0
- .. versionchanged:: 5.5.0: added OSX support
+ .. versionchanged:: 5.5.0: added macOS support
.. warning::
@@ -772,7 +772,7 @@ Sensors
.. versionadded:: 5.1.0
- .. versionchanged:: 5.4.2 added OSX support
+ .. versionchanged:: 5.4.2 added macOS support
.. warning::
@@ -1070,7 +1070,7 @@ Process class
if you call all the methods together (best case scenario).
+------------------------------+-------------------------------+------------------------------+------------------------------+--------------------------+--------------------------+
- | Linux | Windows | OSX | BSD | SunOS | AIX |
+ | Linux | Windows | macOS | BSD | SunOS | AIX |
+==============================+===============================+==============================+==============================+==========================+==========================+
| :meth:`cpu_num` | :meth:`cpu_percent` | :meth:`cpu_percent` | :meth:`cpu_num` | :meth:`name` | :meth:`name` |
+------------------------------+-------------------------------+------------------------------+------------------------------+--------------------------+--------------------------+
@@ -1158,7 +1158,7 @@ Process class
>>> psutil.Process().environ()
{'LC_NUMERIC': 'it_IT.UTF-8', 'QT_QPA_PLATFORMTHEME': 'appmenu-qt5', 'IM_CONFIG_PHASE': '1', 'XDG_GREETER_DATA_DIR': '/var/lib/lightdm-data/giampaolo', 'GNOME_DESKTOP_SESSION_ID': 'this-is-deprecated', 'XDG_CURRENT_DESKTOP': 'Unity', 'UPSTART_EVENTS': 'started starting', 'GNOME_KEYRING_PID': '', 'XDG_VTNR': '7', 'QT_IM_MODULE': 'ibus', 'LOGNAME': 'giampaolo', 'USER': 'giampaolo', 'PATH': '/home/giampaolo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/giampaolo/svn/sysconf/bin', 'LC_PAPER': 'it_IT.UTF-8', 'GNOME_KEYRING_CONTROL': '', 'GTK_IM_MODULE': 'ibus', 'DISPLAY': ':0', 'LANG': 'en_US.UTF-8', 'LESS_TERMCAP_se': '\x1b[0m', 'TERM': 'xterm-256color', 'SHELL': '/bin/bash', 'XDG_SESSION_PATH': '/org/freedesktop/DisplayManager/Session0', 'XAUTHORITY': '/home/giampaolo/.Xauthority', 'LANGUAGE': 'en_US', 'COMPIZ_CONFIG_PROFILE': 'ubuntu', 'LC_MONETARY': 'it_IT.UTF-8', 'QT_LINUX_ACCESSIBILITY_ALWAYS_ON': '1', 'LESS_TERMCAP_me': '\x1b[0m', 'LESS_TERMCAP_md': '\x1b[01;38;5;74m', 'LESS_TERMCAP_mb': '\x1b[01;31m', 'HISTSIZE': '100000', 'UPSTART_INSTANCE': '', 'CLUTTER_IM_MODULE': 'xim', 'WINDOWID': '58786407', 'EDITOR': 'vim', 'SESSIONTYPE': 'gnome-session', 'XMODIFIERS': '@im=ibus', 'GPG_AGENT_INFO': '/home/giampaolo/.gnupg/S.gpg-agent:0:1', 'HOME': '/home/giampaolo', 'HISTFILESIZE': '100000', 'QT4_IM_MODULE': 'xim', 'GTK2_MODULES': 'overlay-scrollbar', 'XDG_SESSION_DESKTOP': 'ubuntu', 'SHLVL': '1', 'XDG_RUNTIME_DIR': '/run/user/1000', 'INSTANCE': 'Unity', 'LC_ADDRESS': 'it_IT.UTF-8', 'SSH_AUTH_SOCK': '/run/user/1000/keyring/ssh', 'VTE_VERSION': '4205', 'GDMSESSION': 'ubuntu', 'MANDATORY_PATH': '/usr/share/gconf/ubuntu.mandatory.path', 'VISUAL': 'vim', 'DESKTOP_SESSION': 'ubuntu', 'QT_ACCESSIBILITY': '1', 'XDG_SEAT_PATH': '/org/freedesktop/DisplayManager/Seat0', 'LESSCLOSE': '/usr/bin/lesspipe %s %s', 'LESSOPEN': '| /usr/bin/lesspipe %s', 'XDG_SESSION_ID': 'c2', 'DBUS_SESSION_BUS_ADDRESS': 'unix:abstract=/tmp/dbus-9GAJpvnt8r', '_': '/usr/bin/python', 'DEFAULTS_PATH': '/usr/share/gconf/ubuntu.default.path', 'LC_IDENTIFICATION': 'it_IT.UTF-8', 'LESS_TERMCAP_ue': '\x1b[0m', 'UPSTART_SESSION': 'unix:abstract=/com/ubuntu/upstart-session/1000/1294', 'XDG_CONFIG_DIRS': '/etc/xdg/xdg-ubuntu:/usr/share/upstart/xdg:/etc/xdg', 'GTK_MODULES': 'gail:atk-bridge:unity-gtk-module', 'XDG_SESSION_TYPE': 'x11', 'PYTHONSTARTUP': '/home/giampaolo/.pythonstart', 'LC_NAME': 'it_IT.UTF-8', 'OLDPWD': '/home/giampaolo/svn/curio_giampaolo/tests', 'GDM_LANG': 'en_US', 'LC_TELEPHONE': 'it_IT.UTF-8', 'HISTCONTROL': 'ignoredups:erasedups', 'LC_MEASUREMENT': 'it_IT.UTF-8', 'PWD': '/home/giampaolo/svn/curio_giampaolo', 'JOB': 'gnome-session', 'LESS_TERMCAP_us': '\x1b[04;38;5;146m', 'UPSTART_JOB': 'unity-settings-daemon', 'LC_TIME': 'it_IT.UTF-8', 'LESS_TERMCAP_so': '\x1b[38;5;246m', 'PAGER': 'less', 'XDG_DATA_DIRS': '/usr/share/ubuntu:/usr/share/gnome:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop', 'XDG_SEAT': 'seat0'}
- Availability: Linux, OSX, Windows, SunOS
+ Availability: Linux, macOS, Windows, SunOS
.. versionadded:: 4.0.0
.. versionchanged:: 5.3.0 added SunOS support
@@ -1414,7 +1414,7 @@ Process class
Return a `(user, system, children_user, children_system)` named tuple
representing the accumulated process time, in seconds (see
`explanation <http://stackoverflow.com/questions/556405/>`__).
- On Windows and OSX only *user* and *system* are filled, the others are
+ On Windows and macOS only *user* and *system* are filled, the others are
set to ``0``.
This is similar to
`os.times() <http://docs.python.org//library/os.html#os.times>`__
@@ -1522,7 +1522,7 @@ Process class
All numbers are expressed in bytes.
+---------+---------+-------+---------+-----+------------------------------+
- | Linux | OSX | BSD | Solaris | AIX | Windows |
+ | Linux | macOS | BSD | Solaris | AIX | Windows |
+=========+=========+=======+=========+=====+==============================+
| rss | rss | rss | rss | rss | rss (alias for ``wset``) |
+---------+---------+-------+---------+-----+------------------------------+
@@ -1582,9 +1582,9 @@ Process class
- **dirty** *(Linux)*: the number of dirty pages.
- - **pfaults** *(OSX)*: number of page faults.
+ - **pfaults** *(macOS)*: number of page faults.
- - **pageins** *(OSX)*: number of actual pageins.
+ - **pageins** *(macOS)*: number of actual pageins.
For on explanation of Windows fields rely on
`PROCESS_MEMORY_COUNTERS_EX <http://msdn.microsoft.com/en-us/library/windows/desktop/ms684874(v=vs.85).aspx>`__ structure doc.
@@ -1608,7 +1608,7 @@ Process class
.. method:: memory_full_info()
This method returns the same information as :meth:`memory_info`, plus, on
- some platform (Linux, OSX, Windows), also provides additional metrics
+ some platform (Linux, macOS, Windows), also provides additional metrics
(USS, PSS and swap).
The additional metrics provide a better representation of "effective"
process memory consumption (in case of USS) as explained in detail in this
@@ -1619,7 +1619,7 @@ Process class
On platforms where extra fields are not implemented this simply returns the
same metrics as :meth:`memory_info`.
- - **uss** *(Linux, OSX, Windows)*:
+ - **uss** *(Linux, macOS, Windows)*:
aka "Unique Set Size", this is the memory which is unique to a process
and which would be freed if the process was terminated right now.
@@ -1678,7 +1678,7 @@ Process class
for an example application.
+---------------+--------------+---------+-----------+--------------+
- | Linux | OSX | Windows | Solaris | FreeBSD |
+ | Linux | macOS | Windows | Solaris | FreeBSD |
+===============+==============+=========+===========+==============+
| rss | rss | rss | rss | rss |
+---------------+--------------+---------+-----------+--------------+
@@ -2118,7 +2118,7 @@ Constants
.. data:: POSIX
.. data:: WINDOWS
.. data:: LINUX
-.. data:: OSX
+.. data:: MACOS
.. data:: FREEBSD
.. data:: NETBSD
.. data:: OPENBSD
@@ -2132,6 +2132,13 @@ Constants
.. versionadded:: 4.0.0
.. versionchanged:: 5.4.0 added AIX
+.. data:: OSX
+
+ Alias for :const:`MACOS` (deprecated).
+
+ .. warning::
+ deprecated in version 5.5.0; use :const:`MACOS` instead.
+
.. _const-procfs_path:
.. data:: PROCFS_PATH
@@ -2164,7 +2171,7 @@ Constants
.. data:: STATUS_DEAD
.. data:: STATUS_WAKE_KILL
.. data:: STATUS_WAKING
-.. data:: STATUS_IDLE (OSX, FreeBSD)
+.. data:: STATUS_IDLE (macOS, FreeBSD)
.. data:: STATUS_LOCKED (FreeBSD)
.. data:: STATUS_WAITING (FreeBSD)
.. data:: STATUS_SUSPENDED (NetBSD)
@@ -2320,7 +2327,7 @@ methods such as :meth:`Process.username` or :meth:`WindowsService.description`:
* all strings are encoded by using the OS filesystem encoding
(``sys.getfilesystemencoding()``) which varies depending on the platform
- (e.g. "UTF-8" on OSX, "mbcs" on Win)
+ (e.g. "UTF-8" on macOS, "mbcs" on Win)
* no API call is supposed to crash with ``UnicodeDecodeError``
* instead, in case of badly encoded data returned by the OS, the following error handlers are used to replace the corrupted characters in the string:
* Python 3: ``sys.getfilesystemencodeerrors()`` (PY 3.6+) or
@@ -2589,7 +2596,7 @@ FAQs
* Q: Why do I get :class:`AccessDenied` for certain processes?
* A: This may happen when you query processess owned by another user,
- especially on `OSX <https://github.com/giampaolo/psutil/issues/883>`__ and
+ especially on `macOS <https://github.com/giampaolo/psutil/issues/883>`__ and
Windows.
Unfortunately there's not much you can do about this except running the
Python process with higher privileges.
diff --git a/psutil/__init__.py b/psutil/__init__.py
index f3859279..affc5c8c 100644
--- a/psutil/__init__.py
+++ b/psutil/__init__.py
@@ -10,7 +10,7 @@ sensors) in Python. Supported platforms:
- Linux
- Windows
- - OSX
+ - macOS
- FreeBSD
- OpenBSD
- NetBSD
@@ -78,9 +78,10 @@ from ._common import AIX
from ._common import BSD
from ._common import FREEBSD # NOQA
from ._common import LINUX
+from ._common import MACOS
from ._common import NETBSD # NOQA
from ._common import OPENBSD # NOQA
-from ._common import OSX
+from ._common import OSX # deprecated alias
from ._common import POSIX # NOQA
from ._common import SUNOS
from ._common import WINDOWS
@@ -151,8 +152,8 @@ elif WINDOWS:
from ._psutil_windows import REALTIME_PRIORITY_CLASS # NOQA
from ._pswindows import CONN_DELETE_TCB # NOQA
-elif OSX:
- from . import _psosx as _psplatform
+elif MACOS:
+ from . import _psmacos as _psplatform
elif BSD:
from . import _psbsd as _psplatform
@@ -199,8 +200,8 @@ __all__ = [
"POWER_TIME_UNKNOWN", "POWER_TIME_UNLIMITED",
- "BSD", "FREEBSD", "LINUX", "NETBSD", "OPENBSD", "OSX", "POSIX", "SUNOS",
- "WINDOWS", "AIX",
+ "BSD", "FREEBSD", "LINUX", "NETBSD", "OPENBSD", "MACOS", "OSX", "POSIX",
+ "SUNOS", "WINDOWS", "AIX",
# classes
"Process", "Popen",
@@ -823,7 +824,7 @@ class Process(object):
"""
return self._proc.cpu_num()
- # Linux, OSX and Windows only
+ # Linux, macOS and Windows only
if hasattr(_psplatform.Process, "environ"):
def environ(self):
@@ -1027,7 +1028,7 @@ class Process(object):
namedtuple representing the accumulated process time, in
seconds.
This is similar to os.times() but per-process.
- On OSX and Windows children_user and children_system are
+ On macOS and Windows children_user and children_system are
always set to 0.
"""
return self._proc.cpu_times()
@@ -1049,7 +1050,7 @@ class Process(object):
def memory_full_info(self):
"""This method returns the same information as memory_info(),
- plus, on some platform (Linux, OSX, Windows), also provides
+ plus, on some platform (Linux, macOS, Windows), also provides
additional metrics (USS, PSS and swap).
The additional metrics provide a better representation of actual
process memory usage.
@@ -1898,9 +1899,9 @@ def virtual_memory():
- used:
memory used, calculated differently depending on the platform and
designed for informational purposes only:
- OSX: active + inactive + wired
+ macOS: active + inactive + wired
BSD: active + wired + cached
- LINUX: total - free
+ Linux: total - free
- free:
memory not being used at all (zeroed) that is readily available;
@@ -1918,10 +1919,10 @@ def virtual_memory():
- buffers (BSD, Linux):
cache for things like file system metadata.
- - cached (BSD, OSX):
+ - cached (BSD, macOS):
cache for various things.
- - wired (OSX, BSD):
+ - wired (macOS, BSD):
memory that is marked to always stay in RAM. It is never moved to disk.
- shared (BSD):
@@ -2046,7 +2047,7 @@ def net_io_counters(pernic=False, nowrap=True):
- errout: total number of errors while sending
- dropin: total number of incoming packets which were dropped
- dropout: total number of outgoing packets which were dropped
- (always 0 on OSX and BSD)
+ (always 0 on macOS and BSD)
If *pernic* is True return the same information for every
network interface installed on the system as a dictionary
@@ -2102,7 +2103,7 @@ def net_connections(kind='inet'):
| all | the sum of all the possible families and protocols |
+------------+----------------------------------------------------+
- On OSX this function requires root privileges.
+ On macOS this function requires root privileges.
"""
return _psplatform.net_connections(kind)
@@ -2175,7 +2176,7 @@ def net_if_stats():
# =====================================================================
-# Linux, OSX
+# Linux, macOS
if hasattr(_psplatform, "sensors_temperatures"):
def sensors_temperatures(fahrenheit=False):
@@ -2213,7 +2214,7 @@ if hasattr(_psplatform, "sensors_temperatures"):
__all__.append("sensors_temperatures")
-# Linux, OSX
+# Linux, macOS
if hasattr(_psplatform, "sensors_fans"):
def sensors_fans():
@@ -2226,7 +2227,7 @@ if hasattr(_psplatform, "sensors_fans"):
__all__.append("sensors_fans")
-# Linux, Windows, FreeBSD, OSX
+# Linux, Windows, FreeBSD, macOS
if hasattr(_psplatform, "sensors_battery"):
def sensors_battery():
diff --git a/psutil/_common.py b/psutil/_common.py
index af1fb563..6fcf8fe0 100644
--- a/psutil/_common.py
+++ b/psutil/_common.py
@@ -42,8 +42,8 @@ PY3 = sys.version_info[0] == 3
__all__ = [
# constants
- 'FREEBSD', 'BSD', 'LINUX', 'NETBSD', 'OPENBSD', 'OSX', 'POSIX', 'SUNOS',
- 'WINDOWS',
+ 'FREEBSD', 'BSD', 'LINUX', 'NETBSD', 'OPENBSD', 'MACOS', 'OSX', 'POSIX',
+ 'SUNOS', 'WINDOWS',
'ENCODING', 'ENCODING_ERRS', 'AF_INET6',
# connection constants
'CONN_CLOSE', 'CONN_CLOSE_WAIT', 'CONN_CLOSING', 'CONN_ESTABLISHED',
@@ -75,7 +75,8 @@ __all__ = [
POSIX = os.name == "posix"
WINDOWS = os.name == "nt"
LINUX = sys.platform.startswith("linux")
-OSX = sys.platform.startswith("darwin")
+MACOS = sys.platform.startswith("darwin")
+OSX = MACOS # deprecated alias
FREEBSD = sys.platform.startswith("freebsd")
OPENBSD = sys.platform.startswith("openbsd")
NETBSD = sys.platform.startswith("netbsd")
@@ -99,7 +100,7 @@ STATUS_ZOMBIE = "zombie"
STATUS_DEAD = "dead"
STATUS_WAKE_KILL = "wake-kill"
STATUS_WAKING = "waking"
-STATUS_IDLE = "idle" # FreeBSD, OSX
+STATUS_IDLE = "idle" # FreeBSD, macOS
STATUS_LOCKED = "locked" # FreeBSD
STATUS_WAITING = "waiting" # FreeBSD
STATUS_SUSPENDED = "suspended" # NetBSD
diff --git a/psutil/_exceptions.py b/psutil/_exceptions.py
index c08e6d83..6dbbd282 100644
--- a/psutil/_exceptions.py
+++ b/psutil/_exceptions.py
@@ -39,7 +39,7 @@ class NoSuchProcess(Error):
class ZombieProcess(NoSuchProcess):
"""Exception raised when querying a zombie process. This is
- raised on OSX, BSD and Solaris only, and not always: depending
+ raised on macOS, BSD and Solaris only, and not always: depending
on the query the OS may be able to succeed anyway.
On Linux all zombie processes are querable (hence this is never
raised). Windows doesn't have zombie processes.
diff --git a/psutil/_psosx.py b/psutil/_psmacos.py
index a0101df0..a719beda 100644
--- a/psutil/_psosx.py
+++ b/psutil/_psmacos.py
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-"""OSX platform implementation."""
+"""macOS platform implementation."""
import collections
import contextlib
@@ -14,7 +14,7 @@ from collections import namedtuple
from . import _common
from . import _psposix
-from . import _psutil_osx as cext
+from . import _psutil_macos as cext
from . import _psutil_posix as cext_posix
from ._common import AF_INET6
from ._common import conn_tmap
@@ -277,7 +277,7 @@ def cpu_stats():
def cpu_freq():
"""Return CPU frequency.
- On OSX per-cpu frequency is not supported.
+ On macOS per-cpu frequency is not supported.
Also, the returned frequency never changes, see:
https://arstechnica.com/civis/viewtopic.php?f=19&t=465002
"""
@@ -381,7 +381,7 @@ net_if_addrs = cext_posix.net_if_addrs
def net_connections(kind='inet'):
"""System-wide network connections."""
- # Note: on OSX this will fail with AccessDenied unless
+ # Note: on macOS this will fail with AccessDenied unless
# the process is owned by root.
ret = []
for pid in pids():
@@ -444,7 +444,7 @@ def users():
def pids():
ls = cext.pids()
if 0 not in ls:
- # On certain OSX versions pids() C doesn't return PID 0 but
+ # On certain macOS versions pids() C doesn't return PID 0 but
# "ps" does and the process is querable via sysctl():
# https://travis-ci.org/giampaolo/psutil/jobs/309619941
try:
diff --git a/psutil/_psutil_bsd.c b/psutil/_psutil_bsd.c
index 9a2ed04b..4e91c02e 100644
--- a/psutil/_psutil_bsd.c
+++ b/psutil/_psutil_bsd.c
@@ -393,7 +393,7 @@ psutil_proc_cmdline(PyObject *self, PyObject *args) {
/*
* Return the number of logical CPUs in the system.
- * XXX this could be shared with OSX
+ * XXX this could be shared with macOS
*/
static PyObject *
psutil_cpu_count_logical(PyObject *self, PyObject *args) {
diff --git a/psutil/_psutil_osx.c b/psutil/_psutil_macos.c
index 15f4d4f6..8fc3140f 100644
--- a/psutil/_psutil_osx.c
+++ b/psutil/_psutil_macos.c
@@ -3,7 +3,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
- * OS X platform-specific module methods for _psutil_osx
+ * macOS platform-specific module methods.
*/
#include <Python.h>
@@ -43,8 +43,8 @@
#include "_psutil_common.h"
#include "_psutil_posix.h"
-#include "arch/osx/process_info.h"
-#include "arch/osx/smc.h"
+#include "arch/macos/process_info.h"
+#include "arch/macos/smc.h"
#define PSUTIL_TV2DOUBLE(t) ((t).tv_sec + (t).tv_usec / 1000000.0)
@@ -251,7 +251,7 @@ psutil_proc_pidtaskinfo_oneshot(PyObject *self, PyObject *args) {
"(ddKKkkkk)",
(float)pti.pti_total_user / 1000000000.0, // (float) cpu user time
(float)pti.pti_total_system / 1000000000.0, // (float) cpu sys time
- // Note about memory: determining other mem stats on OSX is a mess:
+ // Note about memory: determining other mem stats on macOS is a mess:
// http://www.opensource.apple.com/source/top/top-67/libtop.c?txt
// I just give up.
// struct proc_regioninfo pri;
@@ -342,7 +342,7 @@ psutil_proc_cmdline(PyObject *self, PyObject *args) {
if (! PyArg_ParseTuple(args, "l", &pid))
return NULL;
- // get the commandline, defined in arch/osx/process_info.c
+ // get the commandline, defined in arch/macos/process_info.c
py_retlist = psutil_get_cmdline(pid);
return py_retlist;
}
@@ -359,7 +359,7 @@ psutil_proc_environ(PyObject *self, PyObject *args) {
if (! PyArg_ParseTuple(args, "l", &pid))
return NULL;
- // get the environment block, defined in arch/osx/process_info.c
+ // get the environment block, defined in arch/macos/process_info.c
py_retdict = psutil_get_environ(pid);
return py_retdict;
}
@@ -1759,7 +1759,7 @@ psutil_disk_io_counters(PyObject *self, PyObject *args) {
CFNumberGetValue(number, kCFNumberSInt64Type, &write_time);
}
- // Read/Write time on OS X comes back in nanoseconds and in psutil
+ // Read/Write time on macOS comes back in nanoseconds and in psutil
// we've standardized on milliseconds so do the conversion.
py_disk_info = Py_BuildValue(
"(KKKKKK)",
@@ -2066,13 +2066,13 @@ struct module_state {
#if PY_MAJOR_VERSION >= 3
static int
-psutil_osx_traverse(PyObject *m, visitproc visit, void *arg) {
+psutil_macos_traverse(PyObject *m, visitproc visit, void *arg) {
Py_VISIT(GETSTATE(m)->error);
return 0;
}
static int
-psutil_osx_clear(PyObject *m) {
+psutil_macos_clear(PyObject *m) {
Py_CLEAR(GETSTATE(m)->error);
return 0;
}
@@ -2080,31 +2080,31 @@ psutil_osx_clear(PyObject *m) {
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
- "psutil_osx",
+ "psutil_macos",
NULL,
sizeof(struct module_state),
PsutilMethods,
NULL,
- psutil_osx_traverse,
- psutil_osx_clear,
+ psutil_macos_traverse,
+ psutil_macos_clear,
NULL
};
#define INITERROR return NULL
-PyMODINIT_FUNC PyInit__psutil_osx(void)
+PyMODINIT_FUNC PyInit__psutil_macos(void)
#else
#define INITERROR return
void
-init_psutil_osx(void)
+init_psutil_macos(void)
#endif
{
#if PY_MAJOR_VERSION >= 3
PyObject *module = PyModule_Create(&moduledef);
#else
- PyObject *module = Py_InitModule("_psutil_osx", PsutilMethods);
+ PyObject *module = Py_InitModule("_psutil_macos", PsutilMethods);
#endif
PyModule_AddIntConstant(module, "version", PSUTIL_VERSION);
// process status constants, defined in:
@@ -2130,7 +2130,7 @@ init_psutil_osx(void)
// Exception.
ZombieProcessError = PyErr_NewException(
- "_psutil_osx.ZombieProcessError", NULL, NULL);
+ "_psutil_macos.ZombieProcessError", NULL, NULL);
Py_INCREF(ZombieProcessError);
PyModule_AddObject(module, "ZombieProcessError", ZombieProcessError);
diff --git a/psutil/_psutil_posix.c b/psutil/_psutil_posix.c
index cc827273..e9a8f2d9 100644
--- a/psutil/_psutil_posix.c
+++ b/psutil/_psutil_posix.c
@@ -28,7 +28,7 @@
#include <netdb.h>
#include <linux/types.h>
#include <linux/if_packet.h>
-#elif defined(PSUTIL_BSD) || defined(PSUTIL_OSX)
+#elif defined(PSUTIL_BSD) || defined(PSUTIL_MACOS)
#include <netdb.h>
#include <netinet/in.h>
#include <net/if_dl.h>
@@ -71,7 +71,7 @@ psutil_pid_exists(long pid) {
#endif
}
-#if defined(PSUTIL_OSX)
+#if defined(PSUTIL_MACOS)
ret = kill((pid_t)pid , 0);
#else
ret = kill(pid , 0);
@@ -143,7 +143,7 @@ psutil_posix_getpriority(PyObject *self, PyObject *args) {
if (! PyArg_ParseTuple(args, "l", &pid))
return NULL;
-#ifdef PSUTIL_OSX
+#ifdef PSUTIL_MACOS
priority = getpriority(PRIO_PROCESS, (id_t)pid);
#else
priority = getpriority(PRIO_PROCESS, pid);
@@ -166,7 +166,7 @@ psutil_posix_setpriority(PyObject *self, PyObject *args) {
if (! PyArg_ParseTuple(args, "li", &pid, &priority))
return NULL;
-#ifdef PSUTIL_OSX
+#ifdef PSUTIL_MACOS
retval = setpriority(PRIO_PROCESS, (id_t)pid, priority);
#else
retval = setpriority(PRIO_PROCESS, pid, priority);
@@ -221,7 +221,7 @@ psutil_convert_ipaddr(struct sockaddr *addr, int family) {
len = lladdr->sll_halen;
data = (const char *)lladdr->sll_addr;
}
-#elif defined(PSUTIL_BSD) || defined(PSUTIL_OSX)
+#elif defined(PSUTIL_BSD) || defined(PSUTIL_MACOS)
else if (addr->sa_family == AF_LINK) {
// Note: prior to Python 3.4 socket module does not expose
// AF_LINK so we'll do.
@@ -431,9 +431,9 @@ error:
/*
- * net_if_stats() OSX/BSD implementation.
+ * net_if_stats() macOS/BSD implementation.
*/
-#if defined(PSUTIL_BSD) || defined(PSUTIL_OSX)
+#if defined(PSUTIL_BSD) || defined(PSUTIL_MACOS)
int psutil_get_nic_speed(int ifm_active) {
// Determine NIC speed. Taken from:
@@ -620,7 +620,7 @@ error:
close(sock);
return PyErr_SetFromErrno(PyExc_OSError);
}
-#endif // net_if_stats() OSX/BSD implementation
+#endif // net_if_stats() macOS/BSD implementation
/*
@@ -638,7 +638,7 @@ PsutilMethods[] = {
"Retrieve NIC MTU"},
{"net_if_flags", psutil_net_if_flags, METH_VARARGS,
"Retrieve NIC flags"},
-#if defined(PSUTIL_BSD) || defined(PSUTIL_OSX)
+#if defined(PSUTIL_BSD) || defined(PSUTIL_MACOS)
{"net_if_duplex_speed", psutil_net_if_duplex_speed, METH_VARARGS,
"Return NIC stats."},
#endif
@@ -698,7 +698,7 @@ void init_psutil_posix(void)
PyObject *module = Py_InitModule("_psutil_posix", PsutilMethods);
#endif
-#if defined(PSUTIL_BSD) || defined(PSUTIL_OSX) || defined(PSUTIL_SUNOS) || defined(PSUTIL_AIX)
+#if defined(PSUTIL_BSD) || defined(PSUTIL_MACOS) || defined(PSUTIL_SUNOS) || defined(PSUTIL_AIX)
PyModule_AddIntConstant(module, "AF_LINK", AF_LINK);
#endif
diff --git a/psutil/arch/osx/process_info.c b/psutil/arch/macos/process_info.c
index 40c79a2c..de007de4 100644
--- a/psutil/arch/osx/process_info.c
+++ b/psutil/arch/macos/process_info.c
@@ -4,7 +4,7 @@
* found in the LICENSE file.
*
* Helper functions related to fetching process information.
- * Used by _psutil_osx module methods.
+ * Used by _psutil_macos module methods.
*/
@@ -142,7 +142,7 @@ psutil_get_cmdline(long pid) {
mib[2] = (pid_t)pid;
if (sysctl(mib, 3, procargs, &argmax, NULL, 0) < 0) {
// In case of zombie process we'll get EINVAL. We translate it
- // to NSP and _psosx.py will translate it to ZP.
+ // to NSP and _psmacos.py will translate it to ZP.
if ((errno == EINVAL) && (psutil_pid_exists(pid)))
NoSuchProcess("");
else
@@ -236,7 +236,7 @@ psutil_get_environ(long pid) {
mib[2] = (pid_t)pid;
if (sysctl(mib, 3, procargs, &argmax, NULL, 0) < 0) {
// In case of zombie process we'll get EINVAL. We translate it
- // to NSP and _psosx.py will translate it to ZP.
+ // to NSP and _psmacos.py will translate it to ZP.
if ((errno == EINVAL) && (psutil_pid_exists(pid)))
NoSuchProcess("");
else
diff --git a/psutil/arch/osx/process_info.h b/psutil/arch/macos/process_info.h
index bd2eef86..bd2eef86 100644
--- a/psutil/arch/osx/process_info.h
+++ b/psutil/arch/macos/process_info.h
diff --git a/psutil/arch/osx/smc.c b/psutil/arch/macos/smc.c
index 00de0a37..00de0a37 100644
--- a/psutil/arch/osx/smc.c
+++ b/psutil/arch/macos/smc.c
diff --git a/psutil/arch/osx/smc.h b/psutil/arch/macos/smc.h
index acd399c2..acd399c2 100644
--- a/psutil/arch/osx/smc.h
+++ b/psutil/arch/macos/smc.h
diff --git a/psutil/tests/README.rst b/psutil/tests/README.rst
index 515abf77..9cefb775 100644
--- a/psutil/tests/README.rst
+++ b/psutil/tests/README.rst
@@ -17,7 +17,7 @@ Instructions for running tests
(``pip install tox``) then run ``tox`` from within psutil root directory.
* Every time a commit is pushed tests are automatically run on Travis
- (Linux, OSX) and appveyor (Windows):
+ (Linux, MACOS) and appveyor (Windows):
* Travis builds: https://travis-ci.org/giampaolo/psutil
* AppVeyor builds: https://ci.appveyor.com/project/giampaolo/psutil
diff --git a/psutil/tests/__init__.py b/psutil/tests/__init__.py
index f11a6a02..2b00d426 100644
--- a/psutil/tests/__init__.py
+++ b/psutil/tests/__init__.py
@@ -36,7 +36,7 @@ from socket import SOCK_DGRAM
from socket import SOCK_STREAM
import psutil
-from psutil import OSX
+from psutil import MACOS
from psutil import POSIX
from psutil import SUNOS
from psutil import WINDOWS
@@ -179,7 +179,7 @@ def _get_py_exe():
else:
return exe
- if OSX:
+ if MACOS:
exe = \
attempt(sys.executable) or \
attempt(os.path.realpath(sys.executable)) or \
@@ -367,7 +367,7 @@ def create_proc_children_pair():
def create_zombie_proc():
"""Create a zombie process and return its PID."""
assert psutil.POSIX
- unix_file = tempfile.mktemp(prefix=TESTFILE_PREFIX) if OSX else TESTFN
+ unix_file = tempfile.mktemp(prefix=TESTFILE_PREFIX) if MACOS else TESTFN
src = textwrap.dedent("""\
import os, sys, time, socket, contextlib
child_pid = os.fork()
@@ -810,7 +810,7 @@ def get_suite():
x.startswith('test_memory_leaks')]
if "WHEELHOUSE_UPLOADER_USERNAME" in os.environ:
testmods = [x for x in testmods if not x.endswith((
- "osx", "posix", "linux"))]
+ "macos", "posix", "linux"))]
suite = unittest.TestSuite()
for tm in testmods:
# ...so that the full test paths are printed on screen
diff --git a/psutil/tests/test_connections.py b/psutil/tests/test_connections.py
index 176e2664..cba835e1 100755
--- a/psutil/tests/test_connections.py
+++ b/psutil/tests/test_connections.py
@@ -18,9 +18,9 @@ from socket import SOCK_STREAM
import psutil
from psutil import FREEBSD
from psutil import LINUX
+from psutil import MACOS
from psutil import NETBSD
from psutil import OPENBSD
-from psutil import OSX
from psutil import POSIX
from psutil import SUNOS
from psutil import WINDOWS
@@ -124,9 +124,9 @@ class Base(object):
try:
sys_cons = psutil.net_connections(kind=kind)
except psutil.AccessDenied:
- # On OSX, system-wide connections are retrieved by iterating
+ # On MACOS, system-wide connections are retrieved by iterating
# over all processes
- if OSX:
+ if MACOS:
return
else:
raise
@@ -257,7 +257,7 @@ class TestConnectedSocketPairs(Base, unittest.TestCase):
server.close()
client.close()
- @skip_on_access_denied(only_if=OSX)
+ @skip_on_access_denied(only_if=MACOS)
def test_combos(self):
def check_conn(proc, conn, family, type, laddr, raddr, status, kinds):
all_kinds = ("all", "inet", "inet4", "inet6", "tcp", "tcp4",
@@ -455,7 +455,7 @@ class TestSystemWideConnections(Base, unittest.TestCase):
@skip_on_access_denied()
# See: https://travis-ci.org/giampaolo/psutil/jobs/237566297
- @unittest.skipIf(OSX and TRAVIS, "unreliable on OSX + TRAVIS")
+ @unittest.skipIf(MACOS and TRAVIS, "unreliable on MACOS + TRAVIS")
def test_multi_sockets_procs(self):
# Creates multiple sub processes, each creating different
# sockets. For each process check that proc.connections()
diff --git a/psutil/tests/test_contracts.py b/psutil/tests/test_contracts.py
index 912e811f..ac424b54 100755
--- a/psutil/tests/test_contracts.py
+++ b/psutil/tests/test_contracts.py
@@ -21,9 +21,9 @@ from psutil import AIX
from psutil import BSD
from psutil import FREEBSD
from psutil import LINUX
+from psutil import MACOS
from psutil import NETBSD
from psutil import OPENBSD
-from psutil import OSX
from psutil import POSIX
from psutil import SUNOS
from psutil import WINDOWS
@@ -113,21 +113,23 @@ class TestAvailability(unittest.TestCase):
linux = (LINUX and
(os.path.exists("/sys/devices/system/cpu/cpufreq") or
os.path.exists("/sys/devices/system/cpu/cpu0/cpufreq")))
- self.assertEqual(hasattr(psutil, "cpu_freq"), linux or OSX or WINDOWS)
+ self.assertEqual(hasattr(psutil, "cpu_freq"),
+ linux or MACOS or WINDOWS)
def test_sensors_temperatures(self):
- self.assertEqual(hasattr(psutil, "sensors_temperatures"), LINUX or OSX)
+ self.assertEqual(
+ hasattr(psutil, "sensors_temperatures"), LINUX or MACOS)
def test_sensors_fans(self):
- self.assertEqual(hasattr(psutil, "sensors_fans"), LINUX or OSX)
+ self.assertEqual(hasattr(psutil, "sensors_fans"), LINUX or MACOS)
def test_battery(self):
self.assertEqual(hasattr(psutil, "sensors_battery"),
- LINUX or WINDOWS or FREEBSD or OSX)
+ LINUX or WINDOWS or FREEBSD or MACOS)
def test_proc_environ(self):
self.assertEqual(hasattr(psutil.Process, "environ"),
- LINUX or OSX or WINDOWS)
+ LINUX or MACOS or WINDOWS)
def test_proc_uids(self):
self.assertEqual(hasattr(psutil.Process, "uids"), POSIX)
@@ -146,7 +148,7 @@ class TestAvailability(unittest.TestCase):
def test_proc_io_counters(self):
hasit = hasattr(psutil.Process, "io_counters")
- self.assertEqual(hasit, False if OSX or SUNOS else True)
+ self.assertEqual(hasit, False if MACOS or SUNOS else True)
def test_proc_num_fds(self):
self.assertEqual(hasattr(psutil.Process, "num_fds"), POSIX)
@@ -224,7 +226,7 @@ class TestSystem(unittest.TestCase):
@unittest.skipIf(not POSIX, 'POSIX only')
@unittest.skipIf(not HAS_CONNECTIONS_UNIX, "can't list UNIX sockets")
- @skip_on_access_denied(only_if=OSX)
+ @skip_on_access_denied(only_if=MACOS)
def test_net_connections(self):
with unix_socket_path() as name:
with closing(bind_unix_socket(name)):
@@ -385,7 +387,7 @@ class TestFetchAllProcesses(unittest.TestCase):
# http://stackoverflow.com/questions/3112546/os-path-exists-lies
if POSIX and os.path.isfile(ret):
if hasattr(os, 'access') and hasattr(os, "X_OK"):
- # XXX may fail on OSX
+ # XXX may fail on MACOS
assert os.access(ret, os.X_OK)
def pid(self, ret, proc):
@@ -431,7 +433,7 @@ class TestFetchAllProcesses(unittest.TestCase):
# gid == 30 (nodoby); not sure why.
for gid in ret:
self.assertIsInstance(gid, int)
- if not OSX and not NETBSD:
+ if not MACOS and not NETBSD:
self.assertGreaterEqual(gid, 0)
self.assertIn(gid, self.all_gids)
diff --git a/psutil/tests/test_osx.py b/psutil/tests/test_macos.py
index bcb2ba4e..557af9f9 100755
--- a/psutil/tests/test_osx.py
+++ b/psutil/tests/test_macos.py
@@ -4,14 +4,14 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-"""OSX specific tests."""
+"""MACOS specific tests."""
import os
import re
import time
import psutil
-from psutil import OSX
+from psutil import MACOS
from psutil.tests import create_zombie_proc
from psutil.tests import get_test_subprocess
from psutil.tests import HAS_BATTERY
@@ -23,7 +23,7 @@ from psutil.tests import sh
from psutil.tests import unittest
-PAGESIZE = os.sysconf("SC_PAGE_SIZE") if OSX else None
+PAGESIZE = os.sysconf("SC_PAGE_SIZE") if MACOS else None
def sysctl(cmdline):
@@ -76,7 +76,7 @@ def human2bytes(s):
return int(num * prefix[letter])
-@unittest.skipIf(not OSX, "OSX only")
+@unittest.skipIf(not MACOS, "MACOS only")
class TestProcess(unittest.TestCase):
@classmethod
@@ -101,7 +101,7 @@ class TestProcess(unittest.TestCase):
time.strftime("%Y", time.localtime(start_psutil)))
-@unittest.skipIf(not OSX, "OSX only")
+@unittest.skipIf(not MACOS, "MACOS only")
class TestZombieProcessAPIs(unittest.TestCase):
@classmethod
@@ -162,7 +162,7 @@ class TestZombieProcessAPIs(unittest.TestCase):
self.assertRaises(psutil.ZombieProcess, self.p.memory_maps)
-@unittest.skipIf(not OSX, "OSX only")
+@unittest.skipIf(not MACOS, "MACOS only")
class TestSystemAPIs(unittest.TestCase):
# --- disk
diff --git a/psutil/tests/test_memory_leaks.py b/psutil/tests/test_memory_leaks.py
index 680fe780..ce082459 100755
--- a/psutil/tests/test_memory_leaks.py
+++ b/psutil/tests/test_memory_leaks.py
@@ -25,8 +25,8 @@ import time
import psutil
import psutil._common
from psutil import LINUX
+from psutil import MACOS
from psutil import OPENBSD
-from psutil import OSX
from psutil import POSIX
from psutil import SUNOS
from psutil import WINDOWS
@@ -176,7 +176,7 @@ class TestMemLeak(unittest.TestCase):
def _get_mem():
# By using USS memory it seems it's less likely to bump
# into false positives.
- if LINUX or WINDOWS or OSX:
+ if LINUX or WINDOWS or MACOS:
return thisproc.memory_full_info().uss
else:
return thisproc.memory_info().rss
@@ -344,8 +344,8 @@ class TestProcessObjectLeaks(TestMemLeak):
with open(TESTFN, 'w'):
self.execute(self.proc.open_files)
- # OSX implementation is unbelievably slow
- @unittest.skipIf(OSX, "too slow on OSX")
+ # MACOS implementation is unbelievably slow
+ @unittest.skipIf(MACOS, "too slow on MACOS")
@unittest.skipIf(not HAS_MEMORY_MAPS, "not supported")
@skip_if_linux()
def test_memory_maps(self):
@@ -530,7 +530,7 @@ class TestModuleFunctionsLeaks(TestMemLeak):
@unittest.skipIf(LINUX,
"worthless on Linux (pure python)")
- @unittest.skipIf(OSX and os.getuid() != 0, "need root access")
+ @unittest.skipIf(MACOS and os.getuid() != 0, "need root access")
def test_net_connections(self):
with create_sockets():
self.execute(psutil.net_connections)
diff --git a/psutil/tests/test_posix.py b/psutil/tests/test_posix.py
index e9a6f5f6..b80128c7 100755
--- a/psutil/tests/test_posix.py
+++ b/psutil/tests/test_posix.py
@@ -19,8 +19,8 @@ import psutil
from psutil import AIX
from psutil import BSD
from psutil import LINUX
+from psutil import MACOS
from psutil import OPENBSD
-from psutil import OSX
from psutil import POSIX
from psutil import SUNOS
from psutil._compat import PY3
@@ -152,7 +152,7 @@ class TestProcess(unittest.TestCase):
# remove path if there is any, from the command
name_ps = os.path.basename(name_ps).lower()
name_psutil = psutil.Process(self.pid).name().lower()
- # ...because of how we calculate PYTHON_EXE; on OSX this may
+ # ...because of how we calculate PYTHON_EXE; on MACOS this may
# be "pythonX.Y".
name_ps = re.sub(r"\d.\d", "", name_ps)
name_psutil = re.sub(r"\d.\d", "", name_psutil)
@@ -194,7 +194,7 @@ class TestProcess(unittest.TestCase):
p = psutil.Process()
self.assertRaises(psutil.NoSuchProcess, p.name)
- @unittest.skipIf(OSX or BSD, 'ps -o start not available')
+ @unittest.skipIf(MACOS or BSD, 'ps -o start not available')
def test_create_time(self):
time_ps = ps("ps --no-headers -o start -p %s" % self.pid).split(' ')[0]
time_psutil = psutil.Process(self.pid).create_time()
@@ -309,8 +309,8 @@ class TestSystemAPIs(unittest.TestCase):
pids_ps.sort()
pids_psutil.sort()
- # on OSX and OPENBSD ps doesn't show pid 0
- if OSX or OPENBSD and 0 not in pids_ps:
+ # on MACOS and OPENBSD ps doesn't show pid 0
+ if MACOS or OPENBSD and 0 not in pids_ps:
pids_ps.insert(0, 0)
self.assertEqual(pids_ps, pids_psutil)
diff --git a/psutil/tests/test_process.py b/psutil/tests/test_process.py
index e295c95b..23081962 100755
--- a/psutil/tests/test_process.py
+++ b/psutil/tests/test_process.py
@@ -25,9 +25,9 @@ import psutil
from psutil import AIX
from psutil import BSD
from psutil import LINUX
+from psutil import MACOS
from psutil import NETBSD
from psutil import OPENBSD
-from psutil import OSX
from psutil import POSIX
from psutil import SUNOS
from psutil import WINDOWS
@@ -504,7 +504,7 @@ class TestProcess(unittest.TestCase):
def test_num_threads(self):
# on certain platforms such as Linux we might test for exact
# thread number, since we always have with 1 thread per process,
- # but this does not apply across all platforms (OSX, Windows)
+ # but this does not apply across all platforms (MACOS, Windows)
p = psutil.Process()
if OPENBSD:
try:
@@ -548,7 +548,7 @@ class TestProcess(unittest.TestCase):
self.assertEqual(athread.system_time, athread[2])
@retry_before_failing()
- @skip_on_access_denied(only_if=OSX)
+ @skip_on_access_denied(only_if=MACOS)
@unittest.skipIf(not HAS_THREADS, 'not supported')
def test_threads_2(self):
sproc = get_test_subprocess()
@@ -603,7 +603,7 @@ class TestProcess(unittest.TestCase):
value = getattr(mem, name)
self.assertGreaterEqual(value, 0, msg=(name, value))
self.assertLessEqual(value, total, msg=(name, value, total))
- if LINUX or WINDOWS or OSX:
+ if LINUX or WINDOWS or MACOS:
self.assertGreaterEqual(mem.uss, 0)
if LINUX:
self.assertGreaterEqual(mem.pss, 0)
@@ -668,7 +668,7 @@ class TestProcess(unittest.TestCase):
assert 0 <= ret <= 100, ret
assert 0 <= ret <= 100, ret
self.assertRaises(ValueError, p.memory_percent, memtype="?!?")
- if LINUX or OSX or WINDOWS:
+ if LINUX or MACOS or WINDOWS:
ret = p.memory_percent(memtype='uss')
assert 0 <= ret <= 100, ret
assert 0 <= ret <= 100, ret
@@ -705,7 +705,7 @@ class TestProcess(unittest.TestCase):
self.assertEqual(exe.replace(ver, ''),
PYTHON_EXE.replace(ver, ''))
except AssertionError:
- # Tipically OSX. Really not sure what to do here.
+ # Tipically MACOS. Really not sure what to do here.
pass
out = sh([exe, "-c", "import os; print('hey')"])
@@ -825,8 +825,8 @@ class TestProcess(unittest.TestCase):
self.assertEqual(
os.getpriority(os.PRIO_PROCESS, os.getpid()), p.nice())
# XXX - going back to previous nice value raises
- # AccessDenied on OSX
- if not OSX:
+ # AccessDenied on MACOS
+ if not MACOS:
p.nice(0)
self.assertEqual(p.nice(), 0)
except psutil.AccessDenied:
@@ -1317,7 +1317,7 @@ class TestProcess(unittest.TestCase):
succeed_or_zombie_p_exc(zproc.kill)
# ...its parent should 'see' it
- # edit: not true on BSD and OSX
+ # edit: not true on BSD and MACOS
# descendants = [x.pid for x in psutil.Process().children(
# recursive=True)]
# self.assertIn(zpid, descendants)
@@ -1327,9 +1327,9 @@ class TestProcess(unittest.TestCase):
# self.assertEqual(zpid.ppid(), os.getpid())
# ...and all other APIs should be able to deal with it
self.assertTrue(psutil.pid_exists(zpid))
- if not TRAVIS and OSX:
+ if not TRAVIS and MACOS:
# For some reason this started failing all of the sudden.
- # Maybe they upgraded OSX version?
+ # Maybe they upgraded MACOS version?
# https://travis-ci.org/giampaolo/psutil/jobs/310896404
self.assertIn(zpid, psutil.pids())
self.assertIn(zpid, [x.pid for x in psutil.process_iter()])
@@ -1402,7 +1402,7 @@ class TestProcess(unittest.TestCase):
d.pop("PSUTIL_TESTING", None)
d.pop("PLAT", None)
d.pop("HOME", None)
- if OSX:
+ if MACOS:
d.pop("__CF_USER_TEXT_ENCODING", None)
d.pop("VERSIONER_PYTHON_PREFER_32_BIT", None)
d.pop("VERSIONER_PYTHON_VERSION", None)
diff --git a/psutil/tests/test_system.py b/psutil/tests/test_system.py
index 6081ea5a..694a7a3b 100755
--- a/psutil/tests/test_system.py
+++ b/psutil/tests/test_system.py
@@ -23,9 +23,9 @@ from psutil import AIX
from psutil import BSD
from psutil import FREEBSD
from psutil import LINUX
+from psutil import MACOS
from psutil import NETBSD
from psutil import OPENBSD
-from psutil import OSX
from psutil import POSIX
from psutil import SUNOS
from psutil import WINDOWS
@@ -514,7 +514,7 @@ class TestSystemAPIs(unittest.TestCase):
try:
os.stat(disk.mountpoint)
except OSError as err:
- if TRAVIS and OSX and err.errno == errno.EIO:
+ if TRAVIS and MACOS and err.errno == errno.EIO:
continue
# http://mail.python.org/pipermail/python-dev/
# 2012-June/120787.html
@@ -630,7 +630,7 @@ class TestSystemAPIs(unittest.TestCase):
elif addr.ptp:
self.assertIsNone(addr.broadcast)
- if BSD or OSX or SUNOS:
+ if BSD or MACOS or SUNOS:
if hasattr(socket, "AF_LINK"):
self.assertEqual(psutil.AF_LINK, socket.AF_LINK)
elif LINUX:
@@ -774,7 +774,7 @@ class TestSystemAPIs(unittest.TestCase):
self.assertEqual(len(ls), psutil.cpu_count())
def test_os_constants(self):
- names = ["POSIX", "WINDOWS", "LINUX", "OSX", "FREEBSD", "OPENBSD",
+ names = ["POSIX", "WINDOWS", "LINUX", "MACOS", "FREEBSD", "OPENBSD",
"NETBSD", "BSD", "SUNOS"]
for name in names:
self.assertIsInstance(getattr(psutil, name), bool, msg=name)
@@ -799,8 +799,8 @@ class TestSystemAPIs(unittest.TestCase):
assert psutil.SUNOS
names.remove("SUNOS")
elif "darwin" in sys.platform.lower():
- assert psutil.OSX
- names.remove("OSX")
+ assert psutil.MACOS
+ names.remove("MACOS")
else:
assert psutil.WINDOWS
assert not psutil.POSIX
diff --git a/psutil/tests/test_unicode.py b/psutil/tests/test_unicode.py
index 6383c9be..4144b5c2 100755
--- a/psutil/tests/test_unicode.py
+++ b/psutil/tests/test_unicode.py
@@ -58,8 +58,8 @@ import warnings
from contextlib import closing
from psutil import BSD
+from psutil import MACOS
from psutil import OPENBSD
-from psutil import OSX
from psutil import POSIX
from psutil import WINDOWS
from psutil._compat import PY3
@@ -285,7 +285,7 @@ class _BaseFSAPIsTests(object):
self.assertIsInstance(path, str)
-@unittest.skipIf(OSX and TRAVIS, "unreliable on TRAVIS") # TODO
+@unittest.skipIf(MACOS and TRAVIS, "unreliable on TRAVIS") # TODO
@unittest.skipIf(ASCII_FS, "ASCII fs")
@unittest.skipIf(not subprocess_supports_unicode(TESTFN_UNICODE),
"subprocess can't deal with unicode")
@@ -306,7 +306,7 @@ class TestFSAPIs(_BaseFSAPIsTests, unittest.TestCase):
return cls.funky_name in os.listdir(here)
-@unittest.skipIf(OSX and TRAVIS, "unreliable on TRAVIS") # TODO
+@unittest.skipIf(MACOS and TRAVIS, "unreliable on TRAVIS") # TODO
@unittest.skipIf(not subprocess_supports_unicode(INVALID_NAME),
"subprocess can't deal with invalid unicode")
class TestFSAPIsWithInvalidPath(_BaseFSAPIsTests, unittest.TestCase):
diff --git a/scripts/internal/bench_oneshot.py b/scripts/internal/bench_oneshot.py
index 639e9ad7..28ad4bac 100755
--- a/scripts/internal/bench_oneshot.py
+++ b/scripts/internal/bench_oneshot.py
@@ -79,7 +79,7 @@ elif psutil.SUNOS:
'terminal',
'uids',
]
-elif psutil.OSX:
+elif psutil.MACOS:
names += [
'cpu_times',
'create_time',
diff --git a/scripts/internal/print_announce.py b/scripts/internal/print_announce.py
index 018fb092..c92cbcb2 100755
--- a/scripts/internal/print_announce.py
+++ b/scripts/internal/print_announce.py
@@ -39,9 +39,9 @@ monitoring, profiling and limiting process resources and management of \
running processes. It implements many functionalities offered by command \
line tools such as: ps, top, lsof, netstat, ifconfig, who, df, kill, free, \
nice, ionice, iostat, iotop, uptime, pidof, tty, taskset, pmap. It \
-currently supports Linux, Windows, OSX, Sun Solaris, FreeBSD, OpenBSD, NetBSD \
-and AIX, both 32-bit and 64-bit architectures, with Python versions from 2.6 \
-to 3.6. PyPy is also known to work.
+currently supports Linux, Windows, macOS, Sun Solaris, FreeBSD, OpenBSD, \
+NetBSD and AIX, both 32-bit and 64-bit architectures, with Python versions \
+from 2.6 to 3.6. PyPy is also known to work.
What's new
==========
diff --git a/scripts/iotop.py b/scripts/iotop.py
index 9f76eb1c..dabe957b 100755
--- a/scripts/iotop.py
+++ b/scripts/iotop.py
@@ -8,7 +8,7 @@
A clone of iotop (http://guichaz.free.fr/iotop/) showing real time
disk I/O statistics.
-It works on Linux only (FreeBSD and OSX are missing support for IO
+It works on Linux only (FreeBSD and macOS are missing support for IO
counters).
It doesn't work on Windows as curses module is required.
diff --git a/scripts/pmap.py b/scripts/pmap.py
index 16eebb60..a509bd73 100755
--- a/scripts/pmap.py
+++ b/scripts/pmap.py
@@ -5,7 +5,7 @@
# found in the LICENSE file.
"""
-A clone of 'pmap' utility on Linux, 'vmmap' on OSX and 'procstat -v' on BSD.
+A clone of 'pmap' utility on Linux, 'vmmap' on macOS and 'procstat -v' on BSD.
Report memory map of a process.
$ python scripts/pmap.py 32402
diff --git a/scripts/procsmem.py b/scripts/procsmem.py
index a28794b9..ab9ad066 100755
--- a/scripts/procsmem.py
+++ b/scripts/procsmem.py
@@ -41,7 +41,7 @@ import sys
import psutil
-if not (psutil.LINUX or psutil.OSX or psutil.WINDOWS):
+if not (psutil.LINUX or psutil.MACOS or psutil.WINDOWS):
sys.exit("platform not supported")
diff --git a/setup.py b/setup.py
index b0343212..03e315b5 100755
--- a/setup.py
+++ b/setup.py
@@ -28,16 +28,16 @@ HERE = os.path.abspath(os.path.dirname(__file__))
# ...so we can import _common.py
sys.path.insert(0, os.path.join(HERE, "psutil"))
+from _common import AIX # NOQA
from _common import BSD # NOQA
from _common import FREEBSD # NOQA
from _common import LINUX # NOQA
+from _common import MACOS # NOQA
from _common import NETBSD # NOQA
from _common import OPENBSD # NOQA
-from _common import OSX # NOQA
from _common import POSIX # NOQA
from _common import SUNOS # NOQA
from _common import WINDOWS # NOQA
-from _common import AIX # NOQA
macros = []
@@ -145,14 +145,14 @@ if WINDOWS:
# extra_link_args=["/DEBUG"]
)
-elif OSX:
- macros.append(("PSUTIL_OSX", 1))
+elif MACOS:
+ macros.append(("PSUTIL_MACOS", 1))
ext = Extension(
- 'psutil._psutil_osx',
+ 'psutil._psutil_macos',
sources=sources + [
- 'psutil/_psutil_osx.c',
- 'psutil/arch/osx/process_info.c',
- 'psutil/arch/osx/smc.c',
+ 'psutil/_psutil_macos.c',
+ 'psutil/arch/macos/process_info.c',
+ 'psutil/arch/macos/smc.c',
],
define_macros=macros,
extra_link_args=[