Subject: Re: unexpected behaviour of grantpt(3)
To: None <tech-kern@NetBSD.org>
From: Klaus Heinz <k.heinz.feb.sechs@onlinehome.de>
List: tech-kern
Date: 02/18/2006 17:42:01
joerg@britannica.bec.de wrote:

> - static /dev + chmod / chown of master and slave
> - dynamic /dev or /dev/pty: ownership of slave is based on the calling
> process.
>=20
> Linux has implemented the latter for ages, the former is what openpty
> traditionally did. To prevent races in the former way, you must close
> all other references to slave, since they might have been acquired by
> the original permissions.

Ok, I think I understand this better now.

> The real question for me is why do you mix openpty and grantpt at all?
> You should use posix_openpt and grantpt for this purpose.

Don't shoot the messenger. IO-Tty uses openpty and grantpt this way, I
am only trying to make it work on NetBSD again.

There are many different ways to set up the master and slave tty
on different systems and that is just the order in which the IO-Tty
module tries to use what is available on a particular system.
Unfortunately, posix_openpt() is not one of the functions the Perl module
knows about.

=46rom what I found on the web, Linux, FreeBSD, OpenBSD, NetBSD (since 3.0),
Solaris and AIX support posix_openpt() and grantpt(), so I will probably=20
propose this route to the author(s). Meanwhile I will add a patch for
NetBSD to pkgsrc which is as unintrusive as possible.


ciao
     Klaus

 =20