Questions tagged [sigaction]

The sigaction() system call is used to change the action taken by a process on receipt of a specific signal.

The sigaction() function allows the calling process to examine and/or specify the action to be associated with a specific signal. In computing, sigaction is a function API defined by POSIX to give the programmer access to what should be a program's behavior when receiving specific OS

106 questions
0
votes
1 answer

Is sigaction preferred over signal function?

The following is from the man page of signal The behavior of signal() varies across UNIX versions, and has also varied historically across different versions of Linux. Avoid its use: use sigac‐ tion(2) instead. See Portability below. Does…
pensee
  • 47
  • 4
0
votes
0 answers

How to discover the function sigemptyset() to set value for sigset_t sa_mask

I noticed that when a value has to be assigned to sigset_t sa_mask and for example an empty value we can use the function sigemptyset(&sa.sa_mask). I discovered it on StackOverflow. But when you look at the man sigaction, and struct…
asha rani
  • 41
  • 6
0
votes
1 answer

Ignoring signal if it's sent too quickly

I have the following code: //includes... #define SIG_INT 0 //prints out when SIG_INT is received from siginfo_t* void handler(int, siginfo_t*, void*); int main() { pid_t ambulance1 = 0; pid_t ambulance2 = 0; struct sigaction…
vapandris
  • 27
  • 5
0
votes
1 answer

SIGACTION handler to repeat loading after interruption

Hi stackoverflow family, I'm doing a uni task to make a linux program to read a password and secure it and "re-read" the password again if the user interrupts it during. Here's my code for catching handler. void catch_suspend(int sig_num) { …
0
votes
0 answers

How to find reason for SEGFAULT in large multi-thread C program?

I am working with a multi-thread program for Linux embedded systems that crashes very randomly through SEGFAULT signal. I need to find the issue WITHOUT using gdb since the crash occurs only under production environment, never during testing. I know…
0
votes
1 answer

Can i get the signal int constant (like SIGINT or SIGKILL) that terminated a process using using sigaction's flag siginfo with SIGCHLD in C?

I'm trying to figure out if i can get the signal that terminated a child process using a custom SIGCHLD handler passed to a sigaction with flag set to SA_SIGINFO. From what i understood the si_status should report an exit value or a signal value…
user12196313
0
votes
2 answers

How to determine the signal that terminated a QProcess with Qt4 on Linux?

I want to detect the QProcess I launched was terminated externally by either SIGKILL or SIGTERM. This is important in distinguishing between a crash (bug) and an external interference when I've written the process I'm launching myself. I've tried…
0
votes
0 answers

Why can't I catch SIGCHLD every time after fork?

I am trying to create 4 child processes and until the children die, parent should wait. I wrote a program but when I run this code, 1 out of 10, it can't catch the SIGCHLD from every child and my program goes to infinite loop after. It happens…
Wokers
  • 107
  • 3
  • 13
0
votes
1 answer

Calling to siglongjmp from SIGVTALRM handler (multithreading with sigaction)

Hello I have an issue to work with siglongjmp (multi threading) and sigaction configuring SIGVTALRM handler. I've configured with sigsetjmp 2 new threads: 1. env[0] with PC on func f 2. env[1] with PC on func g I've configured an handler to the…
idan2468
  • 1
  • 1
0
votes
1 answer

"Alarm clock" message in linux

struct sigaction act; memset(&act,0,sizeof act); sigaction(SIGALRM, &act, NULL); alarm(any_seconds); My alarm code in linux. I met "Alarm clock" message. But I don't want met this message. How can I do? please help.
oldkrak
  • 47
  • 5
0
votes
1 answer

How to use sigaction with 4 child process?

I have 1 Parent and 4 child processes. I want to catch SIGCHILD from every child and call waitid() for every child. The question is that how can I know SIGCHILD comes from which process? And additional question, if I call wait(NULL) in handler, is…
Wokers
  • 107
  • 3
  • 13
0
votes
0 answers

Custom signal handlers not working with Firebase Crashlytics on iOS

I am integrating the Firebase Crashlytics crash reporting framework into my iOS application. The application is written in ObjC and already has custom signal handlers so there comes the issue that I observe - if the application custom handlers are…
Alex
  • 163
  • 7
0
votes
1 answer

POSIX signal being blocked in signal handler despite not being in sa_mask

I posted a similar question yesterday but I did a poor job of outlining my problem and since then I think I have made progress. My minimal working example is still quite long so I will post relevant snippets but the full example can be found…
Alex Hoffmann
  • 355
  • 4
  • 20
0
votes
1 answer

sigaction not initialized gcc 7

Let be this C file: #include #include void handle(){ return; } int main() { struct sigaction action; action.sa_handler = &handle; printf("%d\n", action.sa_flags); return 0; } Compiling with gcc-7 (Ubuntu…
matlink
  • 3
  • 1
0
votes
0 answers

siginfo field si_signo appears to contain a random value

I am trying to get things out of the siginfo_t struct. For SIGABRT (=6) I get (gdb) print signo $1 = 6 (gdb) print *siginfo $2 = {si_signo = 0, si_errno = 0, si_code = 1689088, __pad0 = 0, _sifields = {_pad = {1689088, 0, 2097152, 0, 1, 6, …
user877329
  • 6,717
  • 8
  • 46
  • 88