ALSA project - the C library reference: /tmp/work/src/alsa-lib-1.2.12/include/global.h Source File

ALSA project - the C library reference

Loading...
Searching...
No Matches
global.h
Go to the documentation of this file.
1
11/*
12 * This library is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License as
14 * published by the Free Software Foundation; either version 2.1 of
15 * the License, or (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU Lesser General Public License for more details.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25 *
26 */
27
28#ifndef __ALSA_GLOBAL_H_
29#define __ALSA_GLOBAL_H_
30
31/* for timeval and timespec */
32#include <time.h>
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
47const char *snd_asoundlib_version(void);
48
49#ifndef ATTRIBUTE_UNUSED
51#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
52#endif
53
54#ifndef __STRING
56#define __STRING(x) #x
57#endif
58
59#ifdef PIC /* dynamic build */
60
62#define __SND_DLSYM_VERSION(name, version) _ ## name ## version
67#define SND_DLSYM_BUILD_VERSION(name, version) char __SND_DLSYM_VERSION(name, version);
68
69#else /* static build */
70
71struct snd_dlsym_link {
72 struct snd_dlsym_link *next;
73 const char *dlsym_name;
74 const void *dlsym_ptr;
75};
76
77extern struct snd_dlsym_link *snd_dlsym_start;
78
80#define __SND_DLSYM_VERSION(prefix, name, version) _ ## prefix ## name ## version
85#define SND_DLSYM_BUILD_VERSION(name, version) \
86 static struct snd_dlsym_link __SND_DLSYM_VERSION(snd_dlsym_, name, version); \
87 void __SND_DLSYM_VERSION(snd_dlsym_constructor_, name, version) (void) __attribute__ ((constructor)); \
88 void __SND_DLSYM_VERSION(snd_dlsym_constructor_, name, version) (void) { \
89 __SND_DLSYM_VERSION(snd_dlsym_, name, version).next = snd_dlsym_start; \
90 __SND_DLSYM_VERSION(snd_dlsym_, name, version).dlsym_name = __STRING(name); \
91 __SND_DLSYM_VERSION(snd_dlsym_, name, version).dlsym_ptr = (void *)&name; \
92 snd_dlsym_start = &__SND_DLSYM_VERSION(snd_dlsym_, name, version); \
93 }
94
95#endif
96
98#define SND_DLSYM_VERSION(version) __STRING(version)
99
100int snd_dlpath(char *path, size_t path_len, const char *name);
101void *snd_dlopen(const char *file, int mode, char *errbuf, size_t errbuflen);
102void *snd_dlsym(void *handle, const char *name, const char *version);
103int snd_dlclose(void *handle);
104
105
107#define __snd_alloca(ptr,type) do { *ptr = (type##_t *) alloca(type##_sizeof()); memset(*ptr, 0, type##_sizeof()); } while (0)
108
115 typedef struct _snd_async_handler snd_async_handler_t;
116
122 typedef void (*snd_async_callback_t)(snd_async_handler_t *handler);
123
124int snd_async_add_handler(snd_async_handler_t **handler, int fd,
125 snd_async_callback_t callback, void *private_data);
126int snd_async_del_handler(snd_async_handler_t *handler);
127int snd_async_handler_get_fd(snd_async_handler_t *handler);
128int snd_async_handler_get_signo(snd_async_handler_t *handler);
129void *snd_async_handler_get_callback_private(snd_async_handler_t *handler);
130
131struct snd_shm_area *snd_shm_area_create(int shmid, void *ptr);
132struct snd_shm_area *snd_shm_area_share(struct snd_shm_area *area);
133int snd_shm_area_destroy(struct snd_shm_area *area);
134
135int snd_user_file(const char *file, char **result);
136
137#ifdef __GLIBC__
138#if !defined(_POSIX_C_SOURCE) && !defined(_POSIX_SOURCE)
139struct timeval {
140 time_t tv_sec; /* seconds */
141 long tv_usec; /* microseconds */
142};
143
144struct timespec {
145 time_t tv_sec; /* seconds */
146 long tv_nsec; /* nanoseconds */
147};
148#endif
149#endif
150
152 typedef struct timeval snd_timestamp_t;
154 typedef struct timespec snd_htimestamp_t;
155
158#ifdef __cplusplus
159}
160#endif
161
162#endif /* __ALSA_GLOBAL_H */
snd_dlsym
void * snd_dlsym(void *handle, const char *name, const char *version)
Resolves a symbol from a dynamic library - ALSA wrapper for dlsym.
Definition dlmisc.c:246
snd_async_del_handler
int snd_async_del_handler(snd_async_handler_t *handler)
Deletes an async handler.
Definition async.c:150
snd_dlopen
void * snd_dlopen(const char *file, int mode, char *errbuf, size_t errbuflen)
Opens a dynamic library - ALSA wrapper for dlopen.
Definition dlmisc.c:122
snd_htimestamp_t
struct timespec snd_htimestamp_t
Definition global.h:154
snd_shm_area_destroy
int snd_shm_area_destroy(struct snd_shm_area *area)
Release the shared area record.
Definition shmarea.c:103
snd_dlclose
int snd_dlclose(void *handle)
Closes a dynamic library - ALSA wrapper for dlclose.
Definition dlmisc.c:186
snd_async_handler_t
struct _snd_async_handler snd_async_handler_t
Internal structure for an async notification client handler.
Definition global.h:115
snd_user_file
int snd_user_file(const char *file, char **result)
Get the full file name.
Definition userfile.c:72
snd_async_handler_get_signo
int snd_async_handler_get_signo(snd_async_handler_t *handler)
Returns the signal number assigned to an async handler.
Definition async.c:197
snd_shm_area_create
struct snd_shm_area * snd_shm_area_create(int shmid, void *ptr)
Create a shm area record.
Definition shmarea.c:68
snd_asoundlib_version
const char * snd_asoundlib_version(void)
Returns the ALSA sound library version in ASCII format.
Definition error.c:143
snd_async_handler_get_fd
int snd_async_handler_get_fd(snd_async_handler_t *handler)
Returns the file descriptor assigned to an async handler.
Definition async.c:208
snd_timestamp_t
struct timeval snd_timestamp_t
Definition global.h:152
snd_async_handler_get_callback_private
void * snd_async_handler_get_callback_private(snd_async_handler_t *handler)
Returns the private data assigned to an async handler.
Definition async.c:219
snd_dlpath
int snd_dlpath(char *path, size_t path_len, const char *name)
Compose the dynamic path.
Definition dlmisc.c:90
snd_shm_area_share
struct snd_shm_area * snd_shm_area_share(struct snd_shm_area *area)
Increase the reference counter of shm area record.
Definition shmarea.c:87
snd_async_callback_t
void(* snd_async_callback_t)(snd_async_handler_t *handler)
Async notification callback.
Definition global.h:122
snd_async_add_handler
int snd_async_add_handler(snd_async_handler_t **handler, int fd, snd_async_callback_t callback, void *private_data)
Registers an async handler.
Definition async.c:112