Re: [PATCH xserver v2] inputthread: On Linux leave the main thread's name as-is

2016-10-26 Thread Peter Hutterer
On Wed, Oct 26, 2016 at 12:21:16PM +0200, Hans de Goede wrote:
> From: Peter Hutterer 
> 
> On Linux, setting the main thread's name changes the program name
> (/proc/self/comm). Setting it to MainThread breaks scripts that rely on
> the command name, e.g. ps -C Xorg.
> 
> Signed-off-by: Peter Hutterer 
> Signed-off-by: Hans de Goede 

pushed, thanks.

   007f8ee..5cb3283  master -> master

Cheers,
   Peter

> ---
> Changes in v2 (hdegoede):
> -Only leave the main thread as-is in Linux, naming it is not an issue on
>  other platforms
> ---
>  os/inputthread.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/os/inputthread.c b/os/inputthread.c
> index ddafa7f..8e7f2ed 100644
> --- a/os/inputthread.c
> +++ b/os/inputthread.c
> @@ -431,11 +431,13 @@ InputThreadPreInit(void)
>  }
>  hotplugPipeWrite = hotplugPipe[1];
>  
> +#ifndef __linux__ /* Linux does not deal well with renaming the main thread 
> */
>  #if defined(HAVE_PTHREAD_SETNAME_NP_WITH_TID)
>  pthread_setname_np (pthread_self(), "MainThread");
>  #elif defined(HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID)
>  pthread_setname_np ("MainThread");
>  #endif
> +#endif
>  
>  }
>  
> -- 
> 2.9.3
> 
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

[PATCH xserver v2] inputthread: On Linux leave the main thread's name as-is

2016-10-26 Thread Hans de Goede
From: Peter Hutterer 

On Linux, setting the main thread's name changes the program name
(/proc/self/comm). Setting it to MainThread breaks scripts that rely on
the command name, e.g. ps -C Xorg.

Signed-off-by: Peter Hutterer 
Signed-off-by: Hans de Goede 
---
Changes in v2 (hdegoede):
-Only leave the main thread as-is in Linux, naming it is not an issue on
 other platforms
---
 os/inputthread.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/os/inputthread.c b/os/inputthread.c
index ddafa7f..8e7f2ed 100644
--- a/os/inputthread.c
+++ b/os/inputthread.c
@@ -431,11 +431,13 @@ InputThreadPreInit(void)
 }
 hotplugPipeWrite = hotplugPipe[1];
 
+#ifndef __linux__ /* Linux does not deal well with renaming the main thread */
 #if defined(HAVE_PTHREAD_SETNAME_NP_WITH_TID)
 pthread_setname_np (pthread_self(), "MainThread");
 #elif defined(HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID)
 pthread_setname_np ("MainThread");
 #endif
+#endif
 
 }
 
-- 
2.9.3

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel