Example #1
0
 def _get_owner(self):
     uid = self.owner
     if uid is None:
         return
     try:
         return getpwuid_cached(uid).pw_name
     except KeyError as e:
         return str(uid)
Example #2
0
 def _get_owner(self):
     uid = self.owner
     if uid is None:
         return
     try:
         return getpwuid_cached(uid).pw_name
     except KeyError as e:
         return str(uid)
Example #3
0
 def __init__(self, pid):
     bincmd = file(os.path.join('/proc', str(pid), 'cmdline'), 'rb').read()
     self.arguments = bincmd.split('\x00') 
     owner_uid = -1
     for line in file(os.path.join('/proc', str(pid), 'status')):
         match = _uid_re.search(line)
         if match:
             owner_uid = int(match.group(1))
     super(LinuxProcess, self).__init__(pid, string.join(self.arguments, ' '), getpwuid_cached(owner_uid).pw_name)