signal stack SA_ONSTACK


 
Thread Tools Search this Thread
Top Forums Programming signal stack SA_ONSTACK
# 1  
Old 04-21-2004
signal stack SA_ONSTACK

Hi Everybody,

Can anybody give me an pratical example where we can use SA_ONSTACK flag in sigaction() system call ?

Please explain me the significance of having an alternate signal stack in UNIX for signal handling.


Regards
Dinesh-Ahuja
# 2  
Old 04-21-2004
Here is one example...a process has a limit on the size of the stack. If a process exceeds that limit it will get a signal, often SIGSEGV, but it can vary from os to os. Now, how can you catch that signal? Without an alternate stack, the signal handler could never run.

I had this exact situation once. A process was dying from a blown stack but its current directory was in a filesystem that was too small to hold a core dump. My handler needed to catch the signal, cd to a large filesystem, set the signal action back to default, and resend the signal to itself. I could not have done that without an alternate stack.

That was the only time that I needed an alternate stack.

Last edited by Perderabo; 04-21-2004 at 05:04 AM..
# 3  
Old 04-22-2004
Thanks for your reply.

Regards
Dinesh
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Kernel Stack vs User Mode Stack

Hi, I am new to the linux kernel development area. I want to know what is the difference between kernel mode stack and user mode stack? Does each process has a user mode stack and a kernel mode stack?? Or Each process has a user mode stack and there is only one kernel mode stack that is shared by... (4 Replies)
Discussion started by: saurabhkoar
4 Replies

2. Programming

queue a signal

A program have to receive signals and work agreed with it, but the process have to receive more than one signal when it is attending other. Those have to be queued to be attended later recived. how can i do that? thanks. (2 Replies)
Discussion started by: marmaster
2 Replies

3. UNIX for Dummies Questions & Answers

Trying to block signal

I have this code that doesnt do what it is suppose to do. It should block signal that I send while process is running. I press control+z while this process is running and it should be blocked but it isnt. When i press control+z it gives me this.... + Stopped When I change SIGTSP into SIGINT then... (5 Replies)
Discussion started by: joker40
5 Replies

4. UNIX for Advanced & Expert Users

need more user signal

Hi In my program I have already used both SIGUSR1 SIGUSR2 user signals. I need another one. How can I do that? Thank you Naama (1 Reply)
Discussion started by: naamabm
1 Replies

5. Shell Programming and Scripting

Killed by signal 15.

Hi all I have Master script, Main script ,and 4 Child script. Master.sh #!/bin/bash /export/home/user/Main.shMain.sh #!/bin/bash /export/home/user/Child1.sh & /export/home/user/Child2.sh & /export/home/user/Child3.sh & /export/home/user/Child4.sh &I run only Master.sh script... (1 Reply)
Discussion started by: almanto
1 Replies

6. Programming

problem with signal()

#include<signal.h> void suicide(); main() { printf("use CTRL \\ for exiting \n"); //signal(SIGINT,SIG_DFL); signal(SIGQUIT,suicide); for (;;); } void suicide() { printf("hello here you r in the suicide code "); } i was just starting with signals .. and tried this ,, but in the... (10 Replies)
Discussion started by: narendra.pant
10 Replies

7. Programming

what is stack winding and stack unwinding

helo can u tell me what do you mean by stack winding and stack unwinding Regards, Amit (2 Replies)
Discussion started by: amitpansuria
2 Replies

8. Programming

Signal Problem

I am using the signal function, and passing it a function named quit procedure...I get the following warning.... passing arg2 of signal from incompatible pointer type... void quit_procedure(void); //this is the way i define my prototype... signal(SIGINT, quit_procedure); Please guide... (5 Replies)
Discussion started by: jacques83
5 Replies
Login or Register to Ask a Question