chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
core: Filter by state behind the D-Bus API, not in the systemctl client.
[elogind.git]
/
src
/
systemctl
/
systemctl.c
diff --git
a/src/systemctl/systemctl.c
b/src/systemctl/systemctl.c
index a99759f2dda471c760457d3d7eec83116ca08d18..b11fee515cc67c4d8fcb3675d16369b563eea5a9 100644
(file)
--- a/
src/systemctl/systemctl.c
+++ b/
src/systemctl/systemctl.c
@@
-319,12
+319,6
@@
static int compare_unit_info(const void *a, const void *b) {
static bool output_show_unit(const UnitInfo *u, char **patterns) {
const char *dot;
static bool output_show_unit(const UnitInfo *u, char **patterns) {
const char *dot;
- if (!strv_isempty(arg_states))
- return
- strv_contains(arg_states, u->load_state) ||
- strv_contains(arg_states, u->sub_state) ||
- strv_contains(arg_states, u->active_state);
-
if (!strv_isempty(patterns)) {
char **pattern;
if (!strv_isempty(patterns)) {
char **pattern;
@@
-513,6
+507,7
@@
static int get_unit_list(
int c,
sd_bus_message **_reply) {
int c,
sd_bus_message **_reply) {
+ _cleanup_bus_message_unref_ sd_bus_message *m = NULL;
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
size_t size = c;
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
size_t size = c;
@@
-523,15
+518,22
@@
static int get_unit_list(
assert(unit_infos);
assert(_reply);
assert(unit_infos);
assert(_reply);
- r = sd_bus_
call_method
(
+ r = sd_bus_
message_new_method_call
(
bus,
bus,
+ &m,
"org.freedesktop.systemd1",
"/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager",
"org.freedesktop.systemd1",
"/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager",
- "ListUnits",
- &error,
- &reply,
- NULL);
+ "ListUnitsFiltered");
+
+ if (r < 0)
+ return bus_log_create_error(r);
+
+ r = sd_bus_message_append_strv(m, arg_states);
+ if (r < 0)
+ return bus_log_create_error(r);
+
+ r = sd_bus_call(bus, m, 0, &error, &reply);
if (r < 0) {
log_error("Failed to list units: %s", bus_error_message(&error, r));
return r;
if (r < 0) {
log_error("Failed to list units: %s", bus_error_message(&error, r));
return r;