Index: uspace/app/stats/stats.c
===================================================================
--- uspace/app/stats/stats.c	(revision a63966ddc781a6162855a3a60dedf48d5a09b9ca)
+++ uspace/app/stats/stats.c	(revision a6302aeae3f6b03e65410b4c2b6091d819fe88d5)
@@ -52,4 +52,13 @@
 #define MINUTE  60
 
+typedef enum {
+	LIST_TASKS,
+	LIST_THREADS,
+	LIST_IPCCS,
+	LIST_CPUS,
+	LIST_LOAD,
+	LIST_UPTIME
+} list_toggle_t;
+
 static void list_tasks(void)
 {
@@ -65,6 +74,5 @@
 	    " [kcycles] [name\n");
 
-	size_t i;
-	for (i = 0; i < count; i++) {
+	for (size_t i = 0; i < count; i++) {
 		uint64_t resmem;
 		uint64_t virtmem;
@@ -103,6 +111,5 @@
 	printf("[taskid] [threadid] [state ] [prio] [cpu ] [ucycles] [kcycles]\n");
 
-	size_t i;
-	for (i = 0; i < count; i++) {
+	for (size_t i = 0; i < count; i++) {
 		if ((all) || (stats_threads[i].task_id == task_id)) {
 			uint64_t ucycles, kcycles;
@@ -130,4 +137,26 @@
 }
 
+static void list_ipccs(task_id_t task_id, bool all)
+{
+	size_t count;
+	stats_ipcc_t *stats_ipccs = stats_get_ipccs(&count);
+
+	if (stats_ipccs == NULL) {
+		fprintf(stderr, "%s: Unable to get IPC connections\n", NAME);
+		return;
+	}
+
+	printf("[caller] [callee]\n");
+
+	for (size_t i = 0; i < count; i++) {
+		if ((all) || (stats_ipccs[i].caller == task_id)) {
+			printf("%-8" PRIu64 " %-8" PRIu64 "\n",
+			    stats_ipccs[i].caller, stats_ipccs[i].callee);
+		}
+	}
+
+	free(stats_ipccs);
+}
+
 static void list_cpus(void)
 {
@@ -142,6 +171,5 @@
 	printf("[id] [MHz     ] [busy cycles] [idle cycles]\n");
 
-	size_t i;
-	for (i = 0; i < count; i++) {
+	for (size_t i = 0; i < count; i++) {
 		printf("%-4u ", cpus[i].id);
 		if (cpus[i].active) {
@@ -174,6 +202,5 @@
 	printf("%s: Load average: ", NAME);
 
-	size_t i;
-	for (i = 0; i < count; i++) {
+	for (size_t i = 0; i < count; i++) {
 		if (i > 0)
 			printf(" ");
@@ -200,5 +227,5 @@
 {
 	printf(
-	    "Usage: %s [-t task_id] [-a] [-c] [-l] [-u]\n"
+	    "Usage: %s [-t task_id] [-i task_id] [-at] [-ai] [-c] [-l] [-u]\n"
 	    "\n"
 	    "Options:\n"
@@ -207,7 +234,15 @@
 	    "\t\tList threads of the given task\n"
 	    "\n"
-	    "\t-a\n"
-	    "\t--all\n"
+	    "\t-i task_id\n"
+	    "\t--ipcc=task_id\n"
+	    "\t\tList IPC connections of the given task\n"
+	    "\n"
+	    "\t-at\n"
+	    "\t--all-threads\n"
 	    "\t\tList all threads\n"
+	    "\n"
+	    "\t-ai\n"
+	    "\t--all-ipccs\n"
+	    "\t\tList all IPC connections\n"
 	    "\n"
 	    "\t-c\n"
@@ -233,15 +268,9 @@
 int main(int argc, char *argv[])
 {
-	bool toggle_tasks = true;
-	bool toggle_threads = false;
+	list_toggle_t list_toggle = LIST_TASKS;
 	bool toggle_all = false;
-	bool toggle_cpus = false;
-	bool toggle_load = false;
-	bool toggle_uptime = false;
-
 	task_id_t task_id = 0;
 
-	int i;
-	for (i = 1; i < argc; i++) {
+	for (int i = 1; i < argc; i++) {
 		int off;
 
@@ -252,20 +281,35 @@
 		}
 
+		/* All IPC connections */
+		if ((off = arg_parse_short_long(argv[i], "-ai", "--all-ipccs")) != -1) {
+			list_toggle = LIST_IPCCS;
+			toggle_all = true;
+			continue;
+		}
+
 		/* All threads */
-		if ((off = arg_parse_short_long(argv[i], "-a", "--all")) != -1) {
-			toggle_tasks = false;
-			toggle_threads = true;
+		if ((off = arg_parse_short_long(argv[i], "-at", "--all-threads")) != -1) {
+			list_toggle = LIST_THREADS;
 			toggle_all = true;
 			continue;
 		}
 
-		/* CPUs */
-		if ((off = arg_parse_short_long(argv[i], "-c", "--cpus")) != -1) {
-			toggle_tasks = false;
-			toggle_cpus = true;
-			continue;
-		}
-
-		/* Threads */
+		/* IPC connections */
+		if ((off = arg_parse_short_long(argv[i], "-i", "--ipcc=")) != -1) {
+			// TODO: Support for 64b range
+			int tmp;
+			errno_t ret = arg_parse_int(argc, argv, &i, &tmp, off);
+			if (ret != EOK) {
+				printf("%s: Malformed task id '%s'\n", NAME, argv[i]);
+				return -1;
+			}
+
+			task_id = tmp;
+
+			list_toggle = LIST_IPCCS;
+			continue;
+		}
+
+		/* Tasks */
 		if ((off = arg_parse_short_long(argv[i], "-t", "--task=")) != -1) {
 			// TODO: Support for 64b range
@@ -273,5 +317,5 @@
 			errno_t ret = arg_parse_int(argc, argv, &i, &tmp, off);
 			if (ret != EOK) {
-				printf("%s: Malformed task_id '%s'\n", NAME, argv[i]);
+				printf("%s: Malformed task id '%s'\n", NAME, argv[i]);
 				return -1;
 			}
@@ -279,6 +323,11 @@
 			task_id = tmp;
 
-			toggle_tasks = false;
-			toggle_threads = true;
+			list_toggle = LIST_THREADS;
+			continue;
+		}
+
+		/* CPUs */
+		if ((off = arg_parse_short_long(argv[i], "-c", "--cpus")) != -1) {
+			list_toggle = LIST_CPUS;
 			continue;
 		}
@@ -286,6 +335,5 @@
 		/* Load */
 		if ((off = arg_parse_short_long(argv[i], "-l", "--load")) != -1) {
-			toggle_tasks = false;
-			toggle_load = true;
+			list_toggle = LIST_LOAD;
 			continue;
 		}
@@ -293,24 +341,29 @@
 		/* Uptime */
 		if ((off = arg_parse_short_long(argv[i], "-u", "--uptime")) != -1) {
-			toggle_tasks = false;
-			toggle_uptime = true;
-			continue;
-		}
-	}
-
-	if (toggle_tasks)
+			list_toggle = LIST_UPTIME;
+			continue;
+		}
+	}
+
+	switch (list_toggle) {
+	case LIST_TASKS:
 		list_tasks();
-
-	if (toggle_threads)
+		break;
+	case LIST_THREADS:
 		list_threads(task_id, toggle_all);
-
-	if (toggle_cpus)
+		break;
+	case LIST_IPCCS:
+		list_ipccs(task_id, toggle_all);
+		break;
+	case LIST_CPUS:
 		list_cpus();
-
-	if (toggle_load)
+		break;
+	case LIST_LOAD:
 		print_load();
-
-	if (toggle_uptime)
+		break;
+	case LIST_UPTIME:
 		print_uptime();
+		break;
+	}
 
 	return 0;
