mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-28 12:57:57 +00:00
protobuf: use generic show function for ipc shared memory
Signed-off-by: Stanislav Kinsbursky <skinsbursky@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
49ea3128db
commit
ba4366d3da
39
ipc_ns.c
39
ipc_ns.c
@ -297,15 +297,12 @@ static int dump_ipc_msg(int fd)
|
|||||||
return info.msgpool;
|
return info.msgpool;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pr_ipc_shm(unsigned int loglevel, const IpcShmEntry *shm)
|
static void pr_info_ipc_shm(const IpcShmEntry *shm)
|
||||||
{
|
{
|
||||||
pr_ipc_desc_entry(loglevel, shm->desc);
|
pr_ipc_desc_entry(LOG_INFO, shm->desc);
|
||||||
print_on_level(loglevel, "size: %-10lu\n", shm->size);
|
print_on_level(LOG_INFO, "size: %-10lu\n", shm->size);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define pr_info_ipc_shm(shm) pr_ipc_shm(LOG_INFO, shm)
|
|
||||||
#define pr_msg_ipc_shm(shm) pr_ipc_shm(LOG_MSG, shm)
|
|
||||||
|
|
||||||
static int ipc_sysctl_req(IpcVarEntry *e, int op)
|
static int ipc_sysctl_req(IpcVarEntry *e, int op)
|
||||||
{
|
{
|
||||||
struct sysctl_req req[] = {
|
struct sysctl_req req[] = {
|
||||||
@ -520,33 +517,21 @@ void show_ipc_msg(int fd, struct cr_options *o)
|
|||||||
pb_show_plain_payload(fd, ipc_msg_entry, ipc_msg_handler, o->show_pages_content);
|
pb_show_plain_payload(fd, ipc_msg_entry, ipc_msg_handler, o->show_pages_content);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void show_ipc_shm_entries(int fd)
|
static void ipc_shm_handler(int fd, void *obj, int show_pages_content)
|
||||||
{
|
{
|
||||||
pr_msg("\nShared memory segments:\n");
|
IpcShmEntry *e = obj;
|
||||||
while (1) {
|
|
||||||
int ret;
|
|
||||||
IpcShmEntry *shm;
|
|
||||||
|
|
||||||
ret = pb_read_eof(fd, &shm, ipc_shm_entry);
|
if (show_pages_content) {
|
||||||
if (ret <= 0)
|
pr_msg("\n");
|
||||||
return;
|
print_image_data(fd, round_up(e->size, sizeof(u64)));
|
||||||
|
} else
|
||||||
pr_msg_ipc_shm(shm);
|
lseek(fd, round_up(e->size, sizeof(u32)), SEEK_CUR);
|
||||||
|
|
||||||
if (lseek(fd, round_up(shm->size, sizeof(u32)), SEEK_CUR) == (off_t) -1)
|
|
||||||
ret = -1;
|
|
||||||
|
|
||||||
ipc_shm_entry__free_unpacked(shm, NULL);
|
|
||||||
if (ret < 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void show_ipc_shm(int fd, struct cr_options *o)
|
void show_ipc_shm(int fd, struct cr_options *o)
|
||||||
{
|
{
|
||||||
pr_img_head(CR_FD_IPCNS);
|
pb_show_plain_payload(fd, ipc_shm_entry, ipc_shm_handler,
|
||||||
show_ipc_shm_entries(fd);
|
o->show_pages_content);
|
||||||
pr_img_tail(CR_FD_IPCNS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void show_ipc_var_entry(int fd)
|
static void show_ipc_var_entry(int fd)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user