Subject: Re: Replacing svr4_ptm_alloc() with ptmopen()
To: None <tech-kern@netbsd.org>
From: Christos Zoulas <christos@astron.com>
List: tech-kern
Date: 07/03/2007 18:40:02
In article <20070701200918.GU24232@snowdrop.l8s.co.uk>,
David Laight  <david@l8s.co.uk> wrote:
>There is code in compat/svr4/svr4_net.c that (I suspect) is implementing
>the SVR3/4 'clone' device driver [1].
>
>For pseudo ttys it calls svr4_ptm_alloc() which loops through some
>/dev/ptyXX names then returns EMOVEFD in order for TRT to happen back
>in sys_open().
>
>I suspect that call to svr4_ptm_alloc() could be replaced by a call to
>ptmopen() (in kern/tty_ptm.c) and it would all still work.
>
>Is that correct? and should it use minor 0 or 2 ?

Yes, it should be done this way. But you also need to handle the case
where the NO_DEV_PTM option or whatever it is called is enabled (perhaps
just fail then). 2 grants the pty on open, 0 does not. You'll need to
test or trusss a solaris binary to see what the c library does. I am
guessing 0.

christos