The following example lists all resource pools defined in an application's pools pset.
The key points of the example include the following:
Open the dynamic conf file read-only, PO_RDONLY. pool_query_pools() returns the list of pools in pl and the number of pools in nelem. For each pool, call pool_get_property() to get the pool.name property from the element into the pval value.
pool_get_property() calls pool_to_elem() to convert the libpool entity to an opaque value. pool_value_get_string() gets the string from the opaque pool value.
conf = pool_conf_alloc();
pool_conf_open(conf, pool_dynamic_location(), PO_RDONLY);
pl = pool_query_pools(conf, &nelem, NULL);
pval = pool_value_alloc();
for (i = 0; i < nelem; i++) {
pool_get_property(conf, pool_to_elem(conf, pl[i]), "pool.name", pval);
pool_value_get_string(pval, &fname);
printf("%s\n", name);
}
pool_value_free(pval);
free(pl);
pool_conf_close(conf);