Zbigniew Jędrzejewski-Szmek
66f737b415
udev: do not pass timeout_warn_usec around, calculate it on demand
...
It was always set to one third of timeout_usec, so let's simplify things by
calculating it using a helper function right before it is used.
Before 9d9264ba39
, udevd.c would avoid setting
timeout_warn_usec to 0, using 1 instead. This wasn't necessary, because when
timeout_warn_usec is finally used in spawn_wait(), it is ignored if
timeout_usec is 0 or timeout_warn_usec is 0. So there was no need to handle
this case specially.
2018-11-13 14:00:32 +01:00
Yu Watanabe
6b92f42934
udevd: use parse_sec() to parse --exec-delay option
2018-11-12 23:16:54 +09:00
Yu Watanabe
cf28ad4689
udev-event: make udev_event_new() take sd_device instead of udev_device
2018-11-07 13:35:03 +09:00
Yu Watanabe
f3d241feb2
udev: use sd_device for udev_event.dev_parent
2018-11-07 13:35:03 +09:00
Yu Watanabe
480ecb7d28
udev: use sd_device for udev_event.dev_db
...
Also, this adds sd_device_unref for the object in udev_event_free()
for safety and readability of code.
2018-11-07 13:35:03 +09:00
Yu Watanabe
e0bb2ff94b
udev-event: make udev_event_new() take sd_netlink and take a reference of that
2018-11-07 13:35:03 +09:00
Yu Watanabe
0f86dc900e
udev-event: make udev_event_new() take exec_delay
2018-11-07 13:35:03 +09:00
Yu Watanabe
4375dab58d
udev-event: fix timeout log messages
...
Follow-up for e81c3a4c5f
.
2018-10-31 09:29:51 +09:00
Yu Watanabe
7af1c7808b
udev-event: do not store unused devnum
2018-10-31 09:29:51 +09:00
Yu Watanabe
d4a95a952e
udev-event: check whether device has devnum before calling udev_node_remove()
...
This fixes a bug in 'remove' event handling, which was introduced by
eb1f9e30ec
, as 'devnum' variable may
not be initialized.
2018-10-31 09:29:51 +09:00
Yu Watanabe
4cade7a15b
udev-event: replace udev_device in subst_format_var() by sd_device
2018-10-27 07:25:27 +09:00
Yu Watanabe
9204d8023f
udev-event: move definition of struct subst_map
2018-10-27 07:25:27 +09:00
Yu Watanabe
eb1f9e30ec
udev-event: replace udev_device in udev_event_execute_rules() by sd_device
...
Also, this adds many logs.
2018-10-27 07:25:27 +09:00
Yu Watanabe
e52eaf5649
udev-event: move devnode handling logic to a new function
...
Also, replace udev_device by sd_device.
2018-10-27 07:25:27 +09:00
Yu Watanabe
2740750d40
udev-event: move conditions to rename network interface into rename_netif()
...
Also, replace udev_device by sd_device.
2018-10-27 07:24:03 +09:00
Yu Watanabe
c1118ceba4
udev-event: rename udev_event_unref() to udev_event_free()
...
As struct udev_event does not have a reference counter.
2018-10-27 07:03:39 +09:00
Yu Watanabe
d737197154
udev-event: fix memleak in udev_event
...
The leak was introduced by 29448498c7
.
2018-10-27 07:03:39 +09:00
Yu Watanabe
89665d0920
udev-event: use structured initializer at one more place
2018-10-27 07:03:39 +09:00
Yu Watanabe
a368732bc4
udev-event: add more assert()
2018-10-27 07:03:39 +09:00
Yu Watanabe
dc8aec36a6
udev-event: check command is not empty before executing
2018-10-27 07:03:39 +09:00
Yu Watanabe
e9343893f7
udev-event: include device name in error message one more place
2018-10-27 07:03:39 +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
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
c45b369dd1
udev-builtin: modernize code a bit
...
- introduce _UDEV_BUILTIN_INVALID,
- use _UDEV_BUILTIN_MAX where applicable,
- add several assertions.
2018-10-23 18:28:38 +09:00
Yu Watanabe
3d6194e83e
udev: make udev_builtin_run take sd_device
2018-10-23 18:28:38 +09:00
Yu Watanabe
14cb109d45
tree-wide: replace 'unsigned int' with 'unsigned'
2018-10-19 22:19:12 +02:00
Yu Watanabe
9b5150b63e
udev: use Hashmap for storing global properties
2018-10-17 06:50:12 +09:00
Yu Watanabe
29448498c7
udev: use Hashmap for storing PROGRAM or BUILTIN
2018-10-17 06:49:56 +09:00
Yu Watanabe
d838e14515
udev: use Hashmap for storing SECLABEL
2018-10-17 06:48:53 +09:00
Yu Watanabe
07a26e42da
udev-builtin: move definitions related to builtin commands to udev-builtin.h
2018-10-11 04:21:14 +09:00
Yu Watanabe
a2554acec6
udev-node: replace udev_device by sd_device and modernize code a bit
2018-10-11 04:21:14 +09:00
Yu Watanabe
7006860271
udev-watch: replace udev_device by sd_device and modernize code a bit
2018-10-11 04:21:14 +09:00
Yu Watanabe
da4bb75f59
udev: drop unused function udev_build_argv()
2018-10-11 04:21:14 +09:00
Yu Watanabe
feaa6db7ac
udev-event: replace udev_build_argv() by strv_split_full()
...
This also modernize udev_event_spawn() a bit.
2018-09-26 22:55:22 +09:00
Yu Watanabe
2024ed616e
udev: drop unused udev struct
2018-09-10 18:27:36 +09:00
Yu Watanabe
755c3fe9a7
libudev-util: drop unnecessary argument 'struct udev *udev' from util_resolve_subsys_kernel()
2018-09-10 18:27:36 +09:00
Yu Watanabe
f330408d62
tree-wide: drop empty lines in comments
2018-07-23 08:44:24 +02:00
Zbigniew Jędrzejewski-Szmek
d9b02e1697
tree-wide: drop copyright headers from frequent contributors
...
Fixes #9320 .
for p in Shapovalov Chevalier Rozhkov Sievers Mack Herrmann Schmidt Rudenberg Sahani Landden Andersen Watanabe; do
git grep -e 'Copyright.*'$p -l|xargs perl -i -0pe 's|/([*][*])?[*]\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\s*[*]([*][*])?/\n*|\n|gms; s|\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\n*|\n|gms'
done
2018-06-20 11:58:53 +02:00
Zbigniew Jędrzejewski-Szmek
50d1760d26
Drop more license boilerplate
...
$ git grep -e 'This program is free software' -l |grep -v LICENSE | \
xargs perl -i -0pe 's/ \* This program.*?for more details.\s*\*\n( \* You should have.*licenses.>.\n)?//gms'
For some reason they were missed previously. All those files seem to
have proper SDPX tags.
2018-06-14 13:05:41 +02:00
Lennart Poettering
810adae9e9
tree-wide: use proper unicode © instead of (C) where we can
...
Let's use a proper unicode copyright symbol where we can, it's prettier.
This important patch is very important.
2018-06-14 10:20:20 +02:00
Lennart Poettering
b6e1fff13d
process-util: add another fork_safe() flag for enabling LOG_ERR/LOG_WARN logging
2018-01-04 13:27:26 +01:00
Lennart Poettering
4c253ed1ca
tree-wide: introduce new safe_fork() helper and port everything over
...
This adds a new safe_fork() wrapper around fork() and makes use of it
everywhere. The new wrapper does a couple of things we previously did
manually and separately in a safer, more correct and automatic way:
1. Optionally resets signal handlers/mask in the child
2. Sets a name on all processes we fork off right after forking off (and
the patch assigns useful names for all processes we fork off now,
following a systematic naming scheme: always enclosed in () – in order
to indicate that these are not proper, exec()ed processes, but only
forked off children, and if the process is long-running with only our
own code, without execve()'ing something else, it gets am "sd-" prefix.)
3. Optionally closes all file descriptors in the child
4. Optionally sets a PR_SET_DEATHSIG to SIGTERM in the child, in a safe
way so that the parent dying before this happens being handled
safely.
5. Optionally reopens the logs
6. Optionally connects stdin/stdout/stderr to /dev/null
7. Debug logs about the forked off processes.
2017-12-25 11:48:21 +01:00