mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-03 15:55:53 +00:00
IPC: show shared memory dump content
Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com> Acked-by: Pavel Emelyanov <xemul@parallels.com> Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
This commit is contained in:
committed by
Cyrill Gorcunov
parent
3d886be2c6
commit
516099d885
@@ -517,6 +517,9 @@ static int cr_parse_file(struct cr_options *opts)
|
|||||||
case IPCNS_VAR_MAGIC:
|
case IPCNS_VAR_MAGIC:
|
||||||
show_ipc_var(fd);
|
show_ipc_var(fd);
|
||||||
break;
|
break;
|
||||||
|
case IPCNS_SHM_MAGIC:
|
||||||
|
show_ipc_shm(fd);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
pr_err("Unknown magic %x on %s\n", magic, opts->show_dump_file);
|
pr_err("Unknown magic %x on %s\n", magic, opts->show_dump_file);
|
||||||
goto err;
|
goto err;
|
||||||
|
@@ -4,6 +4,7 @@
|
|||||||
#include "crtools.h"
|
#include "crtools.h"
|
||||||
|
|
||||||
extern void show_ipc_var(int fd);
|
extern void show_ipc_var(int fd);
|
||||||
|
extern void show_ipc_shm(int fd);
|
||||||
extern int dump_ipc_ns(int ns_pid, struct cr_fdset *fdset);
|
extern int dump_ipc_ns(int ns_pid, struct cr_fdset *fdset);
|
||||||
extern int prepare_ipc_ns(int pid);
|
extern int prepare_ipc_ns(int pid);
|
||||||
|
|
||||||
|
25
ipc_ns.c
25
ipc_ns.c
@@ -246,6 +246,31 @@ static void show_var_entry(struct ipc_var_entry *entry)
|
|||||||
ipc_sysctl_req(entry, CTL_PRINT);
|
ipc_sysctl_req(entry, CTL_PRINT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void show_ipc_shm_entries(int fd)
|
||||||
|
{
|
||||||
|
pr_info("\nShared memory segments:\n");
|
||||||
|
while (1) {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void show_ipc_shm(int fd)
|
||||||
|
{
|
||||||
|
pr_img_head(CR_FD_IPCNS);
|
||||||
|
show_ipc_shm_entries(fd);
|
||||||
|
pr_img_tail(CR_FD_IPCNS);
|
||||||
|
}
|
||||||
|
|
||||||
static void show_ipc_var_entry(int fd)
|
static void show_ipc_var_entry(int fd)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@@ -128,6 +128,9 @@ int try_show_namespaces(int ns_pid)
|
|||||||
if (fdset->fds[CR_FD_IPCNS_VAR] != -1)
|
if (fdset->fds[CR_FD_IPCNS_VAR] != -1)
|
||||||
show_ipc_var(fdset->fds[CR_FD_IPCNS_VAR]);
|
show_ipc_var(fdset->fds[CR_FD_IPCNS_VAR]);
|
||||||
|
|
||||||
|
if (fdset->fds[CR_FD_IPCNS_SHM] != -1)
|
||||||
|
show_ipc_shm(fdset->fds[CR_FD_IPCNS_SHM]);
|
||||||
|
|
||||||
close_cr_fdset(&fdset);
|
close_cr_fdset(&fdset);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user