In the C Standard Library, signal processing defines how a program handles various signals while it executes. A signal can report some exceptional behavior within the program (such as division by zero), or a signal can report some asynchronous event outside the program (such as someone striking an interactive attention key on a keyboard).
Questions tagged [signal-handling]
290 questions
1
vote
0 answers
How can I invoke SIGALARM when running the following code?
How can I use the set-guid bit vulnerability to execute a file /bin/grade which is owned by root using the following 3 vulnerable programs? I am not root nor part of the bsp* groups so my access to the programs is limited to read & execute only. For…

J123
- 11
- 1
- 3
1
vote
1 answer
How to pass signals through mpiexec on windows?
My mpi application has a signal handler to catch ctrl-C or ctrl-break one Windows, and when this application is run in serial in the cmd window, it is seen to work. It is intercepted, the code then does its last ouput, and the code quits…

JR Cary
- 31
- 4
1
vote
1 answer
When programs run into faults, how to write to logs and upload logs to MYSQL in signal handling functions?
I would like to write one signal handling function for multiple programs running at different servers so that when they run into faults e.g. segmentation error SIGSEGV or SIGTERM etc, the signal handling function can produce a log and upload the…

niceee
- 11
- 2
1
vote
2 answers
Understanding how signal handlers attach to a process
I am trying to understand how signal handlers attach to a process and their scope for a process.
class Main
Signal.trap('USR1') do
Process2.kill
end
def main_process
#do something
p = Process2.new
output =…
user2851669
1
vote
1 answer
C: Signal handling and semaphores
I'm trying to better understand semaphores and all that jazz and for that I'm programming a server and clients that communicate using shared memory and semaphores. It works pretty well and everything, but I'm not sure I understand how signal…

skulpt
- 527
- 2
- 6
- 25
1
vote
2 answers
Signal handling and check pointing for mpif90
I have written a code for trapping the signal for CTRL+C for gfortran and it works.
program trap
external trap_term
call signal(2, trap_term)
call sleep(60)
end program trap
function trap_term()
integer::trap_term
print*,'done'
call…

HP AS
- 99
- 4
- 13
1
vote
2 answers
Cleanup tmp dirs when hitting CTRL-C from perl -d debug session
For the temp directory I need in my script, I go with:
my $work_dir = File::Temp->newdir(TEMPLATE => "/tmp/work.$$.XXXX" ) or die "Cannot create tempdir directory $!";
My hope with newdir() is to get the promise of:
By default the directory is…

lzc
- 919
- 7
- 16
1
vote
2 answers
SIGINT ignored by multiple processes
I would like to create three processes, which would print some stuff till I press ctrl+c. Below you can see my try but when a try to stop the program nothing happens. When the only one child is forked, it works good. Where could be a problem? Thanks…

Martin Orem
- 31
- 1
- 8
1
vote
2 answers
How to handle BAD_ACCESS signal handling in objective-c
I am trying to handle the crashes and when ever a crash occurred I want to store some log into a file.
till now what I tried is
void InstallUncaughtExceptionHandler()
{
NSSetUncaughtExceptionHandler(&HandleException);
signal(SIGABRT,…

Monish Kumar
- 2,788
- 4
- 38
- 54
1
vote
0 answers
I have a handler to sigchld signal,but when sigtimedwait() returns success handler not called. Why?
int exe(int sec)
{
const char *buf;
int timeout_sec=sec;
int i=0,j=0;
sigset_t mask;
sigset_t orig_mask;
sigset_t pset;
siginfo_t siginfo;
struct timespec timeout;
pid_t pid;
int fd,status=-1;
int fl;
sig_init();
sigemptyset (&mask);
sigaddset…

Sumit
- 11
- 2
1
vote
0 answers
Error in Signal Handler function call error
Error Signal Handler function call error.
I have a method in a class there i am calling addTime(unsigned long milliSecs, BaseClass *bs, void *data) function.
//file BaseClass.h
class BaseClass {
public:
virtual ~BaseClass(){ }
virtual void…

Tamil Selvan
- 11
- 2
1
vote
1 answer
Server can accept n clients only
I'm programming a server code using C language that must accept only few numbers of clients and if extra one arrives the server will put that client to wait until one of the old clients terminated.
For example
(The server can accept 10 clients only,…

Ali
- 27
- 4
1
vote
1 answer
Pending signals not being delivered
I wrote this program to check blocking of SIGQUIT signal. The problem is after restoring to the previous state, the signal is pending but it isn't being delivered.
Here's the main program
sigset_t newmask, oldmask,…

nj-ath
- 3,028
- 2
- 25
- 41
1
vote
1 answer
Signal handler accepts (*args), how do I provide them?
I'm using a library called BACpypes to communicate over network with a PLC. The short version here is that I need to start a BACpypes application in its own thread and then perform read/write to the plc in this separate thread.
For multiple…

ordanj
- 361
- 1
- 8
- 19
1
vote
1 answer
Handling signals in different ways
Can anyone help me to understand what are the differences between the following three ways of handling a signal? I'm operating in a client/server in C.
Edit: I've understood that the 1st example is wrong, now I'd like to know which is…

testermaster
- 1,031
- 6
- 21
- 40