]> git.ipfire.org Git - thirdparty/systemd.git/blame - timer.c
first attempt in implementinging execution logic
[thirdparty/systemd.git] / timer.c
CommitLineData
5cb5a6ff
LP
1/*-*- Mode: C; c-basic-offset: 8 -*-*/
2
3#include "name.h"
4#include "timer.h"
5
6static NameActiveState timer_active_state(Name *n) {
7
8 static const NameActiveState table[_TIMER_STATE_MAX] = {
9 [TIMER_DEAD] = NAME_INACTIVE,
10 [TIMER_WAITING] = NAME_ACTIVE,
11 [TIMER_RUNNING] = NAME_ACTIVE
12 };
13
14 return table[TIMER(n)->state];
15}
16
17static void timer_free_hook(Name *n) {
18 Timer *t = TIMER(n);
19
20 assert(t);
21
22 if (t->service)
23 t->service->timer = NULL;
24}
25
26const NameVTable timer_vtable = {
27 .suffix = ".timer",
28
29 .load = name_load_fragment_and_dropin,
30 .dump = NULL,
31
32 .start = NULL,
33 .stop = NULL,
34 .reload = NULL,
35
36 .active_state = timer_active_state,
37
38 .free_hook = timer_free_hook
39};