Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!cbosgd!gatech!seismo!umcp-cs!chris From: chris@umcp-cs.UUCP (Chris Torek) Newsgroups: net.unix-wizards Subject: Re: Disassocation from controlling tty Message-ID: <615@umcp-cs.UUCP> Date: Sat, 29-Mar-86 18:55:03 EST Article-I.D.: umcp-cs.615 Posted: Sat Mar 29 18:55:03 1986 Date-Received: Sun, 30-Mar-86 10:51:28 EST References: <515@ssc-bee.UUCP> Reply-To: chris@maryland.UUCP (Chris Torek) Distribution: net Organization: U of Maryland, Computer Science Dept., College Park, MD Lines: 25 In article <515@ssc-bee.UUCP> bossert@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@umcp-cs ARPA: chris@mimsy.umd.edu