c72d21a
From bd4c8cb4db6e3a1905998f8b848e9f4624f51d52 Mon Sep 17 00:00:00 2001
c72d21a
From: Peter Hutterer <peter.hutterer@who-t.net>
c72d21a
Date: Tue, 18 Oct 2016 14:13:47 +1000
c72d21a
Subject: [PATCH xserver v2 7/7] inputthread: On Linux leave the main thread's
c72d21a
 name as-is
c72d21a
c72d21a
On Linux, setting the main thread's name changes the program name
c72d21a
(/proc/self/comm). Setting it to MainThread breaks scripts that rely on
c72d21a
the command name, e.g. ps -C Xorg.
c72d21a
c72d21a
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
c72d21a
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
c72d21a
---
c72d21a
Changes in v2 (hdegoede):
c72d21a
-Only leave the main thread as-is in Linux, naming it is not an issue on
c72d21a
 other platforms
c72d21a
---
c72d21a
 os/inputthread.c | 2 ++
c72d21a
 1 file changed, 2 insertions(+)
c72d21a
c72d21a
diff --git a/os/inputthread.c b/os/inputthread.c
c72d21a
index ddafa7f..8e7f2ed 100644
c72d21a
--- a/os/inputthread.c
c72d21a
+++ b/os/inputthread.c
c72d21a
@@ -431,11 +431,13 @@ InputThreadPreInit(void)
c72d21a
     }
c72d21a
     hotplugPipeWrite = hotplugPipe[1];
c72d21a
 
c72d21a
+#ifndef __linux__ /* Linux does not deal well with renaming the main thread */
c72d21a
 #if defined(HAVE_PTHREAD_SETNAME_NP_WITH_TID)
c72d21a
     pthread_setname_np (pthread_self(), "MainThread");
c72d21a
 #elif defined(HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID)
c72d21a
     pthread_setname_np ("MainThread");
c72d21a
 #endif
c72d21a
+#endif
c72d21a
 
c72d21a
 }
c72d21a
 
c72d21a
-- 
c72d21a
2.9.3
c72d21a