Subject: Re: pty number?
To: Emmanuel Dreyfus <p99dreyf@criens.u-psud.fr>
From: Christoph Hellwig <hch@lst.de>
List: tech-kern
Date: 02/13/2001 00:08:25
On Mon, Feb 12, 2001 at 11:53:27PM +0100, Emmanuel Dreyfus wrote:
> I carry on debugging Linux compatibility, and today, I have a problem
> with Linux's xterm.
>
> It fails on an ioctl that we don't emulate. It is about getting the pty
> number. I'd be happy to fix it, but... what is a pty number?
If you look at the new-style (Unix98) linux pty code, you will see that
it uses multiple major numbers - so just the minor number won't do as
count. The reason why this is needed is because the Unix98 pty code uses
a clone device for opening a pty, so you will get a different number than
the one of the device you opened (/dev/ptmx).
The following code calculates it (drivers/char/pty.c +240):
static int pty_get_device_number(struct tty_struct *tty, unsigned int *value)
{
unsigned int result = MINOR(tty->device)
- tty->driver.minor_start + tty->driver.name_base;
return put_user(result, value);
}
I hope that helps.
Christoph
--
Whip me. Beat me. Make me maintain AIX.