TIOCNOTTY definition

Dave Eisen dkeisen at leland.Stanford.EDU
Thu May 30 05:31:46 AEST 1991


In article <27046 at adm.brl.mil> VENENGA at 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 at 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



More information about the Comp.unix.questions mailing list