LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 04-02-2007, 11:37 AM   #1
xface66
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, 12:15 PM   #2
kshkid
Member
 
Registered: Dec 2005
Distribution: RHEL3, FC3
Posts: 383

Rep: Reputation: 30
Code:
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
 
  


Reply



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 02:17 PM
SIGINT problem brentos Linux - General 1 12-17-2008 10:43 PM
overriding SIGINT xface66 Programming 3 04-02-2007 01:32 PM
SIGINT handling santhosh.bachu Linux - General 1 07-18-2006 01:18 AM
<0>Kernel panic: Aiee, killing interrupt handler! In interrupt handler - not syncing mrb Linux - Newbie 2 01-09-2005 09:47 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:43 AM.

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