Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Nov 1996 15:12:25 +0600
From:      Tim Pierce <twpierce@bio-3.bsd.uchicago.edu>
To:        bde@zeta.org.au
Cc:        hackers@FreeBSD.org
Subject:   Re: TIOCSPGRP on ptys?
Message-ID:  <9611082112.AA11234@bio-5.bsd.uchicago.edu>
In-Reply-To: <199611081551.CAA08229@godzilla.zeta.org.au> (message from Bruce Evans on Sat, 9 Nov 1996 02:51:00 %2B1100)

next in thread | previous in thread | raw e-mail | index | archive | help
Bruce Evans <bde@zeta.org.au> said:

> [I wrote:]
>
> >In fact, the source for kern/tty_pty.c seems to
> >be written to prevent *any* ioctls from being performed on slave
> >ptys, and to prevent most TIOC ioctls from being performed on
> >master ptys.

Clearly I spoke too rashly.  I did not notice that ptyioctl()
calls ttioctl() for any unhandled ioctls -- only that it calls the
line discipline ioctl after checking special cases first.  My bad.

> In BSD4.4Lite, there is essentially only
> one working method:
> 
> 1. Stop being a process group leader, e.g., by forking and continuing
>    in the child.  This is necessary for step 2 to work.  See setsid(2).
> 2. Open the new tty.
> 3. Call setsid() to become a session leader.
> 4. Call ioctl(fd, TIOCSCTTY) to get a controlling terminal.
> 5. Call tcsetpgrp(fd, groupid) or an ioctl to set the process group.
> 
> login_tty() does steps (3) and (4) plus some simple plumbing.  It is
> documented in lgin_tty.c :-).  These interfaces have been stable for
> 4+ years.

Thanks for the elucidation.  I was not sure whether login_tty() is
the preferred mechanism because I could find no documentation for
it and did not know how long it has been a part of 4BSD.  Should a
man3 page be included for it?  (I could contribute one if it is
agreed that this is a good idea.)




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