2 This file is part of systemd.
4 Copyright 2010 Lennart Poettering
6 systemd is free software; you can redistribute it and/or modify it
7 under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation; either version 2.1 of the License, or
9 (at your option) any later version.
11 systemd is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public License
17 along with systemd; If not, see <http://www.gnu.org/licenses/>.
21 #include "conf-parser.h"
22 #include "load-dropin.h"
23 #include "load-fragment.h"
26 #include "unit-name.h"
29 static int add_dependency_consumer(
30 UnitDependency dependency
,
39 r
= unit_add_dependency_by_name(u
, dependency
, entry
, filepath
, true);
41 log_error_errno(r
, "Cannot add dependency %s to %s, ignoring: %m", entry
, u
->id
);
46 int unit_load_dropin(Unit
*u
) {
53 /* Load dependencies from supplementary drop-in directories */
55 SET_FOREACH(t
, u
->names
, i
) {
58 STRV_FOREACH(p
, u
->manager
->lookup_paths
.unit_path
) {
59 unit_file_process_dir(u
->manager
->unit_path_cache
, *p
, t
, ".wants", UNIT_WANTS
,
60 add_dependency_consumer
, u
, NULL
);
61 unit_file_process_dir(u
->manager
->unit_path_cache
, *p
, t
, ".requires", UNIT_REQUIRES
,
62 add_dependency_consumer
, u
, NULL
);
66 u
->dropin_paths
= strv_free(u
->dropin_paths
);
67 r
= unit_find_dropin_paths(u
, &u
->dropin_paths
);
71 STRV_FOREACH(f
, u
->dropin_paths
) {
72 config_parse(u
->id
, *f
, NULL
,
73 UNIT_VTABLE(u
)->sections
,
74 config_item_perf_lookup
, load_fragment_gperf_lookup
,
75 false, false, false, u
);
78 u
->dropin_mtime
= now(CLOCK_REALTIME
);