From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f8c9b,63125f2416827054 X-Google-Attributes: gidf8c9b,public X-Google-Thread: fc89c,63125f2416827054 X-Google-Attributes: gidfc89c,public X-Google-Thread: fee84,63125f2416827054 X-Google-Attributes: gidfee84,public X-Google-ArrivalTime: 1993-04-16 09:57:39 PST Xref: gmd.de comp.unix.osf.osf1:268 comp.unix.programmer:5757 comp.unix.questions:14939 Path: gmd.de!urmel.informatik.rwth-aachen.de!uni-paderborn.de!joost From: joost@cadlab.de (Michael Joosten) Newsgroups: comp.unix.osf.osf1,comp.unix.programmer,comp.unix.questions Subject: Re: Having trouble kill()ing processes from C code. Date: 16 Apr 93 18:55:40 Organization: CADLAB, Paderborn, FRG Distribution: usa Message-ID: References: <1993Apr14.124628.20840@porthos.cc.bellcore.com> Reply-To: joost@cadlab.de NNTP-Posting-Host: ori.cadlab.uni-paderborn.de In-reply-to: wws@iscp.bellcore.com's message of Wed, 14 Apr 93 12:46:28 GMT In article <1993Apr14.124628.20840@porthos.cc.bellcore.com> wws@iscp.bellcore.com (Wayne Scott) writes: keeping track of the PIDs so I can terminate them when the application is shut down. I can NOT terminate the xterm PIDs with kill(pid, SIGTERM); but I CAN terminate them with kill(pid, SIGKILL). However, when an rlogin is done from the xterm, the rlogin is still active AFTER the xterm has been killed. When I logout of the xterm windows with , the xterm AND rlogin go away. If you have xterm sources, you can easily see that there is something 'magically' going on for System V. I had the same problem with a 'tool server' that creates new processes on remote requests. Worked fine on Sun, but on a SGI one could not kill the xterms unless with brutal force, especially not with INTR, HUP and QUIT. My solution was to create a new process group for the forked process, like this: OS_signal(SIGHUP, (OS_SigType)SIG_DFL); OS_signal(SIGINT, (OS_SigType)SIG_DFL); OS_signal(SIGQUIT, (OS_SigType)SIG_DFL); OS_signal(SIGHUP, (OS_SigType)SIG_DFL); // ensure that the exec'ed process has its own group, // otherwise some programms in SysVR3 will ignore // the terminal-signals (SIGHUP, SIGINTR, SIGQUIT, SIGTERM) // like xterms on SGI IRIX..... (mj) setsid(); execvp( path, &argv[0] ); This is not an OSF feature, but rather common to System V and POSIX - or xterm's handling of signals in case of beeing compiled for SysV. The code checks if the pid == pgrp and only then reacts on the signals (as I recall..) Hope that helps, Michael -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Michael Joosten | Tel. : (+49) (+) 5251-284 120 | | CADLAB | Fax : (+49) (+) 5251-284 140 | | Bahnhofstr. 32 | E-Mail: joost@cadlab.de | | D-4790 Paderborn | ...!uunet!unido!cadlab!joost | | FRG | Mass mail to: joost@pbinfo.uni-paderborn.de | |--------------------------------------------------------------------------| | CADLAB is a cooperation between Uni-GH Paderborn & SNI AG | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~