summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-07-10 00:55:44 +0200
committerLennart Poettering <lennart@poettering.net>2010-07-10 00:55:44 +0200
commitb8131a87ccdd9376882ca0a8dd3cfe45172e4c46 (patch)
treedc41d2977155baa31fc5618d5c302f3c8bed8b52
parent828f33e89bc2fa7ee9bc9f977c04d0e30336d848 (diff)
systemctl: show connection counters only for Accept=yes sockets
-rw-r--r--fixme2
-rw-r--r--src/systemctl.c14
2 files changed, 13 insertions, 3 deletions
diff --git a/fixme b/fixme
index 37c6288d78..cd5a23f98d 100644
--- a/fixme
+++ b/fixme
@@ -39,8 +39,6 @@
* pull in umount.target and shutdown.target from emergency.service (?)
-* Don't show Accepted/Connected for non-Accept sockets
-
* Show exit status auf auxiliary programs in systemctl status
External:
diff --git a/src/systemctl.c b/src/systemctl.c
index 0314337903..dc6fb5ea40 100644
--- a/src/systemctl.c
+++ b/src/systemctl.c
@@ -947,6 +947,7 @@ typedef struct UnitStatusInfo {
/* Socket */
unsigned n_accepted;
unsigned n_connections;
+ bool accept;
/* Device */
const char *sysfs_path;
@@ -997,7 +998,7 @@ static void print_status_info(UnitStatusInfo *i) {
if (i->status_text)
printf("\t Status: \"%s\"\n", i->status_text);
- if (i->id && endswith(i->id, ".socket"))
+ if (i->accept)
printf("\tAccepted: %u; Connected: %u\n", i->n_accepted, i->n_connections);
if (i->main_pid > 0 || i->control_pid > 0) {
@@ -1093,6 +1094,17 @@ static int status_property(const char *name, DBusMessageIter *iter, UnitStatusIn
break;
}
+ case DBUS_TYPE_BOOLEAN: {
+ dbus_bool_t b;
+
+ dbus_message_iter_get_basic(iter, &b);
+
+ if (streq(name, "Accept"))
+ i->accept = b;
+
+ break;
+ }
+
case DBUS_TYPE_UINT32: {
uint32_t u;