[CRIU] Re: [PATCH v3 1/4] IPC: dump shared memory

Pavel Emelyanov xemul at parallels.com
Wed Feb 8 12:43:33 EST 2012


> @@ -125,6 +126,22 @@ struct ipc_var_entry {
>  	u32	mq_msgsize_max;
>  } __packed;
>  
> +struct ipc_seg {
> +	u32	key;
> +	u32	uid;
> +	u32	gid;
> +	u32	cuid;
> +	u32	cgid;
> +	u32	mode;
> +	u32	id;
> +	u8	pad[4];
> +} __packed;
> +
> +struct ipc_shm_entry {
> +	struct ipc_seg seg;
> +	u64	size;
> +} __packed;

Why two structs?

> +
>  #define VMA_AREA_NONE		(0 <<  0)
>  #define VMA_AREA_REGULAR	(1 <<  0)	/* Dumpable area */
>  #define VMA_AREA_STACK		(1 <<  1)
> diff --git a/ipc_ns.c b/ipc_ns.c
> +}
> +
> +static int dump_ipc_shm_seg(int fd, int id, const struct shmid_ds *ds)

By now you should either place here check for the number of attaches should be zero
or implement dumping/restoring the attaches to tasks.

> +{
> +	struct ipc_shm_entry shm;
> +	int ret;
> +
> +	fill_ipc_seg(id, &shm.seg, &ds->shm_perm);
> +	shm.size = ds->shm_segsz;
> +	print_ipc_shm(&shm);
> +
> +	ret = write_img(fd, &shm);
> +	if (ret < 0) {
> +		pr_err("Failed to write IPC shared memory segment\n");
> +		return ret;
>  	}
> +	return dump_ipc_shm_pages(fd, &shm);
> +}


More information about the CRIU mailing list