[systemd-commits] 4 commits - .dir-locals.el src/job.c src/job.h src/systemctl.c TODO

Lennart Poettering lennart at kemper.freedesktop.org
Mon Mar 7 16:58:42 PST 2011


 .dir-locals.el  |    7 +++++++
 TODO            |   18 ++++++++++--------
 src/job.c       |   19 +++++++++++++++----
 src/job.h       |    1 +
 src/systemctl.c |   10 +++++++---
 5 files changed, 40 insertions(+), 15 deletions(-)

New commits:
commit 83310f162d2a78913b2748aaa5ffb1ae8226484f
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Mar 8 01:47:30 2011 +0100

    systemctl: when forwarding is-enabled to chkconfig hardcode runlevel 3

diff --git a/src/systemctl.c b/src/systemctl.c
index f5a87fc..23e6597 100644
--- a/src/systemctl.c
+++ b/src/systemctl.c
@@ -4072,7 +4072,7 @@ static int install_info_apply(const char *verb, LookupPaths *paths, InstallInfo
                                 argv[1] = file_name_from_path(sysv);
                                 argv[2] =
                                         streq(verb, "enable") ? "on" :
-                                        streq(verb, "disable") ? "off" : NULL;
+                                        streq(verb, "disable") ? "off" : "--level=3";
 
                                 log_info("Executing %s %s %s", argv[0], argv[1], strempty(argv[2]));
 

commit d68201e9aa5e9ebd6085b1bb8892c42e9d20be75
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Mar 8 01:44:19 2011 +0100

    job: introduce new job result code 'skipped' to use when pre conditions of job did not apply
    
    https://bugzilla.redhat.com/show_bug.cgi?id=682245
    https://bugzilla.redhat.com/show_bug.cgi?id=635780

diff --git a/src/job.c b/src/job.c
index 206490f..f5d3ff8 100644
--- a/src/job.c
+++ b/src/job.c
@@ -465,6 +465,8 @@ int job_run_and_invalidate(Job *j) {
         if ((j = manager_get_job(m, id))) {
                 if (r == -EALREADY)
                         r = job_finish_and_invalidate(j, JOB_DONE);
+                else if (r == -ENOEXEC)
+                        r = job_finish_and_invalidate(j, JOB_SKIPPED);
                 else if (r == -EAGAIN)
                         j->state = JOB_WAITING;
                 else if (r < 0)
@@ -702,7 +704,8 @@ static const char* const job_result_table[_JOB_RESULT_MAX] = {
         [JOB_CANCELED] = "canceled",
         [JOB_TIMEOUT] = "timeout",
         [JOB_FAILED] = "failed",
-        [JOB_DEPENDENCY] = "dependency"
+        [JOB_DEPENDENCY] = "dependency",
+        [JOB_SKIPPED] = "skipped"
 };
 
 DEFINE_STRING_TABLE_LOOKUP(job_result, JobResult);
diff --git a/src/job.h b/src/job.h
index de0c1d2..2c65d94 100644
--- a/src/job.h
+++ b/src/job.h
@@ -78,6 +78,7 @@ enum JobResult {
         JOB_TIMEOUT,
         JOB_FAILED,
         JOB_DEPENDENCY,
+        JOB_SKIPPED,
         _JOB_RESULT_MAX,
         _JOB_RESULT_INVALID = -1
 };
diff --git a/src/systemctl.c b/src/systemctl.c
index 6adcbcc..f5a87fc 100644
--- a/src/systemctl.c
+++ b/src/systemctl.c
@@ -1249,7 +1249,7 @@ static int wait_for_jobs(DBusConnection *bus, Set *s) {
                         log_error("Job canceled.");
                 else if (streq(d.result, "dependency"))
                         log_error("A dependency job failed. See system logs for details.");
-                else if (!streq(d.result, "done"))
+                else if (!streq(d.result, "done") && !streq(d.result, "skipped"))
                         log_error("Job failed. See system logs and 'systemctl status' for details.");
         }
 
@@ -1257,7 +1257,7 @@ static int wait_for_jobs(DBusConnection *bus, Set *s) {
                 r = -ETIME;
         else if (streq_ptr(d.result, "canceled"))
                 r = -ECANCELED;
-        else if (!streq_ptr(d.result, "done"))
+        else if (!streq_ptr(d.result, "done") && !streq_ptr(d.result, "skipped"))
                 r = -EIO;
         else
                 r = 0;
@@ -1417,11 +1417,15 @@ static int start_unit(DBusConnection *bus, char **args, unsigned n) {
                         streq(args[0], "stop")                  ? "StopUnit" :
                         streq(args[0], "reload")                ? "ReloadUnit" :
                         streq(args[0], "restart")               ? "RestartUnit" :
+
                         streq(args[0], "try-restart")           ||
                         streq(args[0], "condrestart")           ? "TryRestartUnit" :
+
                         streq(args[0], "reload-or-restart")     ? "ReloadOrRestartUnit" :
+
                         streq(args[0], "reload-or-try-restart") ||
                         streq(args[0], "condreload") ||
+
                         streq(args[0], "force-reload")          ? "ReloadOrTryRestartUnit" :
                                                                   "StartUnit";
 

commit 81253930180bac6b6fb372a9c7bea724bd795c86
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Mar 8 01:43:41 2011 +0100

    job: convert job type as early as we can, to simplify things a bit

diff --git a/TODO b/TODO
index a2c1a36..0a2f761 100644
--- a/TODO
+++ b/TODO
@@ -14,11 +14,19 @@ F15:
 
 * hook emergency.target into local-fs.target in some way as OnFailure with isolate
 
-* libudev is borked regarding tags
+* introduce simple way to do mandatory conditions (make current conditions mandatory, and introduce =| as non-mandatory conditions)
+
+* mount /dev/.run and /var/run as bind mounts
+
+* Make use of UnknownInterface, UnknownObject
+
+* verify SYSTEMD_IGNORE_DEPENDENCIES support in /etc/rc.d/functions
 
 Features:
 
-* mount /dev/.run and /var/run as bind mounts
+* consider services with no [Install] section and stored in /lib enabled by "systemctl is-enabled"
+
+* consider services with any kind of link in /etc/systemd/system enabled
 
 * introduce "x-systemd-automount" as alternative to the "comment=systemd.automount" mount option
 
@@ -30,18 +38,12 @@ Features:
   document it? When doing that add switch to make this temporary by
   placing mask links in /dev.
 
-* introduce simple way to do mandatory conditions (make current conditions mandatory, and introduce =| as non-mandatory conditions)
-
 * detect LXC environment
 
 * invoke vhangup() before and after invoking getty
 
 * support "auto" and "comment=systemd.automount" at the same time for an fstab entry
 
-* Make use of UnknownInterface, UnknownObject
-
-* look up crypto partition mount points via fstab to show to the user when prompting for a password
-
 * Maybe store in unit files whether a service should be enabled by default on package installation
 
 * perhaps add "systemctl reenable" as combination of "systemctl disable" and "systemctl enable"
diff --git a/src/job.c b/src/job.c
index 54bd414..206490f 100644
--- a/src/job.c
+++ b/src/job.c
@@ -422,10 +422,16 @@ int job_run_and_invalidate(Job *j) {
                         break;
 
                 case JOB_RELOAD_OR_START:
-                        if (unit_active_state(j->unit) == UNIT_ACTIVE)
+                        if (unit_active_state(j->unit) == UNIT_ACTIVE) {
+                                j->type = JOB_RELOAD;
                                 r = unit_reload(j->unit);
-                        else
+                        } else {
+                                j->type = JOB_START;
                                 r = unit_start(j->unit);
+
+                                if (r == -EBADR)
+                                        r = 0;
+                        }
                         break;
 
                 case JOB_RESTART: {
@@ -445,8 +451,10 @@ int job_run_and_invalidate(Job *j) {
                         else if (t == UNIT_ACTIVATING) {
                                 j->type = JOB_START;
                                 r = unit_start(j->unit);
-                        } else
+                        } else {
+                                j->type = JOB_RESTART;
                                 r = unit_stop(j->unit);
+                        }
                         break;
                 }
 

commit 85f0c93a50c14cebf0be2740de64c14f27ac61b3
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Mon Mar 7 19:23:04 2011 +0100

    Keep emacs configuration in one configuration file.
    
    On 07.03.2011 19:04, Lennart Poettering wrote:
    >
    > Oh, I had assumed that .vimrc trick would allow project-wide vim
    > modelines without having to edit each and every single file.
    >
    > Currently, every file does contain an emacs modeline at the top. It
    > would be fair I guess to add a vim modeline to all those files too, even
    > though it's not necessarily pretty.
    Hi,
    maybe it makes sense to go in the opposite direction: add .dir-locals.el
    in the top directory. The settings are actually identical in all .[ch]
    files.

diff --git a/.dir-locals.el b/.dir-locals.el
new file mode 100644
index 0000000..9d9f8cd
--- /dev/null
+++ b/.dir-locals.el
@@ -0,0 +1,7 @@
+; Sets emacs variables based on mode.
+; A list of (major-mode . ((var1 . value1) (var2 . value2)))
+; Mode can be nil, which gives default values.
+
+((nil . ((indent-tabs-mode . nil)
+         (tab-width . 8)))
+)



More information about the systemd-commits mailing list