~diwic/ubuntu/lucid/pulseaudio/bugfixes

« back to all changes in this revision

Viewing changes to src/daemon/ltdl-bind-now.c

  • Committer: Bazaar Package Importer
  • Author(s): Luke Yelavich
  • Date: 2008-11-04 15:46:00 UTC
  • mfrom: (1.2.1 upstream) (1.1.6 lenny)
  • Revision ID: james.westby@ubuntu.com-20081104154600-hlzknpcazaam0nxm
Tags: 0.9.13-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Don't build against, and create jack package. Jack is not in main.
  - Remove --disable-per-user-esound-socket from configure flags, as we still
    want per user esound sockets.
  - Remove stop links from rc0 and rc6.
  - Change default resample algorithm and bubffer size.
  - Add alsa configuration files to route alsa applications via pulseaudio.
  - Move libasound2-plugins from Recommends to Depends.
* debian/pulseaudio.preinst: When upgrading from intrepid, remove
  /etc/X11/Xsession.d/70pulseaudio, as this was used to minimize a race
  condition when starting GNOME in intrepid. This race should not exist in
  jaunty once libcanberra is built to use pulseaudio as a backend.
* Do not spawn a pulseaudio server if clients fail to find a running server.
* Remove explicit version dependency for libspeex-dev to allow the package
  to be built for now.
* Regenerate autotools files to work with Ubuntu's newer libtool/libltdl.
* debian/control: libpulsecore5 -> libpulsecore8 to match the library
  soname.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: ltdl-bind-now.c 2167 2008-03-27 23:35:06Z lennart $ */
2
 
 
3
1
/***
4
2
  This file is part of PulseAudio.
5
3
 
26
24
#include <config.h>
27
25
#endif
28
26
 
29
 
#if HAVE_DLFCN_H
 
27
#ifdef HAVE_DLFCN_H
30
28
#include <dlfcn.h>
31
29
#endif
32
30
 
33
 
#if HAVE_SYS_DL_H
 
31
#ifdef HAVE_SYS_DL_H
34
32
#include <sys/dl.h>
35
33
#endif
36
34
 
37
 
#ifndef HAVE_STRUCT_LT_USER_DLLOADER
38
 
/* Only used with ltdl 2.2 */
39
35
#include <string.h>
40
 
#endif
41
36
 
42
37
#include <ltdl.h>
43
38
 
 
39
#include <pulse/i18n.h>
 
40
 
44
41
#include <pulsecore/macro.h>
45
42
#include <pulsecore/mutex.h>
46
43
#include <pulsecore/thread.h>
56
53
#undef PA_BIND_NOW
57
54
#endif
58
55
 
 
56
#ifdef HAVE_LT_DLMUTEX_REGISTER
 
57
 
59
58
static pa_mutex *libtool_mutex = NULL;
60
59
 
61
 
PA_STATIC_TLS_DECLARE_NO_FREE(libtool_tls);
62
 
 
63
60
static void libtool_lock(void) {
64
61
    pa_mutex_lock(libtool_mutex);
65
62
}
68
65
    pa_mutex_unlock(libtool_mutex);
69
66
}
70
67
 
 
68
#endif
 
69
 
 
70
PA_STATIC_TLS_DECLARE_NO_FREE(libtool_tls);
 
71
 
71
72
static void libtool_set_error(const char *error) {
72
73
    PA_STATIC_TLS_SET(libtool_tls, (char*) error);
73
74
}
91
92
*/
92
93
 
93
94
#ifndef HAVE_LT_DLADVISE
94
 
static lt_module bind_now_open(lt_user_data d, const char *fname) {
 
95
static lt_module bind_now_open(lt_user_data d, const char *fname)
95
96
#else
96
 
  static lt_module bind_now_open(lt_user_data d, const char *fname, lt_dladvise advise) {
 
97
static lt_module bind_now_open(lt_user_data d, const char *fname, lt_dladvise advise)
97
98
#endif
 
99
{
98
100
    lt_module m;
99
101
 
100
102
    pa_assert(fname);
101
103
 
102
104
    if (!(m = dlopen(fname, PA_BIND_NOW))) {
 
105
#ifdef HAVE_LT_DLMUTEX_REGISTER
103
106
        libtool_set_error(dlerror());
 
107
#endif
104
108
        return NULL;
105
109
    }
106
110
 
112
116
    pa_assert(m);
113
117
 
114
118
    if (dlclose(m) != 0){
 
119
#ifdef HAVE_LT_DLMUTEX_REGISTER
115
120
        libtool_set_error(dlerror());
 
121
#endif
116
122
        return 1;
117
123
    }
118
124
 
126
132
    pa_assert(symbol);
127
133
 
128
134
    if (!(ptr = dlsym(m, symbol))) {
 
135
#ifdef HAVE_LT_DLMUTEX_REGISTER
129
136
        libtool_set_error(dlerror());
 
137
#endif
130
138
        return NULL;
131
139
    }
132
140
 
152
160
#endif
153
161
 
154
162
    pa_assert_se(lt_dlinit() == 0);
 
163
 
 
164
#ifdef HAVE_LT_DLMUTEX_REGISTER
155
165
    pa_assert_se(libtool_mutex = pa_mutex_new(TRUE, FALSE));
156
 
#ifdef HAVE_LT_DLMUTEX_REGISTER
157
166
    pa_assert_se(lt_dlmutex_register(libtool_lock, libtool_unlock, libtool_set_error, libtool_get_error) == 0);
158
167
#endif
159
168
 
165
174
 
166
175
    /* Add our BIND_NOW loader as the default module loader. */
167
176
    if (lt_dlloader_add(place, &loader, "bind-now-loader") != 0)
168
 
        pa_log_warn("Failed to add bind-now-loader.");
 
177
        pa_log_warn(_("Failed to add bind-now-loader."));
169
178
# else
170
179
    /* Already initialised */
171
 
    if ( dlopen_loader != NULL ) return;
 
180
    if (dlopen_loader)
 
181
        return;
172
182
 
173
183
    if (!(dlopen_loader = lt_dlloader_find("dlopen"))) {
174
 
      pa_log_warn("Failed to find original dlopen loader.");
175
 
      return;
 
184
        pa_log_warn(_("Failed to find original dlopen loader."));
 
185
        return;
176
186
    }
177
187
 
178
188
    memcpy(&bindnow_loader, dlopen_loader, sizeof(bindnow_loader));
184
194
 
185
195
    /* Add our BIND_NOW loader as the default module loader. */
186
196
    if (lt_dlloader_add(&bindnow_loader) != 0)
187
 
        pa_log_warn("Failed to add bind-now-loader.");
 
197
        pa_log_warn(_("Failed to add bind-now-loader."));
188
198
# endif
189
199
#endif
190
200
}
191
201
 
192
202
void pa_ltdl_done(void) {
193
203
    pa_assert_se(lt_dlexit() == 0);
 
204
 
 
205
#ifdef HAVE_LT_DLMUTEX_REGISTER
194
206
    pa_mutex_free(libtool_mutex);
195
207
    libtool_mutex = NULL;
 
208
#endif
196
209
}
197