Welcome to the most active Linux Forum on the web.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 04-02-2007, 12:37 PM   #1
LQ Newbie
Registered: Dec 2006
Posts: 29

Rep: Reputation: 15
SIGINT handler with Fork()

hi everyone,

i have a program that forks-off a child process. I want to override SIGINT handler. Means when user breaks the program with ctrl+c my handler will run.
I have done it but my handler runs twice one for parent, one for child process i think.
What must i do to prevent this? I want to deallocate memory and exit the child and parent processes.
Do u have any solutions?

Thanks in advance.
Old 04-02-2007, 01:15 PM   #2
Registered: Dec 2005
Distribution: RHEL3, FC3
Posts: 383

Rep: Reputation: 30
The  child  process  inherits  the
     following attributes from the parent process:
o  signal handling settings (that is,  SIG_DFL,  SIG_IGN,
           SIG_HOLD, function address)

and in the child for the signal handler set the default function to SIG_IGN


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
SIGSEGV handler (segmentation fauld handler) myp Programming 8 03-08-2011 03:17 PM
SIGINT problem brentos Linux - General 1 12-17-2008 11:43 PM
overriding SIGINT xface66 Programming 3 04-02-2007 02:32 PM
SIGINT handling santhosh.bachu Linux - General 1 07-18-2006 02:18 AM
<0>Kernel panic: Aiee, killing interrupt handler! In interrupt handler - not syncing mrb Linux - Newbie 2 01-09-2005 10:47 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:55 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration