Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 06 Jul 2005 05:19:20 -0400
From:      Joe Marcus Clarke <marcus@FreeBSD.org>
To:        current@FreeBSD.org
Cc:        phk@FreeBSD.org
Subject:   Re: (problem found) grantpt broken on -CURRENT
Message-ID:  <1120641560.95261.1.camel@shumai.marcuscom.com>
In-Reply-To: <1120623729.99631.21.camel@shumai.marcuscom.com>
References:  <1120539465.3587.19.camel@shumai.marcuscom.com> <1120623729.99631.21.camel@shumai.marcuscom.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--=-m1CqonUApY83P0O22e8X
Content-Type: multipart/mixed; boundary="=-9t8g05O1FJRlMHzDXQT6"


--=-9t8g05O1FJRlMHzDXQT6
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Wed, 2005-07-06 at 00:22 -0400, Joe Marcus Clarke wrote:

>=20
> 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.
>=20
> 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.
>=20
> 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

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

--=-9t8g05O1FJRlMHzDXQT6
Content-Disposition: attachment; filename=grantpt.c.diff
Content-Transfer-Encoding: base64
Content-Type: text/x-patch; name=grantpt.c.diff; charset=ISO-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xlbiA9IHNpemVvZihz
bGF2ZSk7DQogDQogCXJldHZhbCA9IE5VTEw7DQogDQpAQCAtMjIzLDEwICsyMjgsMTggQEAgcHRz
bmFtZShpbnQgZmlsZGVzKQ0KIAkJaWYgKCFJU1BUTShzYnVmKSkNCiAJCQllcnJubyA9IEVJTlZB
TDsNCiAJCWVsc2Ugew0KLQkJCSh2b2lkKXNwcmludGYoc2xhdmUsIF9QQVRIX0RFViBQVFNfUFJF
RklYICIlYyVjIiwNCi0JCQkJICAgICAgUFRfREVWMVttaW5vcihzYnVmLnN0X3JkZXYpIC8gMzJd
LA0KLQkJCQkgICAgICBQVF9ERVYyW21pbm9yKHNidWYuc3RfcmRldikgJSAzMl0pOw0KIAkJCXJl
dHZhbCA9IHNsYXZlOw0KKwkJCSpyZXR2YWwgPSAnXDAnOw0KKwkJCXN0cmNweShyZXR2YWwsIF9Q
QVRIX0RFVik7DQorCQkJdXNlZCA9IHN0cmxlbihyZXR2YWwpOw0KKwkJCWZnbi5sZW4gPSBsZW4g
LSB1c2VkOw0KKwkJCWZnbi5idWYgPSByZXR2YWwgKyB1c2VkOw0KKwkJCWlmICghX2lvY3RsKGZp
bGRlcywgRklPREdOQU1FLCAmZmduKSkgew0KKwkJCQlyZXR1cm4gKHJldHZhbCk7DQorCQkJfQ0K
KwkJCXVzZWQgPSBzdHJsZW4ocmV0dmFsKTsNCisJCQlkZXZuYW1lX3Ioc2J1Zi5zdF9yZGV2LCBT
X0lGQ0hSLCByZXR2YWwgKyB1c2VkLA0KKwkJCQkgIGxlbiAtIHVzZWQpOw0KIAkJfQ0KIAl9DQog
DQo=


--=-9t8g05O1FJRlMHzDXQT6--

--=-m1CqonUApY83P0O22e8X
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (FreeBSD)

iD8DBQBCy6IYb2iPiv4Uz4cRAgtAAJ4kTNDzmYe637yxJ7mPM2iBeWP6cgCcC/rO
sg01NpeLpeKrTbqOjfMqV3k=
=bmvY
-----END PGP SIGNATURE-----

--=-m1CqonUApY83P0O22e8X--




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1120641560.95261.1.camel>