mirror of
https://github.com/systemd/systemd
synced 2026-03-12 16:14:47 +01:00
Compare commits
30 Commits
5c17a470a7
...
bc32241e6a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bc32241e6a | ||
|
|
672e9aec1b | ||
|
|
2969369130 | ||
|
|
2d8c8549ab | ||
|
|
8d1c9489ef | ||
|
|
9d9fed9ef4 | ||
|
|
2669c66614 | ||
|
|
237f2da9d4 | ||
|
|
56d68e715b | ||
|
|
c716c2537f | ||
|
|
ba081955fc | ||
|
|
3d346b8106 | ||
|
|
ec77d1ab3b | ||
|
|
00dd6d7770 | ||
|
|
a0c2541b6b | ||
|
|
f407219cd1 | ||
|
|
e89f6ed476 | ||
|
|
cf5a2ee825 | ||
|
|
6fb61918cc | ||
|
|
6873d20392 | ||
|
|
75029e150b | ||
|
|
a2eb2267e4 | ||
|
|
a626cb15c0 | ||
|
|
63275a7032 | ||
|
|
cbe97b9c92 | ||
|
|
111a3aae71 | ||
|
|
aca591ac55 | ||
|
|
2d359acda5 | ||
|
|
47350c5fb6 | ||
|
|
5600a26114 |
233
meson.build
233
meson.build
@ -38,8 +38,8 @@ relative_source_path = run_command('realpath',
|
|||||||
project_source_root).stdout().strip()
|
project_source_root).stdout().strip()
|
||||||
conf.set_quoted('RELATIVE_SOURCE_PATH', relative_source_path)
|
conf.set_quoted('RELATIVE_SOURCE_PATH', relative_source_path)
|
||||||
|
|
||||||
conf.set('BUILD_MODE', 'BUILD_MODE_' + get_option('mode').to_upper(),
|
conf.set10('BUILD_MODE_DEVELOPER', get_option('mode') == 'developer',
|
||||||
description : 'tailor build to development or release builds')
|
description : 'tailor build to development or release builds')
|
||||||
|
|
||||||
want_ossfuzz = get_option('oss-fuzz')
|
want_ossfuzz = get_option('oss-fuzz')
|
||||||
want_libfuzzer = get_option('llvm-fuzz')
|
want_libfuzzer = get_option('llvm-fuzz')
|
||||||
@ -1117,7 +1117,7 @@ else
|
|||||||
libcurl = []
|
libcurl = []
|
||||||
endif
|
endif
|
||||||
conf.set10('HAVE_LIBCURL', have)
|
conf.set10('HAVE_LIBCURL', have)
|
||||||
conf.set10('CURL_NO_OLDIES', get_option('mode') == 'developer')
|
conf.set10('CURL_NO_OLDIES', conf.get('BUILD_MODE_DEVELOPER') == 1)
|
||||||
|
|
||||||
want_libidn = get_option('libidn')
|
want_libidn = get_option('libidn')
|
||||||
want_libidn2 = get_option('libidn2')
|
want_libidn2 = get_option('libidn2')
|
||||||
@ -1232,7 +1232,7 @@ conf.set10('HAVE_LIBFIDO2', have)
|
|||||||
want_tpm2 = get_option('tpm2')
|
want_tpm2 = get_option('tpm2')
|
||||||
if want_tpm2 != 'false' and not skip_deps
|
if want_tpm2 != 'false' and not skip_deps
|
||||||
tpm2 = dependency('tss2-esys tss2-rc tss2-mu',
|
tpm2 = dependency('tss2-esys tss2-rc tss2-mu',
|
||||||
required : want_tpm2 == 'true')
|
required : want_tpm2 == 'true')
|
||||||
have = tpm2.found()
|
have = tpm2.found()
|
||||||
else
|
else
|
||||||
have = false
|
have = false
|
||||||
@ -2329,7 +2329,7 @@ if conf.get('ENABLE_HOMED') == 1
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
foreach alias : (['halt', 'poweroff', 'reboot', 'shutdown'] +
|
foreach alias : (['halt', 'poweroff', 'reboot', 'shutdown'] +
|
||||||
(conf.get('HAVE_SYSV_COMPAT') == 1 ? ['runlevel', 'telinit'] : []))
|
(conf.get('HAVE_SYSV_COMPAT') == 1 ? ['runlevel', 'telinit'] : []))
|
||||||
meson.add_install_script(meson_make_symlink,
|
meson.add_install_script(meson_make_symlink,
|
||||||
join_paths(rootbindir, 'systemctl'),
|
join_paths(rootbindir, 'systemctl'),
|
||||||
join_paths(rootsbindir, alias))
|
join_paths(rootsbindir, alias))
|
||||||
@ -2750,14 +2750,14 @@ if conf.get('ENABLE_OOMD') == 1
|
|||||||
install_dir : rootlibexecdir)
|
install_dir : rootlibexecdir)
|
||||||
|
|
||||||
public_programs += executable(
|
public_programs += executable(
|
||||||
'oomctl',
|
'oomctl',
|
||||||
oomctl_sources,
|
oomctl_sources,
|
||||||
include_directories : includes,
|
include_directories : includes,
|
||||||
link_with : [libshared],
|
link_with : [libshared],
|
||||||
dependencies : [],
|
dependencies : [],
|
||||||
install_rpath : rootlibexecdir,
|
install_rpath : rootlibexecdir,
|
||||||
install : true,
|
install : true,
|
||||||
install_dir : rootbindir)
|
install_dir : rootbindir)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if conf.get('ENABLE_BINFMT') == 1
|
if conf.get('ENABLE_BINFMT') == 1
|
||||||
@ -3313,16 +3313,20 @@ custom_target(
|
|||||||
'systemd-runtest.env',
|
'systemd-runtest.env',
|
||||||
output : 'systemd-runtest.env',
|
output : 'systemd-runtest.env',
|
||||||
command : ['sh', '-c', '{ ' +
|
command : ['sh', '-c', '{ ' +
|
||||||
'echo SYSTEMD_TEST_DATA=@0@; '.format(join_paths(project_source_root, 'test')) +
|
'echo SYSTEMD_TEST_DATA=@0@; '.format(join_paths(project_source_root, 'test')) +
|
||||||
'echo SYSTEMD_CATALOG_DIR=@0@; '.format(join_paths(project_build_root, 'catalog')) +
|
'echo SYSTEMD_CATALOG_DIR=@0@; '.format(join_paths(project_build_root, 'catalog')) +
|
||||||
'} >@OUTPUT@'],
|
'} >@OUTPUT@'],
|
||||||
build_by_default : true)
|
build_by_default : true)
|
||||||
|
|
||||||
# We intentionally do not do inline initializations with definitions for
|
test_cflags = ['-DTEST_CODE=1']
|
||||||
# a bunch of _cleanup_ variables in tests, to ensure valgrind is triggered.
|
# We intentionally do not do inline initializations with definitions for a
|
||||||
# This triggers a lot of maybe-uninitialized false positives when the
|
# bunch of _cleanup_ variables in tests, to ensure valgrind is triggered if we
|
||||||
# combination of -O2 and -flto is used. Suppress them.
|
# use the variable unexpectedly. This triggers a lot of maybe-uninitialized
|
||||||
no_uninit = '-O2' in get_option('c_args') and '-flto=auto' in get_option('c_args') ? cc.first_supported_argument('-Wno-maybe-uninitialized') : []
|
# false positives when the combination of -O2 and -flto is used. Suppress them.
|
||||||
|
if '-O2' in get_option('c_args') and '-flto=auto' in get_option('c_args')
|
||||||
|
test_cflags += cc.first_supported_argument('-Wno-maybe-uninitialized')
|
||||||
|
endif
|
||||||
|
|
||||||
foreach tuple : tests
|
foreach tuple : tests
|
||||||
sources = tuple[0]
|
sources = tuple[0]
|
||||||
link_with = tuple.length() > 1 and tuple[1].length() > 0 ? tuple[1] : [libshared]
|
link_with = tuple.length() > 1 and tuple[1].length() > 0 ? tuple[1] : [libshared]
|
||||||
@ -3331,7 +3335,7 @@ foreach tuple : tests
|
|||||||
condition = tuple.length() > 4 ? tuple[4] : ''
|
condition = tuple.length() > 4 ? tuple[4] : ''
|
||||||
type = tuple.length() > 5 ? tuple[5] : ''
|
type = tuple.length() > 5 ? tuple[5] : ''
|
||||||
defs = tuple.length() > 6 ? tuple[6] : []
|
defs = tuple.length() > 6 ? tuple[6] : []
|
||||||
defs += no_uninit
|
defs += test_cflags
|
||||||
parallel = tuple.length() > 7 ? tuple[7] : true
|
parallel = tuple.length() > 7 ? tuple[7] : true
|
||||||
timeout = 30
|
timeout = 30
|
||||||
|
|
||||||
@ -3399,7 +3403,7 @@ exe = executable(
|
|||||||
'test-libudev-sym',
|
'test-libudev-sym',
|
||||||
test_libudev_sym_c,
|
test_libudev_sym_c,
|
||||||
include_directories : libudev_includes,
|
include_directories : libudev_includes,
|
||||||
c_args : ['-Wno-deprecated-declarations'] + no_uninit,
|
c_args : ['-Wno-deprecated-declarations'] + test_cflags,
|
||||||
link_with : [libudev],
|
link_with : [libudev],
|
||||||
build_by_default : want_tests != 'false',
|
build_by_default : want_tests != 'false',
|
||||||
install : install_tests,
|
install : install_tests,
|
||||||
@ -3412,7 +3416,7 @@ exe = executable(
|
|||||||
'test-libudev-static-sym',
|
'test-libudev-static-sym',
|
||||||
test_libudev_sym_c,
|
test_libudev_sym_c,
|
||||||
include_directories : libudev_includes,
|
include_directories : libudev_includes,
|
||||||
c_args : ['-Wno-deprecated-declarations'] + no_uninit,
|
c_args : ['-Wno-deprecated-declarations'] + test_cflags,
|
||||||
link_with : [install_libudev_static],
|
link_with : [install_libudev_static],
|
||||||
build_by_default : want_tests != 'false' and static_libudev_pic,
|
build_by_default : want_tests != 'false' and static_libudev_pic,
|
||||||
install : install_tests and static_libudev_pic,
|
install : install_tests and static_libudev_pic,
|
||||||
@ -3453,7 +3457,7 @@ foreach tuple : fuzzers
|
|||||||
include_directories : [incs, include_directories('src/fuzz')],
|
include_directories : [incs, include_directories('src/fuzz')],
|
||||||
link_with : link_with,
|
link_with : link_with,
|
||||||
dependencies : dependencies,
|
dependencies : dependencies,
|
||||||
c_args : defs,
|
c_args : defs + test_cflags,
|
||||||
link_args: link_args,
|
link_args: link_args,
|
||||||
install : false,
|
install : false,
|
||||||
build_by_default : fuzz_tests or fuzzer_build)
|
build_by_default : fuzz_tests or fuzzer_build)
|
||||||
@ -3640,7 +3644,7 @@ if dbus_docs.length() > 0
|
|||||||
'@INPUT@'],
|
'@INPUT@'],
|
||||||
input : dbus_docs)
|
input : dbus_docs)
|
||||||
|
|
||||||
if conf.get('BUILD_MODE') == 'BUILD_MODE_DEVELOPER'
|
if conf.get('BUILD_MODE_DEVELOPER') == 1
|
||||||
test('dbus-docs-fresh',
|
test('dbus-docs-fresh',
|
||||||
update_dbus_docs_py,
|
update_dbus_docs_py,
|
||||||
args : ['--build-dir=@0@'.format(project_build_root),
|
args : ['--build-dir=@0@'.format(project_build_root),
|
||||||
@ -3724,10 +3728,6 @@ alt_time_epoch = run_command('date', '-Is', '-u', '-d',
|
|||||||
status += [
|
status += [
|
||||||
'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)]
|
'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)]
|
||||||
|
|
||||||
status += [
|
|
||||||
'static libsystemd: @0@'.format(static_libsystemd),
|
|
||||||
'static libudev: @0@'.format(static_libudev)]
|
|
||||||
|
|
||||||
# TODO:
|
# TODO:
|
||||||
# CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
|
# CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
|
||||||
# CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
|
# CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
|
||||||
@ -3750,107 +3750,112 @@ found = []
|
|||||||
missing = []
|
missing = []
|
||||||
|
|
||||||
foreach tuple : [
|
foreach tuple : [
|
||||||
['libcryptsetup'],
|
# dependencies
|
||||||
['PAM'],
|
['ACL'],
|
||||||
['pwquality'],
|
|
||||||
['libfdisk'],
|
|
||||||
['p11kit'],
|
|
||||||
['libfido2'],
|
|
||||||
['tpm2'],
|
|
||||||
['AUDIT'],
|
['AUDIT'],
|
||||||
['IMA'],
|
|
||||||
['AppArmor'],
|
['AppArmor'],
|
||||||
['SELinux'],
|
['IMA'],
|
||||||
|
['PAM'],
|
||||||
['SECCOMP'],
|
['SECCOMP'],
|
||||||
|
['SELinux'],
|
||||||
['SMACK'],
|
['SMACK'],
|
||||||
['zlib'],
|
['blkid'],
|
||||||
['xz'],
|
['elfutils'],
|
||||||
|
['gcrypt'],
|
||||||
|
['gnutls'],
|
||||||
|
['libcryptsetup'],
|
||||||
|
['libcurl'],
|
||||||
|
['libfdisk'],
|
||||||
|
['libfido2'],
|
||||||
|
['libidn'],
|
||||||
|
['libidn2'],
|
||||||
|
['libiptc'],
|
||||||
|
['microhttpd'],
|
||||||
|
['openssl'],
|
||||||
|
['p11kit'],
|
||||||
|
['pcre2'],
|
||||||
|
['pwquality'],
|
||||||
|
['qrencode'],
|
||||||
|
['tpm2'],
|
||||||
|
['xkbcommon'],
|
||||||
|
|
||||||
|
# compression libs
|
||||||
['zstd'],
|
['zstd'],
|
||||||
['lz4'],
|
['lz4'],
|
||||||
|
['xz'],
|
||||||
|
['zlib'],
|
||||||
['bzip2'],
|
['bzip2'],
|
||||||
['ACL'],
|
|
||||||
['gcrypt'],
|
# components
|
||||||
['qrencode'],
|
|
||||||
['microhttpd'],
|
|
||||||
['gnutls'],
|
|
||||||
['openssl'],
|
|
||||||
['libcurl'],
|
|
||||||
['idn'],
|
|
||||||
['initrd'],
|
|
||||||
['compat-mutable-uid-boundaries'],
|
|
||||||
['nscd'],
|
|
||||||
['libidn2'],
|
|
||||||
['libidn'],
|
|
||||||
['libiptc'],
|
|
||||||
['elfutils'],
|
|
||||||
['binfmt'],
|
|
||||||
['repart'],
|
|
||||||
['vconsole'],
|
|
||||||
['quotacheck'],
|
|
||||||
['tmpfiles'],
|
|
||||||
['environment.d'],
|
|
||||||
['sysusers'],
|
|
||||||
['firstboot'],
|
|
||||||
['randomseed'],
|
|
||||||
['backlight'],
|
['backlight'],
|
||||||
['rfkill'],
|
['binfmt'],
|
||||||
['xdg-autostart'],
|
['coredump'],
|
||||||
|
['environment.d'],
|
||||||
|
['efi'],
|
||||||
|
['gnu-efi', have_gnu_efi],
|
||||||
|
['firstboot'],
|
||||||
|
['hibernate'],
|
||||||
|
['homed'],
|
||||||
|
['hostnamed'],
|
||||||
|
['hwdb'],
|
||||||
|
['importd'],
|
||||||
|
['initrd'],
|
||||||
|
['kernel-install', get_option('kernel-install')],
|
||||||
|
['localed'],
|
||||||
['logind'],
|
['logind'],
|
||||||
['machined'],
|
['machined'],
|
||||||
['portabled'],
|
|
||||||
['sysext'],
|
|
||||||
['userdb'],
|
|
||||||
['homed'],
|
|
||||||
['importd'],
|
|
||||||
['hostnamed'],
|
|
||||||
['timedated'],
|
|
||||||
['timesyncd'],
|
|
||||||
['localed'],
|
|
||||||
['networkd'],
|
['networkd'],
|
||||||
['resolve'],
|
|
||||||
['DNS-over-TLS(gnutls)', conf.get('DNS_OVER_TLS_USE_GNUTLS') == 1],
|
|
||||||
['DNS-over-TLS(openssl)', conf.get('DNS_OVER_TLS_USE_OPENSSL') == 1],
|
|
||||||
['coredump'],
|
|
||||||
['pstore'],
|
|
||||||
['oomd'],
|
|
||||||
['polkit'],
|
|
||||||
['legacy pkla', install_polkit_pkla],
|
|
||||||
['efi'],
|
|
||||||
['gnu-efi', have_gnu_efi],
|
|
||||||
['kmod'],
|
|
||||||
['xkbcommon'],
|
|
||||||
['pcre2'],
|
|
||||||
['blkid'],
|
|
||||||
['dbus'],
|
|
||||||
['glib'],
|
|
||||||
['nss-myhostname'],
|
['nss-myhostname'],
|
||||||
['nss-mymachines'],
|
['nss-mymachines'],
|
||||||
['nss-resolve'],
|
['nss-resolve'],
|
||||||
['nss-systemd'],
|
['nss-systemd'],
|
||||||
['hwdb'],
|
['oomd'],
|
||||||
|
['portabled'],
|
||||||
|
['pstore'],
|
||||||
|
['quotacheck'],
|
||||||
|
['randomseed'],
|
||||||
|
['repart'],
|
||||||
|
['resolve'],
|
||||||
|
['rfkill'],
|
||||||
|
['sysext'],
|
||||||
|
['systemd-analyze', conf.get('ENABLE_ANALYZE') == 1],
|
||||||
|
['sysusers'],
|
||||||
|
['timedated'],
|
||||||
|
['timesyncd'],
|
||||||
|
['tmpfiles'],
|
||||||
|
['userdb'],
|
||||||
|
['vconsole'],
|
||||||
|
['xdg-autostart'],
|
||||||
|
|
||||||
|
# optional features
|
||||||
|
['idn'],
|
||||||
|
['polkit'],
|
||||||
|
['nscd'],
|
||||||
|
['legacy-pkla', install_polkit_pkla],
|
||||||
|
['kmod'],
|
||||||
|
['dbus'],
|
||||||
|
['glib'],
|
||||||
['tpm'],
|
['tpm'],
|
||||||
['man pages', want_man],
|
['man pages', want_man],
|
||||||
['html pages', want_html],
|
['html pages', want_html],
|
||||||
['man page indices', want_man and have_lxml],
|
['man page indices', want_man and have_lxml],
|
||||||
['SysV compat'],
|
['SysV compat'],
|
||||||
|
['compat-mutable-uid-boundaries'],
|
||||||
['utmp'],
|
['utmp'],
|
||||||
['ldconfig'],
|
['ldconfig'],
|
||||||
['hibernate'],
|
['adm group', get_option('adm-group')],
|
||||||
['adm group', get_option('adm-group')],
|
['wheel group', get_option('wheel-group')],
|
||||||
['wheel group', get_option('wheel-group')],
|
|
||||||
['gshadow'],
|
['gshadow'],
|
||||||
['debug hashmap'],
|
['debug hashmap'],
|
||||||
['debug mmap cache'],
|
['debug mmap cache'],
|
||||||
['debug siphash'],
|
['debug siphash'],
|
||||||
['valgrind', conf.get('VALGRIND') == 1],
|
['valgrind', conf.get('VALGRIND') == 1],
|
||||||
['trace logging', conf.get('LOG_TRACE') == 1],
|
['trace logging', conf.get('LOG_TRACE') == 1],
|
||||||
['install tests', install_tests],
|
['install tests', install_tests],
|
||||||
['link-udev-shared', get_option('link-udev-shared')],
|
['link-udev-shared', get_option('link-udev-shared')],
|
||||||
['link-systemctl-shared', get_option('link-systemctl-shared')],
|
['link-systemctl-shared', get_option('link-systemctl-shared')],
|
||||||
['link-networkd-shared', get_option('link-networkd-shared')],
|
['link-networkd-shared', get_option('link-networkd-shared')],
|
||||||
['link-timesyncd-shared', get_option('link-timesyncd-shared')],
|
['link-timesyncd-shared', get_option('link-timesyncd-shared')],
|
||||||
['kernel-install', get_option('kernel-install')],
|
|
||||||
['systemd-analyze', conf.get('ENABLE_ANALYZE') == 1],
|
|
||||||
['fexecve'],
|
['fexecve'],
|
||||||
['standalone-binaries', get_option('standalone-binaries')],
|
['standalone-binaries', get_option('standalone-binaries')],
|
||||||
]
|
]
|
||||||
@ -3869,6 +3874,26 @@ foreach tuple : [
|
|||||||
endif
|
endif
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
|
if static_libsystemd == 'false'
|
||||||
|
missing += 'static-libsystemd'
|
||||||
|
else
|
||||||
|
found += 'static-libsystemd(@0@)'.format(static_libsystemd)
|
||||||
|
endif
|
||||||
|
|
||||||
|
if static_libudev == 'false'
|
||||||
|
missing += 'static-libudev'
|
||||||
|
else
|
||||||
|
found += 'static-libudev(@0@)'.format(static_libudev)
|
||||||
|
endif
|
||||||
|
|
||||||
|
if conf.get('DNS_OVER_TLS_USE_GNUTLS') == 1
|
||||||
|
found += 'DNS-over-TLS(gnutls)'
|
||||||
|
elif conf.get('DNS_OVER_TLS_USE_OPENSSL') == 1
|
||||||
|
found += 'DNS-over-TLS(openssl)'
|
||||||
|
else
|
||||||
|
missing += 'DNS-over-TLS'
|
||||||
|
endif
|
||||||
|
|
||||||
status += [
|
status += [
|
||||||
'',
|
'',
|
||||||
'enabled features: @0@'.format(', '.join(found)),
|
'enabled features: @0@'.format(', '.join(found)),
|
||||||
|
|||||||
@ -15,7 +15,6 @@
|
|||||||
#include "analyze-condition.h"
|
#include "analyze-condition.h"
|
||||||
#include "analyze-security.h"
|
#include "analyze-security.h"
|
||||||
#include "analyze-verify.h"
|
#include "analyze-verify.h"
|
||||||
#include "build.h"
|
|
||||||
#include "bus-error.h"
|
#include "bus-error.h"
|
||||||
#include "bus-locator.h"
|
#include "bus-locator.h"
|
||||||
#include "bus-map-properties.h"
|
#include "bus-map-properties.h"
|
||||||
@ -53,6 +52,7 @@
|
|||||||
#include "unit-name.h"
|
#include "unit-name.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "verbs.h"
|
#include "verbs.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
#define SCALE_X (0.1 / 1000.0) /* pixels per us */
|
#define SCALE_X (0.1 / 1000.0) /* pixels per us */
|
||||||
#define SCALE_Y (20.0)
|
#define SCALE_Y (20.0)
|
||||||
|
|||||||
@ -4,8 +4,3 @@
|
|||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
extern const char* const systemd_features;
|
extern const char* const systemd_features;
|
||||||
|
|
||||||
enum {
|
|
||||||
BUILD_MODE_DEVELOPER,
|
|
||||||
BUILD_MODE_RELEASE,
|
|
||||||
};
|
|
||||||
|
|||||||
@ -286,7 +286,7 @@ fail:
|
|||||||
/* OK, the operation failed, but let's see if the right
|
/* OK, the operation failed, but let's see if the right
|
||||||
* contents in place already. If so, eat up the error. */
|
* contents in place already. If so, eat up the error. */
|
||||||
|
|
||||||
q = verify_file(fn, line, !(flags & WRITE_STRING_FILE_AVOID_NEWLINE));
|
q = verify_file(fn, line, !(flags & WRITE_STRING_FILE_AVOID_NEWLINE) || (flags & WRITE_STRING_FILE_VERIFY_IGNORE_NEWLINE));
|
||||||
if (q <= 0)
|
if (q <= 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
|||||||
@ -15,16 +15,17 @@
|
|||||||
#define LONG_LINE_MAX (1U*1024U*1024U)
|
#define LONG_LINE_MAX (1U*1024U*1024U)
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
WRITE_STRING_FILE_CREATE = 1 << 0,
|
WRITE_STRING_FILE_CREATE = 1 << 0,
|
||||||
WRITE_STRING_FILE_TRUNCATE = 1 << 1,
|
WRITE_STRING_FILE_TRUNCATE = 1 << 1,
|
||||||
WRITE_STRING_FILE_ATOMIC = 1 << 2,
|
WRITE_STRING_FILE_ATOMIC = 1 << 2,
|
||||||
WRITE_STRING_FILE_AVOID_NEWLINE = 1 << 3,
|
WRITE_STRING_FILE_AVOID_NEWLINE = 1 << 3,
|
||||||
WRITE_STRING_FILE_VERIFY_ON_FAILURE = 1 << 4,
|
WRITE_STRING_FILE_VERIFY_ON_FAILURE = 1 << 4,
|
||||||
WRITE_STRING_FILE_SYNC = 1 << 5,
|
WRITE_STRING_FILE_VERIFY_IGNORE_NEWLINE = 1 << 5,
|
||||||
WRITE_STRING_FILE_DISABLE_BUFFER = 1 << 6,
|
WRITE_STRING_FILE_SYNC = 1 << 6,
|
||||||
WRITE_STRING_FILE_NOFOLLOW = 1 << 7,
|
WRITE_STRING_FILE_DISABLE_BUFFER = 1 << 7,
|
||||||
WRITE_STRING_FILE_MKDIR_0755 = 1 << 8,
|
WRITE_STRING_FILE_NOFOLLOW = 1 << 8,
|
||||||
WRITE_STRING_FILE_MODE_0600 = 1 << 9,
|
WRITE_STRING_FILE_MKDIR_0755 = 1 << 9,
|
||||||
|
WRITE_STRING_FILE_MODE_0600 = 1 << 10,
|
||||||
|
|
||||||
/* And before you wonder, why write_string_file_atomic_label_ts() is a separate function instead of just one
|
/* And before you wonder, why write_string_file_atomic_label_ts() is a separate function instead of just one
|
||||||
more flag here: it's about linking: we don't want to pull -lselinux into all users of write_string_file()
|
more flag here: it's about linking: we don't want to pull -lselinux into all users of write_string_file()
|
||||||
|
|||||||
@ -4,6 +4,7 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
|
|
||||||
#include "macro.h"
|
#include "macro.h"
|
||||||
@ -188,20 +189,39 @@ void log_assert_failed_return(
|
|||||||
log_dispatch_internal(level, error, PROJECT_FILE, __LINE__, __func__, NULL, NULL, NULL, NULL, buffer)
|
log_dispatch_internal(level, error, PROJECT_FILE, __LINE__, __func__, NULL, NULL, NULL, NULL, buffer)
|
||||||
|
|
||||||
/* Logging with level */
|
/* Logging with level */
|
||||||
#define log_full_errno(level, error, ...) \
|
#define log_full_errno_zerook(level, error, ...) \
|
||||||
({ \
|
({ \
|
||||||
int _level = (level), _e = (error); \
|
int _level = (level), _e = (error); \
|
||||||
(log_get_max_level() >= LOG_PRI(_level)) \
|
_e = (log_get_max_level() >= LOG_PRI(_level)) \
|
||||||
? log_internal(_level, _e, PROJECT_FILE, __LINE__, __func__, __VA_ARGS__) \
|
? log_internal(_level, _e, PROJECT_FILE, __LINE__, __func__, __VA_ARGS__) \
|
||||||
: -ERRNO_VALUE(_e); \
|
: -ERRNO_VALUE(_e); \
|
||||||
|
_e < 0 ? _e : -EIO; \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define log_full(level, ...) (void) log_full_errno((level), 0, __VA_ARGS__)
|
#if BUILD_MODE_DEVELOPER && !defined(TEST_CODE)
|
||||||
|
# define ASSERT_NON_ZERO(x) assert((x) != 0)
|
||||||
|
#else
|
||||||
|
# define ASSERT_NON_ZERO(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define log_full_errno(level, error, ...) \
|
||||||
|
({ \
|
||||||
|
int _error = (error); \
|
||||||
|
ASSERT_NON_ZERO(_error); \
|
||||||
|
log_full_errno_zerook(level, _error, __VA_ARGS__); \
|
||||||
|
})
|
||||||
|
|
||||||
|
#define log_full(level, fmt, ...) \
|
||||||
|
({ \
|
||||||
|
if (BUILD_MODE_DEVELOPER) \
|
||||||
|
assert(!strstr(fmt, "%m")); \
|
||||||
|
(void) log_full_errno_zerook(level, 0, fmt, ##__VA_ARGS__); \
|
||||||
|
})
|
||||||
|
|
||||||
int log_emergency_level(void);
|
int log_emergency_level(void);
|
||||||
|
|
||||||
/* Normal logging */
|
/* Normal logging */
|
||||||
#define log_debug(...) log_full_errno(LOG_DEBUG, 0, __VA_ARGS__)
|
#define log_debug(...) log_full(LOG_DEBUG, __VA_ARGS__)
|
||||||
#define log_info(...) log_full(LOG_INFO, __VA_ARGS__)
|
#define log_info(...) log_full(LOG_INFO, __VA_ARGS__)
|
||||||
#define log_notice(...) log_full(LOG_NOTICE, __VA_ARGS__)
|
#define log_notice(...) log_full(LOG_NOTICE, __VA_ARGS__)
|
||||||
#define log_warning(...) log_full(LOG_WARNING, __VA_ARGS__)
|
#define log_warning(...) log_full(LOG_WARNING, __VA_ARGS__)
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
#ifdef CAP_LAST_CAP
|
#ifdef CAP_LAST_CAP
|
||||||
# if CAP_LAST_CAP > SYSTEMD_CAP_LAST_CAP
|
# if CAP_LAST_CAP > SYSTEMD_CAP_LAST_CAP
|
||||||
# if BUILD_MODE == BUILD_MODE_DEVELOPER && defined(TEST_CAPABILITY_C)
|
# if BUILD_MODE_DEVELOPER && defined(TEST_CAPABILITY_C)
|
||||||
# warning "The capability list here is outdated"
|
# warning "The capability list here is outdated"
|
||||||
# endif
|
# endif
|
||||||
# else
|
# else
|
||||||
|
|||||||
@ -216,7 +216,7 @@ int bpf_devices_apply_policy(
|
|||||||
_cleanup_free_ char *controller_path = NULL;
|
_cleanup_free_ char *controller_path = NULL;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
/* This will assign *keep_program if everything goes well. */
|
/* This will assign *prog_installed if everything goes well. */
|
||||||
|
|
||||||
if (!prog)
|
if (!prog)
|
||||||
goto finish;
|
goto finish;
|
||||||
|
|||||||
@ -2015,7 +2015,7 @@ int config_parse_trigger_unit(
|
|||||||
assert(rvalue);
|
assert(rvalue);
|
||||||
assert(data);
|
assert(data);
|
||||||
|
|
||||||
if (!hashmap_isempty(u->dependencies[UNIT_TRIGGERS])) {
|
if (UNIT_TRIGGER(u)) {
|
||||||
log_syntax(unit, LOG_WARNING, filename, line, 0, "Multiple units to trigger specified, ignoring: %s", rvalue);
|
log_syntax(unit, LOG_WARNING, filename, line, 0, "Multiple units to trigger specified, ignoring: %s", rvalue);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -316,7 +316,7 @@ static int path_add_trigger_dependencies(Path *p) {
|
|||||||
|
|
||||||
assert(p);
|
assert(p);
|
||||||
|
|
||||||
if (!hashmap_isempty(UNIT(p)->dependencies[UNIT_TRIGGERS]))
|
if (UNIT_TRIGGER(UNIT(p)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
r = unit_load_related_unit(UNIT(p), ".service", &x);
|
r = unit_load_related_unit(UNIT(p), ".service", &x);
|
||||||
|
|||||||
@ -273,8 +273,9 @@ int mac_selinux_generic_access_check(
|
|||||||
sd_bus_error_set(error, SD_BUS_ERROR_ACCESS_DENIED, "SELinux policy denies access.");
|
sd_bus_error_set(error, SD_BUS_ERROR_ACCESS_DENIED, "SELinux policy denies access.");
|
||||||
}
|
}
|
||||||
|
|
||||||
log_debug_errno(r, "SELinux access check scon=%s tcon=%s tclass=%s perm=%s state=%s path=%s cmdline=%s: %m",
|
log_full_errno_zerook(LOG_DEBUG, r,
|
||||||
scon, fcon, tclass, permission, enforce ? "enforcing" : "permissive", path, cl);
|
"SELinux access check scon=%s tcon=%s tclass=%s perm=%s state=%s path=%s cmdline=%s: %m",
|
||||||
|
scon, fcon, tclass, permission, enforce ? "enforcing" : "permissive", path, cl);
|
||||||
return enforce ? r : 0;
|
return enforce ? r : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -124,7 +124,7 @@ static int timer_add_trigger_dependencies(Timer *t) {
|
|||||||
|
|
||||||
assert(t);
|
assert(t);
|
||||||
|
|
||||||
if (!hashmap_isempty(UNIT(t)->dependencies[UNIT_TRIGGERS]))
|
if (UNIT_TRIGGER(UNIT(t)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
r = unit_load_related_unit(UNIT(t), ".service", &x);
|
r = unit_load_related_unit(UNIT(t), ".service", &x);
|
||||||
|
|||||||
@ -3,11 +3,11 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#include "alloc-util.h"
|
#include "alloc-util.h"
|
||||||
#include "build.h"
|
|
||||||
#include "curl-util.h"
|
#include "curl-util.h"
|
||||||
#include "fd-util.h"
|
#include "fd-util.h"
|
||||||
#include "locale-util.h"
|
#include "locale-util.h"
|
||||||
#include "string-util.h"
|
#include "string-util.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
static void curl_glue_check_finished(CurlGlue *g) {
|
static void curl_glue_check_finished(CurlGlue *g) {
|
||||||
CURLMsg *msg;
|
CURLMsg *msg;
|
||||||
|
|||||||
@ -9,7 +9,6 @@
|
|||||||
#include "sd-daemon.h"
|
#include "sd-daemon.h"
|
||||||
|
|
||||||
#include "alloc-util.h"
|
#include "alloc-util.h"
|
||||||
#include "build.h"
|
|
||||||
#include "conf-parser.h"
|
#include "conf-parser.h"
|
||||||
#include "daemon-util.h"
|
#include "daemon-util.h"
|
||||||
#include "def.h"
|
#include "def.h"
|
||||||
@ -34,6 +33,7 @@
|
|||||||
#include "strv.h"
|
#include "strv.h"
|
||||||
#include "tmpfile-util.h"
|
#include "tmpfile-util.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
#define PRIV_KEY_FILE CERTIFICATE_ROOT "/private/journal-upload.pem"
|
#define PRIV_KEY_FILE CERTIFICATE_ROOT "/private/journal-upload.pem"
|
||||||
#define CERT_FILE CERTIFICATE_ROOT "/certs/journal-upload.pem"
|
#define CERT_FILE CERTIFICATE_ROOT "/certs/journal-upload.pem"
|
||||||
|
|||||||
@ -376,8 +376,8 @@ int server_open_dev_kmsg(Server *s) {
|
|||||||
|
|
||||||
s->dev_kmsg_fd = open("/dev/kmsg", mode);
|
s->dev_kmsg_fd = open("/dev/kmsg", mode);
|
||||||
if (s->dev_kmsg_fd < 0) {
|
if (s->dev_kmsg_fd < 0) {
|
||||||
log_full(errno == ENOENT ? LOG_DEBUG : LOG_WARNING,
|
log_full_errno(errno == ENOENT ? LOG_DEBUG : LOG_WARNING,
|
||||||
"Failed to open /dev/kmsg, ignoring: %m");
|
errno, "Failed to open /dev/kmsg, ignoring: %m");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -66,15 +66,13 @@ int dhcp_packet_verify_headers(DHCPPacket *packet, size_t len, bool checksum, ui
|
|||||||
#define DHCP_CLIENT_DONT_DESTROY(client) \
|
#define DHCP_CLIENT_DONT_DESTROY(client) \
|
||||||
_cleanup_(sd_dhcp_client_unrefp) _unused_ sd_dhcp_client *_dont_destroy_##client = sd_dhcp_client_ref(client)
|
_cleanup_(sd_dhcp_client_unrefp) _unused_ sd_dhcp_client *_dont_destroy_##client = sd_dhcp_client_ref(client)
|
||||||
|
|
||||||
#define log_dhcp_client_errno(client, error, fmt, ...) \
|
#define log_dhcp_client_errno(client, error, fmt, ...) \
|
||||||
({ \
|
log_interface_prefix_full_errno( \
|
||||||
int _e = (error); \
|
"DHCPv4 client: ", \
|
||||||
if (DEBUG_LOGGING) \
|
sd_dhcp_client_get_ifname(client), \
|
||||||
log_interface_full_errno( \
|
error, fmt, ##__VA_ARGS__)
|
||||||
sd_dhcp_client_get_ifname(client), \
|
|
||||||
LOG_DEBUG, _e, "DHCPv4 client: " fmt, \
|
|
||||||
##__VA_ARGS__); \
|
|
||||||
-ERRNO_VALUE(_e); \
|
|
||||||
})
|
|
||||||
#define log_dhcp_client(client, fmt, ...) \
|
#define log_dhcp_client(client, fmt, ...) \
|
||||||
log_dhcp_client_errno(client, 0, fmt, ##__VA_ARGS__)
|
log_interface_prefix_full_errno_zerook( \
|
||||||
|
"DHCPv4 client: ", \
|
||||||
|
sd_dhcp_client_get_ifname(client), \
|
||||||
|
0, fmt, ##__VA_ARGS__)
|
||||||
|
|||||||
@ -98,15 +98,13 @@ int dhcp_server_send_packet(sd_dhcp_server *server,
|
|||||||
void client_id_hash_func(const DHCPClientId *p, struct siphash *state);
|
void client_id_hash_func(const DHCPClientId *p, struct siphash *state);
|
||||||
int client_id_compare_func(const DHCPClientId *a, const DHCPClientId *b);
|
int client_id_compare_func(const DHCPClientId *a, const DHCPClientId *b);
|
||||||
|
|
||||||
#define log_dhcp_server_errno(server, error, fmt, ...) \
|
#define log_dhcp_server_errno(server, error, fmt, ...) \
|
||||||
({ \
|
log_interface_prefix_full_errno( \
|
||||||
int _e = (error); \
|
"DHCPv4 server: ", \
|
||||||
if (DEBUG_LOGGING) \
|
sd_dhcp_server_get_ifname(server), \
|
||||||
log_interface_full_errno( \
|
error, fmt, ##__VA_ARGS__)
|
||||||
sd_dhcp_server_get_ifname(server), \
|
|
||||||
LOG_DEBUG, _e, "DHCPv4 server: " fmt, \
|
|
||||||
##__VA_ARGS__); \
|
|
||||||
-ERRNO_VALUE(_e); \
|
|
||||||
})
|
|
||||||
#define log_dhcp_server(server, fmt, ...) \
|
#define log_dhcp_server(server, fmt, ...) \
|
||||||
log_dhcp_server_errno(server, 0, fmt, ##__VA_ARGS__)
|
log_interface_prefix_full_errno_zerook( \
|
||||||
|
"DHCPv4 server: ", \
|
||||||
|
sd_dhcp_server_get_ifname(server), \
|
||||||
|
0, fmt, ##__VA_ARGS__)
|
||||||
|
|||||||
@ -119,15 +119,13 @@ int dhcp6_message_type_from_string(const char *s) _pure_;
|
|||||||
const char *dhcp6_message_status_to_string(int s) _const_;
|
const char *dhcp6_message_status_to_string(int s) _const_;
|
||||||
int dhcp6_message_status_from_string(const char *s) _pure_;
|
int dhcp6_message_status_from_string(const char *s) _pure_;
|
||||||
|
|
||||||
#define log_dhcp6_client_errno(client, error, fmt, ...) \
|
#define log_dhcp6_client_errno(client, error, fmt, ...) \
|
||||||
({ \
|
log_interface_prefix_full_errno( \
|
||||||
int _e = (error); \
|
"DHCPv6 client: ", \
|
||||||
if (DEBUG_LOGGING) \
|
sd_dhcp6_client_get_ifname(client), \
|
||||||
log_interface_full_errno( \
|
error, fmt, ##__VA_ARGS__)
|
||||||
sd_dhcp6_client_get_ifname(client), \
|
#define log_dhcp6_client(client, fmt, ...) \
|
||||||
LOG_DEBUG, _e, "DHCPv6 client: " fmt, \
|
log_interface_prefix_full_errno_zerook( \
|
||||||
##__VA_ARGS__); \
|
"DHCPv6 client: ", \
|
||||||
-ERRNO_VALUE(_e); \
|
sd_dhcp6_client_get_ifname(client), \
|
||||||
})
|
0, fmt, ##__VA_ARGS__)
|
||||||
#define log_dhcp6_client(client, fmt, ...) \
|
|
||||||
log_dhcp6_client_errno(client, 0, fmt, ##__VA_ARGS__)
|
|
||||||
|
|||||||
@ -36,15 +36,13 @@ struct sd_lldp {
|
|||||||
const char* lldp_event_to_string(sd_lldp_event_t e) _const_;
|
const char* lldp_event_to_string(sd_lldp_event_t e) _const_;
|
||||||
sd_lldp_event_t lldp_event_from_string(const char *s) _pure_;
|
sd_lldp_event_t lldp_event_from_string(const char *s) _pure_;
|
||||||
|
|
||||||
#define log_lldp_errno(lldp, error, fmt, ...) \
|
#define log_lldp_errno(lldp, error, fmt, ...) \
|
||||||
({ \
|
log_interface_prefix_full_errno( \
|
||||||
int _e = (error); \
|
"LLDP: ", \
|
||||||
if (DEBUG_LOGGING) \
|
sd_lldp_get_ifname(lldp), \
|
||||||
log_interface_full_errno( \
|
error, fmt, ##__VA_ARGS__)
|
||||||
sd_lldp_get_ifname(lldp), \
|
#define log_lldp(lldp, fmt, ...) \
|
||||||
LOG_DEBUG, _e, "LLDP: " fmt, \
|
log_interface_prefix_full_errno_zerook( \
|
||||||
##__VA_ARGS__); \
|
"LLDP: ", \
|
||||||
-ERRNO_VALUE(_e); \
|
sd_lldp_get_ifname(lldp), \
|
||||||
})
|
0, fmt, ##__VA_ARGS__)
|
||||||
#define log_lldp(lldp, fmt, ...) \
|
|
||||||
log_lldp_errno(lldp, 0, fmt, ##__VA_ARGS__)
|
|
||||||
|
|||||||
@ -41,15 +41,13 @@ struct sd_ndisc {
|
|||||||
const char* ndisc_event_to_string(sd_ndisc_event_t e) _const_;
|
const char* ndisc_event_to_string(sd_ndisc_event_t e) _const_;
|
||||||
sd_ndisc_event_t ndisc_event_from_string(const char *s) _pure_;
|
sd_ndisc_event_t ndisc_event_from_string(const char *s) _pure_;
|
||||||
|
|
||||||
#define log_ndisc_errno(ndisc, error, fmt, ...) \
|
#define log_ndisc_errno(ndisc, error, fmt, ...) \
|
||||||
({ \
|
log_interface_prefix_full_errno( \
|
||||||
int _e = (error); \
|
"NDISC: ", \
|
||||||
if (DEBUG_LOGGING) \
|
sd_ndisc_get_ifname(ndisc), \
|
||||||
log_interface_full_errno( \
|
error, fmt, ##__VA_ARGS__)
|
||||||
sd_ndisc_get_ifname(ndisc), \
|
#define log_ndisc(ndisc, fmt, ...) \
|
||||||
LOG_DEBUG, _e, "NDISC: " fmt, \
|
log_interface_prefix_full_errno_zerook( \
|
||||||
##__VA_ARGS__); \
|
"NDISC: ", \
|
||||||
-ERRNO_VALUE(_e); \
|
sd_ndisc_get_ifname(ndisc), \
|
||||||
})
|
0, fmt, ##__VA_ARGS__)
|
||||||
#define log_ndisc(ndisc, fmt, ...) \
|
|
||||||
log_ndisc_errno(ndisc, 0, fmt, ##__VA_ARGS__)
|
|
||||||
|
|||||||
@ -125,15 +125,13 @@ struct sd_radv_route_prefix {
|
|||||||
LIST_FIELDS(struct sd_radv_route_prefix, prefix);
|
LIST_FIELDS(struct sd_radv_route_prefix, prefix);
|
||||||
};
|
};
|
||||||
|
|
||||||
#define log_radv_errno(radv, error, fmt, ...) \
|
#define log_radv_errno(radv, error, fmt, ...) \
|
||||||
({ \
|
log_interface_prefix_full_errno( \
|
||||||
int _e = (error); \
|
"RADV: ", \
|
||||||
if (DEBUG_LOGGING) \
|
sd_radv_get_ifname(radv), \
|
||||||
log_interface_full_errno( \
|
error, fmt, ##__VA_ARGS__)
|
||||||
sd_radv_get_ifname(radv), \
|
#define log_radv(radv, fmt, ...) \
|
||||||
LOG_DEBUG, _e, "RADV: " fmt, \
|
log_interface_prefix_full_errno_zerook( \
|
||||||
##__VA_ARGS__); \
|
"RADV: ", \
|
||||||
-ERRNO_VALUE(_e); \
|
sd_radv_get_ifname(radv), \
|
||||||
})
|
0, fmt, ##__VA_ARGS__)
|
||||||
#define log_radv(radv, fmt, ...) \
|
|
||||||
log_radv_errno(radv, 0, fmt, ##__VA_ARGS__)
|
|
||||||
|
|||||||
@ -75,18 +75,16 @@ struct sd_ipv4acd {
|
|||||||
void* userdata;
|
void* userdata;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define log_ipv4acd_errno(acd, error, fmt, ...) \
|
#define log_ipv4acd_errno(acd, error, fmt, ...) \
|
||||||
({ \
|
log_interface_prefix_full_errno( \
|
||||||
int _e = (error); \
|
"IPv4ACD: ", \
|
||||||
if (DEBUG_LOGGING) \
|
sd_ipv4acd_get_ifname(acd), \
|
||||||
log_interface_full_errno( \
|
error, fmt, ##__VA_ARGS__)
|
||||||
sd_ipv4acd_get_ifname(acd), \
|
|
||||||
LOG_DEBUG, _e, "IPv4ACD: " fmt, \
|
|
||||||
##__VA_ARGS__); \
|
|
||||||
-ERRNO_VALUE(_e); \
|
|
||||||
})
|
|
||||||
#define log_ipv4acd(acd, fmt, ...) \
|
#define log_ipv4acd(acd, fmt, ...) \
|
||||||
log_ipv4acd_errno(acd, 0, fmt, ##__VA_ARGS__)
|
log_interface_prefix_full_errno_zerook( \
|
||||||
|
"IPv4ACD: ", \
|
||||||
|
sd_ipv4acd_get_ifname(acd), \
|
||||||
|
0, fmt, ##__VA_ARGS__)
|
||||||
|
|
||||||
static const char * const ipv4acd_state_table[_IPV4ACD_STATE_MAX] = {
|
static const char * const ipv4acd_state_table[_IPV4ACD_STATE_MAX] = {
|
||||||
[IPV4ACD_STATE_INIT] = "init",
|
[IPV4ACD_STATE_INIT] = "init",
|
||||||
|
|||||||
@ -49,18 +49,16 @@ struct sd_ipv4ll {
|
|||||||
void* userdata;
|
void* userdata;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define log_ipv4ll_errno(ll, error, fmt, ...) \
|
#define log_ipv4ll_errno(ll, error, fmt, ...) \
|
||||||
({ \
|
log_interface_prefix_full_errno( \
|
||||||
int _e = (error); \
|
"IPv4LL: ", \
|
||||||
if (DEBUG_LOGGING) \
|
sd_ipv4ll_get_ifname(ll), \
|
||||||
log_interface_full_errno( \
|
error, fmt, ##__VA_ARGS__)
|
||||||
sd_ipv4ll_get_ifname(ll), \
|
|
||||||
LOG_DEBUG, _e, "IPv4LL: " fmt, \
|
|
||||||
##__VA_ARGS__); \
|
|
||||||
-ERRNO_VALUE(_e); \
|
|
||||||
})
|
|
||||||
#define log_ipv4ll(ll, fmt, ...) \
|
#define log_ipv4ll(ll, fmt, ...) \
|
||||||
log_ipv4ll_errno(ll, 0, fmt, ##__VA_ARGS__)
|
log_interface_prefix_full_errno_zerook( \
|
||||||
|
"IPv4LL: ", \
|
||||||
|
sd_ipv4ll_get_ifname(ll), \
|
||||||
|
0, fmt, ##__VA_ARGS__)
|
||||||
|
|
||||||
static void ipv4ll_on_acd(sd_ipv4acd *ll, int event, void *userdata);
|
static void ipv4ll_on_acd(sd_ipv4acd *ll, int event, void *userdata);
|
||||||
|
|
||||||
|
|||||||
@ -45,22 +45,29 @@
|
|||||||
device; \
|
device; \
|
||||||
device = sd_device_enumerator_get_subsystem_next(enumerator))
|
device = sd_device_enumerator_get_subsystem_next(enumerator))
|
||||||
|
|
||||||
#define log_device_full_errno(device, level, error, ...) \
|
#define log_device_full_errno_zerook(device, level, error, ...) \
|
||||||
({ \
|
({ \
|
||||||
const char *_sysname = NULL; \
|
const char *_sysname = NULL; \
|
||||||
sd_device *_d = (device); \
|
sd_device *_d = (device); \
|
||||||
int _level = (level), _error = (error); \
|
int _level = (level), _e = (error); \
|
||||||
\
|
\
|
||||||
if (_d && _unlikely_(log_get_max_level() >= LOG_PRI(_level))) \
|
if (_d && _unlikely_(log_get_max_level() >= LOG_PRI(_level))) \
|
||||||
(void) sd_device_get_sysname(_d, &_sysname); \
|
(void) sd_device_get_sysname(_d, &_sysname); \
|
||||||
log_object_internal(_level, _error, PROJECT_FILE, __LINE__, __func__, \
|
log_object_internal(_level, _e, PROJECT_FILE, __LINE__, __func__, \
|
||||||
_sysname ? "DEVICE=" : NULL, _sysname, \
|
_sysname ? "DEVICE=" : NULL, _sysname, \
|
||||||
NULL, NULL, __VA_ARGS__); \
|
NULL, NULL, __VA_ARGS__); \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define log_device_full(device, level, ...) (void) log_device_full_errno(device, level, 0, __VA_ARGS__)
|
#define log_device_full_errno(device, level, error, ...) \
|
||||||
|
({ \
|
||||||
|
int _error = (error); \
|
||||||
|
ASSERT_NON_ZERO(_error); \
|
||||||
|
log_device_full_errno_zerook(device, level, _error, __VA_ARGS__); \
|
||||||
|
})
|
||||||
|
|
||||||
#define log_device_debug(device, ...) log_device_full_errno(device, LOG_DEBUG, 0, __VA_ARGS__)
|
#define log_device_full(device, level, ...) (void) log_device_full_errno_zerook(device, level, 0, __VA_ARGS__)
|
||||||
|
|
||||||
|
#define log_device_debug(device, ...) log_device_full(device, LOG_DEBUG, __VA_ARGS__)
|
||||||
#define log_device_info(device, ...) log_device_full(device, LOG_INFO, __VA_ARGS__)
|
#define log_device_info(device, ...) log_device_full(device, LOG_INFO, __VA_ARGS__)
|
||||||
#define log_device_notice(device, ...) log_device_full(device, LOG_NOTICE, __VA_ARGS__)
|
#define log_device_notice(device, ...) log_device_full(device, LOG_NOTICE, __VA_ARGS__)
|
||||||
#define log_device_warning(device, ...) log_device_full(device, LOG_WARNING, __VA_ARGS__)
|
#define log_device_warning(device, ...) log_device_full(device, LOG_WARNING, __VA_ARGS__)
|
||||||
|
|||||||
@ -178,13 +178,12 @@ int device_set_syspath(sd_device *device, const char *_syspath, bool verify) {
|
|||||||
|
|
||||||
/* all 'devices' require an 'uevent' file */
|
/* all 'devices' require an 'uevent' file */
|
||||||
path = strjoina(syspath, "/uevent");
|
path = strjoina(syspath, "/uevent");
|
||||||
r = access(path, F_OK);
|
if (access(path, F_OK) < 0) {
|
||||||
if (r < 0) {
|
|
||||||
if (errno == ENOENT)
|
if (errno == ENOENT)
|
||||||
/* this is not a valid device */
|
/* this is not a valid device */
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
return log_debug_errno(errno, "sd-device: %s does not have an uevent file: %m", syspath);
|
return log_debug_errno(errno, "sd-device: cannot access uevent file for %s: %m", syspath);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* everything else just needs to be a directory */
|
/* everything else just needs to be a directory */
|
||||||
|
|||||||
@ -6,7 +6,6 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "alloc-util.h"
|
#include "alloc-util.h"
|
||||||
#include "build.h"
|
|
||||||
#include "fd-util.h"
|
#include "fd-util.h"
|
||||||
#include "libudev-list-internal.h"
|
#include "libudev-list-internal.h"
|
||||||
#include "libudev-util.h"
|
#include "libudev-util.h"
|
||||||
@ -15,6 +14,7 @@
|
|||||||
#include "stdio-util.h"
|
#include "stdio-util.h"
|
||||||
#include "string-util.h"
|
#include "string-util.h"
|
||||||
#include "tests.h"
|
#include "tests.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
static bool arg_monitor = false;
|
static bool arg_monitor = false;
|
||||||
|
|
||||||
|
|||||||
@ -268,8 +268,8 @@ static int manager_enumerate_seats(Manager *m) {
|
|||||||
s = hashmap_get(m->seats, de->d_name);
|
s = hashmap_get(m->seats, de->d_name);
|
||||||
if (!s) {
|
if (!s) {
|
||||||
if (unlinkat(dirfd(d), de->d_name, 0) < 0)
|
if (unlinkat(dirfd(d), de->d_name, 0) < 0)
|
||||||
log_warning("Failed to remove /run/systemd/seats/%s: %m",
|
log_warning_errno(errno, "Failed to remove /run/systemd/seats/%s: %m",
|
||||||
de->d_name);
|
de->d_name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -208,8 +208,10 @@ int link_set_bridge_mdb(Link *link) {
|
|||||||
if (hashmap_isempty(link->network->mdb_entries_by_section))
|
if (hashmap_isempty(link->network->mdb_entries_by_section))
|
||||||
goto finish;
|
goto finish;
|
||||||
|
|
||||||
if (!link_has_carrier(link))
|
if (!link_has_carrier(link)) {
|
||||||
return log_link_debug(link, "Link does not have carrier yet, setting MDB entries later.");
|
log_link_debug(link, "Link does not have carrier yet, setting MDB entries later.");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (link->network->bridge) {
|
if (link->network->bridge) {
|
||||||
Link *master;
|
Link *master;
|
||||||
@ -218,8 +220,10 @@ int link_set_bridge_mdb(Link *link) {
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_link_error_errno(link, r, "Failed to get Link object for Bridge=%s", link->network->bridge->ifname);
|
return log_link_error_errno(link, r, "Failed to get Link object for Bridge=%s", link->network->bridge->ifname);
|
||||||
|
|
||||||
if (!link_has_carrier(master))
|
if (!link_has_carrier(master)) {
|
||||||
return log_link_debug(link, "Bridge interface %s does not have carrier yet, setting MDB entries later.", link->network->bridge->ifname);
|
log_link_debug(link, "Bridge interface %s does not have carrier yet, setting MDB entries later.", link->network->bridge->ifname);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
} else if (!streq_ptr(link->kind, "bridge")) {
|
} else if (!streq_ptr(link->kind, "bridge")) {
|
||||||
log_link_warning(link, "Link is neither a bridge master nor a bridge port, ignoring [BridgeMDB] sections.");
|
log_link_warning(link, "Link is neither a bridge master nor a bridge port, ignoring [BridgeMDB] sections.");
|
||||||
|
|||||||
@ -711,8 +711,10 @@ int manager_rtnl_process_nexthop(sd_netlink *rtnl, sd_netlink_message *message,
|
|||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
log_link_warning_errno(link, r, "rtnl: could not get nexthop family, ignoring: %m");
|
log_link_warning_errno(link, r, "rtnl: could not get nexthop family, ignoring: %m");
|
||||||
return 0;
|
return 0;
|
||||||
} else if (!IN_SET(tmp->family, AF_INET, AF_INET6))
|
} else if (!IN_SET(tmp->family, AF_INET, AF_INET6)) {
|
||||||
return log_link_debug(link, "rtnl: received nexthop message with invalid family %d, ignoring.", tmp->family);
|
log_link_debug(link, "rtnl: received nexthop message with invalid family %d, ignoring.", tmp->family);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
r = sd_rtnl_message_nexthop_get_protocol(message, &tmp->protocol);
|
r = sd_rtnl_message_nexthop_get_protocol(message, &tmp->protocol);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
|
|||||||
@ -3830,7 +3830,7 @@ static int parse_efi_variable_factory_reset(void) {
|
|||||||
|
|
||||||
arg_factory_reset = r;
|
arg_factory_reset = r;
|
||||||
if (r)
|
if (r)
|
||||||
log_notice("Honouring factory reset requested via EFI variable FactoryReset: %m");
|
log_notice("Factory reset requested via EFI variable FactoryReset.");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -262,7 +262,7 @@ static int run(int argc, char *argv[]) {
|
|||||||
if (k < 0)
|
if (k < 0)
|
||||||
log_debug_errno(errno, "Failed to read random data with getrandom(), falling back to /dev/urandom: %m");
|
log_debug_errno(errno, "Failed to read random data with getrandom(), falling back to /dev/urandom: %m");
|
||||||
else if ((size_t) k < buf_size)
|
else if ((size_t) k < buf_size)
|
||||||
log_debug("Short read from getrandom(), falling back to /dev/urandom: %m");
|
log_debug("Short read from getrandom(), falling back to /dev/urandom.");
|
||||||
else
|
else
|
||||||
getrandom_worked = true;
|
getrandom_worked = true;
|
||||||
|
|
||||||
|
|||||||
@ -306,7 +306,8 @@ int bus_wait_for_jobs(BusWaitForJobs *d, bool quiet, const char* const* extra_ar
|
|||||||
if (q < 0 && r == 0)
|
if (q < 0 && r == 0)
|
||||||
r = q;
|
r = q;
|
||||||
|
|
||||||
log_debug_errno(q, "Got result %s/%m for job %s", d->result, d->name);
|
log_full_errno_zerook(LOG_DEBUG, q,
|
||||||
|
"Got result %s/%m for job %s", d->result, d->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
d->name = mfree(d->name);
|
d->name = mfree(d->name);
|
||||||
|
|||||||
@ -3,13 +3,38 @@
|
|||||||
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
#define log_interface_full_errno(ifname, level, error, ...) \
|
#define log_interface_full_errno_zerook(ifname, level, error, ...) \
|
||||||
({ \
|
({ \
|
||||||
const char *_ifname = (ifname); \
|
const char *_ifname = (ifname); \
|
||||||
_ifname ? log_object_internal(level, error, PROJECT_FILE, __LINE__, __func__, "INTERFACE=", _ifname, NULL, NULL, ##__VA_ARGS__) : \
|
_ifname ? log_object_internal(level, error, PROJECT_FILE, __LINE__, __func__, "INTERFACE=", _ifname, NULL, NULL, ##__VA_ARGS__) : \
|
||||||
log_internal(level, error, PROJECT_FILE, __LINE__, __func__, ##__VA_ARGS__); \
|
log_internal(level, error, PROJECT_FILE, __LINE__, __func__, ##__VA_ARGS__); \
|
||||||
})
|
})
|
||||||
|
|
||||||
|
#define log_interface_full_errno(ifname, level, error, ...) \
|
||||||
|
({ \
|
||||||
|
int _error = (error); \
|
||||||
|
ASSERT_NON_ZERO(_error); \
|
||||||
|
log_interface_full_errno_zerook(ifname, level, _error, __VA_ARGS__); \
|
||||||
|
})
|
||||||
|
|
||||||
|
#define log_interface_prefix_full_errno_zerook(prefix, ifname_expr, error, fmt, ...) \
|
||||||
|
({ \
|
||||||
|
int _e = (error); \
|
||||||
|
if (DEBUG_LOGGING) \
|
||||||
|
log_interface_full_errno_zerook( \
|
||||||
|
ifname_expr, \
|
||||||
|
LOG_DEBUG, _e, prefix fmt, \
|
||||||
|
##__VA_ARGS__); \
|
||||||
|
-ERRNO_VALUE(_e); \
|
||||||
|
})
|
||||||
|
|
||||||
|
#define log_interface_prefix_full_errno(prefix, ifname_expr, error, fmt, ...) \
|
||||||
|
({ \
|
||||||
|
int _error = (error); \
|
||||||
|
ASSERT_NON_ZERO(_error); \
|
||||||
|
log_interface_prefix_full_errno_zerook(prefix, ifname_expr, _error, fmt, ##__VA_ARGS__); \
|
||||||
|
})
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The following macros append INTERFACE= to the message.
|
* The following macros append INTERFACE= to the message.
|
||||||
* The macros require a struct named 'Link' which contains 'char *ifname':
|
* The macros require a struct named 'Link' which contains 'char *ifname':
|
||||||
@ -21,15 +46,22 @@
|
|||||||
* See, network/networkd-link.h for example.
|
* See, network/networkd-link.h for example.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define log_link_full_errno(link, level, error, ...) \
|
#define log_link_full_errno_zerook(link, level, error, ...) \
|
||||||
({ \
|
({ \
|
||||||
const Link *_l = (link); \
|
const Link *_l = (link); \
|
||||||
log_interface_full_errno(_l ? _l->ifname : NULL, level, error, ##__VA_ARGS__); \
|
log_interface_full_errno_zerook(_l ? _l->ifname : NULL, level, error, __VA_ARGS__); \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define log_link_full(link, level, ...) (void) log_link_full_errno(link, level, 0, __VA_ARGS__)
|
#define log_link_full_errno(link, level, error, ...) \
|
||||||
|
({ \
|
||||||
|
int _error = (error); \
|
||||||
|
ASSERT_NON_ZERO(_error); \
|
||||||
|
log_link_full_errno_zerook(link, level, _error, __VA_ARGS__); \
|
||||||
|
})
|
||||||
|
|
||||||
#define log_link_debug(link, ...) log_link_full_errno(link, LOG_DEBUG, 0, __VA_ARGS__)
|
#define log_link_full(link, level, ...) (void) log_link_full_errno_zerook(link, level, 0, __VA_ARGS__)
|
||||||
|
|
||||||
|
#define log_link_debug(link, ...) log_link_full(link, LOG_DEBUG, __VA_ARGS__)
|
||||||
#define log_link_info(link, ...) log_link_full(link, LOG_INFO, __VA_ARGS__)
|
#define log_link_info(link, ...) log_link_full(link, LOG_INFO, __VA_ARGS__)
|
||||||
#define log_link_notice(link, ...) log_link_full(link, LOG_NOTICE, __VA_ARGS__)
|
#define log_link_notice(link, ...) log_link_full(link, LOG_NOTICE, __VA_ARGS__)
|
||||||
#define log_link_warning(link, ...) log_link_full(link, LOG_WARNING, __VA_ARGS__)
|
#define log_link_warning(link, ...) log_link_full(link, LOG_WARNING, __VA_ARGS__)
|
||||||
|
|||||||
@ -20,11 +20,10 @@ int module_load_and_warn(struct kmod_ctx *ctx, const char *module, bool verbose)
|
|||||||
return log_full_errno(verbose ? LOG_ERR : LOG_DEBUG, r,
|
return log_full_errno(verbose ? LOG_ERR : LOG_DEBUG, r,
|
||||||
"Failed to look up module alias '%s': %m", module);
|
"Failed to look up module alias '%s': %m", module);
|
||||||
|
|
||||||
if (!modlist) {
|
if (!modlist)
|
||||||
log_full_errno(verbose ? LOG_ERR : LOG_DEBUG, r,
|
return log_full_errno(verbose ? LOG_ERR : LOG_DEBUG,
|
||||||
"Failed to find module '%s'", module);
|
SYNTHETIC_ERRNO(ENOENT),
|
||||||
return -ENOENT;
|
"Failed to find module '%s'", module);
|
||||||
}
|
|
||||||
|
|
||||||
kmod_list_foreach(itr, modlist) {
|
kmod_list_foreach(itr, modlist) {
|
||||||
_cleanup_(kmod_module_unrefp) struct kmod_module *mod = NULL;
|
_cleanup_(kmod_module_unrefp) struct kmod_module *mod = NULL;
|
||||||
|
|||||||
@ -163,10 +163,10 @@ static int lock_all_homes(void) {
|
|||||||
if (!bus_error_is_unknown_service(&error))
|
if (!bus_error_is_unknown_service(&error))
|
||||||
return log_error_errno(r, "Failed to lock home directories: %s", bus_error_message(&error, r));
|
return log_error_errno(r, "Failed to lock home directories: %s", bus_error_message(&error, r));
|
||||||
|
|
||||||
return log_debug("systemd-homed is not running, locking of home directories skipped.");
|
log_debug("systemd-homed is not running, locking of home directories skipped.");
|
||||||
}
|
} else
|
||||||
|
log_debug("Successfully requested locking of all home directories.");
|
||||||
return log_debug("Successfully requested locking of all home directories.");
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int execute(char **modes, char **states, const char *action) {
|
static int execute(char **modes, char **states, const char *action) {
|
||||||
|
|||||||
@ -10,7 +10,6 @@
|
|||||||
#include "sd-daemon.h"
|
#include "sd-daemon.h"
|
||||||
|
|
||||||
#include "alloc-util.h"
|
#include "alloc-util.h"
|
||||||
#include "build.h"
|
|
||||||
#include "bus-internal.h"
|
#include "bus-internal.h"
|
||||||
#include "bus-util.h"
|
#include "bus-util.h"
|
||||||
#include "errno-util.h"
|
#include "errno-util.h"
|
||||||
@ -18,6 +17,7 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "main-func.h"
|
#include "main-func.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
#define DEFAULT_BUS_PATH "unix:path=/run/dbus/system_bus_socket"
|
#define DEFAULT_BUS_PATH "unix:path=/run/dbus/system_bus_socket"
|
||||||
|
|
||||||
|
|||||||
@ -293,7 +293,7 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
r = cg_all_unified();
|
r = cg_all_unified();
|
||||||
if (r <= 0)
|
if (r <= 0)
|
||||||
return log_tests_skipped_errno(r, "Unified hierarchy is required, skipping.");
|
return log_tests_skipped("Unified hierarchy is required, skipping.");
|
||||||
|
|
||||||
r = enter_cgroup_subroot(NULL);
|
r = enter_cgroup_subroot(NULL);
|
||||||
if (r == -ENOMEDIUM)
|
if (r == -ENOMEDIUM)
|
||||||
|
|||||||
@ -3,13 +3,13 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "alloc-util.h"
|
#include "alloc-util.h"
|
||||||
#include "build.h"
|
|
||||||
#include "cgroup-setup.h"
|
#include "cgroup-setup.h"
|
||||||
#include "errno-util.h"
|
#include "errno-util.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "proc-cmdline.h"
|
#include "proc-cmdline.h"
|
||||||
#include "string-util.h"
|
#include "string-util.h"
|
||||||
#include "tests.h"
|
#include "tests.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
static void test_is_wanted_print(bool header) {
|
static void test_is_wanted_print(bool header) {
|
||||||
_cleanup_free_ char *cmdline = NULL;
|
_cleanup_free_ char *cmdline = NULL;
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||||
|
|
||||||
#include "alloc-util.h"
|
#include "alloc-util.h"
|
||||||
#include "build.h"
|
|
||||||
#include "cgroup-util.h"
|
#include "cgroup-util.h"
|
||||||
#include "dirent-util.h"
|
#include "dirent-util.h"
|
||||||
#include "errno-util.h"
|
#include "errno-util.h"
|
||||||
@ -17,6 +16,7 @@
|
|||||||
#include "tests.h"
|
#include "tests.h"
|
||||||
#include "user-util.h"
|
#include "user-util.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
static void check_p_d_u(const char *path, int code, const char *result) {
|
static void check_p_d_u(const char *path, int code, const char *result) {
|
||||||
_cleanup_free_ char *unit = NULL;
|
_cleanup_free_ char *unit = NULL;
|
||||||
|
|||||||
@ -11,7 +11,6 @@
|
|||||||
#include <sys/signalfd.h>
|
#include <sys/signalfd.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "build.h"
|
|
||||||
#include "device-private.h"
|
#include "device-private.h"
|
||||||
#include "fs-util.h"
|
#include "fs-util.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
@ -24,6 +23,7 @@
|
|||||||
#include "string-util.h"
|
#include "string-util.h"
|
||||||
#include "tests.h"
|
#include "tests.h"
|
||||||
#include "udev-event.h"
|
#include "udev-event.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
static int fake_filesystems(void) {
|
static int fake_filesystems(void) {
|
||||||
static const struct fakefs {
|
static const struct fakefs {
|
||||||
|
|||||||
@ -302,10 +302,23 @@ static int cd_capability_compat(Context *c) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int cd_media_compat(Context *c) {
|
static int cd_media_compat(Context *c) {
|
||||||
|
int r;
|
||||||
|
|
||||||
assert(c);
|
assert(c);
|
||||||
|
|
||||||
if (ioctl(c->fd, CDROM_DRIVE_STATUS, CDSL_CURRENT) != CDS_DISC_OK)
|
r = ioctl(c->fd, CDROM_DRIVE_STATUS, CDSL_CURRENT);
|
||||||
return log_debug_errno(errno, "CDROM_DRIVE_STATUS != CDS_DISC_OK");
|
if (r < 0)
|
||||||
|
return log_debug_errno(errno, "ioctl(CDROM_DRIVE_STATUS) failed: m");
|
||||||
|
if (r != CDS_DISC_OK) {
|
||||||
|
log_debug("ioctl(CDROM_DRIVE_STATUS) → %d (%s), ignoring",
|
||||||
|
r,
|
||||||
|
r == CDS_NO_INFO ? "no info" :
|
||||||
|
r == CDS_NO_DISC ? "no disc" :
|
||||||
|
r == CDS_TRAY_OPEN ? "tray open" :
|
||||||
|
r == CDS_DRIVE_NOT_READY ? "drive not ready" :
|
||||||
|
"unkown status");
|
||||||
|
return -ENOMEDIUM;
|
||||||
|
}
|
||||||
|
|
||||||
c->has_media = true;
|
c->has_media = true;
|
||||||
return 0;
|
return 0;
|
||||||
@ -730,25 +743,23 @@ static int cd_media_toc(Context *c) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int open_drive(Context *c) {
|
static int open_drive(Context *c) {
|
||||||
_cleanup_close_ int fd = -1;
|
int fd;
|
||||||
|
|
||||||
assert(c);
|
assert(c);
|
||||||
assert(c->fd < 0);
|
assert(c->fd < 0);
|
||||||
|
|
||||||
for (int cnt = 0; cnt < 20; cnt++) {
|
for (int cnt = 0;; cnt++) {
|
||||||
if (cnt != 0)
|
|
||||||
(void) usleep(100 * USEC_PER_MSEC + random_u64() % (100 * USEC_PER_MSEC));
|
|
||||||
|
|
||||||
fd = open(arg_node, O_RDONLY|O_NONBLOCK|O_CLOEXEC);
|
fd = open(arg_node, O_RDONLY|O_NONBLOCK|O_CLOEXEC);
|
||||||
if (fd >= 0 || errno != EBUSY)
|
if (fd >= 0)
|
||||||
break;
|
break;
|
||||||
|
if (++cnt >= 20 || errno != EBUSY)
|
||||||
|
return log_debug_errno(errno, "Unable to open '%s': %m", arg_node);
|
||||||
|
|
||||||
|
(void) usleep(100 * USEC_PER_MSEC + random_u64() % (100 * USEC_PER_MSEC));
|
||||||
}
|
}
|
||||||
if (fd < 0)
|
|
||||||
return log_debug_errno(errno, "Unable to open '%s'", arg_node);
|
|
||||||
|
|
||||||
log_debug("probing: '%s'", arg_node);
|
log_debug("probing: '%s'", arg_node);
|
||||||
|
c->fd = fd;
|
||||||
c->fd = TAKE_FD(fd);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -939,7 +950,7 @@ static int parse_argv(int argc, char *argv[]) {
|
|||||||
|
|
||||||
arg_node = argv[optind];
|
arg_node = argv[optind];
|
||||||
if (!arg_node)
|
if (!arg_node)
|
||||||
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "No device is specified.");
|
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "No device specified.");
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,12 +45,12 @@
|
|||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
|
||||||
#include "alloc-util.h"
|
#include "alloc-util.h"
|
||||||
#include "build.h"
|
|
||||||
#include "fileio.h"
|
#include "fileio.h"
|
||||||
#include "main-func.h"
|
#include "main-func.h"
|
||||||
#include "string-util.h"
|
#include "string-util.h"
|
||||||
#include "udev-util.h"
|
#include "udev-util.h"
|
||||||
#include "unaligned.h"
|
#include "unaligned.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
#define SUPPORTED_SMBIOS_VER 0x030300
|
#define SUPPORTED_SMBIOS_VER 0x030300
|
||||||
|
|
||||||
|
|||||||
@ -364,9 +364,11 @@ static int get_mac(sd_device *device, MACAddressPolicy policy, struct ether_addr
|
|||||||
return r;
|
return r;
|
||||||
switch (addr_type) {
|
switch (addr_type) {
|
||||||
case NET_ADDR_SET:
|
case NET_ADDR_SET:
|
||||||
return log_device_debug(device, "MAC on the device already set by userspace");
|
log_device_debug(device, "MAC on the device already set by userspace");
|
||||||
|
return 0;
|
||||||
case NET_ADDR_STOLEN:
|
case NET_ADDR_STOLEN:
|
||||||
return log_device_debug(device, "MAC on the device already set based on another device");
|
log_device_debug(device, "MAC on the device already set based on another device");
|
||||||
|
return 0;
|
||||||
case NET_ADDR_RANDOM:
|
case NET_ADDR_RANDOM:
|
||||||
case NET_ADDR_PERM:
|
case NET_ADDR_PERM:
|
||||||
break;
|
break;
|
||||||
@ -375,9 +377,11 @@ static int get_mac(sd_device *device, MACAddressPolicy policy, struct ether_addr
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (want_random == (addr_type == NET_ADDR_RANDOM))
|
if (want_random == (addr_type == NET_ADDR_RANDOM)) {
|
||||||
return log_device_debug(device, "MAC on the device already matches policy *%s*",
|
log_device_debug(device, "MAC on the device already matches policy *%s*",
|
||||||
mac_address_policy_to_string(policy));
|
mac_address_policy_to_string(policy));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (want_random) {
|
if (want_random) {
|
||||||
log_device_debug(device, "Using random bytes to generate MAC");
|
log_device_debug(device, "Using random bytes to generate MAC");
|
||||||
|
|||||||
@ -17,7 +17,6 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "alloc-util.h"
|
#include "alloc-util.h"
|
||||||
#include "build.h"
|
|
||||||
#include "device-nodes.h"
|
#include "device-nodes.h"
|
||||||
#include "extract-word.h"
|
#include "extract-word.h"
|
||||||
#include "fd-util.h"
|
#include "fd-util.h"
|
||||||
@ -27,6 +26,7 @@
|
|||||||
#include "strv.h"
|
#include "strv.h"
|
||||||
#include "strxcpyx.h"
|
#include "strxcpyx.h"
|
||||||
#include "udev-util.h"
|
#include "udev-util.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
static const struct option options[] = {
|
static const struct option options[] = {
|
||||||
{ "device", required_argument, NULL, 'd' },
|
{ "device", required_argument, NULL, 'd' },
|
||||||
|
|||||||
@ -184,21 +184,30 @@ struct UdevRules {
|
|||||||
|
|
||||||
/*** Logging helpers ***/
|
/*** Logging helpers ***/
|
||||||
|
|
||||||
#define log_rule_full_errno(device, rules, level, error, fmt, ...) \
|
#define log_rule_full_errno_zerook(device, rules, level, error, fmt, ...) \
|
||||||
({ \
|
({ \
|
||||||
UdevRules *_r = (rules); \
|
UdevRules *_r = (rules); \
|
||||||
UdevRuleFile *_f = _r ? _r->current_file : NULL; \
|
UdevRuleFile *_f = _r ? _r->current_file : NULL; \
|
||||||
UdevRuleLine *_l = _f ? _f->current_line : NULL; \
|
UdevRuleLine *_l = _f ? _f->current_line : NULL; \
|
||||||
const char *_n = _f ? _f->filename : NULL; \
|
const char *_n = _f ? _f->filename : NULL; \
|
||||||
\
|
\
|
||||||
log_device_full_errno(device, level, error, "%s:%u " fmt, \
|
log_device_full_errno_zerook( \
|
||||||
strna(_n), _l ? _l->line_number : 0, \
|
device, level, error, "%s:%u " fmt, \
|
||||||
##__VA_ARGS__); \
|
strna(_n), _l ? _l->line_number : 0, \
|
||||||
|
##__VA_ARGS__); \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define log_rule_full(device, rules, level, ...) (void) log_rule_full_errno(device, rules, level, 0, __VA_ARGS__)
|
#define log_rule_full_errno(device, rules, level, error, fmt, ...) \
|
||||||
|
({ \
|
||||||
|
int _error = (error); \
|
||||||
|
ASSERT_NON_ZERO(_error); \
|
||||||
|
log_rule_full_errno_zerook( \
|
||||||
|
device, rules, level, _error, fmt, ##__VA_ARGS__); \
|
||||||
|
})
|
||||||
|
|
||||||
#define log_rule_debug(device, rules, ...) log_rule_full_errno(device, rules, LOG_DEBUG, 0, __VA_ARGS__)
|
#define log_rule_full(device, rules, level, ...) (void) log_rule_full_errno_zerook(device, rules, level, 0, __VA_ARGS__)
|
||||||
|
|
||||||
|
#define log_rule_debug(device, rules, ...) log_rule_full(device, rules, LOG_DEBUG, __VA_ARGS__)
|
||||||
#define log_rule_info(device, rules, ...) log_rule_full(device, rules, LOG_INFO, __VA_ARGS__)
|
#define log_rule_info(device, rules, ...) log_rule_full(device, rules, LOG_INFO, __VA_ARGS__)
|
||||||
#define log_rule_notice(device, rules, ...) log_rule_full(device, rules, LOG_NOTICE, __VA_ARGS__)
|
#define log_rule_notice(device, rules, ...) log_rule_full(device, rules, LOG_NOTICE, __VA_ARGS__)
|
||||||
#define log_rule_warning(device, rules, ...) log_rule_full(device, rules, LOG_WARNING, __VA_ARGS__)
|
#define log_rule_warning(device, rules, ...) log_rule_full(device, rules, LOG_WARNING, __VA_ARGS__)
|
||||||
@ -210,10 +219,11 @@ struct UdevRules {
|
|||||||
#define log_rule_warning_errno(device, rules, error, ...) log_rule_full_errno(device, rules, LOG_WARNING, error, __VA_ARGS__)
|
#define log_rule_warning_errno(device, rules, error, ...) log_rule_full_errno(device, rules, LOG_WARNING, error, __VA_ARGS__)
|
||||||
#define log_rule_error_errno(device, rules, error, ...) log_rule_full_errno(device, rules, LOG_ERR, error, __VA_ARGS__)
|
#define log_rule_error_errno(device, rules, error, ...) log_rule_full_errno(device, rules, LOG_ERR, error, __VA_ARGS__)
|
||||||
|
|
||||||
|
#define log_token_full_errno_zerook(rules, level, error, ...) log_rule_full_errno_zerook(NULL, rules, level, error, __VA_ARGS__)
|
||||||
#define log_token_full_errno(rules, level, error, ...) log_rule_full_errno(NULL, rules, level, error, __VA_ARGS__)
|
#define log_token_full_errno(rules, level, error, ...) log_rule_full_errno(NULL, rules, level, error, __VA_ARGS__)
|
||||||
#define log_token_full(rules, level, ...) (void) log_token_full_errno(rules, level, 0, __VA_ARGS__)
|
#define log_token_full(rules, level, ...) (void) log_token_full_errno_zerook(rules, level, 0, __VA_ARGS__)
|
||||||
|
|
||||||
#define log_token_debug(rules, ...) log_token_full_errno(rules, LOG_DEBUG, 0, __VA_ARGS__)
|
#define log_token_debug(rules, ...) log_token_full(rules, LOG_DEBUG, __VA_ARGS__)
|
||||||
#define log_token_info(rules, ...) log_token_full(rules, LOG_INFO, __VA_ARGS__)
|
#define log_token_info(rules, ...) log_token_full(rules, LOG_INFO, __VA_ARGS__)
|
||||||
#define log_token_notice(rules, ...) log_token_full(rules, LOG_NOTICE, __VA_ARGS__)
|
#define log_token_notice(rules, ...) log_token_full(rules, LOG_NOTICE, __VA_ARGS__)
|
||||||
#define log_token_warning(rules, ...) log_token_full(rules, LOG_WARNING, __VA_ARGS__)
|
#define log_token_warning(rules, ...) log_token_full(rules, LOG_WARNING, __VA_ARGS__)
|
||||||
@ -2123,7 +2133,11 @@ static int udev_rule_apply_token_to_event(
|
|||||||
(void) udev_event_apply_format(event, token->value, value, sizeof(value), false);
|
(void) udev_event_apply_format(event, token->value, value, sizeof(value), false);
|
||||||
|
|
||||||
log_rule_debug(dev, rules, "ATTR '%s' writing '%s'", buf, value);
|
log_rule_debug(dev, rules, "ATTR '%s' writing '%s'", buf, value);
|
||||||
r = write_string_file(buf, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_AVOID_NEWLINE);
|
r = write_string_file(buf, value,
|
||||||
|
WRITE_STRING_FILE_VERIFY_ON_FAILURE |
|
||||||
|
WRITE_STRING_FILE_DISABLE_BUFFER |
|
||||||
|
WRITE_STRING_FILE_AVOID_NEWLINE |
|
||||||
|
WRITE_STRING_FILE_VERIFY_IGNORE_NEWLINE);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
log_rule_error_errno(dev, rules, r, "Failed to write ATTR{%s}, ignoring: %m", buf);
|
log_rule_error_errno(dev, rules, r, "Failed to write ATTR{%s}, ignoring: %m", buf);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "build.h"
|
|
||||||
#include "macro.h"
|
#include "macro.h"
|
||||||
|
|
||||||
int info_main(int argc, char *argv[], void *userdata);
|
int info_main(int argc, char *argv[], void *userdata);
|
||||||
|
|||||||
@ -28,7 +28,6 @@
|
|||||||
#include "sd-event.h"
|
#include "sd-event.h"
|
||||||
|
|
||||||
#include "alloc-util.h"
|
#include "alloc-util.h"
|
||||||
#include "build.h"
|
|
||||||
#include "cgroup-util.h"
|
#include "cgroup-util.h"
|
||||||
#include "cpu-set-util.h"
|
#include "cpu-set-util.h"
|
||||||
#include "dev-setup.h"
|
#include "dev-setup.h"
|
||||||
@ -65,6 +64,7 @@
|
|||||||
#include "udev-util.h"
|
#include "udev-util.h"
|
||||||
#include "udev-watch.h"
|
#include "udev-watch.h"
|
||||||
#include "user-util.h"
|
#include "user-util.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
#define WORKER_NUM_MAX 2048U
|
#define WORKER_NUM_MAX 2048U
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user