diff mbox

kvm tools: Improve 'kvm list' output

Message ID 1313000511-3046-1-git-send-email-penberg@kernel.org (mailing list archive)
State New, archived
Headers show

Commit Message

Pekka Enberg Aug. 10, 2011, 6:21 p.m. UTC
This patch improves 'kvm list' output to look more like 'ps':

  $ ./kvm list
    PID GUEST
   2820 guest-2820

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
---
 tools/kvm/builtin-list.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
diff mbox

Patch

diff --git a/tools/kvm/builtin-list.c b/tools/kvm/builtin-list.c
index 43f37f2..34cc03b 100644
--- a/tools/kvm/builtin-list.c
+++ b/tools/kvm/builtin-list.c
@@ -25,7 +25,7 @@  static int print_guest(const char *name, int pid)
 	if (strncmp(comm, PROCESS_NAME, strlen(PROCESS_NAME)))
 		goto cleanup;
 
-	printf("%s (PID: %d)\n", name, pid);
+	printf("%5d %s\n", pid, name);
 
 	free(comm);
 
@@ -45,5 +45,7 @@  cleanup:
 
 int kvm_cmd_list(int argc, const char **argv, const char *prefix)
 {
+	printf("  PID GUEST\n");
+
 	return kvm__enumerate_instances(print_guest);
 }