[lttng-dev] [RFC PATCH 0/2] Identify UST threads by changing thread names

Raphaël Beamonte raphael.beamonte at gmail.com
Fri Jun 3 14:12:19 UTC 2016


Hi!

Thanks for all of your comments, I appreciate it!
Thanks Jeremie for adding Mathieu in Cc, forgot to do it... Will
remember next time! :)

2016-06-02 9:22 GMT-04:00 Sebastien Boisvert <sboisvert at gydle.com>:
> Do you know if the name of these listener threads can be set in their constructor, directly
> when they are brought into this world ?

pthread_create does not allow to specify a name when creating the new
thread, as far as I know! That's why the 'lttng_ust_setustprocname()'
function is called first thing in the ust_listener_thread function.

> Perhaps the availability of pthread_setname_np and/or pthread_set_name_np (you have both names
> in your patch 2) should be ascertained in another venue, such as the configure.ac -- where it belongs.

True!

2016-06-03 2:24 GMT-04:00 Mathieu Desnoyers <mathieu.desnoyers at efficios.com>:
> ----- On Jun 3, 2016, at 8:18 AM, Mathieu Desnoyers mathieu.desnoyers at efficios.com wrote:
>> lttng-ust already uses libc for mutexes and other. So I don't see why
>> you have to _add_ any explicit dependency there.
>
> and we already explicitly use pthread (pthread_create).

You're right, pthread is already used. However, when compiling the
code without adding the pthread dependency, I get the following
warning:

In file included from lttng-tracer.h:30:0,
                 from lttng-ust-abi.c:50:
compat.h: In function ‘lttng_ust_setustprocname’:
compat.h:52:2: warning: implicit declaration of function
‘pthread_setname_np’ [-Wimplicit-function-declaration]
  pthread_setname_np(pthread_self(), name);
  ^
  CC       lttng-context-procname.lo
In file included from lttng-context-procname.c:28:0:
compat.h: In function ‘lttng_ust_setustprocname’:
compat.h:52:2: warning: implicit declaration of function
‘pthread_setname_np’ [-Wimplicit-function-declaration]
  pthread_setname_np(pthread_self(), name);
  ^

It seems to be because pthread is not specified as dependency for
liblttng-ust-tracepoint in liblttng-ust/Makefile.am. However, perhaps
that pthread dependency should be added elsewhere?

>> About the glibc version, we should use autotools to detect the
>> features supported by the system libc, and pass a config define
>> to the source code, so we can use the glibc pthread_setname_np
>> if available, else we keep the current behavior.

That's a good idea, will do!

I'll update and rebase the patch following your comments.
If you have any other insight about the pthread dependency, I'm all ears!

Thanks,
Raphaël


More information about the lttng-dev mailing list