* Having trouble kill()ing processes from C code.
@ 1993-04-14 12:46 Wayne Scott
1993-04-16 22:55 ` Michael Joosten
0 siblings, 1 reply; 2+ messages in thread
From: Wayne Scott @ 1993-04-14 12:46 UTC (permalink / raw)
Hi Folks:
I have an X/Motif application from which I allow users to create xterm
windows to access various machines on the LAN. I do it via fork()/execvp(),
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 <ctrl-d>, the xterm AND rlogin go away.
That's EXACTLY what I want, but can't get it to happen from C code.
I noticed that the xterm processes have "root" as the USER. I don't know if
that's a problem or not. kill(pid, SIGTERM) worked fine on AIX and on OSF/1
on a DECstation 5000 (if I remember correctly).
At this point I don't know what the real problem or solution is.
All helpful suggestions are welcome.
Thank you,
Wayne
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Having trouble kill()ing processes from C code.
1993-04-14 12:46 Having trouble kill()ing processes from C code Wayne Scott
@ 1993-04-16 22:55 ` Michael Joosten
0 siblings, 0 replies; 2+ messages in thread
From: Michael Joosten @ 1993-04-16 22:55 UTC (permalink / raw)
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 <ctrl-d>, 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 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1993-04-16 22:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1993-04-14 12:46 Having trouble kill()ing processes from C code Wayne Scott
1993-04-16 22:55 ` Michael Joosten
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox