1e65207f8bc007e69539e3220cca7a89f1e69d67
2 * Copyright (C) 2013 Mentor Graphics
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 * Do _not_ define _LGPL_SOURCE because we don't want to create a
21 * circular dependency loop between this malloc wrapper, liburcu and
24 #include <lttng/ust-dlfcn.h>
28 #define TRACEPOINT_DEFINE
29 #define TRACEPOINT_CREATE_PROBES
30 #define TP_IP_PARAM ip
31 #include "ust_pthread.h"
33 static __thread
int thread_in_trace
;
35 int pthread_mutex_lock(pthread_mutex_t
*mutex
)
37 static int (*mutex_lock
)(pthread_mutex_t
*);
41 mutex_lock
= dlsym(RTLD_NEXT
, "pthread_mutex_lock");
43 if (thread_in_trace
) {
46 fprintf(stderr
, "unable to initialize pthread wrapper library.\n");
50 if (thread_in_trace
) {
51 return mutex_lock(mutex
);
55 tracepoint(lttng_ust_pthread
, pthread_mutex_lock_req
, mutex
,
56 LTTNG_UST_CALLER_IP());
57 retval
= mutex_lock(mutex
);
58 tracepoint(lttng_ust_pthread
, pthread_mutex_lock_acq
, mutex
,
59 retval
, LTTNG_UST_CALLER_IP());
64 int pthread_mutex_trylock(pthread_mutex_t
*mutex
)
66 static int (*mutex_trylock
)(pthread_mutex_t
*);
70 mutex_trylock
= dlsym(RTLD_NEXT
, "pthread_mutex_trylock");
72 if (thread_in_trace
) {
75 fprintf(stderr
, "unable to initialize pthread wrapper library.\n");
79 if (thread_in_trace
) {
80 return mutex_trylock(mutex
);
84 retval
= mutex_trylock(mutex
);
85 tracepoint(lttng_ust_pthread
, pthread_mutex_trylock
, mutex
,
86 retval
, LTTNG_UST_CALLER_IP());
91 int pthread_mutex_unlock(pthread_mutex_t
*mutex
)
93 static int (*mutex_unlock
)(pthread_mutex_t
*);
97 mutex_unlock
= dlsym(RTLD_NEXT
, "pthread_mutex_unlock");
99 if (thread_in_trace
) {
102 fprintf(stderr
, "unable to initialize pthread wrapper library.\n");
106 if (thread_in_trace
) {
107 return mutex_unlock(mutex
);
111 retval
= mutex_unlock(mutex
);
112 tracepoint(lttng_ust_pthread
, pthread_mutex_unlock
, mutex
,
113 retval
, LTTNG_UST_CALLER_IP());
This page took 0.034072 seconds and 3 git commands to generate.