Subject: Re: README: kernel pty struct allocation change
To: Andrew Brown <>
From: Todd Vierling <>
List: current-users
Date: 09/11/2000 10:32:01
On Mon, 11 Sep 2000, Andrew Brown wrote:

: indeed!  and...isn't pcvt gone?

Yes, but ttyvX still isn't available for i386 to use, I believe.

: does it work?  i don't see a way for it to exit the
: while/switch without returning an error...maybe i'm reading it wrong?

It's backpedaling into sys_open() to get a new fd and then doing a very
interesting trick, used by the /dev/fd nodes.  {struct proc}->p_dupfd is
Magic.  If a filedescriptor is put here, and a device open() call returns
ENXIO, the created file will be that fd, instead of a fd connected to the
ptmx device.  In essence, the user gets an open file on /dev/pty??.

This is how the returned file contains a st_rdev that isn't the same device
number as the /dev/ptmx device itself (see prior post).  It's not a pretty
hack, but it works; ideally, we should have a better way to handle
"masquerading" devices.

-- Todd Vierling <>  *
-- Speed, stability, security, and support.  Wasabi NetBSD:  Run with it.