Able to successfully use scf_read_propvec to read properties from
a test service.
However, get error "error: entity not found" when trying to write
out a property vector.
$ ./smf_routines2y
state is online
error: entity not found
$ $ svcprop -v margot2 | grep valueofpig
config_params/valueofpig astring huge
$
Below is a stripped down test program. I have been staring at awhile
and no obvious errors jump up at me.
Thanks,
Margot
girltalk2% cat smf_routines-margot2.c
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <libscf.h>
#include <libscf_priv.h>
#include <sys/types.h>
#define MARGOT_FMRI "svc:/system/margot2:default"
#define CONFIG_PARAMS "config_params"
main()
{
scf_propvec_t *prop;
char *service_state;
scf_propvec_t properties[] = {
{ "valueofpig",NULL,SCF_TYPE_ASTRING},
{NULL}
};
/*Get status of the service*/
service_state=smf_get_state(MARGOT_FMRI);
if (service_state)
printf("state is %s\n",service_state);
for (prop=properties; prop->pv_prop != NULL; prop++)
prop->pv_ptr="pink";
prop=NULL;
if (scf_write_propvec(MARGOT_FMRI, CONFIG_PARAMS, properties,
&prop) != SCF_SUCCESS)
{
(void) fprintf(stderr, "error: %s\n",
scf_strerror(scf_error()));
if (prop != NULL)
{
printf("prop not equal to null\n");
}
}
}