diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2017-12-01 12:54:44 +0100 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2017-12-01 12:54:44 +0100 |
commit | f114a6e1da74643a89e7ae5d32456ac955e8ae5a (patch) | |
tree | 77421ddf6b10692ce8f636d4635d18ceb8209bff | |
parent | 9afa91dd04357c3e6ad561ee1ea25b5dd6cf1715 (diff) | |
download | psutil-1183-proc-children-speedup.tar.gz |
update doc1183-proc-children-speedup
-rw-r--r-- | docs/index.rst | 3 | ||||
-rw-r--r-- | psutil/__init__.py | 1 | ||||
-rw-r--r-- | psutil/_pslinux.py | 2 |
3 files changed, 5 insertions, 1 deletions
diff --git a/docs/index.rst b/docs/index.rst index 0119b423..ea2384bb 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1716,7 +1716,8 @@ Process class .. method:: children(recursive=False) - Return the children of this process as a list of :Class:`Process` objects. + Return the children of this process as a list of :class:`Process` + instances. If recursive is `True` return all the parent descendants. Pseudo code example assuming *A == this process*: :: diff --git a/psutil/__init__.py b/psutil/__init__.py index 98e60870..a8447973 100644 --- a/psutil/__init__.py +++ b/psutil/__init__.py @@ -268,6 +268,7 @@ else: proc = _psplatform.Process(pid) ppid = proc.ppid() except (NoSuchProcess, AccessDenied): + # Note: AccessDenied is unlikely to happen. pass else: ret[pid] = ppid diff --git a/psutil/_pslinux.py b/psutil/_pslinux.py index ecf116f3..b57adb34 100644 --- a/psutil/_pslinux.py +++ b/psutil/_pslinux.py @@ -1367,6 +1367,8 @@ def ppid_map(): with open_binary("%s/%s/stat" % (procfs_path, pid)) as f: data = f.read() except EnvironmentError as err: + # Note: we should be able to access /stat for all processes + # so we won't bump into EPERM, which is good. if err.errno not in (errno.ENOENT, errno.ESRCH, errno.EPERM, errno.EACCES): raise |