Path: utzoo!mnetor!uunet!husc6!rutgers!sdcsvax!ucsdhub!jack!sdeggo!dave From: dave@sdeggo.UUCP (David L. Smith) Newsgroups: comp.unix.wizards Subject: Re: /dev/tty doesn't exist? Message-ID: <167@sdeggo.UUCP> Date: 3 Jan 88 08:23:43 GMT References: <445@minya.UUCP > Organization: Lazy Programmer's Society of San Diego Lines: 27 In article <445@minya.UUCP >, jc@minya.UUCP (John Chambers) writes: > Some hints: This is a rather generic Unix Sys/V.2, so the problem should > be similar to most ATT Unices. The most unusual thing about how X is run > is that it isn't being started by a login shell; it is started as a daemon > by init, and in some cases, decides to grab a terminal (whose name is on > its command line, and which doesn't have getty on it) and run a program > there. This is a useful thing to do if, for instance, you are playing > around with process-control applications. > > 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, can you say where? The 1/4-page /dev/tty entry isn't much help. > [In fact, the Unix manuals aren't very helpful in general if you want to > write a free-running background program. I've tried to help various users > who wanted to do this, and it's frustrating never quite knowing what I'm > talking about :-] The problem would seem to be that /dev/tty has no idea what tty you really want to be talking to. In order to set things up, you need to do a setpgrp() and then open the terminal you wish to talk to. Termio(7) briefly explains about the control terminal. -- David L. Smith {sdcsvax!man,ihnp4!jack!man, hp-sdd!crash, pyramid}!sdeggo!dave man!sdeggo!dave@sdcsvax.ucsd.edu Sinners can repent, but stupid is forever.