signal-handling Questions

6

Solved

I am doing something like this: #include <signal.h> class myClass { public: void myFunction () { signal(SIGIO,myHandler); } void myHandler (int signum) { /** * Handling code */ ...
Adonic asked 5/12, 2008 at 8:42

3

Solved

I have this decorator: def timed_out(timeout): def decorate(f): if not hasattr(signal, "SIGALRM"): return f def handler(signum, frame): raise TimedOutExc() @functools.wraps(f) def new_f(*...
Costar asked 7/12, 2011 at 18:20

2

Solved

(there is a follow up to this question here) I am working on trying to write a Python based Init system for Linux but I'm having an issue getting signals to my Python init script. From the 'man 2 ...
Cabrales asked 29/4, 2011 at 1:11

1

Solved

According to the C++17 standard, [support.signal], the atomic object should satisfy the following requirements to be used in a signal handler: [...], or f is a non-static member function invoked ...
Azoic asked 18/8, 2022 at 8:9

8

Solved

Can I provide/pass any arguments to signal handler? /* Signal handling */ struct sigaction act; act.sa_handler = signal_handler; /* some more settings */ Now, handler looks like this: void sign...
Meson asked 7/8, 2011 at 1:56

6

Solved

I want to write a signal handler to catch SIGSEGV. I protect a block of memory for read or write using char *buffer; char *p; char a; int pagesize = 4096; mprotect(buffer,pagesize,PROT_NONE) T...
Ulrika asked 18/4, 2010 at 18:44

5

Just wondering about the difference between SIGSTOP and SIGTSTP signals.
Cramfull asked 9/8, 2012 at 15:31

8

Solved

In python 2.6 under Linux, I can use the following to handle a TERM signal: import signal def handleSigTERM(): shutdown() signal.signal(signal.SIGTERM, handleSigTERM) Is there any way to setup...
Tannenwald asked 27/1, 2010 at 17:16

1

In C Linux, is there any way to wait for signal like SIGUSR1 and SIGUSR2 without loop? For eaxmple in this code I wait for SIGUSR1 or SIGUSR2 to print message, but while I want , I do while true.....
Grenoble asked 17/10, 2019 at 7:58

2

Solved

I have a program which uses POSIX timer (timer_create()). Essentially the program sets a timer and starts performing some lengthy (potentially infinite) computation. When the timer expires and a si...
Pindaric asked 15/11, 2011 at 14:47

1

I was reading my textbook's chapter (CS:APP, 3rd ed., chapter 8, page 781) on signals/ECF for Linux x86-64 systems, and came across this: The sigsuspend function temporarily replaces the current...
Mythomania asked 18/4, 2019 at 5:48

2

Solved

Given the following C program: static char vals[ 2 ] = {0, 0}; int main() { char *a = &vals[0]; char *b = &vals[1]; while( 1 ) { SOME_STUFF() // non-atomic operations in critical se...
Futile asked 19/11, 2018 at 22:50

1

Solved

I was looking for a way to stop a thread that perform a task every 2 seconds. I decided to try to use a std::promise/future so that the thread can exit immediately when the promise is set. #includ...
Retrad asked 26/10, 2018 at 19:38

7

Solved

I have just started implementing signal listeners in a django project. While I understand what they are and how to use them. I am having a hard time figuring out where I should put them. The docume...
Parados asked 27/4, 2010 at 5:56

4

I am building a django application which depends on a python module where a SIGINT signal handler has been implemented. Assuming I cannot change the module I am dependent from, how can I workaroun...
Schnozzle asked 20/12, 2011 at 8:51

1

Solved

When we write a signal handler that may change the errno, should we save errno at the beginning of the signal handler and restore the errno at the end of it? Just like below: void signal_handler(...
Sheeting asked 22/1, 2018 at 9:22

2

Solved

I would like to know exactly how the execution of asynchronous signal handlers works on Linux. First, I am unclear as to which thread executes the signal handler. Second, I would like to know the s...
Selfmoving asked 4/8, 2011 at 21:53

2

Solved

Below is an example of source I want to use on a machine running "Red Hat Enterprise Linux 5.5 (Tikanga) Kernel 2.6.18-194.el5xen x86_64" OS. The general idea is that I want to have backtrace of ...

7

Solved

I have an application which I use to catch any segmentation fault or ctrl-c. Using the below code, I am able to catch the segmentation fault but the handler is being called again and again. How ca...
Fabricant asked 18/4, 2012 at 4:48

2

I have a Java 1.6 application that accesses a third party native module, through a JNI class provided as the interface. Recently we noticed that a SEGFAULT is occurring in the native module, and is...
Madel asked 4/7, 2012 at 19:46

4

Solved

What is the difference between these settings? $SIG{CHLD} = 'IGNORE' $SIG{CHLD} = 'DEFAULT' $SIG{CHLD} = '' $SIG{CHLD} = undef According to "Advanced Programming in the UNIX Environment, 2nd ...
Bacteriophage asked 5/12, 2011 at 17:34

3

Program: #include<stdio.h> void main() { int time=1800; while(1){ system("clear"); time-=1; printf("%d\n",time); sleep(1); if(time==0) pause(); } } The above program stops when th...
Delphiadelphic asked 4/9, 2015 at 5:21

2

On my machine I have an aarch64 binary, that is statically compiled. I run it using qemu-aarch64-static with the -g 6566 flag. In another terminal I start up gdb-multiarch and connect as target rem...
Gingili asked 13/7, 2015 at 12:47

1

Solved

I understand that about the only thing, a signal handler in ISO/C++11 is allowed to do is to read from or write to a lock free atomic variable or a volatile sig_atomic_t (I believe, POSIX is a litt...
Listing asked 29/6, 2015 at 14:13

1

I developed a Java tool and it has many JNI functions, I am getting JNI crashes often. Is there any possibility to avoid those crashes or to catch these crashes as exceptions. I surfed intern...
Lengthen asked 7/5, 2015 at 15:37

© 2022 - 2024 — McMap. All rights reserved.