diff options
author | Kamil Rytarowski <krytarowski@users.noreply.github.com> | 2019-06-12 06:38:40 +0200 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2019-06-12 12:38:40 +0800 |
commit | c2f30702a4db0f4dfbf88842c07532cc187daf5a (patch) | |
tree | 3289f4c5072e1b75a8e93353b08f3b46dbd185ec /psutil/_psbsd.py | |
parent | f50df9657591c52a0a46c5af3d14998c6471065f (diff) | |
download | psutil-c2f30702a4db0f4dfbf88842c07532cc187daf5a.tar.gz |
Implement psutil_proc_cwd for NetBSD (#1530)
Pick KERN_PROC_CWD that is available in 8.99.43 and fallback for
older versions to readlink("/proc/$PID/cwd").
Diffstat (limited to 'psutil/_psbsd.py')
-rw-r--r-- | psutil/_psbsd.py | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/psutil/_psbsd.py b/psutil/_psbsd.py index 3d9dfdab..e90bdc84 100644 --- a/psutil/_psbsd.py +++ b/psutil/_psbsd.py @@ -844,10 +844,7 @@ class Process(object): # it into None if OPENBSD and self.pid == 0: return None # ...else it would raise EINVAL - elif NETBSD: - with wrap_exceptions_procfs(self): - return os.readlink("/proc/%s/cwd" % self.pid) - elif HAS_PROC_OPEN_FILES: + elif NETBSD or HAS_PROC_OPEN_FILES: # FreeBSD < 8 does not support functions based on # kinfo_getfile() and kinfo_getvmmap() return cext.proc_cwd(self.pid) or None |