2 * SPDX-License-Identifier: LGPL-2.1-or-later
4 * Copyright (C) 2013 Mentor Graphics
8 * Do _not_ define _LGPL_SOURCE because we don't want to create a
9 * circular dependency loop between this malloc wrapper, liburcu and
12 #include <ust-dlfcn.h>
13 #include <ust-helper.h>
16 #define TRACEPOINT_DEFINE
17 #define TRACEPOINT_CREATE_PROBES
18 #define TP_IP_PARAM ip
19 #include "ust_pthread.h"
21 static __thread
int thread_in_trace
;
23 int pthread_mutex_lock(pthread_mutex_t
*mutex
)
25 static int (*mutex_lock
)(pthread_mutex_t
*);
29 mutex_lock
= dlsym(RTLD_NEXT
, "pthread_mutex_lock");
31 if (thread_in_trace
) {
34 fprintf(stderr
, "unable to initialize pthread wrapper library.\n");
38 if (thread_in_trace
) {
39 return mutex_lock(mutex
);
43 tracepoint(lttng_ust_pthread
, pthread_mutex_lock_req
, mutex
,
44 LTTNG_UST_CALLER_IP());
45 retval
= mutex_lock(mutex
);
46 tracepoint(lttng_ust_pthread
, pthread_mutex_lock_acq
, mutex
,
47 retval
, LTTNG_UST_CALLER_IP());
52 int pthread_mutex_trylock(pthread_mutex_t
*mutex
)
54 static int (*mutex_trylock
)(pthread_mutex_t
*);
58 mutex_trylock
= dlsym(RTLD_NEXT
, "pthread_mutex_trylock");
60 if (thread_in_trace
) {
63 fprintf(stderr
, "unable to initialize pthread wrapper library.\n");
67 if (thread_in_trace
) {
68 return mutex_trylock(mutex
);
72 retval
= mutex_trylock(mutex
);
73 tracepoint(lttng_ust_pthread
, pthread_mutex_trylock
, mutex
,
74 retval
, LTTNG_UST_CALLER_IP());
79 int pthread_mutex_unlock(pthread_mutex_t
*mutex
)
81 static int (*mutex_unlock
)(pthread_mutex_t
*);
85 mutex_unlock
= dlsym(RTLD_NEXT
, "pthread_mutex_unlock");
87 if (thread_in_trace
) {
90 fprintf(stderr
, "unable to initialize pthread wrapper library.\n");
94 if (thread_in_trace
) {
95 return mutex_unlock(mutex
);
99 retval
= mutex_unlock(mutex
);
100 tracepoint(lttng_ust_pthread
, pthread_mutex_unlock
, mutex
,
101 retval
, LTTNG_UST_CALLER_IP());
This page took 0.033898 seconds and 5 git commands to generate.