[systemd-commits] 2 commits - src/journal src/sd-id128.h src/test-id128.c

Lennart Poettering lennart at kemper.freedesktop.org
Tue Jan 3 17:11:01 PST 2012


 src/journal/journald.c |    4 +++-
 src/sd-id128.h         |    7 +++++++
 src/test-id128.c       |    2 ++
 3 files changed, 12 insertions(+), 1 deletion(-)

New commits:
commit eaff7bd849f1ad9f59b52011657e018efacb47bf
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Jan 4 02:09:05 2012 +0100

    sd128: add format string macros for outputting sd_id128_t variables

diff --git a/src/sd-id128.h b/src/sd-id128.h
index bfae78b..2ae1002 100644
--- a/src/sd-id128.h
+++ b/src/sd-id128.h
@@ -49,6 +49,13 @@ int sd_id128_get_boot(sd_id128_t *ret);
         ((sd_id128_t) { .bytes = { 0x##v0, 0x##v1, 0x##v2, 0x##v3, 0x##v4, 0x##v5, 0x##v6, 0x##v7, \
                                    0x##v8, 0x##v9, 0x##v10, 0x##v11, 0x##v12, 0x##v13, 0x##v14, 0x##v15 }})
 
+/* Note that SD_FORMAT_ID128_VAL will evaluate the passed argument 16
+ * times. It is hence not a good idea to call this macro with an
+ * expensive function as paramater or an expression with side
+ * effects */
+#define SD_FORMAT_ID128_STR "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"
+#define SD_FORMAT_ID128_VAL(x) (x).bytes[0], (x).bytes[1], (x).bytes[2], (x).bytes[3], (x).bytes[4], (x).bytes[5], (x).bytes[6], (x).bytes[7], (x).bytes[8], (x).bytes[9], (x).bytes[10], (x).bytes[11], (x).bytes[12], (x).bytes[13], (x).bytes[14], (x).bytes[15]
+
 static inline bool sd_id128_equal(sd_id128_t a, sd_id128_t b) {
         return memcmp(&a, &b, 16) == 0;
 }
diff --git a/src/test-id128.c b/src/test-id128.c
index 6c3928d..520a496 100644
--- a/src/test-id128.c
+++ b/src/test-id128.c
@@ -45,5 +45,7 @@ int main(int argc, char *argv[]) {
 
         printf("waldi: %s\n", sd_id128_to_string(ID128_WALDI, t));
 
+        printf("waldi2: " SD_FORMAT_ID128_STR "\n", SD_FORMAT_ID128_VAL(ID128_WALDI));
+
         return 0;
 }

commit bad75c274a488715a845ff8e5ec3140036929e94
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Jan 3 23:41:55 2012 +0100

    journald: fix _SYSTEMD_CGROUP= values

diff --git a/src/journal/journald.c b/src/journal/journald.c
index 1faf570..b42be8d 100644
--- a/src/journal/journald.c
+++ b/src/journal/journald.c
@@ -391,7 +391,9 @@ static char *shortened_cgroup_path(pid_t pid) {
                 return NULL;
         }
 
-        if (streq(init_path, "/"))
+        if (endswith(init_path, "/system"))
+                init_path[strlen(init_path) - 7] = 0;
+        else if (streq(init_path, "/"))
                 init_path[0] = 0;
 
         if (startswith(process_path, init_path)) {



More information about the systemd-commits mailing list