alsa-lib-1.0.27.2/snd_dlobj_cache_get()
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
*参照元 [#f8292365]
#backlinks
*説明 [#p19d67aa]
-パス: [[alsa-lib-1.0.27.2/src/dlmisc.c]]
-FIXME: これは何?
--説明
**引数 [#t14c5810]
-const char *lib
--
-const char *name
--
-const char *version
--
-int verbose
--
**返り値 [#m625f669]
-void *
--
**参考 [#o07e8426]
*実装 [#iadfcf30]
void *snd_dlobj_cache_get(const char *lib, const char *n...
const char *version, int verbose)
{
struct list_head *p;
struct dlobj_cache *c;
void *func, *dlobj;
-
--[[alsa-lib-1.0.27.2/list_head]]
-
--[[alsa-lib-1.0.27.2/dlobj_cache]]
snd_dlobj_lock();
-
--[[alsa-lib-1.0.27.2/snd_dlobj_lock()]]
list_for_each(p, &pcm_dlobj_list) {
-
--[[alsa-lib-1.0.27.2/list_for_each()]]
-
--[[alsa-lib-1.0.27.2/pcm_dlobj_list(global)]]
c = list_entry(p, struct dlobj_cache, list);
if (c->lib && lib && strcmp(c->lib, lib) != 0)
continue;
if (!c->lib && lib)
continue;
if (!lib && c->lib)
continue;
if (strcmp(c->name, name) == 0) {
c->refcnt++;
func = c->func;
snd_dlobj_unlock();
return func;
}
}
-
--[[alsa-lib-1.0.27.2/list_entry()]]
-
--[[alsa-lib-1.0.27.2/snd_dlobj_unlock()]]
dlobj = snd_dlopen(lib, RTLD_NOW);
if (dlobj == NULL) {
if (verbose)
SNDERR("Cannot open shared library %s",
lib ? lib : "[builtin]");
snd_dlobj_unlock();
return NULL;
}
-
--[[alsa-lib-1.0.27.2/snd_dlopen()]]
-
--[[alsa-lib-1.0.27.2/SNDERR()]]
func = snd_dlsym(dlobj, name, version);
if (func == NULL) {
if (verbose)
SNDERR("symbol %s is not defined inside %s",
name, lib ? lib : "[builtin]");
goto __err;
}
-
--[[alsa-lib-1.0.27.2/snd_dlsym()]]
c = malloc(sizeof(*c));
if (! c)
goto __err;
c->refcnt = 1;
c->lib = lib ? strdup(lib) : NULL;
c->name = strdup(name);
if ((lib && ! c->lib) || ! c->name) {
free((void *)c->name);
free((void *)c->lib);
free(c);
__err:
snd_dlclose(dlobj);
snd_dlobj_unlock();
return NULL;
}
-
--[[alsa-lib-1.0.27.2/snd_dlclose()]]
c->dlobj = dlobj;
c->func = func;
list_add_tail(&c->list, &pcm_dlobj_list);
snd_dlobj_unlock();
return func;
-
--[[alsa-lib-1.0.27.2/list_add_tail()]]
}
*コメント [#f4cdfe17]
終了行:
*参照元 [#f8292365]
#backlinks
*説明 [#p19d67aa]
-パス: [[alsa-lib-1.0.27.2/src/dlmisc.c]]
-FIXME: これは何?
--説明
**引数 [#t14c5810]
-const char *lib
--
-const char *name
--
-const char *version
--
-int verbose
--
**返り値 [#m625f669]
-void *
--
**参考 [#o07e8426]
*実装 [#iadfcf30]
void *snd_dlobj_cache_get(const char *lib, const char *n...
const char *version, int verbose)
{
struct list_head *p;
struct dlobj_cache *c;
void *func, *dlobj;
-
--[[alsa-lib-1.0.27.2/list_head]]
-
--[[alsa-lib-1.0.27.2/dlobj_cache]]
snd_dlobj_lock();
-
--[[alsa-lib-1.0.27.2/snd_dlobj_lock()]]
list_for_each(p, &pcm_dlobj_list) {
-
--[[alsa-lib-1.0.27.2/list_for_each()]]
-
--[[alsa-lib-1.0.27.2/pcm_dlobj_list(global)]]
c = list_entry(p, struct dlobj_cache, list);
if (c->lib && lib && strcmp(c->lib, lib) != 0)
continue;
if (!c->lib && lib)
continue;
if (!lib && c->lib)
continue;
if (strcmp(c->name, name) == 0) {
c->refcnt++;
func = c->func;
snd_dlobj_unlock();
return func;
}
}
-
--[[alsa-lib-1.0.27.2/list_entry()]]
-
--[[alsa-lib-1.0.27.2/snd_dlobj_unlock()]]
dlobj = snd_dlopen(lib, RTLD_NOW);
if (dlobj == NULL) {
if (verbose)
SNDERR("Cannot open shared library %s",
lib ? lib : "[builtin]");
snd_dlobj_unlock();
return NULL;
}
-
--[[alsa-lib-1.0.27.2/snd_dlopen()]]
-
--[[alsa-lib-1.0.27.2/SNDERR()]]
func = snd_dlsym(dlobj, name, version);
if (func == NULL) {
if (verbose)
SNDERR("symbol %s is not defined inside %s",
name, lib ? lib : "[builtin]");
goto __err;
}
-
--[[alsa-lib-1.0.27.2/snd_dlsym()]]
c = malloc(sizeof(*c));
if (! c)
goto __err;
c->refcnt = 1;
c->lib = lib ? strdup(lib) : NULL;
c->name = strdup(name);
if ((lib && ! c->lib) || ! c->name) {
free((void *)c->name);
free((void *)c->lib);
free(c);
__err:
snd_dlclose(dlobj);
snd_dlobj_unlock();
return NULL;
}
-
--[[alsa-lib-1.0.27.2/snd_dlclose()]]
c->dlobj = dlobj;
c->func = func;
list_add_tail(&c->list, &pcm_dlobj_list);
snd_dlobj_unlock();
return func;
-
--[[alsa-lib-1.0.27.2/list_add_tail()]]
}
*コメント [#f4cdfe17]
ページ名: