From 6f8da9534efd4b3833a77a10bff9d009a84dcf80 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Tue, 21 Jun 2011 15:10:23 +0200 Subject: =?UTF-8?q?=C3=84nderung:=20=20=20=20=20=20=20=201564:40817b13d8b3?= =?UTF-8?q?=20Zweig:=20=20=20=20=20=20=20=20=20=20=20dev=20Marke:=20=20=20?= =?UTF-8?q?=20=20=20=20=20=20=20=20tip=20Nutzer:=20=20=20=20=20=20=20=20?= =?UTF-8?q?=20=20Cptn=5FSandwich=20Datum:=20=20=20=20=20=20=20=20=20=20=20?= =?UTF-8?q?Tue=20Jun=2021=2014:02:50=202011=20+0200=20Zusammenfassung:=20u?= =?UTF-8?q?se=20process=20names=20on=20linux=20instead=20of=20"python"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/lib/rename_process.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 module/lib/rename_process.py (limited to 'module/lib/rename_process.py') diff --git a/module/lib/rename_process.py b/module/lib/rename_process.py new file mode 100644 index 000000000..2aa270171 --- /dev/null +++ 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 -- cgit v1.2.3