Beispiel #1
0
static int target_add_default_dependencies(Target *t) {

        static const UnitDependency deps[] = {
                UNIT_REQUIRES,
                UNIT_REQUISITE,
                UNIT_WANTS,
                UNIT_BINDS_TO,
                UNIT_PART_OF
        };

        Iterator i;
        Unit *other;
        int r;
        unsigned k;

        assert(t);

        /* Imply ordering for requirement dependencies on target
         * units. Note that when the user created a contradicting
         * ordering manually we won't add anything in here to make
         * sure we don't create a loop. */

        for (k = 0; k < ELEMENTSOF(deps); k++)
                SET_FOREACH(other, UNIT(t)->dependencies[deps[k]], i) {
                        r = unit_add_default_target_dependency(other, UNIT(t));
                        if (r < 0)
                                return r;
                }
Beispiel #2
0
static int target_add_default_dependencies(Target *t) {
        static const UnitDependency deps[] = {
                UNIT_REQUIRES,
                UNIT_REQUIRES_OVERRIDABLE,
                UNIT_REQUISITE,
                UNIT_REQUISITE_OVERRIDABLE,
                UNIT_WANTS,
                UNIT_BINDS_TO
        };

        Iterator i;
        Unit *other;
        int r;
        unsigned k;

        assert(t);

        /* Imply ordering for requirement dependencies on target
         * units. Note that when the user created a contradicting
         * ordering manually we won't add anything in here to make
         * sure we don't create a loop. */

        for (k = 0; k < ELEMENTSOF(deps); k++)
                SET_FOREACH(other, UNIT(t)->dependencies[deps[k]], i)
                        if ((r = unit_add_default_target_dependency(other, UNIT(t))) < 0)
                                return r;

        /* Make sure targets are unloaded on shutdown */
        return unit_add_dependency_by_name(UNIT(t), UNIT_CONFLICTS, SPECIAL_SHUTDOWN_TARGET, NULL, true);
}