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

Kinsbursky Stanislav skinsbursky at openvz.org
Thu Feb 9 03:09:00 EST 2012


08.02.2012 21:43, Pavel Emelyanov пишет:
>> @@ -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?

struct ipc_seg will be used also for queues and semaphores.


>> +
>>   #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.

What for?

>> +{
>> +	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);
>> +}


-- 
Best regards,
Stanislav Kinsbursky




More information about the CRIU mailing list