[systemd-commits] 7 commits - TODO man/systemd.service.xml src/core src/libsystemd src/shared src/test

Lennart Poettering lennart at kemper.freedesktop.org
Thu Jul 3 06:51:23 PDT 2014


 TODO                             |    8 ++--
 man/systemd.service.xml          |   15 +++++---
 src/core/load-fragment.c         |   14 ++-----
 src/core/service.c               |    6 +--
 src/libsystemd/sd-path/sd-path.c |    4 +-
 src/shared/architecture.h        |   70 +++++++++++++++++++++------------------
 src/shared/exit-status.c         |   13 +++++--
 src/shared/exit-status.h         |    3 +
 src/test/test-architecture.c     |    3 +
 9 files changed, 78 insertions(+), 58 deletions(-)

New commits:
commit c3a07d946b962ba849b6fe5e114f26b0fc6a7ae0
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Jul 3 15:50:57 2014 +0200

    test: print library tuple in test

diff --git a/src/test/test-architecture.c b/src/test/test-architecture.c
index 7e171c7..24217ad 100644
--- a/src/test/test-architecture.c
+++ b/src/test/test-architecture.c
@@ -48,5 +48,8 @@ int main(int argc, char *argv[]) {
         assert_se(a >= 0);
 
         log_info("native architecture=%s", architecture_to_string(a));
+
+        log_info("primary library architecture=" LIB_ARCH_TUPLE);
+
         return 0;
 }

commit 0881d7af14eb6105d825c3a32a1f8ad11ed5d092
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Jul 3 15:50:53 2014 +0200

    shared: add LIB_ARCH tuples for BE ARM archs

diff --git a/src/shared/architecture.h b/src/shared/architecture.h
index 6a3f0b2..7163d1f 100644
--- a/src/shared/architecture.h
+++ b/src/shared/architecture.h
@@ -143,13 +143,16 @@ Architecture uname_architecture(void);
 #elif defined(__arm__)
 #  if defined(WORDS_BIGENDIAN)
 #    define native_architecture() ARCHITECTURE_ARM_BE
-#    error "Missing LIB_ARCH_TUPLE for ARM_BE"
+#    if defined(__ARM_PCS_VFP)
+#      define LIB_ARCH_TUPLE "armeb-linux-gnueabihf"
+#    else
+#      define LIB_ARCH_TUPLE "armeb-linux-gnueabi"
+#    endif
 #  else
+#    define native_architecture() ARCHITECTURE_ARM
 #    if defined(__ARM_PCS_VFP)
-#      define native_architecture() ARCHITECTURE_ARM
 #      define LIB_ARCH_TUPLE "arm-linux-gnueabihf"
 #    else
-#      define native_architecture() ARCHITECTURE_ARM
 #      define LIB_ARCH_TUPLE "arm-linux-gnueabi"
 #    endif
 #  endif

commit 55ebf98cbecdad288ba2e3f63f7026280c62f025
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Jul 3 15:50:31 2014 +0200

    core: introduce exit_status_set_is_empty() to make things a bit easier to read

diff --git a/src/core/service.c b/src/core/service.c
index be88670..0b19767 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -335,7 +335,7 @@ static int service_verify(Service *s) {
                 return -EINVAL;
         }
 
-        if (s->type == SERVICE_ONESHOT && !(set_isempty(s->restart_force_status.signal) && set_isempty(s->restart_force_status.status))) {
+        if (s->type == SERVICE_ONESHOT && !exit_status_set_is_empty(&s->restart_force_status)) {
                 log_error_unit(UNIT(s)->id, "%s has RestartForceStatus= set, which isn't allowed for Type=oneshot services. Refusing.", UNIT(s)->id);
                 return -EINVAL;
         }
diff --git a/src/shared/exit-status.c b/src/shared/exit-status.c
index 942ac86..f3434f7 100644
--- a/src/shared/exit-status.c
+++ b/src/shared/exit-status.c
@@ -216,3 +216,10 @@ void exit_status_set_free(ExitStatusSet *x) {
         set_free(x->signal);
         x->status = x->signal = NULL;
 }
+
+bool exit_status_set_is_empty(ExitStatusSet *x) {
+        if (!x)
+                return true;
+
+        return set_isempty(x->status) && set_isempty(x->signal);
+}
diff --git a/src/shared/exit-status.h b/src/shared/exit-status.h
index 744f2d5..7438508 100644
--- a/src/shared/exit-status.h
+++ b/src/shared/exit-status.h
@@ -97,3 +97,4 @@ bool is_clean_exit(int code, int status, ExitStatusSet *success_status);
 bool is_clean_exit_lsb(int code, int status, ExitStatusSet *success_status);
 
 void exit_status_set_free(ExitStatusSet *x);
+bool exit_status_set_is_empty(ExitStatusSet *x);

commit ce4a52a500965ae6c2f95787f5346112ed56bbae
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Jul 3 15:49:54 2014 +0200

    update TODO

diff --git a/TODO b/TODO
index 983479b..6bb84cd 100644
--- a/TODO
+++ b/TODO
@@ -10,9 +10,6 @@ Bugfixes:
 
 * properly handle .mount unit state tracking when two mount points are stacked one on top of another on the exact same mount point.
 
-* sd_bus_unref() is broken regarding self-references and "pseudo thread-safety".
-  See the comment in sd_bus_unref() for more..
-
 External:
 * Fedora: when installing fedora with yum --installroot /var/run is a directory, not a symlink
    https://bugzilla.redhat.com/show_bug.cgi?id=975864
@@ -25,6 +22,11 @@ External:
 
 Features:
 
+* new component "systemd-first-boot" which asks for locale, timezone,
+  root password on first boot if the configuration for that has not
+  been provisioned yet. Similar in style to what the distros have, but
+  minimalist, text-only /dev/console stuff.
+
 * machinectl should show /etc/os-release info from the container
 
 * Add a new verb "systemctl top"

commit 613e3a26c1209a30c0643159fdd7283cbcfc51f6
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Jul 3 15:40:14 2014 +0200

    shared: rename ARCH_TUPLE to LIB_ARCH_TUPLE
    
    This is really just about library locations, hence clarify that we don't
    assume this to be anything but that.

diff --git a/src/libsystemd/sd-path/sd-path.c b/src/libsystemd/sd-path/sd-path.c
index 44c1b8b..7ade915 100644
--- a/src/libsystemd/sd-path/sd-path.c
+++ b/src/libsystemd/sd-path/sd-path.c
@@ -275,7 +275,7 @@ static int get_path(uint64_t type, char **buffer, const char **ret) {
                 return from_home_dir(NULL, ".local/lib", buffer, ret);
 
         case SD_PATH_USER_LIBRARY_ARCH:
-                return from_home_dir(NULL, ".local/lib/" ARCH_TUPLE, buffer, ret);
+                return from_home_dir(NULL, ".local/lib/" LIB_ARCH_TUPLE, buffer, ret);
 
         case SD_PATH_USER_SHARED:
                 return from_home_dir("XDG_DATA_HOME", ".local/share", buffer, ret);
@@ -502,7 +502,7 @@ static int get_search(uint64_t type, char ***list) {
         case SD_PATH_SEARCH_LIBRARY_ARCH:
                 return search_from_environment(list,
                                                NULL,
-                                               ".local/lib/" ARCH_TUPLE,
+                                               ".local/lib/" LIB_ARCH_TUPLE,
                                                "LD_LIBRARY_PATH",
                                                true,
                                                LIBDIR,
diff --git a/src/shared/architecture.h b/src/shared/architecture.h
index b94adae..6a3f0b2 100644
--- a/src/shared/architecture.h
+++ b/src/shared/architecture.h
@@ -60,111 +60,114 @@ typedef enum Architecture {
 Architecture uname_architecture(void);
 
 /*
- * ARCH_TUPLE should resolve to the local architecture systemd is
- * built for, according to the Debian tuple list:
+ * LIB_ARCH_TUPLE should resolve to the local library path
+ * architecture tuple systemd is built for, according to the Debian
+ * tuple list:
  *
  * https://wiki.debian.org/Multiarch/Tuples
  *
+ * This is used in library search paths that should understand
+ * Debian's paths on all distributions.
  */
 
 #if defined(__x86_64__)
 #  define native_architecture() ARCHITECTURE_X86_64
-#  define ARCH_TUPLE "x86_64-linux-gnu"
+#  define LIB_ARCH_TUPLE "x86_64-linux-gnu"
 #elif defined(__i386__)
 #  define native_architecture() ARCHITECTURE_X86
-#  define ARCH_TUPLE "i386-linux-gnu"
+#  define LIB_ARCH_TUPLE "i386-linux-gnu"
 #elif defined(__powerpc64__)
 #  if defined(WORDS_BIGENDIAN)
 #    define native_architecture() ARCHITECTURE_PPC64
-#    define ARCH_TUPLE "ppc64-linux-gnu"
+#    define LIB_ARCH_TUPLE "ppc64-linux-gnu"
 #  else
 #    define native_architecture() ARCHITECTURE_PPC64_LE
-#    error "Missing ARCH_TUPLE for PPC64LE"
+#    error "Missing LIB_ARCH_TUPLE for PPC64LE"
 #  endif
 #elif defined(__powerpc__)
 #  if defined(WORDS_BIGENDIAN)
 #    define native_architecture() ARCHITECTURE_PPC
-#    define ARCH_TUPLE "powerpc-linux-gnu"
+#    define LIB_ARCH_TUPLE "powerpc-linux-gnu"
 #  else
 #    define native_architecture() ARCHITECTURE_PPC_LE
-#    error "Missing ARCH_TUPLE for PPCLE"
+#    error "Missing LIB_ARCH_TUPLE for PPCLE"
 #  endif
 #elif defined(__ia64__)
 #  define native_architecture() ARCHITECTURE_IA64
-#  define ARCH_TUPLE "ia64-linux-gnu"
+#  define LIB_ARCH_TUPLE "ia64-linux-gnu"
 #elif defined(__hppa64__)
 #  define native_architecture() ARCHITECTURE_PARISC64
-#  error "Missing ARCH_TUPLE for HPPA64"
+#  error "Missing LIB_ARCH_TUPLE for HPPA64"
 #elif defined(__hppa__)
 #  define native_architecture() ARCHITECTURE_PARISC
-#  define ARCH_TUPLE "hppa‑linux‑gnu"
+#  define LIB_ARCH_TUPLE "hppa‑linux‑gnu"
 #elif defined(__s390x__)
 #  define native_architecture() ARCHITECTURE_S390X
-#  define ARCH_TUPLE "s390x-linux-gnu"
+#  define LIB_ARCH_TUPLE "s390x-linux-gnu"
 #elif defined(__s390__)
 #  define native_architecture() ARCHITECTURE_S390
-#  define ARCH_TUPLE "s390-linux-gnu"
+#  define LIB_ARCH_TUPLE "s390-linux-gnu"
 #elif defined(__sparc64__)
 #  define native_architecture() ARCHITECTURE_SPARC64
-#  define ARCH_TUPLE "sparc64-linux-gnu"
+#  define LIB_ARCH_TUPLE "sparc64-linux-gnu"
 #elif defined(__sparc__)
 #  define native_architecture() ARCHITECTURE_SPARC
-#  define ARCH_TUPLE "sparc-linux-gnu"
+#  define LIB_ARCH_TUPLE "sparc-linux-gnu"
 #elif defined(__mips64__)
 #  if defined(WORDS_BIGENDIAN)
 #    define native_architecture() ARCHITECTURE_MIPS64
-#    error "Missing ARCH_TUPLE for MIPS64"
+#    error "Missing LIB_ARCH_TUPLE for MIPS64"
 #  else
 #    define native_architecture() ARCHITECTURE_MIPS64_LE
-#    error "Missing ARCH_TUPLE for MIPS64_LE"
+#    error "Missing LIB_ARCH_TUPLE for MIPS64_LE"
 #  endif
 #elif defined(__mips__)
 #  if defined(WORDS_BIGENDIAN)
 #    define native_architecture() ARCHITECTURE_MIPS
-#    define ARCH_TUPLE "mips-linux-gnu"
+#    define LIB_ARCH_TUPLE "mips-linux-gnu"
 #  else
 #    define native_architecture() ARCHITECTURE_MIPS_LE
-#    define ARCH_TUPLE "mipsel-linux-gnu"
+#    define LIB_ARCH_TUPLE "mipsel-linux-gnu"
 #endif
 #elif defined(__alpha__)
 #  define native_architecture() ARCHITECTURE_ALPHA
-#  define ARCH_TUPLE "alpha-linux-gnu"
+#  define LIB_ARCH_TUPLE "alpha-linux-gnu"
 #elif defined(__aarch64__)
 #  if defined(WORDS_BIGENDIAN)
 #    define native_architecture() ARCHITECTURE_ARM64_BE
-#    define ARCH_TUPLE "aarch64_be-linux-gnu"
+#    define LIB_ARCH_TUPLE "aarch64_be-linux-gnu"
 #  else
 #    define native_architecture() ARCHITECTURE_ARM64
-#    define ARCH_TUPLE "aarch64-linux-gnu"
+#    define LIB_ARCH_TUPLE "aarch64-linux-gnu"
 #  endif
 #elif defined(__arm__)
 #  if defined(WORDS_BIGENDIAN)
 #    define native_architecture() ARCHITECTURE_ARM_BE
-#    error "Missing ARCH_TUPLE for ARM_BE"
+#    error "Missing LIB_ARCH_TUPLE for ARM_BE"
 #  else
 #    if defined(__ARM_PCS_VFP)
 #      define native_architecture() ARCHITECTURE_ARM
-#      define ARCH_TUPLE "arm-linux-gnueabihf"
+#      define LIB_ARCH_TUPLE "arm-linux-gnueabihf"
 #    else
 #      define native_architecture() ARCHITECTURE_ARM
-#      define ARCH_TUPLE "arm-linux-gnueabi"
+#      define LIB_ARCH_TUPLE "arm-linux-gnueabi"
 #    endif
 #  endif
 #elif defined(__sh64__)
 #  define native_architecture() ARCHITECTURE_SH64
-#  error "Missing ARCH_TUPLE for SH64"
+#  error "Missing LIB_ARCH_TUPLE for SH64"
 #elif defined(__sh__)
 #  define native_architecture() ARCHITECTURE_SH
-#  define ARCH_TUPLE "sh4-linux-gnu"
+#  define LIB_ARCH_TUPLE "sh4-linux-gnu"
 #elif defined(__m68k__)
 #  define native_architecture() ARCHITECTURE_M68K
-#  define ARCH_TUPLE "m68k-linux-gnu"
+#  define LIB_ARCH_TUPLE "m68k-linux-gnu"
 #elif defined(__tilegx__)
 #  define native_architecture() ARCHITECTURE_TILEGX
-#  error "Missing ARCH_TUPLE for TILEGX"
+#  error "Missing LIB_ARCH_TUPLE for TILEGX"
 #elif defined(__cris__)
 #  define native_architecture() ARCHITECTURE_CRIS
-#  error "Missing ARCH_TUPLE for CRIS"
+#  error "Missing LIB_ARCH_TUPLE for CRIS"
 #else
 #error "Please register your architecture here!"
 #endif

commit 3e2d435b3d2247a60d6def932d28a4856566a7d7
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Jul 3 15:36:50 2014 +0200

    exit-status: rename ExitStatusSet's "code" field to "status"
    
    We should follow the naming scheme waitid() uses, not come up with our
    own reversed one...

diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index 0f5e71b..b6894d2 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -2935,13 +2935,9 @@ int config_parse_set_status(
         assert(rvalue);
         assert(data);
 
+        /* Empty assignment resets the list */
         if (isempty(rvalue)) {
-                /* Empty assignment resets the list */
-
-                set_free(status_set->signal);
-                set_free(status_set->code);
-
-                status_set->signal = status_set->code = NULL;
+                exit_status_set_free(status_set);
                 return 0;
         }
 
@@ -2958,7 +2954,7 @@ int config_parse_set_status(
                         val = signal_from_string_try_harder(temp);
 
                         if (val > 0) {
-                                r = set_ensure_allocated(&status_set->signal, trivial_hash_func, trivial_compare_func);
+                                r = set_ensure_allocated(&status_set->signal, NULL, NULL);
                                 if (r < 0)
                                         return log_oom();
 
@@ -2975,11 +2971,11 @@ int config_parse_set_status(
                         if (val < 0 || val > 255)
                                 log_syntax(unit, LOG_ERR, filename, line, ERANGE, "Value %d is outside range 0-255, ignoring", val);
                         else {
-                                r = set_ensure_allocated(&status_set->code, trivial_hash_func, trivial_compare_func);
+                                r = set_ensure_allocated(&status_set->status, NULL, NULL);
                                 if (r < 0)
                                         return log_oom();
 
-                                r = set_put(status_set->code, INT_TO_PTR(val));
+                                r = set_put(status_set->status, INT_TO_PTR(val));
                                 if (r < 0) {
                                         log_syntax(unit, LOG_ERR, filename, line, -r, "Unable to store: %s", w);
                                         return r;
diff --git a/src/core/service.c b/src/core/service.c
index e221899..be88670 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -335,7 +335,7 @@ static int service_verify(Service *s) {
                 return -EINVAL;
         }
 
-        if (s->type == SERVICE_ONESHOT && !(set_isempty(s->restart_force_status.signal) && set_isempty(s->restart_force_status.code))) {
+        if (s->type == SERVICE_ONESHOT && !(set_isempty(s->restart_force_status.signal) && set_isempty(s->restart_force_status.status))) {
                 log_error_unit(UNIT(s)->id, "%s has RestartForceStatus= set, which isn't allowed for Type=oneshot services. Refusing.", UNIT(s)->id);
                 return -EINVAL;
         }
@@ -1071,9 +1071,9 @@ static void service_enter_dead(Service *s, ServiceResult f, bool allow_restart)
              (s->restart == SERVICE_RESTART_ON_ABNORMAL && !IN_SET(s->result, SERVICE_SUCCESS, SERVICE_FAILURE_EXIT_CODE)) ||
              (s->restart == SERVICE_RESTART_ON_WATCHDOG && s->result == SERVICE_FAILURE_WATCHDOG) ||
              (s->restart == SERVICE_RESTART_ON_ABORT && IN_SET(s->result, SERVICE_FAILURE_SIGNAL, SERVICE_FAILURE_CORE_DUMP)) ||
-             (s->main_exec_status.code == CLD_EXITED && set_contains(s->restart_force_status.code, INT_TO_PTR(s->main_exec_status.status))) ||
+             (s->main_exec_status.code == CLD_EXITED && set_contains(s->restart_force_status.status, INT_TO_PTR(s->main_exec_status.status))) ||
              (IN_SET(s->main_exec_status.code, CLD_KILLED, CLD_DUMPED) && set_contains(s->restart_force_status.signal, INT_TO_PTR(s->main_exec_status.status)))) &&
-            (s->main_exec_status.code != CLD_EXITED || !set_contains(s->restart_prevent_status.code, INT_TO_PTR(s->main_exec_status.status))) &&
+            (s->main_exec_status.code != CLD_EXITED || !set_contains(s->restart_prevent_status.status, INT_TO_PTR(s->main_exec_status.status))) &&
             (!IN_SET(s->main_exec_status.code, CLD_KILLED, CLD_DUMPED) || !set_contains(s->restart_prevent_status.signal, INT_TO_PTR(s->main_exec_status.status)))) {
 
                 r = service_arm_timer(s, s->restart_usec);
diff --git a/src/shared/exit-status.c b/src/shared/exit-status.c
index 38d71e1..942ac86 100644
--- a/src/shared/exit-status.c
+++ b/src/shared/exit-status.c
@@ -183,7 +183,7 @@ bool is_clean_exit(int code, int status, ExitStatusSet *success_status) {
         if (code == CLD_EXITED)
                 return status == 0 ||
                        (success_status &&
-                       set_contains(success_status->code, INT_TO_PTR(status)));
+                       set_contains(success_status->status, INT_TO_PTR(status)));
 
         /* If a daemon does not implement handlers for some of the
          * signals that's not considered an unclean shutdown */
@@ -212,7 +212,7 @@ bool is_clean_exit_lsb(int code, int status, ExitStatusSet *success_status) {
 void exit_status_set_free(ExitStatusSet *x) {
         assert(x);
 
-        set_free(x->code);
+        set_free(x->status);
         set_free(x->signal);
-        x->code = x->signal = NULL;
+        x->status = x->signal = NULL;
 }
diff --git a/src/shared/exit-status.h b/src/shared/exit-status.h
index 93abf7f..744f2d5 100644
--- a/src/shared/exit-status.h
+++ b/src/shared/exit-status.h
@@ -87,7 +87,7 @@ typedef enum ExitStatusLevel {
 } ExitStatusLevel;
 
 typedef struct ExitStatusSet {
-        Set *code;
+        Set *status;
         Set *signal;
 } ExitStatusSet;
 

commit ab016c45a96bad3fe799ce5d680dbecf3878470b
Author: Lennart Poettering <lennart at poettering.net>
Date:   Thu Jul 3 15:36:33 2014 +0200

    man: reference RestartForceExitStatus= from the Restart= description

diff --git a/man/systemd.service.xml b/man/systemd.service.xml
index 7f7d49e..0131250 100644
--- a/man/systemd.service.xml
+++ b/man/systemd.service.xml
@@ -825,10 +825,15 @@ ExecStart=/bin/echo $ONE $TWO ${TWO}</programlisting>
                                         </tgroup>
                                 </table>
 
-                                <para>In addition to the above settings,
-                                the service will not be restarted if the
-                                exit code or signal is specified in
+                                <para>As exceptions to the setting
+                                above the service will not be
+                                restarted if the exit code or signal
+                                is specified in
                                 <varname>RestartPreventExitStatus=</varname>
+                                (see below). Also, the services will
+                                always be restarted if the exit code
+                                or signal is specified in
+                                <varname>RestartForceExitStatus=</varname>
                                 (see below).</para>
 
                                 <para>Setting this to
@@ -838,8 +843,8 @@ ExecStart=/bin/echo $ONE $TWO ${TWO}</programlisting>
                                 reliability by attempting automatic
                                 recovery from errors. For services
                                 that shall be able to terminate on
-                                their own choice (and avoiding
-                                immediate restart),
+                                their own choice (and avoid
+                                immediate restarting),
                                 <option>on-abnormal</option> is an
                                 alternative choice.</para>
                                 </listitem>



More information about the systemd-commits mailing list