summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2016-02-28 00:42:05 +0100
committerGiampaolo Rodola <g.rodola@gmail.com>2016-02-28 00:42:05 +0100
commit6d106928cb66ddf7c2b649eec00ee3f55639364a (patch)
tree9c72a0d788093b8cb7cf2d4a307e2541ae2c8a0a
parent5c772a131269285b57f81f774e4aaf24fb30ba0b (diff)
downloadpsutil-6d106928cb66ddf7c2b649eec00ee3f55639364a.tar.gz
update doc
-rw-r--r--HISTORY.rst5
-rw-r--r--docs/index.rst21
2 files changed, 24 insertions, 2 deletions
diff --git a/HISTORY.rst b/HISTORY.rst
index 296dc85f..3c4dfa7a 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -3,6 +3,11 @@ Bug tracker at https://github.com/giampaolo/psutil/issues
4.1.0 - XXXX-XX-XX
==================
+**Enhancements**
+
+- #777: [Linux] Process.open_files() on Linux return 3 new fields: position,
+ mode and flags.
+
**Bug fixes**
- #776: [Linux] Process.cpu_affinity() may erroneously raise NoSuchProcess.
diff --git a/docs/index.rst b/docs/index.rst
index 286f8a6a..429e76b3 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -1202,8 +1202,22 @@ Process class
.. method:: open_files()
Return regular files opened by process as a list of namedtuples including
- the absolute file name and the file descriptor number (on Windows this is
- always ``-1``). Example:
+ the following fields:
+
+ - **path**: the absolute file name.
+ - **fd**: the file descriptor number; on Windows this is always ``-1``.
+ - **position** (Linux): the file (offset) position.
+ - **mode** (Linux): a string indicating how the file was opened, similarly
+ `open <https://docs.python.org/3/library/functions.html#open>`__'s
+ ``mode`` argument. Possible values are ``'r'``, ``'w'``, ``'a'``,
+ ``'r+'`` and ``'a+'``. There's no distinction between files opened in
+ bynary or text mode (``"b"`` or ``"t"``).
+ - **flags** (Linux): the flags which were passed to the underlying
+ `os.open <https://docs.python.org/2/library/os.html#os.open>`__ C call
+ when the file was opened (e.g.
+ `os.O_RDONLY <https://docs.python.org/3/library/os.html#os.O_RDONLY>`__,
+ `os.O_TRUNC <https://docs.python.org/3/library/os.html#os.O_TRUNC>`__,
+ etc).
>>> import psutil
>>> f = open('file.ext', 'w')
@@ -1228,6 +1242,9 @@ Process class
.. versionchanged:: 3.1.0 no longer hangs on Windows.
+ .. versionchanged:: 4.1.0 new *position*, *mode* and *flags* fields on
+ Linux.
+
.. method:: connections(kind="inet")
Return socket connections opened by process as a list of namedtuples.