summaryrefslogtreecommitdiffstats
path: root/b/module/lib/rename_process.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-06-21 15:36:15 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-06-21 15:36:15 +0200
commitdd709581d5750d11eaa8e96f64ff62f16b8f6201 (patch)
treef2652e5a64b4730900640368db4724a15542e08f /b/module/lib/rename_process.py
parentÄnderung: 1564:40817b13d8b3 (diff)
downloadpyload-dd709581d5750d11eaa8e96f64ff62f16b8f6201.tar.xz
rename process
Diffstat (limited to 'b/module/lib/rename_process.py')
-rw-r--r--b/module/lib/rename_process.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/b/module/lib/rename_process.py b/b/module/lib/rename_process.py
new file mode 100644
index 000000000..2aa270171
--- /dev/null
+++ b/b/module/lib/rename_process.py
@@ -0,0 +1,21 @@
+import sys
+import os.path
+
+
+def RenameProcess(new_name):
+ """ Renames the process calling the function to the given name. """
+ if sys.platform != 'linux2':
+ print 'Unsupported platform'
+ return False
+ try:
+ import ctypes
+ is_64 = os.path.exists('/lib64/libc.so.6')
+ if is_64:
+ libc = ctypes.CDLL('/lib64/libc.so.6')
+ else:
+ libc = ctypes.CDLL('/lib/libc.so.6')
+ libc.prctl(15, new_name, 0, 0, 0)
+ return True
+ except:
+ print "rename failed"
+ return False