All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bubulac Tatiana <bubulac@unidec.ro>
To: Glynn Clements <glynn.clements@virgin.net>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: SIGTERM
Date: Wed, 22 May 2002 09:20:00 +0300	[thread overview]
Message-ID: <3CEB3890.2EEC90FE@unidec.ro> (raw)
In-Reply-To: 15594.22731.28513.237490@cerise.nosuchdomain.co.uk

That's right.

In the parent process I have the  line no 6 where it blocks.

...
1     signal (SIGTERM, die);
2     signal (SIGALRM, dummy);
...
3    for (min = 0; min < 15 && not_done; min++)
4    {
5         alarm ((unsigned int) 60); /* wait for 1 minute */
6         pid = wait (&status);    /* Wait for a process to end */
7         alarm ((unsigned int) 0); /* Reset alarm */
....
8    }

The problem is that the child process did not catch the signal. I put a
printf in the child signal handler
function.
If I give the "kill child_pid" also nothing happens. Of course if I give
"kill -9 child_pid" the child is killed
and the parent will display "Normal termination".


Glynn Clements wrote:

> Bubulac Tatiana wrote:
>
> >     I want to terminate a parent process that attach several shared
> > memory segments
> > with kill(pid, SIGTERM) but it fails to terminate.
> >     Even if I give the command from command line it fails to terminate.
> >     If I give kill -9 pid it terminates but the shred memory segments
> > remains.
> >     Why I cannot terminate it with  SIGTERM signal?
>
> Presumably the receiver has either blocked, ignored or caught SIGTERM.
>
> >     "....
> >     status = kill ((pid_t)pid, SIGTERM);
> >      printf("status = %d\n", status);
> >     ...."
> > The status is 0. The pid is correct.
>
> That only tells you that the signal was sent. It doesn't tell you what
> the receiving process did as a result; the receiving process may not
> have even received the signal by the time that kill() returns.
>
> --
> Glynn Clements <glynn.clements@virgin.net>


  reply	other threads:[~2002-05-22  6:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-21 10:51 SIGTERM Bubulac Tatiana
2002-05-21 14:25 ` SIGTERM Glynn Clements
2002-05-22  6:20   ` Bubulac Tatiana [this message]
2002-05-22 14:18     ` SIGTERM Glynn Clements

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3CEB3890.2EEC90FE@unidec.ro \
    --to=bubulac@unidec.ro \
    --cc=glynn.clements@virgin.net \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.