Commit Graph

35939 Commits

Author SHA1 Message Date
Lennart Poettering f05e1ae666 sleep: when we can't hibernate on suspend-then-hibernate, fall back to suspend again
Let's make this a bit safer, and try hard to return to sleep, if we can
at all.

Fixes: #10212
2018-10-24 14:44:14 +02:00
Lennart Poettering 14250f0942 sleep: rework what we do if a suspend fails.
First of all, let's fix logging: let's simply log the same message as we
do on success, so that there's always the same pair of these messages
around, regardless if the suspend was successful or not. To distuingish
a successful suspend from a failed one, check the ERRNO= field of the
structured message.

In most ways a failed suspend cycle is not distuingishable from a
successful one that took no time, hence let's treat it this way, and
always pair the success message with a failure message.

This also changes a more important concept: the post-suspend callouts
are now called also called on failure, following the same logic: let's
always run them in pairs: for every pre callout a post callout has to
follow.
2018-10-24 13:07:53 +02:00
Lennart Poettering c695101f47 sleep: no need to check for resume_offset twice
The W_OK check already checks for existance hence let's remove the F_OK
check.
2018-10-24 12:57:37 +02:00
Lennart Poettering eabcf200f7 sleep: let's turn off the RTC alarm time ASAP
Let's be a tiny bit more careful here.

Also, let's rearrange things to simplify them a bit, and to not use "r"
outside of its immediate scope of validity.
2018-10-24 12:52:11 +02:00
Lennart Poettering d029a3a8ca sleep: round up when calculating RTC sleep time
Paranoia: this way we know that when we wake up all timers are
definitely equal or ahead of what we expect them to be.
2018-10-24 12:48:56 +02:00
Lennart Poettering 033cea5c9d sleep: move log message generation for rtc_read_time() into the function itself
The log messages were petty borked anyway, and generated at two separate
locations. Let's fix that.
2018-10-24 12:47:46 +02:00
Lennart Poettering f780e438fa sleep: rework write_wakealarm() to take a numeric parameter
Also, let's rename it to rtc_write_wake_alarm(). Both changes together
make sure rtc_write_wake_alarm() and rtc_read_time() are more alike in
their naming and semantics.
2018-10-24 12:46:12 +02:00
Lennart Poettering c16669a309 sleep: rename read_wakealarm() → rtc_read_time()
It doesn't read wakealarm, but the current time of the RTC. Hence, let's
rename this to make it less misleading.
2018-10-24 12:44:20 +02:00
Lennart Poettering 6ce63245f6 sleep: log about the correct errors 2018-10-24 12:38:13 +02:00
Lennart Poettering 58220e6b91 sleep: don't make up errors, propagate the right ones 2018-10-24 12:38:04 +02:00
Lennart Poettering f00aff0a02 sleep: let's use write_string_file() instead of write_string_stream() if we can
Let's shorten things.
2018-10-24 12:35:49 +02:00
Lennart Poettering d1db1c438f
Merge pull request #10484 from yuwata/udev-spawn-simplify
udev-event: cleanups about udev_event_spawn()
2018-10-24 10:57:45 +02:00
Lennart Poettering e7b48c45ae
Merge pull request #10498 from yuwata/udev-builtin-log
udev-builtin: use log_device_*() macros
2018-10-24 10:53:35 +02:00
Lennart Poettering 77d28bd10f
Merge pull request #10483 from yuwata/udev-cleanup-10
tree-wide: use log_device_*()
2018-10-24 10:51:53 +02:00
Lennart Poettering 086712f99f
Merge pull request #10461 from yuwata/small-cleanups
Fixes recent defects reported by coverity
2018-10-24 10:36:20 +02:00
Jiuyang liu a2f577fca0 add ephemeral to nspawn-settings. 2018-10-24 10:22:20 +02:00
Yu Watanabe 1cb7d29d68 udevadm-info: fix memleak
Fixes CID#1396276.
2018-10-24 05:04:01 +09:00
Yu Watanabe a0570c1a82 udevadm-monitor: initialize variable
Fixes CID#1396278.
2018-10-24 05:04:01 +09:00
Yu Watanabe db8794c3a0 modules-load: return first error in the loop
Follow-up for a889e206a7.
Fixes CID#1396280.
2018-10-24 05:04:01 +09:00
Yu Watanabe fd5ad16cfb reply-password: initialize 'length' variable
Follow-up for 1fd2786161.

This fixes the following warning when built by clang:
```
../src/reply-password/reply-password.c:76:21 warning: variable 'length' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
```

Fixes CID#1396281 and CID#1396277.
2018-10-24 05:03:00 +09:00
Yu Watanabe ec9d636b37 core: use ascii_toupper() instead of everytime judging whether it is the first message 2018-10-24 04:58:08 +09:00
Yu Watanabe e81c3a4c5f udev-event: use sd_event_add_io() for reading stdout or stderr of spawned process 2018-10-24 04:46:48 +09:00
Yu Watanabe 4e57ad3578 udev-event: unify two log_*() by log_full() 2018-10-24 04:46:48 +09:00
Yu Watanabe 5ca3dbc91a udev-event: Capitalize log messages 2018-10-24 04:46:48 +09:00
Yu Watanabe 2e48548fed udev-event: fix condition to create pipe fds
The bug was introduced by feaa6db7ac.
2018-10-24 04:46:48 +09:00
Yu Watanabe f71e8ec10e udev-event: set O_CLOEXEC to pipe fds 2018-10-24 04:46:48 +09:00
Yu Watanabe 947ce772d9 udev-event: make failure in getting device properties fatal 2018-10-24 04:46:48 +09:00
Yu Watanabe a41ff38b09 test: create /dev/null in test-udev.pl 2018-10-24 04:46:48 +09:00
Yu Watanabe 84b1ccb98b udev-event: use rearrange_stdio() and close_all_fds() 2018-10-24 04:46:48 +09:00
Yu Watanabe 6ce075a23a udev-event: set FORK_DEATHSIG flag 2018-10-24 04:46:48 +09:00
Yu Watanabe 63ec4dfaa1 udev-event: drop redundant code
We have set FORK_RESET_SIGNALS in safe_fork(). So, calling
reset_signal_mask() after safe_fork() is redundant.
2018-10-24 04:46:48 +09:00
Yu Watanabe 3ad4d482c7 udev-event: move debug logging before safe_fork()
This fixes the following journal layout issue:
```
Oct 22 15:26:02 systemd-udevd[348]: RUN '/usr/sbin/setregdomain' /usr/lib/udev/rules.d/85-regulatory.rules:5
Oct 22 15:26:02 [439]: Starting '/usr/sbin/setregdomain'
Oct 22 15:26:02 systemd-udevd[348]: Process '/usr/sbin/setregdomain' succeeded.
```
2018-10-24 04:46:48 +09:00
Yu Watanabe d9de38caa4 udev-builtin-input_id: update log messages 2018-10-24 04:33:21 +09:00
Yu Watanabe 9a6e5c24ba udev-builtin-usb_id: update log messages 2018-10-24 04:31:48 +09:00
Yu Watanabe 883658b8f1 udev-builtin-uaccess: update log messages 2018-10-24 04:31:48 +09:00
Yu Watanabe 70fbab6e48 udev-builtin-net_setup_link: update log messages 2018-10-24 04:31:48 +09:00
Yu Watanabe 2dccfe4c2d udev-builtin-keyboard: update log messages 2018-10-24 04:31:48 +09:00
Yu Watanabe f3f80f43aa sd_hwdb: update log messages 2018-10-24 04:31:48 +09:00
Yu Watanabe 5ad71e4490 udev-builtin-btrfs: add debug log messages 2018-10-24 04:31:23 +09:00
Yu Watanabe 5c614b79f4 udev-builtin-blkid: add more debug log messages 2018-10-24 04:31:23 +09:00
Yu Watanabe b0db44fe15 udev-builtin: fix return value of udev_builtin_hwdb()
This fixes a bug introduced by d354690e7d.
Also, this adds more debug logs.
2018-10-24 04:30:05 +09:00
Yu Watanabe ec2e8c3a62 sd-device: fix argument name in log_device_*() macros
Follow-up for b0cba0ca52.
2018-10-24 04:29:00 +09:00
Evgeny Vereshchagin c8758e726c journald: use the "driver" transport for logging a refused connection
Otherwise, these messages can end up in `/dev/null` when journald is run
in containers as was shown in https://github.com/systemd/systemd/pull/10444#issuecomment-430927793.
2018-10-23 19:36:52 +02:00
Evgeny Vereshchagin 9e8b1ec08e sd-journal: escape binary data in match_make_string()
Fixes: #10383
2018-10-23 19:33:01 +02:00
Yu Watanabe 61b8aa3d27 udevadm: normalize exit status
After d354690e7d, each udevadm command
returns negative errno on error. So, let's normalize the exit status
of udevadm.
2018-10-23 19:31:37 +02:00
Lennart Poettering 5d83b9f47b
Merge pull request #10493 from yuwata/parse-time-overflow
util: check overflow in parse_time() and parse_nsec()
2018-10-23 19:30:49 +02:00
Yu Watanabe b220632c61 link-config: use log_device_*() 2018-10-23 22:44:07 +09:00
Yu Watanabe 4d04259d41 udev-watch: use log_device_*() 2018-10-23 22:44:07 +09:00
Yu Watanabe e0ca42e383 udev-node: use log_device_*() 2018-10-23 22:44:07 +09:00
Yu Watanabe 94ad322538 rfkill: use log_device_*() 2018-10-23 22:44:07 +09:00