03-19-2010
@^
Thank you all for the details.
I understood the concept.
regards,
sree
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
AIX 4.3.3
I am trying to write a signal handler into a ksh shell script. I would like to capture the SIGTERM, SIGINT, and the SIGTSTP signals, print out a message to the terminal, and continue executing the script. I have found a way to block the signals:
#! /bin/ksh
SIGTERM=15
SIGINT=2... (2 Replies)
Discussion started by: jalburger
2 Replies
2. Programming
Hi,
I have an c++ application which uses the function fork and execvp().
The parent does not wait until the child ends. The parents just creates children and let them do their stuff.
You can see the parent program as a batch-manager.
I have added a SIGCHLD handler to the program:
void... (3 Replies)
Discussion started by: jens
3 Replies
3. Programming
Hey guys,
I am trying to write a little shell, and was writing a signal handler to handle SIGINT (I am using 'stty intr ^C' and using ctrl-C to give SIGINT).
I wrote this signal handler: void handle_sigint()
{
write(2,"handling sigint\n",16);
write(1,"\nshell% ",8);
}
... (4 Replies)
Discussion started by: blowtorch
4 Replies
4. Programming
I have written a program to demonstrate a problem I have encountered when using BSD style asynchronous input using the O_ASYNC flag in conjunction with a real time interval timer sending regular SIGALRM signals to the program. The SIGIO handler obeys all safe practices, using only an atomic update... (8 Replies)
Discussion started by: stewartw
8 Replies
5. Programming
Is it ok to use exit() inside a signal handler?
I catch SIGUSR1 in a signal handler and I try to close a file and then exit. The result is inconsistent. Sometimes the process exit and sometimes it returns to the original state before the signal handler was invoked.
Perhaps exit is not legal in... (8 Replies)
Discussion started by: Tuvia
8 Replies
6. Programming
Hi,
I have a daq program that runs in an infinite loop until it receives SIGINT. A handler catches the signal and sets a flag to stop the while loop. After the loop some things have to be cleaned up.
The problem is that I want my main while loop to wait until the next full second begins, to... (2 Replies)
Discussion started by: soeckel
2 Replies
7. Shell Programming and Scripting
I have a problem with signal handlers not working.
I have a long 1000 line code and somehow this code for signal handling is not working:
$SIG{INT} = \&interrupt;
sub interrupt {
print STDERR "Caught a control c!\n";
exit; # or just about anything else you'd want to do
}
Any... (2 Replies)
Discussion started by: som.nitk
2 Replies
8. Shell Programming and Scripting
I was working on some Perl code that does signal handling and I came across this one liner and wasn't sure what it was doing.
local $SIG{__DIE__} = sub {$! = 2; die $_;};
I think the first part of the anonymous subroutine is setting $! to 2, but I am not sure what the second part is doing. ... (1 Reply)
Discussion started by: SFNYC
1 Replies
9. Programming
i m unble to execute code of
signal handler using
a) Wait b) Waitpid (1 Reply)
Discussion started by: madhura
1 Replies
10. Programming
Hello,
I'm writing some serial(UART) handler but have stuck on few issues, maybe anyone can help to show me what I'm doing wrong.
Basically I'm intending to write serial RX signal handler.
Application receives defined packages of data over serial which contains header and payload. Handler... (3 Replies)
Discussion started by: Lauris_k
3 Replies
LEARN ABOUT LINUX
rt_sigreturn
SIGRETURN(2) Linux Programmer's Manual SIGRETURN(2)
NAME
sigreturn - return from signal handler and cleanup stack frame
SYNOPSIS
int sigreturn(unsigned long __unused);
DESCRIPTION
When the Linux kernel creates the stack frame for a signal handler, a call to sigreturn() is inserted into the stack frame so that upon
return from the signal handler, sigreturn() will be called.
This sigreturn() call undoes everything that was done--changing the process's signal mask, switching stacks (see sigaltstack(2))--in order
to invoke the signal handler: it restores the process's signal mask, switches stacks, and restores the process's context (registers, pro-
cessor flags), so that the process directly resumes execution at the point where it was interrupted by the signal.
RETURN VALUE
sigreturn() never returns.
FILES
/usr/src/linux/arch/i386/kernel/signal.c
/usr/src/linux/arch/alpha/kernel/entry.S
CONFORMING TO
sigreturn() is specific to Linux and should not be used in programs intended to be portable.
NOTES
The sigreturn() call is used by the kernel to implement signal handlers. It should never be called directly. Better yet, the specific use
of the __unused argument varies depending on the architecture.
SEE ALSO
kill(2), sigaltstack(2), signal(2), signal(7)
COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 2008-06-26 SIGRETURN(2)