diff options
author | Norbert Lange <nolange79@gmail.com> | 2020-05-26 10:26:12 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-06-01 09:41:21 +0200 |
commit | 63e2d1714eedf884ebd9dd865a9dae8ae670d074 (patch) | |
tree | f16d1b52337cbbf511a06f96231fae470a5b2623 /src | |
parent | 0e77fc66bceb9832da82a56a4c1040fe49f8d805 (diff) | |
download | systemd-63e2d1714eedf884ebd9dd865a9dae8ae670d074.tar.gz |
udev: single binary replacing udevd and udevadm
Since the separate binaries contain mostly the same code,
this almost halves the size of the installation.
before:
398K /bin/udevadm
391K /lib/systemd/systemd-udevd
after:
431K /bin/udevadm
0 /lib/systemd/systemd-udevd -> ../../bin/udevadm
Fixes: #14200
Diffstat (limited to 'src')
-rw-r--r-- | src/udev/meson.build | 3 | ||||
-rw-r--r-- | src/udev/udevadm.c | 4 | ||||
-rw-r--r-- | src/udev/udevd.c | 5 | ||||
-rw-r--r-- | src/udev/udevd.h | 4 |
4 files changed, 11 insertions, 5 deletions
diff --git a/src/udev/meson.build b/src/udev/meson.build index 173b10be50..aa23b07090 100644 --- a/src/udev/meson.build +++ b/src/udev/meson.build @@ -13,10 +13,9 @@ udevadm_sources = files(''' udevadm-trigger.c udevadm-util.c udevadm-util.h + udevd.c '''.split()) -systemd_udevd_sources = files('udevd.c') - libudev_core_sources = ''' udev-ctrl.c udev-ctrl.h diff --git a/src/udev/udevadm.c b/src/udev/udevadm.c index e6dbb111a9..f1115bff7a 100644 --- a/src/udev/udevadm.c +++ b/src/udev/udevadm.c @@ -11,6 +11,7 @@ #include "selinux-util.h" #include "string-util.h" #include "udevadm.h" +#include "udevd.h" #include "udev-util.h" #include "verbs.h" #include "util.h" @@ -110,6 +111,9 @@ static int udevadm_main(int argc, char *argv[]) { static int run(int argc, char *argv[]) { int r; + if (strstr(program_invocation_short_name, "udevd")) + return run_udevd(argc, argv); + udev_parse_config(); log_parse_environment(); log_open(); diff --git a/src/udev/udevd.c b/src/udev/udevd.c index 697fd8a043..5f5c1e0ae4 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -59,6 +59,7 @@ #include "strv.h" #include "strxcpyx.h" #include "syslog-util.h" +#include "udevd.h" #include "udev-builtin.h" #include "udev-ctrl.h" #include "udev-event.h" @@ -1713,7 +1714,7 @@ static int main_loop(Manager *manager) { return r; } -static int run(int argc, char *argv[]) { +int run_udevd(int argc, char *argv[]) { _cleanup_free_ char *cgroup = NULL; _cleanup_(manager_freep) Manager *manager = NULL; int fd_ctrl = -1, fd_uevent = -1; @@ -1828,5 +1829,3 @@ static int run(int argc, char *argv[]) { return main_loop(manager); } - -DEFINE_MAIN_FUNCTION(run); diff --git a/src/udev/udevd.h b/src/udev/udevd.h new file mode 100644 index 0000000000..848ffc245b --- /dev/null +++ b/src/udev/udevd.h @@ -0,0 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +#pragma once + +int run_udevd(int argc, char *argv[]); |