]> git.ipfire.org Git - oddments/cappie.git/blobdiff - cappie/util.py
Set names of threads for better debugging.
[oddments/cappie.git] / cappie / util.py
diff --git a/cappie/util.py b/cappie/util.py
new file mode 100644 (file)
index 0000000..107b1b2
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/bash
+###############################################################################
+#                                                                             #
+# Cappie                                                                      #
+# Copyright (C) 2010 Michael Tremer                                           #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+###############################################################################
+
+import ctypes
+
+def setprocname(name):
+       libc = ctypes.cdll.LoadLibrary(None)
+
+       buff = ctypes.create_string_buffer(len(name)+1)
+       buff.value = name
+
+       libc.prctl(15, ctypes.byref(buff), 0, 0, 0)