chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
journalctl: allow globbing in --unit and --user-unit
[elogind.git]
/
src
/
core
/
unit.c
diff --git
a/src/core/unit.c
b/src/core/unit.c
index 31d5f113f7ea2ae7c7ea071cd6fe345c8342695c..e3b620603cf2c489ba10e5063a7e923a8bd5d2ee 100644
(file)
--- a/
src/core/unit.c
+++ b/
src/core/unit.c
@@
-53,14
+53,15
@@
const UnitVTable * const unit_vtable[_UNIT_TYPE_MAX] = {
[UNIT_SERVICE] = &service_vtable,
const UnitVTable * const unit_vtable[_UNIT_TYPE_MAX] = {
[UNIT_SERVICE] = &service_vtable,
- [UNIT_TIMER] = &timer_vtable,
[UNIT_SOCKET] = &socket_vtable,
[UNIT_SOCKET] = &socket_vtable,
+ [UNIT_BUSNAME] = &busname_vtable,
[UNIT_TARGET] = &target_vtable,
[UNIT_TARGET] = &target_vtable,
+ [UNIT_SNAPSHOT] = &snapshot_vtable,
[UNIT_DEVICE] = &device_vtable,
[UNIT_MOUNT] = &mount_vtable,
[UNIT_AUTOMOUNT] = &automount_vtable,
[UNIT_DEVICE] = &device_vtable,
[UNIT_MOUNT] = &mount_vtable,
[UNIT_AUTOMOUNT] = &automount_vtable,
- [UNIT_SNAPSHOT] = &snapshot_vtable,
[UNIT_SWAP] = &swap_vtable,
[UNIT_SWAP] = &swap_vtable,
+ [UNIT_TIMER] = &timer_vtable,
[UNIT_PATH] = &path_vtable,
[UNIT_SLICE] = &slice_vtable,
[UNIT_SCOPE] = &scope_vtable
[UNIT_PATH] = &path_vtable,
[UNIT_SLICE] = &slice_vtable,
[UNIT_SCOPE] = &scope_vtable
@@
-118,7
+119,7
@@
int unit_add_name(Unit *u, const char *text) {
if (!s)
return -ENOMEM;
if (!s)
return -ENOMEM;
- if (!unit_name_is_valid(s,
false
)) {
+ if (!unit_name_is_valid(s,
TEMPLATE_INVALID
)) {
r = -EINVAL;
goto fail;
}
r = -EINVAL;
goto fail;
}
@@
-1124,6
+1125,8
@@
_pure_ static const char *unit_get_status_message_format_try_harder(Unit *u, Job
return NULL;
}
return NULL;
}
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static void unit_status_print_starting_stopping(Unit *u, JobType t) {
const char *format;
static void unit_status_print_starting_stopping(Unit *u, JobType t) {
const char *format;
@@
-1138,6
+1141,7
@@
static void unit_status_print_starting_stopping(Unit *u, JobType t) {
unit_status_printf(u, "", format);
}
unit_status_printf(u, "", format);
}
+#pragma GCC diagnostic pop
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
@@
-1300,8
+1304,11
@@
int unit_reload(Unit *u) {
if (state == UNIT_RELOADING)
return -EALREADY;
if (state == UNIT_RELOADING)
return -EALREADY;
- if (state != UNIT_ACTIVE)
+ if (state != UNIT_ACTIVE) {
+ log_warning_unit(u->id, "Unit %s cannot be reloaded because it is inactive.",
+ u->id);
return -ENOEXEC;
return -ENOEXEC;
+ }
following = unit_following(u);
if (following) {
following = unit_following(u);
if (following) {
@@
-1844,7
+1851,7
@@
static const char *resolve_template(Unit *u, const char *name, const char*path,
assert(p);
if (!name)
assert(p);
if (!name)
- name =
path_get_file_
name(path);
+ name =
base
name(path);
if (!unit_name_is_template(name)) {
*p = NULL;
if (!unit_name_is_template(name)) {
*p = NULL;
@@
-2611,7
+2618,7
@@
UnitFileState unit_get_unit_file_state(Unit *u) {
if (u->unit_file_state < 0 && u->fragment_path)
u->unit_file_state = unit_file_get_state(
u->manager->running_as == SYSTEMD_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER,
if (u->unit_file_state < 0 && u->fragment_path)
u->unit_file_state = unit_file_get_state(
u->manager->running_as == SYSTEMD_SYSTEM ? UNIT_FILE_SYSTEM : UNIT_FILE_USER,
- NULL,
path_get_file_
name(u->fragment_path));
+ NULL,
base
name(u->fragment_path));
return u->unit_file_state;
}
return u->unit_file_state;
}