* SIGSEGV
@ 2005-03-02 12:20 kaushal
2005-03-02 13:48 ` SIGSEGV mohana sundaram
2005-03-04 0:33 ` SIGSEGV Glynn Clements
0 siblings, 2 replies; 4+ messages in thread
From: kaushal @ 2005-03-02 12:20 UTC (permalink / raw)
To: linux-c
Hello all,
I have big package which "must" run all the time irrespective of any
errors.As a part of that Iam even handling the SIGSEGV.The problem is
even if I handle the sigsegv,the handler gets called continuously in an
infinite loop as if the signal is being recvd. continuously.How can I
solve this issue and make my handle run only once?Does bash has such a
mechanism internally?Any suggestions would be very helpful.
Thanks in advance.
kaushal.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: SIGSEGV
2005-03-02 12:20 SIGSEGV kaushal
@ 2005-03-02 13:48 ` mohana sundaram
2005-03-02 14:24 ` SIGSEGV Ron Michael Khu
2005-03-04 0:33 ` SIGSEGV Glynn Clements
1 sibling, 1 reply; 4+ messages in thread
From: mohana sundaram @ 2005-03-02 13:48 UTC (permalink / raw)
To: kaushal; +Cc: linux-c
You should not handle SIGSEGV and continue the process execution. The
result is undefined. Consider restarting the program afresh if your
program has to run all the time.
Thanks,
- Mohan.
On Wed, 02 Mar 2005 17:50:28 +0530, kaushal <kaushal@rocsys.com> wrote:
> Hello all,
> I have big package which "must" run all the time irrespective of any
> errors.As a part of that Iam even handling the SIGSEGV.The problem is
> even if I handle the sigsegv,the handler gets called continuously in an
> infinite loop as if the signal is being recvd. continuously.How can I
> solve this issue and make my handle run only once?Does bash has such a
> mechanism internally?Any suggestions would be very helpful.
> Thanks in advance.
>
> kaushal.
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
The expert at anything was once a beginner.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: SIGSEGV
2005-03-02 13:48 ` SIGSEGV mohana sundaram
@ 2005-03-02 14:24 ` Ron Michael Khu
0 siblings, 0 replies; 4+ messages in thread
From: Ron Michael Khu @ 2005-03-02 14:24 UTC (permalink / raw)
To: mohana sundaram, linux-c-programming
kaushal,
perhaps u can try making use of setjmp.h functions =)
but then perhaps ur application might have done a lot illegal memory
access...
thus the reason for those SIGSEGV's
mohana sundaram wrote:
>You should not handle SIGSEGV and continue the process execution. The
>result is undefined. Consider restarting the program afresh if your
>program has to run all the time.
>
>Thanks,
>- Mohan.
>
>
>On Wed, 02 Mar 2005 17:50:28 +0530, kaushal <kaushal@rocsys.com> wrote:
>
>
>>Hello all,
>> I have big package which "must" run all the time irrespective of any
>>errors.As a part of that Iam even handling the SIGSEGV.The problem is
>>even if I handle the sigsegv,the handler gets called continuously in an
>>infinite loop as if the signal is being recvd. continuously.How can I
>>solve this issue and make my handle run only once?Does bash has such a
>>mechanism internally?Any suggestions would be very helpful.
>>Thanks in advance.
>>
>>kaushal.
>>
>>-
>>To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
>>the body of a message to majordomo@vger.kernel.org
>>More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>>
>>
>
>
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: SIGSEGV
2005-03-02 12:20 SIGSEGV kaushal
2005-03-02 13:48 ` SIGSEGV mohana sundaram
@ 2005-03-04 0:33 ` Glynn Clements
1 sibling, 0 replies; 4+ messages in thread
From: Glynn Clements @ 2005-03-04 0:33 UTC (permalink / raw)
To: kaushal; +Cc: linux-c
kaushal wrote:
> I have big package which "must" run all the time irrespective of any
> errors.As a part of that Iam even handling the SIGSEGV.The problem is
> even if I handle the sigsegv,the handler gets called continuously in an
> infinite loop as if the signal is being recvd. continuously.How can I
> solve this issue and make my handle run only once?
Install the handler using sigaction() with the SA_RESETHAND flag. When
the signal is received, the handler will be de-installed; if SIGSEGV
is received again, the program will be terminated.
The fact that your program received SIGSEGV suggests that one or more
variables contain an invalid value. If you attempt to resume execution
without fixing the error, you will just get further SIGSEGVs.
More generally, if you detect that your program has got into an
invalid state, you have two reasonable choices: either give up (i.e.
terminate) or correct the problem.
Ignoring the problem and hoping that that the program will magically
recover isn't going to work.
A more realistic approach for programs which need to run continuously
would be to run the program from init with the "respawn" option; if
the program terminates, init will restart it.
--
Glynn Clements <glynn@gclements.plus.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-03-04 0:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-02 12:20 SIGSEGV kaushal
2005-03-02 13:48 ` SIGSEGV mohana sundaram
2005-03-02 14:24 ` SIGSEGV Ron Michael Khu
2005-03-04 0:33 ` SIGSEGV Glynn Clements
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).