1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-10-28 03:25:27 +03:00

add api for choose the id name for a service

This commit is contained in:
Lennart Poettering 2010-01-29 01:49:34 +01:00
parent 4fe88d28a4
commit 0ae97ec115
2 changed files with 17 additions and 0 deletions

15
unit.c
View File

@ -155,6 +155,21 @@ int unit_add_name(Unit *u, const char *text) {
return 0;
}
int unit_choose_id(Unit *u, const char *name) {
char *s;
assert(u);
assert(name);
/* Selects one of the names of this unit as the id */
if (!(s = set_get(u->meta.names, (char*) name)))
return -ENOENT;
u->meta.id = s;
return 0;
}
void unit_add_to_load_queue(Unit *u) {
assert(u);

2
unit.h
View File

@ -201,6 +201,8 @@ int unit_add_name(Unit *u, const char *name);
int unit_add_dependency(Unit *u, UnitDependency d, Unit *other);
int unit_add_dependency_by_name(Unit *u, UnitDependency d, const char *name);
int unit_choose_id(Unit *u, const char *name);
void unit_add_to_load_queue(Unit *u);
int unit_merge(Unit *u, Unit *other);