~ubuntu-branches/ubuntu/saucy/mutextrace/saucy-proposed

« back to all changes in this revision

Viewing changes to real.c

  • Committer: Bazaar Package Importer
  • Author(s): Simon Richter
  • Date: 2009-11-30 15:26:21 UTC
  • Revision ID: james.westby@ubuntu.com-20091130152621-kxucetq7b43lx9fu
Tags: upstream-0.1
ImportĀ upstreamĀ versionĀ 0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifdef HAVE_CONFIG_H
 
2
#include <config.h>
 
3
#endif
 
4
 
 
5
#include "real.h"
 
6
 
 
7
#include <dlfcn.h>
 
8
 
 
9
int (*real_create)(pthread_t *, pthread_attr_t const *, void *(*)(void *), void *);
 
10
 
 
11
int (*real_mutex_init)(pthread_mutex_t *, pthread_mutexattr_t const *);
 
12
int (*real_mutex_destroy)(pthread_mutex_t *);
 
13
int (*real_mutex_lock)(pthread_mutex_t *);
 
14
int (*real_mutex_unlock)(pthread_mutex_t *);
 
15
 
 
16
int (*real_cond_init)(pthread_cond_t *, pthread_condattr_t const *);
 
17
int (*real_cond_wait)(pthread_cond_t *, pthread_mutex_t *);
 
18
int (*real_cond_signal)(pthread_cond_t *);
 
19
 
 
20
void init(void) __attribute__((constructor));
 
21
 
 
22
void init(void)
 
23
{
 
24
    real_create = dlsym(RTLD_NEXT, "pthread_create");
 
25
    real_mutex_init = dlsym(RTLD_NEXT, "pthread_mutex_init");
 
26
    real_mutex_destroy = dlsym(RTLD_NEXT, "pthread_mutex_destroy");
 
27
    real_mutex_lock = dlsym(RTLD_NEXT, "pthread_mutex_lock");
 
28
    real_mutex_unlock = dlsym(RTLD_NEXT, "pthread_mutex_unlock");
 
29
    real_cond_init = dlsym(RTLD_NEXT, "pthread_cond_init");
 
30
    real_cond_wait = dlsym(RTLD_NEXT, "pthread_cond_wait");
 
31
    real_cond_signal = dlsym(RTLD_NEXT, "pthread_cond_signal");
 
32
 
 
33
    return;
 
34
}