void install_configd_svc () { svc_t * new_svc = s16_svc_new (); char * fmri; new_svc->id = 1; new_svc->name = strdup ("s16/configd"); svc_object_set_property_string (new_svc, "S16.Name", new_svc->name); asprintf (&fmri, "svc:/%s", new_svc->name); svc_object_set_property_string (new_svc, "S16.FMRI", fmri); free (fmri); svc_object_set_property_string (new_svc, "Unit.Strategy", "exec"); svc_object_set_property_string ( new_svc, "Unit.Description", "The S16 Service Configuration Repository."); /* how shall we identify the location of s16 binaries? */ svc_object_set_property_string (new_svc, "Method.Prestart", "/bin/echo PreStart"); svc_object_set_property_string (new_svc, "Method.Start", "/bin/sleep 7"); svc_object_set_property_string (new_svc, "Method.Poststart", "/bin/echo Execed poststart"); /* "out/freebsd.amd64/debug/stage/bin/s16.repositoryd");*/ s16_inst_new_default (new_svc); inst_list_lget (new_svc->instances)->id = 1; unit_list_add (Manager.units, unit_new (new_svc, inst_list_lget (new_svc->instances))); }
svc_t * rpc_svc_to_svc (rpc_svc_t * rsvc) { RETURN_IF_NULL (rsvc); register unsigned i_index; svc_t * newSvc = s16_svc_new (); newSvc->id = rsvc->id; newSvc->name = s16mem_strdup (rsvc->name); newSvc->properties = rpc_property_array_to_property_list ( rsvc->properties.properties_val, rsvc->properties.properties_len); newSvc->instances = 0; if (rsvc->instances.instances_len > 0) { for (i_index = 0; i_index < rsvc->instances.instances_len; i_index++) inst_list_add (newSvc->instances, rpc_svc_instance_to_svc_instance ( &rsvc->instances.instances_val[i_index])); } return newSvc; }