473,395 Members | 1,689 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,395 software developers and data experts.

Difference between signal() and sigaction() function

Hello Sir...Could you tell me the KEY difference between signal and sigaction functions....Kindly consider the following sample program which is using signal function...
Expand|Select|Wrap|Line Numbers
  1. #include <signal.h>
  2. void mysighandler(void);
  3. int main ()
  4. {
  5.     signal(SIGINT,mysighandler);
  6.     char ch;
  7.     while(1) {
  8.         ch=getchar();
  9.         putchar(ch);
  10.     }
  11. }
  12. void mysighandler(void);
  13. {
  14.     printf("interrrupt signal recieved\n");
  15. }
  16.  
The above main function goes into infinite loop ...when I press ctrl-C my signal handler is getting executed..upto this is fine..
But what difference it makes when I use sigaction() system call in the above program...
I would be thankful if you help me...
May 11 '07 #1
2 5897
Motoma
3,237 Expert 2GB
I have moved this thread to the C++ forum, as I feel the people there will be of more help then I.
May 11 '07 #2
AdrianH
1,251 Expert 1GB
See sigaction() and signal() for more info.


Adrian
May 11 '07 #3

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

Similar topics

8
by: Elf M. Sternberg | last post by:
I'm having a devil of a time with signal handling under BSD 4.4 with Python and I was hoping that this might ring a bell with someone. Using the Webware Application Server (a multi-threaded Python...
1
by: Jorge | last post by:
All, I've got a process that creates some children and want to be alerted when they die. To do this, the SIGCHLD signal is registered in the process using sigaction to jump to a subprogram as...
0
by: steffen staehle | last post by:
Hi, I'm writing a server process which spawns child processes via fork This server process should keep track of the number of children stil running, do the necessary cleanup to avoid zombies,...
3
by: Martin McCormick | last post by:
A C program contains several signal statements to remove a lock file if the program gets killed: /*Set up interrupt handler to catch ctrl-C so that lock file can be removed.*/...
11
by: Jackie | last post by:
Hi everyone, I'd like to know when and how signals are used (e.g. SIGFPE, SIGABRT, SIGTERM, SIGSEGV, SIGINT)? Thank you so much.
4
by: san | last post by:
Greetings, I have a C++ problem. I am implementing a signal handler inside a class SignalClass. The code looks as follows: SignalClass is an Singleton class. class SignalClass { private:...
10
by: subramanian | last post by:
Consider the following code: segment violation is deliberately generated to catch the SIGSEGV signal. The handler for this signal, namely SIGSEGV_handler, is called. However after the handler is...
2
by: Achint Mehta | last post by:
Hi, I am running purify on my program (on linux with gcc ver. 3.4.6) I have installed a signal handler (for timer) using sigaction. I am passing a pointer (data) into the sival_ptr which I...
1
by: 32Alpha | last post by:
Hi, first post here. First off, this IS a homework assignment for an operating systems class, but the question isn't "how do i do the assignment" but "why is my particular implementation not...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...

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.