Merge pull request #11896 from poettering/shutdown-fixes
move src/core/shutdown.c and helpers to src/shutdown/
This commit is contained in:
commit
bea3d64a73
5
TODO
5
TODO
|
@ -23,6 +23,9 @@ Janitorial Clean-ups:
|
|||
|
||||
Features:
|
||||
|
||||
* check ID_RENAMING= property from PID1's .device logic, and don't consider
|
||||
devices that are being renamed.
|
||||
|
||||
* make MAINPID= message reception checks even stricter: if service uses User=,
|
||||
then check sending UID and ignore message if it doesn't match the user or
|
||||
root.
|
||||
|
@ -63,7 +66,7 @@ Features:
|
|||
|
||||
* paranoia: whenever we process passwords, call mlock() on the memory
|
||||
first. i.e. look for all places we use string_erase()/string_free_erase() and
|
||||
augment them with mlock()
|
||||
augment them with mlock(). Also use MADV_DONTDUMP
|
||||
|
||||
* whenever oom_kill memory.event event is triggered print a nice log message
|
||||
|
||||
|
|
|
@ -1441,6 +1441,7 @@ includes = include_directories('src/basic',
|
|||
'src/udev',
|
||||
'src/libudev',
|
||||
'src/core',
|
||||
'src/shutdown',
|
||||
'src/libsystemd/sd-bus',
|
||||
'src/libsystemd/sd-device',
|
||||
'src/libsystemd/sd-event',
|
||||
|
@ -1527,6 +1528,7 @@ public_programs = []
|
|||
subdir('src/libudev')
|
||||
subdir('src/shared')
|
||||
subdir('src/core')
|
||||
subdir('src/shutdown')
|
||||
subdir('src/udev')
|
||||
subdir('src/network')
|
||||
|
||||
|
@ -2676,6 +2678,10 @@ public_programs += exe
|
|||
|
||||
executable('systemd-shutdown',
|
||||
systemd_shutdown_sources,
|
||||
'src/core/mount-setup.c',
|
||||
'src/core/mount-setup.h',
|
||||
'src/core/killall.c',
|
||||
'src/core/killall.h',
|
||||
include_directories : includes,
|
||||
link_with : [libshared],
|
||||
dependencies : [libmount],
|
||||
|
|
|
@ -163,16 +163,6 @@ libcore = static_library(
|
|||
|
||||
systemd_sources = files('main.c')
|
||||
|
||||
systemd_shutdown_sources = files('''
|
||||
shutdown.c
|
||||
umount.c
|
||||
umount.h
|
||||
mount-setup.c
|
||||
mount-setup.h
|
||||
killall.c
|
||||
killall.h
|
||||
'''.split())
|
||||
|
||||
in_files = [['macros.systemd', rpmmacrosdir],
|
||||
['system.conf', pkgsysconfdir],
|
||||
['systemd.pc', pkgconfigdatadir],
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
systemd_shutdown_sources = files('''
|
||||
shutdown.c
|
||||
umount.c
|
||||
umount.h
|
||||
'''.split())
|
|
@ -169,10 +169,10 @@ static int switch_root_initramfs(void) {
|
|||
* value input. For all other issues, report the failure and indicate that
|
||||
* the sync is not making progress.
|
||||
*/
|
||||
static bool sync_making_progress(unsigned long long *prev_dirty) {
|
||||
static int sync_making_progress(unsigned long long *prev_dirty) {
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
unsigned long long val = 0;
|
||||
bool r = false;
|
||||
int ret;
|
||||
|
||||
f = fopen("/proc/meminfo", "re");
|
||||
if (!f)
|
||||
|
@ -205,11 +205,9 @@ static bool sync_making_progress(unsigned long long *prev_dirty) {
|
|||
val += ull;
|
||||
}
|
||||
|
||||
r = *prev_dirty > val;
|
||||
|
||||
ret = *prev_dirty > val;
|
||||
*prev_dirty = val;
|
||||
|
||||
return r;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void sync_with_progress(void) {
|
||||
|
@ -243,7 +241,7 @@ static void sync_with_progress(void) {
|
|||
else if (r == -ETIMEDOUT) {
|
||||
/* Reset the check counter if the "Dirty" value is
|
||||
* decreasing */
|
||||
if (sync_making_progress(&dirty))
|
||||
if (sync_making_progress(&dirty) > 0)
|
||||
checks = 0;
|
||||
} else {
|
||||
log_error_errno(r, "Failed to sync filesystems and block devices: %m");
|
||||
|
@ -345,14 +343,14 @@ int main(int argc, char *argv[]) {
|
|||
bool changed = false;
|
||||
|
||||
if (use_watchdog)
|
||||
watchdog_ping();
|
||||
(void) watchdog_ping();
|
||||
|
||||
/* Let's trim the cgroup tree on each iteration so
|
||||
that we leave an empty cgroup tree around, so that
|
||||
container managers get a nice notify event when we
|
||||
are down */
|
||||
if (cgroup)
|
||||
cg_trim(SYSTEMD_CGROUP_CONTROLLER, cgroup, false);
|
||||
(void) cg_trim(SYSTEMD_CGROUP_CONTROLLER, cgroup, false);
|
||||
|
||||
if (need_umount) {
|
||||
log_info("Unmounting file systems.");
|
||||
|
@ -442,7 +440,7 @@ int main(int argc, char *argv[]) {
|
|||
arguments[0] = NULL;
|
||||
arguments[1] = arg_verb;
|
||||
arguments[2] = NULL;
|
||||
execute_directories(dirs, DEFAULT_TIMEOUT_USEC, NULL, NULL, arguments, NULL, EXEC_DIR_PARALLEL | EXEC_DIR_IGNORE_ERRORS);
|
||||
(void) execute_directories(dirs, DEFAULT_TIMEOUT_USEC, NULL, NULL, arguments, NULL, EXEC_DIR_PARALLEL | EXEC_DIR_IGNORE_ERRORS);
|
||||
|
||||
(void) rlimit_nofile_safe();
|
||||
|
|
@ -716,8 +716,8 @@ tests += [
|
|||
[['src/test/test-umount.c',
|
||||
'src/core/mount-setup.c',
|
||||
'src/core/mount-setup.h',
|
||||
'src/core/umount.c',
|
||||
'src/core/umount.h'],
|
||||
'src/shutdown/umount.c',
|
||||
'src/shutdown/umount.h'],
|
||||
[],
|
||||
[libmount]],
|
||||
|
||||
|
|
Loading…
Reference in New Issue