systemd-analyze: added the verb unit-gdb to spawn and attach gdb

This commit is contained in:
ZIHCO
2025-07-17 15:09:58 +01:00
committed by Luca Boccassi
parent 6235121abf
commit ad6e02e7b4
11 changed files with 264 additions and 56 deletions
+13
View File
@@ -5,6 +5,7 @@
#include "errno-util.h"
#include "parse-util.h"
#include "process-util.h"
#include "signal-util.h"
#include "stdio-util.h"
#include "string-table.h"
@@ -319,3 +320,15 @@ int parse_signo(const char *s, int *ret) {
return 0;
}
void sigterm_process_group_handler(int signal, siginfo_t *info, void *ucontext) {
assert(signal == SIGTERM);
assert(info);
/* If the sender is not us, propagate the signal to all processes in
* the same process group */
if (si_code_from_process(info->si_code) &&
pid_is_valid(info->si_pid) &&
info->si_pid != getpid_cached())
(void) kill(0, signal);
}
+2
View File
@@ -93,3 +93,5 @@ static inline bool si_code_from_process(int si_code) {
return si_code < 0 || IN_SET(si_code, SI_USER, SI_QUEUE);
}
void sigterm_process_group_handler(int signal, siginfo_t *info, void *ucontext);