GHC HEAD breakage by pthread_setname_np usage.

Karel Gardas karel.gardas at centrum.cz
Mon Oct 13 09:12:01 UTC 2014


Hello Simon,

I'm sorry to disturb you, but your recent patch:

commit 674c631ea111233daa929ef63500d75ba0db8858
Author: Simon Marlow <marlowsd at gmail.com>
Date:   Fri Oct 10 14:26:19 2014 +0100

     Name worker threads using pthread_setname_np

     This helps identify threads in gdb particularly in processes with a
     lot of threads.



breaks build on FreeBSD and Solaris at least. The problem is that 
pthread_setname_np is GNU extension and so far I've seen it just in 
linux using glibc >=2.12, modern NetBSD and modern QNX. Builds on 
Solaris and FreeBSD result in unresolved symbol failure. Two examples 
showing this are here:

http://haskell.inf.elte.hu/builders/smartos-x86-head/147/10.html
http://haskell.inf.elte.hu/builders/freebsd-amd64-head/411/10.html

The problem is that I cannot simply #ifdef usage of this since it's 
using `name' parameter of the createOSThread function and if I #ifdef 
this, then the compiler emits obvious warning:

rts/posix/OSThreads.c: In function ‘createOSThread’:

rts/posix/OSThreads.c:132:40:  warning: unused parameter ‘name’


which is probably going to break validate build which builds with -Werror.

Perhaps if pthread_setname_np is not available on the target platform we 
can define it ourself (as empty macro or inline function doing nothing?) 
and use that, but in this case we would probably need proper configure 
check for the presence of this function.

As rts is your domain, I'm just writing this in a hope that you will 
either revert the patch for now or solve it in a way you like.

Thanks!
Karel


More information about the ghc-devs mailing list