Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!tcdcs!bofin!cjmchale From: cjmchale@cs.tcd.ie (Ciaran McHale) Newsgroups: comp.windows.x.motif Subject: Re: Child processes keep window alive after X program terminates Message-ID: <1991Feb8.162913.19062@cs.tcd.ie> Date: 8 Feb 91 16:29:13 GMT References: <107@secola.Columbia.NCR.COM> <1991Feb7.200601.2069@csn.org> Organization: DSG, Dept. of Comp. Sci., Trinity College, Dublin. Lines: 34 In <1991Feb7.200601.2069@csn.org> anstettj@tramp.Colorado.EDU (ANSTETT JANET S S) writes: >In article <107@secola.Columbia.NCR.COM> >tduncan@secola.Columbia.NCR.COM (Terry S. Duncan) writes: >> >> I am writing a motif application which manages a unix software package. >>Among other things my motif application spawns off other unix processes >>(daemons) which will continue to run after the motif program is terminated. >>I am using system(2) to spawn of the child processes. >>The problem I am having is that after I start one of these daemons my motif >>window does not go away unless all children are terminated. In other words, >>the unix process terminates but the window hangs arround... > >What you need to do is a vfork, then in the child process, close the file >descriptor associated with that window. Another approach is to mark the file descriptor, obtained by invoking XConnectionNumber(display), to be "close-on-exec", i.e., the file descriptor should be closed automatically if the exec() system call (or one of its variations) is called. See the manual mage for "fcntl" for more information about the close-on-exec flag associated with file descriptors. Disclaimer: I know that system V has close-on-exec, but I don't know about BSD Unix. Regards, Ciaran. -- Ciaran McHale "Verbosity says it all" ____ Department of Computer Science, Trinity College, Dublin 2, Ireland. \ / Telephone: +353-1-772941 ext 1538 FAX: +353-1-772204 \/ Telex: 93782 TCD EI email: cjmchale@cs.tcd.ie