1
0
mirror of https://github.com/systemd/systemd synced 2025-09-28 08:14:46 +02:00

Compare commits

...

61 Commits

Author SHA1 Message Date
Yu Watanabe
7b5ed18779
Merge pull request #18294 from ssahani/net-2
tree wide use ensure_put
2021-01-19 16:46:41 +09:00
Zbigniew Jędrzejewski-Szmek
f1fb046a98
Merge pull request #18300 from yuwata/analyze-verify-18252
analyze: resolve executable path if it is relative
2021-01-19 08:41:15 +01:00
Susant Sahani
3c29137626 udev: Use TAKE_PTR 2021-01-19 05:56:40 +01:00
Susant Sahani
f5b73a7fa8 udev-rules: Use ordered_hashmap_ensure_put 2021-01-19 05:56:31 +01:00
Susant Sahani
1dfb93210f sysusers: use ordered_hashmap_ensure_put 2021-01-19 05:56:25 +01:00
Yu Watanabe
29d65a4388
Merge pull request #18303 from yuwata/verity-cleanup
veritysetup-generator: drop unused struct and variable
2021-01-19 12:22:55 +09:00
Yu Watanabe
7e2757c42f
Merge pull request #18038 from yuwata/meson-split
meson: various cleanups
2021-01-19 12:22:34 +09:00
Yu Watanabe
13a4e9f209 TODO: fix typo 2021-01-19 07:22:48 +09:00
Yu Watanabe
71ce3ba25b veritysetup-generator: drop unused struct and variable
Follow-ups for 08b04ec7e72b7327b4803809732b1b8fce8dd069.

This also drops unnecessary inclusion.

Fixes CID#1443889.
2021-01-19 07:21:57 +09:00
Yu Watanabe
024e9084c1 meson: move several definitions related libsystemd to src/libsystemd/meson.build 2021-01-19 07:06:32 +09:00
Yu Watanabe
40dbce36df meson: use static_libsystemd_pic 2021-01-19 07:06:32 +09:00
Yu Watanabe
a0e150b2f4 meson: add missing license header 2021-01-19 07:06:32 +09:00
Yu Watanabe
e025c9dfe3 meson: move test or fuzzer definitions to relevant meson.build in subdirectories 2021-01-19 07:06:32 +09:00
Yu Watanabe
b5c34d6bf1 meson: drop unused variable 2021-01-19 07:06:32 +09:00
Yu Watanabe
04e7ada0d7 meson: drop unnecessary files from test definitions 2021-01-19 07:06:32 +09:00
Yu Watanabe
74b28f2b36 meson: drop unnecessary libraries from journal related tests 2021-01-19 07:06:32 +09:00
Yu Watanabe
8d40961c3c meson: slightly disentangle code dependencies
But, still sd-id128 is used in src/basic.
2021-01-19 07:06:32 +09:00
Yu Watanabe
b61016f207 meson: sort inclusion of meson.build files in subdirectories 2021-01-19 07:06:32 +09:00
Yu Watanabe
529642936b meson: move libjournal_core definition to src/journal/meson.build 2021-01-19 07:06:32 +09:00
Yu Watanabe
3976f372ae meson: move libudev related definitions to src/libudev/meson.build
Also, this makes libudev.so built in build directory.
2021-01-19 07:06:32 +09:00
Yu Watanabe
f6fe732ff3 meson: move and gather find_program() 2021-01-19 07:06:32 +09:00
Yu Watanabe
73e994f291 meson: drop redundant source files in executable() 2021-01-19 07:06:32 +09:00
Yu Watanabe
0275e918af meson: move source file list for systemd-xdg-autostart-generator and its tests 2021-01-19 07:06:32 +09:00
Yu Watanabe
f98df767e1 meson: move source file list for busctl 2021-01-19 07:06:32 +09:00
Yu Watanabe
2ad279cfa4 meson: move source file list for systemd-cryptenroll 2021-01-19 07:06:32 +09:00
Yu Watanabe
b4d1892aac meson: move source file list for systemd-cryptsetup 2021-01-19 07:06:32 +09:00
Yu Watanabe
18b49798a6 meson: show standalone-binaries setting in the summary 2021-01-19 07:06:32 +09:00
Yu Watanabe
d33b0daa6c meson: use condition argument in test definition 2021-01-19 07:06:32 +09:00
Yu Watanabe
cbaaf7b9dd meson: drop redundant directory specification in additional source files 2021-01-19 07:06:32 +09:00
Yu Watanabe
c35125732f meson: move definition of systemctl source files 2021-01-19 07:06:29 +09:00
Yu Watanabe
f5a5284ea1 meson: introduce libtimesyncd_core library 2021-01-19 07:04:19 +09:00
Yu Watanabe
b09f01463a meson: enable several tests even if the relevant features are disabled 2021-01-19 07:04:19 +09:00
Yu Watanabe
a28c0617de meson: fix indentation 2021-01-19 07:04:19 +09:00
Yu Watanabe
4fc47fa82a meson: drop unnecessary variable declarations 2021-01-19 07:04:19 +09:00
Yu Watanabe
7087e4729f meson: drop unnecessary loop 2021-01-19 07:04:19 +09:00
Yu Watanabe
6969a671d9 test: drop bus-util.h from sd-bus
To drop src/shared from include directories to build libsystemd.so later.
2021-01-19 07:04:19 +09:00
Yu Watanabe
0159eee04a efi: create symbolic link to efi/loader-feature.h
To drop src/boot/efi from include directories for binaries later.
2021-01-19 07:04:19 +09:00
Yu Watanabe
c11e5f43d2 util: move several DNS related definitions to src/basic/dns-def.h
DNS_HOSTNAME_MAX is used by sd-resolve, but it was defined in
src/shared/dns-domain.h. The library libsystemd should be independent
of source files under src/shared.
2021-01-19 07:04:19 +09:00
Yu Watanabe
af182ae1dc util: move unit-file.[ch] to src/basic
As basic/path-lookup.[ch] depend on them.
2021-01-19 07:04:19 +09:00
Yu Watanabe
22eadc289b util: move parse_syscall_and_errno() to seccomp-util.c
This makes parse-util.c independent of seccomp-util.c, which is located
in src/shared.
2021-01-19 07:04:19 +09:00
Yu Watanabe
09f7c7c668 fuzzers: move several fuzzers 2021-01-19 07:04:19 +09:00
Yu Watanabe
c5abccfa58 meson: fix indentation 2021-01-19 07:04:19 +09:00
Yu Watanabe
5acb3cabd1 meson: make the second and third elements of tests or fuzzers optional
Then, we can shorten many test definitions.
2021-01-19 07:04:19 +09:00
Yu Watanabe
9aeec01e77 test: move test-umount.c to src/shutdown
Then, we can drop src/shutdown from include directories later.
2021-01-19 07:04:19 +09:00
Yu Watanabe
bac11cd667 core: move several source files to src/shared
As, the files are used by many executables, fstab-generator, remount-fs,
machine-id-setup, and etc.
With this change, the total size of the relevant executables and
libshared slightly decreases.

Before:
```
$ ll systemd-fstab-generator systemd-remount-fs systemd-machine-id-setup systemd-shutdown systemd-nspawn systemd src/shared/libsystemd-shared-247.so
-rwxrwxr-x 1 watanabe watanabe 7577800 Jan  5 13:35 src/shared/libsystemd-shared-247.so
-rwxrwxr-x 1 watanabe watanabe 4608360 Jan  5 13:35 systemd
-rwxrwxr-x 1 watanabe watanabe  117240 Jan  5 13:35 systemd-fstab-generator
-rwxrwxr-x 1 watanabe watanabe   61576 Jan  5 13:35 systemd-machine-id-setup
-rwxrwxr-x 1 watanabe watanabe  853080 Jan  5 13:35 systemd-nspawn
-rwxrwxr-x 1 watanabe watanabe   70600 Jan  5 13:35 systemd-remount-fs
-rwxrwxr-x 1 watanabe watanabe  172624 Jan  5 13:35 systemd-shutdown
```
Total: 13461280

After:
```
$ ll systemd-fstab-generator systemd-remount-fs systemd-machine-id-setup systemd-shutdown systemd-nspawn systemd src/shared/libsystemd-shared-247.so
-rwxrwxr-x 1 watanabe watanabe 7658336 Jan  5 13:32 src/shared/libsystemd-shared-247.so
-rwxrwxr-x 1 watanabe watanabe 4523560 Jan  5 13:32 systemd
-rwxrwxr-x 1 watanabe watanabe   78288 Jan  5 13:32 systemd-fstab-generator
-rwxrwxr-x 1 watanabe watanabe   30984 Jan  5 13:32 systemd-machine-id-setup
-rwxrwxr-x 1 watanabe watanabe  840384 Jan  5 13:32 systemd-nspawn
-rwxrwxr-x 1 watanabe watanabe   39104 Jan  5 13:32 systemd-remount-fs
-rwxrwxr-x 1 watanabe watanabe  117160 Jan  5 13:32 systemd-shutdown
```
Total: 13287816
2021-01-19 07:04:19 +09:00
Yu Watanabe
772e0a76f3 test: rewrite test-sd-device-thread.c to depend only on libsystemd
Similarly, this makes test-udev-device-thread.c depend only on libudev.
2021-01-19 07:04:19 +09:00
Yu Watanabe
261fc53b99 test: move tests for libudev into src/libudev 2021-01-19 07:04:19 +09:00
Yu Watanabe
cf2423503b time-wait-sync: move time-wait-sync.c -> src/timesync/wait-sync.c
As wait-online is located under src/network.
2021-01-19 07:04:19 +09:00
Yu Watanabe
e2e7888191 xdg: move tests for xdg-autostart-generator
Then, we can drop src/xdg-autostart-generator from include directories
later.
2021-01-19 07:04:19 +09:00
Yu Watanabe
a79e17234d meson.build: drop unused variable 2021-01-19 07:04:19 +09:00
Yu Watanabe
0703d2f6c4 test: move test-systemd-tmpfiles.py from src/test to test
As the other test scripts, e.g. test-sysusers.sh, are located under
test rather than src/test.
2021-01-19 07:04:19 +09:00
Yu Watanabe
0f46548deb login: move src/login/logind-acl.[ch] -> src/shared/devnode-acl.[ch]
The files are used by logind and udevd. And the functions in the files
are not specific to logind, and quite general enough to move to
libshared.
2021-01-19 07:04:19 +09:00
Yu Watanabe
100fd93f55 tmpfiles: move offline-passwd.[ch] to src/tmpfiles
offline-passwd.[ch] are only used by systemd-tmpfiles and the relevant
test. And are not included in libshared. So, it is not suitable to
located under src/shared.
2021-01-19 07:04:18 +09:00
Yu Watanabe
99b9f8fddd sd-journal: move source files for sd-journal to src/libsystemd/sd-journal 2021-01-19 07:04:18 +09:00
Yu Watanabe
b9b442a0cc analyze: resolve executable path if it is relative
Fixes #18252.
2021-01-19 06:39:25 +09:00
Yu Watanabe
ece852c845 path-util: also check absolute path is a directory or not in find_executable() 2021-01-19 06:39:07 +09:00
Susant Sahani
0b83974b91 install: use ordered_hashmap_ensure_put 2021-01-18 21:12:32 +01:00
Susant Sahani
b5b9b0e7ba network: Use TAKE_PTR 2021-01-18 21:11:31 +01:00
Susant Sahani
9fa3e794ac network: network -- use ordered_hashmap_ensure_put 2021-01-18 21:11:01 +01:00
Susant Sahani
28d9587be5 network: address - use ordered_hashmap_ensure_put 2021-01-18 21:09:27 +01:00
Susant Sahani
9d6bb21f37 network: macsec - use ordered_hashmap_ensure_put 2021-01-18 20:16:50 +01:00
170 changed files with 1390 additions and 1840 deletions

1
.github/labeler.yml vendored
View File

@ -36,4 +36,3 @@ timedate:
- src/timedate/* - src/timedate/*
timesync: timesync:
- src/timesync/* - src/timesync/*
- src/time-wait-sync/*

2
TODO
View File

@ -21,7 +21,7 @@ Janitorial Clean-ups:
Features: Features:
* sd-boot: define a drop-in dir in the ESP that may contain X.509 * sd-boot: define a drop-in dir in the ESP that may contain X.509
certificates. If the firmware is detected to be in setup mode, automaticallly certificates. If the firmware is detected to be in setup mode, automatically
enroll them as PK/KEK/db, turn off setup mode and proceed. Optionally, enroll them as PK/KEK/db, turn off setup mode and proceed. Optionally,
instead of auto-enrolling them add them to the sd-boot menu, giving the user instead of auto-enrolling them add them to the sd-boot menu, giving the user
the option to manually enroll them, after selecting the menu entry. This way, the option to manually enroll them, after selecting the menu entry. This way,

View File

@ -1,3 +1,5 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
# Do not edit. Generated by update-man-rules.py. # Do not edit. Generated by update-man-rules.py.
# Update with: # Update with:
# ninja -C build man/update-man-rules # ninja -C build man/update-man-rules

View File

@ -1553,9 +1553,6 @@ conf.set10('ENABLE_NSS', enable_nss)
conf.set10('ENABLE_TIMEDATECTL', get_option('timedated') or get_option('timesyncd')) conf.set10('ENABLE_TIMEDATECTL', get_option('timedated') or get_option('timesyncd'))
tests = []
fuzzers = []
conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', slow_tests) conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', slow_tests)
##################################################################### #####################################################################
@ -1589,44 +1586,8 @@ else
endif endif
conf.set10('ENABLE_EFI', have) conf.set10('ENABLE_EFI', have)
##################################################################### ############################################################
config_h = configure_file(
output : 'config.h',
configuration : conf)
meson_apply_m4 = find_program('tools/meson-apply-m4.sh')
includes = include_directories('src/basic',
'src/boot',
'src/core',
'src/home',
'src/journal',
'src/journal-remote',
'src/libsystemd-network',
'src/libsystemd/sd-bus',
'src/libsystemd/sd-device',
'src/libsystemd/sd-event',
'src/libsystemd/sd-hwdb',
'src/libsystemd/sd-id128',
'src/libsystemd/sd-netlink',
'src/libsystemd/sd-network',
'src/libsystemd/sd-resolve',
'src/login',
'src/nspawn',
'src/resolve',
'src/shared',
'src/shutdown',
'src/systemd',
'src/time-wait-sync',
'src/timesync',
'src/udev',
'src/xdg-autostart-generator',
'.')
add_project_arguments('-include', 'config.h', language : 'c')
generate_gperfs = find_program('tools/generate-gperfs.py')
autosuspend_update_sh = find_program('tools/autosuspend-update.sh') autosuspend_update_sh = find_program('tools/autosuspend-update.sh')
hwdb_update_sh = find_program('tools/hwdb-update.sh') hwdb_update_sh = find_program('tools/hwdb-update.sh')
make_autosuspend_rules_py = find_program('tools/make-autosuspend-rules.py') make_autosuspend_rules_py = find_program('tools/make-autosuspend-rules.py')
@ -1635,38 +1596,62 @@ make_man_index_py = find_program('tools/make-man-index.py')
syscall_table_update_sh = find_program('tools/syscall-table-update.sh') syscall_table_update_sh = find_program('tools/syscall-table-update.sh')
xml_helper_py = find_program('tools/xml_helper.py') xml_helper_py = find_program('tools/xml_helper.py')
update_dbus_docs_py = find_program('tools/update-dbus-docs.py') update_dbus_docs_py = find_program('tools/update-dbus-docs.py')
meson_apply_m4 = find_program('tools/meson-apply-m4.sh')
generate_gperfs = find_program('tools/generate-gperfs.py')
#####################################################################
config_h = configure_file(
output : 'config.h',
configuration : conf)
add_project_arguments('-include', 'config.h', language : 'c')
############################################################ ############################################################
# binaries that have --help and are intended for use by humans,
# usually, but not always, installed in /bin.
public_programs = []
tests = []
fuzzers = []
basic_includes = include_directories(
'src/basic',
'src/systemd',
'.')
libsystemd_includes = [basic_includes, include_directories(
'src/libsystemd/sd-bus',
'src/libsystemd/sd-device',
'src/libsystemd/sd-event',
'src/libsystemd/sd-hwdb',
'src/libsystemd/sd-id128',
'src/libsystemd/sd-journal',
'src/libsystemd/sd-netlink',
'src/libsystemd/sd-network',
'src/libsystemd/sd-resolve')]
includes = [libsystemd_includes, include_directories('src/shared')]
subdir('po') subdir('po')
subdir('catalog') subdir('catalog')
subdir('src/libudev')
subdir('src/systemd')
subdir('src/basic') subdir('src/basic')
subdir('src/libsystemd') subdir('src/libsystemd')
subdir('src/libsystemd-network') subdir('src/shared')
subdir('src/journal') subdir('src/udev')
subdir('src/login') subdir('src/libudev')
libjournal_core = static_library(
'journal-core',
libjournal_core_sources,
journald_gperf_c,
include_directories : includes,
install : false)
libsystemd_sym_path = '@0@/@1@'.format(project_source_root, libsystemd_sym)
libsystemd = shared_library( libsystemd = shared_library(
'systemd', 'systemd',
disable_mempool_c, disable_mempool_c,
version : libsystemd_version, version : libsystemd_version,
include_directories : includes, include_directories : libsystemd_includes,
link_args : ['-shared', link_args : ['-shared',
'-Wl,--version-script=' + libsystemd_sym_path], '-Wl,--version-script=' + libsystemd_sym_path],
link_with : [libbasic, link_with : [libbasic,
libbasic_gcrypt], libbasic_gcrypt],
link_whole : [libsystemd_static, link_whole : [libsystemd_static],
libjournal_client],
dependencies : [threads, dependencies : [threads,
librt, librt,
libxz, libxz,
@ -1676,21 +1661,17 @@ libsystemd = shared_library(
install : true, install : true,
install_dir : rootlibdir) install_dir : rootlibdir)
static_libsystemd = get_option('static-libsystemd')
static_libsystemd_pic = static_libsystemd == 'true' or static_libsystemd == 'pic'
install_libsystemd_static = static_library( install_libsystemd_static = static_library(
'systemd', 'systemd',
libsystemd_sources, libsystemd_sources,
journal_client_sources,
basic_sources, basic_sources,
basic_gcrypt_sources, basic_gcrypt_sources,
disable_mempool_c, disable_mempool_c,
include_directories : includes, include_directories : libsystemd_includes,
build_by_default : static_libsystemd != 'false', build_by_default : static_libsystemd != 'false',
install : static_libsystemd != 'false', install : static_libsystemd != 'false',
install_dir : rootlibdir, install_dir : rootlibdir,
pic : static_libsystemd == 'true' or static_libsystemd == 'pic', pic : static_libsystemd_pic,
dependencies : [threads, dependencies : [threads,
librt, librt,
libxz, libxz,
@ -1703,39 +1684,76 @@ install_libsystemd_static = static_library(
libgcrypt], libgcrypt],
c_args : libsystemd_c_args + (static_libsystemd_pic ? [] : ['-fno-PIC'])) c_args : libsystemd_c_args + (static_libsystemd_pic ? [] : ['-fno-PIC']))
libudev = shared_library(
'udev',
disable_mempool_c,
version : libudev_version,
include_directories : includes,
link_args : ['-shared',
'-Wl,--version-script=' + libudev_sym_path],
link_with : [libsystemd_static, libshared_static],
link_whole : libudev_basic,
dependencies : [threads],
link_depends : libudev_sym,
install : true,
install_dir : rootlibdir)
install_libudev_static = static_library(
'udev',
basic_sources,
shared_sources,
libsystemd_sources,
libudev_sources,
disable_mempool_c,
include_directories : includes,
build_by_default : static_libudev != 'false',
install : static_libudev != 'false',
install_dir : rootlibdir,
link_depends : libudev_sym,
dependencies : libshared_deps + [libmount],
c_args : static_libudev_pic ? [] : ['-fno-PIC'],
pic : static_libudev_pic)
############################################################ ############################################################
# binaries that have --help and are intended for use by humans, # systemd-analyze requires 'libcore'
# usually, but not always, installed in /bin.
public_programs = []
subdir('src/shared')
subdir('src/core') subdir('src/core')
subdir('src/shutdown') # systemd-journal-remote requires 'libjournal_core'
subdir('src/udev') subdir('src/journal')
subdir('src/network') # systemd-networkd requires 'libsystemd_network'
subdir('src/libsystemd-network')
subdir('src/analyze') subdir('src/analyze')
subdir('src/journal-remote') subdir('src/boot/efi')
subdir('src/busctl')
subdir('src/coredump') subdir('src/coredump')
subdir('src/pstore') subdir('src/cryptenroll')
subdir('src/oom') subdir('src/cryptsetup')
subdir('src/home')
subdir('src/hostname') subdir('src/hostname')
subdir('src/import') subdir('src/import')
subdir('src/partition') subdir('src/journal-remote')
subdir('src/kernel-install') subdir('src/kernel-install')
subdir('src/locale') subdir('src/locale')
subdir('src/login')
subdir('src/machine') subdir('src/machine')
subdir('src/portable') subdir('src/network')
subdir('src/userdb')
subdir('src/home')
subdir('src/nspawn') subdir('src/nspawn')
subdir('src/oom')
subdir('src/partition')
subdir('src/portable')
subdir('src/pstore')
subdir('src/resolve') subdir('src/resolve')
subdir('src/shutdown')
subdir('src/systemctl')
subdir('src/timedate') subdir('src/timedate')
subdir('src/timesync') subdir('src/timesync')
subdir('src/tmpfiles') subdir('src/tmpfiles')
subdir('src/userdb')
subdir('src/vconsole') subdir('src/vconsole')
subdir('src/boot/efi') subdir('src/xdg-autostart-generator')
subdir('src/systemd')
subdir('src/test') subdir('src/test')
subdir('src/fuzz') subdir('src/fuzz')
@ -1756,9 +1774,9 @@ test_dlopen = executable(
build_by_default : want_tests != 'false') build_by_default : want_tests != 'false')
foreach tuple : [['myhostname', 'ENABLE_NSS_MYHOSTNAME'], foreach tuple : [['myhostname', 'ENABLE_NSS_MYHOSTNAME'],
['systemd', 'ENABLE_NSS_SYSTEMD', 'src/nss-systemd/userdb-glue.c src/nss-systemd/userdb-glue.h src/nss-systemd/nss-systemd.h'], ['systemd', 'ENABLE_NSS_SYSTEMD', ['nss-systemd.h', 'userdb-glue.c', 'userdb-glue.h']],
['mymachines', 'ENABLE_NSS_MYMACHINES'], ['mymachines', 'ENABLE_NSS_MYMACHINES'],
['resolve', 'ENABLE_NSS_RESOLVE']] ['resolve', 'ENABLE_NSS_RESOLVE', [], resolve_includes]]
condition = tuple[1] == '' or conf.get(tuple[1]) == 1 condition = tuple[1] == '' or conf.get(tuple[1]) == 1
if condition if condition
@ -1769,15 +1787,19 @@ foreach tuple : [['myhostname', 'ENABLE_NSS_MYHOSTNAME'],
sources = ['src/nss-@0@/nss-@0@.c'.format(module)] sources = ['src/nss-@0@/nss-@0@.c'.format(module)]
if tuple.length() > 2 if tuple.length() > 2
sources += tuple[2].split() foreach s : tuple[2]
sources += ['src/nss-@0@/@1@'.format(module, s)]
endforeach
endif endif
incs = tuple.length() > 3 ? tuple[3] : includes
nss = shared_library( nss = shared_library(
'nss_' + module, 'nss_' + module,
sources, sources,
disable_mempool_c, disable_mempool_c,
version : '2', version : '2',
include_directories : includes, include_directories : incs,
# Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned # Note that we link NSS modules with '-z nodelete' so that mempools never get orphaned
link_args : ['-Wl,-z,nodelete', link_args : ['-Wl,-z,nodelete',
'-shared', '-shared',
@ -1832,7 +1854,7 @@ meson.add_install_script(meson_make_symlink,
public_programs += executable( public_programs += executable(
'systemd-analyze', 'systemd-analyze',
systemd_analyze_sources, systemd_analyze_sources,
include_directories : includes, include_directories : core_includes,
link_with : [libcore, link_with : [libcore,
libshared], libshared],
dependencies : [versiondep, dependencies : [versiondep,
@ -1916,8 +1938,7 @@ executable(
'systemd-fstab-generator', 'systemd-fstab-generator',
'src/fstab-generator/fstab-generator.c', 'src/fstab-generator/fstab-generator.c',
include_directories : includes, include_directories : includes,
link_with : [libcore_shared, link_with : [libshared],
libshared],
install_rpath : rootlibexecdir, install_rpath : rootlibexecdir,
install : true, install : true,
install_dir : systemgeneratordir) install_dir : systemgeneratordir)
@ -1961,7 +1982,6 @@ if conf.get('HAVE_BLKID') == 1
executable( executable(
'systemd-gpt-auto-generator', 'systemd-gpt-auto-generator',
'src/gpt-auto-generator/gpt-auto-generator.c', 'src/gpt-auto-generator/gpt-auto-generator.c',
'src/shared/blkid-util.h',
include_directories : includes, include_directories : includes,
link_with : [libshared], link_with : [libshared],
dependencies : libblkid, dependencies : libblkid,
@ -1982,7 +2002,7 @@ if conf.get('ENABLE_RESOLVE') == 1
executable( executable(
'systemd-resolved', 'systemd-resolved',
systemd_resolved_sources, systemd_resolved_sources,
include_directories : includes, include_directories : resolve_includes,
link_with : [libshared, link_with : [libshared,
libbasic_gcrypt, libbasic_gcrypt,
libsystemd_resolve_core], libsystemd_resolve_core],
@ -2145,90 +2165,9 @@ public_programs += executable(
install_rpath : rootlibexecdir, install_rpath : rootlibexecdir,
install : true) install : true)
if get_option('link-systemctl-shared')
systemctl_link_with = [libshared]
else
systemctl_link_with = [libsystemd_static,
libshared_static,
libjournal_client,
libbasic_gcrypt]
endif
public_programs += executable( public_programs += executable(
'systemctl', 'systemctl',
'src/systemctl/systemctl-add-dependency.c', systemctl_sources,
'src/systemctl/systemctl-add-dependency.h',
'src/systemctl/systemctl-cancel-job.c',
'src/systemctl/systemctl-cancel-job.h',
'src/systemctl/systemctl-clean-or-freeze.c',
'src/systemctl/systemctl-clean-or-freeze.h',
'src/systemctl/systemctl-compat-halt.c',
'src/systemctl/systemctl-compat-halt.h',
'src/systemctl/systemctl-compat-runlevel.c',
'src/systemctl/systemctl-compat-runlevel.h',
'src/systemctl/systemctl-compat-shutdown.c',
'src/systemctl/systemctl-compat-shutdown.h',
'src/systemctl/systemctl-compat-telinit.c',
'src/systemctl/systemctl-compat-telinit.h',
'src/systemctl/systemctl-daemon-reload.c',
'src/systemctl/systemctl-daemon-reload.h',
'src/systemctl/systemctl-edit.c',
'src/systemctl/systemctl-edit.h',
'src/systemctl/systemctl-enable.c',
'src/systemctl/systemctl-enable.h',
'src/systemctl/systemctl-is-active.c',
'src/systemctl/systemctl-is-active.h',
'src/systemctl/systemctl-is-enabled.c',
'src/systemctl/systemctl-is-enabled.h',
'src/systemctl/systemctl-is-system-running.c',
'src/systemctl/systemctl-is-system-running.h',
'src/systemctl/systemctl-kill.c',
'src/systemctl/systemctl-kill.h',
'src/systemctl/systemctl-list-dependencies.c',
'src/systemctl/systemctl-list-dependencies.h',
'src/systemctl/systemctl-list-jobs.c',
'src/systemctl/systemctl-list-jobs.h',
'src/systemctl/systemctl-list-machines.c',
'src/systemctl/systemctl-list-machines.h',
'src/systemctl/systemctl-list-unit-files.c',
'src/systemctl/systemctl-list-unit-files.h',
'src/systemctl/systemctl-list-units.c',
'src/systemctl/systemctl-list-units.h',
'src/systemctl/systemctl-log-setting.c',
'src/systemctl/systemctl-log-setting.h',
'src/systemctl/systemctl-logind.c',
'src/systemctl/systemctl-logind.h',
'src/systemctl/systemctl-mount.c',
'src/systemctl/systemctl-mount.h',
'src/systemctl/systemctl-preset-all.c',
'src/systemctl/systemctl-preset-all.h',
'src/systemctl/systemctl-reset-failed.c',
'src/systemctl/systemctl-reset-failed.h',
'src/systemctl/systemctl-service-watchdogs.c',
'src/systemctl/systemctl-service-watchdogs.h',
'src/systemctl/systemctl-set-default.c',
'src/systemctl/systemctl-set-default.h',
'src/systemctl/systemctl-set-environment.c',
'src/systemctl/systemctl-set-environment.h',
'src/systemctl/systemctl-set-property.c',
'src/systemctl/systemctl-set-property.h',
'src/systemctl/systemctl-show.c',
'src/systemctl/systemctl-show.h',
'src/systemctl/systemctl-start-special.c',
'src/systemctl/systemctl-start-special.h',
'src/systemctl/systemctl-start-unit.c',
'src/systemctl/systemctl-start-unit.h',
'src/systemctl/systemctl-switch-root.c',
'src/systemctl/systemctl-switch-root.h',
'src/systemctl/systemctl-sysv-compat.c',
'src/systemctl/systemctl-sysv-compat.h',
'src/systemctl/systemctl-trivial-method.c',
'src/systemctl/systemctl-trivial-method.h',
'src/systemctl/systemctl-util.c',
'src/systemctl/systemctl-util.c',
'src/systemctl/systemctl-util.h',
'src/systemctl/systemctl.c',
'src/systemctl/systemctl.h',
include_directories : includes, include_directories : includes,
link_with : systemctl_link_with, link_with : systemctl_link_with,
dependencies : [threads, dependencies : [threads,
@ -2315,7 +2254,7 @@ if conf.get('ENABLE_HOMED') == 1
executable( executable(
'systemd-homed', 'systemd-homed',
systemd_homed_sources, systemd_homed_sources,
include_directories : includes, include_directories : home_includes,
link_with : [libshared], link_with : [libshared],
dependencies : [threads, dependencies : [threads,
libcrypt, libcrypt,
@ -2402,27 +2341,6 @@ executable(
install_dir : systemgeneratordir) install_dir : systemgeneratordir)
if conf.get('HAVE_LIBCRYPTSETUP') == 1 if conf.get('HAVE_LIBCRYPTSETUP') == 1
systemd_cryptsetup_sources = files('''
src/cryptsetup/cryptsetup-fido2.h
src/cryptsetup/cryptsetup-keyfile.c
src/cryptsetup/cryptsetup-keyfile.h
src/cryptsetup/cryptsetup-pkcs11.h
src/cryptsetup/cryptsetup-tpm2.h
src/cryptsetup/cryptsetup.c
'''.split())
if conf.get('HAVE_P11KIT') == 1
systemd_cryptsetup_sources += files('src/cryptsetup/cryptsetup-pkcs11.c')
endif
if conf.get('HAVE_LIBFIDO2') == 1
systemd_cryptsetup_sources += files('src/cryptsetup/cryptsetup-fido2.c')
endif
if conf.get('HAVE_TPM2') == 1
systemd_cryptsetup_sources += files('src/cryptsetup/cryptsetup-tpm2.c')
endif
executable( executable(
'systemd-cryptsetup', 'systemd-cryptsetup',
systemd_cryptsetup_sources, systemd_cryptsetup_sources,
@ -2462,34 +2380,6 @@ if conf.get('HAVE_LIBCRYPTSETUP') == 1
install : true, install : true,
install_dir : systemgeneratordir) install_dir : systemgeneratordir)
systemd_cryptenroll_sources = files('''
src/cryptenroll/cryptenroll-fido2.h
src/cryptenroll/cryptenroll-list.c
src/cryptenroll/cryptenroll-list.h
src/cryptenroll/cryptenroll-password.c
src/cryptenroll/cryptenroll-password.h
src/cryptenroll/cryptenroll-pkcs11.h
src/cryptenroll/cryptenroll-recovery.c
src/cryptenroll/cryptenroll-recovery.h
src/cryptenroll/cryptenroll-tpm2.h
src/cryptenroll/cryptenroll-wipe.c
src/cryptenroll/cryptenroll-wipe.h
src/cryptenroll/cryptenroll.c
src/cryptenroll/cryptenroll.h
'''.split())
if conf.get('HAVE_P11KIT') == 1 and conf.get('HAVE_OPENSSL') == 1
systemd_cryptenroll_sources += files('src/cryptenroll/cryptenroll-pkcs11.c')
endif
if conf.get('HAVE_LIBFIDO2') == 1
systemd_cryptenroll_sources += files('src/cryptenroll/cryptenroll-fido2.c')
endif
if conf.get('HAVE_TPM2') == 1
systemd_cryptenroll_sources += files('src/cryptenroll/cryptenroll-tpm2.c')
endif
executable( executable(
'systemd-cryptenroll', 'systemd-cryptenroll',
systemd_cryptenroll_sources, systemd_cryptenroll_sources,
@ -2527,8 +2417,7 @@ endif
if conf.get('ENABLE_XDG_AUTOSTART') == 1 if conf.get('ENABLE_XDG_AUTOSTART') == 1
executable( executable(
'systemd-xdg-autostart-generator', 'systemd-xdg-autostart-generator',
'src/xdg-autostart-generator/xdg-autostart-generator.c', systemd_xdg_autostart_generator_sources,
'src/xdg-autostart-generator/xdg-autostart-service.c',
include_directories : includes, include_directories : includes,
link_with : [libshared], link_with : [libshared],
install_rpath : rootlibexecdir, install_rpath : rootlibexecdir,
@ -2614,20 +2503,11 @@ if conf.get('ENABLE_TIMEDATECTL') == 1
endif endif
if conf.get('ENABLE_TIMESYNCD') == 1 if conf.get('ENABLE_TIMESYNCD') == 1
if get_option('link-timesyncd-shared')
timesyncd_link_with = [libshared]
else
timesyncd_link_with = [libsystemd_static,
libshared_static,
libjournal_client,
libbasic_gcrypt]
endif
executable( executable(
'systemd-timesyncd', 'systemd-timesyncd',
systemd_timesyncd_sources, systemd_timesyncd_sources,
include_directories : includes, include_directories : includes,
link_with : [timesyncd_link_with], link_with : [libtimesyncd_core],
dependencies : [threads, dependencies : [threads,
libm], libm],
install_rpath : rootlibexecdir, install_rpath : rootlibexecdir,
@ -2636,9 +2516,9 @@ if conf.get('ENABLE_TIMESYNCD') == 1
executable( executable(
'systemd-time-wait-sync', 'systemd-time-wait-sync',
'src/time-wait-sync/time-wait-sync.c', 'src/timesync/wait-sync.c',
include_directories : includes, include_directories : includes,
link_with : [timesyncd_link_with], link_with : [libtimesyncd_core],
install_rpath : rootlibexecdir, install_rpath : rootlibexecdir,
install : true, install : true,
install_dir : rootlibexecdir) install_dir : rootlibexecdir)
@ -2929,8 +2809,7 @@ executable(
'systemd-remount-fs', 'systemd-remount-fs',
'src/remount-fs/remount-fs.c', 'src/remount-fs/remount-fs.c',
include_directories : includes, include_directories : includes,
link_with : [libcore_shared, link_with : [libshared],
libshared],
install_rpath : rootlibexecdir, install_rpath : rootlibexecdir,
install : true, install : true,
install_dir : rootlibexecdir) install_dir : rootlibexecdir)
@ -2939,8 +2818,7 @@ executable(
'systemd-machine-id-setup', 'systemd-machine-id-setup',
'src/machine-id-setup/machine-id-setup-main.c', 'src/machine-id-setup/machine-id-setup-main.c',
include_directories : includes, include_directories : includes,
link_with : [libcore_shared, link_with : [libshared],
libshared],
install_rpath : rootlibexecdir, install_rpath : rootlibexecdir,
install : true, install : true,
install_dir : rootbindir) install_dir : rootbindir)
@ -3154,9 +3032,7 @@ public_programs += executable(
public_programs += executable( public_programs += executable(
'busctl', 'busctl',
'src/busctl/busctl.c', busctl_sources,
'src/busctl/busctl-introspect.c',
'src/busctl/busctl-introspect.h',
include_directories : includes, include_directories : includes,
link_with : [libshared], link_with : [libshared],
install_rpath : rootlibexecdir, install_rpath : rootlibexecdir,
@ -3189,8 +3065,7 @@ if enable_sysusers
link_with : [libshared_static, link_with : [libshared_static,
libbasic, libbasic,
libbasic_gcrypt, libbasic_gcrypt,
libsystemd_static, libsystemd_static],
libjournal_client],
install : true, install : true,
install_dir : rootbindir) install_dir : rootbindir)
public_programs += exe public_programs += exe
@ -3232,8 +3107,7 @@ if conf.get('ENABLE_TMPFILES') == 1
link_with : [libshared_static, link_with : [libshared_static,
libbasic, libbasic,
libbasic_gcrypt, libbasic_gcrypt,
libsystemd_static, libsystemd_static],
libjournal_client],
dependencies : [libacl], dependencies : [libacl],
install : true, install : true,
install_dir : rootbindir) install_dir : rootbindir)
@ -3244,7 +3118,6 @@ if conf.get('ENABLE_HWDB') == 1
public_programs += executable( public_programs += executable(
'systemd-hwdb', 'systemd-hwdb',
'src/hwdb/hwdb.c', 'src/hwdb/hwdb.c',
'src/libsystemd/sd-hwdb/hwdb-internal.h',
include_directories : includes, include_directories : includes,
link_with : udev_link_with, link_with : udev_link_with,
install_rpath : udev_rpath, install_rpath : udev_rpath,
@ -3293,8 +3166,7 @@ executable(
'systemd-shutdown', 'systemd-shutdown',
systemd_shutdown_sources, systemd_shutdown_sources,
include_directories : includes, include_directories : includes,
link_with : [libcore_shared, link_with : [libshared],
libshared],
dependencies : [libmount], dependencies : [libmount],
install_rpath : rootlibexecdir, install_rpath : rootlibexecdir,
install : true, install : true,
@ -3342,8 +3214,7 @@ public_programs += executable(
'systemd-nspawn', 'systemd-nspawn',
systemd_nspawn_sources, systemd_nspawn_sources,
include_directories : includes, include_directories : includes,
link_with : [libcore_shared, link_with : [libnspawn_core,
libnspawn_core,
libshared], libshared],
dependencies : [libblkid, dependencies : [libblkid,
libseccomp], libseccomp],
@ -3354,7 +3225,7 @@ if conf.get('ENABLE_NETWORKD') == 1
executable( executable(
'systemd-networkd', 'systemd-networkd',
systemd_networkd_sources, systemd_networkd_sources,
include_directories : network_include_dir, include_directories : network_includes,
link_with : [libnetworkd_core, link_with : [libnetworkd_core,
libsystemd_network, libsystemd_network,
networkd_link_with], networkd_link_with],
@ -3367,8 +3238,7 @@ if conf.get('ENABLE_NETWORKD') == 1
'systemd-networkd-wait-online', 'systemd-networkd-wait-online',
systemd_networkd_wait_online_sources, systemd_networkd_wait_online_sources,
include_directories : includes, include_directories : includes,
link_with : [libnetworkd_core, link_with : [networkd_link_with],
networkd_link_with],
install_rpath : rootlibexecdir, install_rpath : rootlibexecdir,
install : true, install : true,
install_dir : rootlibexecdir) install_dir : rootlibexecdir)
@ -3376,7 +3246,7 @@ if conf.get('ENABLE_NETWORKD') == 1
public_programs += executable( public_programs += executable(
'networkctl', 'networkctl',
networkctl_sources, networkctl_sources,
include_directories : includes, include_directories : libsystemd_network_includes,
link_with : [libsystemd_network, link_with : [libsystemd_network,
networkd_link_with], networkd_link_with],
install_rpath : rootlibexecdir, install_rpath : rootlibexecdir,
@ -3402,7 +3272,7 @@ endif
executable( executable(
'systemd-sulogin-shell', 'systemd-sulogin-shell',
['src/sulogin-shell/sulogin-shell.c'], 'src/sulogin-shell/sulogin-shell.c',
include_directories : includes, include_directories : includes,
link_with : [libshared], link_with : [libshared],
install_rpath : rootlibexecdir, install_rpath : rootlibexecdir,
@ -3422,13 +3292,13 @@ custom_target(
foreach tuple : tests foreach tuple : tests
sources = tuple[0] sources = tuple[0]
link_with = tuple[1].length() > 0 ? tuple[1] : [libshared] link_with = tuple.length() > 1 and tuple[1].length() > 0 ? tuple[1] : [libshared]
dependencies = tuple[2] dependencies = tuple.length() > 2 ? tuple[2] : []
condition = tuple.length() >= 4 ? tuple[3] : '' incs = tuple.length() > 3 and tuple[3].length() > 0 ? tuple[3] : includes
type = tuple.length() >= 5 ? tuple[4] : '' condition = tuple.length() > 4 ? tuple[4] : ''
defs = tuple.length() >= 6 ? tuple[5] : [] type = tuple.length() > 5 ? tuple[5] : ''
incs = tuple.length() >= 7 ? tuple[6] : includes defs = tuple.length() > 6 ? tuple[6] : []
parallel = tuple.length() >= 8 ? tuple[7] : true parallel = tuple.length() > 7 ? tuple[7] : true
timeout = 30 timeout = 30
name = sources[0].split('/')[-1].split('.')[0] name = sources[0].split('/')[-1].split('.')[0]
@ -3523,10 +3393,10 @@ fuzzer_exes = []
foreach tuple : fuzzers foreach tuple : fuzzers
sources = tuple[0] sources = tuple[0]
link_with = tuple[1].length() > 0 ? tuple[1] : [libshared] link_with = tuple.length() > 1 and tuple[1].length() > 0 ? tuple[1] : [libshared]
dependencies = tuple[2] dependencies = tuple.length() > 2 ? tuple[2] : []
defs = tuple.length() >= 4 ? tuple[3] : [] incs = tuple.length() > 3 and tuple[3].length() > 0 ? tuple[3] : includes
incs = tuple.length() >= 5 ? tuple[4] : includes defs = tuple.length() > 4 ? tuple[4] : []
link_args = [] link_args = []
if want_ossfuzz if want_ossfuzz
@ -3918,6 +3788,7 @@ foreach tuple : [
['kernel-install', get_option('kernel-install')], ['kernel-install', get_option('kernel-install')],
['systemd-analyze', conf.get('ENABLE_ANALYZE') == 1], ['systemd-analyze', conf.get('ENABLE_ANALYZE') == 1],
['fexecve'], ['fexecve'],
['standalone-binaries', get_option('standalone-binaries')],
] ]
if tuple.length() >= 2 if tuple.length() >= 2

View File

@ -115,14 +115,17 @@ static int verify_socket(Unit *u) {
} }
int verify_executable(Unit *u, const ExecCommand *exec) { int verify_executable(Unit *u, const ExecCommand *exec) {
int r;
if (!exec) if (!exec)
return 0; return 0;
if (exec->flags & EXEC_COMMAND_IGNORE_FAILURE) if (exec->flags & EXEC_COMMAND_IGNORE_FAILURE)
return 0; return 0;
if (access(exec->path, X_OK) < 0) r = find_executable_full(exec->path, false, NULL, NULL);
return log_unit_error_errno(u, errno, "Command %s is not executable: %m", exec->path); if (r < 0)
return log_unit_error_errno(u, r, "Command %s is not executable: %m", exec->path);
return 0; return 0;
} }

View File

@ -9,3 +9,13 @@ systemd_analyze_sources = files('''
analyze-security.c analyze-security.c
analyze-security.h analyze-security.h
'''.split()) '''.split())
tests += [
[['src/analyze/test-verify.c',
'src/analyze/analyze-verify.c',
'src/analyze/analyze-verify.h'],
[libcore,
libshared],
[],
core_includes],
]

17
src/basic/dns-def.h Normal file
View File

@ -0,0 +1,17 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
/* Length of a single label, with all escaping removed, excluding any trailing dot or NUL byte */
#define DNS_LABEL_MAX 63
/* Worst case length of a single label, with all escaping applied and room for a trailing NUL byte. */
#define DNS_LABEL_ESCAPED_MAX (DNS_LABEL_MAX*4+1)
/* Maximum length of a full hostname, consisting of a series of unescaped labels, and no trailing dot or NUL byte */
#define DNS_HOSTNAME_MAX 253
/* Maximum length of a full hostname, on the wire, including the final NUL byte */
#define DNS_WIRE_FORMAT_HOSTNAME_MAX 255
/* Maximum number of labels per valid hostname */
#define DNS_N_LABELS_MAX 127

View File

@ -10,7 +10,6 @@
#include "sd-id128.h" #include "sd-id128.h"
#include "efi/loader-features.h"
#include "time-util.h" #include "time-util.h"
#define EFI_VENDOR_LOADER SD_ID128_MAKE(4a,67,b0,82,0a,4c,41,cf,b6,c7,44,0b,29,bb,8c,4f) #define EFI_VENDOR_LOADER SD_ID128_MAKE(4a,67,b0,82,0a,4c,41,cf,b6,c7,44,0b,29,bb,8c,4f)

View File

@ -42,6 +42,7 @@ basic_sources = files('''
dirent-util.h dirent-util.h
dlfcn-util.c dlfcn-util.c
dlfcn-util.h dlfcn-util.h
dns-def.h
efivars.c efivars.c
efivars.h efivars.h
env-file.c env-file.c
@ -244,6 +245,8 @@ basic_sources = files('''
unaligned.h unaligned.h
unit-def.c unit-def.c
unit-def.h unit-def.h
unit-file.c
unit-file.h
unit-name.c unit-name.c
unit-name.h unit-name.h
user-util.c user-util.c
@ -378,7 +381,7 @@ run_target(
libbasic = static_library( libbasic = static_library(
'basic', 'basic',
basic_sources, basic_sources,
include_directories : includes, include_directories : basic_includes,
dependencies : [versiondep, dependencies : [versiondep,
threads, threads,
libcap, libcap,
@ -400,6 +403,6 @@ basic_gcrypt_sources = files(
libbasic_gcrypt = static_library( libbasic_gcrypt = static_library(
'basic-gcrypt', 'basic-gcrypt',
basic_gcrypt_sources, basic_gcrypt_sources,
include_directories : includes, include_directories : basic_includes,
dependencies : [libgcrypt], dependencies : [libgcrypt],
c_args : ['-fvisibility=default']) c_args : ['-fvisibility=default'])

View File

@ -16,9 +16,6 @@
#include "missing_network.h" #include "missing_network.h"
#include "parse-util.h" #include "parse-util.h"
#include "process-util.h" #include "process-util.h"
#if HAVE_SECCOMP
#include "seccomp-util.h"
#endif
#include "stat-util.h" #include "stat-util.h"
#include "string-util.h" #include "string-util.h"
#include "strv.h" #include "strv.h"
@ -317,46 +314,6 @@ int parse_errno(const char *t) {
return e; return e;
} }
#if HAVE_SECCOMP
int parse_syscall_and_errno(const char *in, char **name, int *error) {
_cleanup_free_ char *n = NULL;
char *p;
int e = -1;
assert(in);
assert(name);
assert(error);
/*
* This parse "syscall:errno" like "uname:EILSEQ", "@sync:255".
* If errno is omitted, then error is set to -1.
* Empty syscall name is not allowed.
* Here, we do not check that the syscall name is valid or not.
*/
p = strchr(in, ':');
if (p) {
e = seccomp_parse_errno_or_action(p + 1);
if (e < 0)
return e;
n = strndup(in, p - in);
} else
n = strdup(in);
if (!n)
return -ENOMEM;
if (isempty(n))
return -EINVAL;
*error = e;
*name = TAKE_PTR(n);
return 0;
}
#endif
static const char *mangle_base(const char *s, unsigned *base) { static const char *mangle_base(const char *s, unsigned *base) {
const char *k; const char *k;

View File

@ -22,9 +22,6 @@ int parse_mtu(int family, const char *s, uint32_t *ret);
int parse_size(const char *t, uint64_t base, uint64_t *size); int parse_size(const char *t, uint64_t base, uint64_t *size);
int parse_range(const char *t, unsigned *lower, unsigned *upper); int parse_range(const char *t, unsigned *lower, unsigned *upper);
int parse_errno(const char *t); int parse_errno(const char *t);
#if HAVE_SECCOMP
int parse_syscall_and_errno(const char *in, char **name, int *error);
#endif
#define SAFE_ATO_REFUSE_PLUS_MINUS (1U << 30) #define SAFE_ATO_REFUSE_PLUS_MINUS (1U << 30)
#define SAFE_ATO_REFUSE_LEADING_ZERO (1U << 29) #define SAFE_ATO_REFUSE_LEADING_ZERO (1U << 29)

View File

@ -586,10 +586,11 @@ char* path_join_internal(const char *first, ...) {
} }
static int check_x_access(const char *path, int *ret_fd) { static int check_x_access(const char *path, int *ret_fd) {
if (ret_fd) { _cleanup_close_ int fd = -1;
_cleanup_close_ int fd = -1; const char *with_dash;
int r; int r;
if (ret_fd) {
/* We need to use O_PATH because there may be executables for which we have only exec /* We need to use O_PATH because there may be executables for which we have only exec
* permissions, but not read (usually suid executables). */ * permissions, but not read (usually suid executables). */
fd = open(path, O_PATH|O_CLOEXEC); fd = open(path, O_PATH|O_CLOEXEC);
@ -599,14 +600,24 @@ static int check_x_access(const char *path, int *ret_fd) {
r = access_fd(fd, X_OK); r = access_fd(fd, X_OK);
if (r < 0) if (r < 0)
return r; return r;
*ret_fd = TAKE_FD(fd);
} else { } else {
/* Let's optimize things a bit by not opening the file if we don't need the fd. */ /* Let's optimize things a bit by not opening the file if we don't need the fd. */
if (access(path, X_OK) < 0) if (access(path, X_OK) < 0)
return -errno; return -errno;
} }
with_dash = strjoina(path, "/");
/* If this passes, it must be a directory. */
if (access(with_dash, X_OK) >= 0)
return -EISDIR;
if (errno != ENOTDIR)
return -errno;
if (ret_fd)
*ret_fd = TAKE_FD(fd);
return 0; return 0;
} }
@ -663,32 +674,20 @@ int find_executable_full(const char *name, bool use_path_envvar, char **ret_file
return -ENOMEM; return -ENOMEM;
r = check_x_access(j, ret_fd ? &fd : NULL); r = check_x_access(j, ret_fd ? &fd : NULL);
if (r >= 0) { if (r < 0) {
_cleanup_free_ char *with_dash; /* PATH entries which we don't have access to are ignored, as per tradition. */
if (r != -EACCES)
with_dash = strjoin(j, "/"); last_error = r;
if (!with_dash) continue;
return -ENOMEM;
/* If this passes, it must be a directory, and so should be skipped. */
if (access(with_dash, X_OK) >= 0)
continue;
/* We can't just `continue` inverting this case, since we need to update last_error. */
if (errno == ENOTDIR) {
/* Found it! */
if (ret_filename)
*ret_filename = path_simplify(TAKE_PTR(j), false);
if (ret_fd)
*ret_fd = TAKE_FD(fd);
return 0;
}
} }
/* PATH entries which we don't have access to are ignored, as per tradition. */ /* Found it! */
if (errno != EACCES) if (ret_filename)
last_error = -errno; *ret_filename = path_simplify(TAKE_PTR(j), false);
if (ret_fd)
*ret_fd = TAKE_FD(fd);
return 0;
} }
return last_error; return last_error;

6
src/busctl/meson.build Normal file
View File

@ -0,0 +1,6 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
busctl_sources = files(
'busctl-introspect.c',
'busctl-introspect.h',
'busctl.c')

View File

@ -1,16 +1,5 @@
# SPDX-License-Identifier: LGPL-2.1-or-later # SPDX-License-Identifier: LGPL-2.1-or-later
libcore_shared_sources = '''
killall.c
killall.h
loopback-setup.c
loopback-setup.h
machine-id-setup.c
machine-id-setup.h
mount-setup.c
mount-setup.h
'''.split()
libcore_sources = ''' libcore_sources = '''
apparmor-setup.c apparmor-setup.c
apparmor-setup.h apparmor-setup.h
@ -151,22 +140,12 @@ load_fragment_gperf_nulstr_c = custom_target(
command : [awk, '-f', '@INPUT0@', '@INPUT1@'], command : [awk, '-f', '@INPUT0@', '@INPUT1@'],
capture : true) capture : true)
# A convenience library to share code with other binaries:
# systemd-shutdown, systemd-remount-fs, systemd-machine-id-setup, …
libcore_shared = static_library(
'core-shared',
libcore_shared_sources,
include_directories : includes,
dependencies : [versiondep,
libmount])
libcore = static_library( libcore = static_library(
'core', 'core',
libcore_sources, libcore_sources,
load_fragment_gperf_c, load_fragment_gperf_c,
load_fragment_gperf_nulstr_c, load_fragment_gperf_nulstr_c,
include_directories : includes, include_directories : includes,
link_whole : libcore_shared,
dependencies : [versiondep, dependencies : [versiondep,
threads, threads,
librt, librt,
@ -179,6 +158,8 @@ libcore = static_library(
libmount, libmount,
libacl]) libacl])
core_includes = [includes, include_directories('.')]
systemd_sources = files('main.c') systemd_sources = files('main.c')
in_files = [['macros.systemd', rpmmacrosdir], in_files = [['macros.systemd', rpmmacrosdir],
@ -222,3 +203,12 @@ if install_sysconfdir
meson.add_install_script('sh', '-c', mkdir_p.format(join_paths(pkgsysconfdir, 'user'))) meson.add_install_script('sh', '-c', mkdir_p.format(join_paths(pkgsysconfdir, 'user')))
meson.add_install_script('sh', '-c', mkdir_p.format(join_paths(sysconfdir, 'xdg/systemd'))) meson.add_install_script('sh', '-c', mkdir_p.format(join_paths(sysconfdir, 'xdg/systemd')))
endif endif
############################################################
fuzzers += [
[['src/core/fuzz-unit-file.c'],
[libcore,
libshared],
[libmount]],
]

View File

@ -7,8 +7,9 @@ systemd_coredump_sources = files('''
'''.split()) '''.split())
if conf.get('HAVE_ELFUTILS') == 1 if conf.get('HAVE_ELFUTILS') == 1
systemd_coredump_sources += files(['stacktrace.c', systemd_coredump_sources += files(
'stacktrace.h']) 'stacktrace.c',
'stacktrace.h')
endif endif
coredumpctl_sources = files('coredumpctl.c') coredumpctl_sources = files('coredumpctl.c')
@ -22,7 +23,5 @@ tests += [
[['src/coredump/test-coredump-vacuum.c', [['src/coredump/test-coredump-vacuum.c',
'src/coredump/coredump-vacuum.c', 'src/coredump/coredump-vacuum.c',
'src/coredump/coredump-vacuum.h'], 'src/coredump/coredump-vacuum.h'],
[], [], [], [], '', 'manual'],
[],
'ENABLE_COREDUMP', 'manual'],
] ]

View File

@ -0,0 +1,28 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
systemd_cryptenroll_sources = files(
'cryptenroll-fido2.h',
'cryptenroll-list.c',
'cryptenroll-list.h',
'cryptenroll-password.c',
'cryptenroll-password.h',
'cryptenroll-pkcs11.h',
'cryptenroll-recovery.c',
'cryptenroll-recovery.h',
'cryptenroll-tpm2.h',
'cryptenroll-wipe.c',
'cryptenroll-wipe.h',
'cryptenroll.c',
'cryptenroll.h')
if conf.get('HAVE_P11KIT') == 1 and conf.get('HAVE_OPENSSL') == 1
systemd_cryptenroll_sources += files('cryptenroll-pkcs11.c')
endif
if conf.get('HAVE_LIBFIDO2') == 1
systemd_cryptenroll_sources += files('cryptenroll-fido2.c')
endif
if conf.get('HAVE_TPM2') == 1
systemd_cryptenroll_sources += files('cryptenroll-tpm2.c')
endif

View File

@ -0,0 +1,21 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
systemd_cryptsetup_sources = files(
'cryptsetup-fido2.h',
'cryptsetup-keyfile.c',
'cryptsetup-keyfile.h',
'cryptsetup-pkcs11.h',
'cryptsetup-tpm2.h',
'cryptsetup.c')
if conf.get('HAVE_P11KIT') == 1
systemd_cryptsetup_sources += files('cryptsetup-pkcs11.c')
endif
if conf.get('HAVE_LIBFIDO2') == 1
systemd_cryptsetup_sources += files('cryptsetup-fido2.c')
endif
if conf.get('HAVE_TPM2') == 1
systemd_cryptsetup_sources += files('cryptsetup-tpm2.c')
endif

View File

@ -1,157 +1,25 @@
# SPDX-License-Identifier: LGPL-2.1-or-later # SPDX-License-Identifier: LGPL-2.1-or-later
fuzzers += [ fuzzers += [
[['src/fuzz/fuzz-bus-message.c'], [['src/fuzz/fuzz-bus-message.c']],
[libshared],
[]],
[['src/fuzz/fuzz-catalog.c'], [['src/fuzz/fuzz-catalog.c']],
[libjournal_core,
libshared],
[]],
[['src/fuzz/fuzz-dns-packet.c', [['src/fuzz/fuzz-json.c']],
dns_type_headers],
[libsystemd_resolve_core,
libshared],
[libgcrypt,
libgpg_error,
libm]],
[['src/fuzz/fuzz-dhcp6-client.c', [['src/fuzz/fuzz-varlink.c']],
'src/libsystemd-network/dhcp-identifier.h',
'src/libsystemd-network/dhcp-identifier.c',
'src/libsystemd-network/dhcp6-internal.h',
'src/systemd/sd-dhcp6-client.h'],
[libshared,
libsystemd_network],
[]],
[['src/fuzz/fuzz-dhcp-server.c'], [['src/fuzz/fuzz-udev-database.c']],
[libsystemd_network,
libshared],
[]],
[['src/fuzz/fuzz-lldp.c'], [['src/fuzz/fuzz-compress.c']],
[libshared,
libsystemd_network],
[]],
[['src/fuzz/fuzz-ndisc-rs.c', [['src/fuzz/fuzz-bus-label.c']],
'src/libsystemd-network/dhcp-identifier.h',
'src/libsystemd-network/dhcp-identifier.c',
'src/libsystemd-network/icmp6-util.h',
'src/systemd/sd-dhcp6-client.h',
'src/systemd/sd-ndisc.h'],
[libshared,
libsystemd_network],
[]],
[['src/fuzz/fuzz-json.c'], [['src/fuzz/fuzz-env-file.c']],
[libshared],
[]],
[['src/fuzz/fuzz-varlink.c'], [['src/fuzz/fuzz-hostname-setup.c']],
[libshared],
[]],
[['src/fuzz/fuzz-unit-file.c'], [['src/fuzz/fuzz-calendarspec.c']],
[libcore,
libshared],
[libmount]],
[['src/fuzz/fuzz-journald-audit.c', [['src/fuzz/fuzz-time-util.c']],
'src/fuzz/fuzz-journald.c'],
[libjournal_core,
libshared],
[libselinux]],
[['src/fuzz/fuzz-journald-kmsg.c',
'src/fuzz/fuzz-journald.c'],
[libjournal_core,
libshared],
[libselinux]],
[['src/fuzz/fuzz-journald-native.c',
'src/fuzz/fuzz-journald.c'],
[libjournal_core,
libshared],
[libselinux]],
[['src/fuzz/fuzz-journald-native-fd.c',
'src/fuzz/fuzz-journald.c'],
[libjournal_core,
libshared],
[libselinux]],
[['src/fuzz/fuzz-journald-stream.c',
'src/fuzz/fuzz-journald.c'],
[libjournal_core,
libshared],
[libselinux]],
[['src/fuzz/fuzz-journald-syslog.c',
'src/fuzz/fuzz-journald.c'],
[libjournal_core,
libshared],
[libselinux]],
[['src/fuzz/fuzz-journal-remote.c'],
[libsystemd_journal_remote,
libshared],
[]],
[['src/fuzz/fuzz-udev-database.c'],
[libshared],
[]],
[['src/fuzz/fuzz-udev-rules.c'],
[libudevd_core,
libshared],
[threads,
libacl]],
[['src/fuzz/fuzz-compress.c'],
[libshared],
[]],
[['src/fuzz/fuzz-bus-label.c'],
[libshared],
[]],
[['src/fuzz/fuzz-env-file.c'],
[libshared],
[]],
[['src/fuzz/fuzz-hostname-setup.c'],
[libshared],
[]],
[['src/fuzz/fuzz-nspawn-settings.c'],
[libshared,
libnspawn_core],
[libseccomp]],
[['src/fuzz/fuzz-nspawn-oci.c'],
[libshared,
libnspawn_core],
[libseccomp]],
[['src/fuzz/fuzz-calendarspec.c'],
[libshared],
[]],
[['src/fuzz/fuzz-time-util.c'],
[libshared],
[]],
[['src/fuzz/fuzz-xdg-desktop.c',
'src/xdg-autostart-generator/xdg-autostart-service.h',
'src/xdg-autostart-generator/xdg-autostart-service.c'],
[],
[]],
[['src/fuzz/fuzz-udev-rule-parse-value.c'],
[libshared],
[]],
] ]

View File

@ -1,5 +1,7 @@
# SPDX-License-Identifier: LGPL-2.1-or-later # SPDX-License-Identifier: LGPL-2.1-or-later
home_includes = [includes, include_directories('.')]
systemd_homework_sources = files(''' systemd_homework_sources = files('''
home-util.c home-util.c
home-util.h home-util.h

View File

@ -73,7 +73,7 @@ tests += [
[['src/import/test-qcow2.c', [['src/import/test-qcow2.c',
'src/import/qcow2-util.c', 'src/import/qcow2-util.c',
'src/import/qcow2-util.h'], 'src/import/qcow2-util.h'],
[libshared], [],
[libz], [libz],
'HAVE_ZLIB', 'manual'], [], 'HAVE_ZLIB', 'manual'],
] ]

View File

@ -16,16 +16,15 @@ libsystemd_journal_remote_sources = files('''
'''.split()) '''.split())
if conf.get('HAVE_MICROHTTPD') == 1 if conf.get('HAVE_MICROHTTPD') == 1
libsystemd_journal_remote_sources += files(''' libsystemd_journal_remote_sources += files(
microhttpd-util.h 'microhttpd-util.h',
microhttpd-util.c 'microhttpd-util.c')
'''.split())
endif endif
libsystemd_journal_remote = static_library( libsystemd_journal_remote = static_library(
'systemd-journal-remote', 'systemd-journal-remote',
libsystemd_journal_remote_sources, libsystemd_journal_remote_sources,
include_directories : includes, include_directories : journal_includes,
dependencies : [threads, dependencies : [threads,
libmicrohttpd, libmicrohttpd,
libgnutls, libgnutls,
@ -75,3 +74,11 @@ if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
chmod 755 $DESTDIR/var/log/journal/remote || :''') chmod 755 $DESTDIR/var/log/journal/remote || :''')
endif endif
endif endif
############################################################
fuzzers += [
[['src/journal-remote/fuzz-journal-remote.c'],
[libsystemd_journal_remote,
libshared]],
]

View File

@ -1,70 +1,6 @@
# SPDX-License-Identifier: LGPL-2.1-or-later # SPDX-License-Identifier: LGPL-2.1-or-later
journal_client_sources = files(''' sources = files('''
audit-type.c
audit-type.h
catalog.c
catalog.h
compress.c
compress.h
journal-def.h
journal-file.c
journal-file.h
journal-send.c
journal-vacuum.c
journal-vacuum.h
journal-verify.c
journal-verify.h
lookup3.c
lookup3.h
mmap-cache.c
mmap-cache.h
sd-journal.c
'''.split())
if conf.get('HAVE_GCRYPT') == 1
journal_client_sources += files('''
journal-authenticate.c
journal-authenticate.h
fsprg.c
fsprg.h
'''.split())
endif
############################################################
audit_type_includes = [config_h,
missing_audit_h,
'linux/audit.h']
if conf.get('HAVE_AUDIT') == 1
audit_type_includes += 'libaudit.h'
endif
generate_audit_type_list = find_program('generate-audit_type-list.sh')
audit_type_list_txt = custom_target(
'audit_type-list.txt',
output : 'audit_type-list.txt',
command : [generate_audit_type_list, cpp] + audit_type_includes,
capture : true)
audit_type_to_name = custom_target(
'audit_type-to-name.h',
input : ['audit_type-to-name.awk', audit_type_list_txt],
output : 'audit_type-to-name.h',
command : [awk, '-f', '@INPUT0@', '@INPUT1@'],
capture : true)
journal_client_sources += [audit_type_to_name]
libjournal_client = static_library(
'journal-client',
journal_client_sources,
include_directories : includes,
c_args : ['-fvisibility=default'])
############################################################
libjournal_core_sources = files('''
journald-audit.c journald-audit.c
journald-audit.h journald-audit.h
journald-console.c journald-console.c
@ -85,20 +21,27 @@ libjournal_core_sources = files('''
journald-syslog.h journald-syslog.h
journald-wall.c journald-wall.c
journald-wall.h journald-wall.h
journal-internal.h
'''.split()) '''.split())
sources += custom_target(
'journald-gperf.c',
input : 'journald-gperf.gperf',
output : 'journald-gperf.c',
command : [gperf, '@INPUT@', '--output-file', '@OUTPUT@'])
libjournal_core = static_library(
'journal-core',
sources,
include_directories : includes,
install : false)
journal_includes = [includes, include_directories('.')]
systemd_journald_sources = files(''' systemd_journald_sources = files('''
journald.c journald.c
journald-server.h journald-server.h
'''.split()) '''.split())
journald_gperf_c = custom_target(
'journald-gperf.c',
input : 'journald-gperf.gperf',
output : 'journald-gperf.c',
command : [gperf, '@INPUT@', '--output-file', '@OUTPUT@'])
systemd_cat_sources = files('cat.c') systemd_cat_sources = files('cat.c')
journalctl_sources = files(''' journalctl_sources = files('''
@ -131,3 +74,60 @@ if get_option('create-log-dirs')
'setfacl -nm g:wheel:rx,d:g:wheel:rx $DESTDIR/var/log/journal || :') 'setfacl -nm g:wheel:rx,d:g:wheel:rx $DESTDIR/var/log/journal || :')
endif endif
endif endif
############################################################
tests += [
[['src/journal/test-journal-syslog.c'],
[libjournal_core,
libshared],
[threads,
libxz,
liblz4,
libselinux]],
[['src/journal/test-journal-config.c'],
[libjournal_core,
libshared],
[libxz,
liblz4,
libselinux]],
]
fuzzers += [
[['src/journal/fuzz-journald-audit.c',
'src/journal/fuzz-journald.c'],
[libjournal_core,
libshared],
[libselinux]],
[['src/journal/fuzz-journald-kmsg.c',
'src/journal/fuzz-journald.c'],
[libjournal_core,
libshared],
[libselinux]],
[['src/journal/fuzz-journald-native.c',
'src/journal/fuzz-journald.c'],
[libjournal_core,
libshared],
[libselinux]],
[['src/journal/fuzz-journald-native-fd.c',
'src/journal/fuzz-journald.c'],
[libjournal_core,
libshared],
[libselinux]],
[['src/journal/fuzz-journald-stream.c',
'src/journal/fuzz-journald.c'],
[libjournal_core,
libshared],
[libselinux]],
[['src/journal/fuzz-journald-syslog.c',
'src/journal/fuzz-journald.c'],
[libjournal_core,
libshared],
[libselinux]],
]

View File

@ -47,3 +47,73 @@ libsystemd_network = static_library(
'systemd-network', 'systemd-network',
sources, sources,
include_directories : includes) include_directories : includes)
libsystemd_network_includes = [includes, include_directories('.')]
############################################################
tests += [
[['src/libsystemd-network/test-dhcp-option.c'],
[libshared,
libsystemd_network]],
[['src/libsystemd-network/test-sd-dhcp-lease.c'],
[libshared,
libsystemd_network]],
[['src/libsystemd-network/test-dhcp-client.c'],
[libshared,
libsystemd_network]],
[['src/libsystemd-network/test-dhcp-server.c'],
[libshared,
libsystemd_network]],
[['src/libsystemd-network/test-ipv4ll.c'],
[libshared,
libsystemd_network]],
[['src/libsystemd-network/test-ipv4ll-manual.c'],
[libshared,
libsystemd_network],
[], [], '', 'manual'],
[['src/libsystemd-network/test-acd.c'],
[libshared,
libsystemd_network],
[], [], '', 'manual'],
[['src/libsystemd-network/test-ndisc-rs.c'],
[libshared,
libsystemd_network]],
[['src/libsystemd-network/test-ndisc-ra.c'],
[libshared,
libsystemd_network]],
[['src/libsystemd-network/test-dhcp6-client.c'],
[libshared,
libsystemd_network]],
[['src/libsystemd-network/test-lldp.c'],
[libshared,
libsystemd_network]],
]
fuzzers += [
[['src/libsystemd-network/fuzz-dhcp6-client.c'],
[libshared,
libsystemd_network]],
[['src/libsystemd-network/fuzz-dhcp-server.c'],
[libsystemd_network,
libshared]],
[['src/libsystemd-network/fuzz-lldp.c'],
[libshared,
libsystemd_network]],
[['src/libsystemd-network/fuzz-ndisc-rs.c'],
[libshared,
libsystemd_network]],
]

View File

@ -1,13 +1,72 @@
# SPDX-License-Identifier: LGPL-2.1-or-later # SPDX-License-Identifier: LGPL-2.1-or-later
sd_journal_sources = files(
'sd-journal/audit-type.c',
'sd-journal/audit-type.h',
'sd-journal/catalog.c',
'sd-journal/catalog.h',
'sd-journal/compress.c',
'sd-journal/compress.h',
'sd-journal/journal-def.h',
'sd-journal/journal-file.c',
'sd-journal/journal-file.h',
'sd-journal/journal-internal.h',
'sd-journal/journal-send.c',
'sd-journal/journal-vacuum.c',
'sd-journal/journal-vacuum.h',
'sd-journal/journal-verify.c',
'sd-journal/journal-verify.h',
'sd-journal/lookup3.c',
'sd-journal/lookup3.h',
'sd-journal/mmap-cache.c',
'sd-journal/mmap-cache.h',
'sd-journal/sd-journal.c')
if conf.get('HAVE_GCRYPT') == 1
sd_journal_sources += files(
'sd-journal/fsprg.c',
'sd-journal/fsprg.h',
'sd-journal/journal-authenticate.c',
'sd-journal/journal-authenticate.h')
endif
audit_type_includes = [config_h,
missing_audit_h,
'linux/audit.h']
if conf.get('HAVE_AUDIT') == 1
audit_type_includes += 'libaudit.h'
endif
generate_audit_type_list = find_program('sd-journal/generate-audit_type-list.sh')
audit_type_list_txt = custom_target(
'audit_type-list.txt',
output : 'audit_type-list.txt',
command : [generate_audit_type_list, cpp] + audit_type_includes,
capture : true)
audit_type_to_name = custom_target(
'audit_type-to-name.h',
input : ['sd-journal/audit_type-to-name.awk', audit_type_list_txt],
output : 'audit_type-to-name.h',
command : [awk, '-f', '@INPUT0@', '@INPUT1@'],
capture : true)
sd_journal_sources += [audit_type_to_name]
############################################################
id128_sources = files(''' id128_sources = files('''
sd-id128/id128-util.c sd-id128/id128-util.c
sd-id128/id128-util.h sd-id128/id128-util.h
sd-id128/sd-id128.c sd-id128/sd-id128.c
'''.split()) '''.split())
############################################################
sd_daemon_sources = files('sd-daemon/sd-daemon.c') sd_daemon_sources = files('sd-daemon/sd-daemon.c')
############################################################
sd_event_sources = files(''' sd_event_sources = files('''
sd-event/event-source.h sd-event/event-source.h
sd-event/event-util.c sd-event/event-util.c
@ -15,8 +74,12 @@ sd_event_sources = files('''
sd-event/sd-event.c sd-event/sd-event.c
'''.split()) '''.split())
############################################################
sd_login_sources = files('sd-login/sd-login.c') sd_login_sources = files('sd-login/sd-login.c')
############################################################
libsystemd_sources = files(''' libsystemd_sources = files('''
sd-bus/bus-common-errors.c sd-bus/bus-common-errors.c
sd-bus/bus-common-errors.h sd-bus/bus-common-errors.h
@ -91,7 +154,7 @@ libsystemd_sources = files('''
sd-resolve/resolve-private.h sd-resolve/resolve-private.h
sd-resolve/sd-resolve.c sd-resolve/sd-resolve.c
sd-utf8/sd-utf8.c sd-utf8/sd-utf8.c
'''.split()) + id128_sources + sd_daemon_sources + sd_event_sources + sd_login_sources '''.split()) + sd_journal_sources + id128_sources + sd_daemon_sources + sd_event_sources + sd_login_sources
disable_mempool_c = files('disable-mempool.c') disable_mempool_c = files('disable-mempool.c')
@ -101,16 +164,154 @@ libsystemd_static = static_library(
'systemd_static', 'systemd_static',
libsystemd_sources, libsystemd_sources,
install : false, install : false,
include_directories : includes, include_directories : libsystemd_includes,
link_with : libbasic, link_with : libbasic,
dependencies : [threads, dependencies : [threads,
librt], librt],
c_args : libsystemd_c_args) c_args : libsystemd_c_args)
libsystemd_sym = 'src/libsystemd/libsystemd.sym' libsystemd_sym = files('libsystemd.sym')
libsystemd_sym_path = join_paths(meson.current_source_dir(), 'libsystemd.sym')
static_libsystemd = get_option('static-libsystemd')
static_libsystemd_pic = static_libsystemd == 'true' or static_libsystemd == 'pic'
configure_file( configure_file(
input : 'libsystemd.pc.in', input : 'libsystemd.pc.in',
output : 'libsystemd.pc', output : 'libsystemd.pc',
configuration : substs, configuration : substs,
install_dir : pkgconfiglibdir == 'no' ? '' : pkgconfiglibdir) install_dir : pkgconfiglibdir == 'no' ? '' : pkgconfiglibdir)
############################################################
tests += [
[['src/libsystemd/sd-journal/test-journal.c']],
[['src/libsystemd/sd-journal/test-journal-send.c']],
[['src/libsystemd/sd-journal/test-journal-match.c']],
[['src/libsystemd/sd-journal/test-journal-enum.c'],
[], [], [], '', 'timeout=360'],
[['src/libsystemd/sd-journal/test-journal-stream.c']],
[['src/libsystemd/sd-journal/test-journal-flush.c']],
[['src/libsystemd/sd-journal/test-journal-init.c']],
[['src/libsystemd/sd-journal/test-journal-verify.c']],
[['src/libsystemd/sd-journal/test-journal-interleaving.c']],
[['src/libsystemd/sd-journal/test-mmap-cache.c']],
[['src/libsystemd/sd-journal/test-catalog.c']],
[['src/libsystemd/sd-journal/test-compress.c'],
[],
[liblz4,
libzstd,
libxz]],
[['src/libsystemd/sd-journal/test-compress-benchmark.c'],
[],
[liblz4,
libzstd,
libxz],
[], '', 'timeout=90'],
[['src/libsystemd/sd-journal/test-audit-type.c']],
]
############################################################
tests += [
[['src/libsystemd/sd-bus/test-bus-address.c'],
[],
[threads]],
[['src/libsystemd/sd-bus/test-bus-marshal.c'],
[],
[threads,
libglib,
libgobject,
libgio,
libdbus]],
[['src/libsystemd/sd-bus/test-bus-signature.c'],
[],
[threads]],
[['src/libsystemd/sd-bus/test-bus-queue-ref-cycle.c'],
[],
[threads]],
[['src/libsystemd/sd-bus/test-bus-watch-bind.c'],
[],
[threads],
[], '', 'timeout=120'],
[['src/libsystemd/sd-bus/test-bus-chat.c'],
[],
[threads]],
[['src/libsystemd/sd-bus/test-bus-cleanup.c'],
[],
[threads,
libseccomp]],
[['src/libsystemd/sd-bus/test-bus-track.c'],
[],
[libseccomp]],
[['src/libsystemd/sd-bus/test-bus-server.c'],
[],
[threads]],
[['src/libsystemd/sd-bus/test-bus-objects.c'],
[],
[threads]],
[['src/libsystemd/sd-bus/test-bus-vtable.c',
'src/libsystemd/sd-bus/test-vtable-data.h']],
[['src/libsystemd/sd-bus/test-bus-gvariant.c'],
[],
[libglib,
libgobject,
libgio]],
[['src/libsystemd/sd-bus/test-bus-creds.c']],
[['src/libsystemd/sd-bus/test-bus-match.c']],
[['src/libsystemd/sd-bus/test-bus-benchmark.c'],
[],
[threads],
[], '', 'manual'],
[['src/libsystemd/sd-bus/test-bus-introspect.c',
'src/libsystemd/sd-bus/test-vtable-data.h']],
[['src/libsystemd/sd-event/test-event.c']],
[['src/libsystemd/sd-netlink/test-netlink.c']],
[['src/libsystemd/sd-resolve/test-resolve.c'],
[],
[threads],
[], '', 'timeout=120'],
[['src/libsystemd/sd-login/test-login.c']],
[['src/libsystemd/sd-device/test-sd-device.c']],
[['src/libsystemd/sd-device/test-sd-device-monitor.c']],
]
if cxx_cmd != ''
tests += [
[['src/libsystemd/sd-bus/test-bus-vtable-cc.cc']],
]
endif

View File

@ -13,7 +13,6 @@
#include "bus-control.h" #include "bus-control.h"
#include "bus-internal.h" #include "bus-internal.h"
#include "bus-message.h" #include "bus-message.h"
#include "bus-util.h"
#include "capability-util.h" #include "capability-util.h"
#include "process-util.h" #include "process-util.h"
#include "stdio-util.h" #include "stdio-util.h"

View File

@ -7,7 +7,6 @@
#include "bus-message.h" #include "bus-message.h"
#include "bus-signature.h" #include "bus-signature.h"
#include "bus-type.h" #include "bus-type.h"
#include "bus-util.h"
#include "string-util.h" #include "string-util.h"
_public_ int sd_bus_emit_signalv( _public_ int sd_bus_emit_signalv(

View File

@ -8,7 +8,6 @@
#include "bus-creds.h" #include "bus-creds.h"
#include "bus-label.h" #include "bus-label.h"
#include "bus-message.h" #include "bus-message.h"
#include "bus-util.h"
#include "capability-util.h" #include "capability-util.h"
#include "cgroup-util.h" #include "cgroup-util.h"
#include "errno-util.h" #include "errno-util.h"

View File

@ -20,7 +20,6 @@
#include "bus-kernel.h" #include "bus-kernel.h"
#include "bus-label.h" #include "bus-label.h"
#include "bus-message.h" #include "bus-message.h"
#include "bus-util.h"
#include "capability-util.h" #include "capability-util.h"
#include "fd-util.h" #include "fd-util.h"
#include "fileio.h" #include "fileio.h"

View File

@ -4,7 +4,6 @@
#include "bus-internal.h" #include "bus-internal.h"
#include "bus-match.h" #include "bus-match.h"
#include "bus-message.h" #include "bus-message.h"
#include "bus-util.h"
#include "fd-util.h" #include "fd-util.h"
#include "fileio.h" #include "fileio.h"
#include "hexdecoct.h" #include "hexdecoct.h"

View File

@ -12,7 +12,6 @@
#include "bus-message.h" #include "bus-message.h"
#include "bus-signature.h" #include "bus-signature.h"
#include "bus-type.h" #include "bus-type.h"
#include "bus-util.h"
#include "fd-util.h" #include "fd-util.h"
#include "io-util.h" #include "io-util.h"
#include "memfd-util.h" #include "memfd-util.h"

View File

@ -8,7 +8,6 @@
#include "bus-signature.h" #include "bus-signature.h"
#include "bus-slot.h" #include "bus-slot.h"
#include "bus-type.h" #include "bus-type.h"
#include "bus-util.h"
#include "missing_capability.h" #include "missing_capability.h"
#include "set.h" #include "set.h"
#include "string-util.h" #include "string-util.h"

View File

@ -5,7 +5,6 @@
#include "alloc-util.h" #include "alloc-util.h"
#include "bus-internal.h" #include "bus-internal.h"
#include "bus-track.h" #include "bus-track.h"
#include "bus-util.h"
#include "string-util.h" #include "string-util.h"
struct track_item { struct track_item {

View File

@ -26,7 +26,6 @@
#include "bus-socket.h" #include "bus-socket.h"
#include "bus-track.h" #include "bus-track.h"
#include "bus-type.h" #include "bus-type.h"
#include "bus-util.h"
#include "cgroup-util.h" #include "cgroup-util.h"
#include "def.h" #include "def.h"
#include "errno-util.h" #include "errno-util.h"

View File

@ -8,10 +8,10 @@
#include "alloc-util.h" #include "alloc-util.h"
#include "bus-internal.h" #include "bus-internal.h"
#include "bus-kernel.h" #include "bus-kernel.h"
#include "bus-util.h"
#include "def.h" #include "def.h"
#include "fd-util.h" #include "fd-util.h"
#include "missing_resource.h" #include "missing_resource.h"
#include "string-util.h"
#include "time-util.h" #include "time-util.h"
#include "util.h" #include "util.h"

View File

@ -11,12 +11,12 @@
#include "bus-error.h" #include "bus-error.h"
#include "bus-internal.h" #include "bus-internal.h"
#include "bus-match.h" #include "bus-match.h"
#include "bus-util.h"
#include "errno-util.h" #include "errno-util.h"
#include "fd-util.h" #include "fd-util.h"
#include "format-util.h" #include "format-util.h"
#include "log.h" #include "log.h"
#include "macro.h" #include "macro.h"
#include "string-util.h"
#include "tests.h" #include "tests.h"
#include "util.h" #include "util.h"

View File

@ -6,7 +6,6 @@
#include "bus-internal.h" #include "bus-internal.h"
#include "bus-message.h" #include "bus-message.h"
#include "bus-util.h"
#include "tests.h" #include "tests.h"
static bool use_system_bus = false; static bool use_system_bus = false;

View File

@ -3,7 +3,6 @@
#include "sd-bus.h" #include "sd-bus.h"
#include "bus-dump.h" #include "bus-dump.h"
#include "bus-util.h"
#include "cgroup-util.h" #include "cgroup-util.h"
#include "tests.h" #include "tests.h"

View File

@ -2,11 +2,12 @@
#include "sd-bus.h" #include "sd-bus.h"
#include "alloc-util.h"
#include "bus-common-errors.h" #include "bus-common-errors.h"
#include "bus-error.h" #include "bus-error.h"
#include "bus-util.h"
#include "errno-list.h" #include "errno-list.h"
#include "errno-util.h" #include "errno-util.h"
#include "string-util.h"
static void test_error(void) { static void test_error(void) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL, second = SD_BUS_ERROR_NULL; _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL, second = SD_BUS_ERROR_NULL;

View File

@ -11,7 +11,6 @@
#include "bus-gvariant.h" #include "bus-gvariant.h"
#include "bus-internal.h" #include "bus-internal.h"
#include "bus-message.h" #include "bus-message.h"
#include "bus-util.h"
#include "macro.h" #include "macro.h"
#include "tests.h" #include "tests.h"
#include "util.h" #include "util.h"

View File

@ -3,7 +3,6 @@
#include "bus-match.h" #include "bus-match.h"
#include "bus-message.h" #include "bus-message.h"
#include "bus-slot.h" #include "bus-slot.h"
#include "bus-util.h"
#include "log.h" #include "log.h"
#include "macro.h" #include "macro.h"
#include "memory-util.h" #include "memory-util.h"

View File

@ -9,7 +9,6 @@
#include "bus-dump.h" #include "bus-dump.h"
#include "bus-internal.h" #include "bus-internal.h"
#include "bus-message.h" #include "bus-message.h"
#include "bus-util.h"
#include "log.h" #include "log.h"
#include "macro.h" #include "macro.h"
#include "strv.h" #include "strv.h"

View File

@ -6,10 +6,10 @@
#include "sd-bus.h" #include "sd-bus.h"
#include "bus-internal.h" #include "bus-internal.h"
#include "bus-util.h"
#include "log.h" #include "log.h"
#include "macro.h" #include "macro.h"
#include "memory-util.h" #include "memory-util.h"
#include "string-util.h"
struct context { struct context {
int fds[2]; int fds[2];

View File

@ -1,19 +1,25 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */ /* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <errno.h>
#include <pthread.h> #include <pthread.h>
#include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "sd-device.h" #include "sd-device.h"
#include "device-util.h" #include "device-util.h"
#include "macro.h"
#define handle_error_errno(error, msg) \
({ \
errno = abs(error); \
perror(msg); \
EXIT_FAILURE; \
})
static void* thread(void *p) { static void* thread(void *p) {
sd_device **d = p; sd_device **d = p;
assert_se(!(*d = sd_device_unref(*d))); *d = sd_device_unref(*d);
return NULL; return NULL;
} }
@ -22,18 +28,27 @@ int main(int argc, char *argv[]) {
sd_device *loopback; sd_device *loopback;
pthread_t t; pthread_t t;
const char *key, *value; const char *key, *value;
int r;
assert_se(unsetenv("SYSTEMD_MEMPOOL") == 0); unsetenv("SYSTEMD_MEMPOOL");
assert_se(sd_device_new_from_syspath(&loopback, "/sys/class/net/lo") >= 0); r = sd_device_new_from_syspath(&loopback, "/sys/class/net/lo");
if (r < 0)
return handle_error_errno(r, "Failed to create loopback device object");
FOREACH_DEVICE_PROPERTY(loopback, key, value) FOREACH_DEVICE_PROPERTY(loopback, key, value)
printf("%s=%s\n", key, value); printf("%s=%s\n", key, value);
assert_se(pthread_create(&t, NULL, thread, &loopback) == 0); r = pthread_create(&t, NULL, thread, &loopback);
assert_se(pthread_join(t, NULL) == 0); if (r != 0)
return handle_error_errno(r, "Failed to create thread");
assert_se(!loopback); r = pthread_join(t, NULL);
if (r != 0)
return handle_error_errno(r, "Failed to wait thread finished");
if (loopback)
return handle_error_errno(r, "loopback device is not unref()ed");
return 0; return 0;
} }

View File

@ -1,36 +0,0 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <pthread.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include "libudev.h"
#include "macro.h"
static void* thread(void *p) {
struct udev_device **d = p;
assert_se(!(*d = udev_device_unref(*d)));
return NULL;
}
int main(int argc, char *argv[]) {
struct udev_device *loopback;
pthread_t t;
assert_se(unsetenv("SYSTEMD_MEMPOOL") == 0);
assert_se(loopback = udev_device_new_from_syspath(NULL, "/sys/class/net/lo"));
assert_se(udev_device_get_properties_list_entry(loopback));
assert_se(pthread_create(&t, NULL, thread, &loopback) == 0);
assert_se(pthread_join(t, NULL) == 0);
assert_se(!loopback);
return 0;
}

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