summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module/lib/rename_process.py21
-rw-r--r--pyLoadCli.py2
-rwxr-xr-xpyLoadCore.py4
-rwxr-xr-xpyLoadGui.py3
4 files changed, 30 insertions, 0 deletions
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
diff --git a/pyLoadCli.py b/pyLoadCli.py
index fd5bfbc1c..92d382db1 100644
--- a/pyLoadCli.py
+++ b/pyLoadCli.py
@@ -42,6 +42,7 @@ from module.utils import formatSize, decode
import ConfigParser
from module.remote.thriftbackend.ThriftClient import ThriftClient, NoConnection, NoSSL, WrongLogin, ConnectionClosed
from module.lib.Getch import Getch
+from module.lib.rename_process import RenameProcess
class Cli:
def __init__(self, client, command):
@@ -427,6 +428,7 @@ def writeConfig(opts):
print _("Couldn't write user config file")
if __name__ == "__main__":
+ RenameProcess('pyLoadCli')
config = {"addr": "127.0.0.1", "port": "7227", "language": "en"}
try:
config["language"] = os.environ["LANG"][0:2]
diff --git a/pyLoadCore.py b/pyLoadCore.py
index cc77ac88e..5197e4a9a 100755
--- a/pyLoadCore.py
+++ b/pyLoadCore.py
@@ -56,6 +56,8 @@ from module.remote.RemoteManager import RemoteManager
from module.database import DatabaseBackend
from module.database import FileHandler
+from module.lib.rename_process import RenameProcess
+
from module.utils import freeSpace, formatSize, compare_time
from codecs import getwriter
@@ -914,6 +916,8 @@ def deamon():
# And so it begins...
if __name__ == "__main__":
+ #change name to 'pyLoadCore'
+ RenameProcess('pyLoadCore')
if "--daemon" in sys.argv:
deamon()
diff --git a/pyLoadGui.py b/pyLoadGui.py
index 6935c502e..d5c20bb83 100755
--- a/pyLoadGui.py
+++ b/pyLoadGui.py
@@ -45,6 +45,8 @@ from module.gui.Collector import *
from module.gui.XMLParser import *
from module.gui.CoreConfigParser import ConfigParser
+from module.lib.rename_process import RenameProcess
+
from module.remote.thriftbackend.thriftgen.pyload.ttypes import *
try:
@@ -778,6 +780,7 @@ class Notification(QObject):
self.tray.showMessage("pyload", body)
if __name__ == "__main__":
+ RenameProcess('pyLoadGui')
app = main()
app.loop()