removed. If the list of capabilities
is prefixed with ~ all but the listed
capabilities will be included, the
- effect of this assignment
+ effect of the assignment
inverted. Note that this option does
not actually set or unset any
capabilities in the effective,
LSB_DESCRIPTION
} state = NORMAL;
char *short_description = NULL, *long_description = NULL, *chkconfig_description = NULL, *description;
+ struct stat st;
assert(s);
assert(path);
goto finish;
}
+ zero(st);
+ if (fstat(fileno(f), &st) < 0) {
+ r = -errno;
+ goto finish;
+ }
+
free(s->sysv_path);
if (!(s->sysv_path = strdup(path))) {
r = -ENOMEM;
goto finish;
}
+ s->sysv_mtime = timespec_load(&st.st_mtim);
+
+ if (null_or_empty(&st)) {
+ u->meta.load_state = UNIT_MASKED;
+ r = 0;
+ goto finish;
+ }
+
while (!feof(f)) {
char l[LINE_MAX], *t;
s->failure = false;
}
+static bool service_need_daemon_reload(Unit *u) {
+ Service *s = SERVICE(u);
+
+ assert(s);
+
+#ifdef HAVE_SYSV_COMPAT
+ if (s->sysv_path) {
+ struct stat st;
+
+ zero(st);
+ if (stat(s->sysv_path, &st) < 0)
+ /* What, cannot access this anymore? */
+ return true;
+
+ if (s->sysv_mtime > 0 &&
+ timespec_load(&st.st_mtim) != s->sysv_mtime)
+ return true;
+ }
+#endif
+
+ return false;
+}
+
static int service_kill(Unit *u, KillWho who, KillMode mode, int signo, DBusError *error) {
Service *s = SERVICE(u);
int r = 0;
.reset_failed = service_reset_failed,
+ .need_daemon_reload = service_need_daemon_reload,
+
.cgroup_notify_empty = service_cgroup_notify_event,
.notify_message = service_notify_message,
char *sysv_path;
char *sysv_runlevels;
+ usec_t sysv_mtime;
#endif
char *bus_name;
}
bool unit_need_daemon_reload(Unit *u) {
- struct stat st;
-
assert(u);
- if (!u->meta.fragment_path)
- return false;
+ if (u->meta.fragment_path) {
+ struct stat st;
- zero(st);
- if (stat(u->meta.fragment_path, &st) < 0)
- /* What, cannot access this anymore? */
- return true;
+ zero(st);
+ if (stat(u->meta.fragment_path, &st) < 0)
+ /* What, cannot access this anymore? */
+ return true;
- return
- u->meta.fragment_mtime &&
- timespec_load(&st.st_mtim) != u->meta.fragment_mtime;
+ if (u->meta.fragment_mtime > 0 &&
+ timespec_load(&st.st_mtim) != u->meta.fragment_mtime)
+ return true;
+ }
+
+ if (UNIT_VTABLE(u)->need_daemon_reload)
+ return UNIT_VTABLE(u)->need_daemon_reload(u);
+
+ return false;
}
void unit_reset_failed(Unit *u) {
void (*sigchld_event)(Unit *u, pid_t pid, int code, int status);
void (*timer_event)(Unit *u, uint64_t n_elapsed, Watch *w);
+ /* Check whether unit needs a daemon reload */
+ bool (*need_daemon_reload)(Unit *u);
+
/* Reset failed state if we are in failed state */
void (*reset_failed)(Unit *u);