From owner-freebsd-hackers Sat Apr 6 16:27:09 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id QAA25575 for hackers-outgoing; Sat, 6 Apr 1996 16:27:09 -0800 (PST) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.211]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id QAA25570 for ; Sat, 6 Apr 1996 16:27:08 -0800 (PST) Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id RAA28693; Sat, 6 Apr 1996 17:21:08 -0700 From: Terry Lambert Message-Id: <199604070021.RAA28693@phaeton.artisoft.com> Subject: Re: The F_SETOWN problem.. To: roell@blah.a.isar.de (Thomas Roell) Date: Sat, 6 Apr 1996 17:21:08 -0700 (MST) Cc: hackers@FreeBSD.ORG, jkh@time.cdrom.com, roell@xinside.com In-Reply-To: <199604060911.LAA00234@blah.a.isar.de> from "Thomas Roell" at Apr 6, 96 11:11:14 am X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > Ok, then I had 2 or 3 maybe very stupid sounding questions (and believe me, > I tried to work around them for quite a while now): > > 1) How do I get my process to be the controlling pgrp of this tty ? I > tried all things that worked under SVR4, but I'm lost on this one. > Just a couple of sample code lines would help me here incredible. The question is wrong. The correct question is "how do I make this tty the controlling tty for my process?". You are attempting to map in the wrong direction. > 2) Can my progress have two controlling ttys ? Basically this process > is also going to open /dev/ttyv3 (as an example), reading the > keyboard and also wanting to recieve a SIGIO (which fails right now > the same way). No. There is "THE controlling tty for a process group". Consider: when I have multiple tty's open, and I open /dev/tty, which tty will I get? The answer is that I will get the controlling tty. I assume you want this for SIGHUP processing? I used to work (for more than 5 years) as THE software engineer (not including the company president) for the #1 UNIX communications software (TERM). The *ONLY* reliable way to get SIGHUP delivery on two or more ttys is to use another process for each additional tty to act as the controlling process and then use an IPC mechanism to send the signals to the "master" process. We had to do this for a terminal emulation program, since I might call in and then call out of a system, and I want loss of carrier on EITHER tty to cause the program to shutdown the connection on the other tty. Consider: I call into work and I call out, long distance, and then my local power fails. Really, the entire idea of controlling ttys and signal delivery and session and process and credential association is rather broken. Unfortunately POSIX has cast it in stone and now we are all screwed if we want to be standards compliant. 8-(. > 3) Since this process has opened already a virutal terminal, he is > recieving signals for VT switching. Now if I would detach this one > from being the controlling tty and move the controlling tty to > /dev/cuaa1, would I still get those signals ? I don't know how the VT switching decides where to gsignal(), having not really cared to look (I still believe that DDX should be provided by the OS, and a signlaiing API of any kind is therefore unnecessary). I suspect it uses controlling tty in the process that has it open, so doing that would cause the signals to be blocked. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.