Merge pull request #25291 from keszybz/util-cleanup

Split/rename util.c+h and def.h
This commit is contained in:
Yu Watanabe 2022-11-09 09:23:17 +09:00 committed by GitHub
commit bf18862267
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
361 changed files with 1107 additions and 1080 deletions

2
TODO
View file

@ -72,8 +72,6 @@ Regularly:
Janitorial Clean-ups:
* Rearrange tests so that the various test-xyz.c match a specific src/basic/xyz.c again
* rework mount.c and swap.c to follow proper state enumeration/deserialization
semantics, like we do for device.c now

View file

@ -2035,7 +2035,8 @@ install_libsystemd_static = static_library(
libblkid,
libmount,
libgcrypt,
libopenssl],
libopenssl,
versiondep],
c_args : libsystemd_c_args + (static_libsystemd_pic ? [] : ['-fno-PIC']))
libudev = shared_library(
@ -2067,7 +2068,9 @@ install_libudev_static = static_library(
install_tag: 'libudev',
install_dir : rootlibdir,
link_depends : libudev_sym,
dependencies : libshared_deps + [libmount],
dependencies : [libshared_deps,
libmount,
versiondep],
c_args : static_libudev_pic ? [] : ['-fno-PIC'],
pic : static_libudev_pic)
@ -2252,8 +2255,8 @@ exe = executable(
include_directories : includes,
link_with : [libcore,
libshared],
dependencies : [versiondep,
libseccomp],
dependencies : [libseccomp,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -2270,8 +2273,8 @@ exe = executable(
include_directories : core_includes,
link_with : [libcore,
libshared],
dependencies : [versiondep,
libseccomp],
dependencies : [libseccomp,
versiondep],
install_rpath : rootpkglibdir,
install : conf.get('ENABLE_ANALYZE') == 1)
public_programs += exe
@ -2292,7 +2295,8 @@ executable(
libxz,
liblz4,
libselinux,
libzstd],
libzstd,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -2325,7 +2329,8 @@ public_programs += executable(
libxz,
liblz4,
libzstd,
libdl],
libdl,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootbindir)
@ -2456,7 +2461,8 @@ if conf.get('ENABLE_RESOLVE') == 1
dependencies : [threads,
lib_openssl_or_gcrypt,
libm,
libidn],
libidn,
versiondep],
install_rpath : rootpkglibdir,
install : true)
@ -2477,7 +2483,8 @@ if conf.get('ENABLE_LOGIND') == 1
link_with : [liblogind_core,
libshared],
dependencies : [threads,
libacl],
libacl,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -2490,7 +2497,8 @@ if conf.get('ENABLE_LOGIND') == 1
dependencies : [threads,
liblz4,
libxz,
libzstd],
libzstd,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootbindir)
@ -2517,7 +2525,8 @@ if conf.get('ENABLE_LOGIND') == 1
libshared_static],
dependencies : [threads,
libpam,
libpam_misc],
libpam_misc,
versiondep],
link_depends : pam_systemd_sym,
install : true,
install_tag : 'pam',
@ -2565,7 +2574,8 @@ if conf.get('HAVE_BLKID') == 1 and conf.get('HAVE_GNU_EFI') == 1
'src/boot/bootctl.c',
include_directories : includes,
link_with : [boot_link_with],
dependencies : [libblkid],
dependencies : [libblkid,
versiondep],
install_rpath : rootpkglibdir,
install : true)
@ -2574,7 +2584,8 @@ if conf.get('HAVE_BLKID') == 1 and conf.get('HAVE_GNU_EFI') == 1
'src/boot/bless-boot.c',
include_directories : includes,
link_with : [boot_link_with],
dependencies : [libblkid],
dependencies : [libblkid,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -2594,7 +2605,8 @@ if conf.get('HAVE_BLKID') == 1 and conf.get('HAVE_GNU_EFI') == 1
'src/boot/measure.c',
include_directories : includes,
link_with : [libshared],
dependencies : [libopenssl],
dependencies : [libopenssl,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -2603,7 +2615,9 @@ if conf.get('HAVE_BLKID') == 1 and conf.get('HAVE_GNU_EFI') == 1
'src/boot/pcrphase.c',
include_directories : includes,
link_with : [libshared],
dependencies : [libopenssl, tpm2],
dependencies : [libopenssl,
tpm2,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -2615,7 +2629,8 @@ executable(
'src/boot/boot-check-no-failures.c',
include_directories : includes,
link_with : [libshared],
dependencies : [libblkid],
dependencies : [libblkid,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -2625,7 +2640,8 @@ public_programs += executable(
'src/activate/activate.c',
include_directories : includes,
link_with : [libshared],
dependencies : [threads],
dependencies : [threads,
versiondep],
install_rpath : rootpkglibdir,
install : true)
@ -2639,7 +2655,8 @@ systemctl = executable(
libselinux,
libxz,
liblz4,
libzstd],
libzstd,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootbindir)
@ -2651,7 +2668,9 @@ if conf.get('ENABLE_PORTABLED') == 1
systemd_portabled_sources,
include_directories : includes,
link_with : [libshared],
dependencies : [threads, libselinux],
dependencies : [threads,
libselinux,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -2661,7 +2680,8 @@ if conf.get('ENABLE_PORTABLED') == 1
'src/portable/portablectl.c',
include_directories : includes,
link_with : [libshared],
dependencies : [threads],
dependencies : [threads,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootbindir)
@ -2684,7 +2704,8 @@ if conf.get('ENABLE_USERDB') == 1
systemd_userwork_sources,
include_directories : includes,
link_with : [libshared],
dependencies : [threads],
dependencies : [threads,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -2694,7 +2715,8 @@ if conf.get('ENABLE_USERDB') == 1
systemd_userdbd_sources,
include_directories : includes,
link_with : [libshared],
dependencies : [threads],
dependencies : [threads,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -2704,7 +2726,8 @@ if conf.get('ENABLE_USERDB') == 1
userdbctl_sources,
include_directories : includes,
link_with : [libshared],
dependencies : [threads],
dependencies : [threads,
versiondep],
install_rpath : rootpkglibdir,
install : true)
endif
@ -2720,7 +2743,8 @@ if conf.get('ENABLE_HOMED') == 1
libcrypt,
libopenssl,
libfdisk,
libp11kit],
libp11kit,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -2733,7 +2757,8 @@ if conf.get('ENABLE_HOMED') == 1
dependencies : [threads,
libcrypt,
libopenssl,
libm],
libm,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -2747,7 +2772,8 @@ if conf.get('ENABLE_HOMED') == 1
libcrypt,
libopenssl,
libp11kit,
libdl],
libdl,
versiondep],
install_rpath : rootpkglibdir,
install : true)
@ -2765,7 +2791,8 @@ if conf.get('ENABLE_HOMED') == 1
dependencies : [threads,
libpam,
libpam_misc,
libcrypt],
libcrypt,
versiondep],
link_depends : pam_systemd_home_sym,
install : true,
install_tag : 'pam',
@ -2830,7 +2857,8 @@ if conf.get('HAVE_LIBCRYPTSETUP') == 1
include_directories : includes,
link_with : [libshared],
dependencies : [libcryptsetup,
libp11kit],
libp11kit,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -2849,7 +2877,8 @@ if conf.get('HAVE_LIBCRYPTSETUP') == 1
'src/veritysetup/veritysetup.c',
include_directories : includes,
link_with : [libshared],
dependencies : [libcryptsetup],
dependencies : [libcryptsetup,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -2859,6 +2888,7 @@ if conf.get('HAVE_LIBCRYPTSETUP') == 1
'src/veritysetup/veritysetup-generator.c',
include_directories : includes,
link_with : [libshared],
dependencies : [versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : systemgeneratordir)
@ -2871,7 +2901,8 @@ if conf.get('HAVE_LIBCRYPTSETUP') == 1
dependencies : [libcryptsetup,
libdl,
libopenssl,
libp11kit],
libp11kit,
versiondep],
install_rpath : rootpkglibdir,
install : true)
@ -2880,7 +2911,8 @@ if conf.get('HAVE_LIBCRYPTSETUP') == 1
['src/integritysetup/integritysetup.c', 'src/integritysetup/integrity-util.c'],
include_directories : includes,
link_with : [libshared],
dependencies : [libcryptsetup],
dependencies : [libcryptsetup,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -2965,9 +2997,11 @@ if conf.get('ENABLE_LOCALED') == 1
if conf.get('HAVE_XKBCOMMON') == 1
# logind will load libxkbcommon.so dynamically on its own, but we still
# need to specify where the headers are
deps = [libdl, libxkbcommon.partial_dependency(compile_args: true)]
deps = [libdl,
libxkbcommon.partial_dependency(compile_args: true),
versiondep]
else
deps = []
deps = [versiondep]
endif
dbus_programs += executable(
@ -3007,7 +3041,8 @@ if conf.get('ENABLE_TIMEDATECTL') == 1
include_directories : includes,
install_rpath : rootpkglibdir,
link_with : [libshared],
dependencies : [libm],
dependencies : [libm,
versiondep],
install : true)
endif
@ -3018,7 +3053,8 @@ if conf.get('ENABLE_TIMESYNCD') == 1
include_directories : includes,
link_with : [libtimesyncd_core],
dependencies : [threads,
libm],
libm,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -3052,7 +3088,8 @@ if conf.get('ENABLE_MACHINED') == 1
dependencies : [threads,
libxz,
liblz4,
libzstd],
libzstd,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootbindir)
@ -3064,7 +3101,8 @@ if conf.get('ENABLE_IMPORTD') == 1
systemd_importd_sources,
include_directories : includes,
link_with : [libshared],
dependencies : [threads],
dependencies : [threads,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -3075,12 +3113,12 @@ if conf.get('ENABLE_IMPORTD') == 1
include_directories : includes,
link_with : [libshared,
lib_import_common],
dependencies : [versiondep,
libcurl,
dependencies : [libcurl,
lib_openssl_or_gcrypt,
libz,
libbzip2,
libxz],
libxz,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -3094,7 +3132,8 @@ if conf.get('ENABLE_IMPORTD') == 1
dependencies : [libcurl,
libz,
libbzip2,
libxz],
libxz,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -3118,7 +3157,8 @@ if conf.get('ENABLE_IMPORTD') == 1
dependencies : [libcurl,
libz,
libbzip2,
libxz],
libxz,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -3132,13 +3172,13 @@ if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1
systemd_journal_upload_sources,
include_directories : includes,
link_with : [libshared],
dependencies : [versiondep,
threads,
dependencies : [threads,
libcurl,
libgnutls,
libxz,
liblz4,
libzstd],
libzstd,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -3156,7 +3196,8 @@ if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
libgnutls,
libxz,
liblz4,
libzstd],
libzstd,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -3171,7 +3212,8 @@ if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
libgnutls,
libxz,
liblz4,
libzstd],
libzstd,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -3188,7 +3230,8 @@ if conf.get('ENABLE_COREDUMP') == 1
libacl,
libxz,
liblz4,
libzstd],
libzstd,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -3202,7 +3245,8 @@ if conf.get('ENABLE_COREDUMP') == 1
dependencies : [threads,
libxz,
liblz4,
libzstd],
libzstd,
versiondep],
install_rpath : rootpkglibdir,
install : true)
endif
@ -3217,7 +3261,8 @@ if conf.get('ENABLE_PSTORE') == 1
libacl,
libxz,
liblz4,
libzstd],
libzstd,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -3228,7 +3273,8 @@ if conf.get('ENABLE_OOMD') == 1
systemd_oomd_sources,
include_directories : includes,
link_with : [libshared],
dependencies : [libatomic],
dependencies : [libatomic,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -3238,7 +3284,7 @@ if conf.get('ENABLE_OOMD') == 1
oomctl_sources,
include_directories : includes,
link_with : [libshared],
dependencies : [],
dependencies : [versiondep],
install_rpath : rootpkglibdir,
install : true)
endif
@ -3270,7 +3316,8 @@ if conf.get('ENABLE_SYSUPDATE') == 1
dependencies : [threads,
libblkid,
libfdisk,
libopenssl],
libopenssl,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -3305,7 +3352,8 @@ if conf.get('ENABLE_FIRSTBOOT') == 1
'src/firstboot/firstboot.c',
include_directories : includes,
link_with : [libshared],
dependencies : [libcrypt],
dependencies : [libcrypt,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootbindir)
@ -3316,6 +3364,7 @@ executable(
'src/remount-fs/remount-fs.c',
include_directories : includes,
link_with : [libshared],
dependencies : [versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -3325,6 +3374,7 @@ executable(
'src/machine-id-setup/machine-id-setup-main.c',
include_directories : includes,
link_with : [libshared],
dependencies : [versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootbindir)
@ -3334,23 +3384,27 @@ executable(
'src/fsck/fsck.c',
include_directories : includes,
link_with : [libshared],
dependencies : [versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
executable('systemd-growfs',
'src/partition/growfs.c',
include_directories : includes,
link_with : [libshared],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
executable(
'systemd-growfs',
'src/partition/growfs.c',
include_directories : includes,
link_with : [libshared],
dependencies : [versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
executable(
'systemd-makefs',
'src/partition/makefs.c',
include_directories : includes,
link_with : [libshared],
dependencies : [versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -3360,6 +3414,7 @@ executable(
'src/sleep/sleep.c',
include_directories : includes,
link_with : [libshared],
dependencies : [versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -3374,6 +3429,7 @@ public_programs += executable(
'src/sysctl/sysctl.c',
include_directories : includes,
link_with : [libshared],
dependencies : [versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -3383,6 +3439,7 @@ executable(
'src/ac-power/ac-power.c',
include_directories : includes,
link_with : [libshared],
dependencies : [versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -3392,6 +3449,7 @@ public_programs += executable(
'src/detect-virt/detect-virt.c',
include_directories : includes,
link_with : [libshared],
dependencies : [versiondep],
install_rpath : rootpkglibdir,
install : true)
@ -3400,6 +3458,7 @@ public_programs += executable(
'src/delta/delta.c',
include_directories : includes,
link_with : [libshared],
dependencies : [versiondep],
install_rpath : rootpkglibdir,
install : true)
@ -3408,6 +3467,7 @@ public_programs += executable(
'src/escape/escape.c',
include_directories : includes,
link_with : [libshared],
dependencies : [versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootbindir)
@ -3417,6 +3477,7 @@ public_programs += executable(
'src/notify/notify.c',
include_directories : includes,
link_with : [libshared],
dependencies : [versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootbindir)
@ -3427,7 +3488,8 @@ public_programs += executable(
include_directories : includes,
link_with : [libshared],
dependencies : [threads,
libopenssl],
libopenssl,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootbindir)
@ -3532,7 +3594,8 @@ public_programs += executable(
'src/mount/mount-tool.c',
include_directories : includes,
link_with : [libshared],
dependencies: [libmount],
dependencies: [libmount,
versiondep],
install_rpath : rootpkglibdir,
install : true)
@ -3544,6 +3607,7 @@ public_programs += executable(
'src/run/run.c',
include_directories : includes,
link_with : [libshared],
dependencies : [versiondep],
install_rpath : rootpkglibdir,
install : true)
@ -3552,7 +3616,8 @@ public_programs += executable(
'src/stdio-bridge/stdio-bridge.c',
include_directories : includes,
link_with : [libshared],
dependencies : [versiondep],
dependencies : [versiondep,
versiondep],
install_rpath : rootpkglibdir,
install : true)
@ -3571,6 +3636,7 @@ if enable_sysusers
'src/sysusers/sysusers.c',
include_directories : includes,
link_with : [libshared],
dependencies : [versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootbindir)
@ -3593,6 +3659,7 @@ if enable_sysusers
libbasic,
libbasic_gcrypt,
libsystemd_static],
dependencies : [versiondep],
install : true,
install_dir : rootbindir)
public_programs += exe
@ -3612,7 +3679,8 @@ if conf.get('ENABLE_TMPFILES') == 1
systemd_tmpfiles_sources,
include_directories : includes,
link_with : [libshared],
dependencies : [libacl],
dependencies : [libacl,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootbindir)
@ -3635,7 +3703,8 @@ if conf.get('ENABLE_TMPFILES') == 1
libbasic,
libbasic_gcrypt,
libsystemd_static],
dependencies : [libacl],
dependencies : [libacl,
versiondep],
install : true,
install_dir : rootbindir)
public_programs += exe
@ -3685,7 +3754,8 @@ public_programs += executable(
'src/socket-proxy/socket-proxyd.c',
include_directories : includes,
link_with : [libshared],
dependencies : [threads],
dependencies : [threads,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -3695,12 +3765,12 @@ udevadm = executable(
udevadm_sources,
include_directories : includes,
link_with : [libudevd_core],
dependencies : [versiondep,
threads,
dependencies : [threads,
libkmod,
libidn,
libacl,
libblkid],
libblkid,
versiondep],
install_rpath : udev_rpath,
install : true,
install_dir : rootbindir)
@ -3715,7 +3785,8 @@ if conf.get('ENABLE_REPART') == 1
dependencies : [threads,
libblkid,
libfdisk,
libopenssl],
libopenssl,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootbindir)
@ -3734,7 +3805,8 @@ if conf.get('ENABLE_REPART') == 1
dependencies : [threads,
libblkid,
libfdisk,
libopenssl],
libopenssl,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootbindir)
@ -3746,7 +3818,8 @@ executable(
systemd_shutdown_sources,
include_directories : includes,
link_with : [libshared],
dependencies : [libmount],
dependencies : [libmount,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -3756,6 +3829,7 @@ executable(
'src/update-done/update-done.c',
include_directories : includes,
link_with : [libshared],
dependencies : [versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -3765,7 +3839,8 @@ executable(
'src/update-utmp/update-utmp.c',
include_directories : includes,
link_with : [libshared],
dependencies : [libaudit],
dependencies : [libaudit,
versiondep],
install_rpath : rootpkglibdir,
install : (conf.get('ENABLE_UTMP') == 1),
install_dir : rootlibexecdir)
@ -3776,7 +3851,8 @@ if conf.get('HAVE_KMOD') == 1
'src/modules-load/modules-load.c',
include_directories : includes,
link_with : [libshared],
dependencies : [libkmod],
dependencies : [libkmod,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -3796,7 +3872,8 @@ public_programs += executable(
link_with : [libnspawn_core,
libshared],
dependencies : [libblkid,
libseccomp],
libseccomp,
versiondep],
install_rpath : rootpkglibdir,
install : true)
@ -3808,7 +3885,8 @@ if conf.get('ENABLE_NETWORKD') == 1
link_with : [libnetworkd_core,
libsystemd_network,
networkd_link_with],
dependencies : [threads],
dependencies : [threads,
versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -3818,6 +3896,7 @@ if conf.get('ENABLE_NETWORKD') == 1
systemd_networkd_wait_online_sources,
include_directories : includes,
link_with : [networkd_link_with],
dependencies : [versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -3828,6 +3907,7 @@ if conf.get('ENABLE_NETWORKD') == 1
include_directories : libsystemd_network_includes,
link_with : [libsystemd_network,
networkd_link_with],
dependencies : [versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootbindir)
@ -3838,6 +3918,7 @@ exe = executable(
network_generator_sources,
include_directories : includes,
link_with : [networkd_link_with],
dependencies : [versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -3855,6 +3936,7 @@ executable(
'src/sulogin-shell/sulogin-shell.c',
include_directories : includes,
link_with : [libshared],
dependencies : [versiondep],
install_rpath : rootpkglibdir,
install : true,
install_dir : rootlibexecdir)
@ -4035,7 +4117,8 @@ foreach tuple : fuzzers
sources,
include_directories : [incs, include_directories('src/fuzz')],
link_with : link_with,
dependencies : dependencies,
dependencies : [dependencies,
versiondep],
c_args : defs + test_cflags,
link_args: link_args,
install : false,

View file

@ -2,6 +2,7 @@
#include <getopt.h>
#include "build.h"
#include "main-func.h"
#include "udev-util.h"

View file

@ -9,6 +9,7 @@
#include "sd-daemon.h"
#include "alloc-util.h"
#include "build.h"
#include "env-util.h"
#include "errno-util.h"
#include "escape.h"
@ -23,7 +24,6 @@
#include "string-util.h"
#include "strv.h"
#include "terminal-util.h"
#include "util.h"
static char **arg_listen = NULL;
static bool arg_accept = false;

View file

@ -3,7 +3,7 @@
#include "analyze.h"
#include "analyze-cat-config.h"
#include "conf-files.h"
#include "def.h"
#include "constants.h"
#include "nulstr-util.h"
#include "path-util.h"
#include "pretty-print.h"

View file

@ -37,6 +37,7 @@
#include "analyze-unit-paths.h"
#include "analyze-compare-versions.h"
#include "analyze-verify.h"
#include "build.h"
#include "bus-error.h"
#include "bus-locator.h"
#include "bus-map-properties.h"
@ -46,7 +47,7 @@
#include "capability-util.h"
#include "conf-files.h"
#include "copy.h"
#include "def.h"
#include "constants.h"
#include "exit-status.h"
#include "extract-word.h"
#include "fd-util.h"
@ -79,7 +80,6 @@
#include "time-util.h"
#include "tmpfile-util.h"
#include "unit-name.h"
#include "util.h"
#include "verb-log-control.h"
#include "verbs.h"
#include "version.h"

View file

@ -6,7 +6,8 @@
#include <unistd.h>
#include "ask-password-api.h"
#include "def.h"
#include "build.h"
#include "constants.h"
#include "log.h"
#include "macro.h"
#include "main-func.h"

View file

@ -19,7 +19,6 @@
#include "string-util.h"
#include "strv.h"
#include "terminal-util.h"
#include "util.h"
#define PCI_CLASS_GRAPHICS_CARD 0x30000

View file

@ -4,7 +4,6 @@
#include <endian.h>
#include "macro.h"
#include "util.h"
/* A cleaned up architecture definition. We don't want to get lost in
* processor features, models, generations or even ABIs. Hence we

222
src/basic/argv-util.c Normal file
View file

@ -0,0 +1,222 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <sched.h>
#include <sys/mman.h>
#include <sys/prctl.h>
#include <unistd.h>
#include "argv-util.h"
#include "errno-util.h"
#include "missing_sched.h"
#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "string-util.h"
#include "strv.h"
int saved_argc = 0;
char **saved_argv = NULL;
bool invoked_as(char *argv[], const char *token) {
if (!argv || isempty(argv[0]))
return false;
if (isempty(token))
return false;
return strstr(last_path_component(argv[0]), token);
}
bool invoked_by_systemd(void) {
int r;
/* If the process is directly executed by PID1 (e.g. ExecStart= or generator), systemd-importd,
* or systemd-homed, then $SYSTEMD_EXEC_PID= is set, and read the command line. */
const char *e = getenv("SYSTEMD_EXEC_PID");
if (!e)
return false;
if (streq(e, "*"))
/* For testing. */
return true;
pid_t p;
r = parse_pid(e, &p);
if (r < 0) {
/* We know that systemd sets the variable correctly. Something else must have set it. */
log_debug_errno(r, "Failed to parse \"SYSTEMD_EXEC_PID=%s\", ignoring: %m", e);
return false;
}
return getpid_cached() == p;
}
bool argv_looks_like_help(int argc, char **argv) {
char **l;
/* Scans the command line for indications the user asks for help. This is supposed to be called by
* tools that do not implement getopt() style command line parsing because they are not primarily
* user-facing. Detects four ways of asking for help:
*
* 1. Passing zero arguments
* 2. Passing "help" as first argument
* 3. Passing --help as any argument
* 4. Passing -h as any argument
*/
if (argc <= 1)
return true;
if (streq_ptr(argv[1], "help"))
return true;
l = strv_skip(argv, 1);
return strv_contains(l, "--help") ||
strv_contains(l, "-h");
}
static int update_argv(const char name[], size_t l) {
static int can_do = -1;
if (can_do == 0)
return 0;
can_do = false; /* We'll set it to true only if the whole process works */
/* Let's not bother with this if we don't have euid == 0. Strictly speaking we should check for the
* CAP_SYS_RESOURCE capability which is independent of the euid. In our own code the capability generally is
* present only for euid == 0, hence let's use this as quick bypass check, to avoid calling mmap() if
* PR_SET_MM_ARG_{START,END} fails with EPERM later on anyway. After all geteuid() is dead cheap to call, but
* mmap() is not. */
if (geteuid() != 0)
return log_debug_errno(SYNTHETIC_ERRNO(EPERM),
"Skipping PR_SET_MM, as we don't have privileges.");
static size_t mm_size = 0;
static char *mm = NULL;
int r;
if (mm_size < l+1) {
size_t nn_size;
char *nn;
nn_size = PAGE_ALIGN(l+1);
nn = mmap(NULL, nn_size, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
if (nn == MAP_FAILED)
return log_debug_errno(errno, "mmap() failed: %m");
strncpy(nn, name, nn_size);
/* Now, let's tell the kernel about this new memory */
if (prctl(PR_SET_MM, PR_SET_MM_ARG_START, (unsigned long) nn, 0, 0) < 0) {
if (ERRNO_IS_PRIVILEGE(errno))
return log_debug_errno(errno, "PR_SET_MM_ARG_START failed: %m");
/* HACK: prctl() API is kind of dumb on this point. The existing end address may already be
* below the desired start address, in which case the kernel may have kicked this back due
* to a range-check failure (see linux/kernel/sys.c:validate_prctl_map() to see this in
* action). The proper solution would be to have a prctl() API that could set both start+end
* simultaneously, or at least let us query the existing address to anticipate this condition
* and respond accordingly. For now, we can only guess at the cause of this failure and try
* a workaround--which will briefly expand the arg space to something potentially huge before
* resizing it to what we want. */
log_debug_errno(errno, "PR_SET_MM_ARG_START failed, attempting PR_SET_MM_ARG_END hack: %m");
if (prctl(PR_SET_MM, PR_SET_MM_ARG_END, (unsigned long) nn + l + 1, 0, 0) < 0) {
r = log_debug_errno(errno, "PR_SET_MM_ARG_END hack failed, proceeding without: %m");
(void) munmap(nn, nn_size);
return r;
}
if (prctl(PR_SET_MM, PR_SET_MM_ARG_START, (unsigned long) nn, 0, 0) < 0)
return log_debug_errno(errno, "PR_SET_MM_ARG_START still failed, proceeding without: %m");
} else {
/* And update the end pointer to the new end, too. If this fails, we don't really know what
* to do, it's pretty unlikely that we can rollback, hence we'll just accept the failure,
* and continue. */
if (prctl(PR_SET_MM, PR_SET_MM_ARG_END, (unsigned long) nn + l + 1, 0, 0) < 0)
log_debug_errno(errno, "PR_SET_MM_ARG_END failed, proceeding without: %m");
}
if (mm)
(void) munmap(mm, mm_size);
mm = nn;
mm_size = nn_size;
} else {
strncpy(mm, name, mm_size);
/* Update the end pointer, continuing regardless of any failure. */
if (prctl(PR_SET_MM, PR_SET_MM_ARG_END, (unsigned long) mm + l + 1, 0, 0) < 0)
log_debug_errno(errno, "PR_SET_MM_ARG_END failed, proceeding without: %m");
}
can_do = true;
return 0;
}
int rename_process(const char name[]) {
bool truncated = false;
/* This is a like a poor man's setproctitle(). It changes the comm field, argv[0], and also the glibc's
* internally used name of the process. For the first one a limit of 16 chars applies; to the second one in
* many cases one of 10 (i.e. length of "/sbin/init") however if we have CAP_SYS_RESOURCES it is unbounded;
* to the third one 7 (i.e. the length of "systemd". If you pass a longer string it will likely be
* truncated.
*
* Returns 0 if a name was set but truncated, > 0 if it was set but not truncated. */
if (isempty(name))
return -EINVAL; /* let's not confuse users unnecessarily with an empty name */
if (!is_main_thread())
return -EPERM; /* Let's not allow setting the process name from other threads than the main one, as we
* cache things without locking, and we make assumptions that PR_SET_NAME sets the
* process name that isn't correct on any other threads */
size_t l = strlen(name);
/* First step, change the comm field. The main thread's comm is identical to the process comm. This means we
* can use PR_SET_NAME, which sets the thread name for the calling thread. */
if (prctl(PR_SET_NAME, name) < 0)
log_debug_errno(errno, "PR_SET_NAME failed: %m");
if (l >= TASK_COMM_LEN) /* Linux userspace process names can be 15 chars at max */
truncated = true;
/* Second step, change glibc's ID of the process name. */
if (program_invocation_name) {
size_t k;
k = strlen(program_invocation_name);
strncpy(program_invocation_name, name, k);
if (l > k)
truncated = true;
}
/* Third step, completely replace the argv[] array the kernel maintains for us. This requires privileges, but
* has the advantage that the argv[] array is exactly what we want it to be, and not filled up with zeros at
* the end. This is the best option for changing /proc/self/cmdline. */
(void) update_argv(name, l);
/* Fourth step: in all cases we'll also update the original argv[], so that our own code gets it right too if
* it still looks here */
if (saved_argc > 0) {
if (saved_argv[0]) {
size_t k;
k = strlen(saved_argv[0]);
strncpy(saved_argv[0], name, k);
if (l > k)
truncated = true;
}
for (int i = 1; i < saved_argc; i++) {
if (!saved_argv[i])
break;
memzero(saved_argv[i], strlen(saved_argv[i]));
}
}
return !truncated;
}

25
src/basic/argv-util.h Normal file
View file

@ -0,0 +1,25 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
#include "macro.h"
extern int saved_argc;
extern char **saved_argv;
static inline void save_argc_argv(int argc, char **argv) {
/* Protect against CVE-2021-4034 style attacks */
assert_se(argc > 0);
assert_se(argv);
assert_se(argv[0]);
saved_argc = argc;
saved_argv = argv;
}
bool invoked_as(char *argv[], const char *token);
bool invoked_by_systemd(void);
bool argv_looks_like_help(int argc, char **argv);
int rename_process(const char name[]);

View file

@ -12,7 +12,6 @@
#include "macro.h"
#include "process-util.h"
#include "signal-util.h"
#include "util.h"
int asynchronous_job(void* (*func)(void *p), void *arg) {
sigset_t ss, saved_ss;

View file

@ -1,6 +1,10 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <stdio.h>
#include "build.h"
#include "macro.h"
#include "version.h"
const char* const systemd_features =
@ -226,3 +230,9 @@ const char* const systemd_features =
" default-hierarchy=" DEFAULT_HIERARCHY_NAME
;
int version(void) {
printf("systemd " STRINGIFY(PROJECT_VERSION) " (" GIT_VERSION ")\n%s\n",
systemd_features);
return 0;
}

View file

@ -4,3 +4,5 @@
#include "version.h"
extern const char* const systemd_features;
int version(void);

View file

@ -10,7 +10,6 @@
#include "macro.h"
#include "parse-util.h"
#include "stdio-util.h"
#include "util.h"
static const struct capability_name* lookup_capability(register const char *str, register GPERF_LEN_TYPE len);

View file

@ -11,11 +11,11 @@
#include "cap-list.h"
#include "fileio.h"
#include "log.h"
#include "logarithm.h"
#include "macro.h"
#include "missing_prctl.h"
#include "parse-util.h"
#include "user-util.h"
#include "util.h"
int have_effective_cap(int value) {
_cleanup_cap_free_ cap_t cap = NULL;

View file

@ -8,7 +8,6 @@
#include "macro.h"
#include "missing_capability.h"
#include "util.h"
#define CAP_ALL UINT64_MAX

View file

@ -12,7 +12,7 @@
#include "alloc-util.h"
#include "cgroup-util.h"
#include "def.h"
#include "constants.h"
#include "dirent-util.h"
#include "extract-word.h"
#include "fd-util.h"

View file

@ -9,7 +9,7 @@
#include <sys/statfs.h>
#include <sys/types.h>
#include "def.h"
#include "constants.h"
#include "set.h"
#define SYSTEMD_CGROUP_CONTROLLER_LEGACY "name=systemd"

View file

@ -32,7 +32,6 @@
#include "string-table.h"
#include "string-util.h"
#include "unaligned.h"
#include "util.h"
#if HAVE_LZ4
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(LZ4F_compressionContext_t, LZ4F_freeCompressionContext, NULL);

View file

@ -7,7 +7,7 @@
#include "chase-symlinks.h"
#include "conf-files.h"
#include "def.h"
#include "constants.h"
#include "dirent-util.h"
#include "fd-util.h"
#include "hashmap.h"

View file

@ -1,6 +1,30 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#if !defined(HAS_FEATURE_MEMORY_SANITIZER)
# if defined(__has_feature)
# if __has_feature(memory_sanitizer)
# define HAS_FEATURE_MEMORY_SANITIZER 1
# endif
# endif
# if !defined(HAS_FEATURE_MEMORY_SANITIZER)
# define HAS_FEATURE_MEMORY_SANITIZER 0
# endif
#endif
#if !defined(HAS_FEATURE_ADDRESS_SANITIZER)
# ifdef __SANITIZE_ADDRESS__
# define HAS_FEATURE_ADDRESS_SANITIZER 1
# elif defined(__has_feature)
# if __has_feature(address_sanitizer)
# define HAS_FEATURE_ADDRESS_SANITIZER 1
# endif
# endif
# if !defined(HAS_FEATURE_ADDRESS_SANITIZER)
# define HAS_FEATURE_ADDRESS_SANITIZER 0
# endif
#endif
#define DEFAULT_TIMEOUT_USEC (90*USEC_PER_SEC)
#define DEFAULT_RESTART_USEC (100*USEC_PER_MSEC)
#define DEFAULT_CONFIRM_USEC (30*USEC_PER_SEC)

View file

@ -29,7 +29,6 @@
#include "stat-util.h"
#include "stdio-util.h"
#include "tmpfile-util.h"
#include "util.h"
/* The maximum number of iterations in the loop to close descriptors in the fallback case
* when /proc/self/fd/ is inaccessible. */

View file

@ -27,7 +27,7 @@ int fs_type_from_string(const char *name, const statfs_f_type_t **ret) {
return 0;
}
int fs_in_group(const struct statfs *s, FilesystemGroups fs_group) {
bool fs_in_group(const struct statfs *s, FilesystemGroups fs_group) {
const char *fs;
int r;
@ -35,7 +35,7 @@ int fs_in_group(const struct statfs *s, FilesystemGroups fs_group) {
const statfs_f_type_t *magic;
r = fs_type_from_string(fs, &magic);
if (r == 0) {
if (r >= 0)
for (size_t i = 0; i < FILESYSTEM_MAGIC_MAX; i++) {
if (magic[i] == 0)
break;
@ -43,7 +43,6 @@ int fs_in_group(const struct statfs *s, FilesystemGroups fs_group) {
if (is_fs_type(s, magic[i]))
return true;
}
}
}
return false;

View file

@ -36,7 +36,7 @@ const FilesystemSet *filesystem_set_find(const char *name);
const char *fs_type_to_string(statfs_f_type_t magic);
int fs_type_from_string(const char *name, const statfs_f_type_t **ret);
int fs_in_group(const struct statfs *s, enum FilesystemGroups fs_group);
bool fs_in_group(const struct statfs *s, enum FilesystemGroups fs_group);
/* gperf prototypes */
const struct FilesystemMagic* filesystems_gperf_lookup(const char *key, GPERF_LEN_TYPE length);

View file

@ -32,7 +32,6 @@
#include "tmpfile-util.h"
#include "umask-util.h"
#include "user-util.h"
#include "util.h"
int unlink_noerrno(const char *path) {
PROTECT_ERRNO;

View file

@ -9,6 +9,7 @@
#include "alloc-util.h"
#include "fileio.h"
#include "hashmap.h"
#include "logarithm.h"
#include "macro.h"
#include "memory-util.h"
#include "mempool.h"

View file

@ -7,7 +7,6 @@
#include "hash-funcs.h"
#include "macro.h"
#include "util.h"
/*
* A hash table implementation. As a minor optimization a NULL hashmap object

View file

@ -11,13 +11,13 @@
#include "alloc-util.h"
#include "errno-util.h"
#include "in-addr-util.h"
#include "logarithm.h"
#include "macro.h"
#include "parse-util.h"
#include "random-util.h"
#include "stdio-util.h"
#include "string-util.h"
#include "strxcpyx.h"
#include "util.h"
bool in4_addr_is_null(const struct in_addr *a) {
assert(a);

View file

@ -8,7 +8,6 @@
#include "hash-funcs.h"
#include "macro.h"
#include "util.h"
union in_addr_union {
struct in_addr in;

View file

@ -1,46 +1,15 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <unistd.h>
#include "alloc-util.h"
#include "build.h"
#include "env-file.h"
#include "env-util.h"
#include "fd-util.h"
#include "fileio.h"
#include "hostname-util.h"
#include "log.h"
#include "macro.h"
#include "initrd-util.h"
#include "parse-util.h"
#include "stat-util.h"
#include "string-util.h"
#include "util.h"
#include "virt.h"
int saved_argc = 0;
char **saved_argv = NULL;
static int saved_in_initrd = -1;
int prot_from_flags(int flags) {
switch (flags & O_ACCMODE) {
case O_RDONLY:
return PROT_READ;
case O_WRONLY:
return PROT_WRITE;
case O_RDWR:
return PROT_READ|PROT_WRITE;
default:
return -EINVAL;
}
}
bool in_initrd(void) {
int r;
const char *e;
@ -104,62 +73,3 @@ bool in_initrd(void) {
void in_initrd_force(bool value) {
saved_in_initrd = value;
}
int container_get_leader(const char *machine, pid_t *pid) {
_cleanup_free_ char *s = NULL, *class = NULL;
const char *p;
pid_t leader;
int r;
assert(machine);
assert(pid);
if (streq(machine, ".host")) {
*pid = 1;
return 0;
}
if (!hostname_is_valid(machine, 0))
return -EINVAL;
p = strjoina("/run/systemd/machines/", machine);
r = parse_env_file(NULL, p,
"LEADER", &s,
"CLASS", &class);
if (r == -ENOENT)
return -EHOSTDOWN;
if (r < 0)
return r;
if (!s)
return -EIO;
if (!streq_ptr(class, "container"))
return -EIO;
r = parse_pid(s, &leader);
if (r < 0)
return r;
if (leader <= 1)
return -EIO;
*pid = leader;
return 0;
}
int version(void) {
printf("systemd " STRINGIFY(PROJECT_VERSION) " (" GIT_VERSION ")\n%s\n",
systemd_features);
return 0;
}
/* Turn off core dumps but only if we're running outside of a container. */
void disable_coredumps(void) {
int r;
if (detect_container() > 0)
return;
r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", WRITE_STRING_FILE_DISABLE_BUFFER);
if (r < 0)
log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m");
}

7
src/basic/initrd-util.h Normal file
View file

@ -0,0 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include <stdbool.h>
bool in_initrd(void);
void in_initrd_force(bool value);

View file

@ -10,7 +10,7 @@
#include <sys/mman.h>
#include <sys/stat.h>
#include "def.h"
#include "constants.h"
#include "dirent-util.h"
#include "env-util.h"
#include "fd-util.h"

View file

@ -16,6 +16,7 @@
#include "sd-messages.h"
#include "alloc-util.h"
#include "argv-util.h"
#include "errno-util.h"
#include "fd-util.h"
#include "format-util.h"

View file

@ -5,25 +5,6 @@
#include "macro.h"
extern int saved_argc;
extern char **saved_argv;
static inline void save_argc_argv(int argc, char **argv) {
/* Protect against CVE-2021-4034 style attacks */
assert_se(argc > 0);
assert_se(argv);
assert_se(argv[0]);
saved_argc = argc;
saved_argv = argv;
}
int prot_from_flags(int flags) _const_;
bool in_initrd(void);
void in_initrd_force(bool value);
/* Note: log2(0) == log2(1) == 0 here and below. */
#define CONST_LOG2ULL(x) ((x) > 1 ? (unsigned) __builtin_clzll(x) ^ 63U : 0)
@ -70,9 +51,3 @@ static inline unsigned log2u_round_up(unsigned x) {
return log2u(x - 1) + 1;
}
int container_get_leader(const char *machine, pid_t *pid);
int version(void);
void disable_coredumps(void);

View file

@ -9,32 +9,9 @@
#include <sys/sysmacros.h>
#include <sys/types.h>
#include "constants.h"
#include "macro-fundamental.h"
#if !defined(HAS_FEATURE_MEMORY_SANITIZER)
# if defined(__has_feature)
# if __has_feature(memory_sanitizer)
# define HAS_FEATURE_MEMORY_SANITIZER 1
# endif
# endif
# if !defined(HAS_FEATURE_MEMORY_SANITIZER)
# define HAS_FEATURE_MEMORY_SANITIZER 0
# endif
#endif
#if !defined(HAS_FEATURE_ADDRESS_SANITIZER)
# ifdef __SANITIZE_ADDRESS__
# define HAS_FEATURE_ADDRESS_SANITIZER 1
# elif defined(__has_feature)
# if __has_feature(address_sanitizer)
# define HAS_FEATURE_ADDRESS_SANITIZER 1
# endif
# endif
# if !defined(HAS_FEATURE_ADDRESS_SANITIZER)
# define HAS_FEATURE_ADDRESS_SANITIZER 0
# endif
#endif
/* Note: on GCC "no_sanitize_address" is a function attribute only, on llvm it may also be applied to global
* variables. We define a specific macro which knows this. Note that on GCC we don't need this decorator so much, since
* our primary usecase for this attribute is registration structures placed in named ELF sections which shall not be

View file

@ -9,6 +9,8 @@ basic_sources = files(
'alloc-util.h',
'architecture.c',
'architecture.h',
'argv-util.c',
'argv-util.h',
'arphrd-util.c',
'arphrd-util.h',
'async.c',
@ -31,7 +33,7 @@ basic_sources = files(
'chattr-util.h',
'conf-files.c',
'conf-files.h',
'def.h',
'constants.h',
'devnum-util.c',
'devnum-util.h',
'dirent-util.c',
@ -80,6 +82,8 @@ basic_sources = files(
'hostname-util.h',
'in-addr-util.c',
'in-addr-util.h',
'initrd-util.c',
'initrd-util.h',
'inotify-util.c',
'inotify-util.h',
'io-util.c',
@ -126,6 +130,7 @@ basic_sources = files(
'locale-util.h',
'log.c',
'log.h',
'logarithm.h',
'login-util.c',
'login-util.h',
'macro.h',
@ -254,8 +259,6 @@ basic_sources = files(
'user-util.h',
'utf8.c',
'utf8.h',
'util.c',
'util.h',
'virt.c',
'virt.h',
'xattr-util.c',

View file

@ -3,7 +3,7 @@
#include <stdbool.h>
#include "def.h"
#include "constants.h"
#include "macro.h"
typedef enum LookupPathsFlags {

View file

@ -7,13 +7,13 @@
#include "efivars.h"
#include "extract-word.h"
#include "fileio.h"
#include "initrd-util.h"
#include "macro.h"
#include "parse-util.h"
#include "proc-cmdline.h"
#include "process-util.h"
#include "special.h"
#include "string-util.h"
#include "util.h"
#include "virt.h"
int proc_cmdline(char **ret) {

View file

@ -8,7 +8,6 @@
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/mount.h>
#include <sys/personality.h>
#include <sys/prctl.h>
@ -22,12 +21,15 @@
#include "alloc-util.h"
#include "architecture.h"
#include "argv-util.h"
#include "env-file.h"
#include "env-util.h"
#include "errno-util.h"
#include "escape.h"
#include "fd-util.h"
#include "fileio.h"
#include "fs-util.h"
#include "hostname-util.h"
#include "locale-util.h"
#include "log.h"
#include "macro.h"
@ -35,6 +37,7 @@
#include "missing_sched.h"
#include "missing_syscall.h"
#include "namespace-util.h"
#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "raw-clone.h"
@ -253,151 +256,47 @@ int get_process_cmdline(pid_t pid, size_t max_columns, ProcessCmdlineFlags flags
return 0;
}
static int update_argv(const char name[], size_t l) {
static int can_do = -1;
if (can_do == 0)
return 0;
can_do = false; /* We'll set it to true only if the whole process works */
/* Let's not bother with this if we don't have euid == 0. Strictly speaking we should check for the
* CAP_SYS_RESOURCE capability which is independent of the euid. In our own code the capability generally is
* present only for euid == 0, hence let's use this as quick bypass check, to avoid calling mmap() if
* PR_SET_MM_ARG_{START,END} fails with EPERM later on anyway. After all geteuid() is dead cheap to call, but
* mmap() is not. */
if (geteuid() != 0)
return log_debug_errno(SYNTHETIC_ERRNO(EPERM),
"Skipping PR_SET_MM, as we don't have privileges.");
static size_t mm_size = 0;
static char *mm = NULL;
int container_get_leader(const char *machine, pid_t *pid) {
_cleanup_free_ char *s = NULL, *class = NULL;
const char *p;
pid_t leader;
int r;
if (mm_size < l+1) {
size_t nn_size;
char *nn;
assert(machine);
assert(pid);
nn_size = PAGE_ALIGN(l+1);
nn = mmap(NULL, nn_size, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
if (nn == MAP_FAILED)
return log_debug_errno(errno, "mmap() failed: %m");
strncpy(nn, name, nn_size);
/* Now, let's tell the kernel about this new memory */
if (prctl(PR_SET_MM, PR_SET_MM_ARG_START, (unsigned long) nn, 0, 0) < 0) {
if (ERRNO_IS_PRIVILEGE(errno))
return log_debug_errno(errno, "PR_SET_MM_ARG_START failed: %m");
/* HACK: prctl() API is kind of dumb on this point. The existing end address may already be
* below the desired start address, in which case the kernel may have kicked this back due
* to a range-check failure (see linux/kernel/sys.c:validate_prctl_map() to see this in
* action). The proper solution would be to have a prctl() API that could set both start+end
* simultaneously, or at least let us query the existing address to anticipate this condition
* and respond accordingly. For now, we can only guess at the cause of this failure and try
* a workaround--which will briefly expand the arg space to something potentially huge before
* resizing it to what we want. */
log_debug_errno(errno, "PR_SET_MM_ARG_START failed, attempting PR_SET_MM_ARG_END hack: %m");
if (prctl(PR_SET_MM, PR_SET_MM_ARG_END, (unsigned long) nn + l + 1, 0, 0) < 0) {
r = log_debug_errno(errno, "PR_SET_MM_ARG_END hack failed, proceeding without: %m");
(void) munmap(nn, nn_size);
return r;
}
if (prctl(PR_SET_MM, PR_SET_MM_ARG_START, (unsigned long) nn, 0, 0) < 0)
return log_debug_errno(errno, "PR_SET_MM_ARG_START still failed, proceeding without: %m");
} else {
/* And update the end pointer to the new end, too. If this fails, we don't really know what
* to do, it's pretty unlikely that we can rollback, hence we'll just accept the failure,
* and continue. */
if (prctl(PR_SET_MM, PR_SET_MM_ARG_END, (unsigned long) nn + l + 1, 0, 0) < 0)
log_debug_errno(errno, "PR_SET_MM_ARG_END failed, proceeding without: %m");
}
if (mm)
(void) munmap(mm, mm_size);
mm = nn;
mm_size = nn_size;
} else {
strncpy(mm, name, mm_size);
/* Update the end pointer, continuing regardless of any failure. */
if (prctl(PR_SET_MM, PR_SET_MM_ARG_END, (unsigned long) mm + l + 1, 0, 0) < 0)
log_debug_errno(errno, "PR_SET_MM_ARG_END failed, proceeding without: %m");
if (streq(machine, ".host")) {
*pid = 1;
return 0;
}
can_do = true;
if (!hostname_is_valid(machine, 0))
return -EINVAL;
p = strjoina("/run/systemd/machines/", machine);
r = parse_env_file(NULL, p,
"LEADER", &s,
"CLASS", &class);
if (r == -ENOENT)
return -EHOSTDOWN;
if (r < 0)
return r;
if (!s)
return -EIO;
if (!streq_ptr(class, "container"))
return -EIO;
r = parse_pid(s, &leader);
if (r < 0)
return r;
if (leader <= 1)
return -EIO;
*pid = leader;
return 0;
}
int rename_process(const char name[]) {
bool truncated = false;
/* This is a like a poor man's setproctitle(). It changes the comm field, argv[0], and also the glibc's
* internally used name of the process. For the first one a limit of 16 chars applies; to the second one in
* many cases one of 10 (i.e. length of "/sbin/init") however if we have CAP_SYS_RESOURCES it is unbounded;
* to the third one 7 (i.e. the length of "systemd". If you pass a longer string it will likely be
* truncated.
*
* Returns 0 if a name was set but truncated, > 0 if it was set but not truncated. */
if (isempty(name))
return -EINVAL; /* let's not confuse users unnecessarily with an empty name */
if (!is_main_thread())
return -EPERM; /* Let's not allow setting the process name from other threads than the main one, as we
* cache things without locking, and we make assumptions that PR_SET_NAME sets the
* process name that isn't correct on any other threads */
size_t l = strlen(name);
/* First step, change the comm field. The main thread's comm is identical to the process comm. This means we
* can use PR_SET_NAME, which sets the thread name for the calling thread. */
if (prctl(PR_SET_NAME, name) < 0)
log_debug_errno(errno, "PR_SET_NAME failed: %m");
if (l >= TASK_COMM_LEN) /* Linux userspace process names can be 15 chars at max */
truncated = true;
/* Second step, change glibc's ID of the process name. */
if (program_invocation_name) {
size_t k;
k = strlen(program_invocation_name);
strncpy(program_invocation_name, name, k);
if (l > k)
truncated = true;
}
/* Third step, completely replace the argv[] array the kernel maintains for us. This requires privileges, but
* has the advantage that the argv[] array is exactly what we want it to be, and not filled up with zeros at
* the end. This is the best option for changing /proc/self/cmdline. */
(void) update_argv(name, l);
/* Fourth step: in all cases we'll also update the original argv[], so that our own code gets it right too if
* it still looks here */
if (saved_argc > 0) {
if (saved_argv[0]) {
size_t k;
k = strlen(saved_argv[0]);
strncpy(saved_argv[0], name, k);
if (l > k)
truncated = true;
}
for (int i = 1; i < saved_argc; i++) {
if (!saved_argv[i])
break;
memzero(saved_argv[i], strlen(saved_argv[i]));
}
}
return !truncated;
}
int is_kernel_thread(pid_t pid) {
_cleanup_free_ char *line = NULL;
unsigned long long flags;
@ -1583,40 +1482,6 @@ int setpriority_closest(int priority) {
return 0;
}
bool invoked_as(char *argv[], const char *token) {
if (!argv || isempty(argv[0]))
return false;
if (isempty(token))
return false;
return strstr(last_path_component(argv[0]), token);
}
bool invoked_by_systemd(void) {
int r;
/* If the process is directly executed by PID1 (e.g. ExecStart= or generator), systemd-importd,
* or systemd-homed, then $SYSTEMD_EXEC_PID= is set, and read the command line. */
const char *e = getenv("SYSTEMD_EXEC_PID");
if (!e)
return false;
if (streq(e, "*"))
/* For testing. */
return true;
pid_t p;
r = parse_pid(e, &p);
if (r < 0) {
/* We know that systemd sets the variable correctly. Something else must have set it. */
log_debug_errno(r, "Failed to parse \"SYSTEMD_EXEC_PID=%s\", ignoring: %m", e);
return false;
}
return getpid_cached() == p;
}
_noreturn_ void freeze(void) {
log_close();
@ -1638,31 +1503,6 @@ _noreturn_ void freeze(void) {
pause();
}
bool argv_looks_like_help(int argc, char **argv) {
char **l;
/* Scans the command line for indications the user asks for help. This is supposed to be called by
* tools that do not implement getopt() style command line parsing because they are not primarily
* user-facing. Detects four ways of asking for help:
*
* 1. Passing zero arguments
* 2. Passing "help" as first argument
* 3. Passing --help as any argument
* 4. Passing -h as any argument
*/
if (argc <= 1)
return true;
if (streq_ptr(argv[1], "help"))
return true;
l = strv_skip(argv, 1);
return strv_contains(l, "--help") ||
strv_contains(l, "-h");
}
static const char *const sigchld_code_table[] = {
[CLD_EXITED] = "exited",
[CLD_KILLED] = "killed",

View file

@ -50,6 +50,8 @@ int get_process_environ(pid_t pid, char **ret);
int get_process_ppid(pid_t pid, pid_t *ret);
int get_process_umask(pid_t pid, mode_t *ret);
int container_get_leader(const char *machine, pid_t *pid);
int wait_for_terminate(pid_t pid, siginfo_t *status);
typedef enum WaitFlags {
@ -69,7 +71,6 @@ void sigterm_wait(pid_t pid);
int kill_and_sigcont(pid_t pid, int sig);
int rename_process(const char name[]);
int is_kernel_thread(pid_t pid);
int getenv_for_pid(pid_t pid, const char *field, char **_value);
@ -189,10 +190,4 @@ int pidfd_get_pid(int fd, pid_t *ret);
int setpriority_closest(int priority);
bool invoked_as(char *argv[], const char *token);
bool invoked_by_systemd(void);
_noreturn_ void freeze(void);
bool argv_looks_like_help(int argc, char **argv);

View file

@ -4,7 +4,7 @@
#include <unistd.h>
#include "alloc-util.h"
#include "def.h"
#include "constants.h"
#include "fd-util.h"
#include "fileio.h"
#include "parse-util.h"

View file

@ -11,6 +11,7 @@
#include "log.h"
#include "macro.h"
#include "process-util.h"
/**
* raw_clone() - uses clone to create a new process with clone flags

View file

@ -18,7 +18,6 @@
#include "strv.h"
#include "terminal-util.h"
#include "utf8.h"
#include "util.h"
char* first_word(const char *s, const char *word) {
size_t sl, wl;

View file

@ -21,7 +21,7 @@
#include <unistd.h>
#include "alloc-util.h"
#include "def.h"
#include "constants.h"
#include "devnum-util.h"
#include "env-util.h"
#include "fd-util.h"
@ -44,7 +44,6 @@
#include "terminal-util.h"
#include "time-util.h"
#include "user-util.h"
#include "util.h"
static volatile unsigned cached_columns = 0;
static volatile unsigned cached_lines = 0;

View file

@ -6,6 +6,7 @@
#include "dirent-util.h"
#include "fd-util.h"
#include "fs-util.h"
#include "initrd-util.h"
#include "macro.h"
#include "path-lookup.h"
#include "set.h"

View file

@ -11,8 +11,9 @@
#include "alloc-util.h"
#include "binfmt-util.h"
#include "build.h"
#include "conf-files.h"
#include "def.h"
#include "constants.h"
#include "fd-util.h"
#include "fileio.h"
#include "log.h"

View file

@ -5,6 +5,7 @@
#include "efi-loader.h"
#include "generator.h"
#include "initrd-util.h"
#include "log.h"
#include "mkdir.h"
#include "special.h"

View file

@ -5,6 +5,7 @@
#include "alloc-util.h"
#include "bootspec.h"
#include "build.h"
#include "devnum-util.h"
#include "efi-api.h"
#include "efi-loader.h"
@ -19,7 +20,6 @@
#include "pretty-print.h"
#include "sync-util.h"
#include "terminal-util.h"
#include "util.h"
#include "verbs.h"
#include "virt.h"

View file

@ -8,12 +8,12 @@
#include "sd-bus.h"
#include "alloc-util.h"
#include "build.h"
#include "bus-error.h"
#include "log.h"
#include "main-func.h"
#include "pretty-print.h"
#include "terminal-util.h"
#include "util.h"
static int help(void) {
_cleanup_free_ char *link = NULL;

View file

@ -15,6 +15,7 @@
#include "alloc-util.h"
#include "blkid-util.h"
#include "bootspec.h"
#include "build.h"
#include "chase-symlinks.h"
#include "copy.h"
#include "devnum-util.h"
@ -53,7 +54,6 @@
#include "tpm2-util.h"
#include "umask-util.h"
#include "utf8.h"
#include "util.h"
#include "verbs.h"
#include "virt.h"

View file

@ -4,6 +4,7 @@
#include <unistd.h>
#include "alloc-util.h"
#include "build.h"
#include "efi-loader.h"
#include "fd-util.h"
#include "fileio.h"

View file

@ -4,6 +4,7 @@
#include <sd-messages.h>
#include "build.h"
#include "efivars.h"
#include "main-func.h"
#include "openssl-util.h"

View file

@ -6,7 +6,6 @@
#include "busctl-introspect.h"
#include "path-util.h"
#include "string-util.h"
#include "util.h"
#include "xml.h"
#define NODE_DEPTH_MAX 16

View file

@ -5,6 +5,7 @@
#include "sd-bus.h"
#include "alloc-util.h"
#include "build.h"
#include "bus-dump.h"
#include "bus-internal.h"
#include "bus-message.h"

View file

@ -8,6 +8,7 @@
#include "sd-bus.h"
#include "alloc-util.h"
#include "build.h"
#include "bus-util.h"
#include "cgroup-show.h"
#include "cgroup-util.h"
@ -21,7 +22,6 @@
#include "pretty-print.h"
#include "strv.h"
#include "unit-name.h"
#include "util.h"
static PagerFlags arg_pager_flags = 0;
static OutputFlags arg_output_flags = OUTPUT_CGROUP_XATTRS | OUTPUT_CGROUP_ID;

View file

@ -10,6 +10,7 @@
#include "sd-bus.h"
#include "alloc-util.h"
#include "build.h"
#include "bus-error.h"
#include "bus-util.h"
#include "cgroup-show.h"

View file

@ -12,7 +12,6 @@
#include "capability-util.h"
#include "fd-util.h"
#include "log.h"
#include "util.h"
static bool initialized = false;
static int audit_fd;

View file

@ -3,6 +3,7 @@
#include "bpf-dlopen.h"
#include "bpf-util.h"
#include "cgroup-util.h"
#include "initrd-util.h"
#include "log.h"
bool cgroup_bpf_supported(void) {

View file

@ -39,6 +39,7 @@
#if HAVE_APPARMOR
#include "apparmor-util.h"
#endif
#include "argv-util.h"
#include "async.h"
#include "barrier.h"
#include "bpf-lsm.h"
@ -47,10 +48,10 @@
#include "cgroup-setup.h"
#include "chase-symlinks.h"
#include "chown-recursive.h"
#include "constants.h"
#include "cpu-set-util.h"
#include "creds-util.h"
#include "data-fd-util.h"
#include "def.h"
#include "env-file.h"
#include "env-util.h"
#include "errno-list.h"

View file

@ -9,6 +9,7 @@
#include "format-util.h"
#include "fs-util.h"
#include "hexdecoct.h"
#include "initrd-util.h"
#include "import-creds.h"
#include "io-util.h"
#include "mkdir-label.h"

View file

@ -3,7 +3,6 @@
#include "kill.h"
#include "signal-util.h"
#include "string-table.h"
#include "util.h"
void kill_context_init(KillContext *c) {
assert(c);

View file

@ -22,6 +22,7 @@
#include "alloc-util.h"
#include "apparmor-setup.h"
#include "architecture.h"
#include "argv-util.h"
#if HAVE_LIBBPF
#include "bpf-lsm.h"
#endif
@ -36,7 +37,7 @@
#include "crash-handler.h"
#include "dbus-manager.h"
#include "dbus.h"
#include "def.h"
#include "constants.h"
#include "dev-setup.h"
#include "efi-random.h"
#include "efivars.h"
@ -52,6 +53,7 @@
#include "hostname-setup.h"
#include "ima-setup.h"
#include "import-creds.h"
#include "initrd-util.h"
#include "killall.h"
#include "kmod-setup.h"
#include "limits-util.h"
@ -92,7 +94,6 @@
#include "time-util.h"
#include "umask-util.h"
#include "user-util.h"
#include "util.h"
#include "virt.h"
#include "watchdog.h"

View file

@ -6,6 +6,7 @@
#include "fd-util.h"
#include "fileio.h"
#include "format-util.h"
#include "initrd-util.h"
#include "macro.h"
#include "manager-serialize.h"
#include "manager.h"

View file

@ -30,13 +30,13 @@
#include "bus-util.h"
#include "clean-ipc.h"
#include "clock-util.h"
#include "constants.h"
#include "core-varlink.h"
#include "creds-util.h"
#include "dbus-job.h"
#include "dbus-manager.h"
#include "dbus-unit.h"
#include "dbus.h"
#include "def.h"
#include "dirent-util.h"
#include "env-util.h"
#include "escape.h"
@ -48,6 +48,7 @@
#include "fileio.h"
#include "generator-setup.h"
#include "hashmap.h"
#include "initrd-util.h"
#include "inotify-util.h"
#include "install.h"
#include "io-util.h"

View file

@ -14,6 +14,7 @@
#include "exit-status.h"
#include "format-util.h"
#include "fstab-util.h"
#include "initrd-util.h"
#include "libmount-util.h"
#include "log.h"
#include "manager.h"

View file

@ -23,7 +23,6 @@
#include "selinux-util.h"
#include "stdio-util.h"
#include "strv.h"
#include "util.h"
static bool initialized = false;

View file

@ -8,13 +8,13 @@
#include <selinux/selinux.h>
#endif
#include "initrd-util.h"
#include "log.h"
#include "macro.h"
#include "selinux-setup.h"
#include "selinux-util.h"
#include "string-util.h"
#include "time-util.h"
#include "util.h"
#if HAVE_SELINUX
_printf_(2,3)

View file

@ -13,9 +13,9 @@
#include "bus-kernel.h"
#include "bus-util.h"
#include "chase-symlinks.h"
#include "constants.h"
#include "dbus-service.h"
#include "dbus-unit.h"
#include "def.h"
#include "env-util.h"
#include "escape.h"
#include "exit-status.h"
@ -41,7 +41,6 @@
#include "unit-name.h"
#include "unit.h"
#include "utf8.h"
#include "util.h"
#define service_spawn(...) service_spawn_internal(__func__, __VA_ARGS__)

View file

@ -12,7 +12,6 @@
#include "string-table.h"
#include "string-util.h"
#include "terminal-util.h"
#include "util.h"
static const char* const show_status_table[_SHOW_STATUS_MAX] = {
[SHOW_STATUS_NO] = "no",

View file

@ -19,7 +19,6 @@
#include "macro.h"
#include "smack-setup.h"
#include "string-util.h"
#include "util.h"
#if ENABLE_SMACK

View file

@ -15,10 +15,10 @@
#include "bus-error.h"
#include "bus-util.h"
#include "chase-symlinks.h"
#include "constants.h"
#include "copy.h"
#include "dbus-socket.h"
#include "dbus-unit.h"
#include "def.h"
#include "errno-list.h"
#include "exit-status.h"
#include "fd-util.h"

View file

@ -20,6 +20,7 @@
#include "compress.h"
#include "conf-parser.h"
#include "copy.h"
#include "coredump-util.h"
#include "coredump-vacuum.h"
#include "dirent-util.h"
#include "elf-util.h"

View file

@ -11,12 +11,13 @@
#include "sd-messages.h"
#include "alloc-util.h"
#include "build.h"
#include "bus-error.h"
#include "bus-locator.h"
#include "bus-util.h"
#include "chase-symlinks.h"
#include "compress.h"
#include "def.h"
#include "constants.h"
#include "dissect-image.h"
#include "fd-util.h"
#include "format-table.h"
@ -42,7 +43,6 @@
#include "terminal-util.h"
#include "tmpfile-util.h"
#include "user-util.h"
#include "util.h"
#include "verbs.h"
#define SHORT_BUS_CALL_TIMEOUT_USEC (3 * USEC_PER_SEC)

View file

@ -3,6 +3,7 @@
#include <getopt.h>
#include <unistd.h>
#include "build.h"
#include "creds-util.h"
#include "dirent-util.h"
#include "escape.h"

View file

@ -3,6 +3,7 @@
#include <getopt.h>
#include "ask-password-api.h"
#include "build.h"
#include "cryptenroll-fido2.h"
#include "cryptenroll-list.h"
#include "cryptenroll-password.h"

View file

@ -23,7 +23,6 @@
#include "string-util.h"
#include "strv.h"
#include "unit-name.h"
#include "util.h"
typedef struct crypto_device {
char *uuid;

View file

@ -5,6 +5,7 @@
#include "alloc-util.h"
#include "dropin.h"
#include "generator.h"
#include "initrd-util.h"
#include "mkdir-label.h"
#include "parse-util.h"
#include "path-util.h"

View file

@ -6,6 +6,7 @@
#include <unistd.h>
#include "alloc-util.h"
#include "build.h"
#include "chase-symlinks.h"
#include "dirent-util.h"
#include "fd-util.h"

View file

@ -6,10 +6,10 @@
#include <stdlib.h>
#include "alloc-util.h"
#include "build.h"
#include "main-func.h"
#include "pretty-print.h"
#include "string-table.h"
#include "util.h"
#include "virt.h"
static bool arg_quiet = false;

View file

@ -12,6 +12,7 @@
#include "architecture.h"
#include "blockdev-util.h"
#include "build.h"
#include "chase-symlinks.h"
#include "copy.h"
#include "device-util.h"
@ -42,7 +43,6 @@
#include "terminal-util.h"
#include "tmpfile-util.h"
#include "user-util.h"
#include "util.h"
static enum {
ACTION_DISSECT,

View file

@ -3,7 +3,7 @@
#include "sd-path.h"
#include "conf-files.h"
#include "def.h"
#include "constants.h"
#include "env-file.h"
#include "escape.h"
#include "glyph-util.h"

View file

@ -5,6 +5,7 @@
#include <stdlib.h>
#include "alloc-util.h"
#include "build.h"
#include "log.h"
#include "main-func.h"
#include "path-util.h"

View file

@ -9,6 +9,7 @@
#include "alloc-util.h"
#include "ask-password-api.h"
#include "build.h"
#include "chase-symlinks.h"
#include "copy.h"
#include "creds-util.h"

View file

@ -32,7 +32,6 @@
#include "socket-util.h"
#include "special.h"
#include "stdio-util.h"
#include "util.h"
static bool arg_skip = false;
static bool arg_force = false;

View file

@ -13,6 +13,7 @@
#include "fstab-util.h"
#include "generator.h"
#include "in-addr-util.h"
#include "initrd-util.h"
#include "log.h"
#include "main-func.h"
#include "mkdir.h"
@ -29,7 +30,6 @@
#include "string-util.h"
#include "strv.h"
#include "unit-name.h"
#include "util.h"
#include "virt.h"
#include "volatile-util.h"

View file

@ -4,7 +4,6 @@
#include "fd-util.h"
#include "fuzz.h"
#include "time-util.h"
#include "util.h"
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
_cleanup_free_ char *str = NULL;

View file

@ -18,7 +18,6 @@
#include "strv.h"
#include "terminal-util.h"
#include "unit-name.h"
#include "util.h"
#include "virt.h"
static const char *arg_dest = NULL;

View file

@ -23,6 +23,7 @@
#include "fstab-util.h"
#include "generator.h"
#include "gpt.h"
#include "initrd-util.h"
#include "mkdir.h"
#include "mountpoint-util.h"
#include "parse-util.h"
@ -34,7 +35,6 @@
#include "string-util.h"
#include "strv.h"
#include "unit-name.h"
#include "util.h"
#include "virt.h"
static const char *arg_dest = NULL;

View file

@ -8,6 +8,7 @@
#include "dropin.h"
#include "fstab-util.h"
#include "generator.h"
#include "initrd-util.h"
#include "log.h"
#include "main-func.h"
#include "mkdir-label.h"

View file

@ -7,8 +7,8 @@
#include "alloc-util.h"
#include "devnum-util.h"
#include "fileio.h"
#include "initrd-util.h"
#include "log.h"
#include "util.h"
int main(int argc, char *argv[]) {
struct stat st;

View file

@ -5,6 +5,7 @@
#include "sd-bus.h"
#include "ask-password-api.h"
#include "build.h"
#include "bus-common-errors.h"
#include "bus-error.h"
#include "bus-locator.h"

View file

@ -1,7 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "conf-parser.h"
#include "def.h"
#include "constants.h"
#include "home-util.h"
#include "homed-conf.h"

View file

@ -11,6 +11,7 @@
#include "alloc-util.h"
#include "architecture.h"
#include "build.h"
#include "bus-common-errors.h"
#include "bus-error.h"
#include "bus-map-properties.h"
@ -23,7 +24,6 @@
#include "pretty-print.h"
#include "spawn-polkit-agent.h"
#include "terminal-util.h"
#include "util.h"
#include "verbs.h"
static bool arg_ask_password = true;

View file

@ -11,7 +11,7 @@
#include "bus-get-properties.h"
#include "bus-log-control-api.h"
#include "bus-polkit.h"
#include "def.h"
#include "constants.h"
#include "env-file-label.h"
#include "env-file.h"
#include "env-util.h"
@ -36,7 +36,6 @@
#include "string-table.h"
#include "strv.h"
#include "user-util.h"
#include "util.h"
#include "virt.h"
#define VALID_DEPLOYMENT_CHARS (DIGITS LETTERS "-.:")

View file

@ -5,12 +5,12 @@
#include "sd-hwdb.h"
#include "alloc-util.h"
#include "build.h"
#include "hwdb-util.h"
#include "main-func.h"
#include "pretty-print.h"
#include "selinux-util.h"
#include "terminal-util.h"
#include "util.h"
#include "verbs.h"
static const char *arg_hwdb_bin_dir = NULL;

View file

@ -4,6 +4,7 @@
#include <stdio.h>
#include "alloc-util.h"
#include "build.h"
#include "gpt.h"
#include "id128-print.h"
#include "main-func.h"
@ -11,7 +12,6 @@
#include "strv.h"
#include "format-table.h"
#include "terminal-util.h"
#include "util.h"
#include "verbs.h"
static Id128PrettyPrintMode arg_mode = ID128_PRINT_ID128;

View file

@ -16,7 +16,6 @@
#include "stat-util.h"
#include "string-util.h"
#include "tmpfile-util.h"
#include "util.h"
#define COPY_BUFFER_SIZE (16*1024)

View file

@ -11,7 +11,6 @@
#include "ratelimit.h"
#include "string-util.h"
#include "tmpfile-util.h"
#include "util.h"
#define COPY_BUFFER_SIZE (16*1024)

View file

@ -7,6 +7,7 @@
#include "sd-id128.h"
#include "alloc-util.h"
#include "build.h"
#include "discover-image.h"
#include "export-raw.h"
#include "export-tar.h"

Some files were not shown because too many files have changed in this diff Show more