LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-05-2014, 01:06 AM   #1
bsr_linux
LQ Newbie
 
Registered: Aug 2014
Posts: 3

Rep: Reputation: Disabled
Sigaction shows varied signals when checked at parent process after the child exits


Parent process forked a child to print() some output using fflush(NULL) and does _exit(0);

After the child exits, the parent where I had added a sigaction for signals 1-15 and 33-300 shows varied signal number each time, the child is forked, prints and exits. sometimes it shows 11, 43 , 100, 123 ....


How to figure out why such bogus values are coming? If I add explicitly a handler for SIGCHLD, it works fine!! If no user-defined handler, some bogus signal no is shown each time ...

Any pointers or help in this regard is appreciated.

Thanks,
bsr
 
Old 08-05-2014, 06:53 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 24,365

Rep: Reputation: 8005Reputation: 8005Reputation: 8005Reputation: 8005Reputation: 8005Reputation: 8005Reputation: 8005Reputation: 8005Reputation: 8005Reputation: 8005Reputation: 8005
looks like you got a random number from the outer space, not a real signal...
 
Old 08-05-2014, 07:08 AM   #3
bsr_linux
LQ Newbie
 
Registered: Aug 2014
Posts: 3

Original Poster
Rep: Reputation: Disabled
But what is the reason for such signals, which are not standard/real-time? Can I use sigaction to catch and process such signals that is > 64 ?
 
Old 08-05-2014, 07:53 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 24,365

Rep: Reputation: 8005Reputation: 8005Reputation: 8005Reputation: 8005Reputation: 8005Reputation: 8005Reputation: 8005Reputation: 8005Reputation: 8005Reputation: 8005Reputation: 8005
You did not catch those signals, you got a random number instead of the real signal number.
 
Old 08-05-2014, 08:04 AM   #5
bsr_linux
LQ Newbie
 
Registered: Aug 2014
Posts: 3

Original Poster
Rep: Reputation: Disabled
I used sigaction to register for all signals ranging from 1 to 16 and 18 to 300.
But it is not invoking the handler for any signal in this range.

If I include signal 17 (SIGCHLD), I can see that the handler in sigaction is invoked!
 
Old 08-05-2014, 08:09 AM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 24,365

Rep: Reputation: 8005Reputation: 8005Reputation: 8005Reputation: 8005Reputation: 8005Reputation: 8005Reputation: 8005Reputation: 8005Reputation: 8005Reputation: 8005Reputation: 8005
for me sigaction dies for 9, 19, 32, 33 and every other signal above 64. would be nice to see your code....
 
  


Reply


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
killng parent process without killing child process (Linux C programming) lettuce84@naver.com Linux - Newbie 3 07-24-2015 08:37 AM
Forked Child Process Inherits Library Linkage from Parent Process (All Unix Flavors) Embedded_guy Linux - General 3 11-14-2012 08:12 AM
Sending Signal from Child Process to Parent Process : Not getting desired output thelink123 Linux - General 4 10-26-2012 09:05 PM
[SOLVED] Child exits and Parent stops?? x24804 Programming 2 10-26-2012 09:02 AM
how to make parent catch signals after child execs adevendra Programming 6 08-24-2009 06:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:38 PM.

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