chiark / gitweb /
core: drop KillMode parameter from KillUnit() bus call
[elogind.git] / src / systemctl / systemctl.c
index 8279f08d5750fb7e16e7af3fc7f9676535b891d9..e587cfbfae552e0b10fc1d33be62e29ee0d043d8 100644 (file)
@@ -65,6 +65,7 @@
 #include "path-util.h"
 
 static const char *arg_type = NULL;
 #include "path-util.h"
 
 static const char *arg_type = NULL;
+static const char *arg_load_state = NULL;
 static char **arg_property = NULL;
 static bool arg_all = false;
 static const char *arg_job_mode = "replace";
 static char **arg_property = NULL;
 static bool arg_all = false;
 static const char *arg_job_mode = "replace";
@@ -85,7 +86,6 @@ static bool arg_failed = false;
 static bool arg_runtime = false;
 static char **arg_wall = NULL;
 static const char *arg_kill_who = NULL;
 static bool arg_runtime = false;
 static char **arg_wall = NULL;
 static const char *arg_kill_who = NULL;
-static const char *arg_kill_mode = NULL;
 static int arg_signal = SIGTERM;
 static const char *arg_root = NULL;
 static usec_t arg_when = 0;
 static int arg_signal = SIGTERM;
 static const char *arg_root = NULL;
 static usec_t arg_when = 0;
@@ -337,7 +337,9 @@ static bool output_show_unit(const struct unit_info *u) {
 
         return (!arg_type || ((dot = strrchr(u->id, '.')) &&
                               streq(dot+1, arg_type))) &&
 
         return (!arg_type || ((dot = strrchr(u->id, '.')) &&
                               streq(dot+1, arg_type))) &&
-                (arg_all || !(streq(u->active_state, "inactive") || u->following[0]) || u->job_id > 0);
+                (!arg_load_state || streq(u->load_state, arg_load_state)) &&
+                (arg_all || !(streq(u->active_state, "inactive")
+                              || u->following[0]) || u->job_id > 0);
 }
 
 static void output_units_list(const struct unit_info *unit_infos, unsigned c) {
 }
 
 static void output_units_list(const struct unit_info *unit_infos, unsigned c) {
@@ -2137,9 +2139,6 @@ static int kill_unit(DBusConnection *bus, char **args) {
         if (!arg_kill_who)
                 arg_kill_who = "all";
 
         if (!arg_kill_who)
                 arg_kill_who = "all";
 
-        if (!arg_kill_mode)
-                arg_kill_mode = streq(arg_kill_who, "all") ? "control-group" : "process";
-
         STRV_FOREACH(name, args+1) {
                 DBusMessage *reply;
                 char *n;
         STRV_FOREACH(name, args+1) {
                 DBusMessage *reply;
                 char *n;
@@ -2160,7 +2159,6 @@ static int kill_unit(DBusConnection *bus, char **args) {
                 b = dbus_message_append_args(m,
                                              DBUS_TYPE_STRING, n ? &n : name,
                                              DBUS_TYPE_STRING, &arg_kill_who,
                 b = dbus_message_append_args(m,
                                              DBUS_TYPE_STRING, n ? &n : name,
                                              DBUS_TYPE_STRING, &arg_kill_who,
-                                             DBUS_TYPE_STRING, &arg_kill_mode,
                                              DBUS_TYPE_INT32, &arg_signal,
                                              DBUS_TYPE_INVALID);
                 free(n);
                                              DBUS_TYPE_INT32, &arg_signal,
                                              DBUS_TYPE_INVALID);
                 free(n);
@@ -2589,8 +2587,13 @@ static void print_status_info(UnitStatusInfo *i) {
         }
 
         if (i->id && arg_transport != TRANSPORT_SSH) {
         }
 
         if (i->id && arg_transport != TRANSPORT_SSH) {
+                int flags = (arg_lines*OUTPUT_SHOW_ALL |
+                             arg_follow*OUTPUT_FOLLOW |
+                             !arg_quiet*OUTPUT_WARN_CUTOFF);
                 printf("\n");
                 printf("\n");
-                show_journal_by_unit(i->id, arg_output, 0, i->inactive_exit_timestamp_monotonic, arg_lines, arg_all, arg_follow, !arg_quiet);
+                show_journal_by_unit(i->id, arg_output, 0,
+                                     i->inactive_exit_timestamp_monotonic,
+                                     arg_lines, flags);
         }
 
         if (i->need_daemon_reload)
         }
 
         if (i->need_daemon_reload)
@@ -3921,7 +3924,7 @@ finish:
 static int enable_sysv_units(char **args) {
         int r = 0;
 
 static int enable_sysv_units(char **args) {
         int r = 0;
 
-#if defined (HAVE_SYSV_COMPAT) && (defined(TARGET_FEDORA) || defined(TARGET_MANDRIVA) || defined(TARGET_SUSE) || defined(TARGET_MEEGO) || defined(TARGET_ALTLINUX) || defined(TARGET_MAGEIA))
+#if defined (HAVE_SYSV_COMPAT) && (defined(TARGET_FEDORA) || defined(TARGET_MANDRIVA) || defined(TARGET_SUSE) || defined(TARGET_ALTLINUX) || defined(TARGET_MAGEIA))
         const char *verb = args[0];
         unsigned f = 1, t = 1;
         LookupPaths paths;
         const char *verb = args[0];
         unsigned f = 1, t = 1;
         LookupPaths paths;
@@ -4585,7 +4588,6 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
                 ARG_ROOT,
                 ARG_FULL,
                 ARG_NO_RELOAD,
                 ARG_ROOT,
                 ARG_FULL,
                 ARG_NO_RELOAD,
-                ARG_KILL_MODE,
                 ARG_KILL_WHO,
                 ARG_NO_ASK_PASSWORD,
                 ARG_FAILED,
                 ARG_KILL_WHO,
                 ARG_NO_ASK_PASSWORD,
                 ARG_FAILED,
@@ -4617,7 +4619,6 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
                 { "root",      required_argument, NULL, ARG_ROOT      },
                 { "force",     no_argument,       NULL, ARG_FORCE     },
                 { "no-reload", no_argument,       NULL, ARG_NO_RELOAD },
                 { "root",      required_argument, NULL, ARG_ROOT      },
                 { "force",     no_argument,       NULL, ARG_FORCE     },
                 { "no-reload", no_argument,       NULL, ARG_NO_RELOAD },
-                { "kill-mode", required_argument, NULL, ARG_KILL_MODE }, /* undocumented on purpose */
                 { "kill-who",  required_argument, NULL, ARG_KILL_WHO  },
                 { "signal",    required_argument, NULL, 's'           },
                 { "no-ask-password", no_argument, NULL, ARG_NO_ASK_PASSWORD },
                 { "kill-who",  required_argument, NULL, ARG_KILL_WHO  },
                 { "signal",    required_argument, NULL, 's'           },
                 { "no-ask-password", no_argument, NULL, ARG_NO_ASK_PASSWORD },
@@ -4650,9 +4651,17 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
                         return 0;
 
                 case 't':
                         return 0;
 
                 case 't':
-                        arg_type = optarg;
-                        break;
-
+                        if (unit_type_from_string(optarg) >= 0) {
+                                arg_type = optarg;
+                                break;
+                        }
+                        if (unit_load_state_from_string(optarg) >= 0) {
+                                arg_load_state = optarg;
+                                break;
+                        }
+                        log_error("Unkown unit type or load state '%s'.",
+                                  optarg);
+                        return -EINVAL;
                 case 'p': {
                         char **l;
 
                 case 'p': {
                         char **l;
 
@@ -4755,10 +4764,6 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
                         arg_kill_who = optarg;
                         break;
 
                         arg_kill_who = optarg;
                         break;
 
-                case ARG_KILL_MODE:
-                        arg_kill_mode = optarg;
-                        break;
-
                 case 's':
                         if ((arg_signal = signal_from_string_try_harder(optarg)) < 0) {
                                 log_error("Failed to parse signal string %s.", optarg);
                 case 's':
                         if ((arg_signal = signal_from_string_try_harder(optarg)) < 0) {
                                 log_error("Failed to parse signal string %s.", optarg);