kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] kvm tools: Handle multiple IPC cmd at a time
@ 2011-12-21 12:13 Asias He
  2011-12-21 12:13 ` [PATCH 2/3] kvm tools: Introduce KVM_IPC_VMSTATE IPC cmd Asias He
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Asias He @ 2011-12-21 12:13 UTC (permalink / raw)
  To: Pekka Enberg; +Cc: Sasha Levin, Cyrill Gorcunov, Ingo Molnar, kvm, Asias He

This is useful when client submiting multiple IPC cmd in one socket
connection.

Signed-off-by: Asias He <asias.hejun@gmail.com>
---
 tools/kvm/kvm-ipc.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/tools/kvm/kvm-ipc.c b/tools/kvm/kvm-ipc.c
index 68c2565..f2c3523 100644
--- a/tools/kvm/kvm-ipc.c
+++ b/tools/kvm/kvm-ipc.c
@@ -74,7 +74,7 @@ static void kvm_ipc__close_conn(int fd)
 	close(fd);
 }
 
-static void kvm_ipc__new_data(int fd)
+static int kvm_ipc__new_data(int fd)
 {
 	struct kvm_ipc_msg *msg;
 	u32 n;
@@ -97,8 +97,11 @@ static void kvm_ipc__new_data(int fd)
 
 	kvm_ipc__handle(fd, msg);
 
+	return 0;
+
 done:
 	free(msg);
+	return -1;
 }
 
 static void *kvm_ipc__thread(void *param)
@@ -115,10 +118,16 @@ static void *kvm_ipc__thread(void *param)
 			if (fd == stop_fd && event.events & EPOLLIN) {
 				break;
 			} else if (fd == server_fd) {
-				int client;
+				int client, r;
 
 				client = kvm_ipc__new_conn(fd);
-				kvm_ipc__new_data(client);
+				/*
+				 * Handle multiple IPC cmd at a time
+				 */
+				do {
+					r = kvm_ipc__new_data(client);
+				} while	(r == 0);
+
 			} else if (event.events && (EPOLLERR | EPOLLRDHUP | EPOLLHUP)) {
 				kvm_ipc__close_conn(fd);
 			} else {
-- 
1.7.7.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-12-22  2:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-21 12:13 [PATCH 1/3] kvm tools: Handle multiple IPC cmd at a time Asias He
2011-12-21 12:13 ` [PATCH 2/3] kvm tools: Introduce KVM_IPC_VMSTATE IPC cmd Asias He
2011-12-21 12:13 ` [PATCH 3/3] kvm tools: Respect paused status in ./lkvm list Asias He
2011-12-21 20:30 ` [PATCH 1/3] kvm tools: Handle multiple IPC cmd at a time Pekka Enberg
2011-12-22  2:11   ` Asias He

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).