kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6] kvm tools: Handle multiple IPC cmd at a time
@ 2011-12-22  2:10 Asias He
  2011-12-22  2:10 ` [PATCH 2/6] kvm tools: Introduce KVM_IPC_VMSTATE IPC cmd Asias He
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Asias He @ 2011-12-22  2:10 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 2036b91..dbe2363 100644
--- a/tools/kvm/kvm-ipc.c
+++ b/tools/kvm/kvm-ipc.c
@@ -102,7 +102,7 @@ static void kvm_ipc__close_conn(int fd)
 	close(fd);
 }
 
-static void kvm_ipc__receive(int fd)
+static int kvm_ipc__receive(int fd)
 {
 	struct kvm_ipc_head head;
 	u8 *msg = NULL;
@@ -122,8 +122,11 @@ static void kvm_ipc__receive(int fd)
 
 	kvm_ipc__handle(fd, head.type, head.len, msg);
 
+	return 0;
+
 done:
 	free(msg);
+	return -1;
 }
 
 static void *kvm_ipc__thread(void *param)
@@ -140,10 +143,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__receive(client);
+				/*
+				 * Handle multiple IPC cmd at a time
+				 */
+				do {
+					r = kvm_ipc__receive(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] 6+ messages in thread

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

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-22  2:10 [PATCH 1/6] kvm tools: Handle multiple IPC cmd at a time Asias He
2011-12-22  2:10 ` [PATCH 2/6] kvm tools: Introduce KVM_IPC_VMSTATE IPC cmd Asias He
2011-12-22  2:10 ` [PATCH 3/6] kvm tools: Respect paused status in ./lkvm list Asias He
2011-12-22  2:10 ` [PATCH 4/6] kvm tools: Improve 'lkvm {pause,resume}'s output Asias He
2011-12-22  2:10 ` [PATCH 5/6] kvm tools: Remove resume pause noise Asias He
2011-12-22  2:10 ` [PATCH 6/6] kvm tools: Use kvm_ipc__send to send IPC msg 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).