Added symbol versioning for dlsym-callbacks.

Removed snd_config_refer_load from confmisc.c and pcm.c.
This commit is contained in:
Jaroslav Kysela 2001-08-15 12:12:16 +00:00
parent 36a2810081
commit b45c08611c
43 changed files with 184 additions and 137 deletions

View file

@ -1056,10 +1056,14 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name,
open_name = buf;
snprintf(buf, sizeof(buf), "_snd_pcm_%s_open", str);
}
if (!lib)
lib = ALSA_LIB;
h = dlopen(lib, RTLD_NOW);
open_func = h ? dlsym(h, open_name) : NULL;
if (h) {
if ((err = snd_dlsym_verify(h, open_name, SND_DLSYM_VERSION(SND_PCM_DLSYM_VERSION))) < 0) {
dlclose(h);
goto _err;
}
open_func = dlsym(h, open_name);
}
err = 0;
if (!h) {
SNDERR("Cannot open shared library %s", lib);
@ -1079,25 +1083,12 @@ static int snd_pcm_open_noupdate(snd_pcm_t **pcmp, snd_config_t *root,
const char *name, snd_pcm_stream_t stream, int mode)
{
int err;
snd_config_t *pcm_conf, *n;
snd_config_t *pcm_conf;
err = snd_config_search_definition(root, "pcm", name, &pcm_conf);
if (err < 0) {
SNDERR("Unknown PCM %s", name);
return err;
}
if (snd_config_search(pcm_conf, "refer", &n) >= 0) {
snd_config_t *refer;
char *new_name;
err = snd_config_refer_load(&refer, &new_name, root, n);
if (err < 0) {
SNDERR("Unable to load refered block in PCM %s: %s", name, snd_strerror(err));
return err;
}
err = snd_pcm_open_noupdate(pcmp, refer, new_name, stream, mode);
if (refer != root)
snd_config_delete(refer);
return err;
}
err = snd_pcm_open_conf(pcmp, name, root, pcm_conf, stream, mode);
snd_config_delete(pcm_conf);
return err;

View file

@ -541,6 +541,7 @@ int snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sfor
return 0;
}
SND_DLSYM_BUILD_VERSION(_snd_pcm_adpcm_open, SND_PCM_DLSYM_VERSION);
int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)

View file

@ -414,6 +414,7 @@ int snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sform
return 0;
}
SND_DLSYM_BUILD_VERSION(_snd_pcm_alaw_open, SND_PCM_DLSYM_VERSION);
int _snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)

View file

@ -184,6 +184,7 @@ int snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name, snd_pcm_t *slave, int
return 0;
}
SND_DLSYM_BUILD_VERSION(_snd_pcm_copy_open, SND_PCM_DLSYM_VERSION);
int _snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)

View file

@ -449,6 +449,7 @@ int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name, const char *fname, int
return 0;
}
SND_DLSYM_BUILD_VERSION(_snd_pcm_file_open, SND_PCM_DLSYM_VERSION);
int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)

View file

@ -394,8 +394,6 @@ static int snd_pcm_hook_add_conf(snd_pcm_t *pcm, snd_config_t *root, snd_config_
install = buf;
snprintf(buf, sizeof(buf), "_snd_pcm_hook_%s_install", str);
}
if (!lib)
lib = ALSA_LIB;
h = dlopen(lib, RTLD_NOW);
install_func = h ? dlsym(h, install) : NULL;
err = 0;
@ -425,6 +423,7 @@ static int snd_pcm_hook_add_conf(snd_pcm_t *pcm, snd_config_t *root, snd_config_
return 0;
}
SND_DLSYM_BUILD_VERSION(_snd_pcm_hooks_open, SND_PCM_DLSYM_VERSION);
int _snd_pcm_hooks_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)

View file

@ -640,6 +640,7 @@ int snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name, int card, int device, in
return ret;
}
SND_DLSYM_BUILD_VERSION(_snd_pcm_hw_open, SND_PCM_DLSYM_VERSION);
int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)

View file

@ -319,6 +319,7 @@ int snd_pcm_linear_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sfo
return 0;
}
SND_DLSYM_BUILD_VERSION(_snd_pcm_linear_open, SND_PCM_DLSYM_VERSION);
int _snd_pcm_linear_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)

View file

@ -704,8 +704,6 @@ static int snd_pcm_meter_add_scope_conf(snd_pcm_t *pcm, const char *name,
open_name = buf;
snprintf(buf, sizeof(buf), "_snd_pcm_scope_%s_open", str);
}
if (!lib)
lib = ALSA_LIB;
h = dlopen(lib, RTLD_NOW);
open_func = h ? dlsym(h, open_name) : NULL;
err = 0;
@ -724,6 +722,7 @@ static int snd_pcm_meter_add_scope_conf(snd_pcm_t *pcm, const char *name,
}
SND_DLSYM_BUILD_VERSION(_snd_pcm_meter_open, SND_PCM_DLSYM_VERSION);
int _snd_pcm_meter_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)

View file

@ -429,6 +429,7 @@ int snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sfor
return 0;
}
SND_DLSYM_BUILD_VERSION(_snd_pcm_mulaw_open, SND_PCM_DLSYM_VERSION);
int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)

View file

@ -643,6 +643,7 @@ int snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
return 0;
}
SND_DLSYM_BUILD_VERSION(_snd_pcm_multi_open, SND_PCM_DLSYM_VERSION);
int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)

View file

@ -358,6 +358,7 @@ int snd_pcm_null_open(snd_pcm_t **pcmp, const char *name, snd_pcm_stream_t strea
return 0;
}
SND_DLSYM_BUILD_VERSION(_snd_pcm_null_open, SND_PCM_DLSYM_VERSION);
int _snd_pcm_null_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *conf,
snd_pcm_stream_t stream, int mode)

View file

@ -771,6 +771,7 @@ int snd_pcm_plug_open(snd_pcm_t **pcmp,
#define MAX_CHANNELS 64
SND_DLSYM_BUILD_VERSION(_snd_pcm_plug_open, SND_PCM_DLSYM_VERSION);
int _snd_pcm_plug_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)

View file

@ -528,6 +528,7 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sform
return 0;
}
SND_DLSYM_BUILD_VERSION(_snd_pcm_rate_open, SND_PCM_DLSYM_VERSION);
int _snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)

View file

@ -833,6 +833,7 @@ int snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_entry_t *tt
#define MAX_CHANNELS 32
SND_DLSYM_BUILD_VERSION(_snd_pcm_route_open, SND_PCM_DLSYM_VERSION);
int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)

View file

@ -1359,6 +1359,7 @@ int snd_pcm_share_open(snd_pcm_t **pcmp, const char *name, const char *sname,
return 0;
}
SND_DLSYM_BUILD_VERSION(_snd_pcm_share_open, SND_PCM_DLSYM_VERSION);
int _snd_pcm_share_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)

View file

@ -710,6 +710,7 @@ int is_local(struct hostent *hent)
return i < numreqs;
}
SND_DLSYM_BUILD_VERSION(_snd_pcm_shm_open, SND_PCM_DLSYM_VERSION);
int _snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name,
snd_config_t *root, snd_config_t *conf,
snd_pcm_stream_t stream, int mode)