473,403 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

SIGSEGV multiple occurences.

I am trying to get my code to handle SIGSEGV multiple times, it will handle one of them but then nothing else.
Expand|Select|Wrap|Line Numbers
  1. void sigHandler( int signum ) {
  2.     if ( signum == SIGSEGV ) {
  3.     printf("got a signal...\n");
  4.     }  
  5. }
  6.  
  7. int main( int argc, char ** argv ) {
  8.     signal(SIGSEGV, sigHandler);
  9.     .....................................
  10.     for (x = 0; x < 2000; x++) {
  11.         printf("x == %d\n", x);
  12.         *ptr = x;
  13.         }
Thanks in advance.
Jan 24 '08 #1
1 1974
gpraghuram
1,275 Expert 1GB
I am trying to get my code to handle SIGSEGV multiple times, it will handle one of them but then nothing else.
Expand|Select|Wrap|Line Numbers
  1. void sigHandler( int signum ) {
  2.     if ( signum == SIGSEGV ) {
  3.     printf("got a signal...\n");
  4.     }  
  5. }
  6.  
  7. int main( int argc, char ** argv ) {
  8.     signal(SIGSEGV, sigHandler);
  9.     .....................................
  10.     for (x = 0; x < 2000; x++) {
  11.         printf("x == %d\n", x);
  12.         *ptr = x;
  13.         }
Thanks in advance.

It is because you are not setting the value of the signal handler again.
Expand|Select|Wrap|Line Numbers
  1. void sigHandler( int signum ) {
  2.     if ( signum == SIGSEGV ) {
  3.     printf("got a signal...\n");
  4.              signal(SIGSEGV, sigHandler);//This should be added to ur code.
  5.     }  
  6. }
  7.  
Thanks
Raghuram
Jan 28 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Dieter Maurer | last post by:
Python 2.3.3, Linux 2.4.x: It looks as if a SIGSEGV in a thread of a multi threaded application does not kill the complete process under some circumstances but only one thread (unrelated to the...
0
by: Paffko | last post by:
What are the possibilities of getting SIGBUS and SIGSEGV errors in the following scenario? There is a program (C/C++/Pro*C) that was running fine under HP-UX 11.x and Oracle8i (8.1.6). Oracle...
4
by: junky_fellow | last post by:
what is the difference between signals SIGBUS and SIGSEGV ? when does an application program receive SIGBUS and in which cases SIGSEGV ? thanx in advance for any help ...
4
by: Dominique Deleris | last post by:
Hello, I desperately and urgently need a __working__ function, that will replace all occurences of a substring in a string. Prototype should be : char *str_replace(char *str, const char...
13
by: vashwath | last post by:
Hi all, In my current project I am using signals for error handling. Since I cannot show full code, I have just shown important piece of code which is relevant. void sigsegenv() {...
4
by: Dameon | last post by:
Hi All, I have a process where I'd like to search the contents of a file(in a dir) for all occurences (or the count of) of a given string. My goal is to focus more on performance, as some of the...
8
by: Daneel | last post by:
Hello! I'm looking for an algorithm which finds all occurences of a bit sequence (e.g., "0001") in a file. This sequence can start at any bit in the file (it is not byte aligned). I have some...
2
by: kasala | last post by:
I get an xml document as input from other department. The input xml document i recieve has a particular word "rnx" which should not be there and my system doesn't support it. And there is also...
1
ajhayes
by: ajhayes | last post by:
I posted a few weeks ago about trying to set up a way to order by unit number (http://bytes.com/topic/access/answers/864507-need-help-setting-up-table-structure-ordering-unit) I'm trying to use a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.