[CRIU] Re: [PATCH 2/8] parasite: support sockets queues

Kinsbursky Stanislav skinsbursky at openvz.org
Tue Feb 28 06:40:55 EST 2012


28.02.2012 15:36, Pavel Emelyanov пишет:
>> +static int dump_socket_queue(int img_fd, struct sk_queue_item *item, int *err)
>> +{
>> +	struct sk_packet_entry *pe;
>> +	unsigned long size;
>> +	socklen_t tmp;
>> +	int ret, minus_one = -1;
>> +	int sock_fd = item->fd;
>> +
>> +	/*
>> +	 * Discover max DGRAM size
>> +	 */
>> +	ret = sys_getsockopt(sock_fd, SOL_SOCKET, SO_RCVBUF,&ret,&tmp);
> NAK. The SO_RCVBUF is not used in unix sockets.

Yes, you right. Will replace by SO_SNDBUF.

>> +	if (ret<  0) {
>> +		sys_write_msg("getsockopt failed\n");
>> +		*err = ret;
>> +		return PARASITE_ERR_FAIL;
>> +	}
>> +	/*
>> +	 * Note: 32 bytes will be used by kernel for protocol header.
>> +	 */
>> +	size = ret - 32;
>> +	/*
>> +	 * Try to alloc buffer for max supported DGRAM + our header.
>> +	 * Note: STREAM queue will be written by chunks of this size.
>> +	 */
>> +	pe = brk_alloc(size + sizeof(struct sk_packet_entry));
>> +	if (!pe) {
>> +		sys_write_msg("not enough mem for skb\n");
>> +		*err = -ENOMEM;
>> +		return PARASITE_ERR_MMAP;
>> +	}
>> +	/*
>> +	 * Enable peek offset incrementation.
>> +	 */
>> +	ret = 0;
>> +	*err = sys_setsockopt(sock_fd, SOL_SOCKET, SO_PEEK_OFF,&ret, sizeof(int));
> You should read the previous value first.

Forgot about it. thanks.



-- 
Best regards,
Stanislav Kinsbursky




More information about the CRIU mailing list