[systemd-commits] 4 commits - src/shared src/timedate src/tmpfiles units/systemd-backlight at .service.in units/systemd-journal-catalog-update.service.in units/systemd-journal-flush.service.in
Lennart Poettering
lennart at kemper.freedesktop.org
Mon Feb 2 12:35:34 PST 2015
src/shared/macro.h | 3 +-
src/shared/time-util.h | 2 +
src/timedate/timedatectl.c | 2 -
src/tmpfiles/tmpfiles.c | 28 +++++++++++-------------
units/systemd-backlight at .service.in | 2 -
units/systemd-journal-catalog-update.service.in | 2 -
units/systemd-journal-flush.service.in | 2 -
7 files changed, 20 insertions(+), 21 deletions(-)
New commits:
commit 75f709fbf284041d951717cfb3bf6304db0fa7c9
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Feb 2 21:34:32 2015 +0100
units: so far we defaulted to 90s as default timeout for most things, let's do so for our oneshot services too
Fewer surprises, and stuff...
diff --git a/units/systemd-backlight at .service.in b/units/systemd-backlight at .service.in
index 19d640b..5e6706c 100644
--- a/units/systemd-backlight at .service.in
+++ b/units/systemd-backlight at .service.in
@@ -19,4 +19,4 @@ Type=oneshot
RemainAfterExit=yes
ExecStart=@rootlibexecdir@/systemd-backlight load %i
ExecStop=@rootlibexecdir@/systemd-backlight save %i
-TimeoutSec=2min
+TimeoutSec=90s
diff --git a/units/systemd-journal-catalog-update.service.in b/units/systemd-journal-catalog-update.service.in
index 9667310..6370dd4 100644
--- a/units/systemd-journal-catalog-update.service.in
+++ b/units/systemd-journal-catalog-update.service.in
@@ -18,4 +18,4 @@ ConditionNeedsUpdate=/etc
Type=oneshot
RemainAfterExit=yes
ExecStart=@rootbindir@/journalctl --update-catalog
-TimeoutSec=2min
+TimeoutSec=90s
diff --git a/units/systemd-journal-flush.service.in b/units/systemd-journal-flush.service.in
index 53a6f30..a0a2e3f 100644
--- a/units/systemd-journal-flush.service.in
+++ b/units/systemd-journal-flush.service.in
@@ -19,4 +19,4 @@ RequiresMountsFor=/var/log/journal
ExecStart=@rootbindir@/journalctl --flush
Type=oneshot
RemainAfterExit=yes
-TimeoutSec=2min
+TimeoutSec=90s
commit 7a7d5db71f12ae6f3c055b88a85f6bc9305ea1c4
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Feb 2 21:34:09 2015 +0100
tmpfiles: let's always use DEFINE_PRIVATE_STRING_TABLE_LOOKUP_TO_STRING() instead of defining our own string tables
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index 0e1bd86..930b9a6 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -907,19 +907,17 @@ typedef enum {
CREATION_NORMAL,
CREATION_EXISTING,
CREATION_FORCE,
+ _CREATION_MODE_MAX,
+ _CREATION_MODE_INVALID = -1
} CreationMode;
-static const char* creation_verb(CreationMode mode) {
- switch(mode) {
- case CREATION_NORMAL:
- return "Created";
- case CREATION_EXISTING:
- return "Found existing";
- case CREATION_FORCE:
- return "Created replacement";
- }
- assert_not_reached("Bad creation");
-}
+static const char *creation_mode_verb_table[_CREATION_MODE_MAX] = {
+ [CREATION_NORMAL] = "Created",
+ [CREATION_EXISTING] = "Found existing",
+ [CREATION_FORCE] = "Created replacement",
+};
+
+DEFINE_PRIVATE_STRING_TABLE_LOOKUP_TO_STRING(creation_mode_verb, CreationMode);
static int create_item(Item *i) {
struct stat st;
@@ -1013,7 +1011,7 @@ static int create_item(Item *i) {
creation = CREATION_EXISTING;
} else
creation = CREATION_NORMAL;
- log_debug("%s directory \"%s\".", creation_verb(creation), i->path);
+ log_debug("%s directory \"%s\".", creation_mode_verb_to_string(creation), i->path);
r = path_set_perms(i, i->path);
if (r < 0)
@@ -1057,7 +1055,7 @@ static int create_item(Item *i) {
creation = CREATION_EXISTING;
} else
creation = CREATION_NORMAL;
- log_debug("%s fifo \"%s\".", creation_verb(creation), i->path);
+ log_debug("%s fifo \"%s\".", creation_mode_verb_to_string(creation), i->path);
r = path_set_perms(i, i->path);
if (r < 0)
@@ -1096,7 +1094,7 @@ static int create_item(Item *i) {
creation = CREATION_EXISTING;
} else
creation = CREATION_NORMAL;
- log_debug("%s symlink \"%s\".", creation_verb(creation), i->path);
+ log_debug("%s symlink \"%s\".", creation_mode_verb_to_string(creation), i->path);
break;
@@ -1157,7 +1155,7 @@ static int create_item(Item *i) {
} else
creation = CREATION_NORMAL;
log_debug("%s %s device node \"%s\" %u:%u.",
- creation_verb(creation),
+ creation_mode_verb_to_string(creation),
i->type == CREATE_BLOCK_DEVICE ? "block" : "char",
i->path, major(i->mode), minor(i->mode));
commit babc21fdc0c309e3f397fdb57fb3038b5bef654a
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Feb 2 21:28:33 2015 +0100
time-util: let's make xstrftime() useful for everybody, even if we only have a single user so far.
diff --git a/src/shared/time-util.h b/src/shared/time-util.h
index b55a660..fbfbcbf 100644
--- a/src/shared/time-util.h
+++ b/src/shared/time-util.h
@@ -107,3 +107,5 @@ int get_timezones(char ***l);
bool timezone_is_valid(const char *name);
clockid_t clock_boottime_or_monotonic(void);
+
+#define xstrftime(buf, fmt, tm) assert_se(strftime(buf, ELEMENTSOF(buf), fmt, tm) > 0)
diff --git a/src/timedate/timedatectl.c b/src/timedate/timedatectl.c
index 1f85536..4d89886 100644
--- a/src/timedate/timedatectl.c
+++ b/src/timedate/timedatectl.c
@@ -38,8 +38,6 @@
#include "pager.h"
#include "time-dst.h"
-#define xstrftime(buf, fmt, tm) assert_se(strftime(buf, sizeof(buf), fmt, tm) > 0)
-
static bool arg_no_pager = false;
static bool arg_ask_password = true;
static BusTransport arg_transport = BUS_TRANSPORT_LOCAL;
commit b7ce6b592d8908d378904323a4a6670bfe0b7ab1
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Feb 2 21:28:19 2015 +0100
macro: document that DECIMAL_STR_MAX contains space for the trailing NUL byte
diff --git a/src/shared/macro.h b/src/shared/macro.h
index e88630f..7f89951 100644
--- a/src/shared/macro.h
+++ b/src/shared/macro.h
@@ -383,7 +383,8 @@ do { \
/* Returns the number of chars needed to format variables of the
* specified type as a decimal string. Adds in extra space for a
- * negative '-' prefix. */
+ * negative '-' prefix (hence works correctly on signed
+ * types). Includes space for the trailing NUL. */
#define DECIMAL_STR_MAX(type) \
(2+(sizeof(type) <= 1 ? 3 : \
sizeof(type) <= 2 ? 5 : \
More information about the systemd-commits
mailing list