Пример #1
0
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)));
}
Пример #2
0
svc_id_t * instance_create_1_svc (svc_id_t id, char * name,
                                  struct svc_req * req)
{
    static svc_id_t result;
    svc_t * svc;

    if (!(svc = svc_find_id (RD.services, id)))
        return 0;

    if (strcmp (name, "default"))
        result = s16_inst_new_default (svc);
    else
        result = s16_inst_new (svc, name);

    return &result;
}