summaryrefslogtreecommitdiff
path: root/src/core/killall.c
Commit message (Collapse)AuthorAge
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-23
| | | | | | This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
* treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt2014-11-28
| | | | | | | | | | | If the format string contains %m, clearly errno must have a meaningful value, so we might as well use log_*_errno to have ERRNO= logged. Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/' Plus some whitespace, linewrap, and indent adjustments.
* hashmap: introduce hash_ops to make struct Hashmap smallerMichal Schmidt2014-09-15
| | | | | | | | | It is redundant to store 'hash' and 'compare' function pointers in struct Hashmap separately. The functions always comprise a pair. Store a single pointer to struct hash_ops instead. systemd keeps hundreds of hashmaps, so this saves a little bit of memory.
* use more _cleanup_ macroRonny Chevalier2014-06-24
|
* core: fix invalid free() in killall()Andreas Henriksson2014-06-13
| | | | | | | | | | static int killall(....) in ./src/core/killall.c tries to get "s" initialized by calling get_process_comm(...) which calls read_one_line_file(...) which if it fails will mean it is left uninitialized. It is then used in argument to strna(s) call where it is dereferenced(!), in addition to nothing else initializing it before the scope it is in finishes.
* shared: procfs_file_alloca: handle pid==0Simon Peeters2014-01-05
| | | | when pid is set to 0 use /proc/self
* Use format patterns for usec_t, pid_t, nsec_t, usec_tZbigniew Jędrzejewski-Szmek2014-01-02
| | | | | | | | It is nicer to predefine patterns using configure time check instead of using casts everywhere. Since we do not need to use any flags, include "%" in the format instead of excluding it like PRI* macros.
* core: fix order of parameters in broadcast_signal()Lennart Poettering2013-11-25
|
* shutdown: during final killing spree also send SIGHUP in addition to SIGTERM ↵Lennart Poettering2013-11-25
| | | | | | to deal with shells This makes shutdown a bit faster if debug-shell.service is enabled.
* killall: do not use alloca() in argument listZbigniew Jędrzejewski-Szmek2013-06-26
| | | | It is not allowed.
* core/killall: use procfs_file_allocaZbigniew Jędrzejewski-Szmek2013-04-19
|
* core/killall.c: prevent segfault and initialize pidsHarald Hoyer2013-04-03
|
* shutdown: correctly wait for processes we killed in the killall spreeLennart Poettering2013-04-02
| | | | | | | | | | | | | | | | | Previously we simply counted how many processes we killed and expected as many waitpid() calls to succeed. That however is incorrect to do. As we might kill processes that are not our immediate children, and as there might be left-over processes in the waitpid() queue from earlier the we might get more ore less waitpid() events that we expect. Hence: keep precise track of the processes we kill, remove the ones we get waitpid() for, and after each time we get SIGCHLD check if all others still exist. We use getpgid() to check if a PID still exists. This should fix issues with journald not setting journal files offline correctly on shutdown, because we'd too quickly proceed from SIGTERM to SIGKILL because some left-over process was in our waitpid() queue.
* killall: print notice what we forcefully KILLKay Sievers2013-03-30
|
* killall: avoid gcc warning about wait name clashLennart Poettering2012-07-19
|
* switch-root: don't wait for processesLennart Poettering2012-07-17
| | | | | When we transition from the initrd to the main system, don't reap processes, so that they can be handled normally after deserialization.
* core: go on a killing spree when transitioning from initrd to main systemLennart Poettering2012-07-13