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
0
votes
2answers
34 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'...
1
vote
0answers
18 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 ...
2
votes
2answers
40 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 ...
0
votes
2answers
36 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 ...
0
votes
0answers
59 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 "...
1
vote
0answers
14 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. ...
0
votes
1answer
30 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 ...
0
votes
1answer
35 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 ...
4
votes
2answers
92 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 ...
0
votes
1answer
33 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 ...
0
votes
2answers
73 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 ...
2
votes
2answers
28 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. ...
0
votes
0answers
13 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 ...
5
votes
1answer
150 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 ...
0
votes
0answers
8 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 ...
0
votes
0answers
42 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-...
2
votes
0answers
51 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 $$ ...
0
votes
0answers
29 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); ...
0
votes
1answer
45 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 ...
0
votes
2answers
59 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 ...
-2
votes
1answer
65 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?
1
vote
0answers
59 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 '...
0
votes
0answers
13 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 ...
1
vote
0answers
27 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 ...
2
votes
1answer
63 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 ...
0
votes
1answer
95 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 ...
0
votes
1answer
74 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 ...
0
votes
0answers
43 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,...
0
votes
1answer
209 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....
0
votes
0answers
15 views

Console app keeps running after closing the controlling terminal when logged in as root in terminal

I log into my host Ubuntu system as a user. I open terminal (that will start an interactive non-login shell). Then I do "sudo su" to login as root. Then I start my console app that runs in ...
0
votes
1answer
74 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 ...
2
votes
1answer
71 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....
0
votes
0answers
23 views

How to gracefullly close subprocesses

I am new to signals/operating systems so please bear with me. I am given a task to gracefully skill subprocesses. Let's say transformer is a service being run by systemd. When I restart the service ...
0
votes
1answer
36 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) { ...
0
votes
0answers
57 views

Trigger event when (un)plugging a headphone jack

I am using Archlinux with i3, and i3blocks as status bar. In my status bar, I show the volume. I want this to be updated whenever I change the volume, or when I (un)plug a headset. For changinge the ...
6
votes
1answer
117 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 ...
0
votes
0answers
70 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 ...
0
votes
0answers
28 views

Are there differences in signal handling for C programs and scripts?

I have the following script and corresponding C program which at first glance appear to work the same with respect to signals and the standard error output. Script: #!/bin/sh function terminate() { ...
0
votes
0answers
44 views

why SIGPIPE behaves different in different kernels?

I have two different systems running with linux and I'm getting some logs with tail -f logfile While tail was running, I sent SIGPIPE to tail's process. tail continued to run on system 1 but died ...
0
votes
1answer
205 views

Which thread receives SIGURG?

I recently wrote a "study note" about Unix, and I made following proposition about multi-threaded processes: it will be almost impossible for the kernel to identify the thread that should ...
0
votes
0answers
18 views

Timer disarms when interval is too small

Timers seem to disarm after process is resumed (SIGCONT) ONLY when interval is too small. I use timer_create with CLOCK_REALTIME. My linux distribution is ubuntu 20.04.1 This is the code that shows ...
0
votes
1answer
181 views

Is there a way to configure the Linux OOM killer to kill the parent instead of child process?

Is there a way to configure the Linux OOM killer to kill the parent instead of child process? When the child process is killed that parent keeps running in a bad state. I can detect if the child was ...
0
votes
1answer
353 views

Why doesn't [kill -s SIGUSR1] work inside script but works on command line? (re: invalid signal specification)

I'm trying to write a shell script (/bin/sh) that includes a command-line option to send SIGUSR1 to a process: my_command() { printf "Sending SIGUSR1: " kill -s SIGUSR1 `...
0
votes
1answer
87 views

How exactly a CTRL^C passes a signal to process

I'm trying to figure out how exactly CTRL^C sends a SIGINT to a process. Let's consider a pseudo-terminal system. I'll write what I know (or think I know lol) and please add/replace where needed: The ...
3
votes
0answers
75 views

Can linux kernel execute a signal handler of an application process and receive signals for the same process at the same time?

Can linux kernel receive signals for an application process while executing a signal handler of the same process? If yes, are both tasks multi-threaded? Or is it through some other way that I do not ...
0
votes
1answer
107 views

Why do trap sometimes ignore signals?

I have the following script #! /usr/bin/bash trap "{ echo bye ;}" SIGINT while : do echo "Hello" done When I press Ctrl-c the while loop is not stopped and echo ...
-2
votes
1answer
82 views

How are the associations between signals and events created, removed, modified, enabled and disabled?

In Linux, many signals are generated when some associated events occur. How are the associations between signals and events created, removed, modified, enabled and disabled? (preferably in terms of ...
0
votes
1answer
400 views

Is a process in TASK_INTERRUPTIBLE state waken up only by the delivery of a signal?

The Linux Programming Interface says 22.3 Interruptible and Uninterruptible Process Sleep States We need to add a proviso to our earlier statement that SIGKILL and SIGSTOP always act immediately ...
-1
votes
1answer
255 views

What is the difference between the default disposition for SIGCHLD and explicitly setting the disposition to SIG_IGN?

The Linux Programming Interface says 26.3.1 Establishing a Handler for SIGCHLD The SIGCHLD signal is sent to a parent process whenever one of its children termi- nates. By default, this signal is ...
1
vote
1answer
89 views

Signal lost for Bash background process

When I spawn a background job in Bash 5.1 and immediately send it a signal, this signals seems to get lost. Short demo: $ cat simple.cc #include <signal.h> #include <unistd.h> #include &...

1
2 3 4 5
12