Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!virtech!cpcahil From: cpcahil@virtech.uucp (Conor P. Cahill) Newsgroups: comp.unix.questions Subject: Re: setpgrp question Keywords: setpgrp, unix system call Message-ID: <1989Dec24.222740.8645@virtech.uucp> Date: 24 Dec 89 22:27:40 GMT References: <6863@cbnewsh.ATT.COM> Organization: Virtual Technologies Inc. Lines: 33 In article <6863@cbnewsh.ATT.COM>, skumar@cbnewsh.ATT.COM (swaminathan.ravikumar) writes: > By reading different sources I found out that a process can > break its control terminal by calling "setpgrp". I don't > understand this 100%. Why should the process lose the control > terminal? why do you need "setpgrp"? setpgrp() is one of the steps that should be executed by a daemon process at initialization time. It does disconnect the terminal from the controll tty and therefore should only be used by programs that no longer wish to be associated with a terminal. Note that it does not disallow the use of stdin/stdout/stderr. These are file pointers that are already connected to file descriptors that read/write to a terminal. However, it does effect the ability of the program to re-connect with the terminal by opening "/dev/tty" (which is exactly what pg tries to do). > I know that it is used to group processes to receive > signals. Does this mean that the processes in the group cannot > use stdin/stdout. I would like to hear from anybody who has used > this call in a real application to understand this better. In reality you shouldn't use setpgrp() unless you want to run without any user interaction on the terminal (i.e. a background process or a daemon process that is supposed to be run in the background). -- +-----------------------------------------------------------------------+ | Conor P. Cahill uunet!virtech!cpcahil 703-430-9247 ! | Virtual Technologies Inc., P. O. Box 876, Sterling, VA 22170 | +-----------------------------------------------------------------------+