[CRIU] [RFC 1/2] tty: fix /dev/tty{1,63} minor number

Dmitry Safonov dsafonov at virtuozzo.com
Wed Apr 27 10:28:07 PDT 2016


On 04/27/2016 08:25 PM, Cyrill Gorcunov wrote:
> On Wed, Apr 27, 2016 at 08:10:53PM +0300, Dmitry Safonov wrote:
>> Seems like, device with TTY_MAJOR major and minor MIN_NR_CONSOLES
>> is pointing to /dev/tty1 (first vitual console) and MAX_NR_CONSOLES
>> is /dev/tty63.
>>
>> Cc: Cyrill Gorcunov <gorcunov at openvz.org>
>> Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
>> ---
>>   criu/tty.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/criu/tty.c b/criu/tty.c
>> index 68d7ba3d133b..7c634e19ebc0 100644
>> --- a/criu/tty.c
>> +++ b/criu/tty.c
>> @@ -261,7 +261,7 @@ struct tty_driver *get_tty_driver(dev_t rdev, dev_t dev)
>>   			return &ctty_driver;
>>   		break;
>>   	case TTY_MAJOR:
>> -		if (minor > MIN_NR_CONSOLES && minor < MAX_NR_CONSOLES)
>> +		if (minor >= MIN_NR_CONSOLES && minor <= MAX_NR_CONSOLES)
>>   			/*
>>   			 * Minors [MIN_NR_CONSOLES; MAX_NR_CONSOLES] stand
>>   			 * for consoles (virtual terminals, VT in terms
> Wait! IIRC MIN_NR_CONSOLES stands for 0 so it is pointing to /dev/tty
> and should be treated as current tty.
>
> [cyrill at uranus ~] stat /dev/tty
>    File: ‘/dev/tty’
> Device: 6h/6dInode: 1035        Links: 1     Device type: 5,0

Hmm, could you tell the kernel version on which MIN_NR_CONSOLES
is zero? On current master it's:
> [linux]$ git grep MIN_NR_CONSOLES
> include/uapi/linux/vt.h:#define MIN_NR_CONSOLES 1       /* must be at 
> least 1 */
> [linux]$ 
What I overlooked?

-- 
Regards,
Dmitry Safonov



More information about the CRIU mailing list