[CRIU] [PATCH 3/7] tty: Save mount ids for terminals into image

Cyrill Gorcunov gorcunov at gmail.com
Wed Feb 8 07:54:37 PST 2017


On Wed, Feb 08, 2017 at 11:35:25AM +0300, Pavel Emelyanov wrote:
> > @@ -1479,6 +1481,11 @@ static int collect_one_tty_info_entry(void *obj, ProtobufCMessage *msg, struct c
> >  
> >  	info->tie = pb_msg(msg, TtyInfoEntry);
> >  
> > +	if (!info->tie->has_mnt_id) {
> > +		info->tie->has_mnt_id = true;
> > +		info->tie->mnt_id = 0;
> > +	}
> 
> Would you explain this?

Not sure what exactly to explain here, explicit zeroifying?
Yes, decoder should zero them (and in most case it does) but
just to be on safe side I did it explicitly.

> > @@ -39,6 +39,8 @@ enum TtyType {
> >  message tty_data_entry {
> >  	required uint32			tty_id		= 1;
> >  	required bytes			data		= 2;
> > +
> > +	optional sint32			mnt_id		= 3 [default = 0];
> 
> Default is zero w/o explicit mark.
> The tty_id references tty_info_entry which already has mnt_id.

tty_id is not longer unique, with multiple devpts each tty and
related resource is addressed with two keys: tty_id + mnt_id,
so every resource (tty-info, tty-file, tty-data) must carry
own mnt_id, or we need rework tty code to make tty-id to
be unique but in this case readin tty[-image]|[-data] will
be a way more harder with crit help, believe me, i tried.

	Cyrill


More information about the CRIU mailing list