Add -ust to the name of UST threads of the application
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi Raphaël,
Quoted 21 lines · Sebastien Boisvert
Add the required functions to change the thread name of the UST threads and add the -ust string at its end. This will help to identify LTTng-UST processes when analyzing the trace of a process.
Signed-off-by Raphaël Beamonte <raphael.beamonte at gmail.com>--- liblttng-ust/compat.h | 22 ++++++++++++++++++++++ liblttng-ust/lttng-ust-comm.c | 2 ++ 2 files changed, 24 insertions(+)liblttng-ust/compat.h +3
-0@@ -34,6 +34,23 @@ void lttng_ust_getprocname(char *name) (void )prctl (PR_GET_NAME , (unsigned long ) name,0 ,0 ,0 ); } +static inline +void lttng_ust_setustprocname () +{
liblttng-ust/compat.h void lttng_ust_getprocname(char *name) · line 49
Quoted 10 lines
liblttng-ust/compat.h +10
-0+char name[LTTNG_UST_PROCNAME_LEN ]; +int limit =LTTNG_UST_PROCNAME_LEN -4 ; + +lttng_ust_getprocname (name); + +if (strlen (name) >= limit) { + name[limit] =0 ; + } + +sprintf (name,"%s%s" , name,"-ust" );
The objects can not overlap, otherwise, the behavior is undefined:
"If copying takes place between objects that overlap as a result of a call to sprintf() or snprintf(), the results are undefined." [1]
[1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/sprintf.html
Quoted 25 lines
liblttng-ust/compat.h +9
-0+ + (void) prctl(PR_SET_NAME, name, 0, 0, 0); +} +#elif defined(__FreeBSD__)#include <stdlib.h> #include <string.h> @@ -59,6 +76,11 @@ void lttng_ust_getprocname(char *name) strncpy(name, bsd_name, LTTNG_UST_PROCNAME_LEN - 1); } +static inline +void lttng_ust_setustprocname () +{ +} +#endif #include <errno.h> liblttng-ust/lttng-ust-comm.c +0
-0
liblttng-ust/lttng-ust-comm.c void *ust_listener_thread(void *arg) · line 1302
Quoted 8 lines
liblttng-ust/lttng-ust-comm.c +2
-0@@ -1295,6 +1295,8 @@ void *ust_listener_thread(void *arg)int sock, ret, prev_connect_failed =0 , has_waited =0 ;long timeout; +lttng_ust_setustprocname (); +/* Restart trying to connect to the session daemon */ restart:if (prev_connect_failed) {
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi Sebastien,
2016-06-02 9:14 GMT-04:00 Sebastien Boisvert <[email protected]>:
Quoted 8 lines
Quoted 1 line
+
sprintf(name, "%s%s", name, "-ust");The objects can not overlap, otherwise, the behavior is undefined:
"If copying takes place between objects that overlap as a result of a call to
sprintf()orsnprintf(), the results are undefined." [1][1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/sprintf.html
Thanks! Will fix that!
Raphaël
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev