mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-10-29 05:40:25 -04:00 
			
		
		
		
	Changes for static build.
This commit is contained in:
		
							parent
							
								
									caa8d5372e
								
							
						
					
					
						commit
						27472b56a6
					
				
					 44 changed files with 362 additions and 158 deletions
				
			
		
							
								
								
									
										13
									
								
								INSTALL
									
										
									
									
									
								
							
							
						
						
									
										13
									
								
								INSTALL
									
										
									
									
									
								
							|  | @ -34,4 +34,15 @@ For compilation you can use these commands: | ||||||
| 	make | 	make | ||||||
| 
 | 
 | ||||||
| Note: Some automake packages have missing aclocal program. Use newer version | Note: Some automake packages have missing aclocal program. Use newer version | ||||||
|       in this case. |       in the case. | ||||||
|  | 
 | ||||||
|  | Compilation of static library | ||||||
|  | ----------------------------- | ||||||
|  | 
 | ||||||
|  | If you would like to use the static ALSA library, you need to use these | ||||||
|  | options for the configure script: | ||||||
|  | 
 | ||||||
|  | 	./configure --enable-shared=no --enable-static=yes | ||||||
|  | 
 | ||||||
|  | Unfortunately, due to bug in the libtool script, the shared and static | ||||||
|  | library cannot be built together. | ||||||
|  |  | ||||||
|  | @ -30,6 +30,6 @@ SHOW_INCLUDE_FILES = NO | ||||||
| JAVADOC_AUTOBRIEF = NO | JAVADOC_AUTOBRIEF = NO | ||||||
| INHERIT_DOCS	 = YES | INHERIT_DOCS	 = YES | ||||||
| ENABLED_SECTIONS = "" | ENABLED_SECTIONS = "" | ||||||
| PREDEFINED	 = "DOC_HIDDEN" | PREDEFINED	 = PIC "DOC_HIDDEN" | ||||||
| 
 | 
 | ||||||
| OPTIMIZE_OUTPUT_FOR_C = YES	# doxygen 1.2.6 option | OPTIMIZE_OUTPUT_FOR_C = YES	# doxygen 1.2.6 option | ||||||
|  |  | ||||||
|  | @ -38,14 +38,45 @@ | ||||||
| #define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) /**< don't print warning when attribute is not used */ | #define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) /**< don't print warning when attribute is not used */ | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| /** helper macro for SND_DLSYM_BUILD_VERSION */ | #ifdef PIC /* dynamic build */ | ||||||
|  | 
 | ||||||
|  | /** helper macro for SND_DLSYM_BUILD_VERSION \hideinitializer */ | ||||||
| #define __SND_DLSYM_VERSION(name, version) _ ## name ## version | #define __SND_DLSYM_VERSION(name, version) _ ## name ## version | ||||||
| /** build version for versioned dynamic symbol */ | /** build version for versioned dynamic symbol \hideinitializer */ | ||||||
| #define SND_DLSYM_BUILD_VERSION(name, version) char __SND_DLSYM_VERSION(name, version) | #define SND_DLSYM_BUILD_VERSION(name, version) char __SND_DLSYM_VERSION(name, version); | ||||||
|  | 
 | ||||||
|  | #else /* static build */ | ||||||
|  | 
 | ||||||
|  | struct snd_dlsym_link { | ||||||
|  | 	struct snd_dlsym_link *next; | ||||||
|  | 	const char *dlsym_name; | ||||||
|  | 	const void *dlsym_ptr; | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | extern struct snd_dlsym_link *snd_dlsym_start; | ||||||
|  | 
 | ||||||
|  | /** helper macro for SND_DLSYM_BUILD_VERSION \hideinitializer */ | ||||||
|  | #define __SND_DLSYM_VERSION(prefix, name, version) _ ## prefix ## name ## version | ||||||
|  | /** build version for versioned dynamic symbol \hideinitializer */ | ||||||
|  | #define SND_DLSYM_BUILD_VERSION(name, version) \ | ||||||
|  |   static struct snd_dlsym_link __SND_DLSYM_VERSION(snd_dlsym_, name, version); \ | ||||||
|  |   void __SND_DLSYM_VERSION(snd_dlsym_constructor_, name, version) (void) __attribute__ ((constructor)); \ | ||||||
|  |   void __SND_DLSYM_VERSION(snd_dlsym_constructor_, name, version) (void) { \ | ||||||
|  |     __SND_DLSYM_VERSION(snd_dlsym_, name, version).next = snd_dlsym_start; \ | ||||||
|  |     __SND_DLSYM_VERSION(snd_dlsym_, name, version).dlsym_name = # name; \ | ||||||
|  |     __SND_DLSYM_VERSION(snd_dlsym_, name, version).dlsym_ptr = (void *)&name; \ | ||||||
|  |     snd_dlsym_start = &__SND_DLSYM_VERSION(snd_dlsym_, name, version); \ | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| /** get version of dynamic symbol as string */ | /** get version of dynamic symbol as string */ | ||||||
| #define SND_DLSYM_VERSION(version) __STRING(version) | #define SND_DLSYM_VERSION(version) __STRING(version) | ||||||
| 
 | 
 | ||||||
| int snd_dlsym_verify(void *handle, const char *name, const char *version); | void *snd_dlopen(const char *file, int mode); | ||||||
|  | void *snd_dlsym(void *handle, const char *name, const char *version); | ||||||
|  | int snd_dlclose(void *handle); | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| /** Async notification client handler */ | /** Async notification client handler */ | ||||||
| typedef struct _snd_async_handler snd_async_handler_t; | typedef struct _snd_async_handler snd_async_handler_t; | ||||||
|  |  | ||||||
							
								
								
									
										37
									
								
								src/conf.c
									
										
									
									
									
								
							
							
						
						
									
										37
									
								
								src/conf.c
									
										
									
									
									
								
							|  | @ -31,8 +31,8 @@ | ||||||
| 
 | 
 | ||||||
| #include <stdarg.h> | #include <stdarg.h> | ||||||
| #include <wordexp.h> | #include <wordexp.h> | ||||||
| #include <sys/stat.h> |  | ||||||
| #include <dlfcn.h> | #include <dlfcn.h> | ||||||
|  | #include <sys/stat.h> | ||||||
| #include "local.h" | #include "local.h" | ||||||
| 
 | 
 | ||||||
| #ifndef DOC_HIDDEN | #ifndef DOC_HIDDEN | ||||||
|  | @ -1801,17 +1801,15 @@ static int snd_config_hooks_call(snd_config_t *root, snd_config_t *config, void | ||||||
| 		buf[len-1] = '\0'; | 		buf[len-1] = '\0'; | ||||||
| 		func_name = buf; | 		func_name = buf; | ||||||
| 	} | 	} | ||||||
| 	h = dlopen(lib, RTLD_NOW); | 	h = snd_dlopen(lib, RTLD_NOW); | ||||||
| 	if ((err = snd_dlsym_verify(h, func_name, SND_DLSYM_VERSION(SND_CONFIG_DLSYM_VERSION_HOOK))) < 0) | 	func = h ? snd_dlsym(h, func_name, SND_DLSYM_VERSION(SND_CONFIG_DLSYM_VERSION_HOOK)) : NULL; | ||||||
| 		goto _err; |  | ||||||
| 	func = h ? dlsym(h, func_name) : NULL; |  | ||||||
| 	err = 0; | 	err = 0; | ||||||
| 	if (!h) { | 	if (!h) { | ||||||
| 		SNDERR("Cannot open shared library %s", lib); | 		SNDERR("Cannot open shared library %s", lib); | ||||||
| 		err = -ENOENT; | 		err = -ENOENT; | ||||||
| 	} else if (!func) { | 	} else if (!func) { | ||||||
| 		SNDERR("symbol %s is not defined inside %s", func_name, lib); | 		SNDERR("symbol %s is not defined inside %s", func_name, lib); | ||||||
| 		dlclose(h); | 		snd_dlclose(h); | ||||||
| 		err = -ENXIO; | 		err = -ENXIO; | ||||||
| 	} | 	} | ||||||
| 	_err: | 	_err: | ||||||
|  | @ -1822,7 +1820,7 @@ static int snd_config_hooks_call(snd_config_t *root, snd_config_t *config, void | ||||||
| 		err = func(root, config, &nroot, private_data); | 		err = func(root, config, &nroot, private_data); | ||||||
| 		if (err < 0) | 		if (err < 0) | ||||||
| 			SNDERR("function %s returned error: %s", func_name, snd_strerror(err)); | 			SNDERR("function %s returned error: %s", func_name, snd_strerror(err)); | ||||||
| 		dlclose(h); | 		snd_dlclose(h); | ||||||
| 		if (err >= 0 && nroot) | 		if (err >= 0 && nroot) | ||||||
| 			snd_config_substitute(root, nroot); | 			snd_config_substitute(root, nroot); | ||||||
| 	} | 	} | ||||||
|  | @ -1869,9 +1867,6 @@ static int snd_config_hooks(snd_config_t *config, void *private_data) | ||||||
| 	return err; | 	return err; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #ifndef DOC_HIDDEN |  | ||||||
| SND_DLSYM_BUILD_VERSION(snd_config_hook_load, SND_CONFIG_DLSYM_VERSION_HOOK); |  | ||||||
| #endif |  | ||||||
| /**
 | /**
 | ||||||
|  * \brief Load configuration from specified files |  * \brief Load configuration from specified files | ||||||
|  * \param root Configuration root node |  * \param root Configuration root node | ||||||
|  | @ -2001,14 +1996,14 @@ int snd_config_hook_load(snd_config_t *root, snd_config_t *config, snd_config_t | ||||||
| 	snd_config_delete(n); | 	snd_config_delete(n); | ||||||
| 	return err; | 	return err; | ||||||
| } | } | ||||||
|  | #ifndef DOC_HIDDEN | ||||||
|  | SND_DLSYM_BUILD_VERSION(snd_config_hook_load, SND_CONFIG_DLSYM_VERSION_HOOK); | ||||||
|  | #endif | ||||||
| 
 | 
 | ||||||
| #ifndef DOC_HIDDEN | #ifndef DOC_HIDDEN | ||||||
| int snd_determine_driver(int card, char **driver); | int snd_determine_driver(int card, char **driver); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| #ifndef DOC_HIDDEN |  | ||||||
| SND_DLSYM_BUILD_VERSION(snd_config_hook_load_for_all_cards, SND_CONFIG_DLSYM_VERSION_HOOK); |  | ||||||
| #endif |  | ||||||
| /**
 | /**
 | ||||||
|  * \brief Load configuration for all present cards |  * \brief Load configuration for all present cards | ||||||
|  * \param root Configuration root node |  * \param root Configuration root node | ||||||
|  | @ -2056,6 +2051,9 @@ int snd_config_hook_load_for_all_cards(snd_config_t *root, snd_config_t *config, | ||||||
| 	*dst = NULL; | 	*dst = NULL; | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  | #ifndef DOC_HIDDEN | ||||||
|  | SND_DLSYM_BUILD_VERSION(snd_config_hook_load_for_all_cards, SND_CONFIG_DLSYM_VERSION_HOOK); | ||||||
|  | #endif | ||||||
| 
 | 
 | ||||||
| /** 
 | /** 
 | ||||||
|  * \brief Update #snd_config rereading (if needed) files specified in |  * \brief Update #snd_config rereading (if needed) files specified in | ||||||
|  | @ -2510,19 +2508,16 @@ static int _snd_config_evaluate(snd_config_t *src, | ||||||
| 			buf[len-1] = '\0'; | 			buf[len-1] = '\0'; | ||||||
| 			func_name = buf; | 			func_name = buf; | ||||||
| 		} | 		} | ||||||
| 		h = dlopen(lib, RTLD_NOW); | 		h = snd_dlopen(lib, RTLD_NOW); | ||||||
| 		if (h) { | 		if (h) | ||||||
| 			if ((err = snd_dlsym_verify(h, func_name, SND_DLSYM_VERSION(SND_CONFIG_DLSYM_VERSION_EVALUATE))) < 0) | 			func = snd_dlsym(h, func_name, SND_DLSYM_VERSION(SND_CONFIG_DLSYM_VERSION_EVALUATE)); | ||||||
| 				goto _err; |  | ||||||
| 			func = dlsym(h, func_name); |  | ||||||
| 		} |  | ||||||
| 		err = 0; | 		err = 0; | ||||||
| 		if (!h) { | 		if (!h) { | ||||||
| 			SNDERR("Cannot open shared library %s", lib); | 			SNDERR("Cannot open shared library %s", lib); | ||||||
| 			return -ENOENT; | 			return -ENOENT; | ||||||
| 		} else if (!func) { | 		} else if (!func) { | ||||||
| 			SNDERR("symbol %s is not defined inside %s", func_name, lib); | 			SNDERR("symbol %s is not defined inside %s", func_name, lib); | ||||||
| 			dlclose(h); | 			snd_dlclose(h); | ||||||
| 			return -ENXIO; | 			return -ENXIO; | ||||||
| 		} | 		} | ||||||
| 	       _err: | 	       _err: | ||||||
|  | @ -2533,7 +2528,7 @@ static int _snd_config_evaluate(snd_config_t *src, | ||||||
| 			err = func(&eval, root, src, private_data); | 			err = func(&eval, root, src, private_data); | ||||||
| 			if (err < 0) | 			if (err < 0) | ||||||
| 				SNDERR("function %s returned error: %s", func_name, snd_strerror(err)); | 				SNDERR("function %s returned error: %s", func_name, snd_strerror(err)); | ||||||
| 			dlclose(h); | 			snd_dlclose(h); | ||||||
| 			if (err >= 0 && eval) | 			if (err >= 0 && eval) | ||||||
| 				snd_config_substitute(src, eval); | 				snd_config_substitute(src, eval); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|  | @ -142,7 +142,6 @@ int snd_config_get_ctl_iface(snd_config_t *conf) | ||||||
|  *  Helper functions for the configuration file |  *  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) | int snd_func_getenv(snd_config_t **dst, snd_config_t *root, snd_config_t *src, void *private_data) | ||||||
| { | { | ||||||
| 	snd_config_t *n, *d; | 	snd_config_t *n, *d; | ||||||
|  | @ -220,8 +219,8 @@ int snd_func_getenv(snd_config_t **dst, snd_config_t *root, snd_config_t *src, v | ||||||
|       		free(def); |       		free(def); | ||||||
| 	return err; | 	return err; | ||||||
| } | } | ||||||
|  | SND_DLSYM_BUILD_VERSION(snd_func_getenv, SND_CONFIG_DLSYM_VERSION_EVALUATE); | ||||||
| 
 | 
 | ||||||
| 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) | int snd_func_igetenv(snd_config_t **dst, snd_config_t *root, snd_config_t *src, void *private_data) | ||||||
| { | { | ||||||
| 	snd_config_t *d; | 	snd_config_t *d; | ||||||
|  | @ -246,8 +245,8 @@ int snd_func_igetenv(snd_config_t **dst, snd_config_t *root, snd_config_t *src, | ||||||
|  _end: |  _end: | ||||||
| 	return err; | 	return err; | ||||||
| } | } | ||||||
|  | SND_DLSYM_BUILD_VERSION(snd_func_igetenv, SND_CONFIG_DLSYM_VERSION_EVALUATE); | ||||||
| 		 | 		 | ||||||
| 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) | int snd_func_concat(snd_config_t **dst, snd_config_t *root, snd_config_t *src, void *private_data) | ||||||
| { | { | ||||||
| 	snd_config_t *n; | 	snd_config_t *n; | ||||||
|  | @ -311,8 +310,8 @@ int snd_func_concat(snd_config_t **dst, snd_config_t *root, snd_config_t *src, v | ||||||
|       __error: |       __error: | ||||||
| 	return err; | 	return err; | ||||||
| } | } | ||||||
|  | SND_DLSYM_BUILD_VERSION(snd_func_concat, SND_CONFIG_DLSYM_VERSION_EVALUATE); | ||||||
| 
 | 
 | ||||||
| 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, | int snd_func_datadir(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED, | ||||||
| 		     snd_config_t *src, void *private_data ATTRIBUTE_UNUSED) | 		     snd_config_t *src, void *private_data ATTRIBUTE_UNUSED) | ||||||
| { | { | ||||||
|  | @ -321,6 +320,7 @@ int snd_func_datadir(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED, | ||||||
| 		err = snd_config_set_string(*dst, DATADIR "/alsa"); | 		err = snd_config_set_string(*dst, DATADIR "/alsa"); | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  | SND_DLSYM_BUILD_VERSION(snd_func_datadir, SND_CONFIG_DLSYM_VERSION_EVALUATE); | ||||||
| 
 | 
 | ||||||
| static int open_ctl(long card, snd_ctl_t **ctl) | static int open_ctl(long card, snd_ctl_t **ctl) | ||||||
| { | { | ||||||
|  | @ -344,7 +344,6 @@ static int string_from_integer(char **dst, long v) | ||||||
| } | } | ||||||
| #endif | #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 snd_func_private_string(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *src, void *private_data) | ||||||
| { | { | ||||||
| 	int err; | 	int err; | ||||||
|  | @ -356,6 +355,7 @@ int snd_func_private_string(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNU | ||||||
| 		err = snd_config_set_string(*dst, (char *)private_data); | 		err = snd_config_set_string(*dst, (char *)private_data); | ||||||
| 	return err; | 	return err; | ||||||
| } | } | ||||||
|  | SND_DLSYM_BUILD_VERSION(snd_func_private_string, SND_CONFIG_DLSYM_VERSION_EVALUATE); | ||||||
| 
 | 
 | ||||||
| int snd_determine_driver(int card, char **driver) | int snd_determine_driver(int card, char **driver) | ||||||
| { | { | ||||||
|  | @ -389,7 +389,6 @@ int snd_determine_driver(int card, char **driver) | ||||||
| 	return 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) | 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; | 	char *driver; | ||||||
|  | @ -403,8 +402,8 @@ int snd_func_private_card_strtype(snd_config_t **dst, snd_config_t *root ATTRIBU | ||||||
| 	free(driver); | 	free(driver); | ||||||
| 	return err; | 	return err; | ||||||
| } | } | ||||||
|  | SND_DLSYM_BUILD_VERSION(snd_func_private_card_strtype, SND_CONFIG_DLSYM_VERSION_EVALUATE); | ||||||
| 
 | 
 | ||||||
| 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) | int snd_func_card_strtype(snd_config_t **dst, snd_config_t *root, snd_config_t *src, void *private_data) | ||||||
| { | { | ||||||
| 	snd_config_t *n; | 	snd_config_t *n; | ||||||
|  | @ -436,8 +435,8 @@ int snd_func_card_strtype(snd_config_t **dst, snd_config_t *root, snd_config_t * | ||||||
| 	free(str); | 	free(str); | ||||||
| 	return snd_func_private_card_strtype(dst, root, src, (void *)v); | 	return snd_func_private_card_strtype(dst, root, src, (void *)v); | ||||||
| } | } | ||||||
|  | SND_DLSYM_BUILD_VERSION(snd_func_card_strtype, SND_CONFIG_DLSYM_VERSION_EVALUATE); | ||||||
| 
 | 
 | ||||||
| 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) | int snd_func_card_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src, void *private_data) | ||||||
| { | { | ||||||
| 	snd_config_t *n; | 	snd_config_t *n; | ||||||
|  | @ -487,8 +486,8 @@ int snd_func_card_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src, | ||||||
|       		snd_ctl_close(ctl); |       		snd_ctl_close(ctl); | ||||||
| 	return err; | 	return err; | ||||||
| } | } | ||||||
|  | SND_DLSYM_BUILD_VERSION(snd_func_card_id, SND_CONFIG_DLSYM_VERSION_EVALUATE); | ||||||
| 
 | 
 | ||||||
| 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) | int snd_func_pcm_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src, void *private_data) | ||||||
| { | { | ||||||
| 	snd_config_t *n; | 	snd_config_t *n; | ||||||
|  | @ -560,8 +559,8 @@ int snd_func_pcm_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src, v | ||||||
|       		snd_ctl_close(ctl); |       		snd_ctl_close(ctl); | ||||||
| 	return err; | 	return err; | ||||||
| } | } | ||||||
|  | SND_DLSYM_BUILD_VERSION(snd_func_pcm_id, SND_CONFIG_DLSYM_VERSION_EVALUATE); | ||||||
| 
 | 
 | ||||||
| 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) | 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; | 	char *res = NULL; | ||||||
|  | @ -585,8 +584,8 @@ int snd_func_private_pcm_subdevice(snd_config_t **dst, snd_config_t *root ATTRIB | ||||||
| 	free(res); | 	free(res); | ||||||
| 	return err; | 	return err; | ||||||
| } | } | ||||||
|  | SND_DLSYM_BUILD_VERSION(snd_func_private_pcm_subdevice, SND_CONFIG_DLSYM_VERSION_EVALUATE); | ||||||
| 
 | 
 | ||||||
| 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) | int snd_func_refer(snd_config_t **dst, snd_config_t *root, snd_config_t *src, void *private_data) | ||||||
| { | { | ||||||
| 	snd_config_t *n; | 	snd_config_t *n; | ||||||
|  | @ -645,3 +644,4 @@ int snd_func_refer(snd_config_t **dst, snd_config_t *root, snd_config_t *src, vo | ||||||
|  _end: |  _end: | ||||||
| 	return err; | 	return err; | ||||||
| } | } | ||||||
|  | SND_DLSYM_BUILD_VERSION(snd_func_refer, SND_CONFIG_DLSYM_VERSION_EVALUATE); | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ EXTRA_LTLIBRARIES = libcontrol.la | ||||||
| 
 | 
 | ||||||
| libcontrol_la_SOURCES = cards.c hcontrol.c \ | libcontrol_la_SOURCES = cards.c hcontrol.c \ | ||||||
|                         control.c control_hw.c control_shm.c \ |                         control.c control_hw.c control_shm.c \ | ||||||
| 			setup.c | 			setup.c control_symbols.c | ||||||
| 
 | 
 | ||||||
| noinst_HEADERS = control_local.h | noinst_HEADERS = control_local.h | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -33,8 +33,8 @@ | ||||||
| #include <unistd.h> | #include <unistd.h> | ||||||
| #include <string.h> | #include <string.h> | ||||||
| #include <fcntl.h> | #include <fcntl.h> | ||||||
| #include <dlfcn.h> |  | ||||||
| #include <signal.h> | #include <signal.h> | ||||||
|  | #include <dlfcn.h> | ||||||
| #include <sys/poll.h> | #include <sys/poll.h> | ||||||
| #include "control_local.h" | #include "control_local.h" | ||||||
| 
 | 
 | ||||||
|  | @ -475,6 +475,9 @@ static int snd_ctl_open_conf(snd_ctl_t **ctlp, const char *name, | ||||||
| 	snd_config_iterator_t i, next; | 	snd_config_iterator_t i, next; | ||||||
| 	const char *lib = NULL, *open_name = NULL; | 	const char *lib = NULL, *open_name = NULL; | ||||||
| 	int (*open_func)(snd_ctl_t **, const char *, snd_config_t *, snd_config_t *, int) = NULL; | 	int (*open_func)(snd_ctl_t **, const char *, snd_config_t *, snd_config_t *, int) = NULL; | ||||||
|  | #ifndef PIC | ||||||
|  | 	extern void *snd_control_open_symbols(void); | ||||||
|  | #endif | ||||||
| 	void *h; | 	void *h; | ||||||
| 	if (snd_config_get_type(ctl_conf) != SND_CONFIG_TYPE_COMPOUND) { | 	if (snd_config_get_type(ctl_conf) != SND_CONFIG_TYPE_COMPOUND) { | ||||||
| 		if (name) | 		if (name) | ||||||
|  | @ -529,21 +532,19 @@ static int snd_ctl_open_conf(snd_ctl_t **ctlp, const char *name, | ||||||
| 		open_name = buf; | 		open_name = buf; | ||||||
| 		snprintf(buf, sizeof(buf), "_snd_ctl_%s_open", str); | 		snprintf(buf, sizeof(buf), "_snd_ctl_%s_open", str); | ||||||
| 	} | 	} | ||||||
| 	h = dlopen(lib, RTLD_NOW); | #ifndef PIC | ||||||
| 	if (h) { | 	snd_control_open_symbols(); | ||||||
| 		if ((err = snd_dlsym_verify(h, open_name, SND_DLSYM_VERSION(SND_CONTROL_DLSYM_VERSION))) < 0) { | #endif | ||||||
| 			dlclose(h); | 	h = snd_dlopen(lib, RTLD_NOW); | ||||||
| 			goto _err; | 	if (h) | ||||||
| 		} | 		open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_CONTROL_DLSYM_VERSION)); | ||||||
| 		open_func = dlsym(h, open_name); |  | ||||||
| 	} |  | ||||||
| 	err = 0; | 	err = 0; | ||||||
| 	if (!h) { | 	if (!h) { | ||||||
| 		SNDERR("Cannot open shared library %s", lib); | 		SNDERR("Cannot open shared library %s", lib); | ||||||
| 		err = -ENOENT; | 		err = -ENOENT; | ||||||
| 	} if (!open_func) { | 	} if (!open_func) { | ||||||
| 		SNDERR("symbol %s is not defined inside %s", open_name, lib); | 		SNDERR("symbol %s is not defined inside %s", open_name, lib); | ||||||
| 		dlclose(h); | 		snd_dlclose(h); | ||||||
| 		err = -ENXIO; | 		err = -ENXIO; | ||||||
| 	} | 	} | ||||||
|        _err: |        _err: | ||||||
|  |  | ||||||
|  | @ -29,6 +29,11 @@ | ||||||
| #include <sys/ioctl.h> | #include <sys/ioctl.h> | ||||||
| #include "control_local.h" | #include "control_local.h" | ||||||
| 
 | 
 | ||||||
|  | #ifndef PIC | ||||||
|  | /* entry for static linking */ | ||||||
|  | const char *_snd_module_control_hw = ""; | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| #ifndef F_SETSIG | #ifndef F_SETSIG | ||||||
| #define F_SETSIG 10 | #define F_SETSIG 10 | ||||||
| #endif | #endif | ||||||
|  | @ -336,7 +341,6 @@ int snd_ctl_hw_open(snd_ctl_t **handle, const char *name, int card, int mode) | ||||||
| 	return 0; | 	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) | 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; | 	snd_config_iterator_t i, next; | ||||||
|  | @ -368,4 +372,4 @@ int _snd_ctl_hw_open(snd_ctl_t **handlep, char *name, snd_config_t *root ATTRIBU | ||||||
| 		return -EINVAL; | 		return -EINVAL; | ||||||
| 	return snd_ctl_hw_open(handlep, name, card, 0); | 	return snd_ctl_hw_open(handlep, name, card, 0); | ||||||
| } | } | ||||||
| 				 | SND_DLSYM_BUILD_VERSION(_snd_ctl_hw_open, SND_CONTROL_DLSYM_VERSION); | ||||||
|  |  | ||||||
|  | @ -35,6 +35,11 @@ | ||||||
| #include <netdb.h> | #include <netdb.h> | ||||||
| #include "aserver.h" | #include "aserver.h" | ||||||
| 
 | 
 | ||||||
|  | #ifndef PIC | ||||||
|  | /* entry for static linking */ | ||||||
|  | const char *_snd_module_control_shm = ""; | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| typedef struct { | typedef struct { | ||||||
| 	int socket; | 	int socket; | ||||||
| 	volatile snd_ctl_shm_ctrl_t *ctrl; | 	volatile snd_ctl_shm_ctrl_t *ctrl; | ||||||
|  | @ -553,7 +558,6 @@ int snd_ctl_shm_open(snd_ctl_t **handlep, const char *name, const char *sockname | ||||||
| 	return result; | 	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) | 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; | 	snd_config_iterator_t i, next; | ||||||
|  | @ -668,3 +672,4 @@ int _snd_ctl_shm_open(snd_ctl_t **handlep, char *name, snd_config_t *root, snd_c | ||||||
| 	snd_config_delete(sconfig); | 	snd_config_delete(sconfig); | ||||||
| 	return err; | 	return err; | ||||||
| } | } | ||||||
|  | SND_DLSYM_BUILD_VERSION(_snd_ctl_shm_open, SND_CONTROL_DLSYM_VERSION); | ||||||
|  |  | ||||||
							
								
								
									
										65
									
								
								src/dlmisc.c
									
										
									
									
									
								
							
							
						
						
									
										65
									
								
								src/dlmisc.c
									
										
									
									
									
								
							|  | @ -30,6 +30,41 @@ | ||||||
| #include <dlfcn.h> | #include <dlfcn.h> | ||||||
| #include "local.h" | #include "local.h" | ||||||
| 
 | 
 | ||||||
|  | #ifndef DOC_HIDDEN | ||||||
|  | #ifndef PIC | ||||||
|  | struct snd_dlsym_link *snd_dlsym_start = NULL; | ||||||
|  | #endif | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * \brief Open the dynamic library, with ALSA extension | ||||||
|  |  * \param name name, similar to dlopen | ||||||
|  |  * \param mode mode, similar to dlopen | ||||||
|  |  * \return pointer to handle | ||||||
|  |  */ | ||||||
|  | void *snd_dlopen(const char *name, int mode) | ||||||
|  | { | ||||||
|  | #ifndef PIC | ||||||
|  | 	if (name == NULL) | ||||||
|  | 		return &snd_dlsym_start; | ||||||
|  | #endif | ||||||
|  | 	return dlopen(name, mode); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * \brief Close the dynamic library, with ALSA extension | ||||||
|  |  * \param handle handle, similar to dlclose | ||||||
|  |  * \return zero if success, otherwise an error code | ||||||
|  |  */ | ||||||
|  | int snd_dlclose(void *handle) | ||||||
|  | { | ||||||
|  | #ifndef PIC | ||||||
|  | 	if (handle == &snd_dlsym_start) | ||||||
|  | 		return 0; | ||||||
|  | #endif | ||||||
|  | 	return dlclose(handle); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| /**
 | /**
 | ||||||
|  * \brief Verify dynamically loaded symbol |  * \brief Verify dynamically loaded symbol | ||||||
|  * \param handle dlopen handle |  * \param handle dlopen handle | ||||||
|  | @ -37,7 +72,7 @@ | ||||||
|  * \param version version of symbol |  * \param version version of symbol | ||||||
|  * \return zero is success, otherwise a negative error code |  * \return zero is success, otherwise a negative error code | ||||||
|  */ |  */ | ||||||
| int snd_dlsym_verify(void *handle, const char *name, const char *version) | static int snd_dlsym_verify(void *handle, const char *name, const char *version) | ||||||
| { | { | ||||||
| 	int res; | 	int res; | ||||||
| 	char *vname; | 	char *vname; | ||||||
|  | @ -54,3 +89,31 @@ int snd_dlsym_verify(void *handle, const char *name, const char *version) | ||||||
| 		SNDERR("unable to verify version for symbol %s", name); | 		SNDERR("unable to verify version for symbol %s", name); | ||||||
| 	return res; | 	return res; | ||||||
| } | } | ||||||
|  | /**
 | ||||||
|  |  * \brief Resolve the symbol, with ALSA extension | ||||||
|  |  * \param handle handle, similar to dlsym | ||||||
|  |  * \param name symbol name | ||||||
|  |  * \param version symbol version | ||||||
|  |  */ | ||||||
|  | void *snd_dlsym(void *handle, const char *name, const char *version) | ||||||
|  | { | ||||||
|  | 	int err; | ||||||
|  | 
 | ||||||
|  | #ifndef PIC | ||||||
|  | 	if (handle == &snd_dlsym_start) { | ||||||
|  | 		/* it's the funny part, we are looking for a symbol */ | ||||||
|  | 		/* in a static library */ | ||||||
|  | 		struct snd_dlsym_link *link = snd_dlsym_start; | ||||||
|  | 		while (link) { | ||||||
|  | 			if (!strcmp(name, link->dlsym_name)) | ||||||
|  | 				return (void *)link->dlsym_ptr; | ||||||
|  | 			link = link->next; | ||||||
|  | 		} | ||||||
|  | 		return NULL; | ||||||
|  | 	} | ||||||
|  | #endif | ||||||
|  | 	err = snd_dlsym_verify(handle, name, version); | ||||||
|  | 	if (err < 0) | ||||||
|  | 		return NULL; | ||||||
|  | 	return dlsym(handle, name); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | @ -1,6 +1,6 @@ | ||||||
| EXTRA_LTLIBRARIES=libhwdep.la | EXTRA_LTLIBRARIES=libhwdep.la | ||||||
| 
 | 
 | ||||||
| libhwdep_la_SOURCES = hwdep.c hwdep_hw.c | libhwdep_la_SOURCES = hwdep.c hwdep_hw.c hwdep_symbols.c | ||||||
| noinst_HEADERS = hwdep_local.h | noinst_HEADERS = hwdep_local.h | ||||||
| all: libhwdep.la | all: libhwdep.la | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -48,6 +48,9 @@ static int snd_hwdep_open_conf(snd_hwdep_t **hwdep, | ||||||
| 	snd_config_iterator_t i, next; | 	snd_config_iterator_t i, next; | ||||||
| 	const char *lib = NULL, *open_name = NULL; | 	const char *lib = NULL, *open_name = NULL; | ||||||
| 	int (*open_func)(snd_hwdep_t **, const char *, snd_config_t *, snd_config_t *, int) = NULL; | 	int (*open_func)(snd_hwdep_t **, const char *, snd_config_t *, snd_config_t *, int) = NULL; | ||||||
|  | #ifndef PIC | ||||||
|  | 	extern void *snd_hwdep_open_symbols(void); | ||||||
|  | #endif | ||||||
| 	void *h; | 	void *h; | ||||||
| 	if (snd_config_get_type(hwdep_conf) != SND_CONFIG_TYPE_COMPOUND) { | 	if (snd_config_get_type(hwdep_conf) != SND_CONFIG_TYPE_COMPOUND) { | ||||||
| 		if (name) | 		if (name) | ||||||
|  | @ -102,20 +105,18 @@ static int snd_hwdep_open_conf(snd_hwdep_t **hwdep, | ||||||
| 		open_name = buf; | 		open_name = buf; | ||||||
| 		snprintf(buf, sizeof(buf), "_snd_hwdep_%s_open", str); | 		snprintf(buf, sizeof(buf), "_snd_hwdep_%s_open", str); | ||||||
| 	} | 	} | ||||||
| 	h = dlopen(lib, RTLD_NOW); | #ifndef PIC | ||||||
| 	if (h) { | 	snd_hwdep_open_symbols(); | ||||||
| 		if ((err = snd_dlsym_verify(h, open_name, SND_DLSYM_VERSION(SND_HWDEP_DLSYM_VERSION))) < 0) { | #endif | ||||||
| 			dlclose(h); | 	h = snd_dlopen(lib, RTLD_NOW); | ||||||
| 			goto _err; | 	if (h) | ||||||
| 		} | 		open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_HWDEP_DLSYM_VERSION)); | ||||||
| 		open_func = dlsym(h, open_name); |  | ||||||
| 	} |  | ||||||
| 	if (!h) { | 	if (!h) { | ||||||
| 		SNDERR("Cannot open shared library %s", lib); | 		SNDERR("Cannot open shared library %s", lib); | ||||||
| 		err = -ENOENT; | 		err = -ENOENT; | ||||||
| 	} else if (!open_func) { | 	} else if (!open_func) { | ||||||
| 		SNDERR("symbol %s is not defined inside %s", open_name, lib); | 		SNDERR("symbol %s is not defined inside %s", open_name, lib); | ||||||
| 		dlclose(h); | 		snd_dlclose(h); | ||||||
| 		err = -ENXIO; | 		err = -ENXIO; | ||||||
| 	} | 	} | ||||||
|        _err: |        _err: | ||||||
|  |  | ||||||
|  | @ -27,6 +27,11 @@ | ||||||
| #include <sys/ioctl.h> | #include <sys/ioctl.h> | ||||||
| #include "hwdep_local.h" | #include "hwdep_local.h" | ||||||
| 
 | 
 | ||||||
|  | #ifndef PIC | ||||||
|  | /* entry for static linking */ | ||||||
|  | const char *_snd_module_hwdep_hw = ""; | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| #define SNDRV_FILE_HWDEP	"/dev/snd/hwC%iD%i" | #define SNDRV_FILE_HWDEP	"/dev/snd/hwC%iD%i" | ||||||
| #define SNDRV_HWDEP_VERSION_MAX	SNDRV_PROTOCOL_VERSION(1, 0, 0) | #define SNDRV_HWDEP_VERSION_MAX	SNDRV_PROTOCOL_VERSION(1, 0, 0) | ||||||
| 
 | 
 | ||||||
|  | @ -137,7 +142,6 @@ int snd_hwdep_hw_open(snd_hwdep_t **handle, const char *name, int card, int devi | ||||||
| 	return 0; | 	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, | int _snd_hwdep_hw_open(snd_hwdep_t **hwdep, char *name, | ||||||
| 		       snd_config_t *root ATTRIBUTE_UNUSED, | 		       snd_config_t *root ATTRIBUTE_UNUSED, | ||||||
| 		       snd_config_t *conf, int mode) | 		       snd_config_t *conf, int mode) | ||||||
|  | @ -178,3 +182,4 @@ int _snd_hwdep_hw_open(snd_hwdep_t **hwdep, char *name, | ||||||
| 		return -EINVAL; | 		return -EINVAL; | ||||||
| 	return snd_hwdep_hw_open(hwdep, name, card, device, mode); | 	return snd_hwdep_hw_open(hwdep, name, card, device, mode); | ||||||
| } | } | ||||||
|  | SND_DLSYM_BUILD_VERSION(_snd_hwdep_hw_open, SND_HWDEP_DLSYM_VERSION); | ||||||
|  |  | ||||||
|  | @ -7,7 +7,7 @@ libpcm_la_SOURCES = atomic.c mask.c interval.c \ | ||||||
| 		    pcm_route.c pcm_mulaw.c pcm_alaw.c pcm_adpcm.c \ | 		    pcm_route.c pcm_mulaw.c pcm_alaw.c pcm_adpcm.c \ | ||||||
| 		    pcm_rate.c pcm_plug.c pcm_misc.c pcm_mmap.c pcm_multi.c \ | 		    pcm_rate.c pcm_plug.c pcm_misc.c pcm_mmap.c pcm_multi.c \ | ||||||
| 	            pcm_shm.c pcm_file.c pcm_null.c pcm_share.c \ | 	            pcm_shm.c pcm_file.c pcm_null.c pcm_share.c \ | ||||||
| 		    pcm_meter.c pcm_hooks.c | 		    pcm_meter.c pcm_hooks.c pcm_symbols.c | ||||||
| noinst_HEADERS = atomic.h pcm_local.h pcm_plugin.h mask.h mask_inline.h \ | noinst_HEADERS = atomic.h pcm_local.h pcm_plugin.h mask.h mask_inline.h \ | ||||||
| 	         interval.h interval_inline.h plugin_ops.h | 	         interval.h interval_inline.h plugin_ops.h | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -38,12 +38,12 @@ | ||||||
| #include <malloc.h> | #include <malloc.h> | ||||||
| #include <stdarg.h> | #include <stdarg.h> | ||||||
| #include <signal.h> | #include <signal.h> | ||||||
|  | #include <dlfcn.h> | ||||||
| #include <sys/ioctl.h> | #include <sys/ioctl.h> | ||||||
| #include <sys/poll.h> | #include <sys/poll.h> | ||||||
| #include <sys/shm.h> | #include <sys/shm.h> | ||||||
| #include <sys/mman.h> | #include <sys/mman.h> | ||||||
| #include <limits.h> | #include <limits.h> | ||||||
| #include <dlfcn.h> |  | ||||||
| #include "pcm_local.h" | #include "pcm_local.h" | ||||||
| 
 | 
 | ||||||
| /**
 | /**
 | ||||||
|  | @ -1027,6 +1027,9 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name, | ||||||
| 	int (*open_func)(snd_pcm_t **, const char *,  | 	int (*open_func)(snd_pcm_t **, const char *,  | ||||||
| 			 snd_config_t *, snd_config_t *,  | 			 snd_config_t *, snd_config_t *,  | ||||||
| 			 snd_pcm_stream_t, int) = NULL; | 			 snd_pcm_stream_t, int) = NULL; | ||||||
|  | #ifndef PIC | ||||||
|  | 	extern void *snd_pcm_open_symbols(void); | ||||||
|  | #endif | ||||||
| 	void *h; | 	void *h; | ||||||
| 	if (snd_config_get_type(pcm_conf) != SND_CONFIG_TYPE_COMPOUND) { | 	if (snd_config_get_type(pcm_conf) != SND_CONFIG_TYPE_COMPOUND) { | ||||||
| 		if (name) | 		if (name) | ||||||
|  | @ -1081,21 +1084,19 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name, | ||||||
| 		open_name = buf; | 		open_name = buf; | ||||||
| 		snprintf(buf, sizeof(buf), "_snd_pcm_%s_open", str); | 		snprintf(buf, sizeof(buf), "_snd_pcm_%s_open", str); | ||||||
| 	} | 	} | ||||||
| 	h = dlopen(lib, RTLD_NOW); | #ifndef PIC | ||||||
| 	if (h) { | 	snd_pcm_open_symbols();	/* this call is for static linking only */ | ||||||
| 		if ((err = snd_dlsym_verify(h, open_name, SND_DLSYM_VERSION(SND_PCM_DLSYM_VERSION))) < 0) { | #endif | ||||||
| 			dlclose(h); | 	h = snd_dlopen(lib, RTLD_NOW); | ||||||
| 			goto _err; | 	if (h) | ||||||
| 		} | 		open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_PCM_DLSYM_VERSION)); | ||||||
| 		open_func = dlsym(h, open_name); |  | ||||||
| 	} |  | ||||||
| 	err = 0; | 	err = 0; | ||||||
| 	if (!h) { | 	if (!h) { | ||||||
| 		SNDERR("Cannot open shared library %s", lib); | 		SNDERR("Cannot open shared library %s", lib); | ||||||
| 		err = -ENOENT; | 		err = -ENOENT; | ||||||
| 	} else if (!open_func) { | 	} else if (!open_func) { | ||||||
| 		SNDERR("symbol %s is not defined inside %s", open_name, lib); | 		SNDERR("symbol %s is not defined inside %s", open_name, lib); | ||||||
| 		dlclose(h); | 		snd_dlclose(h); | ||||||
| 		err = -ENXIO; | 		err = -ENXIO; | ||||||
| 	} | 	} | ||||||
|        _err: |        _err: | ||||||
|  | @ -1139,7 +1140,6 @@ int snd_pcm_open(snd_pcm_t **pcmp, const char *name, | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #ifndef DOC_HIDDEN | #ifndef DOC_HIDDEN | ||||||
| 
 |  | ||||||
| int snd_pcm_new(snd_pcm_t **pcmp, snd_pcm_type_t type, const char *name, | int snd_pcm_new(snd_pcm_t **pcmp, snd_pcm_type_t type, const char *name, | ||||||
| 		snd_pcm_stream_t stream, int mode) | 		snd_pcm_stream_t stream, int mode) | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -51,6 +51,11 @@ IMA compatability project proceedings, Vol 2, Issue 2, May 1992. | ||||||
| #include "pcm_local.h" | #include "pcm_local.h" | ||||||
| #include "pcm_plugin.h" | #include "pcm_plugin.h" | ||||||
| 
 | 
 | ||||||
|  | #ifndef PIC | ||||||
|  | /* entry for static linking */ | ||||||
|  | const char *_snd_module_pcm_adpcm = ""; | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| typedef void (*adpcm_f)(const snd_pcm_channel_area_t *dst_areas, | typedef void (*adpcm_f)(const snd_pcm_channel_area_t *dst_areas, | ||||||
| 			snd_pcm_uframes_t dst_offset, | 			snd_pcm_uframes_t dst_offset, | ||||||
| 			const snd_pcm_channel_area_t *src_areas, | 			const snd_pcm_channel_area_t *src_areas, | ||||||
|  | @ -541,7 +546,6 @@ int snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sfor | ||||||
| 	return 0; | 	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, | int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name, | ||||||
| 			snd_config_t *root, snd_config_t *conf,  | 			snd_config_t *root, snd_config_t *conf,  | ||||||
| 			snd_pcm_stream_t stream, int mode) | 			snd_pcm_stream_t stream, int mode) | ||||||
|  | @ -586,5 +590,4 @@ int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name, | ||||||
| 		snd_pcm_close(spcm); | 		snd_pcm_close(spcm); | ||||||
| 	return err; | 	return err; | ||||||
| } | } | ||||||
| 				 | SND_DLSYM_BUILD_VERSION(_snd_pcm_adpcm_open, SND_PCM_DLSYM_VERSION); | ||||||
| 
 |  | ||||||
|  |  | ||||||
|  | @ -23,6 +23,11 @@ | ||||||
| #include "pcm_local.h" | #include "pcm_local.h" | ||||||
| #include "pcm_plugin.h" | #include "pcm_plugin.h" | ||||||
| 
 | 
 | ||||||
|  | #ifndef PIC | ||||||
|  | /* entry for static linking */ | ||||||
|  | const char *_snd_module_pcm_alaw = ""; | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| typedef void (*alaw_f)(const snd_pcm_channel_area_t *dst_areas, | typedef void (*alaw_f)(const snd_pcm_channel_area_t *dst_areas, | ||||||
| 		       snd_pcm_uframes_t dst_offset, | 		       snd_pcm_uframes_t dst_offset, | ||||||
| 		       const snd_pcm_channel_area_t *src_areas, | 		       const snd_pcm_channel_area_t *src_areas, | ||||||
|  | @ -414,7 +419,6 @@ int snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sform | ||||||
| 	return 0; | 	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, | int _snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name, | ||||||
| 		       snd_config_t *root, snd_config_t *conf,  | 		       snd_config_t *root, snd_config_t *conf,  | ||||||
| 		       snd_pcm_stream_t stream, int mode) | 		       snd_pcm_stream_t stream, int mode) | ||||||
|  | @ -459,5 +463,4 @@ int _snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name, | ||||||
| 		snd_pcm_close(spcm); | 		snd_pcm_close(spcm); | ||||||
| 	return err; | 	return err; | ||||||
| } | } | ||||||
| 				 | SND_DLSYM_BUILD_VERSION(_snd_pcm_alaw_open, SND_PCM_DLSYM_VERSION); | ||||||
| 
 |  | ||||||
|  |  | ||||||
|  | @ -23,6 +23,11 @@ | ||||||
| #include "pcm_local.h" | #include "pcm_local.h" | ||||||
| #include "pcm_plugin.h" | #include "pcm_plugin.h" | ||||||
| 
 | 
 | ||||||
|  | #ifndef PIC | ||||||
|  | /* entry for static linking */ | ||||||
|  | const char *_snd_module_pcm_copy = ""; | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| typedef struct { | typedef struct { | ||||||
| 	/* This field need to be the first */ | 	/* This field need to be the first */ | ||||||
| 	snd_pcm_plugin_t plug; | 	snd_pcm_plugin_t plug; | ||||||
|  | @ -184,7 +189,6 @@ int snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name, snd_pcm_t *slave, int | ||||||
| 	return 0; | 	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, | int _snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name, | ||||||
| 		       snd_config_t *root, snd_config_t *conf,  | 		       snd_config_t *root, snd_config_t *conf,  | ||||||
| 		       snd_pcm_stream_t stream, int mode) | 		       snd_pcm_stream_t stream, int mode) | ||||||
|  | @ -221,4 +225,4 @@ int _snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name, | ||||||
| 		snd_pcm_close(spcm); | 		snd_pcm_close(spcm); | ||||||
| 	return err; | 	return err; | ||||||
| } | } | ||||||
| 
 | SND_DLSYM_BUILD_VERSION(_snd_pcm_copy_open, SND_PCM_DLSYM_VERSION); | ||||||
|  |  | ||||||
|  | @ -23,6 +23,11 @@ | ||||||
| #include "pcm_local.h" | #include "pcm_local.h" | ||||||
| #include "pcm_plugin.h" | #include "pcm_plugin.h" | ||||||
| 
 | 
 | ||||||
|  | #ifndef PIC | ||||||
|  | /* entry for static linking */ | ||||||
|  | const char *_snd_module_pcm_file = ""; | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| typedef enum _snd_pcm_file_format { | typedef enum _snd_pcm_file_format { | ||||||
| 	SND_PCM_FILE_FORMAT_RAW | 	SND_PCM_FILE_FORMAT_RAW | ||||||
| } snd_pcm_file_format_t; | } snd_pcm_file_format_t; | ||||||
|  | @ -456,7 +461,6 @@ int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name, const char *fname, int | ||||||
| 	return 0; | 	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, | int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name, | ||||||
| 		       snd_config_t *root, snd_config_t *conf,  | 		       snd_config_t *root, snd_config_t *conf,  | ||||||
| 		       snd_pcm_stream_t stream, int mode) | 		       snd_pcm_stream_t stream, int mode) | ||||||
|  | @ -520,3 +524,4 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name, | ||||||
| 		snd_pcm_close(spcm); | 		snd_pcm_close(spcm); | ||||||
| 	return err; | 	return err; | ||||||
| } | } | ||||||
|  | SND_DLSYM_BUILD_VERSION(_snd_pcm_file_open, SND_PCM_DLSYM_VERSION); | ||||||
|  |  | ||||||
|  | @ -22,6 +22,11 @@ | ||||||
| #include <dlfcn.h> | #include <dlfcn.h> | ||||||
| #include "pcm_local.h" | #include "pcm_local.h" | ||||||
| 
 | 
 | ||||||
|  | #ifndef PIC | ||||||
|  | /* entry for static linking */ | ||||||
|  | const char *_snd_module_pcm_hooks = ""; | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| #ifndef DOC_HIDDEN | #ifndef DOC_HIDDEN | ||||||
| struct _snd_pcm_hook { | struct _snd_pcm_hook { | ||||||
| 	snd_pcm_t *pcm; | 	snd_pcm_t *pcm; | ||||||
|  | @ -430,7 +435,6 @@ static int snd_pcm_hook_add_conf(snd_pcm_t *pcm, snd_config_t *root, snd_config_ | ||||||
| 	return 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, | int _snd_pcm_hooks_open(snd_pcm_t **pcmp, const char *name, | ||||||
| 			snd_config_t *root, snd_config_t *conf,  | 			snd_config_t *root, snd_config_t *conf,  | ||||||
| 			snd_pcm_stream_t stream, int mode) | 			snd_pcm_stream_t stream, int mode) | ||||||
|  | @ -499,6 +503,7 @@ int _snd_pcm_hooks_open(snd_pcm_t **pcmp, const char *name, | ||||||
| 	*pcmp = rpcm; | 	*pcmp = rpcm; | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  | SND_DLSYM_BUILD_VERSION(_snd_pcm_hooks_open, SND_PCM_DLSYM_VERSION); | ||||||
| 
 | 
 | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -31,6 +31,11 @@ | ||||||
| #include "pcm_local.h" | #include "pcm_local.h" | ||||||
| #include "../control/control_local.h" | #include "../control/control_local.h" | ||||||
| 
 | 
 | ||||||
|  | #ifndef PIC | ||||||
|  | /* entry for static linking */ | ||||||
|  | const char *_snd_module_pcm_hw = ""; | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| #ifndef F_SETSIG | #ifndef F_SETSIG | ||||||
| #define F_SETSIG 10 | #define F_SETSIG 10 | ||||||
| #endif | #endif | ||||||
|  | @ -654,7 +659,6 @@ int snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name, int card, int device, in | ||||||
| 	return ret; | 	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, | int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name, | ||||||
| 		     snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *conf, | 		     snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *conf, | ||||||
| 		     snd_pcm_stream_t stream, int mode) | 		     snd_pcm_stream_t stream, int mode) | ||||||
|  | @ -709,4 +713,4 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name, | ||||||
| 	} | 	} | ||||||
| 	return snd_pcm_hw_open(pcmp, name, card, device, subdevice, stream, mode); | 	return snd_pcm_hw_open(pcmp, name, card, device, subdevice, stream, mode); | ||||||
| } | } | ||||||
| 				 | SND_DLSYM_BUILD_VERSION(_snd_pcm_hw_open, SND_PCM_DLSYM_VERSION); | ||||||
|  |  | ||||||
|  | @ -23,6 +23,11 @@ | ||||||
| #include "pcm_local.h" | #include "pcm_local.h" | ||||||
| #include "pcm_plugin.h" | #include "pcm_plugin.h" | ||||||
| 
 | 
 | ||||||
|  | #ifndef PIC | ||||||
|  | /* entry for static linking */ | ||||||
|  | const char *_snd_module_pcm_linear = ""; | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| typedef struct { | typedef struct { | ||||||
| 	/* This field need to be the first */ | 	/* This field need to be the first */ | ||||||
| 	snd_pcm_plugin_t plug; | 	snd_pcm_plugin_t plug; | ||||||
|  | @ -319,7 +324,6 @@ int snd_pcm_linear_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sfo | ||||||
| 	return 0; | 	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, | int _snd_pcm_linear_open(snd_pcm_t **pcmp, const char *name, | ||||||
| 			 snd_config_t *root, snd_config_t *conf,  | 			 snd_config_t *root, snd_config_t *conf,  | ||||||
| 			 snd_pcm_stream_t stream, int mode) | 			 snd_pcm_stream_t stream, int mode) | ||||||
|  | @ -363,5 +367,4 @@ int _snd_pcm_linear_open(snd_pcm_t **pcmp, const char *name, | ||||||
| 		snd_pcm_close(spcm); | 		snd_pcm_close(spcm); | ||||||
| 	return err; | 	return err; | ||||||
| } | } | ||||||
| 				 | SND_DLSYM_BUILD_VERSION(_snd_pcm_linear_open, SND_PCM_DLSYM_VERSION); | ||||||
| 
 |  | ||||||
|  |  | ||||||
|  | @ -34,6 +34,11 @@ | ||||||
| #include "pcm_local.h" | #include "pcm_local.h" | ||||||
| #include "pcm_plugin.h" | #include "pcm_plugin.h" | ||||||
| 
 | 
 | ||||||
|  | #ifndef PIC | ||||||
|  | /* entry for static linking */ | ||||||
|  | const char *_snd_module_pcm_meter = ""; | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| #if defined(__sparc__) || defined(__ia64__) || defined(__mips__) | #if defined(__sparc__) || defined(__ia64__) || defined(__mips__) | ||||||
| /* asm/atomic.h is unavailable on sparc and ia64 */ | /* asm/atomic.h is unavailable on sparc and ia64 */ | ||||||
| #define atomic_t int | #define atomic_t int | ||||||
|  | @ -728,8 +733,6 @@ static int snd_pcm_meter_add_scope_conf(snd_pcm_t *pcm, const char *name, | ||||||
| 	return err >= 0 ? open_func(pcm, name, root, conf) : err; | 	return err >= 0 ? open_func(pcm, name, root, conf) : err; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 			 |  | ||||||
| SND_DLSYM_BUILD_VERSION(_snd_pcm_meter_open, SND_PCM_DLSYM_VERSION); |  | ||||||
| int _snd_pcm_meter_open(snd_pcm_t **pcmp, const char *name, | int _snd_pcm_meter_open(snd_pcm_t **pcmp, const char *name, | ||||||
| 			snd_config_t *root, snd_config_t *conf,  | 			snd_config_t *root, snd_config_t *conf,  | ||||||
| 			snd_pcm_stream_t stream, int mode) | 			snd_pcm_stream_t stream, int mode) | ||||||
|  | @ -807,6 +810,7 @@ int _snd_pcm_meter_open(snd_pcm_t **pcmp, const char *name, | ||||||
| 	} | 	} | ||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  | SND_DLSYM_BUILD_VERSION(_snd_pcm_meter_open, SND_PCM_DLSYM_VERSION); | ||||||
| 
 | 
 | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -23,6 +23,11 @@ | ||||||
| #include "pcm_local.h" | #include "pcm_local.h" | ||||||
| #include "pcm_plugin.h" | #include "pcm_plugin.h" | ||||||
| 
 | 
 | ||||||
|  | #ifndef PIC | ||||||
|  | /* entry for static linking */ | ||||||
|  | const char *_snd_module_pcm_mulaw = ""; | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| typedef void (*mulaw_f)(const snd_pcm_channel_area_t *src_areas, | typedef void (*mulaw_f)(const snd_pcm_channel_area_t *src_areas, | ||||||
| 			snd_pcm_uframes_t src_offset, | 			snd_pcm_uframes_t src_offset, | ||||||
| 			const snd_pcm_channel_area_t *dst_areas, | 			const snd_pcm_channel_area_t *dst_areas, | ||||||
|  | @ -429,7 +434,6 @@ int snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sfor | ||||||
| 	return 0; | 	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, | int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name, | ||||||
| 			snd_config_t *root, snd_config_t *conf,  | 			snd_config_t *root, snd_config_t *conf,  | ||||||
| 			snd_pcm_stream_t stream, int mode) | 			snd_pcm_stream_t stream, int mode) | ||||||
|  | @ -474,5 +478,4 @@ int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name, | ||||||
| 		snd_pcm_close(spcm); | 		snd_pcm_close(spcm); | ||||||
| 	return err; | 	return err; | ||||||
| } | } | ||||||
| 				 | SND_DLSYM_BUILD_VERSION(_snd_pcm_mulaw_open, SND_PCM_DLSYM_VERSION); | ||||||
| 
 |  | ||||||
|  |  | ||||||
|  | @ -26,6 +26,11 @@ | ||||||
| #include <math.h> | #include <math.h> | ||||||
| #include "pcm_local.h" | #include "pcm_local.h" | ||||||
| 
 | 
 | ||||||
|  | #ifndef PIC | ||||||
|  | /* entry for static linking */ | ||||||
|  | const char *_snd_module_pcm_multi = ""; | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| typedef struct { | typedef struct { | ||||||
| 	snd_pcm_t *pcm; | 	snd_pcm_t *pcm; | ||||||
| 	unsigned int channels_count; | 	unsigned int channels_count; | ||||||
|  | @ -659,7 +664,6 @@ int snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name, | ||||||
| 	return 0; | 	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, | int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name, | ||||||
| 			snd_config_t *root, snd_config_t *conf, | 			snd_config_t *root, snd_config_t *conf, | ||||||
| 			snd_pcm_stream_t stream, int mode) | 			snd_pcm_stream_t stream, int mode) | ||||||
|  | @ -863,4 +867,4 @@ _free: | ||||||
| 		free(channels_schannel); | 		free(channels_schannel); | ||||||
| 	return err; | 	return err; | ||||||
| } | } | ||||||
| 
 | SND_DLSYM_BUILD_VERSION(_snd_pcm_multi_open, SND_PCM_DLSYM_VERSION); | ||||||
|  |  | ||||||
|  | @ -25,6 +25,11 @@ | ||||||
| #include "pcm_local.h" | #include "pcm_local.h" | ||||||
| #include "pcm_plugin.h" | #include "pcm_plugin.h" | ||||||
| 
 | 
 | ||||||
|  | #ifndef PIC | ||||||
|  | /* entry for static linking */ | ||||||
|  | const char *_snd_module_pcm_null = ""; | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| typedef struct { | typedef struct { | ||||||
| 	snd_timestamp_t trigger_tstamp; | 	snd_timestamp_t trigger_tstamp; | ||||||
| 	snd_pcm_state_t state; | 	snd_pcm_state_t state; | ||||||
|  | @ -364,7 +369,6 @@ int snd_pcm_null_open(snd_pcm_t **pcmp, const char *name, snd_pcm_stream_t strea | ||||||
| 	return 0; | 	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, | int _snd_pcm_null_open(snd_pcm_t **pcmp, const char *name, | ||||||
| 		       snd_config_t *conf,  | 		       snd_config_t *conf,  | ||||||
| 		       snd_pcm_stream_t stream, int mode) | 		       snd_pcm_stream_t stream, int mode) | ||||||
|  | @ -380,3 +384,4 @@ int _snd_pcm_null_open(snd_pcm_t **pcmp, const char *name, | ||||||
| 	} | 	} | ||||||
| 	return snd_pcm_null_open(pcmp, name, stream, mode); | 	return snd_pcm_null_open(pcmp, name, stream, mode); | ||||||
| } | } | ||||||
|  | SND_DLSYM_BUILD_VERSION(_snd_pcm_null_open, SND_PCM_DLSYM_VERSION); | ||||||
|  |  | ||||||
|  | @ -22,6 +22,11 @@ | ||||||
| #include "pcm_local.h" | #include "pcm_local.h" | ||||||
| #include "pcm_plugin.h" | #include "pcm_plugin.h" | ||||||
| 
 | 
 | ||||||
|  | #ifndef PIC | ||||||
|  | /* entry for static linking */ | ||||||
|  | const char *_snd_module_pcm_plug = ""; | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| enum snd_pcm_plug_route_policy { | enum snd_pcm_plug_route_policy { | ||||||
| 	PLUG_ROUTE_POLICY_NONE, | 	PLUG_ROUTE_POLICY_NONE, | ||||||
| 	PLUG_ROUTE_POLICY_DEFAULT, | 	PLUG_ROUTE_POLICY_DEFAULT, | ||||||
|  | @ -788,7 +793,6 @@ int snd_pcm_plug_open(snd_pcm_t **pcmp, | ||||||
| 
 | 
 | ||||||
| #define MAX_CHANNELS 64 | #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, | int _snd_pcm_plug_open(snd_pcm_t **pcmp, const char *name, | ||||||
| 		       snd_config_t *root, snd_config_t *conf,  | 		       snd_config_t *root, snd_config_t *conf,  | ||||||
| 		       snd_pcm_stream_t stream, int mode) | 		       snd_pcm_stream_t stream, int mode) | ||||||
|  | @ -872,4 +876,4 @@ int _snd_pcm_plug_open(snd_pcm_t **pcmp, const char *name, | ||||||
| 		snd_pcm_close(spcm); | 		snd_pcm_close(spcm); | ||||||
| 	return err; | 	return err; | ||||||
| } | } | ||||||
| 				 | SND_DLSYM_BUILD_VERSION(_snd_pcm_plug_open, SND_PCM_DLSYM_VERSION); | ||||||
|  |  | ||||||
|  | @ -24,6 +24,11 @@ | ||||||
| #include "pcm_local.h" | #include "pcm_local.h" | ||||||
| #include "pcm_plugin.h" | #include "pcm_plugin.h" | ||||||
| 
 | 
 | ||||||
|  | #ifndef PIC | ||||||
|  | /* entry for static linking */ | ||||||
|  | const char *_snd_module_pcm_rate = ""; | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| #define DIV (1<<16) | #define DIV (1<<16) | ||||||
| 
 | 
 | ||||||
| typedef struct { | typedef struct { | ||||||
|  | @ -528,7 +533,6 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sform | ||||||
| 	return 0; | 	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, | int _snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name, | ||||||
| 		       snd_config_t *root, snd_config_t *conf,  | 		       snd_config_t *root, snd_config_t *conf,  | ||||||
| 		       snd_pcm_stream_t stream, int mode) | 		       snd_pcm_stream_t stream, int mode) | ||||||
|  | @ -576,5 +580,4 @@ int _snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name, | ||||||
| 		snd_pcm_close(spcm); | 		snd_pcm_close(spcm); | ||||||
| 	return err; | 	return err; | ||||||
| } | } | ||||||
| 				 | SND_DLSYM_BUILD_VERSION(_snd_pcm_rate_open, SND_PCM_DLSYM_VERSION); | ||||||
| 
 |  | ||||||
|  |  | ||||||
|  | @ -24,6 +24,11 @@ | ||||||
| #include "pcm_local.h" | #include "pcm_local.h" | ||||||
| #include "pcm_plugin.h" | #include "pcm_plugin.h" | ||||||
| 
 | 
 | ||||||
|  | #ifndef PIC | ||||||
|  | /* entry for static linking */ | ||||||
|  | const char *_snd_module_pcm_route = ""; | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| /* The best possible hack to support missing optimization in gcc 2.7.2.3 */ | /* The best possible hack to support missing optimization in gcc 2.7.2.3 */ | ||||||
| #if ROUTE_PLUGIN_RESOLUTION & (ROUTE_PLUGIN_RESOLUTION - 1) != 0 | #if ROUTE_PLUGIN_RESOLUTION & (ROUTE_PLUGIN_RESOLUTION - 1) != 0 | ||||||
| #define div(a) a /= ROUTE_PLUGIN_RESOLUTION | #define div(a) a /= ROUTE_PLUGIN_RESOLUTION | ||||||
|  | @ -833,7 +838,6 @@ int snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_entry_t *tt | ||||||
| 
 | 
 | ||||||
| #define MAX_CHANNELS 32 | #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, | int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name, | ||||||
| 			snd_config_t *root, snd_config_t *conf,  | 			snd_config_t *root, snd_config_t *conf,  | ||||||
| 			snd_pcm_stream_t stream, int mode) | 			snd_pcm_stream_t stream, int mode) | ||||||
|  | @ -906,5 +910,4 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name, | ||||||
| 		snd_pcm_close(spcm); | 		snd_pcm_close(spcm); | ||||||
| 	return err; | 	return err; | ||||||
| } | } | ||||||
| 				 | SND_DLSYM_BUILD_VERSION(_snd_pcm_route_open, SND_PCM_DLSYM_VERSION); | ||||||
| 
 |  | ||||||
|  |  | ||||||
|  | @ -32,6 +32,10 @@ | ||||||
| #include <pthread.h> | #include <pthread.h> | ||||||
| #include "pcm_local.h" | #include "pcm_local.h" | ||||||
| 
 | 
 | ||||||
|  | #ifndef PIC | ||||||
|  | /* entry for static linking */ | ||||||
|  | const char *_snd_module_pcm_share = ""; | ||||||
|  | #endif | ||||||
| 
 | 
 | ||||||
| static LIST_HEAD(snd_pcm_share_slaves); | static LIST_HEAD(snd_pcm_share_slaves); | ||||||
| static pthread_mutex_t snd_pcm_share_slaves_mutex = PTHREAD_MUTEX_INITIALIZER; | static pthread_mutex_t snd_pcm_share_slaves_mutex = PTHREAD_MUTEX_INITIALIZER; | ||||||
|  | @ -1365,7 +1369,6 @@ int snd_pcm_share_open(snd_pcm_t **pcmp, const char *name, const char *sname, | ||||||
| 	return 0; | 	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, | int _snd_pcm_share_open(snd_pcm_t **pcmp, const char *name, | ||||||
| 			snd_config_t *root, snd_config_t *conf, | 			snd_config_t *root, snd_config_t *conf, | ||||||
| 			snd_pcm_stream_t stream, int mode) | 			snd_pcm_stream_t stream, int mode) | ||||||
|  | @ -1478,3 +1481,4 @@ _free: | ||||||
| 	free(channels_map); | 	free(channels_map); | ||||||
| 	return err; | 	return err; | ||||||
| } | } | ||||||
|  | SND_DLSYM_BUILD_VERSION(_snd_pcm_share_open, SND_PCM_DLSYM_VERSION); | ||||||
|  |  | ||||||
|  | @ -38,6 +38,11 @@ | ||||||
| #include <netdb.h> | #include <netdb.h> | ||||||
| #include "aserver.h" | #include "aserver.h" | ||||||
| 
 | 
 | ||||||
|  | #ifndef PIC | ||||||
|  | /* entry for static linking */ | ||||||
|  | const char *_snd_module_pcm_shm = ""; | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| typedef struct { | typedef struct { | ||||||
| 	int socket; | 	int socket; | ||||||
| 	volatile snd_pcm_shm_ctrl_t *ctrl; | 	volatile snd_pcm_shm_ctrl_t *ctrl; | ||||||
|  | @ -719,7 +724,6 @@ int is_local(struct hostent *hent) | ||||||
| 	return i < numreqs; | 	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, | int _snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name, | ||||||
| 		      snd_config_t *root, snd_config_t *conf, | 		      snd_config_t *root, snd_config_t *conf, | ||||||
| 		      snd_pcm_stream_t stream, int mode) | 		      snd_pcm_stream_t stream, int mode) | ||||||
|  | @ -833,4 +837,4 @@ int _snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name, | ||||||
| 	snd_config_delete(sconfig); | 	snd_config_delete(sconfig); | ||||||
| 	return err; | 	return err; | ||||||
| } | } | ||||||
| 				 | SND_DLSYM_BUILD_VERSION(_snd_pcm_shm_open, SND_PCM_DLSYM_VERSION); | ||||||
|  |  | ||||||
|  | @ -1,6 +1,6 @@ | ||||||
| EXTRA_LTLIBRARIES=librawmidi.la | EXTRA_LTLIBRARIES=librawmidi.la | ||||||
| 
 | 
 | ||||||
| librawmidi_la_SOURCES = rawmidi.c rawmidi_hw.c | librawmidi_la_SOURCES = rawmidi.c rawmidi_hw.c rawmidi_symbols.c | ||||||
| noinst_HEADERS = rawmidi_local.h | noinst_HEADERS = rawmidi_local.h | ||||||
| 
 | 
 | ||||||
| all: librawmidi.la | all: librawmidi.la | ||||||
|  |  | ||||||
|  | @ -74,6 +74,9 @@ static int snd_rawmidi_open_conf(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp | ||||||
| 	const char *lib = NULL, *open_name = NULL; | 	const char *lib = NULL, *open_name = NULL; | ||||||
| 	int (*open_func)(snd_rawmidi_t **, snd_rawmidi_t **, | 	int (*open_func)(snd_rawmidi_t **, snd_rawmidi_t **, | ||||||
| 			 const char *, snd_config_t *, snd_config_t *, int) = NULL; | 			 const char *, snd_config_t *, snd_config_t *, int) = NULL; | ||||||
|  | #ifndef PIC | ||||||
|  | 	extern void *snd_rawmidi_open_symbols(void); | ||||||
|  | #endif | ||||||
| 	void *h; | 	void *h; | ||||||
| 	if (snd_config_get_type(rawmidi_conf) != SND_CONFIG_TYPE_COMPOUND) { | 	if (snd_config_get_type(rawmidi_conf) != SND_CONFIG_TYPE_COMPOUND) { | ||||||
| 		if (name) | 		if (name) | ||||||
|  | @ -128,20 +131,19 @@ static int snd_rawmidi_open_conf(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp | ||||||
| 		open_name = buf; | 		open_name = buf; | ||||||
| 		snprintf(buf, sizeof(buf), "_snd_rawmidi_%s_open", str); | 		snprintf(buf, sizeof(buf), "_snd_rawmidi_%s_open", str); | ||||||
| 	} | 	} | ||||||
| 	h = dlopen(lib, RTLD_NOW); | #ifndef PIC | ||||||
| 	if (h) { | 	snd_rawmidi_open_symbols(); | ||||||
| 		if ((err = snd_dlsym_verify(h, open_name, SND_DLSYM_VERSION(SND_RAWMIDI_DLSYM_VERSION))) < 0) { | #endif | ||||||
| 			dlclose(h); | 	h = snd_dlopen(lib, RTLD_NOW); | ||||||
|                         goto _err; | 	if (h) | ||||||
| 		} | 		open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_RAWMIDI_DLSYM_VERSION)); | ||||||
| 		open_func = dlsym(h, open_name); | 	err = 0; | ||||||
| 	} |  | ||||||
| 	if (!h) { | 	if (!h) { | ||||||
| 		SNDERR("Cannot open shared library %s", lib); | 		SNDERR("Cannot open shared library %s", lib); | ||||||
| 		err = -ENOENT; | 		err = -ENOENT; | ||||||
| 	} else if (!open_func) { | 	} else if (!open_func) { | ||||||
| 		SNDERR("symbol %s is not defined inside %s", open_name, lib); | 		SNDERR("symbol %s is not defined inside %s", open_name, lib); | ||||||
| 		dlclose(h); | 		snd_dlclose(h); | ||||||
| 		err = -ENXIO; | 		err = -ENXIO; | ||||||
| 	} | 	} | ||||||
|        _err: |        _err: | ||||||
|  |  | ||||||
|  | @ -29,7 +29,12 @@ | ||||||
| #include "../control/control_local.h" | #include "../control/control_local.h" | ||||||
| #include "rawmidi_local.h" | #include "rawmidi_local.h" | ||||||
| 
 | 
 | ||||||
| #define SNDRV_FILE_RAWMIDI	"/dev/snd/midiC%iD%i" | #ifndef PIC | ||||||
|  | /* entry for static linking */ | ||||||
|  | const char *_snd_module_rawmidi_hw = ""; | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | #define SNDRV_FILE_RAWMIDI		"/dev/snd/midiC%iD%i" | ||||||
| #define SNDRV_RAWMIDI_VERSION_MAX	SNDRV_PROTOCOL_VERSION(2, 0, 0) | #define SNDRV_RAWMIDI_VERSION_MAX	SNDRV_PROTOCOL_VERSION(2, 0, 0) | ||||||
| 
 | 
 | ||||||
| typedef struct { | typedef struct { | ||||||
|  | @ -302,7 +307,6 @@ int snd_rawmidi_hw_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp, | ||||||
| 	return -ENOMEM; | 	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, | int _snd_rawmidi_hw_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp, | ||||||
| 			 char *name, snd_config_t *root ATTRIBUTE_UNUSED, | 			 char *name, snd_config_t *root ATTRIBUTE_UNUSED, | ||||||
| 			 snd_config_t *conf, int mode) | 			 snd_config_t *conf, int mode) | ||||||
|  | @ -348,4 +352,4 @@ int _snd_rawmidi_hw_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp, | ||||||
| 		return -EINVAL; | 		return -EINVAL; | ||||||
| 	return snd_rawmidi_hw_open(inputp, outputp, name, card, device, subdevice, mode); | 	return snd_rawmidi_hw_open(inputp, outputp, name, card, device, subdevice, mode); | ||||||
| } | } | ||||||
| 				 | SND_DLSYM_BUILD_VERSION(_snd_rawmidi_hw_open, SND_RAWMIDI_DLSYM_VERSION); | ||||||
|  |  | ||||||
|  | @ -1,6 +1,7 @@ | ||||||
| EXTRA_LTLIBRARIES=libseq.la | EXTRA_LTLIBRARIES=libseq.la | ||||||
| 
 | 
 | ||||||
| libseq_la_SOURCES = seq_hw.c seq.c seq_event.c seqmid.c seq_midi_event.c | libseq_la_SOURCES = seq_hw.c seq.c seq_event.c seqmid.c seq_midi_event.c \ | ||||||
|  | 		    seq_symbols.c | ||||||
| noinst_HEADERS = seq_local.h | noinst_HEADERS = seq_local.h | ||||||
| 
 | 
 | ||||||
| all: libseq.la | all: libseq.la | ||||||
|  |  | ||||||
|  | @ -26,8 +26,8 @@ | ||||||
|  * |  * | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include <sys/poll.h> |  | ||||||
| #include <dlfcn.h> | #include <dlfcn.h> | ||||||
|  | #include <sys/poll.h> | ||||||
| #include "seq_local.h" | #include "seq_local.h" | ||||||
| 
 | 
 | ||||||
| /****************************************************************************
 | /****************************************************************************
 | ||||||
|  | @ -77,6 +77,9 @@ static int snd_seq_open_conf(snd_seq_t **seqp, const char *name, | ||||||
| 	int (*open_func)(snd_seq_t **, const char *, | 	int (*open_func)(snd_seq_t **, const char *, | ||||||
| 			 snd_config_t *, snd_config_t *,  | 			 snd_config_t *, snd_config_t *,  | ||||||
| 			 int, int) = NULL; | 			 int, int) = NULL; | ||||||
|  | #ifndef PIC | ||||||
|  | 	extern void *snd_seq_open_symbols(void); | ||||||
|  | #endif | ||||||
| 	void *h; | 	void *h; | ||||||
| 	if (snd_config_get_type(seq_conf) != SND_CONFIG_TYPE_COMPOUND) { | 	if (snd_config_get_type(seq_conf) != SND_CONFIG_TYPE_COMPOUND) { | ||||||
| 		if (name) | 		if (name) | ||||||
|  | @ -129,21 +132,19 @@ static int snd_seq_open_conf(snd_seq_t **seqp, const char *name, | ||||||
| 		open_name = buf; | 		open_name = buf; | ||||||
| 		snprintf(buf, sizeof(buf), "_snd_seq_%s_open", str); | 		snprintf(buf, sizeof(buf), "_snd_seq_%s_open", str); | ||||||
| 	} | 	} | ||||||
| 	h = dlopen(lib, RTLD_NOW); | #ifndef PIC | ||||||
| 	if (h) { | 	snd_seq_open_symbols(); | ||||||
| 		if ((err = snd_dlsym_verify(h, open_name, SND_DLSYM_VERSION(SND_SEQ_DLSYM_VERSION))) < 0) { | #endif | ||||||
| 			dlclose(h); | 	h = snd_dlopen(lib, RTLD_NOW); | ||||||
| 			goto _err; | 	if (h) | ||||||
| 		} | 		open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_SEQ_DLSYM_VERSION)); | ||||||
| 		open_func = dlsym(h, open_name); |  | ||||||
| 	} |  | ||||||
| 	err = 0; | 	err = 0; | ||||||
| 	if (!h) { | 	if (!h) { | ||||||
| 		SNDERR("Cannot open shared library %s", lib); | 		SNDERR("Cannot open shared library %s", lib); | ||||||
| 		err = -ENOENT; | 		err = -ENOENT; | ||||||
| 	} else if (!open_func) { | 	} else if (!open_func) { | ||||||
| 		SNDERR("symbol %s is not defined inside %s", open_name, lib); | 		SNDERR("symbol %s is not defined inside %s", open_name, lib); | ||||||
| 		dlclose(h); | 		snd_dlclose(h); | ||||||
| 		err = -ENXIO; | 		err = -ENXIO; | ||||||
| 	} | 	} | ||||||
|        _err: |        _err: | ||||||
|  |  | ||||||
|  | @ -24,6 +24,11 @@ | ||||||
| #include <sys/ioctl.h> | #include <sys/ioctl.h> | ||||||
| #include "seq_local.h" | #include "seq_local.h" | ||||||
| 
 | 
 | ||||||
|  | #ifndef PIC | ||||||
|  | /* entry for static linking */ | ||||||
|  | const char *_snd_module_seq_hw = ""; | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| #define SNDRV_FILE_SEQ		"/dev/snd/seq" | #define SNDRV_FILE_SEQ		"/dev/snd/seq" | ||||||
| #define SNDRV_FILE_ALOADSEQ	"/dev/aloadSEQ" | #define SNDRV_FILE_ALOADSEQ	"/dev/aloadSEQ" | ||||||
| #define SNDRV_SEQ_VERSION_MAX	SNDRV_PROTOCOL_VERSION(1, 0, 0) | #define SNDRV_SEQ_VERSION_MAX	SNDRV_PROTOCOL_VERSION(1, 0, 0) | ||||||
|  | @ -503,7 +508,6 @@ int snd_seq_hw_open(snd_seq_t **handle, const char *name, int streams, int mode) | ||||||
| 	return 0; | 	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, | int _snd_seq_hw_open(snd_seq_t **handlep, char *name, | ||||||
| 		     snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *conf, | 		     snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *conf, | ||||||
| 		     int streams, int mode) | 		     int streams, int mode) | ||||||
|  | @ -520,4 +524,4 @@ int _snd_seq_hw_open(snd_seq_t **handlep, char *name, | ||||||
| 	} | 	} | ||||||
| 	return snd_seq_hw_open(handlep, name, streams, mode); | 	return snd_seq_hw_open(handlep, name, streams, mode); | ||||||
| } | } | ||||||
| 				 | SND_DLSYM_BUILD_VERSION(_snd_seq_hw_open, SND_SEQ_DLSYM_VERSION); | ||||||
|  |  | ||||||
|  | @ -1,6 +1,7 @@ | ||||||
| EXTRA_LTLIBRARIES=libtimer.la | EXTRA_LTLIBRARIES=libtimer.la | ||||||
| 
 | 
 | ||||||
| libtimer_la_SOURCES = timer.c timer_hw.c timer_query.c timer_query_hw.c | libtimer_la_SOURCES = timer.c timer_hw.c timer_query.c timer_query_hw.c \ | ||||||
|  | 	              timer_symbols.c | ||||||
| noinst_HEADERS = timer_local.h | noinst_HEADERS = timer_local.h | ||||||
| all: libtimer.la | all: libtimer.la | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -47,6 +47,9 @@ static int snd_timer_open_conf(snd_timer_t **timer, | ||||||
| 	snd_config_iterator_t i, next; | 	snd_config_iterator_t i, next; | ||||||
| 	const char *lib = NULL, *open_name = NULL; | 	const char *lib = NULL, *open_name = NULL; | ||||||
| 	int (*open_func)(snd_timer_t **, const char *, snd_config_t *, snd_config_t *, int) = NULL; | 	int (*open_func)(snd_timer_t **, const char *, snd_config_t *, snd_config_t *, int) = NULL; | ||||||
|  | #ifndef PIC | ||||||
|  | 	extern void *snd_timer_open_symbols(void); | ||||||
|  | #endif | ||||||
| 	void *h; | 	void *h; | ||||||
| 	if (snd_config_get_type(timer_conf) != SND_CONFIG_TYPE_COMPOUND) { | 	if (snd_config_get_type(timer_conf) != SND_CONFIG_TYPE_COMPOUND) { | ||||||
| 		if (name) | 		if (name) | ||||||
|  | @ -101,20 +104,19 @@ static int snd_timer_open_conf(snd_timer_t **timer, | ||||||
| 		open_name = buf; | 		open_name = buf; | ||||||
| 		snprintf(buf, sizeof(buf), "_snd_timer_%s_open", str); | 		snprintf(buf, sizeof(buf), "_snd_timer_%s_open", str); | ||||||
| 	} | 	} | ||||||
| 	h = dlopen(lib, RTLD_NOW); | #ifndef PIC | ||||||
| 	if (h) { | 	snd_timer_open_symbols(); | ||||||
| 		if ((err = snd_dlsym_verify(h, open_name, SND_DLSYM_VERSION(SND_TIMER_DLSYM_VERSION))) < 0) { | #endif | ||||||
|                 	dlclose(h); | 	h = snd_dlopen(lib, RTLD_NOW); | ||||||
|                         goto _err; | 	if (h) | ||||||
| 		} | 		open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_TIMER_DLSYM_VERSION)); | ||||||
| 		open_func = dlsym(h, open_name); | 	err = 0; | ||||||
| 	} |  | ||||||
| 	if (!h) { | 	if (!h) { | ||||||
| 		SNDERR("Cannot open shared library %s", lib); | 		SNDERR("Cannot open shared library %s", lib); | ||||||
| 		err = -ENOENT; | 		err = -ENOENT; | ||||||
| 	} else if (!open_func) { | 	} else if (!open_func) { | ||||||
| 		SNDERR("symbol %s is not defined inside %s", open_name, lib); | 		SNDERR("symbol %s is not defined inside %s", open_name, lib); | ||||||
| 		dlclose(h); | 		snd_dlclose(h); | ||||||
| 		err = -ENXIO; | 		err = -ENXIO; | ||||||
| 	} | 	} | ||||||
|        _err: |        _err: | ||||||
|  |  | ||||||
|  | @ -27,6 +27,11 @@ | ||||||
| #include <sys/ioctl.h> | #include <sys/ioctl.h> | ||||||
| #include "timer_local.h" | #include "timer_local.h" | ||||||
| 
 | 
 | ||||||
|  | #ifndef PIC | ||||||
|  | /* entry for static linking */ | ||||||
|  | const char *_snd_module_timer_hw = ""; | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| #define SNDRV_FILE_TIMER		"/dev/snd/timer" | #define SNDRV_FILE_TIMER		"/dev/snd/timer" | ||||||
| #define SNDRV_TIMER_VERSION_MAX	SNDRV_PROTOCOL_VERSION(2, 0, 0) | #define SNDRV_TIMER_VERSION_MAX	SNDRV_PROTOCOL_VERSION(2, 0, 0) | ||||||
| 
 | 
 | ||||||
|  | @ -200,7 +205,6 @@ int snd_timer_hw_open(snd_timer_t **handle, const char *name, int dev_class, int | ||||||
| 	return 0; | 	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, | int _snd_timer_hw_open(snd_timer_t **timer, char *name, | ||||||
| 		       snd_config_t *root ATTRIBUTE_UNUSED, | 		       snd_config_t *root ATTRIBUTE_UNUSED, | ||||||
| 		       snd_config_t *conf, int mode) | 		       snd_config_t *conf, int mode) | ||||||
|  | @ -260,3 +264,4 @@ int _snd_timer_hw_open(snd_timer_t **timer, char *name, | ||||||
| 		return -EINVAL; | 		return -EINVAL; | ||||||
| 	return snd_timer_hw_open(timer, name, dev_class, dev_sclass, card, device, subdevice, mode); | 	return snd_timer_hw_open(timer, name, dev_class, dev_sclass, card, device, subdevice, mode); | ||||||
| } | } | ||||||
|  | SND_DLSYM_BUILD_VERSION(_snd_timer_hw_open, SND_TIMER_DLSYM_VERSION); | ||||||
|  |  | ||||||
|  | @ -46,6 +46,9 @@ static int snd_timer_query_open_conf(snd_timer_query_t **timer, | ||||||
| 	snd_config_iterator_t i, next; | 	snd_config_iterator_t i, next; | ||||||
| 	const char *lib = NULL, *open_name = NULL; | 	const char *lib = NULL, *open_name = NULL; | ||||||
| 	int (*open_func)(snd_timer_query_t **, const char *, snd_config_t *, snd_config_t *, int) = NULL; | 	int (*open_func)(snd_timer_query_t **, const char *, snd_config_t *, snd_config_t *, int) = NULL; | ||||||
|  | #ifndef PIC | ||||||
|  | 	extern void *snd_timer_query_open_symbols(void); | ||||||
|  | #endif | ||||||
| 	void *h; | 	void *h; | ||||||
| 	if (snd_config_get_type(timer_conf) != SND_CONFIG_TYPE_COMPOUND) { | 	if (snd_config_get_type(timer_conf) != SND_CONFIG_TYPE_COMPOUND) { | ||||||
| 		if (name) | 		if (name) | ||||||
|  | @ -100,20 +103,18 @@ static int snd_timer_query_open_conf(snd_timer_query_t **timer, | ||||||
| 		open_name = buf; | 		open_name = buf; | ||||||
| 		snprintf(buf, sizeof(buf), "_snd_timer_query_%s_open", str); | 		snprintf(buf, sizeof(buf), "_snd_timer_query_%s_open", str); | ||||||
| 	} | 	} | ||||||
| 	h = dlopen(lib, RTLD_NOW); | #ifndef PIC | ||||||
| 	if (h) { | 	snd_timer_query_open_symbols(); | ||||||
| 		if ((err = snd_dlsym_verify(h, open_name, SND_DLSYM_VERSION(SND_TIMER_QUERY_DLSYM_VERSION))) < 0) { | #endif | ||||||
| 			dlclose(h); | 	h = snd_dlopen(lib, RTLD_NOW); | ||||||
|                         goto _err; | 	if (h) | ||||||
| 		} | 		open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_TIMER_QUERY_DLSYM_VERSION)); | ||||||
| 		open_func = dlsym(h, open_name); |  | ||||||
| 	} |  | ||||||
| 	if (!h) { | 	if (!h) { | ||||||
| 		SNDERR("Cannot open shared library %s", lib); | 		SNDERR("Cannot open shared library %s", lib); | ||||||
| 		err = -ENOENT; | 		err = -ENOENT; | ||||||
| 	} else if (!open_func) { | 	} else if (!open_func) { | ||||||
| 		SNDERR("symbol %s is not defined inside %s", open_name, lib); | 		SNDERR("symbol %s is not defined inside %s", open_name, lib); | ||||||
| 		dlclose(h); | 		snd_dlclose(h); | ||||||
| 		err = -ENXIO; | 		err = -ENXIO; | ||||||
| 	} | 	} | ||||||
|        _err: |        _err: | ||||||
|  |  | ||||||
|  | @ -27,6 +27,11 @@ | ||||||
| #include <sys/ioctl.h> | #include <sys/ioctl.h> | ||||||
| #include "timer_local.h" | #include "timer_local.h" | ||||||
| 
 | 
 | ||||||
|  | #ifndef PIC | ||||||
|  | /* entry for static linking */ | ||||||
|  | const char *_snd_module_timer_query_hw = ""; | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| #define SNDRV_FILE_TIMER		"/dev/snd/timer" | #define SNDRV_FILE_TIMER		"/dev/snd/timer" | ||||||
| #define SNDRV_TIMER_VERSION_MAX	SNDRV_PROTOCOL_VERSION(2, 0, 0) | #define SNDRV_TIMER_VERSION_MAX	SNDRV_PROTOCOL_VERSION(2, 0, 0) | ||||||
| 
 | 
 | ||||||
|  | @ -88,7 +93,6 @@ int snd_timer_query_hw_open(snd_timer_query_t **handle, const char *name, int mo | ||||||
| 	return 0; | 	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, | int _snd_timer_query_hw_open(snd_timer_query_t **timer, char *name, | ||||||
| 			     snd_config_t *root ATTRIBUTE_UNUSED, | 			     snd_config_t *root ATTRIBUTE_UNUSED, | ||||||
| 			     snd_config_t *conf, int mode) | 			     snd_config_t *conf, int mode) | ||||||
|  | @ -106,3 +110,4 @@ int _snd_timer_query_hw_open(snd_timer_query_t **timer, char *name, | ||||||
| 	} | 	} | ||||||
| 	return snd_timer_query_hw_open(timer, name, mode); | 	return snd_timer_query_hw_open(timer, name, mode); | ||||||
| } | } | ||||||
|  | SND_DLSYM_BUILD_VERSION(_snd_timer_query_hw_open, SND_TIMER_QUERY_DLSYM_VERSION); | ||||||
|  |  | ||||||
|  | @ -11,6 +11,6 @@ rawmidi_LDADD=../src/libasound.la | ||||||
| midiloop_LDADD=../src/libasound.la | midiloop_LDADD=../src/libasound.la | ||||||
| 
 | 
 | ||||||
| INCLUDES=-I$(top_srcdir)/include | INCLUDES=-I$(top_srcdir)/include | ||||||
| CFLAGS=-Wall -pipe -g | CFLAGS=-static -Wall -pipe -g | ||||||
| 
 | 
 | ||||||
| EXTRA_DIST=seq-decoder.c seq-sender.c midifile.h midifile.c midifile.3 | EXTRA_DIST=seq-decoder.c seq-sender.c midifile.h midifile.c midifile.3 | ||||||
|  |  | ||||||
|  | @ -1,6 +1,7 @@ | ||||||
| #include <stdlib.h> | #include <stdlib.h> | ||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
| #include <ctype.h> | #include <ctype.h> | ||||||
|  | #include <sys/time.h> | ||||||
| #include "../include/asoundlib.h" | #include "../include/asoundlib.h" | ||||||
| #include <string.h> | #include <string.h> | ||||||
| #include <signal.h> | #include <signal.h> | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Jaroslav Kysela
						Jaroslav Kysela