chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
socket: properly serialize/desrialize mqueue fds
[elogind.git]
/
src
/
core
/
unit.c
diff --git
a/src/core/unit.c
b/src/core/unit.c
index 6396bfc09f733e0734112c77147564bbd1531ace..45453dce64a6464899721ad5f7c133fcac4e418f 100644
(file)
--- a/
src/core/unit.c
+++ b/
src/core/unit.c
@@
-1438,7
+1438,10
@@
void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su
check_unneeded_dependencies(u);
if (ns != os && ns == UNIT_FAILED) {
check_unneeded_dependencies(u);
if (ns != os && ns == UNIT_FAILED) {
- log_notice("Unit %s entered failed state.", u->id);
+ log_struct(LOG_NOTICE,
+ "MESSAGE=Unit %s entered failed state", u->id,
+ "UNIT=%s", u->id,
+ NULL);
unit_trigger_on_failure(u);
}
}
unit_trigger_on_failure(u);
}
}
@@
-1557,7
+1560,7
@@
void unit_unwatch_pid(Unit *u, pid_t pid) {
hashmap_remove_value(u->manager->watch_pids, LONG_TO_PTR(pid), u);
}
hashmap_remove_value(u->manager->watch_pids, LONG_TO_PTR(pid), u);
}
-int unit_watch_timer(Unit *u,
usec_t delay
, Watch *w) {
+int unit_watch_timer(Unit *u,
clockid_t clock_id, bool relative, usec_t usec
, Watch *w) {
struct itimerspec its;
int flags, fd;
bool ours;
struct itimerspec its;
int flags, fd;
bool ours;
@@
-1577,14
+1580,15
@@
int unit_watch_timer(Unit *u, usec_t delay, Watch *w) {
} else if (w->type == WATCH_INVALID) {
ours = true;
} else if (w->type == WATCH_INVALID) {
ours = true;
- if ((fd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK|TFD_CLOEXEC)) < 0)
+ fd = timerfd_create(clock_id, TFD_NONBLOCK|TFD_CLOEXEC);
+ if (fd < 0)
return -errno;
} else
assert_not_reached("Invalid watch type");
zero(its);
return -errno;
} else
assert_not_reached("Invalid watch type");
zero(its);
- if (
delay
<= 0) {
+ if (
usec
<= 0) {
/* Set absolute time in the past, but not 0, since we
* don't want to disarm the timer */
its.it_value.tv_sec = 0;
/* Set absolute time in the past, but not 0, since we
* don't want to disarm the timer */
its.it_value.tv_sec = 0;
@@
-1592,8
+1596,8
@@
int unit_watch_timer(Unit *u, usec_t delay, Watch *w) {
flags = TFD_TIMER_ABSTIME;
} else {
flags = TFD_TIMER_ABSTIME;
} else {
- timespec_store(&its.it_value,
delay
);
- flags =
0
;
+ timespec_store(&its.it_value,
usec
);
+ flags =
relative ? 0 : TFD_TIMER_ABSTIME
;
}
/* This will also flush the elapse counter */
}
/* This will also flush the elapse counter */