From 563a2453ba7db9f7e02e8ddffb224407fa20bdf8 Mon Sep 17 00:00:00 2001 From: red-agent <hell.director@gmail.com> Date: Mon, 5 Oct 2009 17:13:12 +0300 Subject: [PATCH] Improved proccess renaming --- src/gajim.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/gajim.py b/src/gajim.py index 87e7823e75..0182dec88e 100644 --- a/src/gajim.py +++ b/src/gajim.py @@ -158,14 +158,18 @@ else: if dbus_support.supported: from music_track_listener import MusicTrackListener import dbus - - if os.name == 'posix': # dl module is Unix Only - try: # rename the process name to gajim - import dl - libc = dl.open('/lib/libc.so.6') - libc.call('prctl', 15, 'gajim\0', 0, 0, 0) - except Exception: - pass + + from ctypes import CDLL + from ctypes.util import find_library + import platform + + sysname = platform.system() + libc = CDLL(find_library('c')) + + if sysname == 'Linux': + libc.prctl(15, 'Gajim', 0, 0, 0) + elif sysname in ('FreeBSD', 'OpenBSD', 'NetBSD'): + libc.setproctitle('Gajim') if gtk.pygtk_version < (2, 12, 0): pritext = _('Gajim needs PyGTK 2.12 or above') -- GitLab