Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!spool.mu.edu!uunet!stanford.edu!leland.Stanford.EDU!dkeisen From: dkeisen@leland.Stanford.EDU (Dave Eisen) Newsgroups: comp.unix.questions Subject: Re: TIOCNOTTY definition Message-ID: <1991May29.193146.7428@leland.Stanford.EDU> Date: 29 May 91 19:31:46 GMT Article-I.D.: leland.1991May29.193146.7428 References: <27046@adm.brl.mil> Organization: Sequoia Peripherals, Inc. Lines: 32 In article <27046@adm.brl.mil> VENENGA@iscsvax.uni.edu writes: >I am trying to convert some bsd source to SYS V, and overall, it's not going >too bad. The only problem I am running into is a TIOCNOTTY not defined >compiler error. I have grep'ped all my include files, and cannot find a >TIOCNOTTY definition anywhere. Could some kind soul(s) tell me what this A define for TIOCNOTTY would not be of any use to you anyway. The fact that TIOCNOTTY is not in termio.h means that the terminal driver doesn't support this ioctl, which is in fact unique to BSD-like systems. This is usually used on a file descriptor obtained by opening /dev/tty in order for the calling process to disassociate itself with the control terminal (so it won't receive signals when a user hits the interrupt key, etc.). In System Vish systems the way to disassociate from the control terminal is to change your process group using the call setpgrp. So replace the opening /dev/tty, doing that ioctl, and closing the descriptor with a call to setpgrp. Caveat: If the process later opens up a terminal device file, that becomes the control terminal for the process and you lose the protection you just got by calling setpgrp. There are ways to deal with this, for a good discussion of the issues that arise when setting up a daemon, I recommend Richard Stevens's book on UNIX Network Programming. -- Dave Eisen dkeisen@leland.Stanford.EDU 1101 San Antonio Road, Suite 102 (Gang-of-Four is being taken off the net) Mountain View, CA 94043 (415) 967-5644