def terminal(self): hit_enoent = False tty = wrap_exceptions( cext.proc_basic_info(self.pid)[0]) if tty != cext.PRNODEV: for x in (0, 1, 2, 255): try: return os.readlink('/proc/%d/path/%d' % (self.pid, x)) except OSError as err: if err.errno == errno.ENOENT: hit_enoent = True continue raise if hit_enoent: # raise NSP if the process disappeared on us os.stat('/proc/%s' % self.pid)
def terminal(self): hit_enoent = False tty = wrap_exceptions( cext.proc_basic_info(self.pid)[0]) if tty != cext.PRNODEV: for x in (0, 1, 2, 255): try: return os.readlink('/proc/%d/path/%d' % (self.pid, x)) except OSError: err = sys.exc_info()[1] if err.errno == errno.ENOENT: hit_enoent = True continue raise if hit_enoent: # raise NSP if the process disappeared on us os.stat('/proc/%s' % self.pid)
def status(self): code = cext.proc_basic_info(self.pid)[6] # XXX is '?' legit? (we're not supposed to return it anyway) return PROC_STATUSES.get(code, '?')
def memory_info(self): ret = cext.proc_basic_info(self.pid) rss, vms = ret[1] * 1024, ret[2] * 1024 return _common.pmem(rss, vms)
def ppid(self): return cext.proc_basic_info(self.pid)[0]
def num_threads(self): return cext.proc_basic_info(self.pid)[5]
def create_time(self): return cext.proc_basic_info(self.pid)[3]