summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dbus-execute.c6
-rw-r--r--src/dbus-execute.h4
-rw-r--r--src/dbus-timer.c37
-rw-r--r--src/execute.c8
-rw-r--r--src/execute.h4
-rw-r--r--src/load-fragment.c18
-rw-r--r--src/timer.c10
7 files changed, 52 insertions, 35 deletions
diff --git a/src/dbus-execute.c b/src/dbus-execute.c
index 529f72dfa0..d37bd5560e 100644
--- a/src/dbus-execute.c
+++ b/src/dbus-execute.c
@@ -171,7 +171,7 @@ int bus_execute_append_affinity(Manager *m, DBusMessageIter *i, const char *prop
return 0;
}
-int bus_execute_append_timer_slack_ns(Manager *m, DBusMessageIter *i, const char *property, void *data) {
+int bus_execute_append_timer_slack_nsec(Manager *m, DBusMessageIter *i, const char *property, void *data) {
ExecContext *c = data;
uint64_t u;
@@ -180,8 +180,8 @@ int bus_execute_append_timer_slack_ns(Manager *m, DBusMessageIter *i, const char
assert(property);
assert(c);
- if (c->timer_slack_ns_set)
- u = (uint64_t) c->timer_slack_ns_set;
+ if (c->timer_slack_nsec_set)
+ u = (uint64_t) c->timer_slack_nsec;
else
u = (uint64_t) prctl(PR_GET_TIMERSLACK);
diff --git a/src/dbus-execute.h b/src/dbus-execute.h
index 95d400d28b..5208159695 100644
--- a/src/dbus-execute.h
+++ b/src/dbus-execute.h
@@ -115,7 +115,7 @@
{ interface, "CPUSchedulingPolicy", bus_execute_append_cpu_sched_policy, "i", &(context) }, \
{ interface, "CPUSchedulingPriority", bus_execute_append_cpu_sched_priority, "i", &(context) }, \
{ interface, "CPUAffinity", bus_execute_append_affinity,"ay", &(context) }, \
- { interface, "TimerSlackNS", bus_execute_append_timer_slack_ns, "t", &(context) }, \
+ { interface, "TimerSlackNSec", bus_execute_append_timer_slack_nsec, "t", &(context) }, \
{ interface, "CPUSchedulingResetOnFork", bus_property_append_bool, "b", &(context).cpu_sched_reset_on_fork }, \
{ interface, "NonBlocking", bus_property_append_bool, "b", &(context).non_blocking }, \
{ interface, "StandardInput", bus_execute_append_input, "s", &(context).std_input }, \
@@ -158,7 +158,7 @@ int bus_execute_append_ioprio(Manager *m, DBusMessageIter *i, const char *proper
int bus_execute_append_cpu_sched_policy(Manager *m, DBusMessageIter *i, const char *property, void *data);
int bus_execute_append_cpu_sched_priority(Manager *m, DBusMessageIter *i, const char *property, void *data);
int bus_execute_append_affinity(Manager *m, DBusMessageIter *i, const char *property, void *data);
-int bus_execute_append_timer_slack_ns(Manager *m, DBusMessageIter *i, const char *property, void *data);
+int bus_execute_append_timer_slack_nsec(Manager *m, DBusMessageIter *i, const char *property, void *data);
int bus_execute_append_capabilities(Manager *m, DBusMessageIter *i, const char *property, void *data);
int bus_execute_append_rlimits(Manager *m, DBusMessageIter *i, const char *property, void *data);
int bus_execute_append_command(Manager *m, DBusMessageIter *u, const char *property, void *data);
diff --git a/src/dbus-timer.c b/src/dbus-timer.c
index d548227b5a..0cd37d9718 100644
--- a/src/dbus-timer.c
+++ b/src/dbus-timer.c
@@ -29,7 +29,7 @@
" <interface name=\"org.freedesktop.systemd1.Timer\">\n" \
" <property name=\"Unit\" type=\"s\" access=\"read\"/>\n" \
" <property name=\"Timers\" type=\"a(stt)\" access=\"read\"/>\n" \
- " <property name=\"NextElapse\" type=\"t\" access=\"read\"/>\n" \
+ " <property name=\"NextElapseUSec\" type=\"t\" access=\"read\"/>\n" \
" </interface>\n"
#define INTROSPECTION \
@@ -57,13 +57,30 @@ static int bus_timer_append_timers(Manager *m, DBusMessageIter *i, const char *p
return -ENOMEM;
LIST_FOREACH(value, k, p->values) {
- const char *t = timer_base_to_string(k->base);
+ char *buf;
+ const char *t;
+ size_t l;
+ bool b;
- if (!dbus_message_iter_open_container(&sub, DBUS_TYPE_STRUCT, NULL, &sub2) ||
- !dbus_message_iter_append_basic(&sub2, DBUS_TYPE_STRING, &t) ||
- !dbus_message_iter_append_basic(&sub2, DBUS_TYPE_UINT64, &k->value) ||
- !dbus_message_iter_append_basic(&sub2, DBUS_TYPE_UINT64, &k->next_elapse) ||
- !dbus_message_iter_close_container(&sub, &sub2))
+ t = timer_base_to_string(k->base);
+ assert(endswith(t, "Sec"));
+
+ /* s/Sec/USec/ */
+ l = strlen(t);
+ if (!(buf = new(char, l+2)))
+ return -ENOMEM;
+
+ memcpy(buf, t, l-3);
+ memcpy(buf+l-3, "USec", 5);
+
+ b = dbus_message_iter_open_container(&sub, DBUS_TYPE_STRUCT, NULL, &sub2) &&
+ dbus_message_iter_append_basic(&sub2, DBUS_TYPE_STRING, &buf) &&
+ dbus_message_iter_append_basic(&sub2, DBUS_TYPE_UINT64, &k->value) &&
+ dbus_message_iter_append_basic(&sub2, DBUS_TYPE_UINT64, &k->next_elapse) &&
+ dbus_message_iter_close_container(&sub, &sub2);
+
+ free(buf);
+ if (!b)
return -ENOMEM;
}
@@ -76,9 +93,9 @@ static int bus_timer_append_timers(Manager *m, DBusMessageIter *i, const char *p
DBusHandlerResult bus_timer_message_handler(Unit *u, DBusConnection *c, DBusMessage *message) {
const BusProperty properties[] = {
BUS_UNIT_PROPERTIES,
- { "org.freedesktop.systemd1.Timer", "Unit", bus_property_append_string, "s", u->timer.unit->meta.id },
- { "org.freedesktop.systemd1.Timer", "Timers", bus_timer_append_timers, "a(stt)", u },
- { "org.freedesktop.systemd1.Timer", "NextElapse", bus_property_append_usec, "t", &u->timer.next_elapse },
+ { "org.freedesktop.systemd1.Timer", "Unit", bus_property_append_string, "s", u->timer.unit->meta.id },
+ { "org.freedesktop.systemd1.Timer", "Timers", bus_timer_append_timers, "a(stt)", u },
+ { "org.freedesktop.systemd1.Timer", "NextElapseUSec", bus_property_append_usec, "t", &u->timer.next_elapse },
{ NULL, NULL, NULL, NULL, NULL }
};
diff --git a/src/execute.c b/src/execute.c
index f3f95ff754..982b7d1bcd 100644
--- a/src/execute.c
+++ b/src/execute.c
@@ -1083,8 +1083,8 @@ int exec_spawn(ExecCommand *command,
goto fail;
}
- if (context->timer_slack_ns_set)
- if (prctl(PR_SET_TIMERSLACK, context->timer_slack_ns_set) < 0) {
+ if (context->timer_slack_nsec_set)
+ if (prctl(PR_SET_TIMERSLACK, context->timer_slack_nsec) < 0) {
r = EXIT_TIMERSLACK;
goto fail;
}
@@ -1468,8 +1468,8 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) {
fputs("\n", f);
}
- if (c->timer_slack_ns_set)
- fprintf(f, "%sTimerSlackNS: %lu\n", prefix, c->timer_slack_ns);
+ if (c->timer_slack_nsec_set)
+ fprintf(f, "%sTimerSlackNSec: %lu\n", prefix, c->timer_slack_nsec);
fprintf(f,
"%sStandardInput: %s\n"
diff --git a/src/execute.h b/src/execute.h
index aa5f566677..1ab6a24d9b 100644
--- a/src/execute.h
+++ b/src/execute.h
@@ -95,7 +95,7 @@ struct ExecContext {
cpu_set_t *cpuset;
unsigned cpuset_ncpus;
- unsigned long timer_slack_ns;
+ unsigned long timer_slack_nsec;
ExecInput std_input;
ExecOutput std_output;
@@ -135,7 +135,7 @@ struct ExecContext {
bool nice_set:1;
bool ioprio_set:1;
bool cpu_sched_set:1;
- bool timer_slack_ns_set:1;
+ bool timer_slack_nsec_set:1;
/* This is not exposed to the user but available
* internally. We need it to make sure that whenever we spawn
diff --git a/src/load-fragment.c b/src/load-fragment.c
index a5ea0e41b0..8e777fdbcf 100644
--- a/src/load-fragment.c
+++ b/src/load-fragment.c
@@ -857,7 +857,7 @@ static int config_parse_bounding_set(
return 0;
}
-static int config_parse_timer_slack_ns(
+static int config_parse_timer_slack_nsec(
const char *filename,
unsigned line,
const char *section,
@@ -880,7 +880,7 @@ static int config_parse_timer_slack_ns(
return r;
}
- c->timer_slack_ns = u;
+ c->timer_slack_nsec = u;
return 0;
}
@@ -1373,7 +1373,7 @@ static void dump_items(FILE *f, const ConfigItem *items) {
{ config_parse_capabilities, "CAPABILITIES" },
{ config_parse_secure_bits, "SECUREBITS" },
{ config_parse_bounding_set, "BOUNDINGSET" },
- { config_parse_timer_slack_ns, "TIMERSLACK" },
+ { config_parse_timer_slack_nsec, "TIMERSLACK" },
{ config_parse_limit, "LIMIT" },
{ config_parse_cgroup, "CGROUP [...]" },
{ config_parse_deps, "UNIT [...]" },
@@ -1468,7 +1468,7 @@ static int load_from_path(Unit *u, const char *path) {
{ "Capabilities", config_parse_capabilities, &(context), section }, \
{ "SecureBits", config_parse_secure_bits, &(context), section }, \
{ "CapabilityBoundingSetDrop", config_parse_bounding_set, &(context), section }, \
- { "TimerSlackNS", config_parse_timer_slack_ns, &(context), section }, \
+ { "TimerSlackNSec", config_parse_timer_slack_nsec,&(context), section }, \
{ "LimitCPU", config_parse_limit, &(context).rlimit[RLIMIT_CPU], section }, \
{ "LimitFSIZE", config_parse_limit, &(context).rlimit[RLIMIT_FSIZE], section }, \
{ "LimitDATA", config_parse_limit, &(context).rlimit[RLIMIT_DATA], section }, \
@@ -1574,11 +1574,11 @@ static int load_from_path(Unit *u, const char *path) {
{ "What", config_parse_path, &u->swap.parameters_fragment.what, "Swap" },
{ "Priority", config_parse_int, &u->swap.parameters_fragment.priority, "Swap" },
- { "OnActive", config_parse_timer, &u->timer, "Timer" },
- { "OnBoot", config_parse_timer, &u->timer, "Timer" },
- { "OnStartup", config_parse_timer, &u->timer, "Timer" },
- { "OnUnitActive", config_parse_timer, &u->timer, "Timer" },
- { "OnUnitInactive", config_parse_timer, &u->timer, "Timer" },
+ { "OnActiveSec", config_parse_timer, &u->timer, "Timer" },
+ { "OnBootSec", config_parse_timer, &u->timer, "Timer" },
+ { "OnStartupSec", config_parse_timer, &u->timer, "Timer" },
+ { "OnUnitActiveSec", config_parse_timer, &u->timer, "Timer" },
+ { "OnUnitInactiveSec", config_parse_timer, &u->timer, "Timer" },
{ "Unit", config_parse_timer_unit, &u->timer, "Timer" },
{ "PathExists", config_parse_path_spec, &u->path, "Path" },
diff --git a/src/timer.c b/src/timer.c
index e3c916bb0f..b4521e6efc 100644
--- a/src/timer.c
+++ b/src/timer.c
@@ -440,11 +440,11 @@ static const char* const timer_state_table[_TIMER_STATE_MAX] = {
DEFINE_STRING_TABLE_LOOKUP(timer_state, TimerState);
static const char* const timer_base_table[_TIMER_BASE_MAX] = {
- [TIMER_ACTIVE] = "OnActive",
- [TIMER_BOOT] = "OnBoot",
- [TIMER_STARTUP] = "OnStartup",
- [TIMER_UNIT_ACTIVE] = "OnUnitActive",
- [TIMER_UNIT_INACTIVE] = "OnUnitInactive"
+ [TIMER_ACTIVE] = "OnActiveSec",
+ [TIMER_BOOT] = "OnBootSec",
+ [TIMER_STARTUP] = "OnStartupSec",
+ [TIMER_UNIT_ACTIVE] = "OnUnitActiveSec",
+ [TIMER_UNIT_INACTIVE] = "OnUnitInactiveSec"
};
DEFINE_STRING_TABLE_LOOKUP(timer_base, TimerBase);