[lttng-dev] [PATCH lttng-ust] Add trace instrumentation for some pthread functions.

Stefan Seefeld stefan_seefeld at mentor.com
Wed Aug 7 11:08:24 EDT 2013


On 08/07/2013 10:33 AM, Mathieu Desnoyers wrote:
> * Stefan Seefeld (stefan_seefeld at mentor.com) wrote:
>
>>
>> +int pthread_mutex_lock(pthread_mutex_t *mutex)
>> +{
>> +	static int (*mutex_lock)(pthread_mutex_t *);
>> +	int retval;
>> +
>> +	if (!mutex_lock) {
>> +		mutex_lock = dlsym(RTLD_NEXT, "pthread_mutex_lock");
>> +		if (!mutex_lock && !thread_in_trace) {
> I'd rather see:
>
>                 if (!mutex_lock) {
>                         if (thread_in_trace) {
>                                 abort();
>                         }
>                         fprintf(stderr, "unable to initialize pthread wrapper library.\n");
>                         return EINVAL;
>                 }
>
> because in that situation, there is not much we can do anyway.

Agreed.

>> +TRACEPOINT_EVENT(ust_pthread, pthread_mutex_lock_req,
>> +	TP_ARGS(pthread_mutex_t *, mutex),
>> +	TP_FIELDS(
>> +		ctf_integer_hex(void *, mutex, (void *) mutex)
> I think the (void *) cast can be removed here: an implicit cast from
> pthread_mutex_t * to void * should be fine.

Adjusted.

    Stefan

-- 
Stefan Seefeld
CodeSourcery / Mentor Graphics
http://www.mentor.com/embedded-software/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch
Type: text/x-patch
Size: 7580 bytes
Desc: not available
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20130807/173a9354/attachment.bin>


More information about the lttng-dev mailing list