Re: Question on SIGSTOP
From: Barry Margolin (barmar_at_alum.mit.edu)
Date: 03/31/05
- Next message: Paul Pluzhnikov: "Re: use LD_PRELOAD with Java VM"
- Previous message: Rouben Rostamian: "Re: Difference between fvwm2 and fvwm??"
- In reply to: Minti: "Re: Question on SIGSTOP"
- Next in thread: Richard Kettlewell: "Re: Question on SIGSTOP"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 30 Mar 2005 20:35:43 -0500
In article <1112212957.827926.3290@o13g2000cwo.googlegroups.com>,
"Minti" <imanpreet@gmail.com> wrote:
> Richard Kettlewell wrote:
> > "Minti" <imanpreet@gmail.com> writes:
> > > What is the the behaviour of "overloading" the SIGSTOP? When I try
> > > to provide a handler for it using signal, I get SIG_ERR.
> >
> > You cannot provide a handler for SIGSTOP.
> >
> > > However bash, csh and other s****s seem to be able to provide
> > > handlers for SIGSTOP for when I press "Ctrl+Z" or when I do "kill
> > > -SIGSTOP process_id" I get a "STOPPED message".
> >
> > The message comes from the parent s****, not the suspended process.
> > It is the subprocess, not the s****, that receives the stop signal.
>
>
> I would have understood this if it were to print "STOPPED" message only
> for "Ctrl+Z", for it is only the s**** that sends the signal. But what
> I am confused about is that why does this happen when I _specifically_
> send SIGSTOP using kill. S****, be it parent or subprocess has no way
> of providing a handler for SIGSTOP, so how does it get to know about
> SIGSTOP signal.
When a child process is stopped, the parent process is sent a SIGCHLD
signal. This signal can be caught, and the shell's handler then calls
one of the wait() variants, discovers that the child was stopped, and
prints the "STOPPED" message.
-- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me ***
- Next message: Paul Pluzhnikov: "Re: use LD_PRELOAD with Java VM"
- Previous message: Rouben Rostamian: "Re: Difference between fvwm2 and fvwm??"
- In reply to: Minti: "Re: Question on SIGSTOP"
- Next in thread: Richard Kettlewell: "Re: Question on SIGSTOP"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|