1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-07 18:27:04 +03:00
Commit Graph

17 Commits

Author SHA1 Message Date
Thomas Hindoe Paaboel Andersen
2eec67acbb remove unused includes
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.
2015-02-23 23:53:42 +01:00
Michal Schmidt
56f64d9576 treewide: use log_*_errno whenever %m is in the format string
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-11-28 19:49:27 +01:00
Michal Schmidt
d5099efc47 hashmap: introduce hash_ops to make struct Hashmap smaller
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-09-15 16:08:50 +02:00
Ronny Chevalier
e1d758033d use more _cleanup_ macro 2014-06-24 19:09:57 +02:00
Andreas Henriksson
3e09eb5c83 core: fix invalid free() in killall()
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-06-13 19:00:13 +02:00
Simon Peeters
b68fa010f7 shared: procfs_file_alloca: handle pid==0
when pid is set to 0 use /proc/self
2014-01-05 00:59:13 -05:00
Zbigniew Jędrzejewski-Szmek
ccd06097c7 Use format patterns for usec_t, pid_t, nsec_t, usec_t
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.
2014-01-02 19:45:47 -05:00
Lennart Poettering
6301a98cdf core: fix order of parameters in broadcast_signal() 2013-11-25 23:03:03 +01:00
Lennart Poettering
0bee65f062 shutdown: during final killing spree also send SIGHUP in addition to SIGTERM to deal with shells
This makes shutdown a bit faster if debug-shell.service is enabled.
2013-11-25 22:10:22 +01:00
Zbigniew Jędrzejewski-Szmek
5841bd803f killall: do not use alloca() in argument list
It is not allowed.
2013-06-26 19:52:00 -04:00
Zbigniew Jędrzejewski-Szmek
31885cd5e3 core/killall: use procfs_file_alloca 2013-04-19 10:10:41 -04:00
Harald Hoyer
b6e8f1f03d core/killall.c: prevent segfault and initialize pids 2013-04-03 15:17:51 +02:00
Lennart Poettering
aaf7eb81be shutdown: correctly wait for processes we killed in the killall spree
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-04-02 01:28:01 +02:00
Kay Sievers
df758e9875 killall: print notice what we forcefully KILL 2013-03-30 14:19:40 +01:00
Lennart Poettering
3d141780b8 killall: avoid gcc warning about wait name clash 2012-07-19 02:17:11 +02:00
Lennart Poettering
cee530bb23 switch-root: don't wait for processes
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-17 17:44:26 +02:00
Lennart Poettering
bd3fa1d243 core: go on a killing spree when transitioning from initrd to main system 2012-07-13 14:41:57 +02:00