TIOCNOTTY under SCO System V/386
Michael Galassi
nerd at percival.rain.com
Sat Jun 22 11:11:14 AEST 1991
stockett at jeanluc.UUCP (Jeffrey M. Stockett) writes:
>I'm trying to port over some code from a BSD machine to SCO System V/386,
>and I have run into a problem with the following lines:
> if ((s = open("/dev/tty", O_RDWR)) >= 0) {
> ioctl(s, TIOCNOTTY, 0);
> close(s);
> }
Stab in the dark, looks like the debug code in rlogind. If this is
the case, #undef DEBUG, the TIOCNOTTY is not a good thing to have
occur to the controlling terminal of an interactive session.
If I'm wrong, here is the code to replace the above fragment:
(void) setpgrp();
This will dissociate you from the controlling terminal and will make
the next terminal you open the controlling terminal. There are other
side effects to this call, read the man page and know how these may
affect you.
FYI, this is the relevant section from the BSD man page (tty(4)).
A process can remove the association it has with its con-
trolling terminal by opening the file /dev/tty and issuing
an
ioctl(f, TIOCNOTTY, 0);
And, here is the relevant section from the Xenix man page (setpgrp(S))
There are many ramifications to be considered before
invoking setpgrp. When a process is made a process group
leader with setpgrp, the terminal that controlled the
process that issued the setpgrp statement is lost as the
controlling terminal for the new process group. The new
process group takes as its controlling terminal the next
terminal it opens that is not already open.
I assume that the functionality of setpgrp is identical in sco xenix
and sco unix.
Cheers,
-m
--
Michael Galassi | nerd at percival.rain.com
MS-DOS: The ultimate PC virus. | ...!tektronix!percy!nerd
More information about the Comp.unix.sysv386
mailing list