Disassocation from controlling tty
Chris Torek
chris at umcp-cs.UUCP
Sun Mar 30 09:55:03 AEST 1986
In article <515 at ssc-bee.UUCP> bossert at ssc-bee.UUCP writes:
>Where the desired goal is disassociation of a process from its
>controlling tty, what are the differences between
setpgrp() and ioctl(TIOCSPGRP)
>? Which is preferable? Why?
Neither. Use
if ((t = open("/dev/tty", 0)) >= 0) {
(void) ioctl(t, TIOCNOTTY, 0);
(void) close(t);
}
I just checked the kernel code, and this changes u.u_procp->p_pgrp
too, so the setpgrp() call is unnecessary.
Note that if you execute this call without fork()ing, then wait
for some event, the shell will never regain control of the terminal
(if the process was started without `&').
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 1415)
UUCP: seismo!umcp-cs!chris
CSNet: chris at umcp-cs ARPA: chris at mimsy.umd.edu
More information about the Comp.unix.wizards
mailing list