aboutsummaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2024-06-17 17:00:33 +0200
committerMitja Felicijan <mitja.felicijan@gmail.com>2024-06-17 17:00:33 +0200
commite34f07dc8bd8db122616b27329404947b49b0d3b (patch)
treedafbcba9e4b1767e2437d7928d9913f2e1792993 /content
parenta304c3714e1ec9238d76d265fec4c93c58152cf9 (diff)
downloadmitjafelicijan.com-e34f07dc8bd8db122616b27329404947b49b0d3b.tar.gz
Note: Sending signals to C programs
Diffstat (limited to 'content')
-rw-r--r--content/notes/2024-06-17-sending-signals-to-c-programs.md85
1 files changed, 43 insertions, 42 deletions
diff --git a/content/notes/2024-06-17-sending-signals-to-c-programs.md b/content/notes/2024-06-17-sending-signals-to-c-programs.md
index 94f0b94..bd4a895 100644
--- a/content/notes/2024-06-17-sending-signals-to-c-programs.md
+++ b/content/notes/2024-06-17-sending-signals-to-c-programs.md
@@ -9,8 +9,8 @@ draft: false
9For simple and easy IPC to the C program we can use signals. 9For simple and easy IPC to the C program we can use signals.
10https://www.man7.org/linux/man-pages/man7/signal.7.html 10https://www.man7.org/linux/man-pages/man7/signal.7.html
11 11
12Only two user defined signals are available but you can hijack other ones even 12Only two user defined signals are available (`SIGUSR1` and `SIGUSR2`) but you
13though this is really not advisable. 13can hijack other ones even though this is really not advisable.
14 14
15```c 15```c
16// signal.c 16// signal.c
@@ -39,43 +39,44 @@ Compile with `gcc -o signal signal.c` and run the program with `./signal` and
39then from another terminal send the signal to the program with `kill -10 39then from another terminal send the signal to the program with `kill -10
40$(pidof signal)` which should print out `Signal received: 10`. 40$(pidof signal)` which should print out `Signal received: 10`.
41 41
42| Signal | x86/ARM | Alpha/ | MIPS | PARISC | Notes | 42| Signal | x86/ARM | Alpha/ | MIPS | PARISC | Notes |
43|-----------|---------|--------|------|--------|---------------| 43|-------------|---------|--------|--------|--------|---------------|
44| SIGHUP | 1 | 1 | 1 | 1 | | 44| SIGHUP | 1 | 1 | 1 | 1 | |
45| SIGINT | 2 | 2 | 2 | 2 | | 45| SIGINT | 2 | 2 | 2 | 2 | |
46| SIGQUIT | 3 | 3 | 3 | 3 | | 46| SIGQUIT | 3 | 3 | 3 | 3 | |
47| SIGILL | 4 | 4 | 4 | 4 | | 47| SIGILL | 4 | 4 | 4 | 4 | |
48| SIGTRAP | 5 | 5 | 5 | 5 | | 48| SIGTRAP | 5 | 5 | 5 | 5 | |
49| SIGABRT | 6 | 6 | 6 | 6 | | 49| SIGABRT | 6 | 6 | 6 | 6 | |
50| SIGIOT | 6 | 6 | 6 | 6 | | 50| SIGIOT | 6 | 6 | 6 | 6 | |
51| SIGBUS | 7 | 10 | 10 | 10 | | 51| SIGBUS | 7 | 10 | 10 | 10 | |
52| SIGEMT | - | 7 | 7 | - | | 52| SIGEMT | - | 7 | 7 | - | |
53| SIGFPE | 8 | 8 | 8 | 8 | | 53| SIGFPE | 8 | 8 | 8 | 8 | |
54| SIGKILL | 9 | 9 | 9 | 9 | | 54| SIGKILL | 9 | 9 | 9 | 9 | |
55| SIGUSR1 | 10 | 30 | 16 | 16 | | 55| **SIGUSR1** | **10** | **30** | **16** | **16** | |
56| SIGSEGV | 11 | 11 | 11 | 11 | | 56| SIGSEGV | 11 | 11 | 11 | 11 | |
57| SIGUSR2 | 12 | 31 | 17 | 17 | | 57| **SIGUSR2** | **12** | **31** | **17** | **17** | |
58| SIGPIPE | 13 | 13 | 13 | 13 | | 58| SIGPIPE | 13 | 13 | 13 | 13 | |
59| SIGALRM | 14 | 14 | 14 | 14 | | 59| SIGALRM | 14 | 14 | 14 | 14 | |
60| SIGTERM | 15 | 15 | 15 | 15 | | 60| SIGTERM | 15 | 15 | 15 | 15 | |
61| SIGSTKFLT | 16 | - | - | 7 | | 61| SIGSTKFLT | 16 | - | - | 7 | |
62| SIGCHLD | 17 | 20 | 18 | 18 | | 62| SIGCHLD | 17 | 20 | 18 | 18 | |
63| SIGCLD | - | - | 18 | - | | 63| SIGCLD | - | - | 18 | - | |
64| SIGCONT | 18 | 19 | 25 | 26 | | 64| SIGCONT | 18 | 19 | 25 | 26 | |
65| SIGSTOP | 19 | 17 | 23 | 24 | | 65| SIGSTOP | 19 | 17 | 23 | 24 | |
66| SIGTSTP | 20 | 18 | 24 | 25 | | 66| SIGTSTP | 20 | 18 | 24 | 25 | |
67| SIGTTIN | 21 | 21 | 26 | 27 | | 67| SIGTTIN | 21 | 21 | 26 | 27 | |
68| SIGTTOU | 22 | 22 | 27 | 28 | | 68| SIGTTOU | 22 | 22 | 27 | 28 | |
69| SIGURG | 23 | 16 | 21 | 29 | | 69| SIGURG | 23 | 16 | 21 | 29 | |
70| SIGXCPU | 24 | 24 | 30 | 12 | | 70| SIGXCPU | 24 | 24 | 30 | 12 | |
71| SIGXFSZ | 25 | 25 | 31 | 30 | | 71| SIGXFSZ | 25 | 25 | 31 | 30 | |
72| SIGVTALRM | 26 | 26 | 28 | 20 | | 72| SIGVTALRM | 26 | 26 | 28 | 20 | |
73| SIGPROF | 27 | 27 | 29 | 21 | | 73| SIGPROF | 27 | 27 | 29 | 21 | |
74| SIGWINCH | 28 | 28 | 20 | 23 | | 74| SIGWINCH | 28 | 28 | 20 | 23 | |
75| SIGIO | 29 | 23 | 22 | 22 | | 75| SIGIO | 29 | 23 | 22 | 22 | |
76| SIGPOLL | | | | | Same as SIGIO | 76| SIGPOLL | | | | | Same as SIGIO |
77| SIGPWR | 30 | 29/- | 19 | 19 | | 77| SIGPWR | 30 | 29/- | 19 | 19 | |
78| SIGINFO | - | 29/- | - | - | | 78| SIGINFO | - | 29/- | - | - | |
79| SIGLOST | - | -/29 | - | - | | 79| SIGLOST | - | -/29 | - | - | |
80| SIGSYS | 31 | 12 | 12 | 31 | | 80| SIGSYS | 31 | 12 | 12 | 31 | |
81| SIGUNUSED | 31 | - | - | 31 | | 81| SIGUNUSED | 31 | - | - | 31 | |
82