add code to allow polypaudio dump preloaded modules using "--dump-modules"

git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@702 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
Lennart Poettering 2006-04-13 17:33:06 +00:00
parent d4b22f3000
commit fe64b89fd8

View file

@ -78,15 +78,41 @@ static void show_info(const char *name, const char *path, void (*info)(const cha
}
}
extern const lt_dlsymlist lt_preloaded_symbols[];
static int is_preloaded(const char *name) {
const lt_dlsymlist *l;
for (l = lt_preloaded_symbols; l->name; l++) {
char buf[64], *e;
if (l->address)
continue;
snprintf(buf, sizeof(buf), "%s", l->name);
if ((e = strrchr(buf, '.')))
*e = 0;
if (!strcmp(name, buf))
return 1;
}
return 0;
}
static int callback(const char *path, lt_ptr data) {
const char *e;
pa_daemon_conf *c = (data);
e = pa_path_get_filename(path);
if (strlen(e) > sizeof(PREFIX)-1 && !strncmp(e, PREFIX, sizeof(PREFIX)-1))
show_info(e, path, c->log_level >= PA_LOG_INFO ? long_info : short_info);
if (strlen(e) <= sizeof(PREFIX)-1 || strncmp(e, PREFIX, sizeof(PREFIX)-1))
return 0;
if (is_preloaded(e))
return 0;
show_info(e, path, c->log_level >= PA_LOG_INFO ? long_info : short_info);
return 0;
}
@ -95,6 +121,25 @@ void pa_dump_modules(pa_daemon_conf *c, int argc, char * const argv[]) {
int i;
for (i = 0; i < argc; i++)
show_info(argv[i], NULL, long_info);
} else
} else {
const lt_dlsymlist *l;
for (l = lt_preloaded_symbols; l->name; l++) {
char buf[64], *e;
if (l->address)
continue;
if (strlen(l->name) <= sizeof(PREFIX)-1 || strncmp(l->name, PREFIX, sizeof(PREFIX)-1))
continue;
snprintf(buf, sizeof(buf), "%s", l->name);
if ((e = strrchr(buf, '.')))
*e = 0;
show_info(buf, NULL, c->log_level >= PA_LOG_INFO ? long_info : short_info);
}
lt_dlforeachfile(NULL, callback, c);
}
}