Removed snd_config_refer_load from confmisc.c and pcm.c.
* \{
*/
+/** 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 */
* \{
*/
+/** 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;
/** \} */
+#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;
* \{
*/
+/** 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;
#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
* \{
*/
+/** 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 */
* \{
*/
+/** 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 */
* \{
*/
+/** dlsym version for interface entry callback */
+#define SND_SEQ_DLSYM_VERSION _dlsym_seq_001
+
/** Sequencer handle */
typedef struct _snd_seq snd_seq_t;
* \{
*/
+/** 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 */
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 \
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)
* \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;
* \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;
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);
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;
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;
_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;
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)
{
}
#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;
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;
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;
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;
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;
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;
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;
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);
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;
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;
--- /dev/null
+/**
+ * \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;
+}
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;
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)
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);
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;
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)
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)
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)
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)
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;
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)
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)
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)
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;
}
+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)
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)
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)
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)
#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)
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)
#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)
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)
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)
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;
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)
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);
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)
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;
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)
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;
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)