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.

Filter by
Sorted by
Tagged with
1 vote
0 answers
23 views

Under what conditions are unix (Mac OS ) sytem calls restarted after getting interrupted by a signal ? What do the man page mean by "calls committed"?

I'm reading a book on unix systems and I'm at the part where signals are discussed. I'm a bit confused when it comes to what happens when a system call is running and a signal is received. It says ...
user avatar
0 votes
2 answers
97 views

When is mandatory send SIGINT programmatically?

I know the recommendable way to terminate a foreground process is through the SIGTERM signal, it because it gives the opportunity to the process itself to clean/release resources. This signal only can ...
user avatar
6 votes
1 answer
504 views

What is correct or suggested approach to send the signal name through 'kill' command?

I read many tutorials about the use of kill command, mostly 3 approaches kill -15 <pid> kill -SIGTERM <pid> kill -TERM <pid> For scripts purposes and for portability with macos too, ...
user avatar
4 votes
3 answers
967 views

Why are the signal lists for kill, killall and pkill not the same?

I researched the kill, pkill and killall commands, and I understood most of their differences. However, I am confused about their signals: If I run kill -l, I see: 1) SIGHUP 2) SIGINT 3) ...
user avatar
1 vote
1 answer
107 views

What signal do bg and fg send?

I know that ctrl + z changes a process from foreground to background - as suspended - through SIGTSTP. I am able to re-run that background suspended process through either fg or bg as required. ...
user avatar
0 votes
1 answer
81 views

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 ...
user avatar
  • 409
0 votes
2 answers
61 views

Signals table in /proc/[PID]

I am trying to overwrite or change the Signals of a process. As I guess there is a table of signals in every process separately. Is there anything like that in the /proc folder? Thank you for your ...
user avatar
1 vote
0 answers
19 views

which signal will caused "wait_event_interruptible" interrupted?

There are wait_event_interruptible in a driver to wait until message is aviliable.But this function was interrupted by a signal. I find out this in manpage: The function will return -ERESTARTSYS if ...
user avatar
  • 11
1 vote
1 answer
199 views

Why does a command with a non-zero exit status send an ERR signal even when it is “part of a && or || list”?

man bash includes this documentation for using trap: trap [-lp] [[arg] sigspec ...] … The ERR trap is not executed if the failed command is part of the command list immediately following a ...
user avatar
0 votes
0 answers
18 views

Can coredump handler mess up process exit code?

I have a program that installs a handler to log backtrace on fatal signals (SIGSEGV, SIGABRT and a couple others). The signal handler does void signalHandler(int signum) { signal(signum, SIG_DFL); ...
user avatar
  • 562
0 votes
0 answers
54 views

Zsh: bind a key to run another command while a zsh script is in foreground

Zsh keybindings seem to work only when the shell is waiting for a command after the prompt. When a zsh script is launched, it cares about reading inputs only when a command like read is encountered, ...
user avatar
0 votes
2 answers
56 views

Xlib: what is the best implementation of GUI digital clock?

I am making an X application which contains a digital clock. The clock displays the current time in the format of "hh:mm". I want to master Xlib, so I want to use only Xlib (no other ...
user avatar
1 vote
1 answer
53 views

How to kill all background and spawned processes of a bash script in its pre-exit handler?

I'm using the wait -n technique to perform max_jobs parallel tasks: #!/usr/bin/env bash cleanup() { echo "cleaning up..." } trap "cleanup" EXIT do_task() { echo "...
user avatar
1 vote
1 answer
95 views

When terminal emulator exits, why does shell also exits?

When I start a terminal emulator (for example, qterminal), it starts the default shell (for example, bash). And when I quit the terminal (for example, by clicking the x button or by killing the ...
user avatar
1 vote
1 answer
31 views

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 ...
user avatar
  • 597
29 votes
2 answers
3k views

Why does 'ping' not output a summary when redirecting output?

I can ping google.com for several seconds and when I press Ctrl + C, a brief summary is displayed at the bottom: $ ping google.com PING google.com (74.125.131.113) 56(84) bytes of data. 64 bytes from ...
user avatar
  • 1,577
0 votes
2 answers
226 views

Send signal to process in tmux pane

Suppose that app X is running in the foreground in tmux pane. I'd like to send a given signal, e.g. SIGUSR1, to app X. Can I configure a tmux keybinding to send a signal to the currently-selected pane'...
user avatar
  • 133
1 vote
0 answers
36 views

Prevent the line `load:... cmd:... running ...` upon SIGINFO

Issuing SIGINFO (e.g. by pressing ^T) while a terminal process is running usually results in a printout of a line load: 2.93 cmd: sleep 7826 waiting 0.00u 0.00s If I have written the tool that's ...
user avatar
  • 111
2 votes
2 answers
385 views

Which signal (like SIGINT or SIGTERM) can a process get when system is going to reboot?

My application needs to do something before exit, I have already handled the ctrl-c case by handling signal of SIGINT, but I'd also like to handle the case when the system is going to reboot. I ...
user avatar
  • 133
0 votes
2 answers
128 views

Why is it necessary to block a signal before sigwait()'ing it?

In APUE, chapter 12 page 454, it is mentioned that: To avoid erroneous behavior, a thread must block the signals it is waiting for ... The similar is said in the standard: The signals defined by ...
user avatar
  • 477
0 votes
0 answers
106 views

Specific behavior of timers with sigev_notify = SIGSTOP signal

Timer doesn't send signal when the time period between timer expiration and SIGCONT delivering is at least two times longer than value in itimerspec. I noticed that it also happens with other "...
user avatar
  • 1
1 vote
0 answers
22 views

How to split a stream to two binaries with retry?

I have a binary that produces an audio stream in s16le format. I want to split this stream to two different processes, but I don't want the command to exit and interrupt process 1 if process 2 errors. ...
user avatar
0 votes
1 answer
71 views

Proper way to wrap dash using rlwrap

On Ubuntu, I have set alias sh='rlwrap --complete-filenames sh' to get readline keybindings and filename completion when using the dash shell (on my computer, sh is /usr/bin/sh, which is a symbolic ...
user avatar
  • 1,952
0 votes
1 answer
87 views

Intercepting system signal as a strategy to prevent kill calls from taking effect

As a follow up to this question, I am correct that (4) (quote below) is the farthest I can get ? in my app (a .NET app which runs as a systemd daemon), intercept the kernel signal sent to the process ...
user avatar
  • 298
4 votes
2 answers
97 views

Looking for a general split+merge syntax for IO streams

I often want to perform an operation that requires splitting the stdout of a pipeline (let's call it pipeline-before) into two parallel streams; feeding the resulting stream, as their stdin, to two ...
user avatar
  • 13k
0 votes
1 answer
40 views

Is signal handling a property of a process or not?

From reading the standard, I understand that: signal handling is a property shared by all threads of a process; signal mask is a per-thread property. However, the standard list the following (In ...
user avatar
  • 477
0 votes
2 answers
155 views

Use of SEGV signal

As far as I understand, a SEGV signal is sent by the OS to inform a process that it has attempted an illegal memory access. But I noticed that it is also possible to send a SEGV signal to a process ...
user avatar
  • 23
2 votes
2 answers
80 views

xterm loss of focus signals vim to exit input mode?

I've been using xterm on a KDE desktop for many years, on one Debian/Ubuntu/Arbian release after another. I use the focus-follows-mouse desktop setting, and ":set mouse=a" in .vimrc. ...
user avatar
0 votes
0 answers
28 views

How to detach from dtach when the detach character is disabled

I am using dtach like this: dtach -A /tmp/mysession -Ez bash. This starts bash. Now, how do I detach from dtach? I have disabled the detach character using the -E option, so I cannot press Ctrl\ to ...
user avatar
  • 1,952
5 votes
1 answer
357 views

Cannot stop docker-compose logs -f with CTRL + C any more

docker-compose logs -f is a useful command to view the logs of containers in the background and follow them to see new entries immediately. It seems that with the latest stable V2.1.0 it's not ...
user avatar
  • 279
0 votes
0 answers
9 views

Get signal which terminated last command [duplicate]

I'm attempting to switch from fish to zsh. One of the features of fish I like is how it will display the signal name in PS1 if the last command was terminated by a signal. Is there a way to do this ...
user avatar
0 votes
0 answers
61 views

Shell, traps, signals and conditional cleanup

I have a script running qemu-system in background (-daemonize) and have to clean up (kill) running qemu-system once foreground process completes. Same time I have NOT to clean up (kill) running qemu-...
user avatar
  • 238
2 votes
0 answers
110 views

SIGSTOP and SIGCONT and the bash choosing how to respond to them

I'm reading the documentation on the freezer-subsystem and I came across the following example on why SIGSTOP and SIGCONT are not always working as we expect them to: $ echo $$ 16644 $ bash $ echo $$ ...
user avatar
0 votes
0 answers
54 views

Can't receive CTR-C after changing process group

I have this code: static void signal_handler(int signum); int main(void) { const struct sigaction sa = { .sa_handler = signal_handler, }; sigaction(SIGINT, &sa, NULL); ...
user avatar
0 votes
1 answer
118 views

SIGHUP strange behavior

Context: I am running a process from bash without & and any redirection i.e like ./foo. The process is running while(1) i.e it is running forever. Also, the process is ignoring SIGHUP i.e not ...
user avatar
  • 9
0 votes
2 answers
125 views

How do you turn the exit status of a program into the signal name

pid_t waitpid(pid_t pid, int *status, int options); For example when the status=2, return the string "SIGINT" when the status=11, return the string "SIGSEGV". Is there a built_in ...
user avatar
-2 votes
1 answer
130 views

Is there an alternative to the kill system call? [closed]

Is there an alternative to the kill system call? An alternative, yet similar system call that can simply send a signal to a process?
user avatar
  • 170
1 vote
0 answers
183 views

Why PID 1 send SIGTERM

I had this problem for a few days. A process, in this case qbittorrent, will stop after a few minutes. Looking at logs it seems that it just caught a SIGTERM. Alright so I used strace -p {PID} -e '...
user avatar
0 votes
0 answers
15 views

Is it possible to send signals to a command that was entered while another one is running

Sometimes I do make or something in foreground and, while it is executing, I type and enter stuff that I want to do afterwards, such as cd some_other_dirEntermake againEntercd -Enter. But let's say ...
user avatar
  • 1,012
1 vote
0 answers
58 views

Controlling a process that has been moved into a Screen session with Reptyr

I have been experimenting with trying to pull a running process into a screen session with reptyr, as per a number of guides like the following, and which also generally seems to work fairly reliably ...
user avatar
2 votes
1 answer
103 views

What is the real reason why nohup ./a.out dies when SSH session times out?

When you run ./a.out in a terminal over SSH, and then the SSH session times out, ./a.out is killed. Why is this? Some say that it's because of SIGHUP. But running nohup ./a.out still has the same ...
user avatar
0 votes
1 answer
210 views

__USE_POSIX and VS Code in WSL distro

I'm learning C and in general I code with VS Code in Ubuntu. For convenience, I'm trying to migrate my learning materials to Windows where a lot of my other works happen, so I installed WSL 2 and its ...
user avatar
0 votes
1 answer
269 views

How to gracefully kill (like normal close) Google Chrome (over SSH)?

I am running a "TV laptop" - just a low-powered laptop connected to a TV with one single purpose, to run a live TV stream from Google Chrome on Ubuntu MATE 20.04.2 LTS. The first thing I ...
user avatar
0 votes
0 answers
95 views

Internals of signal handling

I have been studying this excellent Caltech lecture regarding the signal delivery mechanism, which talks about how current process state (stack, RIP etc) at the time of the signal generation is copied,...
user avatar
  • 153
0 votes
1 answer
410 views

Is it possible to force a program that ignores signals to quit on ctrl-C?

I have a program that ignores SIGINT but that I want to run in the foreground. I would like to find a way to force it to close on Ctrl-C. Is there any way to write a wrapper (that you'd call ./wrapper....
user avatar
  • 165
0 votes
1 answer
191 views

Why I can't send SIGRTMAX-9 signal with kill command?

I have a bash script running in the background and wanted to send the SIGRTMAX-9 signal to it. SIGRTMAX-* case Why kill command doesn't recognize the SIGRTMAX-9 signal? ╭─ /tmp/tmp.KHFbrCQhOB ...
user avatar
  • 1
2 votes
1 answer
99 views

Should POSIX shell support SIGPOLL signal?

I have never used POLL signal, but it is listed as some signal that has default action to do abnormal termination of the process: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/signal.h....
user avatar
  • 538
0 votes
1 answer
296 views

why crtl-C or ctrl-Z is not working in this program?

during this process is running i am trying to stop it by Ctrl+C or Ctrl+Z but any of this is not working. #include <stdio.h> void main(void) { process(); } void process(void) { ...
user avatar
  • 3
6 votes
1 answer
193 views

Does the "reboot" command log me out of the shell or does it forcefully terminate it?

Under Linux, if I issue a reboot command from the shell, what is the sequence of events that lead to the shell (e.g. bash) disconnecting? I think it's one of the following, but not sure which: It log ...
user avatar
  • 161
0 votes
0 answers
160 views

Ignore SIGHUP with trap while still being able to receive output and send input

So i already know one can ignore HUP by doing: trap "command" HUP but since that completely background the process, is it possible to do the same but still being able to send input to said ...
user avatar

1
2 3 4 5
12