*BSD News Article 22926


Return to BSD News archive

Xref: sserve comp.os.386bsd.bugs:1659 comp.unix.bsd:12804 comp.unix.i386:7441
Newsgroups: comp.os.386bsd.bugs,comp.unix.bsd,comp.unix.i386
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!saimiri.primate.wisc.edu!sdd.hp.com!cs.utexas.edu!geraldo.cc.utexas.edu!portal.austin.ibm.com!awdprime.austin.ibm.com!fredriks
From: fredriks@austin.ibm.com (Lars Fredriksen)
Subject: setting TIOCSCTTY on /dev/tty
Originator: @worf.cet.austin.ibm.com
Sender: news@austin.ibm.com (News id)
Message-ID: <CFKJGp.1v2n@austin.ibm.com>
Date: Wed, 27 Oct 1993 18:31:37 GMT
Organization: IBM Austin
Lines: 27


What is the expected behaviour of opening /dev/tty and issuing a ioctl
to make it the controlling terminal?

Currently there is a bug in FreeBSD, where the vn_ioctl sets the
p->session->s_ttyvp to the current vnode if the ioctl issued is TIOCSCTTY.

This causes you to lose knowledge of the real terminal, and you end up
with an infinite recursion in the kernel when the next ioctl on /dev/tty
is issued. The recursion occurs between spec_ioctl and cttyioctl.

The question I have is:

	Are you allowed to issue TIOSCTTY on /dev/tty? 

My gut feeling says yes - but I am not that versed in the ins and outs of 
the tty subsystem so I would like some expert opinion.

Then assuming that you are allowed to do it, how would vn_ioctl check to 
make sure it reassigned the vnode only if it is not /dev/tty??

Lars
-- 

Regards,

----------------------------------------------------------------------------