mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-10 01:17:44 +03:00
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
This commit is contained in:
parent
0e77fc66bc
commit
63e2d1714e
22
meson.build
22
meson.build
@ -2198,6 +2198,10 @@ foreach alias : (['halt', 'poweroff', 'reboot', 'shutdown'] +
|
||||
join_paths(rootsbindir, alias))
|
||||
endforeach
|
||||
|
||||
meson.add_install_script(meson_make_symlink,
|
||||
join_paths(rootbindir, 'udevadm'),
|
||||
join_paths(rootlibexecdir, 'systemd-udevd'))
|
||||
|
||||
if conf.get('ENABLE_BACKLIGHT') == 1
|
||||
executable(
|
||||
'systemd-backlight',
|
||||
@ -2983,24 +2987,6 @@ public_programs += executable(
|
||||
install : true,
|
||||
install_dir : rootlibexecdir)
|
||||
|
||||
public_programs += executable(
|
||||
'systemd-udevd',
|
||||
systemd_udevd_sources,
|
||||
include_directories : includes,
|
||||
c_args : '-DLOG_REALM=LOG_REALM_UDEV',
|
||||
link_with : [libudev_core,
|
||||
libsystemd_network,
|
||||
libudev_static],
|
||||
dependencies : [versiondep,
|
||||
threads,
|
||||
libkmod,
|
||||
libidn,
|
||||
libacl,
|
||||
libblkid],
|
||||
install_rpath : udev_rpath,
|
||||
install : true,
|
||||
install_dir : rootlibexecdir)
|
||||
|
||||
public_programs += executable(
|
||||
'udevadm',
|
||||
udevadm_sources,
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
4
src/udev/udevd.h
Normal file
4
src/udev/udevd.h
Normal file
@ -0,0 +1,4 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0+ */
|
||||
#pragma once
|
||||
|
||||
int run_udevd(int argc, char *argv[]);
|
Loading…
Reference in New Issue
Block a user