From owner-freebsd-current@FreeBSD.ORG Wed Jul 6 09:19:37 2005 Return-Path: X-Original-To: current@FreeBSD.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BD21416A41C; Wed, 6 Jul 2005 09:19:37 +0000 (GMT) (envelope-from marcus@FreeBSD.org) Received: from creme-brulee.marcuscom.com (creme-brulee.marcuscom.com [24.172.16.118]) by mx1.FreeBSD.org (Postfix) with ESMTP id 698B043D48; Wed, 6 Jul 2005 09:19:35 +0000 (GMT) (envelope-from marcus@FreeBSD.org) Received: from shumai.marcuscom.com (shumai.marcuscom.com [192.168.1.4]) by creme-brulee.marcuscom.com (8.13.3/8.13.3) with ESMTP id j669JpMl082719; Wed, 6 Jul 2005 05:19:51 -0400 (EDT) (envelope-from marcus@FreeBSD.org) From: Joe Marcus Clarke To: current@FreeBSD.org 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> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-m1CqonUApY83P0O22e8X" Organization: FreeBSD, Inc. Date: Wed, 06 Jul 2005 05:19:20 -0400 Message-Id: <1120641560.95261.1.camel@shumai.marcuscom.com> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 FreeBSD GNOME Team Port Cc: phk@FreeBSD.org Subject: Re: (problem found) grantpt broken on -CURRENT X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jul 2005 09:19:38 -0000 --=-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-8859-1 LS0tIHNyYy9saWIvbGliYy9zdGRsaWIvZ3JhbnRwdC5jLm9yaWcJV2VkIEp1bCAgNiAwNDoyMjoz NyAyMDA1DQorKysgc3JjL2xpYi9saWJjL3N0ZGxpYi9ncmFudHB0LmMJV2VkIEp1bCAgNiAwNTox NzowOSAyMDA1DQpAQCAtMzgsMTIgKzM4LDE1IEBAIF9fRkJTRElEKCIkRnJlZUJTRDogc3JjL2xp Yi9saWJjL3N0ZGxpYi8NCiAjaW5jbHVkZSAibmFtZXNwYWNlLmgiDQogI2luY2x1ZGUgPHN5cy90 eXBlcy5oPg0KICNpbmNsdWRlIDxzeXMvc3RhdC5oPg0KKyNpbmNsdWRlIDxzeXMvaW9jdGwuaD4N CisjaW5jbHVkZSA8c3lzL2ZpbGlvLmg+DQogI2luY2x1ZGUgP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ZXR2YWwsIF9Q 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--