commit d83f1ad2fe62dd190f1474c100971932d1478757 Author: Damian Johnson atagar@torproject.org Date: Sat Oct 13 12:54:29 2012 -0700
Using platform.system() for procName system check
As pointed out by ultramage on irc the present sys.platform checks in the procName module are overly strict. The sys.platform attribut includes the version (in his case being 'freebsd10'), causing our attempt to change the process name to fail.
Only tested via a simple sanity check, running arm then looking at my ps output...
atagar@morrigan:~/Desktop/arm$ ps aux | grep arm atagar 8105 6.5 0.8 46560 8420 pts/8 Sl+ 12:54 0:01 arm --- src/util/procName.py | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/util/procName.py b/src/util/procName.py index fab0b1e..b33ff7b 100644 --- a/src/util/procName.py +++ b/src/util/procName.py @@ -11,9 +11,9 @@ argument replacement (ie, replace argv[0], argv[1], etc but with a string the same size). """
-import sys import ctypes import ctypes.util +import platform
# flag for setting the process name, found in '/usr/include/linux/prctl.h' PR_SET_NAME = 15 @@ -38,9 +38,9 @@ def renameProcess(processName): """
_setArgv(processName) - if sys.platform == "linux2": + if platform.system() == "Linux": _setPrctlName(processName) - elif sys.platform == "freebsd7": + elif platform.system() in ("Darwin", "FreeBSD", "OpenBSD"): _setProcTitle(processName)
def _setArgv(processName):