summaryrefslogtreecommitdiff
path: root/src/core/killall.c
AgeCommit message (Collapse)Author
2016-01-26shutdown: complain if process excluded from killing spree runs of the same ↵Michal Sekletar
rootfs as PID1
2015-10-27util-lib: split out allocation calls into alloc-util.[ch]Lennart Poettering
2015-10-27util-lib: split string parsing related calls from util.[ch] into parse-util.[ch]Lennart Poettering
2015-10-25util-lib: split out fd-related operations into fd-util.[ch]Lennart Poettering
There are more than enough to deserve their own .c file, hence move them over.
2015-10-24util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering
string-util.[ch] There are more than enough calls doing string manipulations to deserve its own files, hence do something about it. This patch also sorts the #include blocks of all files that needed to be updated, according to the sorting suggestions from CODING_STYLE. Since pretty much every file needs our string manipulation functions this effectively means that most files have sorted #include blocks now. Also touches a few unrelated include files.
2015-09-04macro: introduce new PID_TO_PTR macros and make use of themLennart Poettering
This adds a new PID_TO_PTR() macro, plus PTR_TO_PID() and makes use of it wherever we maintain processes in a hash table. Previously we sometimes used LONG_TO_PTR() and other times ULONG_TO_PTR() for that, hence let's make this more explicit and clean up things.
2015-06-09core: log oom during killing spreeThomas Hindoe Paaboel Andersen
but don't do anything else. We still want to kill as much as possible. Coverity CID#996306
2015-04-11shared: add terminal-util.[ch]Ronny Chevalier
2015-04-10shared: add process-util.[ch]Ronny Chevalier
2015-04-10shared: add formats-util.hRonny Chevalier
2015-02-23remove unused includesThomas Hindoe Paaboel Andersen
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.
2014-11-28treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt
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.
2014-09-15hashmap: introduce hash_ops to make struct Hashmap smallerMichal Schmidt
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.
2014-06-24use more _cleanup_ macroRonny Chevalier
2014-06-13core: fix invalid free() in killall()Andreas Henriksson
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.
2014-01-05shared: procfs_file_alloca: handle pid==0Simon Peeters
when pid is set to 0 use /proc/self
2014-01-02Use format patterns for usec_t, pid_t, nsec_t, usec_tZbigniew Jędrzejewski-Szmek
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.
2013-11-25core: fix order of parameters in broadcast_signal()Lennart Poettering
2013-11-25shutdown: during final killing spree also send SIGHUP in addition to SIGTERM ↵Lennart Poettering
to deal with shells This makes shutdown a bit faster if debug-shell.service is enabled.
2013-06-26killall: do not use alloca() in argument listZbigniew Jędrzejewski-Szmek
It is not allowed.
2013-04-19core/killall: use procfs_file_allocaZbigniew Jędrzejewski-Szmek
2013-04-03core/killall.c: prevent segfault and initialize pidsHarald Hoyer
2013-04-02shutdown: correctly wait for processes we killed in the killall spreeLennart Poettering
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.
2013-03-30killall: print notice what we forcefully KILLKay Sievers
2012-07-19killall: avoid gcc warning about wait name clashLennart Poettering
2012-07-17switch-root: don't wait for processesLennart Poettering
When we transition from the initrd to the main system, don't reap processes, so that they can be handled normally after deserialization.
2012-07-13core: go on a killing spree when transitioning from initrd to main systemLennart Poettering