Path: utzoo!utgpu!water!watmath!clyde!ima!minya!jc From: jc@minya.UUCP (John Chambers) Newsgroups: comp.unix.wizards Subject: Re: /dev/tty doesn't exist? Summary: Got it; thanks, folks Message-ID: <458@minya.UUCP> Date: 28 Jan 88 03:55:25 GMT References: <445@minya.UUCP > <167@sdeggo.UUCP> <706@stride.Stride.COM> Organization: home Lines: 31 > >In article <445@minya.UUCP >, jc@minya.UUCP (John Chambers) writes: > > > > > > Perhaps the question could be rephrased: What is the official, approved > > > way for a daemon process like this to attach a terminal? If the answer > > > is RTFM.... > Well, after wading through lots of responses, most of which told me things I already knew, and didn't answer the question, a couple of folks gave the right hint, something that I still can't get from re-reading TFM: the call of setpgrp() must happen BEFORE opening any terminal device. If there is any file open that looks like a terminal, setpgrp() seems to have no effect at all (or maybe it's just too subtle for me :-). Anyhow, I have my program finding /dev/tty now, so thanks. There is still a puzzle, in that my process starts children, including quite often a shell, and these inherit the terminal (as with getty/login, I guess). I've tried making the children into process-group leaders on their own, to no avail. No matter what I do, the ^C at the terminal goes to the original process. It doesn't even work for a child to close all its files, setpgrp(), and re-open all its files. Very, very strange stuff here. I've sort of handled this by having the program intercept all signals and pass them along to its children. This works, but it doesn't seem to reach the grandchildren, even if I do kill(0,). The manual says it should, but the grandchildren don't notice the signal. Am I paranoid, or did they do this intentionally to make my life difficult? -- John Chambers <{adelie,ima,maynard,mit-eddie}!minya!{jc,root}> (617/484-6393)