[tor-commits] [stem/master] Clarifying that jail ids only exist on FreeBSD

atagar at torproject.org atagar at torproject.org
Sat Dec 31 21:58:55 UTC 2011


commit af9cdc40e9aa3c8ae625dd6941fb63815ad361f3
Author: Damian Johnson <atagar at torproject.org>
Date:   Sat Dec 31 13:23:01 2011 -0800

    Clarifying that jail ids only exist on FreeBSD
    
    Sebastian and rransom confirmed that jail ids do not exist on OSX and OpenBSD
    so clarifying that the function is only known to apply for FreeBSD.
---
 stem/util/system.py |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/stem/util/system.py b/stem/util/system.py
index 86a2e27..aa1180e 100644
--- a/stem/util/system.py
+++ b/stem/util/system.py
@@ -459,7 +459,8 @@ def get_cwd(pid):
 
 def get_bsd_jail_id(pid):
   """
-  Get the FreeBSD jail id for a process.
+  Gets the jail id for a process. These seem to only exist for FreeBSD (this
+  style for jails does not exist on Linux, OSX, or OpenBSD).
   
   Arguments:
     pid (int) - process id of the jail id to be queried
@@ -482,14 +483,11 @@ def get_bsd_jail_id(pid):
     jid = ps_output[1].strip()
     if jid.isdigit(): return int(jid)
   
-  # TODO: Is this function exclusive to FreeBSD or does it work on other BSD
-  # systems? It should fail on OpenBSD but might work on OSX.
-  
   os_name = os.uname()[0]
   if os_name == "FreeBSD":
-    log.warn("Failed to figure out the FreeBSD jail id for pid %s. Guessing that it's not in a jail." % pid)
+    log.warn("Unable to get the jail id for process %s." % pid)
   else:
-    log.debug("get_bsd_jail_id(%s): this function isn't supported on %s" % (pid, os_name))
+    log.debug("get_bsd_jail_id(%s): jail ids do not exist on %s" % (pid, os_name))
   
   return 0
 





More information about the tor-commits mailing list