X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fload-fragment.c;h=1a87a96194118a6284dde9ceb0421691e9469ffb;hp=cd66b2dd141bfd2d5ff190bb888097d646af9a86;hb=0dcc78574905ca0e31694238662002bd36ca65d4;hpb=8f05424d50045ffd85912e4df36618e8aabd8988 diff --git a/src/load-fragment.c b/src/load-fragment.c index cd66b2dd1..1a87a9619 100644 --- a/src/load-fragment.c +++ b/src/load-fragment.c @@ -1566,7 +1566,8 @@ static int load_from_path(Unit *u, const char *path) { { "OnFailure", config_parse_deps, UINT_TO_PTR(UNIT_ON_FAILURE), "Unit" }, { "RecursiveStop", config_parse_bool, &u->meta.recursive_stop, "Unit" }, { "StopWhenUnneeded", config_parse_bool, &u->meta.stop_when_unneeded, "Unit" }, - { "OnlyByDependency", config_parse_bool, &u->meta.only_by_dependency, "Unit" }, + { "RefuseManualStart", config_parse_bool, &u->meta.refuse_manual_start, "Unit" }, + { "RefuseManualStop", config_parse_bool, &u->meta.refuse_manual_stop, "Unit" }, { "DefaultDependencies", config_parse_bool, &u->meta.default_dependencies, "Unit" }, { "IgnoreDependencyFailure",config_parse_bool, &u->meta.ignore_dependency_failure, "Unit" }, { "JobTimeoutSec", config_parse_usec, &u->meta.job_timeout, "Unit" }, @@ -1616,6 +1617,7 @@ static int load_from_path(Unit *u, const char *path) { { "Mark", config_parse_int, &u->socket.mark, "Socket" }, { "PipeSize", config_parse_size, &u->socket.pipe_size, "Socket" }, { "FreeBind", config_parse_bool, &u->socket.free_bind, "Socket" }, + { "TCPCongestion", config_parse_string, &u->socket.tcp_congestion, "Socket" }, EXEC_CONTEXT_CONFIG_ITEMS(u->socket.exec_context, "Socket"), { "What", config_parse_string, &u->mount.parameters_fragment.what, "Mount" }, @@ -1780,68 +1782,69 @@ finish: int unit_load_fragment(Unit *u) { int r; + Iterator i; + const char *t; assert(u); + assert(u->meta.load_state == UNIT_STUB); + assert(u->meta.id); - if (u->meta.fragment_path) { + /* First, try to find the unit under its id. We always look + * for unit files in the default directories, to make it easy + * to override things by placing things in /etc/systemd/system */ + if ((r = load_from_path(u, u->meta.id)) < 0) + return r; + + /* Try to find an alias we can load this with */ + if (u->meta.load_state == UNIT_STUB) + SET_FOREACH(t, u->meta.names, i) { + + if (t == u->meta.id) + continue; + + if ((r = load_from_path(u, t)) < 0) + return r; + + if (u->meta.load_state != UNIT_STUB) + break; + } + /* And now, try looking for it under the suggested (originally linked) path */ + if (u->meta.load_state == UNIT_STUB && u->meta.fragment_path) if ((r = load_from_path(u, u->meta.fragment_path)) < 0) return r; - } else { - Iterator i; - const char *t; + /* Look for a template */ + if (u->meta.load_state == UNIT_STUB && u->meta.instance) { + char *k; + + if (!(k = unit_name_template(u->meta.id))) + return -ENOMEM; + + r = load_from_path(u, k); + free(k); - /* Try to find the unit under its id */ - if ((r = load_from_path(u, u->meta.id)) < 0) + if (r < 0) return r; - /* Try to find an alias we can load this with */ if (u->meta.load_state == UNIT_STUB) SET_FOREACH(t, u->meta.names, i) { if (t == u->meta.id) continue; - if ((r = load_from_path(u, t)) < 0) + if (!(k = unit_name_template(t))) + return -ENOMEM; + + r = load_from_path(u, k); + free(k); + + if (r < 0) return r; if (u->meta.load_state != UNIT_STUB) break; } - - /* Now, follow the same logic, but look for a template */ - if (u->meta.load_state == UNIT_STUB && u->meta.instance) { - char *k; - - if (!(k = unit_name_template(u->meta.id))) - return -ENOMEM; - - r = load_from_path(u, k); - free(k); - - if (r < 0) - return r; - - if (u->meta.load_state == UNIT_STUB) - SET_FOREACH(t, u->meta.names, i) { - - if (t == u->meta.id) - continue; - - if (!(k = unit_name_template(t))) - return -ENOMEM; - - r = load_from_path(u, k); - free(k); - - if (r < 0) - return r; - - if (u->meta.load_state != UNIT_STUB) - break; - } - } } return 0;