11-26-2008
Why did you pick 65536 instead of SIGSTKSZ for stack size?
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
HI,
I need to handle SIGUSR2 signal in my application to change the state of the application dynamically. I have implemented the signal handler. However the application is able to catch only one SIGUSR2 signal. The second SIGUSR2 signal causes the application to crash. This is happning only with... (3 Replies)
Discussion started by: diganta
3 Replies
2. UNIX for Advanced & Expert Users
Hi
can any please tell me
is it possible to catch the signal in a shell script like we do in C.
if yes please give me some idea or a link. (4 Replies)
Discussion started by: Raom
4 Replies
3. Programming
Hi folks
I'm trying to write a signal handler (in c on HPUX) that will catch the child process launched by execl when it's finished so that I can check a compliance file.
The signal handler appears to catch the child process terminating however when the signal handler completes the parent... (3 Replies)
Discussion started by: themezzaman
3 Replies
4. Shell Programming and Scripting
Guys,
I'm doing signal handling in Perl. I'm trying to catch ^C signal inside the script.
There two scripts : one shell script and one perl script.
The shell script calls the perl script.
For e.g. shell script a.sh and perl scipt sig.pl.
Shell script a.sh looks something like this :... (6 Replies)
Discussion started by: obelix
6 Replies
5. UNIX for Advanced & Expert Users
#1: does anyone know how to detect how many times (and/or the time length) a given thread has been context switched out of the CPU?
#2: are there any tchniques that minimize/eliminate your thread getting context switched?
I would be happy to know the answers to these questions for ANY... (2 Replies)
Discussion started by: fabulous2
2 Replies
6. Programming
Hello all,
I am starting to learn signal handling in Linux and have been trying out some simple codes to deal with SIGALRM. The code shown below sets a timer to count down. When the timer is finished a SIGALRM is produced. The handler for the signal just increments a variable called count. This... (7 Replies)
Discussion started by: fox_hound_33
7 Replies
7. Programming
I am trying to write a small program where I can send signals and then ask for an action to be triggered if that signal is received. For example, here is an example where I am trying to write a programme that will say you pressed ctrl*c when someone presses ctrl+c. My questions are what you would... (1 Reply)
Discussion started by: #moveon
1 Replies
8. Programming
i wrote handler for sigsegv such that i can allocate memory for a variable to which
sigsegv generated for illlegal acces of memory.
my code is
#include <signal.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
char *j;
void segv_handler(int dummy)
{
j=(char *)malloc(10);
... (4 Replies)
Discussion started by: pavan6754
4 Replies
9. UNIX and Linux Applications
Hello,
Can anybody tell me how can i handle segmentation fault signal, in C code? (2 Replies)
Discussion started by: mustus
2 Replies
10. Programming
hi friends i have a problem in signal handling ...
let me explain my problem clearly..
i have four process ..
main process forks two child process and each child process again forks another new process respectively...
the problem is whenever i kill the child process it is reforking and the... (2 Replies)
Discussion started by: senvenugopal
2 Replies
LEARN ABOUT OPENSOLARIS
sigstack
sigstack(3C) Standard C Library Functions sigstack(3C)
NAME
sigstack - set and/or get alternate signal stack context
SYNOPSIS
#include <signal.h>
int sigstack(struct sigstack *ss, struct sigstack *oss);
DESCRIPTION
The sigstack() function allows the calling process to indicate to the system an area of its address space to be used for processing signals
received by the process.
If the ss argument is not a null pointer, it must point to a sigstack structure. The length of the application-supplied stack must be at
least SIGSTKSZ bytes. If the alternate signal stack overflows, the resulting behavior is undefined. (See USAGE below.)
o The value of the ss_onstack member indicates whether the process wants the system to use an alternate signal stack when deliver-
ing signals.
o The value of the ss_sp member indicates the desired location of the alternate signal stack area in the process' address space.
o If the ss argument is a null pointer, the current alternate signal stack context is not changed.
If the oss argument is not a null pointer, it points to a sigstack structure in which the current alternate signal stack context is placed.
The value stored in the ss_onstack member of oss will be non-zero if the process is currently executing on the alternate signal stack. If
the oss argument is a null pointer, the current alternate signal stack context is not returned.
When a signal's action indicates its handler should execute on the alternate signal stack (specified by calling sigaction(2)), sigstack()
checks to see if the process is currently executing on that stack. If the process is not currently executing on the alternate signal
stack, the system arranges a switch to the alternate signal stack for the duration of the signal handler's execution.
After a successful call to one of the exec functions, there are no alternate signal stacks in the new process image.
RETURN VALUES
Upon successful completion, sigstack() returns 0. Otherwise, it returns -1 and sets errno to indicate the error.
ERRORS
The sigstack() function will fail if:
EPERM An attempt was made to modify an active stack.
USAGE
A portable application, when being written or rewritten, should use sigaltstack(2) instead of sigstack().
The direction of stack growth is not indicated in the historical definition of struct sigstack. The only way to portably establish a stack
pointer is for the application to determine stack growth direction, or to allocate a block of storage and set the stack pointer to the mid-
dle. sigstack() may assume that the size of the signal stack is SIGSTKSZ as found in <signal.h>. An application that would like to specify
a signal stack size other than SIGSTKSZ should use sigaltstack(2).
Applications should not use longjmp(3C) to leave a signal handler that is running on a stack established with sigstack(). Doing so may dis-
able future use of the signal stack. For abnormal exit from a signal handler, siglongjmp(3C), setcontext(2), or swapcontext(3C) may be
used. These functions fully support switching from one stack to another.
The sigstack() function requires the application to have knowledge of the underlying system's stack architecture. For this reason, sigalt-
stack(2) is recommended over this function.
SEE ALSO
fork(2), _longjmp(3C), longjmp(3C), setjmp(3C), sigaltstack(2), siglongjmp(3C), sigsetjmp(3C)
SunOS 5.11 28 Feb 1996 sigstack(3C)