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

@ -4,6 +4,11 @@
* \{
*/
/** dlsym version for config evaluate callback */
#define SND_CONFIG_DLSYM_VERSION_EVALUATE _dlsym_config_evaluate_001
/** dlsym version for config hook callback */
#define SND_CONFIG_DLSYM_VERSION_HOOK _dlsym_config_hook_001
/** Config node type */
typedef enum _snd_config_type {
/** Integer number */

View file

@ -11,6 +11,9 @@
* \{
*/
/** dlsym version for interface entry callback */
#define SND_CONTROL_DLSYM_VERSION _dlsym_control_001
/** IEC958 structure */
typedef struct sndrv_aes_iec958 snd_aes_iec958_t;

View file

@ -14,6 +14,12 @@
/** \} */
#define __SND_DLSYM_VERSION(name, version) _ ## name ## version
#define SND_DLSYM_BUILD_VERSION(name, version) char __SND_DLSYM_VERSION(name, version)
#define SND_DLSYM_VERSION(version) __STRING(version)
int snd_dlsym_verify(void *handle, const char *name, const char *version);
/** Async notification client handler */
typedef struct _snd_async_handler snd_async_handler_t;

View file

@ -11,6 +11,9 @@
* \{
*/
/** dlsym version for interface entry callback */
#define SND_HWDEP_DLSYM_VERSION _dlsym_hwdep_001
/** HwDep information container */
typedef struct _snd_hwdep_info snd_hwdep_info_t;

View file

@ -24,8 +24,6 @@
#include "config.h"
#define ALSA_LIB "libasound.so"
#define _snd_config_iterator list_head
#define _snd_interval sndrv_interval
#define _snd_pcm_info sndrv_pcm_info

View file

@ -11,6 +11,9 @@
* \{
*/
/** dlsym version for interface entry callback */
#define SND_PCM_DLSYM_VERSION _dlsym_pcm_001
/** PCM generic info container */
typedef struct _snd_pcm_info snd_pcm_info_t;
/** PCM hardware configuration space container */

View file

@ -11,6 +11,9 @@
* \{
*/
/** dlsym version for interface entry callback */
#define SND_RAWMIDI_DLSYM_VERSION _dlsym_rawmidi_001
/** RawMidi information container */
typedef struct _snd_rawmidi_info snd_rawmidi_info_t;
/** RawMidi settings container */

View file

@ -9,6 +9,9 @@ extern "C" {
* \{
*/
/** dlsym version for interface entry callback */
#define SND_SEQ_DLSYM_VERSION _dlsym_seq_001
/** Sequencer handle */
typedef struct _snd_seq snd_seq_t;

View file

@ -11,6 +11,11 @@
* \{
*/
/** dlsym version for interface entry callback */
#define SND_TIMER_DLSYM_VERSION _dlsym_timer_001
/** dlsym version for interface entry callback */
#define SND_TIMER_QUERY_DLSYM_VERSION _dlsym_timer_query_001
/** timer identification structure */
typedef struct _snd_timer_id snd_timer_id_t;
/** timer info structure */

View file

@ -2,7 +2,7 @@ SUBDIRS=control mixer pcm rawmidi timer hwdep seq instr compat conf
COMPATNUM=@LIBTOOL_VERSION_INFO@
lib_LTLIBRARIES = libasound.la
libasound_la_SOURCES = conf.c confmisc.c input.c output.c async.c error.c
libasound_la_SOURCES = conf.c confmisc.c input.c output.c async.c error.c dlmisc.c
libasound_la_LIBADD = control/libcontrol.la mixer/libmixer.la pcm/libpcm.la \
rawmidi/librawmidi.la timer/libtimer.la \
hwdep/libhwdep.la seq/libseq.la instr/libinstr.la \

View file

@ -1801,18 +1801,18 @@ static int snd_config_hooks_call(snd_config_t *root, snd_config_t *config, void
buf[len-1] = '\0';
func_name = buf;
}
if (!lib)
lib = ALSA_LIB;
h = dlopen(lib, RTLD_NOW);
if ((err = snd_dlsym_verify(h, func_name, SND_DLSYM_VERSION(SND_CONFIG_DLSYM_VERSION_HOOK))) < 0)
goto _err;
func = h ? dlsym(h, func_name) : NULL;
err = 0;
if (!h) {
SNDERR("Cannot open shared library %s", lib);
return -ENOENT;
err = -ENOENT;
} else if (!func) {
SNDERR("symbol %s is not defined inside %s", func_name, lib);
dlclose(h);
return -ENXIO;
err = -ENXIO;
}
_err:
if (func_conf)
@ -1877,6 +1877,7 @@ static int snd_config_hooks(snd_config_t *config, void *private_data)
* \param private_data Private data
* \return zero if success, otherwise a negative error code
*/
SND_DLSYM_BUILD_VERSION(snd_config_hook_load, SND_CONFIG_DLSYM_VERSION_HOOK);
int snd_config_hook_load(snd_config_t *root, snd_config_t *config, snd_config_t **dst, void *private_data)
{
snd_config_t *n, *res = NULL;
@ -2011,6 +2012,7 @@ int snd_determine_driver(int card, char **driver);
* \param private_data Private data
* \return zero if success, otherwise a negative error code
*/
SND_DLSYM_BUILD_VERSION(snd_config_hook_load_for_all_cards, SND_CONFIG_DLSYM_VERSION_HOOK);
int snd_config_hook_load_for_all_cards(snd_config_t *root, snd_config_t *config, snd_config_t **dst, void *private_data ATTRIBUTE_UNUSED)
{
int card = -1, err;
@ -2504,10 +2506,12 @@ static int _snd_config_evaluate(snd_config_t *src,
buf[len-1] = '\0';
func_name = buf;
}
if (!lib)
lib = ALSA_LIB;
h = dlopen(lib, RTLD_NOW);
func = h ? dlsym(h, func_name) : NULL;
if (h) {
if ((err = snd_dlsym_verify(h, func_name, SND_DLSYM_VERSION(SND_CONFIG_DLSYM_VERSION_EVALUATE))) < 0)
goto _err;
func = dlsym(h, func_name);
}
err = 0;
if (!h) {
SNDERR("Cannot open shared library %s", lib);

View file

@ -139,96 +139,11 @@ int snd_config_get_ctl_iface(snd_config_t *conf)
return err;
}
/**
* \brief Refer the configuration block to another
* \param dst new configuration block (if *dst != root -> dst needs to be deleted)
* \param name the identifier of new configuration block
* \param root the root of all configurations
* \param config redirect configuration
*/
int snd_config_refer_load(snd_config_t **dst,
char **name,
snd_config_t *root,
snd_config_t *config)
{
int err;
snd_config_t *result, *c;
char *rname;
assert(dst);
assert(name);
assert(root);
assert(config);
if (snd_config_get_type(config) == SND_CONFIG_TYPE_STRING) {
const char *str;
snd_config_get_string(config, &str);
*name = strdup(str);
if (*name == NULL)
return -ENOMEM;
*dst = root;
return 0;
}
if (snd_config_get_type(config) != SND_CONFIG_TYPE_COMPOUND)
return -EINVAL;
result = root;
rname = NULL;
if (snd_config_search(config, "file", &c) >= 0) {
snd_config_t *rconfig;
const char *filename;
snd_input_t *input;
err = snd_config_copy(&rconfig, root);
if (err < 0)
return err;
if (snd_config_get_type(c) == SND_CONFIG_TYPE_STRING) {
snd_config_get_string(c, &filename);
} else {
err = -EINVAL;
__filename_error:
snd_config_delete(rconfig);
return err;
}
err = snd_input_stdio_open(&input, filename, "r");
if (err < 0) {
SNDERR("Unable to open filename %s: %s", filename, snd_strerror(err));
goto __filename_error;
}
err = snd_config_load(rconfig, input);
if (err < 0) {
snd_input_close(input);
goto __filename_error;
}
snd_input_close(input);
result = rconfig;
}
if (snd_config_search(config, "name", &c) >= 0) {
const char *ptr;
if ((err = snd_config_get_string(c, &ptr)) < 0)
goto __error;
rname = strdup(ptr);
if (rname == NULL) {
err = -ENOMEM;
goto __error;
}
}
if (rname == NULL) {
err = -EINVAL;
goto __error;
}
*dst = result;
*name = rname;
return 0;
__error:
if (rname)
free(rname);
if (result != root)
snd_config_delete(result);
return err;
}
/*
* Helper functions for the configuration file
*/
SND_DLSYM_BUILD_VERSION(snd_func_getenv, SND_CONFIG_DLSYM_VERSION_EVALUATE);
int snd_func_getenv(snd_config_t **dst, snd_config_t *root, snd_config_t *src, void *private_data)
{
snd_config_t *n, *d;
@ -307,6 +222,7 @@ int snd_func_getenv(snd_config_t **dst, snd_config_t *root, snd_config_t *src, v
return err;
}
SND_DLSYM_BUILD_VERSION(snd_func_igetenv, SND_CONFIG_DLSYM_VERSION_EVALUATE);
int snd_func_igetenv(snd_config_t **dst, snd_config_t *root, snd_config_t *src, void *private_data)
{
snd_config_t *d;
@ -331,8 +247,8 @@ int snd_func_igetenv(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
_end:
return err;
}
SND_DLSYM_BUILD_VERSION(snd_func_concat, SND_CONFIG_DLSYM_VERSION_EVALUATE);
int snd_func_concat(snd_config_t **dst, snd_config_t *root, snd_config_t *src, void *private_data)
{
snd_config_t *n;
@ -397,6 +313,7 @@ int snd_func_concat(snd_config_t **dst, snd_config_t *root, snd_config_t *src, v
return err;
}
SND_DLSYM_BUILD_VERSION(snd_func_datadir, SND_CONFIG_DLSYM_VERSION_EVALUATE);
int snd_func_datadir(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED,
snd_config_t *src, void *private_data ATTRIBUTE_UNUSED)
{
@ -428,6 +345,7 @@ static int string_from_integer(char **dst, long v)
}
#endif
SND_DLSYM_BUILD_VERSION(snd_func_private_string, SND_CONFIG_DLSYM_VERSION_EVALUATE);
int snd_func_private_string(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *src, void *private_data)
{
int err;
@ -472,6 +390,7 @@ int snd_determine_driver(int card, char **driver)
return err;
}
SND_DLSYM_BUILD_VERSION(snd_func_private_card_strtype, SND_CONFIG_DLSYM_VERSION_EVALUATE);
int snd_func_private_card_strtype(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *src, void *private_data)
{
char *driver;
@ -486,6 +405,7 @@ int snd_func_private_card_strtype(snd_config_t **dst, snd_config_t *root ATTRIBU
return err;
}
SND_DLSYM_BUILD_VERSION(snd_func_card_strtype, SND_CONFIG_DLSYM_VERSION_EVALUATE);
int snd_func_card_strtype(snd_config_t **dst, snd_config_t *root, snd_config_t *src, void *private_data)
{
snd_config_t *n;
@ -518,6 +438,7 @@ int snd_func_card_strtype(snd_config_t **dst, snd_config_t *root, snd_config_t *
return snd_func_private_card_strtype(dst, root, src, (void *)v);
}
SND_DLSYM_BUILD_VERSION(snd_func_card_id, SND_CONFIG_DLSYM_VERSION_EVALUATE);
int snd_func_card_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src, void *private_data)
{
snd_config_t *n;
@ -568,6 +489,7 @@ int snd_func_card_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
return err;
}
SND_DLSYM_BUILD_VERSION(snd_func_pcm_id, SND_CONFIG_DLSYM_VERSION_EVALUATE);
int snd_func_pcm_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src, void *private_data)
{
snd_config_t *n;
@ -640,6 +562,7 @@ int snd_func_pcm_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src, v
return err;
}
SND_DLSYM_BUILD_VERSION(snd_func_private_pcm_subdevice, SND_CONFIG_DLSYM_VERSION_EVALUATE);
int snd_func_private_pcm_subdevice(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *src, void *private_data)
{
char *res = NULL;
@ -664,6 +587,7 @@ int snd_func_private_pcm_subdevice(snd_config_t **dst, snd_config_t *root ATTRIB
return err;
}
SND_DLSYM_BUILD_VERSION(snd_func_refer, SND_CONFIG_DLSYM_VERSION_EVALUATE);
int snd_func_refer(snd_config_t **dst, snd_config_t *root, snd_config_t *src, void *private_data)
{
snd_config_t *n;

View file

@ -502,10 +502,14 @@ static int snd_ctl_open_conf(snd_ctl_t **ctlp, const char *name,
open_name = buf;
snprintf(buf, sizeof(buf), "_snd_ctl_%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_CONTROL_DLSYM_VERSION))) < 0) {
dlclose(h);
goto _err;
}
open_func = dlsym(h, open_name);
}
err = 0;
if (!h) {
SNDERR("Cannot open shared library %s", lib);

View file

@ -318,6 +318,7 @@ int snd_ctl_hw_open(snd_ctl_t **handle, const char *name, int card, int mode)
return 0;
}
SND_DLSYM_BUILD_VERSION(_snd_ctl_hw_open, SND_CONTROL_DLSYM_VERSION);
int _snd_ctl_hw_open(snd_ctl_t **handlep, char *name, snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *conf)
{
snd_config_iterator_t i, next;

View file

@ -525,6 +525,7 @@ int snd_ctl_shm_open(snd_ctl_t **handlep, const char *name, const char *sockname
return result;
}
SND_DLSYM_BUILD_VERSION(_snd_ctl_shm_open, SND_CONTROL_DLSYM_VERSION);
int _snd_ctl_shm_open(snd_ctl_t **handlep, char *name, snd_config_t *root, snd_config_t *conf, int mode)
{
snd_config_iterator_t i, next;

56
src/dlmisc.c Normal file
View file

@ -0,0 +1,56 @@
/**
* \file dlmisc.c
* \brief dynamic loader helpers
* \author Jaroslav Kysela <perex@suse.cz>
* \date 2001
*
* Dynamic loader helpers
*/
/*
* Dynamic loader helpers
* Copyright (c) 2000 by Jaroslav Kysela <perex@suse.cz>
*
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <dlfcn.h>
#include "local.h"
/**
* \brief Verify dynamically loaded symbol
* \param handle dlopen handle
* \param name name of symbol
* \param version version of symbol
* \return zero is success, otherwise a negative error code
*/
int snd_dlsym_verify(void *handle, const char *name, const char *version)
{
int res;
char *vname;
if (handle == NULL)
return -EINVAL;
vname = alloca(1 + strlen(name) + strlen(version) + 1);
vname[0] = '_';
strcpy(vname + 1, name);
strcat(vname, version);
res = dlsym(handle, vname) == NULL ? -ENOENT : 0;
printf("dlsym verify: %i, vname = '%s'\n", res, vname);
if (res < 0)
SNDERR("unable to verify version for symbol %s", name);
return res;
}

View file

@ -102,10 +102,14 @@ static int snd_hwdep_open_conf(snd_hwdep_t **hwdep,
open_name = buf;
snprintf(buf, sizeof(buf), "_snd_hwdep_%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_HWDEP_DLSYM_VERSION))) < 0) {
dlclose(h);
goto _err;
}
open_func = dlsym(h, open_name);
}
if (!h) {
SNDERR("Cannot open shared library %s", lib);
err = -ENOENT;

View file

@ -137,6 +137,7 @@ int snd_hwdep_hw_open(snd_hwdep_t **handle, const char *name, int card, int devi
return 0;
}
SND_DLSYM_BUILD_VERSION(_snd_hwdep_hw_open, SND_HWDEP_DLSYM_VERSION);
int _snd_hwdep_hw_open(snd_hwdep_t **hwdep, char *name,
snd_config_t *root ATTRIBUTE_UNUSED,
snd_config_t *conf, int mode)

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)

View file

@ -128,10 +128,14 @@ static int snd_rawmidi_open_conf(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp
open_name = buf;
snprintf(buf, sizeof(buf), "_snd_rawmidi_%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_RAWMIDI_DLSYM_VERSION))) < 0) {
dlclose(h);
goto _err;
}
open_func = dlsym(h, open_name);
}
if (!h) {
SNDERR("Cannot open shared library %s", lib);
err = -ENOENT;

View file

@ -302,6 +302,7 @@ int snd_rawmidi_hw_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
return -ENOMEM;
}
SND_DLSYM_BUILD_VERSION(_snd_rawmidi_hw_open, SND_RAWMIDI_DLSYM_VERSION);
int _snd_rawmidi_hw_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
char *name, snd_config_t *root ATTRIBUTE_UNUSED,
snd_config_t *conf, int mode)

View file

@ -129,10 +129,14 @@ static int snd_seq_open_conf(snd_seq_t **seqp, const char *name,
open_name = buf;
snprintf(buf, sizeof(buf), "_snd_seq_%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_SEQ_DLSYM_VERSION))) < 0) {
dlclose(h);
goto _err;
}
open_func = dlsym(h, open_name);
}
err = 0;
if (!h) {
SNDERR("Cannot open shared library %s", lib);

View file

@ -503,6 +503,7 @@ int snd_seq_hw_open(snd_seq_t **handle, const char *name, int streams, int mode)
return 0;
}
SND_DLSYM_BUILD_VERSION(_snd_seq_hw_open, SND_SEQ_DLSYM_VERSION);
int _snd_seq_hw_open(snd_seq_t **handlep, char *name,
snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *conf,
int streams, int mode)

View file

@ -101,10 +101,14 @@ static int snd_timer_open_conf(snd_timer_t **timer,
open_name = buf;
snprintf(buf, sizeof(buf), "_snd_timer_%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_TIMER_DLSYM_VERSION))) < 0) {
dlclose(h);
goto _err;
}
open_func = dlsym(h, open_name);
}
if (!h) {
SNDERR("Cannot open shared library %s", lib);
err = -ENOENT;

View file

@ -200,6 +200,7 @@ int snd_timer_hw_open(snd_timer_t **handle, const char *name, int dev_class, int
return 0;
}
SND_DLSYM_BUILD_VERSION(_snd_timer_hw_open, SND_TIMER_DLSYM_VERSION);
int _snd_timer_hw_open(snd_timer_t **timer, char *name,
snd_config_t *root ATTRIBUTE_UNUSED,
snd_config_t *conf, int mode)

View file

@ -100,10 +100,14 @@ static int snd_timer_query_open_conf(snd_timer_query_t **timer,
open_name = buf;
snprintf(buf, sizeof(buf), "_snd_timer_query_%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_TIMER_QUERY_DLSYM_VERSION))) < 0) {
dlclose(h);
goto _err;
}
open_func = dlsym(h, open_name);
}
if (!h) {
SNDERR("Cannot open shared library %s", lib);
err = -ENOENT;

View file

@ -88,6 +88,7 @@ int snd_timer_query_hw_open(snd_timer_query_t **handle, const char *name, int mo
return 0;
}
SND_DLSYM_BUILD_VERSION(_snd_timer_query_hw_open, SND_TIMER_QUERY_DLSYM_VERSION);
int _snd_timer_query_hw_open(snd_timer_query_t **timer, char *name,
snd_config_t *root ATTRIBUTE_UNUSED,
snd_config_t *conf, int mode)