Questions tagged [signals]

A signal is a message which can be sent to a running process. Signals can be initiated by programs, users, or administrators.

Handling Signals

Each Unix signal has a default set of effects on a Unix program. Programmers can code their applications to respond in customized ways to most signals. These custom pieces of code are called signal handlers.

Two signals are unable to be redefined by a signal handler. SIGKILL always stops a process and SIGSTOP always moves a process from the foreground to the background. These two signals cannot be "caught" by a signal handler.

611 questions
90
votes
1 answer

List of Kill Signals

I'm familiar with several process signals and what they do, but I would like to understand them all. There are three things I would like to find out about each signal. What the signal does When a signal like this is typically sent Any command line…
Dave
  • 1,025
24
votes
1 answer

Why does SIGUSR1 cause process to be terminated?

I was surprised with this comment in other question: Sending dd the USR1 signal too soon after it has started (i.e. in a bash script, the line after you started it) will in fact terminate it Can anybody explain why?
Alois Mahdal
  • 4,440
6
votes
1 answer

How do I find out what process is consuming pending signals?

A user is getting the following message when they try to run a particular program. timer_create: Resource temporarily unavailable From this StackOverflow Q&A titled: timer_create() : -1 EAGAIN (Resource temporarily unavailable), I discovered that…
Tom Ellis
  • 253
6
votes
2 answers

difference between signalfd and sigwaitinfo?

I went through examples and man page but couldn't figure out difference between signalfd and sigwaitinfo Apart from syntax both are doing same thing i.e. waiting for signal storing it details into some structure. in man page it is written. This…
Suri
  • 391
  • 2
  • 4
  • 9
5
votes
1 answer

Should a service cancel and terminate incomplete work on SIGTERM?

Assuming that service does not leave things in "dangerous" or inconsistent state (though failures to carry tasks will be observed), should it close files, connections and any other work?
sevo
  • 1,237
5
votes
1 answer

What is signal queue depth in Linux

How many signals can be queued on a process that has all signals blocked? What if I use sigqueue() more often then that limit? Will those signals not be queued? Will I get an error?
Kouros
  • 205
4
votes
1 answer

Trying to see default handlers for various signals

I understand that there is a default signal handler, that is a function for each signal , such as SIGKILL etc. In which file it is written? I tried looking at signal.h, but could not find it there. I am expecting each signal handler is having at…
user3891236
  • 141
  • 1
  • 2
3
votes
1 answer

Multiple processes reporting signals received

If I run multiple programs with program & in one terminal, and then from another one start sending SIGKILL SIGINT or any other signal, will the terminal running all the processes tell me what process received what signal?
user75027
  • 633
2
votes
1 answer

How do I use sigaction() with SA_RESTART correctly?

I want to develop a C code that will wait concurrently for both keyboard input and keyboard-generated signals, and will be able to have other I/O (with pipes and files) active. I have a minimal signal handler which increments a flag (and currently…
Paul_Pedant
  • 8,679
2
votes
1 answer

What’s the difference between SIGALRM and SIGVTALRM?

I do understand that both are used to raise a signal according to the time elapsed… But what’s the difference then ? In my case, I want to raise such signal against specific thread time where the time counter is suspended if the process is suspended…
2
votes
1 answer

Two(≥2) signal handlers execution order when one is interrupted by another?

Suppose in main I register 2 signal handlers for SIGUSR1 and SIGUR2, let's say sig_ur1 and sig_ur2. What's gonna happen when signal SIGUR2 arrives when sig_ur1 is running? sig_ur1 running ----> signal SIGUR2 arrives ----> : sig_ur1 keeps running…
Rick
  • 1,157
2
votes
1 answer

What are some other reasons for process being in D state except performing I/O?

I have been recently asked this question during interview, "What is D state and when does process goes in D state. I explained what D state is and then gave the answer that when the process is performing I/O operation that is when its in D state.…
MaverickD
  • 359
1
vote
0 answers

How does siglongjmp work with multiple signal handlers

I am following the APUE textbook on siglongjump(), and there is this piece of code which is confusing me. pr_mask() is simply a function which prints the signals which are masked. According to this, if USR1 signal comes, it gets added to the…
1
vote
1 answer

Signal while SIGSTOP is active

What happens if a process gets a signal after it was stopped by SIGSTOP? I am trying to understand and get a good picture of how this is handled. Unfortunately, all I could find was a short description of the signal but no details of particular…
Zoltan K.
  • 493
1
vote
1 answer

Why must a handler be defined for sigsuspend to return?

I'm working on a school assignment where I'm sending signals between two processes. Process 1 sends a signal to process 2, and then process 2 sends SIGUSR1 back to process 1 to acknowledge the original signal. In process 2, I use sigsuspend to wait…
Izzo
  • 961
1
2