Index: third_party/psutil/psutil/_psosx.py |
diff --git a/third_party/psutil/psutil/_psosx.py b/third_party/psutil/psutil/_psosx.py |
index 543124c077d3b3ba41de1b65fad12875c1be14d6..4112883131ee601b9c291dbf726d36e5d7d01073 100644 |
--- a/third_party/psutil/psutil/_psosx.py |
+++ b/third_party/psutil/psutil/_psosx.py |
@@ -1,6 +1,6 @@ |
#!/usr/bin/env python |
# |
-# $Id: _psosx.py 1142 2011-10-05 18:45:49Z g.rodola $ |
+# $Id: _psosx.py 1159 2011-10-14 18:42:54Z g.rodola@gmail.com $ |
# |
# Copyright (c) 2009, Jay Loden, Giampaolo Rodola'. All rights reserved. |
# Use of this source code is governed by a BSD-style license that can be |
@@ -194,11 +194,16 @@ class Process(object): |
return files |
@wrap_exceptions |
- def get_connections(self): |
+ def get_connections(self, kind='inet'): |
"""Return etwork connections opened by a process as a list of |
- namedtuples.""" |
- retlist = _psutil_osx.get_process_connections(self.pid) |
- return [ntuple_connection(*conn) for conn in retlist] |
+ namedtuples. |
+ """ |
+ if kind not in conn_tmap: |
+ raise ValueError("invalid %r kind argument; choose between %s" |
+ % (kind, ', '.join([repr(x) for x in conn_tmap]))) |
+ families, types = conn_tmap[kind] |
+ ret = _psutil_osx.get_process_connections(self.pid, families, types) |
+ return [ntuple_connection(*conn) for conn in ret] |
@wrap_exceptions |
def process_wait(self, timeout=None): |