diff options
author | Armin Gruner <ag-github@muc.de> | 2020-08-13 15:39:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-13 15:39:29 +0200 |
commit | b09f5a28c98f1d4ee160e133ee5fc5446efba68f (patch) | |
tree | 3b1eef9bdcc588f5f98acd718d2afae958ec0af8 /psutil/_psbsd.py | |
parent | a0967043b5819b2edc61d9a12306289d5e7f98c2 (diff) | |
download | psutil-b09f5a28c98f1d4ee160e133ee5fc5446efba68f.tar.gz |
Implement Process.environ() on *BSD family (#1800) (patch by Armin Gruner)
Diffstat (limited to 'psutil/_psbsd.py')
-rw-r--r-- | psutil/_psbsd.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/psutil/_psbsd.py b/psutil/_psbsd.py index d53eb042..0568e3a8 100644 --- a/psutil/_psbsd.py +++ b/psutil/_psbsd.py @@ -51,7 +51,7 @@ if FREEBSD: cext.SWAIT: _common.STATUS_WAITING, cext.SLOCK: _common.STATUS_LOCKED, } -elif OPENBSD or NETBSD: +elif OPENBSD: PROC_STATUSES = { cext.SIDL: _common.STATUS_IDLE, cext.SSLEEP: _common.STATUS_SLEEPING, @@ -76,12 +76,11 @@ elif OPENBSD or NETBSD: elif NETBSD: PROC_STATUSES = { cext.SIDL: _common.STATUS_IDLE, - cext.SACTIVE: _common.STATUS_RUNNING, - cext.SDYING: _common.STATUS_ZOMBIE, + cext.SSLEEP: _common.STATUS_SLEEPING, cext.SSTOP: _common.STATUS_STOPPED, cext.SZOMB: _common.STATUS_ZOMBIE, - cext.SDEAD: _common.STATUS_DEAD, - cext.SSUSPENDED: _common.STATUS_SUSPENDED, # unique to NetBSD + cext.SRUN: _common.STATUS_WAKING, + cext.SONPROC: _common.STATUS_RUNNING, } TCP_STATUSES = { @@ -670,6 +669,10 @@ class Process(object): return cext.proc_cmdline(self.pid) @wrap_exceptions + def environ(self): + return cext.proc_environ(self.pid) + + @wrap_exceptions def terminal(self): tty_nr = self.oneshot()[kinfo_proc_map['ttynr']] tmap = _psposix.get_terminal_map() |