tduncan@secola.Columbia.NCR.COM (Terry S. Duncan) (02/07/91)
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. When I do a `ps -ef` I see the child processes all with parent process ID of 1 and no shell or any- thing to be keeping the window up. Is this a bug in motif, X, or mwm? If not, what do I need to do to make the window dissapear? I have tried ignoring and releasing the SIGCLD signal, but, there was no difference. I have also tried using fork(2) and exec(2) but that made no difference either. - Terry
anstettj@tramp.Colorado.EDU (ANSTETT JANET S S) (02/08/91)
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. In other words, use XtDisplay to get all the display information, then in the child do a close on fd in the display information. After this do your exec. This will allow you to exit your application before all the child processes have finished. Hope this helps. Janet Anstett
cjmchale@cs.tcd.ie (Ciaran McHale) (02/09/91)
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