[CRIU] [crtools-bot for Kinsbursky Stanislav ] IPC: show message queue dump content

Cyrill Gorcunov gorcunov at openvz.org
Tue Feb 14 08:08:58 EST 2012


The commit is pushed to "master" and will appear on git://github.com/cyrillos/crtools.git
------>
commit 992a4382f624c82718184a90888964ed7c60e0a1
Author: Kinsbursky Stanislav <skinsbursky at openvz.org>
Date:   Mon Feb 13 20:27:42 2012 +0300

    IPC: show message queue dump content
    
    Signed-off-by: Stanislav Kinsbursky <skinsbursky at parallels.com>
    Acked-by: Pavel Emelyanov <xemul at parallels.com>
    Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 cr-show.c        |    3 +++
 include/ipc_ns.h |    1 +
 ipc_ns.c         |   38 ++++++++++++++++++++++++++++++++++++++
 namespaces.c     |    3 +++
 4 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/cr-show.c b/cr-show.c
index 8535ba3..9715910 100644
--- a/cr-show.c
+++ b/cr-show.c
@@ -517,6 +517,9 @@ static int cr_parse_file(struct cr_options *opts)
 	case IPCNS_SHM_MAGIC:
 		show_ipc_shm(fd);
 		break;
+	case IPCNS_MSG_MAGIC:
+		show_ipc_msg(fd);
+		break;
 	default:
 		pr_err("Unknown magic %x on %s\n", magic, opts->show_dump_file);
 		goto err;
diff --git a/include/ipc_ns.h b/include/ipc_ns.h
index 2654b64..981e2fa 100644
--- a/include/ipc_ns.h
+++ b/include/ipc_ns.h
@@ -5,6 +5,7 @@
 
 extern void show_ipc_var(int fd);
 extern void show_ipc_shm(int fd);
+extern void show_ipc_msg(int fd);
 extern int dump_ipc_ns(int ns_pid, struct cr_fdset *fdset);
 extern int prepare_ipc_ns(int pid);
 
diff --git a/ipc_ns.c b/ipc_ns.c
index 7c251a7..b4fa8a9 100644
--- a/ipc_ns.c
+++ b/ipc_ns.c
@@ -365,6 +365,44 @@ static void show_var_entry(struct ipc_var_entry *entry)
 	ipc_sysctl_req(entry, CTL_PRINT);
 }
 
+static void show_ipc_msg_entries(int fd)
+{
+	pr_info("\nMessage queues:\n");
+	while (1) {
+		int ret;
+		struct ipc_msg_entry entry;
+		int msg_nr = 0;
+
+		ret = read_img_eof(fd, &entry);
+		if (ret <= 0)
+			return;
+
+		print_ipc_msg_entry(&entry);
+
+		while (msg_nr < entry.qnum) {
+			struct ipc_msg msg;
+
+			ret = read_img(fd, &msg);
+			if (ret <= 0)
+				return;
+
+			print_ipc_msg(msg_nr, &msg);
+
+			if (lseek(fd, round_up(msg.msize, sizeof(u64)),
+						SEEK_CUR) == (off_t) -1)
+				return;
+			msg_nr++;
+		}
+	}
+}
+
+void show_ipc_msg(int fd)
+{
+	pr_img_head(CR_FD_IPCNS);
+	show_ipc_msg_entries(fd);
+	pr_img_tail(CR_FD_IPCNS);
+}
+
 static void show_ipc_shm_entries(int fd)
 {
 	pr_info("\nShared memory segments:\n");
diff --git a/namespaces.c b/namespaces.c
index dd00b3c..aa0b572 100644
--- a/namespaces.c
+++ b/namespaces.c
@@ -131,6 +131,9 @@ int try_show_namespaces(int ns_pid)
 	if (fdset->fds[CR_FD_IPCNS_SHM] != -1)
 		show_ipc_shm(fdset->fds[CR_FD_IPCNS_SHM]);
 
+	if (fdset->fds[CR_FD_IPCNS_MSG] != -1)
+		show_ipc_msg(fdset->fds[CR_FD_IPCNS_MSG]);
+
 	close_cr_fdset(&fdset);
 	return 0;
 }


More information about the CRIU mailing list