The advantage is that is the name is mispellt, cpp will warn us.
$ git grep -Ee "conf.set\('(HAVE|ENABLE)_" -l|xargs sed -r -i "s/conf.set\('(HAVE|ENABLE)_/conf.set10('\1_/"
$ git grep -Ee '#ifn?def (HAVE|ENABLE)' -l|xargs sed -r -i 's/#ifdef (HAVE|ENABLE)/#if \1/; s/#ifndef (HAVE|ENABLE)/#if ! \1/;'
$ git grep -Ee 'if.*defined\(HAVE' -l|xargs sed -i -r 's/defined\((HAVE_[A-Z0-9_]*)\)/\1/g'
$ git grep -Ee 'if.*defined\(ENABLE' -l|xargs sed -i -r 's/defined\((ENABLE_[A-Z0-9_]*)\)/\1/g'
+ manual changes to meson.build
squash! build-sys: use #if Y instead of #ifdef Y everywhere
v2:
- fix incorrect setting of HAVE_LIBIDN2
output : 'README',
configuration : substs)
-if conf.get('HAVE_SYSV_COMPAT', false)
+if conf.get('HAVE_SYSV_COMPAT') == 1
install_data(file,
install_dir : sysvinit_path)
endif
output : 'README',
configuration : substs)
-if conf.get('HAVE_SYSV_COMPAT', false)
+if conf.get('HAVE_SYSV_COMPAT') == 1
install_data(file,
install_dir : varlogdir)
endif
70-touchpad.hwdb
'''.split())
-if conf.get('ENABLE_HWDB', false)
+if conf.get('ENABLE_HWDB') == 1
install_data(hwdb_files,
install_dir : udevhwdbdir)
mandirn = join_paths(get_option('mandir'), 'man' + section)
- if condition == '' or conf.get(condition, false)
+ if condition == '' or conf.get(condition) == 1
p1 = custom_target(
man,
input : xml,
#####################################################################
rootprefixdir = get_option('rootprefix')
+conf.set10('HAVE_SPLIT_USR', get_option('split-usr'))
if get_option('split-usr')
- conf.set('HAVE_SPLIT_USR', true)
rootprefixdir = rootprefixdir != '' ? rootprefixdir : '/'
else
rootprefixdir = rootprefixdir != '' ? rootprefixdir : '/usr'
sysvinit_path = get_option('sysvinit-path')
sysvrcnd_path = get_option('sysvrcnd-path')
-if sysvinit_path != '' or sysvrcnd_path != ''
- conf.set('HAVE_SYSV_COMPAT', true,
- description : 'SysV init scripts and rcN.d links are supported')
- m4_defines += ['-DHAVE_SYSV_COMPAT']
-endif
+have = sysvinit_path != '' or sysvrcnd_path != ''
+conf.set10('HAVE_SYSV_COMPAT', have,
+ description : 'SysV init scripts and rcN.d links are supported')
+m4_defines += have ? ['-DHAVE_SYSV_COMPAT'] : []
# join_paths ignore the preceding arguments if an absolute component is
# encountered, so this should canonicalize various paths when they are
# We get -1 if the size cannot be determined
have = cc.sizeof(decl, prefix : decl_headers) > 0
- conf.set('HAVE_' + decl.underscorify().to_upper(), have)
+ conf.set10('HAVE_' + decl.underscorify().to_upper(), have)
endforeach
foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'],
conf.set10('HAVE_' + decl[0], have)
endforeach
-skip = false
foreach ident : ['secure_getenv', '__secure_getenv']
- if not skip and cc.has_function(ident)
- conf.set('HAVE_' + ident.to_upper(), true)
- skip = true
- endif
+ conf.set10('HAVE_' + ident.to_upper(), cc.has_function(ident))
endforeach
foreach ident : [
endforeach
if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''')
- conf.set('USE_SYS_RANDOM_H', true)
+ conf.set10('USE_SYS_RANDOM_H', true)
conf.set10('HAVE_GETRANDOM', true)
else
have = cc.has_function('getrandom', prefix : '''#include <linux/random.h>''')
+ conf.set10('USE_SYS_RANDOM_H', false)
conf.set10('HAVE_GETRANDOM', have)
endif
'valgrind/valgrind.h',
]
- conf.set('HAVE_' + header.underscorify().to_upper(),
- cc.has_header(header))
+ conf.set10('HAVE_' + header.underscorify().to_upper(),
+ cc.has_header(header))
endforeach
############################################################
substs.set('DEBUGTTY', get_option('debug-tty'))
debug = get_option('debug')
+enable_debug_hashmap = false
+enable_debug_mmap_cache = false
if debug != ''
foreach name : debug.split(',')
if name == 'hashmap'
- conf.set('ENABLE_DEBUG_HASHMAP', true)
+ enable_debug_hashmap = true
elif name == 'mmap-cache'
- conf.set('ENABLE_DEBUG_MMAP_CACHE', true)
+ enable_debug_mmap_cache = true
else
message('unknown debug option "@0@", ignoring'.format(name))
endif
endforeach
endif
+conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
+conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
#####################################################################
libseccomp = dependency('libseccomp',
version : '>= 2.3.1',
required : want_seccomp == 'true')
- if libseccomp.found()
- conf.set('HAVE_SECCOMP', true)
- m4_defines += ['-DHAVE_SECCOMP']
- endif
+ have = libseccomp.found()
else
+ have = false
libseccomp = []
endif
+conf.set10('HAVE_SECCOMP', have)
+m4_defines += have ? ['-DHAVE_SECCOMP'] : []
want_selinux = get_option('selinux')
if want_selinux != 'false'
libselinux = dependency('libselinux',
version : '>= 2.1.9',
required : want_selinux == 'true')
- if libselinux.found()
- conf.set('HAVE_SELINUX', true)
- m4_defines += ['-DHAVE_SELINUX']
- endif
+ have = libselinux.found()
else
+ have = false
libselinux = []
endif
+conf.set10('HAVE_SELINUX', have)
+m4_defines += have ? ['-DHAVE_SELINUX'] : []
want_apparmor = get_option('apparmor')
if want_apparmor != 'false'
libapparmor = dependency('libapparmor',
required : want_apparmor == 'true')
- if libapparmor.found()
- conf.set('HAVE_APPARMOR', true)
- m4_defines += ['-DHAVE_APPARMOR']
- endif
+ have = libapparmor.found()
else
+ have = false
libapparmor = []
endif
+conf.set10('HAVE_APPARMOR', have)
+m4_defines += have ? ['-DHAVE_APPARMOR'] : []
smack_run_label = get_option('smack-run-label')
if smack_run_label != ''
install_polkit = false
install_polkit_pkla = false
if want_polkit != 'false'
- conf.set('ENABLE_POLKIT', true)
install_polkit = true
libpolkit = dependency('polkit-gobject-1',
install_polkit_pkla = true
endif
endif
+conf.set10('ENABLE_POLKIT', install_polkit)
want_acl = get_option('acl')
if want_acl != 'false'
libacl = cc.find_library('acl', required : want_acl == 'true')
- if libacl.found()
- conf.set('HAVE_ACL', true)
- m4_defines += ['-DHAVE_ACL']
- endif
+ have = libacl.found()
else
+ have = false
libacl = []
endif
+conf.set10('HAVE_ACL', have)
+m4_defines += have ? ['-DHAVE_ACL'] : []
want_audit = get_option('audit')
if want_audit != 'false'
libaudit = dependency('audit', required : want_audit == 'true')
- conf.set('HAVE_AUDIT', libaudit.found())
+ have = libaudit.found()
else
+ have = false
libaudit = []
endif
+conf.set10('HAVE_AUDIT', have)
want_blkid = get_option('blkid')
if want_blkid != 'false'
libblkid = dependency('blkid', required : want_blkid == 'true')
- conf.set('HAVE_BLKID', libblkid.found())
+ have = libblkid.found()
else
+ have = false
libblkid = []
endif
+conf.set10('HAVE_BLKID', have)
want_kmod = get_option('kmod')
if want_kmod != 'false'
libkmod = dependency('libkmod',
version : '>= 15',
required : want_kmod == 'true')
- conf.set('HAVE_KMOD', libkmod.found())
+ have = libkmod.found()
else
+ have = false
libkmod = []
endif
+conf.set10('HAVE_KMOD', have)
want_pam = get_option('pam')
if want_pam != 'false'
libpam = cc.find_library('pam', required : want_pam == 'true')
libpam_misc = cc.find_library('pam_misc', required : want_pam == 'true')
- if libpam.found() and libpam_misc.found()
- conf.set('HAVE_PAM', true)
- m4_defines += ['-DHAVE_PAM']
- endif
+ have = libpam.found() and libpam_misc.found()
else
+ have = false
libpam = []
libpam_misc = []
endif
+conf.set10('HAVE_PAM', have)
+m4_defines += have ? ['-DHAVE_PAM'] : []
want_microhttpd = get_option('microhttpd')
if want_microhttpd != 'false'
libmicrohttpd = dependency('libmicrohttpd',
version : '>= 0.9.33',
required : want_microhttpd == 'true')
- if libmicrohttpd.found()
- conf.set('HAVE_MICROHTTPD', true)
- m4_defines += ['-DHAVE_MICROHTTPD']
- endif
+ have = libmicrohttpd.found()
else
+ have = false
libmicrohttpd = []
endif
+conf.set10('HAVE_MICROHTTPD', have)
+m4_defines += have ? ['-DHAVE_MICROHTTPD'] : []
want_libcryptsetup = get_option('libcryptsetup')
if want_libcryptsetup != 'false'
libcryptsetup = dependency('libcryptsetup',
version : '>= 1.6.0',
required : want_libcryptsetup == 'true')
- conf.set('HAVE_LIBCRYPTSETUP', libcryptsetup.found())
+ have = libcryptsetup.found()
else
+ have = false
libcryptsetup = []
endif
+conf.set10('HAVE_LIBCRYPTSETUP', have)
want_libcurl = get_option('libcurl')
if want_libcurl != 'false'
libcurl = dependency('libcurl',
version : '>= 7.32.0',
required : want_libcurl == 'true')
- if libcurl.found()
- conf.set('HAVE_LIBCURL', true)
- m4_defines += ['-DHAVE_LIBCURL']
- endif
+ have = libcurl.found()
else
+ have = false
libcurl = []
endif
+conf.set10('HAVE_LIBCURL', have)
+m4_defines += have ? ['-DHAVE_LIBCURL'] : []
want_libidn = get_option('libidn')
want_libidn2 = get_option('libidn2')
if want_libidn != 'false' and want_libidn2 != 'true'
libidn = dependency('libidn',
required : want_libidn == 'true')
- if libidn.found()
- conf.set('HAVE_LIBIDN', true)
- m4_defines += ['-DHAVE_LIBIDN']
- endif
+ have = libidn.found()
else
+ have = false
libidn = []
endif
-if not conf.get('HAVE_LIBIDN', false) and want_libidn2 != 'false'
+conf.set10('HAVE_LIBIDN', have)
+m4_defines += have ? ['-DHAVE_LIBIDN'] : []
+if not have and want_libidn2 != 'false'
# libidn is used for both libidn and libidn2 objects
libidn = dependency('libidn2',
required : want_libidn2 == 'true')
- if libidn.found()
- conf.set('HAVE_LIBIDN2', true)
- m4_defines += ['-DHAVE_LIBIDN2']
- endif
+ have = libidn.found()
+else
+ have = false
endif
+conf.set10('HAVE_LIBIDN2', have)
+m4_defines += have ? ['-DHAVE_LIBIDN2'] : []
want_libiptc = get_option('libiptc')
if want_libiptc != 'false'
libiptc = dependency('libiptc',
required : want_libiptc == 'true')
- if libiptc.found()
- conf.set('HAVE_LIBIPTC', true)
- m4_defines += ['-DHAVE_LIBIPTC']
- endif
+ have = libiptc.found()
else
+ have = false
libiptc = []
endif
+conf.set10('HAVE_LIBIPTC', have)
+m4_defines += have ? ['-DHAVE_LIBIPTC'] : []
want_qrencode = get_option('qrencode')
if want_qrencode != 'false'
libqrencode = dependency('libqrencode',
required : want_qrencode == 'true')
- conf.set('HAVE_QRENCODE', libqrencode.found())
+ have = libqrencode.found()
else
+ have = false
libqrencode = []
endif
+conf.set10('HAVE_QRENCODE', have)
want_gcrypt = get_option('gcrypt')
if want_gcrypt != 'false'
libgcrypt = cc.find_library('gcrypt', required : want_gcrypt == 'true')
libgpg_error = cc.find_library('gpg-error', required : want_gcrypt == 'true')
-
- have_deps = libgcrypt.found() and libgpg_error.found()
- conf.set('HAVE_GCRYPT', have_deps)
- if not have_deps
- # link to neither of the libs if one is not found
- libgcrypt = []
- libgpg_error = []
- endif
+ have = libgcrypt.found() and libgpg_error.found()
else
+ have = false
+endif
+if not have
+ # link to neither of the libs if one is not found
libgcrypt = []
libgpg_error = []
endif
+conf.set10('HAVE_GCRYPT', have)
want_gnutls = get_option('gnutls')
if want_gnutls != 'false'
libgnutls = dependency('gnutls',
version : '>= 3.1.4',
required : want_gnutls == 'true')
- conf.set('HAVE_GNUTLS', libgnutls.found())
+ have = libgnutls.found()
else
+ have = false
libgnutls = []
endif
+conf.set10('HAVE_GNUTLS', have)
want_elfutils = get_option('elfutils')
if want_elfutils != 'false'
libdw = dependency('libdw',
required : want_elfutils == 'true')
- conf.set('HAVE_ELFUTILS', libdw.found())
+ have = libdw.found()
else
+ have = false
libdw = []
endif
+conf.set10('HAVE_ELFUTILS', have)
want_zlib = get_option('zlib')
if want_zlib != 'false'
libz = dependency('zlib',
required : want_zlib == 'true')
- conf.set('HAVE_ZLIB', libz.found())
+ have = libz.found()
else
+ have = false
libz = []
endif
+conf.set10('HAVE_ZLIB', have)
want_bzip2 = get_option('bzip2')
if want_bzip2 != 'false'
libbzip2 = cc.find_library('bz2',
required : want_bzip2 == 'true')
- conf.set('HAVE_BZIP2', libbzip2.found())
+ have = libbzip2.found()
else
+ have = false
libbzip2 = []
endif
+conf.set10('HAVE_BZIP2', have)
want_xz = get_option('xz')
if want_xz != 'false'
libxz = dependency('liblzma',
required : want_xz == 'true')
- conf.set('HAVE_XZ', libxz.found())
+ have = libxz.found()
else
+ have = false
libxz = []
endif
+conf.set10('HAVE_XZ', have)
want_lz4 = get_option('lz4')
if want_lz4 != 'false'
liblz4 = dependency('liblz4',
required : want_lz4 == 'true')
- conf.set('HAVE_LZ4', liblz4.found())
+ have = liblz4.found()
else
+ have = false
liblz4 = []
endif
+conf.set10('HAVE_LZ4', have)
want_xkbcommon = get_option('xkbcommon')
if want_xkbcommon != 'false'
libxkbcommon = dependency('xkbcommon',
version : '>= 0.3.0',
required : want_xkbcommon == 'true')
- conf.set('HAVE_XKBCOMMON', libxkbcommon.found())
+ have = libxkbcommon.found()
else
+ have = false
libxkbcommon = []
endif
+conf.set10('HAVE_XKBCOMMON', have)
want_glib = get_option('glib')
if want_glib != 'false'
libgio = dependency('gio-2.0',
required : want_glib == 'true')
have = libglib.found() and libgobject.found() and libgio.found()
- conf.set('HAVE_GLIB', have)
else
+ have = false
libglib = []
libgobject = []
libgio = []
endif
+conf.set10('HAVE_GLIB', have)
want_dbus = get_option('dbus')
if want_dbus != 'false'
libdbus = dependency('dbus-1',
version : '>= 1.3.2',
required : want_dbus == 'true')
- conf.set('HAVE_DBUS', libdbus.found())
+ have = libdbus.found()
else
+ have = false
libdbus = []
endif
+conf.set10('HAVE_DBUS', have)
default_dnssec = get_option('default-dnssec')
-if default_dnssec != 'no' and not conf.get('HAVE_GCRYPT', false)
+if default_dnssec != 'no' and conf.get('HAVE_GCRYPT') == 0
message('default-dnssec cannot be set to yes or allow-downgrade when gcrypt is disabled. Setting default-dnssec to no.')
default_dnssec = 'no'
endif
want_importd = get_option('importd')
if want_importd != 'false'
- have_deps = (conf.get('HAVE_LIBCURL', false) and
- conf.get('HAVE_ZLIB', false) and
- conf.get('HAVE_BZIP2', false) and
- conf.get('HAVE_XZ', false) and
- conf.get('HAVE_GCRYPT', false))
- conf.set('ENABLE_IMPORTD', have_deps)
- if want_importd == 'true' and not have_deps
+ have = (conf.get('HAVE_LIBCURL') == 1 and
+ conf.get('HAVE_ZLIB') == 1 and
+ conf.get('HAVE_BZIP2') == 1 and
+ conf.get('HAVE_XZ') == 1 and
+ conf.get('HAVE_GCRYPT') == 1)
+ if want_importd == 'true' and not have
error('importd support was requested, but dependencies are not available')
endif
+else
+ have = false
endif
+conf.set10('ENABLE_IMPORTD', have)
want_remote = get_option('remote')
if want_remote != 'false'
- have_deps = [conf.get('HAVE_MICROHTTPD', false),
- conf.get('HAVE_LIBCURL', false)]
+ have_deps = [conf.get('HAVE_MICROHTTPD') == 1,
+ conf.get('HAVE_LIBCURL') == 1]
# sd-j-remote requires µhttpd, and sd-j-upload requires libcurl, so
# it's possible to build one without the other. Complain only if
# support was explictly requested. The auxiliary files like sysusers
if want_remote == 'true' and not (have_deps[0] and have_deps[1])
error('remote support was requested, but dependencies are not available')
endif
- conf.set('ENABLE_REMOTE', have_deps[0] or have_deps[1])
+ have = have_deps[0] or have_deps[1]
+else
+ have = false
endif
+conf.set10('ENABLE_REMOTE', have)
foreach pair : [['utmp', 'HAVE_UTMP'],
['hibernate', 'ENABLE_HIBERNATE'],
['nss-systemd', 'ENABLE_NSS_SYSTEMD'],
]
- if get_option(pair[0])
- conf.set(pair[1], true)
- m4_defines += ['-D' + pair[1]]
- endif
+ have = get_option(pair[0])
+ conf.set10(pair[1], have)
+ m4_defines += have ? ['-D' + pair[1]] : []
endforeach
want_tests = get_option('tests')
gnu_efi_arch = ''
endif
- conf.set('ENABLE_EFI', true)
+ have = true
conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
conf.set('SD_TPM_PCR', get_option('tpm-pcrindex').to_int())
+else
+ have = false
endif
+conf.set10('ENABLE_EFI', have)
#####################################################################
['mymachines', 'ENABLE_MACHINED'],
['resolve', 'ENABLE_RESOLVED']]
- condition = tuple[1] == '' or conf.get(tuple[1], false)
+ condition = tuple[1] == '' or conf.get(tuple[1]) == 1
if condition
module = tuple[0]
install : true,
install_dir : systemgeneratordir)
-if conf.get('ENABLE_ENVIRONMENT_D', false)
+if conf.get('ENABLE_ENVIRONMENT_D') == 1
executable('30-systemd-environment-d-generator',
'src/environment-d-generator/environment-d-generator.c',
include_directories : includes,
join_paths(environmentdir, '99-environment.conf'))
endif
-if conf.get('ENABLE_HIBERNATE', false)
+if conf.get('ENABLE_HIBERNATE') == 1
executable('systemd-hibernate-resume-generator',
'src/hibernate-resume/hibernate-resume-generator.c',
include_directories : includes,
install_dir : rootlibexecdir)
endif
-if conf.get('HAVE_BLKID', false)
+if conf.get('HAVE_BLKID') == 1
executable('systemd-gpt-auto-generator',
'src/gpt-auto-generator/gpt-auto-generator.c',
'src/basic/blkid-util.h',
public_programs += [exe]
endif
-if conf.get('ENABLE_RESOLVED', false)
+if conf.get('ENABLE_RESOLVED') == 1
executable('systemd-resolved',
systemd_resolved_sources,
gcrypt_util_sources,
public_programs += [exe]
endif
-if conf.get('ENABLE_LOGIND', false)
+if conf.get('ENABLE_LOGIND') == 1
executable('systemd-logind',
systemd_logind_sources,
include_directories : includes,
install_dir : rootbindir)
public_programs += [exe]
- if conf.get('HAVE_PAM', false)
+ if conf.get('HAVE_PAM') == 1
version_script_arg = join_paths(meson.current_source_dir(), pam_systemd_sym)
pam_systemd = shared_library(
'pam_systemd',
endif
endif
-if conf.get('HAVE_PAM', false)
+if conf.get('HAVE_PAM') == 1
executable('systemd-user-sessions',
'src/user-sessions/user-sessions.c',
include_directories : includes,
install_dir : rootlibexecdir)
endif
-if conf.get('ENABLE_EFI', false) and conf.get('HAVE_BLKID', false)
+if conf.get('ENABLE_EFI') == 1 and conf.get('HAVE_BLKID') == 1
exe = executable('bootctl',
'src/boot/bootctl.c',
include_directories : includes,
install_dir : rootbindir)
public_programs += [exe]
-if conf.get('ENABLE_BACKLIGHT', false)
+if conf.get('ENABLE_BACKLIGHT') == 1
executable('systemd-backlight',
'src/backlight/backlight.c',
include_directories : includes,
install_dir : rootlibexecdir)
endif
-if conf.get('ENABLE_RFKILL', false)
+if conf.get('ENABLE_RFKILL') == 1
executable('systemd-rfkill',
'src/rfkill/rfkill.c',
include_directories : includes,
install : true,
install_dir : systemgeneratordir)
-if conf.get('HAVE_LIBCRYPTSETUP', false)
+if conf.get('HAVE_LIBCRYPTSETUP') == 1
executable('systemd-cryptsetup',
'src/cryptsetup/cryptsetup.c',
include_directories : includes,
install_dir : systemgeneratordir)
endif
-if conf.get('HAVE_SYSV_COMPAT', false)
+if conf.get('HAVE_SYSV_COMPAT') == 1
executable('systemd-sysv-generator',
'src/sysv-generator/sysv-generator.c',
include_directories : includes,
install_dir : systemgeneratordir)
endif
-if conf.get('ENABLE_HOSTNAMED', false)
+if conf.get('ENABLE_HOSTNAMED') == 1
executable('systemd-hostnamed',
'src/hostname/hostnamed.c',
include_directories : includes,
public_programs += [exe]
endif
-if conf.get('ENABLE_LOCALED', false)
- if conf.get('HAVE_XKBCOMMON', false)
+if conf.get('ENABLE_LOCALED') == 1
+ if conf.get('HAVE_XKBCOMMON') == 1
# logind will load libxkbcommon.so dynamically on its own
deps = [libdl]
else
public_programs += [exe]
endif
-if conf.get('ENABLE_TIMEDATED', false)
+if conf.get('ENABLE_TIMEDATED') == 1
executable('systemd-timedated',
'src/timedate/timedated.c',
include_directories : includes,
public_programs += [exe]
endif
-if conf.get('ENABLE_TIMESYNCD', false)
+if conf.get('ENABLE_TIMESYNCD') == 1
executable('systemd-timesyncd',
systemd_timesyncd_sources,
include_directories : includes,
install_dir : rootlibexecdir)
endif
-if conf.get('ENABLE_MACHINED', false)
+if conf.get('ENABLE_MACHINED') == 1
executable('systemd-machined',
systemd_machined_sources,
include_directories : includes,
public_programs += [exe]
endif
-if conf.get('ENABLE_IMPORTD', false)
+if conf.get('ENABLE_IMPORTD') == 1
executable('systemd-importd',
systemd_importd_sources,
include_directories : includes,
public_programs += [systemd_pull, systemd_import, systemd_export]
endif
-if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_LIBCURL', false)
+if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_LIBCURL') == 1
exe = executable('systemd-journal-upload',
systemd_journal_upload_sources,
include_directories : includes,
public_programs += [exe]
endif
-if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_MICROHTTPD', false)
+if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
s_j_remote = executable('systemd-journal-remote',
systemd_journal_remote_sources,
include_directories : includes,
public_programs += [s_j_remote, s_j_gatewayd]
endif
-if conf.get('ENABLE_COREDUMP', false)
+if conf.get('ENABLE_COREDUMP') == 1
executable('systemd-coredump',
systemd_coredump_sources,
include_directories : includes,
public_programs += [exe]
endif
-if conf.get('ENABLE_BINFMT', false)
+if conf.get('ENABLE_BINFMT') == 1
exe = executable('systemd-binfmt',
'src/binfmt/binfmt.c',
include_directories : includes,
mkdir_p.format(join_paths(sysconfdir, 'binfmt.d')))
endif
-if conf.get('ENABLE_VCONSOLE', false)
+if conf.get('ENABLE_VCONSOLE') == 1
executable('systemd-vconsole-setup',
'src/vconsole/vconsole-setup.c',
include_directories : includes,
install_dir : rootlibexecdir)
endif
-if conf.get('ENABLE_RANDOMSEED', false)
+if conf.get('ENABLE_RANDOMSEED') == 1
executable('systemd-random-seed',
'src/random-seed/random-seed.c',
include_directories : includes,
install_dir : rootlibexecdir)
endif
-if conf.get('ENABLE_FIRSTBOOT', false)
+if conf.get('ENABLE_FIRSTBOOT') == 1
executable('systemd-firstboot',
'src/firstboot/firstboot.c',
include_directories : includes,
install : true)
public_programs += [exe]
-if conf.get('ENABLE_SYSUSERS', false)
+if conf.get('ENABLE_SYSUSERS') == 1
exe = executable('systemd-sysusers',
'src/sysusers/sysusers.c',
include_directories : includes,
public_programs += [exe]
endif
-if conf.get('ENABLE_TMPFILES', false)
+if conf.get('ENABLE_TMPFILES') == 1
exe = executable('systemd-tmpfiles',
'src/tmpfiles/tmpfiles.c',
include_directories : includes,
public_programs += [exe]
endif
-if conf.get('ENABLE_HWDB', false)
+if conf.get('ENABLE_HWDB') == 1
exe = executable('systemd-hwdb',
'src/hwdb/hwdb.c',
'src/libsystemd/sd-hwdb/hwdb-internal.h',
public_programs += [exe]
endif
-if conf.get('ENABLE_QUOTACHECK', false)
+if conf.get('ENABLE_QUOTACHECK') == 1
executable('systemd-quotacheck',
'src/quotacheck/quotacheck.c',
include_directories : includes,
install : true,
install_dir : rootlibexecdir)
-if conf.get('HAVE_KMOD', false)
+if conf.get('HAVE_KMOD') == 1
executable('systemd-modules-load',
'src/modules-load/modules-load.c',
include_directories : includes,
install : true)
public_programs += [exe]
-if conf.get('ENABLE_NETWORKD', false)
+if conf.get('ENABLE_NETWORKD') == 1
executable('systemd-networkd',
systemd_networkd_sources,
include_directories : includes,
type = ''
endif
- if condition == '' or conf.get(condition, false)
+ if condition == '' or conf.get(condition) == 1
exe = executable(
name,
sources,
# CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
# LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
-if conf.get('ENABLE_EFI', false)
+if conf.get('ENABLE_EFI') == 1
status += [
'efi arch: @0@'.format(efi_arch)]
['blkid'],
['dbus'],
['glib'],
- ['nss-myhostname', conf.get('HAVE_MYHOSTNAME', false)],
+ ['nss-myhostname', conf.get('HAVE_MYHOSTNAME') == 1],
['hwdb'],
['tpm'],
['man pages', want_man],
['html pages', want_html],
['man page indices', want_man and have_lxml],
- ['split /usr', conf.get('HAVE_SPLIT_USR', false)],
+ ['split /usr', conf.get('HAVE_SPLIT_USR') == 1],
['SysV compat'],
['utmp'],
['ldconfig'],
if cond == ''
ident1 = 'HAVE_' + tuple[0].underscorify().to_upper()
ident2 = 'ENABLE_' + tuple[0].underscorify().to_upper()
- cond = conf.get(ident1, false) or conf.get(ident2, false)
+ cond = conf.get(ident1, 0) == 1 or conf.get(ident2, 0) == 1
endif
if cond
found += [tuple[0]]
-if conf.get('ENABLE_NETWORKD', false)
+if conf.get('ENABLE_NETWORKD') == 1
install_data('80-container-host0.network',
'80-container-ve.network',
'80-container-vz.network',
]
foreach item : items
- if item[1] == '' or conf.get(item[1], false)
+ if item[1] == '' or conf.get(item[1]) == 1
install_data(item[0],
install_dir : bashcompletiondir)
endif
]
foreach item : items
- if item[1] == '' or conf.get(item[1], false)
+ if item[1] == '' or conf.get(item[1]) == 1
install_data(item[0],
install_dir : zshcompletiondir)
endif
#include "log.h"
#include "pager.h"
#include "parse-util.h"
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
#include "seccomp-util.h"
#endif
#include "special.h"
return 0;
}
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
static void dump_syscall_filter(const SyscallFilterSet *set) {
const char *syscall;
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#ifdef HAVE_BLKID
+#if HAVE_BLKID
#include <blkid.h>
#endif
#include "util.h"
-#ifdef HAVE_BLKID
+#if HAVE_BLKID
DEFINE_TRIVIAL_CLEANUP_FUNC(blkid_probe, blkid_free_probe);
#define _cleanup_blkid_free_probe_ _cleanup_(blkid_free_probep)
#endif
#include <sys/sysmacros.h>
#include <unistd.h>
-#ifdef HAVE_LINUX_BTRFS_H
+#if HAVE_LINUX_BTRFS_H
#include <linux/btrfs.h>
#endif
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#ifdef HAVE_PAM
+#if HAVE_PAM
#define _PAM_FEATURE_ "+PAM"
#else
#define _PAM_FEATURE_ "-PAM"
#endif
-#ifdef HAVE_AUDIT
+#if HAVE_AUDIT
#define _AUDIT_FEATURE_ "+AUDIT"
#else
#define _AUDIT_FEATURE_ "-AUDIT"
#endif
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
#define _SELINUX_FEATURE_ "+SELINUX"
#else
#define _SELINUX_FEATURE_ "-SELINUX"
#endif
-#ifdef HAVE_APPARMOR
+#if HAVE_APPARMOR
#define _APPARMOR_FEATURE_ "+APPARMOR"
#else
#define _APPARMOR_FEATURE_ "-APPARMOR"
#endif
-#ifdef HAVE_IMA
+#if HAVE_IMA
#define _IMA_FEATURE_ "+IMA"
#else
#define _IMA_FEATURE_ "-IMA"
#endif
-#ifdef HAVE_SMACK
+#if HAVE_SMACK
#define _SMACK_FEATURE_ "+SMACK"
#else
#define _SMACK_FEATURE_ "-SMACK"
#endif
-#ifdef HAVE_SYSV_COMPAT
+#if HAVE_SYSV_COMPAT
#define _SYSVINIT_FEATURE_ "+SYSVINIT"
#else
#define _SYSVINIT_FEATURE_ "-SYSVINIT"
#endif
-#ifdef HAVE_UTMP
+#if HAVE_UTMP
#define _UTMP_FEATURE_ "+UTMP"
#else
#define _UTMP_FEATURE_ "-UTMP"
#endif
-#ifdef HAVE_LIBCRYPTSETUP
+#if HAVE_LIBCRYPTSETUP
#define _LIBCRYPTSETUP_FEATURE_ "+LIBCRYPTSETUP"
#else
#define _LIBCRYPTSETUP_FEATURE_ "-LIBCRYPTSETUP"
#endif
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
#define _GCRYPT_FEATURE_ "+GCRYPT"
#else
#define _GCRYPT_FEATURE_ "-GCRYPT"
#endif
-#ifdef HAVE_GNUTLS
+#if HAVE_GNUTLS
#define _GNUTLS_FEATURE_ "+GNUTLS"
#else
#define _GNUTLS_FEATURE_ "-GNUTLS"
#endif
-#ifdef HAVE_ACL
+#if HAVE_ACL
#define _ACL_FEATURE_ "+ACL"
#else
#define _ACL_FEATURE_ "-ACL"
#endif
-#ifdef HAVE_XZ
+#if HAVE_XZ
#define _XZ_FEATURE_ "+XZ"
#else
#define _XZ_FEATURE_ "-XZ"
#endif
-#ifdef HAVE_LZ4
+#if HAVE_LZ4
#define _LZ4_FEATURE_ "+LZ4"
#else
#define _LZ4_FEATURE_ "-LZ4"
#endif
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
#define _SECCOMP_FEATURE_ "+SECCOMP"
#else
#define _SECCOMP_FEATURE_ "-SECCOMP"
#endif
-#ifdef HAVE_BLKID
+#if HAVE_BLKID
#define _BLKID_FEATURE_ "+BLKID"
#else
#define _BLKID_FEATURE_ "-BLKID"
#endif
-#ifdef HAVE_ELFUTILS
+#if HAVE_ELFUTILS
#define _ELFUTILS_FEATURE_ "+ELFUTILS"
#else
#define _ELFUTILS_FEATURE_ "-ELFUTILS"
#endif
-#ifdef HAVE_KMOD
+#if HAVE_KMOD
#define _KMOD_FEATURE_ "+KMOD"
#else
#define _KMOD_FEATURE_ "-KMOD"
#endif
-#ifdef HAVE_LIBIDN2
+#if HAVE_LIBIDN2
#define _IDN2_FEATURE_ "+IDN2"
#else
#define _IDN2_FEATURE_ "-IDN2"
#endif
-#ifdef HAVE_LIBIDN
+#if HAVE_LIBIDN
#define _IDN_FEATURE_ "+IDN"
#else
#define _IDN_FEATURE_ "-IDN"
#define SIGNALS_CRASH_HANDLER SIGSEGV,SIGILL,SIGFPE,SIGBUS,SIGQUIT,SIGABRT
#define SIGNALS_IGNORE SIGPIPE
-#ifdef HAVE_SPLIT_USR
+#if HAVE_SPLIT_USR
#define KBD_KEYMAP_DIRS \
"/usr/share/keymaps/\0" \
"/usr/share/kbd/keymaps/\0" \
#define NOTIFY_FD_MAX 768
#define NOTIFY_BUFFER_MAX PIPE_BUF
-#ifdef HAVE_SPLIT_USR
+#if HAVE_SPLIT_USR
# define _CONF_PATHS_SPLIT_USR(n) "/lib/" n "\0"
#else
# define _CONF_PATHS_SPLIT_USR(n)
#include "strv.h"
#include "util.h"
-#ifdef ENABLE_DEBUG_HASHMAP
+#if ENABLE_DEBUG_HASHMAP
#include <pthread.h>
#include "list.h"
#endif
#define DIB_FREE UINT_MAX
-#ifdef ENABLE_DEBUG_HASHMAP
+#if ENABLE_DEBUG_HASHMAP
struct hashmap_debug_info {
LIST_FIELDS(struct hashmap_debug_info, debug_list);
unsigned max_entries; /* high watermark of n_entries */
dibs = dib_raw_ptr(h);
assert(dibs[idx] != DIB_RAW_FREE);
-#ifdef ENABLE_DEBUG_HASHMAP
+#if ENABLE_DEBUG_HASHMAP
h->debug.rem_count++;
h->debug.last_rem_idx = idx;
#endif
assert(e->p.b.key == i->next_key);
}
-#ifdef ENABLE_DEBUG_HASHMAP
+#if ENABLE_DEBUG_HASHMAP
i->prev_idx = idx;
#endif
}
idx = i->idx;
-#ifdef ENABLE_DEBUG_HASHMAP
+#if ENABLE_DEBUG_HASHMAP
i->prev_idx = idx;
#endif
return IDX_NIL;
}
-#ifdef ENABLE_DEBUG_HASHMAP
+#if ENABLE_DEBUG_HASHMAP
if (i->idx == IDX_FIRST) {
i->put_count = h->debug.put_count;
i->rem_count = h->debug.rem_count;
shared_hash_key_initialized= true;
}
-#ifdef ENABLE_DEBUG_HASHMAP
+#if ENABLE_DEBUG_HASHMAP
h->debug.func = func;
h->debug.file = file;
h->debug.line = line;
assert(!h->has_indirect);
assert(!h->n_direct_entries);
-#ifdef ENABLE_DEBUG_HASHMAP
+#if ENABLE_DEBUG_HASHMAP
assert_se(pthread_mutex_lock(&hashmap_debug_list_mutex) == 0);
LIST_REMOVE(debug_list, hashmap_debug_list, &h->debug);
assert_se(pthread_mutex_unlock(&hashmap_debug_list_mutex) == 0);
dib_raw_t raw_dib, *dibs;
unsigned dib, distance;
-#ifdef ENABLE_DEBUG_HASHMAP
+#if ENABLE_DEBUG_HASHMAP
h->debug.put_count++;
#endif
assert_se(hashmap_put_robin_hood(h, idx, swap) == false);
n_entries_inc(h);
-#ifdef ENABLE_DEBUG_HASHMAP
+#if ENABLE_DEBUG_HASHMAP
h->debug.max_entries = MAX(h->debug.max_entries, n_entries(h));
#endif
idx = bucket_scan(h, hash, key);
if (idx != IDX_NIL) {
e = plain_bucket_at(h, idx);
-#ifdef ENABLE_DEBUG_HASHMAP
+#if ENABLE_DEBUG_HASHMAP
/* Although the key is equal, the key pointer may have changed,
* and this would break our assumption for iterating. So count
* this operation as incompatible with iteration. */
typedef struct {
unsigned idx; /* index of an entry to be iterated next */
const void *next_key; /* expected value of that entry's key pointer */
-#ifdef ENABLE_DEBUG_HASHMAP
+#if ENABLE_DEBUG_HASHMAP
unsigned put_count; /* hashmap's put_count recorded at start of iteration */
unsigned rem_count; /* hashmap's rem_count in previous iteration */
unsigned prev_idx; /* idx in previous iteration */
(Hashmap*)(h), \
(void)0)
-#ifdef ENABLE_DEBUG_HASHMAP
+#if ENABLE_DEBUG_HASHMAP
# define HASHMAP_DEBUG_PARAMS , const char *func, const char *file, int line
# define HASHMAP_DEBUG_SRC_ARGS , __func__, __FILE__, __LINE__
# define HASHMAP_DEBUG_PASS_ARGS , func, file, line
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
-#ifdef HAVE_LINUX_MEMFD_H
+#if HAVE_LINUX_MEMFD_H
#include <linux/memfd.h>
#endif
#include <stdio.h>
#include <uchar.h>
#include <unistd.h>
-#ifdef HAVE_AUDIT
+#if HAVE_AUDIT
#include <libaudit.h>
#endif
#include <asm/sgidefs.h>
#endif
-#ifdef HAVE_LINUX_BTRFS_H
+#if HAVE_LINUX_BTRFS_H
#include <linux/btrfs.h>
#endif
-#ifdef HAVE_LINUX_VM_SOCKETS_H
+#if HAVE_LINUX_VM_SOCKETS_H
#include <linux/vm_sockets.h>
#else
#define VMADDR_CID_ANY -1U
#define BTRFS_QGROUP_LEVEL_SHIFT 48
#endif
-#ifndef HAVE_LINUX_BTRFS_H
+#if ! HAVE_LINUX_BTRFS_H
struct btrfs_ioctl_vol_args {
int64_t fd;
char name[BTRFS_PATH_NAME_MAX + 1];
#define MAX_HANDLE_SZ 128
#endif
-#ifndef HAVE_SECURE_GETENV
-# ifdef HAVE___SECURE_GETENV
+#if ! HAVE_SECURE_GETENV
+# if HAVE___SECURE_GETENV
# define secure_getenv __secure_getenv
# else
# error "neither secure_getenv nor __secure_getenv are available"
#define KEY_ALS_TOGGLE 0x230
#endif
-#ifndef HAVE_KEY_SERIAL_T
+#if ! HAVE_KEY_SERIAL_T
typedef int32_t key_serial_t;
#endif
#ifndef IF_OPER_UP
#define IF_OPER_UP 6
-#ifndef HAVE_CHAR32_T
+#if ! HAVE_CHAR32_T
#define char32_t uint32_t
#endif
-#ifndef HAVE_CHAR16_T
+#if ! HAVE_CHAR16_T
#define char16_t uint16_t
#endif
#define IFA_F_MCAUTOJOIN 0x400
#endif
-#ifndef HAVE_STRUCT_ETHTOOL_LINK_SETTINGS
+#if ! HAVE_STRUCT_ETHTOOL_LINK_SETTINGS
#define ETHTOOL_GLINKSETTINGS 0x0000004c /* Get ethtool_link_settings */
#define ETHTOOL_SLINKSETTINGS 0x0000004d /* Set ethtool_link_settings */
#endif
-#ifndef HAVE_STRUCT_FIB_RULE_UID_RANGE
+#if ! HAVE_STRUCT_FIB_RULE_UID_RANGE
struct fib_rule_uid_range {
__u32 start;
#define DEFAULT_PATH_NORMAL "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
#define DEFAULT_PATH_SPLIT_USR DEFAULT_PATH_NORMAL ":/sbin:/bin"
-#ifdef HAVE_SPLIT_USR
+#if HAVE_SPLIT_USR
# define DEFAULT_PATH DEFAULT_PATH_SPLIT_USR
#else
# define DEFAULT_PATH DEFAULT_PATH_NORMAL
#include <sys/wait.h>
#include <syslog.h>
#include <unistd.h>
-#ifdef HAVE_VALGRIND_VALGRIND_H
+#if HAVE_VALGRIND_VALGRIND_H
#include <valgrind/valgrind.h>
#endif
}
void valgrind_summary_hack(void) {
-#ifdef HAVE_VALGRIND_VALGRIND_H
+#if HAVE_VALGRIND_VALGRIND_H
if (getpid_cached() == 1 && RUNNING_ON_VALGRIND) {
pid_t pid;
pid = raw_clone(SIGCHLD);
#include <linux/random.h>
#include <stdint.h>
-#ifdef HAVE_SYS_AUXV_H
+#if HAVE_SYS_AUXV_H
# include <sys/auxv.h>
#endif
-#ifdef USE_SYS_RANDOM_H
+#if USE_SYS_RANDOM_H
# include <sys/random.h>
#else
# include <linux/random.h>
void initialize_srand(void) {
static bool srand_called = false;
unsigned x;
-#ifdef HAVE_SYS_AUXV_H
+#if HAVE_SYS_AUXV_H
void *auxv;
#endif
if (srand_called)
return;
-#ifdef HAVE_SYS_AUXV_H
+#if HAVE_SYS_AUXV_H
/* The kernel provides us with 16 bytes of entropy in auxv, so let's
* try to make use of that to seed the pseudo-random generator. It's
* better than nothing... */
#include <sys/un.h>
#include <syslog.h>
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
#include <selinux/context.h>
#include <selinux/label.h>
#include <selinux/selinux.h>
#include "time-util.h"
#include "util.h"
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
DEFINE_TRIVIAL_CLEANUP_FUNC(char*, freecon);
DEFINE_TRIVIAL_CLEANUP_FUNC(context_t, context_free);
#endif
bool mac_selinux_use(void) {
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
if (cached_use < 0)
cached_use = is_selinux_enabled() > 0;
}
void mac_selinux_retest(void) {
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
cached_use = -1;
#endif
}
int mac_selinux_init(void) {
int r = 0;
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
usec_t before_timestamp, after_timestamp;
struct mallinfo before_mallinfo, after_mallinfo;
void mac_selinux_finish(void) {
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
if (!label_hnd)
return;
int mac_selinux_fix(const char *path, bool ignore_enoent, bool ignore_erofs) {
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
struct stat st;
int r;
int mac_selinux_apply(const char *path, const char *label) {
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
if (!mac_selinux_use())
return 0;
int mac_selinux_get_create_label_from_exe(const char *exe, char **label) {
int r = -EOPNOTSUPP;
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
_cleanup_freecon_ char *mycon = NULL, *fcon = NULL;
security_class_t sclass;
assert(label);
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
if (!mac_selinux_use())
return -EOPNOTSUPP;
int mac_selinux_get_child_mls_label(int socket_fd, const char *exe, const char *exec_label, char **label) {
int r = -EOPNOTSUPP;
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
_cleanup_freecon_ char *mycon = NULL, *peercon = NULL, *fcon = NULL;
_cleanup_context_free_ context_t pcon = NULL, bcon = NULL;
security_class_t sclass;
char* mac_selinux_free(char *label) {
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
if (!label)
return NULL;
int mac_selinux_create_file_prepare(const char *path, mode_t mode) {
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
_cleanup_freecon_ char *filecon = NULL;
int r;
void mac_selinux_create_file_clear(void) {
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
PROTECT_ERRNO;
if (!mac_selinux_use())
int mac_selinux_create_socket_prepare(const char *label) {
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
if (!mac_selinux_use())
return 0;
void mac_selinux_create_socket_clear(void) {
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
PROTECT_ERRNO;
if (!mac_selinux_use())
/* Binds a socket and label its file system object according to the SELinux policy */
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
_cleanup_freecon_ char *fcon = NULL;
const struct sockaddr_un *un;
bool context_changed = false;
#include "string-table.h"
#include "xattr-util.h"
-#ifdef HAVE_SMACK
+#if HAVE_SMACK
bool mac_smack_use(void) {
static int cached_use = -1;
#include "utf8.h"
#include "util.h"
-#ifdef ENABLE_IDN
+#if ENABLE_IDN
# define IDN_FLAGS (NI_IDN|NI_IDN_USE_STD3_ASCII_RULES)
#else
# define IDN_FLAGS 0
loaded_image->LoadOptions = options;
loaded_image->LoadOptionsSize = (StrLen(loaded_image->LoadOptions)+1) * sizeof(CHAR16);
-#ifdef ENABLE_TPM
+#if ENABLE_TPM
/* Try to log any options to the TPM, especially to catch manually edited options */
err = tpm_log_event(SD_TPM_PCR,
(EFI_PHYSICAL_ADDRESS) loaded_image->LoadOptions,
*
*/
-#ifdef ENABLE_TPM
+#if ENABLE_TPM
#include <efi.h>
#include <efilib.h>
stub.c
'''.split()
-if conf.get('ENABLE_EFI', false) and get_option('gnu-efi') != 'false'
+if conf.get('ENABLE_EFI') == 1 and get_option('gnu-efi') != 'false'
efi_cc = get_option('efi-cc')
efi_ld = get_option('efi-ld')
efi_conf = configuration_data()
efi_conf.set_quoted('PACKAGE_VERSION', meson.project_version())
efi_conf.set_quoted('EFI_MACHINE_TYPE_NAME', EFI_MACHINE_TYPE_NAME)
- efi_conf.set('ENABLE_TPM', get_option('tpm'))
+ efi_conf.set10('ENABLE_TPM', get_option('tpm'))
efi_conf.set('SD_TPM_PCR', get_option('tpm-pcrindex'))
efi_config_h = configure_file(
line[i] = options[i];
cmdline = line;
-#ifdef ENABLE_TPM
+#if ENABLE_TPM
/* Try to log any options to the TPM, especially manually edited options */
err = tpm_log_event(SD_TPM_PCR,
(EFI_PHYSICAL_ADDRESS) loaded_image->LoadOptions,
#include "audit-fd.h"
-#ifdef HAVE_AUDIT
+#if HAVE_AUDIT
#include <libaudit.h>
#include <stdbool.h>
#include <sys/prctl.h>
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
#include <seccomp.h>
#endif
#include "path-util.h"
#include "process-util.h"
#include "rlimit-util.h"
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
#include "seccomp-util.h"
#endif
#include "securebits-util.h"
_cleanup_strv_free_ char **l = NULL;
int r;
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
Iterator i;
void *id;
#endif
if (r < 0)
return r;
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
SET_FOREACH(id, c->syscall_filter, i) {
char *name;
_cleanup_strv_free_ char **l = NULL;
int r;
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
Iterator i;
void *id;
#endif
assert(reply);
assert(c);
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
SET_FOREACH(id, c->syscall_archs, i) {
const char *name;
return 1;
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
} else if (streq(name, "SystemCallFilter")) {
int whitelist;
return 0;
}
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
static int mac_selinux_filter(sd_bus_message *message, void *userdata, sd_bus_error *error) {
Manager *m = userdata;
const char *verb, *path;
assert(m);
assert(bus);
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
r = sd_bus_add_filter(bus, NULL, mac_selinux_filter, m);
if (r < 0)
return log_error_errno(r, "Failed to add SELinux access filter: %m");
#include <unistd.h>
#include <utmpx.h>
-#ifdef HAVE_PAM
+#if HAVE_PAM
#include <security/pam_appl.h>
#endif
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
#include <selinux/selinux.h>
#endif
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
#include <seccomp.h>
#endif
-#ifdef HAVE_APPARMOR
+#if HAVE_APPARMOR
#include <sys/apparmor.h>
#endif
#include "af-list.h"
#include "alloc-util.h"
-#ifdef HAVE_APPARMOR
+#if HAVE_APPARMOR
#include "apparmor-util.h"
#endif
#include "async.h"
#include "process-util.h"
#include "rlimit-util.h"
#include "rm-rf.h"
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
#include "seccomp-util.h"
#endif
#include "securebits.h"
return 0;
}
-#ifdef HAVE_PAM
+#if HAVE_PAM
static int null_conv(
int num_msg,
char ***env,
int fds[], unsigned n_fds) {
-#ifdef HAVE_PAM
+#if HAVE_PAM
static const struct pam_conv conv = {
.conv = null_conv,
c->lock_personality;
}
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
static bool skip_seccomp_unavailable(const Unit* u, const char* msg) {
needs_setuid, /* Do we need to do the actual setresuid()/setresgid() calls? */
needs_mount_namespace, /* Do we need to set up a mount namespace for this kernel? */
needs_ambient_hack; /* Do we need to apply the ambient capabilities hack? */
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
bool use_selinux = false;
#endif
-#ifdef HAVE_SMACK
+#if HAVE_SMACK
bool use_smack = false;
#endif
-#ifdef HAVE_APPARMOR
+#if HAVE_APPARMOR
bool use_apparmor = false;
#endif
uid_t uid = UID_INVALID;
* present. The actual MAC context application will happen later, as late as possible, to avoid
* impacting our own code paths. */
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
use_selinux = mac_selinux_use();
#endif
-#ifdef HAVE_SMACK
+#if HAVE_SMACK
use_smack = mac_smack_use();
#endif
-#ifdef HAVE_APPARMOR
+#if HAVE_APPARMOR
use_apparmor = mac_apparmor_use();
#endif
}
}
if (needs_sandboxing) {
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
if (use_selinux && params->selinux_context_net && socket_fd >= 0) {
r = mac_selinux_get_child_mls_label(socket_fd, command->path, context->selinux_context, &mac_selinux_context_net);
if (r < 0) {
* syscalls that are subject to seccomp filtering, hence should probably be applied before the syscalls
* are restricted. */
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
if (use_selinux) {
char *exec_context = mac_selinux_context_net ?: context->selinux_context;
}
#endif
-#ifdef HAVE_SMACK
+#if HAVE_SMACK
if (use_smack) {
r = setup_smack(context, command);
if (r < 0) {
}
#endif
-#ifdef HAVE_APPARMOR
+#if HAVE_APPARMOR
if (use_apparmor && context->apparmor_profile) {
r = aa_change_onexec(context->apparmor_profile);
if (r < 0 && !context->apparmor_profile_ignore) {
return log_unit_error_errno(unit, errno, "Failed to disable new privileges: %m");
}
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
r = apply_address_families(unit, context);
if (r < 0) {
*exit_status = EXIT_ADDRESS_FAMILIES;
prefix, yes_no(c->lock_personality));
if (c->syscall_filter) {
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
Iterator j;
void *id;
bool first = true;
if (!c->syscall_whitelist)
fputc('~', f);
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
SET_FOREACH(id, c->syscall_filter, j) {
_cleanup_free_ char *name = NULL;
}
if (c->syscall_archs) {
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
Iterator j;
void *id;
#endif
"%sSystemCallArchitectures:",
prefix);
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
SET_FOREACH(id, c->syscall_archs, j)
fprintf(f, " %s", strna(seccomp_arch_to_string(PTR_TO_UINT32(id) - 1)));
#endif
#define IMA_POLICY_PATH "/etc/ima/ima-policy"
int ima_setup(void) {
-#ifdef HAVE_IMA
+#if HAVE_IMA
_cleanup_fclose_ FILE *input = NULL;
_cleanup_close_ int imafd = -1;
unsigned lineno = 0;
#include <string.h>
#include <unistd.h>
-#ifdef HAVE_KMOD
+#if HAVE_KMOD
#include <libkmod.h>
#endif
#include "macro.h"
#include "string-util.h"
-#ifdef HAVE_KMOD
+#if HAVE_KMOD
static void systemd_kmod_log(
void *data,
int priority,
#endif
int kmod_setup(void) {
-#ifdef HAVE_KMOD
+#if HAVE_KMOD
static const struct {
const char *module;
/* this should never be a module */
{ "unix", "/proc/net/unix", true, true, NULL },
-#ifdef HAVE_LIBIPTC
+#if HAVE_LIBIPTC
/* netfilter is needed by networkd, nspawn among others, and cannot be autoloaded */
{ "ip_tables", "/proc/net/ip_tables_names", false, false, NULL },
#endif
#include <fcntl.h>
#include <linux/fs.h>
#include <linux/oom.h>
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
#include <seccomp.h>
#endif
#include <sched.h>
#include "path-util.h"
#include "process-util.h"
#include "rlimit-util.h"
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
#include "seccomp-util.h"
#endif
#include "securebits.h"
return 0;
}
-#ifdef HAVE_SYSV_COMPAT
+#if HAVE_SYSV_COMPAT
int config_parse_sysv_priority(const char *unit,
const char *filename,
unsigned line,
return r;
}
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
static int syscall_filter_parse_one(
const char *unit,
const ConfigParserCallback callback;
const char *rvalue;
} table[] = {
-#if !defined(HAVE_SYSV_COMPAT) || !defined(HAVE_SECCOMP) || !defined(HAVE_PAM) || !defined(HAVE_SELINUX) || !defined(HAVE_SMACK) || !defined(HAVE_APPARMOR)
+#if !HAVE_SYSV_COMPAT || !HAVE_SECCOMP || !HAVE_PAM || !HAVE_SELINUX || !HAVE_SMACK || !HAVE_APPARMOR
{ config_parse_warn_compat, "NOTSUPPORTED" },
#endif
{ config_parse_int, "INTEGER" },
{ config_parse_exec, "PATH [ARGUMENT [...]]" },
{ config_parse_service_type, "SERVICETYPE" },
{ config_parse_service_restart, "SERVICERESTART" },
-#ifdef HAVE_SYSV_COMPAT
+#if HAVE_SYSV_COMPAT
{ config_parse_sysv_priority, "SYSVPRIORITY" },
#endif
{ config_parse_kill_mode, "KILLMODE" },
{ config_parse_set_status, "STATUS" },
{ config_parse_service_sockets, "SOCKETS" },
{ config_parse_environ, "ENVIRON" },
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
{ config_parse_syscall_filter, "SYSCALLS" },
{ config_parse_syscall_archs, "ARCHS" },
{ config_parse_syscall_errno, "ERRNO" },
{ config_parse_blockio_device_weight, "DEVICEWEIGHT" },
{ config_parse_long, "LONG" },
{ config_parse_socket_service, "SERVICE" },
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
{ config_parse_exec_selinux_context, "LABEL" },
#endif
{ config_parse_job_mode, "MODE" },
#include <sys/reboot.h>
#include <sys/stat.h>
#include <unistd.h>
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
#include <seccomp.h>
#endif
-#ifdef HAVE_VALGRIND_VALGRIND_H
+#if HAVE_VALGRIND_VALGRIND_H
#include <valgrind/valgrind.h>
#endif
#include "process-util.h"
#include "raw-clone.h"
#include "rlimit-util.h"
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
#include "seccomp-util.h"
#endif
#include "selinux-setup.h"
{ "Manager", "RuntimeWatchdogSec", config_parse_sec, 0, &arg_runtime_watchdog },
{ "Manager", "ShutdownWatchdogSec", config_parse_sec, 0, &arg_shutdown_watchdog },
{ "Manager", "CapabilityBoundingSet", config_parse_capability_set, 0, &arg_capability_bounding_set },
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
{ "Manager", "SystemCallArchitectures", config_parse_syscall_archs, 0, &arg_syscall_archs },
#endif
{ "Manager", "TimerSlackNSec", config_parse_nsec, 0, &arg_timer_slack_nsec },
}
static int enforce_syscall_archs(Set *archs) {
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
int r;
if (!is_seccomp_available())
struct rlimit saved_rlimit_nofile = RLIMIT_MAKE_CONST(0), saved_rlimit_memlock = RLIMIT_MAKE_CONST((rlim_t) -1);
const char *error_message = NULL;
-#ifdef HAVE_SYSV_COMPAT
+#if HAVE_SYSV_COMPAT
if (getpid_cached() != 1 && strstr(program_invocation_short_name, "init")) {
/* This is compatibility support for SysV, where
* calling init as a user is identical to telinit. */
arg_serialization = safe_fclose(arg_serialization);
fds = fdset_free(fds);
-#ifdef HAVE_VALGRIND_VALGRIND_H
+#if HAVE_VALGRIND_VALGRIND_H
/* If we are PID 1 and running under valgrind, then let's exit
* here explicitly. valgrind will only generate nice output on
* exit(), not on exec(), hence let's do the former not the
#include <sys/wait.h>
#include <unistd.h>
-#ifdef HAVE_AUDIT
+#if HAVE_AUDIT
#include <libaudit.h>
#endif
m->default_timeout_stop_usec = DEFAULT_TIMEOUT_USEC;
m->default_restart_usec = DEFAULT_RESTART_USEC;
-#ifdef ENABLE_EFI
+#if ENABLE_EFI
if (MANAGER_IS_SYSTEM(m) && detect_container() <= 0)
boot_timestamps(&m->userspace_timestamp, &m->firmware_timestamp, &m->loader_timestamp);
#endif
void manager_send_unit_audit(Manager *m, Unit *u, int type, bool success) {
-#ifdef HAVE_AUDIT
+#if HAVE_AUDIT
_cleanup_free_ char *p = NULL;
const char *msg;
int audit_fd, r;
* fourth (securityfs) is needed by IMA to load a custom policy. The
* other ones we can delay until SELinux and IMA are loaded. When
* SMACK is enabled we need smackfs, too, so it's a fifth one. */
-#ifdef HAVE_SMACK
+#if HAVE_SMACK
#define N_EARLY_MOUNT 5
#else
#define N_EARLY_MOUNT 4
NULL, MNT_FATAL|MNT_IN_CONTAINER },
{ "securityfs", "/sys/kernel/security", "securityfs", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV,
NULL, MNT_NONE },
-#ifdef HAVE_SMACK
+#if HAVE_SMACK
{ "smackfs", "/sys/fs/smackfs", "smackfs", "smackfsdef=*", MS_NOSUID|MS_NOEXEC|MS_NODEV,
mac_smack_use, MNT_FATAL },
{ "tmpfs", "/dev/shm", "tmpfs", "mode=1777,smackfsroot=*", MS_NOSUID|MS_NODEV|MS_STRICTATIME,
NULL, MNT_FATAL|MNT_IN_CONTAINER },
{ "devpts", "/dev/pts", "devpts", "mode=620,gid=" STRINGIFY(TTY_GID), MS_NOSUID|MS_NOEXEC,
NULL, MNT_IN_CONTAINER },
-#ifdef HAVE_SMACK
+#if HAVE_SMACK
{ "tmpfs", "/run", "tmpfs", "mode=755,smackfsroot=*", MS_NOSUID|MS_NODEV|MS_STRICTATIME,
mac_smack_use, MNT_FATAL },
#endif
cg_is_legacy_wanted, MNT_FATAL|MNT_IN_CONTAINER },
{ "pstore", "/sys/fs/pstore", "pstore", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV,
NULL, MNT_NONE },
-#ifdef ENABLE_EFI
+#if ENABLE_EFI
{ "efivarfs", "/sys/firmware/efi/efivars", "efivarfs", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV,
is_efi_boot, MNT_NONE },
#endif
return 0;
}
-#if defined(HAVE_SELINUX) || defined(HAVE_SMACK)
+#if HAVE_SELINUX || HAVE_SMACK
static int nftw_cb(
const char *fpath,
const struct stat *sb,
if (r < 0)
return r;
-#if defined(HAVE_SELINUX) || defined(HAVE_SMACK)
+#if HAVE_SELINUX || HAVE_SMACK
/* Nodes in devtmpfs and /run need to be manually updated for
* the appropriate labels, after mounting. The other virtual
* API file systems like /sys and /proc do not need that, they
/* ProtectKernelModules= option */
static const MountEntry protect_kernel_modules_table[] = {
-#ifdef HAVE_SPLIT_USR
+#if HAVE_SPLIT_USR
{ "/lib/modules", INACCESSIBLE, true },
#endif
{ "/usr/lib/modules", INACCESSIBLE, true },
#include "selinux-access.h"
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
#include <errno.h>
#include <selinux/avc.h>
#include <selinux/selinux.h>
#include <stdio.h>
-#ifdef HAVE_AUDIT
+#if HAVE_AUDIT
#include <libaudit.h>
#endif
va_list ap;
const char *fmt2;
-#ifdef HAVE_AUDIT
+#if HAVE_AUDIT
int fd;
fd = get_audit_fd();
int mac_selinux_generic_access_check(sd_bus_message *message, const char *path, const char *permission, sd_bus_error *error);
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
#define mac_selinux_access_check(message, permission, error) \
mac_selinux_generic_access_check((message), NULL, (permission), (error))
#include <stdio.h>
#include <unistd.h>
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
#include <selinux/selinux.h>
#endif
#include "string-util.h"
#include "util.h"
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
_printf_(2,3)
static int null_log(int type, const char *fmt, ...) {
return 0;
int mac_selinux_setup(bool *loaded_policy) {
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
int enforce = 0;
usec_t before_load, after_load;
char *con;
#include "string-util.h"
#include "util.h"
-#ifdef HAVE_SMACK
+#if HAVE_SMACK
static int write_access2_rules(const char* srcdir) {
_cleanup_close_ int load2_fd = -1, change_fd = -1;
int mac_smack_setup(bool *loaded_policy) {
-#ifdef HAVE_SMACK
+#if HAVE_SMACK
int r;
static bool nonunmountable_path(const char *path) {
return path_equal(path, "/")
-#ifndef HAVE_SPLIT_USR
+#if ! HAVE_SPLIT_USR
|| path_equal(path, "/usr")
#endif
|| path_startswith(path, "/run/initramfs");
#include <sys/xattr.h>
#include <unistd.h>
-#ifdef HAVE_ELFUTILS
+#if HAVE_ELFUTILS
#include <dwarf.h>
#include <elfutils/libdwfl.h>
#endif
static int fix_acl(int fd, uid_t uid) {
-#ifdef HAVE_ACL
+#if HAVE_ACL
_cleanup_(acl_freep) acl_t acl = NULL;
acl_entry_t entry;
acl_permset_t permset;
goto fail;
}
-#if defined(HAVE_XZ) || defined(HAVE_LZ4)
+#if HAVE_XZ || HAVE_LZ4
/* If we will remove the coredump anyway, do not compress. */
if (arg_compress && !maybe_remove_external_coredump(NULL, st.st_size)) {
if (r < 0)
return log_error_errno(r, "Failed to drop privileges: %m");
-#ifdef HAVE_ELFUTILS
+#if HAVE_ELFUTILS
/* Try to get a strack trace if we can */
if (coredump_size <= arg_process_size_max) {
_cleanup_free_ char *stacktrace = NULL;
}
if (filename) {
-#if defined(HAVE_XZ) || defined(HAVE_LZ4)
+#if HAVE_XZ || HAVE_LZ4
_cleanup_close_ int fdf;
fdf = open(filename, O_RDONLY | O_CLOEXEC);
coredump-vacuum.h
'''.split())
-if conf.get('HAVE_ELFUTILS', false)
+if conf.get('HAVE_ELFUTILS') == 1
systemd_coredump_sources += files(['stacktrace.c',
'stacktrace.h'])
endif
"/usr/local/share\0"
"/usr/lib\0"
"/usr/share\0"
-#ifdef HAVE_SPLIT_USR
+#if HAVE_SPLIT_USR
"/lib\0"
#endif
;
}
static int should_skip_prefix(const char* p) {
-#ifdef HAVE_SPLIT_USR
+#if HAVE_SPLIT_USR
int r;
_cleanup_free_ char *target = NULL;
}
}
-#ifdef HAVE_SYSV_COMPAT
+#if HAVE_SYSV_COMPAT
else if (streq(key, "fastboot") && !value) {
log_warning("Please pass 'fsck.mode=skip' rather than 'fastboot' on the kernel command line.");
arg_skip = true;
static void test_files(void) {
-#ifdef HAVE_SYSV_COMPAT
+#if HAVE_SYSV_COMPAT
if (access("/fastboot", F_OK) >= 0) {
log_error("Please pass 'fsck.mode=skip' on the kernel command line rather than creating /fastboot on the root file system.");
arg_skip = true;
return generator_add_symlink(arg_dest, SPECIAL_SWAP_TARGET, "wants", name);
}
-#ifdef ENABLE_EFI
+#if ENABLE_EFI
static int add_automount(
const char *id,
const char *what,
return 0;
}
-#ifdef ENABLE_EFI
+#if ENABLE_EFI
static int add_root_cryptsetup(void) {
/* If a device /dev/gpt-auto-root-luks appears, then make it pull in systemd-cryptsetup-root.service, which
static int add_root_mount(void) {
-#ifdef ENABLE_EFI
+#if ENABLE_EFI
int r;
if (!is_efi_boot()) {
-if conf.get('ENABLE_HOSTNAMED', false)
+if conf.get('ENABLE_HOSTNAMED') == 1
install_data('org.freedesktop.hostname1.conf',
install_dir : dbuspolicydir)
install_data('org.freedesktop.hostname1.service',
import-compress.h
'''.split())
-if conf.get('ENABLE_IMPORTD', false)
+if conf.get('ENABLE_IMPORTD') == 1
install_data('org.freedesktop.import1.conf',
install_dir : dbuspolicydir)
install_data('org.freedesktop.import1.service',
break;
case ARG_TRUST:
-#ifdef HAVE_GNUTLS
+#if HAVE_GNUTLS
if (arg_trust_pem) {
log_error("CA certificate file specified twice");
return -EINVAL;
if (streq(optarg, "all"))
arg_trust_all = true;
else {
-#ifdef HAVE_GNUTLS
+#if HAVE_GNUTLS
arg_trust = strdup(optarg);
if (!arg_trust)
return log_oom();
break;
case ARG_GNUTLS_LOG: {
-#ifdef HAVE_GNUTLS
+#if HAVE_GNUTLS
const char* p = optarg;
for (;;) {
_cleanup_free_ char *word = NULL;
microhttpd-util.c
'''.split())
-if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_LIBCURL', false)
+if conf.get('ENABLE_REMOTE') ==1 and conf.get('HAVE_LIBCURL') == 1
journal_upload_conf = configure_file(
input : 'journal-upload.conf.in',
output : 'journal-upload.conf',
install_dir : pkgsysconfdir)
endif
-if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_MICROHTTPD', false)
+if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
journal_remote_conf = configure_file(
input : 'journal-remote.conf.in',
output : 'journal-remote.conf',
#include <stdio.h>
#include <string.h>
-#ifdef HAVE_GNUTLS
+#if HAVE_GNUTLS
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
#endif
return mhd_respond_internal(connection, code, m, r, MHD_RESPMEM_MUST_FREE);
}
-#ifdef HAVE_GNUTLS
+#if HAVE_GNUTLS
static struct {
const char *const names[4];
#include <stdio.h>
#include <linux/audit.h>
-#ifdef HAVE_AUDIT
+#if HAVE_AUDIT
# include <libaudit.h>
#endif
#include <sys/mman.h>
#include <unistd.h>
-#ifdef HAVE_XZ
+#if HAVE_XZ
#include <lzma.h>
#endif
-#ifdef HAVE_LZ4
+#if HAVE_LZ4
#include <lz4.h>
#include <lz4frame.h>
#endif
#include "string-util.h"
#include "util.h"
-#ifdef HAVE_LZ4
+#if HAVE_LZ4
DEFINE_TRIVIAL_CLEANUP_FUNC(LZ4F_compressionContext_t, LZ4F_freeCompressionContext);
DEFINE_TRIVIAL_CLEANUP_FUNC(LZ4F_decompressionContext_t, LZ4F_freeDecompressionContext);
#endif
int compress_blob_xz(const void *src, uint64_t src_size,
void *dst, size_t dst_alloc_size, size_t *dst_size) {
-#ifdef HAVE_XZ
+#if HAVE_XZ
static const lzma_options_lzma opt = {
1u << 20u, NULL, 0, LZMA_LC_DEFAULT, LZMA_LP_DEFAULT,
LZMA_PB_DEFAULT, LZMA_MODE_FAST, 128, LZMA_MF_HC3, 4
int compress_blob_lz4(const void *src, uint64_t src_size,
void *dst, size_t dst_alloc_size, size_t *dst_size) {
-#ifdef HAVE_LZ4
+#if HAVE_LZ4
int r;
assert(src);
int decompress_blob_xz(const void *src, uint64_t src_size,
void **dst, size_t *dst_alloc_size, size_t* dst_size, size_t dst_max) {
-#ifdef HAVE_XZ
+#if HAVE_XZ
_cleanup_(lzma_end) lzma_stream s = LZMA_STREAM_INIT;
lzma_ret ret;
size_t space;
int decompress_blob_lz4(const void *src, uint64_t src_size,
void **dst, size_t *dst_alloc_size, size_t* dst_size, size_t dst_max) {
-#ifdef HAVE_LZ4
+#if HAVE_LZ4
char* out;
int r, size; /* LZ4 uses int for size */
const void *prefix, size_t prefix_len,
uint8_t extra) {
-#ifdef HAVE_XZ
+#if HAVE_XZ
_cleanup_(lzma_end) lzma_stream s = LZMA_STREAM_INIT;
lzma_ret ret;
void **buffer, size_t *buffer_size,
const void *prefix, size_t prefix_len,
uint8_t extra) {
-#ifdef HAVE_LZ4
+#if HAVE_LZ4
/* Checks whether the decompressed blob starts with the
* mentioned prefix. The byte extra needs to follow the
* prefix */
}
int compress_stream_xz(int fdf, int fdt, uint64_t max_bytes) {
-#ifdef HAVE_XZ
+#if HAVE_XZ
_cleanup_(lzma_end) lzma_stream s = LZMA_STREAM_INIT;
lzma_ret ret;
uint8_t buf[BUFSIZ], out[BUFSIZ];
int compress_stream_lz4(int fdf, int fdt, uint64_t max_bytes) {
-#ifdef HAVE_LZ4
+#if HAVE_LZ4
LZ4F_errorCode_t c;
_cleanup_(LZ4F_freeCompressionContextp) LZ4F_compressionContext_t ctx = NULL;
_cleanup_free_ char *buf = NULL;
int decompress_stream_xz(int fdf, int fdt, uint64_t max_bytes) {
-#ifdef HAVE_XZ
+#if HAVE_XZ
_cleanup_(lzma_end) lzma_stream s = LZMA_STREAM_INIT;
lzma_ret ret;
}
int decompress_stream_lz4(int in, int out, uint64_t max_bytes) {
-#ifdef HAVE_LZ4
+#if HAVE_LZ4
size_t c;
_cleanup_(LZ4F_freeDecompressionContextp) LZ4F_decompressionContext_t ctx = NULL;
_cleanup_free_ char *buf = NULL;
static inline int compress_blob(const void *src, uint64_t src_size,
void *dst, size_t dst_alloc_size, size_t *dst_size) {
int r;
-#ifdef HAVE_LZ4
+#if HAVE_LZ4
r = compress_blob_lz4(src, src_size, dst, dst_alloc_size, dst_size);
if (r == 0)
return OBJECT_COMPRESSED_LZ4;
int decompress_stream_xz(int fdf, int fdt, uint64_t max_size);
int decompress_stream_lz4(int fdf, int fdt, uint64_t max_size);
-#ifdef HAVE_LZ4
+#if HAVE_LZ4
# define compress_stream compress_stream_lz4
# define COMPRESSED_EXT ".lz4"
#else
#define HEADER_INCOMPATIBLE_ANY (HEADER_INCOMPATIBLE_COMPRESSED_XZ|HEADER_INCOMPATIBLE_COMPRESSED_LZ4)
-#if defined(HAVE_XZ) && defined(HAVE_LZ4)
+#if HAVE_XZ && HAVE_LZ4
# define HEADER_INCOMPATIBLE_SUPPORTED HEADER_INCOMPATIBLE_ANY
-#elif defined(HAVE_XZ)
+#elif HAVE_XZ
# define HEADER_INCOMPATIBLE_SUPPORTED HEADER_INCOMPATIBLE_COMPRESSED_XZ
-#elif defined(HAVE_LZ4)
+#elif HAVE_LZ4
# define HEADER_INCOMPATIBLE_SUPPORTED HEADER_INCOMPATIBLE_COMPRESSED_LZ4
#else
# define HEADER_INCOMPATIBLE_SUPPORTED 0
};
#define HEADER_COMPATIBLE_ANY HEADER_COMPATIBLE_SEALED
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
# define HEADER_COMPATIBLE_SUPPORTED HEADER_COMPATIBLE_SEALED
#else
# define HEADER_COMPATIBLE_SUPPORTED 0
JournalFile* journal_file_close(JournalFile *f) {
assert(f);
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
/* Write the final tag */
if (f->seal && f->writable) {
int r;
ordered_hashmap_free_free(f->chain_cache);
-#if defined(HAVE_XZ) || defined(HAVE_LZ4)
+#if HAVE_XZ || HAVE_LZ4
free(f->compress_buffer);
#endif
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
if (f->fss_file)
munmap(f->fss_file, PAGE_ALIGN(f->fss_file_size));
else
goto next;
if (o->object.flags & OBJECT_COMPRESSION_MASK) {
-#if defined(HAVE_XZ) || defined(HAVE_LZ4)
+#if HAVE_XZ || HAVE_LZ4
uint64_t l;
size_t rsize = 0;
if (r < 0)
return r;
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
r = journal_file_hmac_put_object(f, OBJECT_FIELD, o, p);
if (r < 0)
return r;
o->data.hash = htole64(hash);
-#if defined(HAVE_XZ) || defined(HAVE_LZ4)
+#if HAVE_XZ || HAVE_LZ4
if (JOURNAL_FILE_COMPRESS(f) && size >= COMPRESSION_SIZE_THRESHOLD) {
size_t rsize = 0;
if (r < 0)
return r;
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
r = journal_file_hmac_put_object(f, OBJECT_DATA, o, p);
if (r < 0)
return r;
if (r < 0)
return r;
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
r = journal_file_hmac_put_object(f, OBJECT_ENTRY_ARRAY, o, q);
if (r < 0)
return r;
o->entry.xor_hash = htole64(xor_hash);
o->entry.boot_id = f->header->boot_id;
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
r = journal_file_hmac_put_object(f, OBJECT_ENTRY, o, np);
if (r < 0)
return r;
ts = &_ts;
}
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
r = journal_file_maybe_append_tag(f, ts->realtime);
if (r < 0)
return r;
f->flags = flags;
f->prot = prot_from_flags(flags);
f->writable = (flags & O_ACCMODE) != O_RDONLY;
-#if defined(HAVE_LZ4)
+#if HAVE_LZ4
f->compress_lz4 = compress;
-#elif defined(HAVE_XZ)
+#elif HAVE_XZ
f->compress_xz = compress;
#endif
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
f->seal = seal;
#endif
fd_setcrtime(f->fd, 0);
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
/* Try to load the FSPRG state, and if we can't, then
* just don't do sealing */
if (f->seal) {
goto fail;
}
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
if (!newly_created && f->writable) {
r = journal_file_fss_load(f);
if (r < 0)
goto fail;
}
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
r = journal_file_hmac_setup(f);
if (r < 0)
goto fail;
if (r < 0)
goto fail;
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
r = journal_file_append_first_tag(f);
if (r < 0)
goto fail;
return -E2BIG;
if (o->object.flags & OBJECT_COMPRESSION_MASK) {
-#if defined(HAVE_XZ) || defined(HAVE_LZ4)
+#if HAVE_XZ || HAVE_LZ4
size_t rsize = 0;
r = decompress_blob(o->object.flags & OBJECT_COMPRESSION_MASK,
#include <inttypes.h>
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
#include <gcrypt.h>
#endif
pthread_t offline_thread;
volatile OfflineState offline_state;
-#if defined(HAVE_XZ) || defined(HAVE_LZ4)
+#if HAVE_XZ || HAVE_LZ4
void *compress_buffer;
size_t compress_buffer_size;
#endif
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
gcry_md_hd_t hmac;
bool hmac_running;
bool found_last = false;
const char *tmp_dir = NULL;
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
uint64_t last_tag = 0;
#endif
assert(f);
if (key) {
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
r = journal_file_parse_verification_key(f, key);
if (r < 0) {
log_error("Failed to parse seed.");
goto fail;
}
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
if (f->seal) {
uint64_t q, rt;
static bool arg_file_stdin = false;
static int arg_priorities = 0xFF;
static char *arg_verify_key = NULL;
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
static usec_t arg_interval = DEFAULT_FSS_INTERVAL_USEC;
static bool arg_force = false;
#endif
" -D --directory=PATH Show journal files from directory\n"
" --file=PATH Show journal file\n"
" --root=ROOT Operate on files below a root directory\n"
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
" --interval=TIME Time interval for changing the FSS sealing key\n"
" --verify-key=KEY Specify FSS verification key\n"
" --force Override of the FSS key pair with --setup-keys\n"
" --dump-catalog Show entries in the message catalog\n"
" --update-catalog Update the message catalog database\n"
" --new-id128 Generate a new 128-bit ID\n"
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
" --setup-keys Generate a new FSS key pair\n"
#endif
, program_invocation_short_name);
arg_action = ACTION_VACUUM;
break;
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
case ARG_FORCE:
arg_force = true;
break;
}
static int setup_keys(void) {
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
size_t mpk_size, seed_size, state_size, i;
uint8_t *mpk, *seed, *state;
int fd = -1, r;
} else
fprintf(stderr, "\nThe keys have been generated for host " SD_ID128_FORMAT_STR ".\n", SD_ID128_FORMAT_VAL(machine));
-#ifdef HAVE_QRENCODE
+#if HAVE_QRENCODE
/* If this is not an UTF-8 system don't print any QR codes */
if (is_locale_utf8()) {
fputs("\nTo transfer the verification key to your phone please scan the QR code below:\n\n", stderr);
int k;
usec_t first = 0, validated = 0, last = 0;
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
if (!arg_verify_key && JOURNAL_HEADER_SEALED(f->header))
log_notice("Journal file %s has sealing enabled but verification key has not been passed using --verify-key=.", f->path);
#endif
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
#include <selinux/selinux.h>
#endif
free_and_replace(c->label, l);
c->label_size = label_size;
}
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
else {
char *con;
if (r < 0)
return log_error_errno(errno, "SO_PASSCRED failed: %m");
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
if (mac_selinux_use()) {
r = setsockopt(s->native_fd, SOL_SOCKET, SO_PASSSEC, &one, sizeof(one));
if (r < 0)
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
#include <selinux/selinux.h>
#endif
#include <sys/ioctl.h>
}
static void server_add_acls(JournalFile *f, uid_t uid) {
-#ifdef HAVE_ACL
+#if HAVE_ACL
int r;
#endif
assert(f);
-#ifdef HAVE_ACL
+#if HAVE_ACL
if (uid <= SYSTEM_UID_MAX)
return;
}
void server_maybe_append_tags(Server *s) {
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
JournalFile *f;
Iterator i;
usec_t n;
#include <stddef.h>
#include <unistd.h>
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
#include <selinux/selinux.h>
#endif
if (r < 0)
return log_error_errno(errno, "SO_PASSCRED failed: %m");
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
if (mac_selinux_use()) {
r = setsockopt(s->syslog_fd, SOL_SOCKET, SO_PASSSEC, &one, sizeof(one));
if (r < 0)
t = server.oldest_file_usec + server.max_retention_usec - n;
}
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
if (server.system_journal) {
usec_t u;
sd-journal.c
'''.split())
-if conf.get('HAVE_GCRYPT', false)
+if conf.get('HAVE_GCRYPT') == 1
journal_internal_sources += files('''
journal-authenticate.c
journal-authenticate.h
audit_type_includes = [config_h,
missing_h,
'linux/audit.h']
-if conf.get('HAVE_AUDIT', false)
+if conf.get('HAVE_AUDIT') == 1
audit_type_includes += 'libaudit.h'
endif
journalctl_sources = files('journalctl.c')
-if conf.get('HAVE_QRENCODE', false)
+if conf.get('HAVE_QRENCODE') == 1
journalctl_sources += files('journal-qrcode.c',
'journal-qrcode.h')
endif
#define WINDOWS_MIN 64
-#ifdef ENABLE_DEBUG_MMAP_CACHE
+#if ENABLE_DEBUG_MMAP_CACHE
/* Tiny windows increase mmap activity and the chance of exposing unsafe use. */
# define WINDOW_SIZE (page_size())
#else
if (!w->contexts && !w->keep_always) {
/* Not used anymore? */
-#ifdef ENABLE_DEBUG_MMAP_CACHE
+#if ENABLE_DEBUG_MMAP_CACHE
/* Unmap unused windows immediately to expose use-after-unmap
* by SIGSEGV. */
window_free(w);
compression = o->object.flags & OBJECT_COMPRESSION_MASK;
if (compression) {
-#if defined(HAVE_XZ) || defined(HAVE_LZ4)
+#if HAVE_XZ || HAVE_LZ4
r = decompress_startswith(compression,
o->data.payload, l,
&f->compress_buffer, &f->compress_buffer_size,
compression = o->object.flags & OBJECT_COMPRESSION_MASK;
if (compression) {
-#if defined(HAVE_XZ) || defined(HAVE_LZ4)
+#if HAVE_XZ || HAVE_LZ4
size_t rsize;
int r;
typedef int (decompress_t)(const void *src, uint64_t src_size,
void **dst, size_t *dst_alloc_size, size_t* dst_size, size_t dst_max);
-#if defined(HAVE_XZ) || defined(HAVE_LZ4)
+#if HAVE_XZ || HAVE_LZ4
static usec_t arg_duration;
static size_t arg_start;
#endif
int main(int argc, char *argv[]) {
-#if defined(HAVE_XZ) || defined(HAVE_LZ4)
+#if HAVE_XZ || HAVE_LZ4
const char *i;
int r;
arg_start = getpid_cached();
NULSTR_FOREACH(i, "zeros\0simple\0random\0") {
-#ifdef HAVE_XZ
+#if HAVE_XZ
test_compress_decompress("XZ", i, compress_blob_xz, decompress_blob_xz);
#endif
-#ifdef HAVE_LZ4
+#if HAVE_LZ4
test_compress_decompress("LZ4", i, compress_blob_lz4, decompress_blob_lz4);
#endif
}
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#ifdef HAVE_LZ4
+#if HAVE_LZ4
#include <lz4.h>
#endif
#include "random-util.h"
#include "util.h"
-#ifdef HAVE_XZ
+#if HAVE_XZ
# define XZ_OK 0
#else
# define XZ_OK -EPROTONOSUPPORT
#endif
-#ifdef HAVE_LZ4
+#if HAVE_LZ4
# define LZ4_OK 0
#else
# define LZ4_OK -EPROTONOSUPPORT
typedef int (compress_stream_t)(int fdf, int fdt, uint64_t max_bytes);
typedef int (decompress_stream_t)(int fdf, int fdt, uint64_t max_size);
-#if defined(HAVE_XZ) || defined(HAVE_LZ4)
+#if HAVE_XZ || HAVE_LZ4
static void test_compress_decompress(int compression,
compress_blob_t compress,
decompress_blob_t decompress,
}
#endif
-#ifdef HAVE_LZ4
+#if HAVE_LZ4
static void test_lz4_decompress_partial(void) {
char buf[20000];
size_t buf_size = sizeof(buf), compressed;
#endif
int main(int argc, char *argv[]) {
-#if defined(HAVE_XZ) || defined(HAVE_LZ4)
+#if HAVE_XZ || HAVE_LZ4
const char text[] =
"text\0foofoofoofoo AAAA aaaaaaaaa ghost busters barbarbar FFF"
"foofoofoofoo AAAA aaaaaaaaa ghost busters barbarbar FFF";
random_bytes(data + 7, sizeof(data) - 7);
-#ifdef HAVE_XZ
+#if HAVE_XZ
test_compress_decompress(OBJECT_COMPRESSED_XZ, compress_blob_xz, decompress_blob_xz,
text, sizeof(text), false);
test_compress_decompress(OBJECT_COMPRESSED_XZ, compress_blob_xz, decompress_blob_xz,
log_info("/* XZ test skipped */");
#endif
-#ifdef HAVE_LZ4
+#if HAVE_LZ4
test_compress_decompress(OBJECT_COMPRESSED_LZ4, compress_blob_lz4, decompress_blob_lz4,
text, sizeof(text), false);
test_compress_decompress(OBJECT_COMPRESSED_LZ4, compress_blob_lz4, decompress_blob_lz4,
iovec.iov_len = strlen(test);
assert_se(journal_file_append_entry(f, &ts, &iovec, 1, NULL, NULL, NULL) == 0);
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
journal_file_append_tag(f);
#endif
journal_file_dump(f);
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#ifdef HAVE_VALGRIND_MEMCHECK_H
+#if HAVE_VALGRIND_MEMCHECK_H
#include <valgrind/memcheck.h>
#endif
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#ifdef HAVE_VALGRIND_MEMCHECK_H
+#if HAVE_VALGRIND_MEMCHECK_H
#include <valgrind/memcheck.h>
#endif
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#ifdef HAVE_GLIB
+#if HAVE_GLIB
#include <glib.h>
#endif
assert_se(bus_message_seal(m, 4711, 0) >= 0);
-#ifdef HAVE_GLIB
+#if HAVE_GLIB
{
GVariant *v;
char *t;
assert_se(bus_message_get_blob(m, &blob, &sz) >= 0);
-#ifdef HAVE_GLIB
+#if HAVE_GLIB
{
GVariant *v;
char *t;
#include <math.h>
#include <stdlib.h>
-#ifdef HAVE_GLIB
+#if HAVE_GLIB
#include <gio/gio.h>
#endif
-#ifdef HAVE_DBUS
+#if HAVE_DBUS
#include <dbus/dbus.h>
#endif
log_info("message size = %zu, contents =\n%s", sz, h);
free(h);
-#ifdef HAVE_GLIB
+#if HAVE_GLIB
{
GDBusMessage *g;
char *p;
}
#endif
-#ifdef HAVE_DBUS
+#if HAVE_DBUS
{
DBusMessage *w;
DBusError error;
"/etc/systemd/hwdb/hwdb.bin\0"
"/etc/udev/hwdb.bin\0"
"/usr/lib/systemd/hwdb/hwdb.bin\0"
-#ifdef HAVE_SPLIT_USR
+#if HAVE_SPLIT_USR
"/lib/systemd/hwdb/hwdb.bin\0"
#endif
UDEVLIBEXECDIR "/hwdb.bin\0";
"/usr/local/bin",
"/usr/sbin",
"/usr/bin",
-#ifdef HAVE_SPLIT_USR
+#if HAVE_SPLIT_USR
"/sbin",
"/bin",
#endif
false,
"/usr/local/lib",
"/usr/lib",
-#ifdef HAVE_SPLIT_USR
+#if HAVE_SPLIT_USR
"/lib",
#endif
NULL);
"LD_LIBRARY_PATH",
true,
LIBDIR,
-#ifdef HAVE_SPLIT_USR
+#if HAVE_SPLIT_USR
ROOTLIBDIR,
#endif
NULL);
#include <string.h>
#include <unistd.h>
-#ifdef HAVE_XKBCOMMON
+#if HAVE_XKBCOMMON
#include <xkbcommon/xkbcommon.h>
#include <dlfcn.h>
#endif
return sd_bus_reply_method_return(m, NULL);
}
-#ifdef HAVE_XKBCOMMON
+#if HAVE_XKBCOMMON
_printf_(3, 0)
static void log_xkb(struct xkb_context *ctx, enum xkb_log_level lvl, const char *format, va_list args) {
localectl_sources = files('localectl.c')
-if conf.get('ENABLE_LOCALED', false)
+if conf.get('ENABLE_LOCALED') == 1
install_data('org.freedesktop.locale1.conf',
install_dir : dbuspolicydir)
install_data('org.freedesktop.locale1.service',
kbd_model_map = join_paths(meson.current_source_dir(), 'kbd-model-map')
language_fallback_map = join_paths(meson.current_source_dir(), 'language-fallback-map')
-if conf.get('ENABLE_LOCALED', false)
+if conf.get('ENABLE_LOCALED') == 1
install_data('kbd-model-map',
'language-fallback-map',
install_dir : pkgdatadir)
#include "libudev.h"
-#ifdef HAVE_ACL
+#if HAVE_ACL
int devnode_acl(const char *path,
bool flush,
'''.split())
logind_acl_c = files('logind-acl.c')
-if conf.get('HAVE_ACL', false)
+if conf.get('HAVE_ACL') == 1
liblogind_core_sources += logind_acl_c
endif
sysfs-show.c
'''.split())
-if conf.get('ENABLE_LOGIND', false)
+if conf.get('ENABLE_LOGIND') == 1
logind_conf = configure_file(
input : 'logind.conf.in',
output : 'logind.conf',
include_directories : includes,
dependencies : [threads])
-if conf.get('ENABLE_MACHINED', false)
+if conf.get('ENABLE_MACHINED') == 1
install_data('org.freedesktop.machine1.conf',
install_dir : dbuspolicydir)
install_data('org.freedesktop.machine1.service',
network_include_dir = include_directories('.')
-if conf.get('ENABLE_NETWORKD', false)
+if conf.get('ENABLE_NETWORKD') == 1
networkd_gperf_c = custom_target(
'networkd-gperf.c',
input : 'networkd-gperf.gperf',
"/etc/systemd/network",
"/run/systemd/network",
"/usr/lib/systemd/network",
-#ifdef HAVE_SPLIT_USR
+#if HAVE_SPLIT_USR
"/lib/systemd/network",
#endif
NULL};
options = buf;
}
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
if (selinux_apifs_context) {
char *t;
{ "tmpfs", "/dev", "tmpfs", "mode=755", MS_NOSUID|MS_STRICTATIME, MOUNT_FATAL },
{ "tmpfs", "/dev/shm", "tmpfs", "mode=1777", MS_NOSUID|MS_NODEV|MS_STRICTATIME, MOUNT_FATAL },
{ "tmpfs", "/run", "tmpfs", "mode=755", MS_NOSUID|MS_NODEV|MS_STRICTATIME, MOUNT_FATAL },
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
{ "/sys/fs/selinux", "/sys/fs/selinux", NULL, NULL, MS_BIND, 0 }, /* Bind mount first */
{ NULL, "/sys/fs/selinux", NULL, NULL, MS_BIND|MS_RDONLY|MS_NOSUID|MS_NOEXEC|MS_NODEV|MS_REMOUNT, 0 }, /* Then, make it r/o */
#endif
#include <fcntl.h>
#include <linux/magic.h>
-#ifdef HAVE_ACL
+#if HAVE_ACL
#include <sys/acl.h>
#endif
#include <sys/stat.h>
#include "strv.h"
#include "user-util.h"
-#ifdef HAVE_ACL
+#if HAVE_ACL
static int get_acl(int fd, const char *name, acl_type_t type, acl_t *ret) {
char procfs_path[strlen("/proc/self/fd/") + DECIMAL_STR_MAX(int) + 1];
#include <sys/capability.h>
#include <sys/types.h>
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
#include <seccomp.h>
#endif
#include "alloc-util.h"
#include "log.h"
#include "nspawn-seccomp.h"
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
#include "seccomp-util.h"
#endif
#include "string-util.h"
#include "strv.h"
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
static int seccomp_add_default_syscall_filter(
scmp_filter_ctx ctx,
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#ifdef HAVE_BLKID
+#if HAVE_BLKID
#include <blkid.h>
#endif
#include <errno.h>
#include <linux/loop.h>
#include <pwd.h>
#include <sched.h>
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
#include <selinux/selinux.h>
#endif
#include <signal.h>
return -EINVAL;
}
-#ifndef HAVE_LIBIPTC
+#if ! HAVE_LIBIPTC
if (arg_expose_ports) {
log_error("--port= is not supported, compiled without libiptc support.");
return -EOPNOTSUPP;
const char *p;
int r;
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
if (arg_selinux_apifs_context)
(void) asprintf(&options,
"newinstance,ptmxmode=0666,mode=620,gid=" GID_FMT ",context=\"%s\"",
return log_error_errno(r, "personality() failed: %m");
}
-#ifdef HAVE_SELINUX
+#if HAVE_SELINUX
if (arg_selinux_context)
if (setexeccon(arg_selinux_context) < 0)
return log_error_errno(errno, "setexeccon(\"%s\") failed: %m", arg_selinux_context);
log_warning("Invalid quotacheck.mode= parameter '%s'. Ignoring.", value);
}
-#ifdef HAVE_SYSV_COMPAT
+#if HAVE_SYSV_COMPAT
else if (streq(key, "forcequotacheck") && !value) {
log_warning("Please use 'quotacheck.mode=force' rather than 'forcequotacheck' on the kernel command line.");
arg_force = true;
static void test_files(void) {
-#ifdef HAVE_SYSV_COMPAT
+#if HAVE_SYSV_COMPAT
if (access("/forcequotacheck", F_OK) >= 0) {
log_error("Please pass 'quotacheck.mode=force' on the kernel command line rather than creating /forcequotacheck on the root file system.");
arg_force = true;
systemd_resolve_only_sources +
dns_type_headers)
-if conf.get('ENABLE_RESOLVED', false)
+if conf.get('ENABLE_RESOLVED') == 1
install_data('org.freedesktop.resolve1.conf',
install_dir : dbuspolicydir)
install_data('org.freedesktop.resolve1.service',
return r;
}
-#ifndef HAVE_GCRYPT
+#if ! HAVE_GCRYPT
if (m->dnssec_mode != DNSSEC_NO) {
log_warning("DNSSEC option cannot be enabled or set to allow-downgrade when systemd-resolved is built without gcrypt support. Turning off DNSSEC support.");
m->dnssec_mode = DNSSEC_NO;
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
#include <gcrypt.h>
#endif
return (int) c;
}
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
static int rr_compare(const void *a, const void *b) {
DnsResourceRecord **x = (DnsResourceRecord**) a, **y = (DnsResourceRecord**) b;
assert(l);
-#ifndef HAVE_GCRYPT
+#if ! HAVE_GCRYPT
if (IN_SET(mode, DNSSEC_YES, DNSSEC_ALLOW_DOWNGRADE))
log_warning("DNSSEC option for the link cannot be enabled or set to allow-downgrade when systemd-resolved is built without gcrypt support. Turning off DNSSEC support.");
return;
#include <poll.h>
#include <sys/ioctl.h>
-#ifdef HAVE_LIBIDN2
+#if HAVE_LIBIDN2
#include <idn2.h>
#endif
static int determine_hostname(char **full_hostname, char **llmnr_hostname, char **mdns_hostname) {
_cleanup_free_ char *h = NULL, *n = NULL;
-#if defined(HAVE_LIBIDN2)
+#if HAVE_LIBIDN2
_cleanup_free_ char *utf8 = NULL;
-#elif defined(HAVE_LIBIDN)
+#elif HAVE_LIBIDN
int k;
#endif
char label[DNS_LABEL_MAX];
return -EINVAL;
}
-#if defined(HAVE_LIBIDN2)
+#if HAVE_LIBIDN2
r = idn2_to_unicode_8z8z(label, &utf8, 0);
if (r != IDN2_OK)
return log_error("Failed to undo IDNA: %s", idn2_strerror(r));
r = strlen(utf8);
decoded = utf8;
-#elif defined(HAVE_LIBIDN)
+#elif HAVE_LIBIDN
k = dns_label_undo_idna(label, r, label, sizeof label);
if (k < 0)
return log_error_errno(k, "Failed to undo IDNA: %m");
test_hostname_lookup(bus, "poettering.de", AF_INET, NULL);
test_hostname_lookup(bus, "poettering.de", AF_INET6, NULL);
-#if defined(HAVE_LIBIDN2) || defined(HAVE_LIBIDN)
+#if HAVE_LIBIDN2 || HAVE_LIBIDN
/* Unsigned A with IDNA conversion necessary */
test_hostname_lookup(bus, "pöttering.de", AF_UNSPEC, NULL);
test_hostname_lookup(bus, "pöttering.de", AF_INET, NULL);
test_dnssec_canonicalize_one("FOO..bar.", NULL, -EINVAL);
}
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
static void test_dnssec_verify_dns_key(void) {
test_dnssec_canonicalize();
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
test_dnssec_verify_dns_key();
test_dnssec_verify_rrset();
test_dnssec_verify_rrset2();
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#ifdef HAVE_ACL
+#if HAVE_ACL
#include <acl/libacl.h>
#include <stdbool.h>
r = sd_bus_message_append(m, "v", "i", (int32_t) n);
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
} else if (streq(field, "SystemCallFilter")) {
int whitelist;
return r;
else if (r > 0)
return 1;
-#ifdef ENABLE_POLKIT
+#if ENABLE_POLKIT
else {
_cleanup_(sd_bus_message_unrefp) sd_bus_message *request = NULL;
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
return -EACCES;
}
-#ifdef ENABLE_POLKIT
+#if ENABLE_POLKIT
typedef struct AsyncPolkitQuery {
sd_bus_message *request, *reply;
Hashmap **registry,
sd_bus_error *error) {
-#ifdef ENABLE_POLKIT
+#if ENABLE_POLKIT
_cleanup_(sd_bus_message_unrefp) sd_bus_message *pk = NULL;
AsyncPolkitQuery *q;
const char *sender, **k, **v;
if (r != 0)
return r;
-#ifdef ENABLE_POLKIT
+#if ENABLE_POLKIT
q = hashmap_get(*registry, call);
if (q) {
int authorized, challenge;
else if (r > 0)
return 1;
-#ifdef ENABLE_POLKIT
+#if ENABLE_POLKIT
if (sd_bus_get_current_message(call->bus) != call)
return -EINVAL;
}
void bus_verify_polkit_async_registry_free(Hashmap *registry) {
-#ifdef ENABLE_POLKIT
+#if ENABLE_POLKIT
AsyncPolkitQuery *q;
while ((q = hashmap_steal_first(registry)))
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#ifdef HAVE_LIBCRYPTSETUP
+#if HAVE_LIBCRYPTSETUP
#include <libcryptsetup.h>
#endif
#include <sys/mount.h>
#include "xattr-util.h"
_unused_ static int probe_filesystem(const char *node, char **ret_fstype) {
-#ifdef HAVE_BLKID
+#if HAVE_BLKID
_cleanup_blkid_free_probe_ blkid_probe b = NULL;
const char *fstype;
int r;
int dissect_image(int fd, const void *root_hash, size_t root_hash_size, DissectImageFlags flags, DissectedImage **ret) {
-#ifdef HAVE_BLKID
+#if HAVE_BLKID
sd_id128_t root_uuid = SD_ID128_NULL, verity_uuid = SD_ID128_NULL;
_cleanup_udev_enumerate_unref_ struct udev_enumerate *e = NULL;
bool is_gpt, is_mbr, generic_rw, multiple_generic = false;
return 0;
}
-#ifdef HAVE_LIBCRYPTSETUP
+#if HAVE_LIBCRYPTSETUP
typedef struct DecryptedPartition {
struct crypt_device *device;
char *name;
#endif
DecryptedImage* decrypted_image_unref(DecryptedImage* d) {
-#ifdef HAVE_LIBCRYPTSETUP
+#if HAVE_LIBCRYPTSETUP
size_t i;
int r;
return NULL;
}
-#ifdef HAVE_LIBCRYPTSETUP
+#if HAVE_LIBCRYPTSETUP
static int make_dm_name_and_node(const void *original_node, const char *suffix, char **ret_name, char **ret_node) {
_cleanup_free_ char *name = NULL, *node = NULL;
DecryptedImage **ret) {
_cleanup_(decrypted_image_unrefp) DecryptedImage *d = NULL;
-#ifdef HAVE_LIBCRYPTSETUP
+#if HAVE_LIBCRYPTSETUP
unsigned i;
int r;
#endif
return 0;
}
-#ifdef HAVE_LIBCRYPTSETUP
+#if HAVE_LIBCRYPTSETUP
if (m->encrypted && !passphrase)
return -ENOKEY;
}
}
-#ifdef HAVE_LIBCRYPTSETUP
+#if HAVE_LIBCRYPTSETUP
static int deferred_remove(DecryptedPartition *p) {
struct dm_ioctl dm = {
int decrypted_image_relinquish(DecryptedImage *d) {
-#ifdef HAVE_LIBCRYPTSETUP
+#if HAVE_LIBCRYPTSETUP
size_t i;
int r;
#endif
/* Turns on automatic removal after the last use ended for all DM devices of this image, and sets a boolean so
* that we don't clean it up ourselves either anymore */
-#ifdef HAVE_LIBCRYPTSETUP
+#if HAVE_LIBCRYPTSETUP
for (i = 0; i < d->n_decrypted; i++) {
DecryptedPartition *p = d->decrypted + i;
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#if defined(HAVE_LIBIDN2)
+#if HAVE_LIBIDN2
# include <idn2.h>
-#elif defined(HAVE_LIBIDN)
+#elif HAVE_LIBIDN
# include <idna.h>
# include <stringprep.h>
#endif
return r;
}
-#ifdef HAVE_LIBIDN
+#if HAVE_LIBIDN
int dns_label_apply_idna(const char *encoded, size_t encoded_size, char *decoded, size_t decoded_max) {
_cleanup_free_ uint32_t *input = NULL;
size_t input_size, l;
int dns_name_apply_idna(const char *name, char **ret) {
/* Return negative on error, 0 if not implemented, positive on success. */
-#if defined(HAVE_LIBIDN2)
+#if HAVE_LIBIDN2
int r;
_cleanup_free_ char *t = NULL;
if (IN_SET(r, IDN2_TOO_BIG_DOMAIN, IDN2_TOO_BIG_LABEL))
return -ENOSPC;
return -EINVAL;
-#elif defined(HAVE_LIBIDN)
+#elif HAVE_LIBIDN
_cleanup_free_ char *buf = NULL;
size_t n = 0, allocated = 0;
bool first = true;
return dns_label_unescape(name, NULL, DNS_LABEL_MAX);
}
-#if defined(HAVE_LIBIDN)
+#if HAVE_LIBIDN
int dns_label_apply_idna(const char *encoded, size_t encoded_size, char *decoded, size_t decoded_max);
int dns_label_undo_idna(const char *encoded, size_t encoded_size, char *decoded, size_t decoded_max);
#endif
#include "util.h"
#include "virt.h"
-#ifdef ENABLE_EFI
+#if ENABLE_EFI
#define LOAD_OPTION_ACTIVE 0x00000001
#define MEDIA_DEVICE_PATH 0x04
#define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x0000000000000002
#define EFI_VARIABLE_RUNTIME_ACCESS 0x0000000000000004
-#ifdef ENABLE_EFI
+#if ENABLE_EFI
bool is_efi_boot(void);
bool is_efi_secure_boot(void);
#include "in-addr-util.h"
-#ifdef HAVE_LIBIPTC
+#if HAVE_LIBIPTC
int fw_add_masquerade(
bool add,
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
#include <gcrypt.h>
#include "gcrypt-util.h"
#include <stdbool.h>
#include <stddef.h>
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
#include <gcrypt.h>
void initialize_libgcrypt(bool secmem);
#endif
static inline int string_hashsum_sha224(const char *s, size_t len, char **out) {
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
return string_hashsum(s, len, GCRY_MD_SHA224, out);
#else
return -EOPNOTSUPP;
}
static inline int string_hashsum_sha256(const char *s, size_t len, char **out) {
-#ifdef HAVE_GCRYPT
+#if HAVE_GCRYPT
return string_hashsum(s, len, GCRY_MD_SHA256, out);
#else
return -EOPNOTSUPP;
if (path_startswith(rpath, "/usr"))
return true;
-#ifdef HAVE_SPLIT_USR
+#if HAVE_SPLIT_USR
if (path_startswith(rpath, "/lib"))
return true;
#endif
"/etc/systemd/system-preset",
"/usr/local/lib/systemd/system-preset",
"/usr/lib/systemd/system-preset",
-#ifdef HAVE_SPLIT_USR
+#if HAVE_SPLIT_USR
"/lib/systemd/system-preset",
#endif
NULL);
#include "user-util.h"
static int access_check_var_log_journal(sd_journal *j) {
-#ifdef HAVE_ACL
+#if HAVE_ACL
_cleanup_strv_free_ char **g = NULL;
const char* dir;
#endif
if (r > 0)
return 0;
-#ifdef HAVE_ACL
+#if HAVE_ACL
if (laccess("/run/log/journal", F_OK) >= 0)
dir = "/run/log/journal";
else
test_tables_h = files('test-tables.h')
shared_sources += [test_tables_h]
-if conf.get('HAVE_ACL', false)
+if conf.get('HAVE_ACL') == 1
shared_sources += ['acl-util.c']
endif
-if conf.get('HAVE_UTMP', false)
+if conf.get('HAVE_UTMP') == 1
shared_sources += ['utmp-wtmp.c']
endif
-if conf.get('HAVE_SECCOMP', false)
+if conf.get('HAVE_SECCOMP') == 1
shared_sources += ['seccomp-util.c']
endif
-if conf.get('HAVE_LIBIPTC', false)
+if conf.get('HAVE_LIBIPTC') == 1
shared_sources += ['firewall-util.c']
endif
"/usr/local/lib/systemd/system",
SYSTEM_DATA_UNIT_PATH,
"/usr/lib/systemd/system",
-#ifdef HAVE_SPLIT_USR
+#if HAVE_SPLIT_USR
"/lib/systemd/system",
#endif
STRV_IFNOTNULL(generator_late),
#include "time-util.h"
#include "util.h"
-#ifdef ENABLE_POLKIT
+#if ENABLE_POLKIT
static pid_t agent_pid = 0;
int polkit_agent_open(void) {
#include "time-util.h"
#include "util.h"
-#ifdef HAVE_UTMP
+#if HAVE_UTMP
int utmp_get_runlevel(int *runlevel, int *previous);
int utmp_put_shutdown(void);
return r;
}
-#ifdef ENABLE_LOGIND
+#if ENABLE_LOGIND
static int logind_set_wall_message(void) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
sd_bus *bus;
/* Ask systemd-logind, which might grant access to unprivileged users
* through PolicyKit */
static int logind_reboot(enum action a) {
-#ifdef ENABLE_LOGIND
+#if ENABLE_LOGIND
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
const char *method, *description;
sd_bus *bus;
}
static int logind_check_inhibitors(enum action a) {
-#ifdef ENABLE_LOGIND
+#if ENABLE_LOGIND
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
_cleanup_strv_free_ char **sessions = NULL;
const char *what, *who, *why, *mode;
}
static int logind_prepare_firmware_setup(void) {
-#ifdef ENABLE_LOGIND
+#if ENABLE_LOGIND
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
sd_bus *bus;
int r;
static int enable_sysv_units(const char *verb, char **args) {
int r = 0;
-#if defined(HAVE_SYSV_COMPAT)
+#if HAVE_SYSV_COMPAT
_cleanup_lookup_paths_free_ LookupPaths paths = {};
unsigned f = 0;
return systemctl_parse_argv(argc, argv);
}
-#ifdef HAVE_SYSV_COMPAT
+#if HAVE_SYSV_COMPAT
_pure_ static int action_to_runlevel(void) {
static const char table[_ACTION_MAX] = {
#endif
static int talk_initctl(void) {
-#ifdef HAVE_SYSV_COMPAT
+#if HAVE_SYSV_COMPAT
struct init_request request = {
.magic = INIT_MAGIC,
.sleeptime = 0,
static int logind_schedule_shutdown(void) {
-#ifdef ENABLE_LOGIND
+#if ENABLE_LOGIND
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
char date[FORMAT_TIMESTAMP_MAX];
const char *action;
}
static int logind_cancel_shutdown(void) {
-#ifdef ENABLE_LOGIND
+#if ENABLE_LOGIND
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
sd_bus *bus;
int r;
return 0;
}
-#ifdef ENABLE_GSHADOW
+#if ENABLE_GSHADOW
static int putsgent_with_members(const struct sgrp *sg, FILE *gshadow) {
char **a;
}
static int write_temporary_gshadow(const char * gshadow_path, FILE **tmpfile, char **tmpfile_path) {
-#ifdef ENABLE_GSHADOW
+#if ENABLE_GSHADOW
_cleanup_fclose_ FILE *original = NULL, *gshadow = NULL;
_cleanup_(unlink_and_freep) char *gshadow_tmp = NULL;
bool group_changed = false;
}
static void test_dns_name_apply_idna(void) {
-#if defined HAVE_LIBIDN2 || defined HAVE_LIBIDN
+#if HAVE_LIBIDN2 || HAVE_LIBIDN
const int ret = 1;
#else
const int ret = 0;
* labels. If registrars follow IDNA2008 we'll just be performing a
* useless lookup.
*/
-#if defined HAVE_LIBIDN
+#if HAVE_LIBIDN
const int ret2 = 1;
#else
const int ret2 = 0;
#include "mkdir.h"
#include "path-util.h"
#include "rm-rf.h"
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
#include "seccomp-util.h"
#endif
#include "stat-util.h"
}
static void test_exec_systemcallfilter(Manager *m) {
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
if (!is_seccomp_available())
return;
test(m, "exec-systemcallfilter-not-failing.service", 0, CLD_EXITED);
}
static void test_exec_systemcallerrornumber(Manager *m) {
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
if (is_seccomp_available())
test(m, "exec-systemcallerrornumber.service", 1, CLD_EXITED);
#endif
}
static void test_exec_restrict_namespaces(Manager *m) {
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
if (!is_seccomp_available())
return;
}
static void test_exec_systemcall_system_mode_with_user(Manager *m) {
-#ifdef HAVE_SECCOMP
+#if HAVE_SECCOMP
if (!is_seccomp_available())
return;
if (getpwnam("nobody"))
modules = strv_new(argv[1], NULL);
else
modules = strv_new(
-#ifdef HAVE_MYHOSTNAME
+#if HAVE_MYHOSTNAME
"myhostname",
#endif
-#ifdef HAVE_RESOLVED
+#if HAVE_RESOLVED
"resolve",
#endif
-#ifdef HAVE_MACHINED
+#if HAVE_MACHINED
"mymachines",
#endif
"dns",
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
-#ifdef HAVE_VALGRIND_VALGRIND_H
+#if HAVE_VALGRIND_VALGRIND_H
#include <valgrind/valgrind.h>
#endif
if (geteuid() != 0)
return;
-#ifdef HAVE_VALGRIND_VALGRIND_H
+#if HAVE_VALGRIND_VALGRIND_H
/* valgrind patches open(/proc//cmdline)
* so, test_get_process_cmdline_harder fails always
* See https://github.com/systemd/systemd/pull/3555#issuecomment-226564908 */
if (r < 0)
return;
-#ifdef HAVE_VALGRIND_VALGRIND_H
+#if HAVE_VALGRIND_VALGRIND_H
/* see above, valgrind is weird, we can't verify what we are doing here */
if (RUNNING_ON_VALGRIND)
return;
#include "fd-util.h"
#include "sigbus.h"
#include "util.h"
-#ifdef HAVE_VALGRIND_VALGRIND_H
+#if HAVE_VALGRIND_VALGRIND_H
#include <valgrind/valgrind.h>
#endif
void *addr = NULL;
uint8_t *p;
-#ifdef HAVE_VALGRIND_VALGRIND_H
+#if HAVE_VALGRIND_VALGRIND_H
if (RUNNING_ON_VALGRIND)
return EXIT_TEST_SKIP;
#endif
-if conf.get('ENABLE_TIMEDATED', false)
+if conf.get('ENABLE_TIMEDATED') == 1
install_data('org.freedesktop.timedate1.conf',
install_dir : dbuspolicydir)
install_data('org.freedesktop.timedate1.service',
systemd_timesyncd_sources += [timesyncd_gperf_c]
-if conf.get('ENABLE_TIMESYNCD', false)
+if conf.get('ENABLE_TIMESYNCD') == 1
timesyncd_conf = configure_file(
input : 'timesyncd.conf.in',
output : 'timesyncd.conf',
char *path;
char *argument;
char **xattrs;
-#ifdef HAVE_ACL
+#if HAVE_ACL
acl_t acl_access;
acl_t acl_default;
#endif
}
static int parse_acls_from_arg(Item *item) {
-#ifdef HAVE_ACL
+#if HAVE_ACL
int r;
assert(item);
return 0;
}
-#ifdef HAVE_ACL
+#if HAVE_ACL
static int path_set_acl(const char *path, const char *pretty, acl_type_t type, acl_t acl, bool modify) {
_cleanup_(acl_free_charpp) char *t = NULL;
_cleanup_(acl_freep) acl_t dup = NULL;
static int path_set_acls(Item *item, const char *path) {
int r = 0;
-#ifdef HAVE_ACL
+#if HAVE_ACL
char fn[strlen("/proc/self/fd/") + DECIMAL_STR_MAX(int)];
_cleanup_close_ int fd = -1;
struct stat st;
free(i->argument);
strv_free(i->xattrs);
-#ifdef HAVE_ACL
+#if HAVE_ACL
acl_free(i->acl_access);
acl_free(i->acl_default);
#endif
net/ethtool-util.h
'''.split()
-if conf.get('HAVE_KMOD', false)
+if conf.get('HAVE_KMOD') == 1
libudev_core_sources += ['udev-builtin-kmod.c']
endif
-if conf.get('HAVE_BLKID', false)
+if conf.get('HAVE_BLKID') == 1
libudev_core_sources += ['udev-builtin-blkid.c']
endif
-if conf.get('HAVE_ACL', false)
+if conf.get('HAVE_ACL') == 1
libudev_core_sources += ['udev-builtin-uaccess.c',
logind_acl_c,
sd_login_c]
"/etc/systemd/network",
"/run/systemd/network",
"/usr/lib/systemd/network",
-#ifdef HAVE_SPLIT_USR
+#if HAVE_SPLIT_USR
"/lib/systemd/network",
#endif
NULL};
static int find_gpt_root(struct udev_device *dev, blkid_probe pr, bool test) {
-#if defined(GPT_ROOT_NATIVE) && defined(ENABLE_EFI)
+#if defined(GPT_ROOT_NATIVE) && ENABLE_EFI
_cleanup_free_ char *root_id = NULL;
bool found_esp = false;
#include <stdlib.h>
#include <sys/ioctl.h>
-#ifdef HAVE_LINUX_BTRFS_H
+#if HAVE_LINUX_BTRFS_H
#include <linux/btrfs.h>
#endif
static bool initialized;
static const struct udev_builtin *builtins[] = {
-#ifdef HAVE_BLKID
+#if HAVE_BLKID
[UDEV_BUILTIN_BLKID] = &udev_builtin_blkid,
#endif
[UDEV_BUILTIN_BTRFS] = &udev_builtin_btrfs,
[UDEV_BUILTIN_HWDB] = &udev_builtin_hwdb,
[UDEV_BUILTIN_INPUT_ID] = &udev_builtin_input_id,
[UDEV_BUILTIN_KEYBOARD] = &udev_builtin_keyboard,
-#ifdef HAVE_KMOD
+#if HAVE_KMOD
[UDEV_BUILTIN_KMOD] = &udev_builtin_kmod,
#endif
[UDEV_BUILTIN_NET_ID] = &udev_builtin_net_id,
[UDEV_BUILTIN_NET_LINK] = &udev_builtin_net_setup_link,
[UDEV_BUILTIN_PATH_ID] = &udev_builtin_path_id,
[UDEV_BUILTIN_USB_ID] = &udev_builtin_usb_id,
-#ifdef HAVE_ACL
+#if HAVE_ACL
[UDEV_BUILTIN_UACCESS] = &udev_builtin_uaccess,
#endif
};
/* built-in commands */
enum udev_builtin_cmd {
-#ifdef HAVE_BLKID
+#if HAVE_BLKID
UDEV_BUILTIN_BLKID,
#endif
UDEV_BUILTIN_BTRFS,
UDEV_BUILTIN_HWDB,
UDEV_BUILTIN_INPUT_ID,
UDEV_BUILTIN_KEYBOARD,
-#ifdef HAVE_KMOD
+#if HAVE_KMOD
UDEV_BUILTIN_KMOD,
#endif
UDEV_BUILTIN_NET_ID,
UDEV_BUILTIN_NET_LINK,
UDEV_BUILTIN_PATH_ID,
UDEV_BUILTIN_USB_ID,
-#ifdef HAVE_ACL
+#if HAVE_ACL
UDEV_BUILTIN_UACCESS,
#endif
UDEV_BUILTIN_MAX
bool (*validate)(struct udev *udev);
bool run_once;
};
-#ifdef HAVE_BLKID
+#if HAVE_BLKID
extern const struct udev_builtin udev_builtin_blkid;
#endif
extern const struct udev_builtin udev_builtin_btrfs;
extern const struct udev_builtin udev_builtin_hwdb;
extern const struct udev_builtin udev_builtin_input_id;
extern const struct udev_builtin udev_builtin_keyboard;
-#ifdef HAVE_KMOD
+#if HAVE_KMOD
extern const struct udev_builtin udev_builtin_kmod;
#endif
extern const struct udev_builtin udev_builtin_net_id;
#include <string.h>
#include <unistd.h>
-#ifdef HAVE_AUDIT
+#if HAVE_AUDIT
#include <libaudit.h>
#endif
typedef struct Context {
sd_bus *bus;
-#ifdef HAVE_AUDIT
+#if HAVE_AUDIT
int audit_fd;
#endif
} Context;
/* We finished start-up, so let's write the utmp
* record and send the audit msg */
-#ifdef HAVE_AUDIT
+#if HAVE_AUDIT
if (c->audit_fd >= 0)
if (audit_log_user_comm_message(c->audit_fd, AUDIT_SYSTEM_BOOT, "", "systemd-update-utmp", NULL, NULL, NULL, 1) < 0 &&
errno != EPERM) {
/* We started shut-down, so let's write the utmp
* record and send the audit msg */
-#ifdef HAVE_AUDIT
+#if HAVE_AUDIT
if (c->audit_fd >= 0)
if (audit_log_user_comm_message(c->audit_fd, AUDIT_SYSTEM_SHUTDOWN, "", "systemd-update-utmp", NULL, NULL, NULL, 1) < 0 &&
errno != EPERM) {
if (previous == runlevel)
return 0;
-#ifdef HAVE_AUDIT
+#if HAVE_AUDIT
if (c->audit_fd >= 0) {
_cleanup_free_ char *s = NULL;
int main(int argc, char *argv[]) {
Context c = {
-#ifdef HAVE_AUDIT
+#if HAVE_AUDIT
.audit_fd = -1
#endif
};
umask(0022);
-#ifdef HAVE_AUDIT
+#if HAVE_AUDIT
/* If the kernel lacks netlink or audit support,
* don't worry about it. */
c.audit_fd = audit_open();
log_debug("systemd-update-utmp stopped as pid "PID_FMT, getpid_cached());
finish:
-#ifdef HAVE_AUDIT
+#if HAVE_AUDIT
if (c.audit_fd >= 0)
audit_close(c.audit_fd);
#endif
-if conf.get('ENABLE_VCONSOLE', false)
+if conf.get('ENABLE_VCONSOLE') == 1
vconsole_rules = configure_file(
input : '90-vconsole.rules.in',
output : '90-vconsole.rules',
in_files = []
-if conf.get('ENABLE_COREDUMP', false)
+if conf.get('ENABLE_COREDUMP') == 1
in_files += ['50-coredump.conf']
endif
in_files = ['basic.conf']
-enable_sysusers = conf.get('ENABLE_SYSUSERS', false)
+enable_sysusers = conf.get('ENABLE_SYSUSERS') == 1
foreach file : in_files
gen = configure_file(
m4_files = ['systemd.conf']
-if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_MICROHTTPD', false)
+if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1
m4_files += ['systemd-remote.conf']
endif
journal-data/journal-2.txt
'''.split()
-if conf.get('ENABLE_RESOLVED', false)
+if conf.get('ENABLE_RESOLVED') == 1
test_data_files += '''
test-resolve/_openpgpkey.fedoraproject.org.pkts
test-resolve/fedoraproject.org.pkts
-enable_tmpfiles = conf.get('ENABLE_TMPFILES', false)
+enable_tmpfiles = conf.get('ENABLE_TMPFILES') == 1
tmpfiles = [['home.conf', ''],
['journal-nocow.conf', ''],
foreach pair : tmpfiles
if not enable_tmpfiles
# do nothing
- elif pair[1] == '' or conf.get(pair[1], false)
+ elif pair[1] == '' or conf.get(pair[1]) == 1
install_data(pair[0], install_dir : tmpfilesdir)
else
message('Not installing tmpfiles.d/@0@ because @1@ is @2@'
foreach pair : m4_files
if not enable_tmpfiles
# do nothing
- elif pair[1] == '' or conf.get(pair[1], false)
+ elif pair[1] == '' or conf.get(pair[1]) == 1
custom_target(
'tmpfiles.d_' + pair[0],
input : pair[0] + '.m4',
# we do this here because install_data does not accept custom_target output
conds = tuple[1].split(' ')
- install = ((conds.get(0, '') == '' or conf.get(conds[0], false)) and
- (conds.get(1, '') == '' or conf.get(conds[1], false)))
+ install = ((conds.get(0, '') == '' or conf.get(conds[0]) == 1) and
+ (conds.get(1, '') == '' or conf.get(conds[1]) == 1))
gen1 = configure_file(
input : file + '.in',
# we do this here because install_data does not accept custom_target output
conds = tuple[1].split(' ')
- install = ((conds.get(0, '') == '' or conf.get(conds[0], false)) and
- (conds.get(1, '') == '' or conf.get(conds[1], false)))
+ install = ((conds.get(0, '') == '' or conf.get(conds[0]) == 1) and
+ (conds.get(1, '') == '' or conf.get(conds[1]) == 1))
custom_target(
file,
input = tuple.get(3, file)
conds = tuple[1].split(' ')
- install = ((conds.get(0, '') == '' or conf.get(conds[0], false)) and
- (conds.get(1, '') == '' or conf.get(conds[1], false)))
+ install = ((conds.get(0, '') == '' or conf.get(conds[0]) == 1) and
+ (conds.get(1, '') == '' or conf.get(conds[1]) == 1))
if install
install_data(input,
meson.add_install_script(meson_make_symlink,
join_paths(dbussystemservicedir, 'org.freedesktop.systemd1.service'),
join_paths(dbussessionservicedir, 'org.freedesktop.systemd1.service'))
-if conf.get('HAVE_SYSV_COMPAT', false)
+if conf.get('HAVE_SYSV_COMPAT') == 1
foreach i : [1, 2, 3, 4, 5]
meson.add_install_script(
'sh', '-c',