[CRIU] [PATCH v2 2/3] IPC: show shared memory dump content

Kinsbursky Stanislav skinsbursky at openvz.org
Fri Feb 3 12:00:18 EST 2012



Signed-off-by: Stanislav Kinsbursky <skinsbursky at parallels.com>

---
 ipc_ns.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/ipc_ns.c b/ipc_ns.c
index 34a4c92..ce950ea 100644
--- a/ipc_ns.c
+++ b/ipc_ns.c
@@ -251,6 +251,32 @@ static void show_ipc_entry(struct ipc_ns_entry *entry)
 	ipc_sysctl_req(entry, CTL_PRINT);
 }
 
+static void print_ipc_shm(struct ipc_shm_entry *shm)
+{
+	pr_info("key: 0x%08x\t id: %-10d\tsize: %-10lu\tuid: %-10d\t"
+		"gid: %-10d\tcuid: %-10d\tcgid: %-10d\tmode: %-10o\n",
+		shm->key, shm->id, shm->size, shm->uid,
+		shm->gid, shm->cuid, shm->cgid, shm->mode);
+}
+
+static void show_ipc_shm(int fd, int entries)
+{
+	pr_info("\nShared memory segments (%d):\n", entries);
+	while (entries--) {
+		int ret;
+		struct ipc_shm_entry shm;
+
+		ret = read_img_eof(fd, &shm);
+		if (ret <= 0)
+			return;
+
+		print_ipc_shm(&shm);
+
+		if (lseek(fd, round_up(shm.size, sizeof(u32)), SEEK_CUR) == (off_t) -1)
+			return;
+	}
+}
+
 static void show_ipc_data(int fd)
 {
 	int ret;
@@ -260,6 +286,7 @@ static void show_ipc_data(int fd)
 	if (ret <= 0)
 		return;
 	show_ipc_entry(&entry);
+	show_ipc_shm(fd, entry.in_use[IPC_SHM_IDS]);
 }
 
 void show_ipc_ns(int fd)



More information about the CRIU mailing list