Re: (problem found) grantpt broken on -CURRENT

From: Joe Marcus Clarke <marcus_at_FreeBSD.org>
Date: Wed, 06 Jul 2005 05:19:20 -0400
On Wed, 2005-07-06 at 00:22 -0400, Joe Marcus Clarke wrote:

> 
> I did some more research, and found that the problem was not in devfs
> hiding the devices, but rather in the way ptsname() determined the tty
> name for the open file descriptor.  The kernel gets the minor number for
> a tty from the si_drv0 member of the device cdev structure.  However,
> ptsname() relies on the minor number of the st_rdev member of the stat
> structure to get the tty name.  Devfs sets the st_rdev value to the
> device's inode xor a random number.  Therefore, ptsname() returns
> garbage, and grantpt() subsequently fails.
> 
> I created this patch that corrects the problem, but I'm not sure if it's
> the right way to go.  Poul-Henning (or anyone) could you have a look and
> let me know if this is okay?  I'd really like to see this working again
> in -CURRENT so 6.0 GNOME users will be able to use their sftp shares.
> Thanks.
> 
> Oh, and it might be a good idea to make sys/types.h aware of MAXMINOR as
> it still hardcodes the constant.

Actually, I think the real solution is to reimplement ptsname() using
devname(3) similar to the way ttyname() is done.

Joe

-- 
Joe Marcus Clarke
FreeBSD GNOME Team      ::      gnome_at_FreeBSD.org
FreeNode / #freebsd-gnome
http://www.FreeBSD.org/gnome

Received on Wed Jul 06 2005 - 07:19:37 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:38 UTC