Tony Nguyen wrote:
> John Levon wrote:
>> I don't get how I'm supposed to use this. It returns a const property 
>> (as it
>> seems it should) but all the ways to iterate over the contents use a 
>> non-const
>> argument. Seems pretty useless, which is why I suppose it's not used 
>> (and why
>> the manpage is totally wrong).
>>
I missed the piece of code that answers your question :^) Basically, I 
cast the argument to be a non-const in the scf_simple_prop_next* calls.

-tony
>>   
> John,
>
> I found the below snippet of code to work fine for me and was planning 
> to blog about the use of these interface once my code is integrated. I 
> do agree that it's quite confusing and the manpage is not insufficient.
>
> -tony
>
> ...
>        scf_simple_app_props_t  *config_pg = NULL;
>        scf_simple_prop_t       const *pressure_prop = NULL;
>        scf_simple_prop_t       const *reconfig_int_prop = NULL;
> ...
> ...
>        if ((config_pg = scf_simple_app_props_get(h, RCAP_FMRI)) == 
> NULL) {
>                warn(gettext("Failed to get configuration "
>                     "information \n"));
> ....
> ....
>        if ((pressure_prop = scf_simple_app_props_search(config_pg,
>            "config_params", "pressure")) == NULL && (numvals =
>            scf_simple_prop_numvalues(pressure_prop)) <= 0) {
>                warn(gettext("Couldn't find property `%s' in property "
>                    "group `%s'\n"), "pressure", "config_params");
>                goto err;
>         } else {
>                 if ((tmp_int = scf_simple_prop_next_integer(
>                     (scf_simple_prop_t *) pressure_prop)) != NULL)
>                         _rcfg->rcfg_memory_cap_enforcement_pressure = 
> *tmp_int;
>
>                 if (_rcfg->rcfg_memory_cap_enforcement_pressure < 0)
>                         _rcfg->rcfg_memory_cap_enforcement_pressure = 0;
>                 debug("cap max pressure: %d%%\n",
>                     _rcfg->rcfg_memory_cap_enforcement_pressure);
>         }
>


Reply via email to