Merge pull request #6974 from keszybz/clean-up-defines

Clean up define definitions
This commit is contained in:
Lennart Poettering 2017-10-04 19:25:30 +02:00 committed by GitHub
commit 4aa1d31c89
156 changed files with 706 additions and 673 deletions

View File

@ -3,7 +3,7 @@ file = configure_file(
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

View File

@ -3,7 +3,7 @@ file = configure_file(
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

View File

@ -18,7 +18,7 @@ hwdb_files = files('''
70-touchpad.hwdb
'''.split())
if conf.get('ENABLE_HWDB', false)
if conf.get('ENABLE_HWDB') == 1
install_data(hwdb_files,
install_dir : udevhwdbdir)

View File

@ -21,7 +21,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
-->
<refentry id="dnssec-trust-anchors.d" conditional='ENABLE_RESOLVED'
<refentry id="dnssec-trust-anchors.d" conditional='ENABLE_RESOLVE'
xmlns:xi="http://www.w3.org/2001/XInclude">
<refentryinfo>
<title>dnssec-trust-anchors.d</title>

View File

@ -51,7 +51,7 @@ foreach tuple : manpages
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,

View File

@ -22,7 +22,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
-->
<refentry id="nss-myhostname" conditional='HAVE_MYHOSTNAME'>
<refentry id="nss-myhostname" conditional='ENABLE_MYHOSTNAME'>
<refentryinfo>
<title>nss-myhostname</title>

View File

@ -22,7 +22,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
-->
<refentry id="nss-resolve" conditional='ENABLE_RESOLVED'>
<refentry id="nss-resolve" conditional='ENABLE_RESOLVE'>
<refentryinfo>
<title>nss-resolve</title>

View File

@ -21,7 +21,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
-->
<refentry id="resolved.conf" conditional='ENABLE_RESOLVED'
<refentry id="resolved.conf" conditional='ENABLE_RESOLVE'
xmlns:xi="http://www.w3.org/2001/XInclude">
<refentryinfo>
<title>resolved.conf</title>

View File

@ -11,7 +11,7 @@ manpages = [
['dnssec-trust-anchors.d',
'5',
['systemd.negative', 'systemd.positive'],
'ENABLE_RESOLVED'],
'ENABLE_RESOLVE'],
['environment.d', '5', [], 'ENABLE_ENVIRONMENT_D'],
['file-hierarchy', '7', [], ''],
['halt', '8', ['poweroff', 'reboot'], ''],
@ -36,14 +36,14 @@ manpages = [
['modules-load.d', '5', [], 'HAVE_KMOD'],
['networkctl', '1', [], 'ENABLE_NETWORKD'],
['networkd.conf', '5', ['networkd.conf.d'], 'ENABLE_NETWORKD'],
['nss-myhostname', '8', ['libnss_myhostname.so.2'], 'HAVE_MYHOSTNAME'],
['nss-myhostname', '8', ['libnss_myhostname.so.2'], 'ENABLE_MYHOSTNAME'],
['nss-mymachines', '8', ['libnss_mymachines.so.2'], 'ENABLE_MACHINED'],
['nss-resolve', '8', ['libnss_resolve.so.2'], 'ENABLE_RESOLVED'],
['nss-resolve', '8', ['libnss_resolve.so.2'], 'ENABLE_RESOLVE'],
['nss-systemd', '8', ['libnss_systemd.so.2'], 'ENABLE_NSS_SYSTEMD'],
['os-release', '5', [], ''],
['pam_systemd', '8', [], 'HAVE_PAM'],
['resolved.conf', '5', ['resolved.conf.d'], 'ENABLE_RESOLVED'],
['runlevel', '8', [], 'HAVE_UTMP'],
['resolved.conf', '5', ['resolved.conf.d'], 'ENABLE_RESOLVE'],
['runlevel', '8', [], 'ENABLE_UTMP'],
['sd-bus-errors',
'3',
['SD_BUS_ERROR_ACCESS_DENIED',
@ -588,8 +588,8 @@ manpages = [
['systemd-random-seed'],
'ENABLE_RANDOMSEED'],
['systemd-remount-fs.service', '8', ['systemd-remount-fs'], ''],
['systemd-resolve', '1', [], 'ENABLE_RESOLVED'],
['systemd-resolved.service', '8', ['systemd-resolved'], 'ENABLE_RESOLVED'],
['systemd-resolve', '1', [], 'ENABLE_RESOLVE'],
['systemd-resolved.service', '8', ['systemd-resolved'], 'ENABLE_RESOLVE'],
['systemd-rfkill.service',
'8',
['systemd-rfkill', 'systemd-rfkill.socket'],
@ -632,7 +632,7 @@ manpages = [
['systemd-update-utmp.service',
'8',
['systemd-update-utmp', 'systemd-update-utmp-runlevel.service'],
'HAVE_UTMP'],
'ENABLE_UTMP'],
['systemd-user-sessions.service', '8', ['systemd-user-sessions'], 'HAVE_PAM'],
['systemd-vconsole-setup.service',
'8',

View File

@ -23,7 +23,7 @@
<refentry id="runlevel"
xmlns:xi="http://www.w3.org/2001/XInclude"
conditional="HAVE_UTMP">
conditional="ENABLE_UTMP">
<refentryinfo>
<title>runlevel</title>

View File

@ -21,7 +21,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
-->
<refentry id="systemd-resolve" conditional='ENABLE_RESOLVED'
<refentry id="systemd-resolve" conditional='ENABLE_RESOLVE'
xmlns:xi="http://www.w3.org/2001/XInclude">
<refentryinfo>

View File

@ -21,7 +21,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
-->
<refentry id="systemd-resolved.service" conditional='ENABLE_RESOLVED'>
<refentry id="systemd-resolved.service" conditional='ENABLE_RESOLVE'>
<refentryinfo>
<title>systemd-resolved.service</title>

View File

@ -19,7 +19,7 @@
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
-->
<refentry id="systemd-update-utmp.service" conditional="HAVE_UTMP">
<refentry id="systemd-update-utmp.service" conditional="ENABLE_UTMP">
<refentryinfo>
<title>systemd-update-utmp.service</title>

View File

@ -38,8 +38,8 @@ endif
#####################################################################
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'
@ -47,11 +47,10 @@ endif
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
@ -243,7 +242,7 @@ if cxx.found()
endif
foreach arg : ['-Wextra',
'-Wundef',
'-Werror=undef',
'-Wlogical-op',
'-Wmissing-include-dirs',
'-Wold-style-definition',
@ -390,7 +389,7 @@ foreach decl : ['char16_t',
# 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'],
@ -419,15 +418,11 @@ foreach decl : [['IFLA_INET6_ADDR_GEN_MODE', 'linux/if_link.h'],
]
prefix = decl.length() > 2 ? decl[2] : ''
have = cc.has_header_symbol(decl[1], decl[0], prefix : prefix)
conf.set10('HAVE_DECL_' + decl[0], have)
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 : [
@ -452,15 +447,16 @@ foreach ident : [
]
have = cc.has_function(ident[0], prefix : ident[1])
conf.set10('HAVE_DECL_' + ident[0].to_upper(), have)
conf.set10('HAVE_' + ident[0].to_upper(), have)
endforeach
if cc.has_function('getrandom', prefix : '''#include <sys/random.h>''')
conf.set('USE_SYS_RANDOM_H', true)
conf.set10('HAVE_DECL_GETRANDOM', 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('HAVE_DECL_GETRANDOM', have)
conf.set10('USE_SYS_RANDOM_H', false)
conf.set10('HAVE_GETRANDOM', have)
endif
#####################################################################
@ -545,12 +541,13 @@ endif
foreach header : ['linux/btrfs.h',
'linux/memfd.h',
'linux/vm_sockets.h',
'sys/auxv.h',
'valgrind/memcheck.h',
'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
############################################################
@ -637,17 +634,21 @@ substs.set('SUSHELL', get_option('debug-shell'))
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)
#####################################################################
@ -671,38 +672,38 @@ if want_seccomp != 'false'
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 != ''
@ -714,7 +715,6 @@ want_polkit = get_option('polkit')
install_polkit = false
install_polkit_pkla = false
if want_polkit != 'false'
conf.set('ENABLE_POLKIT', true)
install_polkit = true
libpolkit = dependency('polkit-gobject-1',
@ -724,92 +724,101 @@ if want_polkit != 'false'
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')
@ -820,125 +829,140 @@ endif
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'
@ -951,25 +975,28 @@ 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
@ -979,21 +1006,23 @@ substs.set('DEFAULT_DNSSEC_MODE', default_dnssec)
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
@ -1001,46 +1030,47 @@ if want_remote != 'false'
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'],
['environment-d', 'ENABLE_ENVIRONMENT_D'],
['binfmt', 'ENABLE_BINFMT'],
['coredump', 'ENABLE_COREDUMP'],
['resolve', 'ENABLE_RESOLVED'],
['logind', 'ENABLE_LOGIND'],
['hostnamed', 'ENABLE_HOSTNAMED'],
['localed', 'ENABLE_LOCALED'],
['machined', 'ENABLE_MACHINED'],
['networkd', 'ENABLE_NETWORKD'],
['timedated', 'ENABLE_TIMEDATED'],
['timesyncd', 'ENABLE_TIMESYNCD'],
['myhostname', 'HAVE_MYHOSTNAME'],
['firstboot', 'ENABLE_FIRSTBOOT'],
['randomseed', 'ENABLE_RANDOMSEED'],
['backlight', 'ENABLE_BACKLIGHT'],
['vconsole', 'ENABLE_VCONSOLE'],
['quotacheck', 'ENABLE_QUOTACHECK'],
['sysusers', 'ENABLE_SYSUSERS'],
['tmpfiles', 'ENABLE_TMPFILES'],
['hwdb', 'ENABLE_HWDB'],
['rfkill', 'ENABLE_RFKILL'],
['ldconfig', 'ENABLE_LDCONFIG'],
['efi', 'ENABLE_EFI'],
['tpm', 'ENABLE_TPM'],
['ima', 'HAVE_IMA'],
['smack', 'HAVE_SMACK'],
['gshadow', 'ENABLE_GSHADOW'],
['idn', 'ENABLE_IDN'],
['nss-systemd', 'ENABLE_NSS_SYSTEMD'],
]
if get_option(pair[0])
conf.set(pair[1], true)
m4_defines += ['-D' + pair[1]]
endif
foreach term : ['utmp',
'hibernate',
'environment-d',
'binfmt',
'coredump',
'resolve',
'logind',
'hostnamed',
'localed',
'machined',
'networkd',
'timedated',
'timesyncd',
'myhostname',
'firstboot',
'randomseed',
'backlight',
'vconsole',
'quotacheck',
'sysusers',
'tmpfiles',
'hwdb',
'rfkill',
'ldconfig',
'efi',
'tpm',
'ima',
'smack',
'gshadow',
'idn',
'nss-systemd']
have = get_option(term)
name = 'ENABLE_' + term.underscorify().to_upper()
conf.set10(name, have)
m4_defines += have ? ['-D' + name] : []
endforeach
want_tests = get_option('tests')
@ -1071,11 +1101,14 @@ if get_option('efi')
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)
#####################################################################
@ -1185,12 +1218,12 @@ test_dlopen = executable(
link_with : [libbasic],
dependencies : [libdl])
foreach tuple : [['myhostname', 'HAVE_MYHOSTNAME'],
foreach tuple : [['myhostname', 'ENABLE_MYHOSTNAME'],
['systemd', 'ENABLE_NSS_SYSTEMD'],
['mymachines', 'ENABLE_MACHINED'],
['resolve', 'ENABLE_RESOLVED']]
['resolve', 'ENABLE_RESOLVE']]
condition = tuple[1] == '' or conf.get(tuple[1], false)
condition = tuple[1] == '' or conf.get(tuple[1]) == 1
if condition
module = tuple[0]
@ -1318,7 +1351,7 @@ executable('systemd-fstab-generator',
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,
@ -1332,7 +1365,7 @@ if conf.get('ENABLE_ENVIRONMENT_D', false)
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,
@ -1350,7 +1383,7 @@ if conf.get('ENABLE_HIBERNATE', false)
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',
@ -1371,7 +1404,7 @@ if conf.get('HAVE_BLKID', false)
public_programs += [exe]
endif
if conf.get('ENABLE_RESOLVED', false)
if conf.get('ENABLE_RESOLVE') == 1
executable('systemd-resolved',
systemd_resolved_sources,
gcrypt_util_sources,
@ -1401,7 +1434,7 @@ if conf.get('ENABLE_RESOLVED', false)
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,
@ -1434,7 +1467,7 @@ if conf.get('ENABLE_LOGIND', false)
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',
@ -1458,7 +1491,7 @@ if conf.get('ENABLE_LOGIND', false)
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,
@ -1468,7 +1501,7 @@ if conf.get('HAVE_PAM', false)
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,
@ -1500,7 +1533,7 @@ exe = executable('systemctl', 'src/systemctl/systemctl.c',
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,
@ -1510,7 +1543,7 @@ if conf.get('ENABLE_BACKLIGHT', false)
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,
@ -1528,7 +1561,7 @@ executable('systemd-system-update-generator',
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,
@ -1566,7 +1599,7 @@ if conf.get('HAVE_LIBCRYPTSETUP', false)
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,
@ -1584,7 +1617,7 @@ if conf.get('HAVE_SYSV_COMPAT', false)
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,
@ -1602,8 +1635,8 @@ if conf.get('ENABLE_HOSTNAMED', false)
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
@ -1628,7 +1661,7 @@ if conf.get('ENABLE_LOCALED', false)
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,
@ -1646,7 +1679,7 @@ if conf.get('ENABLE_TIMEDATED', false)
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,
@ -1658,7 +1691,7 @@ if conf.get('ENABLE_TIMESYNCD', false)
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,
@ -1681,7 +1714,7 @@ if conf.get('ENABLE_MACHINED', false)
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,
@ -1730,7 +1763,7 @@ if conf.get('ENABLE_IMPORTD', false)
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,
@ -1746,7 +1779,7 @@ if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_LIBCURL', false)
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,
@ -1775,7 +1808,7 @@ if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_MICROHTTPD', false)
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,
@ -1801,7 +1834,7 @@ if conf.get('ENABLE_COREDUMP', false)
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,
@ -1817,7 +1850,7 @@ if conf.get('ENABLE_BINFMT', false)
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,
@ -1827,7 +1860,7 @@ if conf.get('ENABLE_VCONSOLE', false)
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,
@ -1837,7 +1870,7 @@ if conf.get('ENABLE_RANDOMSEED', false)
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,
@ -2046,7 +2079,7 @@ exe = executable('busctl',
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,
@ -2057,7 +2090,7 @@ if conf.get('ENABLE_SYSUSERS', false)
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,
@ -2069,7 +2102,7 @@ if conf.get('ENABLE_TMPFILES', false)
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',
@ -2081,7 +2114,7 @@ if conf.get('ENABLE_HWDB', false)
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,
@ -2159,7 +2192,7 @@ executable('systemd-update-utmp',
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,
@ -2191,7 +2224,7 @@ exe = executable('systemd-nspawn',
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,
@ -2241,7 +2274,7 @@ foreach tuple : tests
type = ''
endif
if condition == '' or conf.get(condition, false)
if condition == '' or conf.get(condition) == 1
exe = executable(
name,
sources,
@ -2447,7 +2480,7 @@ status += [
# 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)]
@ -2518,13 +2551,13 @@ foreach tuple : [
['blkid'],
['dbus'],
['glib'],
['nss-myhostname', conf.get('HAVE_MYHOSTNAME', false)],
['nss-myhostname', conf.get('ENABLE_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'],
@ -2540,7 +2573,7 @@ foreach tuple : [
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]]

View File

@ -1,4 +1,4 @@
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',

View File

@ -37,12 +37,12 @@ if bashcompletiondir != 'no'
['loginctl', 'ENABLE_LOGIND'],
['machinectl', 'ENABLE_MACHINED'],
['networkctl', 'ENABLE_NETWORKD'],
['systemd-resolve', 'ENABLE_RESOLVED'],
['systemd-resolve', 'ENABLE_RESOLVE'],
['timedatectl', 'ENABLE_TIMEDATED'],
]
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

View File

@ -33,13 +33,13 @@ if zshcompletiondir != 'no'
['_machinectl', 'ENABLE_MACHINED'],
['_networkctl', 'ENABLE_NETWORKD'],
['_systemd-inhibit', 'ENABLE_LOGIND'],
['_systemd-resolve', 'ENABLE_RESOLVED'],
['_systemd-resolve', 'ENABLE_RESOLVE'],
['_systemd-tmpfiles', 'ENABLE_TMPFILES'],
['_timedatectl', 'ENABLE_TIMEDATED'],
]
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

View File

@ -36,7 +36,7 @@
#include "log.h"
#include "pager.h"
#include "parse-util.h"
#ifdef HAVE_SECCOMP
#if HAVE_SECCOMP
#include "seccomp-util.h"
#endif
#include "special.h"
@ -1337,7 +1337,7 @@ static int get_log_target(sd_bus *bus, char **args) {
return 0;
}
#ifdef HAVE_SECCOMP
#if HAVE_SECCOMP
static void dump_syscall_filter(const SyscallFilterSet *set) {
const char *syscall;

View File

@ -19,13 +19,13 @@
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

View File

@ -32,7 +32,7 @@
#include <sys/sysmacros.h>
#include <unistd.h>
#ifdef HAVE_LINUX_BTRFS_H
#if HAVE_LINUX_BTRFS_H
#include <linux/btrfs.h>
#endif

View File

@ -19,121 +19,121 @@
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 ENABLE_IMA
#define _IMA_FEATURE_ "+IMA"
#else
#define _IMA_FEATURE_ "-IMA"
#endif
#ifdef HAVE_SMACK
#if ENABLE_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 ENABLE_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"

View File

@ -43,7 +43,7 @@
#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" \
@ -68,7 +68,7 @@
#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)

View File

@ -34,7 +34,7 @@
#include "strv.h"
#include "util.h"
#ifdef ENABLE_DEBUG_HASHMAP
#if ENABLE_DEBUG_HASHMAP
#include <pthread.h>
#include "list.h"
#endif
@ -142,7 +142,7 @@ typedef uint8_t dib_raw_t;
#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 */
@ -499,7 +499,7 @@ static void base_remove_entry(HashmapBase *h, unsigned idx) {
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
@ -578,7 +578,7 @@ static unsigned hashmap_iterate_in_insertion_order(OrderedHashmap *h, Iterator *
assert(e->p.b.key == i->next_key);
}
#ifdef ENABLE_DEBUG_HASHMAP
#if ENABLE_DEBUG_HASHMAP
i->prev_idx = idx;
#endif
@ -635,7 +635,7 @@ static unsigned hashmap_iterate_in_internal_order(HashmapBase *h, Iterator *i) {
}
idx = i->idx;
#ifdef ENABLE_DEBUG_HASHMAP
#if ENABLE_DEBUG_HASHMAP
i->prev_idx = idx;
#endif
@ -658,7 +658,7 @@ static unsigned hashmap_iterate_entry(HashmapBase *h, Iterator *i) {
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;
@ -750,7 +750,7 @@ static struct HashmapBase *hashmap_base_new(const struct hash_ops *hash_ops, enu
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;
@ -807,7 +807,7 @@ static void hashmap_free_no_clear(HashmapBase *h) {
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);
@ -919,7 +919,7 @@ static bool hashmap_put_robin_hood(HashmapBase *h, unsigned idx,
dib_raw_t raw_dib, *dibs;
unsigned dib, distance;
#ifdef ENABLE_DEBUG_HASHMAP
#if ENABLE_DEBUG_HASHMAP
h->debug.put_count++;
#endif
@ -1012,7 +1012,7 @@ static int hashmap_base_put_boldly(HashmapBase *h, unsigned idx,
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
@ -1240,7 +1240,7 @@ int hashmap_replace(Hashmap *h, const void *key, void *value) {
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. */

View File

@ -58,7 +58,7 @@ typedef struct Set Set; /* Stores just keys */
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 */
@ -89,7 +89,7 @@ typedef struct {
(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

View File

@ -21,7 +21,7 @@
#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>

View File

@ -40,7 +40,7 @@
#include <uchar.h>
#include <unistd.h>
#ifdef HAVE_AUDIT
#if HAVE_AUDIT
#include <libaudit.h>
#endif
@ -48,11 +48,11 @@
#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
@ -204,7 +204,7 @@ struct sockaddr_vm {
#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];
@ -546,8 +546,8 @@ struct btrfs_ioctl_quota_ctl_args {
#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"
@ -613,7 +613,7 @@ struct input_mask {
#define O_TMPFILE (__O_TMPFILE | O_DIRECTORY)
#endif
#if !HAVE_DECL_LO_FLAGS_PARTSCAN
#if !HAVE_LO_FLAGS_PARTSCAN
#define LO_FLAGS_PARTSCAN 8
#endif
@ -625,7 +625,7 @@ struct input_mask {
#define LOOP_CTL_GET_FREE 0x4C82
#endif
#if !HAVE_DECL_IFLA_INET6_ADDR_GEN_MODE
#if !HAVE_IFLA_INET6_ADDR_GEN_MODE
#define IFLA_INET6_UNSPEC 0
#define IFLA_INET6_FLAGS 1
#define IFLA_INET6_CONF 2
@ -643,11 +643,11 @@ struct input_mask {
#define IN6_ADDR_GEN_MODE_NONE 1
#endif
#if !HAVE_DECL_IN6_ADDR_GEN_MODE_STABLE_PRIVACY
#if !HAVE_IN6_ADDR_GEN_MODE_STABLE_PRIVACY
#define IN6_ADDR_GEN_MODE_STABLE_PRIVACY 2
#endif
#if !HAVE_DECL_IFLA_MACVLAN_FLAGS
#if !HAVE_IFLA_MACVLAN_FLAGS
#define IFLA_MACVLAN_UNSPEC 0
#define IFLA_MACVLAN_MODE 1
#define IFLA_MACVLAN_FLAGS 2
@ -656,7 +656,7 @@ struct input_mask {
#define IFLA_MACVLAN_MAX (__IFLA_MACVLAN_MAX - 1)
#endif
#if !HAVE_DECL_IFLA_IPVLAN_MODE
#if !HAVE_IFLA_IPVLAN_MODE
#define IFLA_IPVLAN_UNSPEC 0
#define IFLA_IPVLAN_MODE 1
#define __IFLA_IPVLAN_MAX 2
@ -668,7 +668,7 @@ struct input_mask {
#define IPVLAN_MAX 2
#endif
#if !HAVE_DECL_IFLA_VTI_REMOTE
#if !HAVE_IFLA_VTI_REMOTE
#define IFLA_VTI_UNSPEC 0
#define IFLA_VTI_LINK 1
#define IFLA_VTI_IKEY 2
@ -680,7 +680,7 @@ struct input_mask {
#define IFLA_VTI_MAX (__IFLA_VTI_MAX - 1)
#endif
#if !HAVE_DECL_IFLA_PHYS_PORT_ID
#if !HAVE_IFLA_PHYS_PORT_ID
#define IFLA_EXT_MASK 29
#undef IFLA_PROMISCUITY
#define IFLA_PROMISCUITY 30
@ -693,7 +693,7 @@ struct input_mask {
#define IFLA_MAX (__IFLA_MAX - 1)
#endif
#if !HAVE_DECL_IFLA_BOND_AD_INFO
#if !HAVE_IFLA_BOND_AD_INFO
#define IFLA_BOND_UNSPEC 0
#define IFLA_BOND_MODE 1
#define IFLA_BOND_ACTIVE_SLAVE 2
@ -723,7 +723,7 @@ struct input_mask {
#define IFLA_BOND_MAX (__IFLA_BOND_MAX - 1)
#endif
#if !HAVE_DECL_IFLA_VLAN_PROTOCOL
#if !HAVE_IFLA_VLAN_PROTOCOL
#define IFLA_VLAN_UNSPEC 0
#define IFLA_VLAN_ID 1
#define IFLA_VLAN_FLAGS 2
@ -735,7 +735,7 @@ struct input_mask {
#define IFLA_VLAN_MAX (__IFLA_VLAN_MAX - 1)
#endif
#if !HAVE_DECL_IFLA_VXLAN_GPE
#if !HAVE_IFLA_VXLAN_GPE
#define IFLA_VXLAN_UNSPEC 0
#define IFLA_VXLAN_ID 1
#define IFLA_VXLAN_GROUP 2
@ -770,7 +770,7 @@ struct input_mask {
#define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1)
#endif
#if !HAVE_DECL_IFLA_GENEVE_LABEL
#if !HAVE_IFLA_GENEVE_LABEL
#define IFLA_GENEVE_UNSPEC 0
#define IFLA_GENEVE_ID 1
#define IFLA_GENEVE_REMOTE 2
@ -789,7 +789,7 @@ struct input_mask {
#define IFLA_GENEVE_MAX (__IFLA_GENEVE_MAX - 1)
#endif
#if !HAVE_DECL_IFLA_IPTUN_ENCAP_DPORT
#if !HAVE_IFLA_IPTUN_ENCAP_DPORT
#define IFLA_IPTUN_UNSPEC 0
#define IFLA_IPTUN_LINK 1
#define IFLA_IPTUN_LOCAL 2
@ -815,7 +815,7 @@ struct input_mask {
#define IFLA_IPTUN_MAX (__IFLA_IPTUN_MAX - 1)
#endif
#if !HAVE_DECL_IFLA_GRE_ENCAP_DPORT
#if !HAVE_IFLA_GRE_ENCAP_DPORT
#define IFLA_GRE_UNSPEC 0
#define IFLA_GRE_LINK 1
#define IFLA_GRE_IFLAGS 2
@ -840,7 +840,7 @@ struct input_mask {
#define IFLA_GRE_MAX (__IFLA_GRE_MAX - 1)
#endif
#if !HAVE_DECL_IFLA_BRIDGE_VLAN_INFO
#if !HAVE_IFLA_BRIDGE_VLAN_INFO
#define IFLA_BRIDGE_FLAGS 0
#define IFLA_BRIDGE_MODE 1
#define IFLA_BRIDGE_VLAN_INFO 2
@ -857,7 +857,7 @@ struct input_mask {
#define BRIDGE_VLAN_INFO_RANGE_END (1<<4) /* VLAN is end of vlan range */
#endif
#if !HAVE_DECL_IFLA_BR_VLAN_DEFAULT_PVID
#if !HAVE_IFLA_BR_VLAN_DEFAULT_PVID
#define IFLA_BR_UNSPEC 0
#define IFLA_BR_FORWARD_DELAY 1
#define IFLA_BR_HELLO_TIME 2
@ -903,7 +903,7 @@ struct input_mask {
#define IFLA_BR_MAX (__IFLA_BR_MAX - 1)
#endif
#if !HAVE_DECL_IFLA_BRPORT_LEARNING_SYNC
#if !HAVE_IFLA_BRPORT_LEARNING_SYNC
#define IFLA_BRPORT_UNSPEC 0
#define IFLA_BRPORT_STATE 1
#define IFLA_BRPORT_PRIORITY 2
@ -920,7 +920,7 @@ struct input_mask {
#define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1)
#endif
#if !HAVE_DECL_FRA_UID_RANGE
#if !HAVE_FRA_UID_RANGE
#define FRA_UNSPEC 0
#define FRA_DST 1
#define FRA_SRC 2
@ -947,15 +947,15 @@ struct input_mask {
#define FRA_MAX (__FRA_MAX - 1)
#endif
#if !HAVE_DECL_IFLA_BRPORT_PROXYARP
#if !HAVE_IFLA_BRPORT_PROXYARP
#define IFLA_BRPORT_PROXYARP 10
#endif
#if !HAVE_DECL_IFLA_VRF_TABLE
#if !HAVE_IFLA_VRF_TABLE
#define IFLA_VRF_TABLE 1
#endif
#if !HAVE_DECL_NDA_IFINDEX
#if !HAVE_NDA_IFINDEX
#define NDA_UNSPEC 0
#define NDA_DST 1
#define NDA_LLADDR 2
@ -1039,7 +1039,7 @@ struct input_mask {
#define LOOPBACK_IFINDEX 1
#endif
#if !HAVE_DECL_IFA_FLAGS
#if !HAVE_IFA_FLAGS
#define IFA_FLAGS 8
#endif
@ -1108,7 +1108,7 @@ struct input_mask {
#define KEY_ALS_TOGGLE 0x230
#endif
#ifndef HAVE_KEY_SERIAL_T
#if ! HAVE_KEY_SERIAL_T
typedef int32_t key_serial_t;
#endif
@ -1204,11 +1204,11 @@ typedef int32_t key_serial_t;
#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
@ -1220,7 +1220,7 @@ typedef int32_t key_serial_t;
#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 */
@ -1247,7 +1247,7 @@ struct 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;

View File

@ -24,7 +24,7 @@
#include <sys/types.h>
#if !HAVE_DECL_PIVOT_ROOT
#if !HAVE_PIVOT_ROOT
static inline int pivot_root(const char *new_root, const char *put_old) {
return syscall(SYS_pivot_root, new_root, put_old);
}
@ -32,7 +32,7 @@ static inline int pivot_root(const char *new_root, const char *put_old) {
/* ======================================================================= */
#if !HAVE_DECL_MEMFD_CREATE
#if !HAVE_MEMFD_CREATE
# ifndef __NR_memfd_create
# if defined __x86_64__
# define __NR_memfd_create 319
@ -73,7 +73,7 @@ static inline int memfd_create(const char *name, unsigned int flags) {
/* ======================================================================= */
#if !HAVE_DECL_GETRANDOM
#if !HAVE_GETRANDOM
# ifndef __NR_getrandom
# if defined __x86_64__
# define __NR_getrandom 318
@ -120,7 +120,7 @@ static inline int getrandom(void *buffer, size_t count, unsigned flags) {
/* ======================================================================= */
#if !HAVE_DECL_GETTID
#if !HAVE_GETTID
static inline pid_t gettid(void) {
return (pid_t) syscall(SYS_gettid);
}
@ -128,7 +128,7 @@ static inline pid_t gettid(void) {
/* ======================================================================= */
#if !HAVE_DECL_NAME_TO_HANDLE_AT
#if !HAVE_NAME_TO_HANDLE_AT
# ifndef __NR_name_to_handle_at
# if defined(__x86_64__)
# define __NR_name_to_handle_at 303
@ -163,7 +163,7 @@ static inline int name_to_handle_at(int fd, const char *name, struct file_handle
/* ======================================================================= */
#if !HAVE_DECL_SETNS
#if !HAVE_SETNS
# ifndef __NR_setns
# if defined(__x86_64__)
# define __NR_setns 308
@ -198,7 +198,7 @@ static inline pid_t raw_getpid(void) {
/* ======================================================================= */
#if !HAVE_DECL_RENAMEAT2
#if !HAVE_RENAMEAT2
# ifndef __NR_renameat2
# if defined __x86_64__
# define __NR_renameat2 316
@ -241,7 +241,7 @@ static inline int renameat2(int oldfd, const char *oldname, int newfd, const cha
/* ======================================================================= */
#if !HAVE_DECL_KCMP
#if !HAVE_KCMP
static inline int kcmp(pid_t pid1, pid_t pid2, int type, unsigned long idx1, unsigned long idx2) {
# ifdef __NR_kcmp
return syscall(__NR_kcmp, pid1, pid2, type, idx1, idx2);
@ -254,7 +254,7 @@ static inline int kcmp(pid_t pid1, pid_t pid2, int type, unsigned long idx1, uns
/* ======================================================================= */
#if !HAVE_DECL_KEYCTL
#if !HAVE_KEYCTL
static inline long keyctl(int cmd, unsigned long arg2, unsigned long arg3, unsigned long arg4,unsigned long arg5) {
# ifdef __NR_keyctl
return syscall(__NR_keyctl, cmd, arg2, arg3, arg4, arg5);
@ -285,7 +285,7 @@ static inline key_serial_t request_key(const char *type, const char *description
/* ======================================================================= */
#if !HAVE_DECL_COPY_FILE_RANGE
#if !HAVE_COPY_FILE_RANGE
# ifndef __NR_copy_file_range
# if defined(__x86_64__)
# define __NR_copy_file_range 326
@ -319,7 +319,7 @@ static inline ssize_t copy_file_range(int fd_in, loff_t *off_in,
}
#endif
#if !HAVE_DECL_BPF
#if !HAVE_BPF
# ifndef __NR_bpf
# if defined __i386__
# define __NR_bpf 357

View File

@ -30,7 +30,7 @@
#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

View File

@ -34,7 +34,7 @@
#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
@ -945,7 +945,7 @@ int opinionated_personality(unsigned long *ret) {
}
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);

View File

@ -26,11 +26,11 @@
#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>
@ -100,14 +100,14 @@ int acquire_random_bytes(void *p, size_t n, bool high_quality_required) {
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... */

View File

@ -26,7 +26,7 @@
#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>
@ -40,7 +40,7 @@
#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);
@ -54,7 +54,7 @@ static struct selabel_handle *label_hnd = NULL;
#endif
bool mac_selinux_use(void) {
#ifdef HAVE_SELINUX
#if HAVE_SELINUX
if (cached_use < 0)
cached_use = is_selinux_enabled() > 0;
@ -65,7 +65,7 @@ bool mac_selinux_use(void) {
}
void mac_selinux_retest(void) {
#ifdef HAVE_SELINUX
#if HAVE_SELINUX
cached_use = -1;
#endif
}
@ -73,7 +73,7 @@ void mac_selinux_retest(void) {
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;
@ -110,7 +110,7 @@ int mac_selinux_init(void) {
void mac_selinux_finish(void) {
#ifdef HAVE_SELINUX
#if HAVE_SELINUX
if (!label_hnd)
return;
@ -121,7 +121,7 @@ void mac_selinux_finish(void) {
int mac_selinux_fix(const char *path, bool ignore_enoent, bool ignore_erofs) {
#ifdef HAVE_SELINUX
#if HAVE_SELINUX
struct stat st;
int r;
@ -169,7 +169,7 @@ int mac_selinux_fix(const char *path, bool ignore_enoent, bool ignore_erofs) {
int mac_selinux_apply(const char *path, const char *label) {
#ifdef HAVE_SELINUX
#if HAVE_SELINUX
if (!mac_selinux_use())
return 0;
@ -188,7 +188,7 @@ int mac_selinux_apply(const char *path, const char *label) {
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;
@ -220,7 +220,7 @@ int mac_selinux_get_our_label(char **label) {
assert(label);
#ifdef HAVE_SELINUX
#if HAVE_SELINUX
if (!mac_selinux_use())
return -EOPNOTSUPP;
@ -235,7 +235,7 @@ int mac_selinux_get_our_label(char **label) {
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;
@ -296,7 +296,7 @@ int mac_selinux_get_child_mls_label(int socket_fd, const char *exe, const char *
char* mac_selinux_free(char *label) {
#ifdef HAVE_SELINUX
#if HAVE_SELINUX
if (!label)
return NULL;
@ -312,7 +312,7 @@ char* mac_selinux_free(char *label) {
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;
@ -355,7 +355,7 @@ int mac_selinux_create_file_prepare(const char *path, mode_t mode) {
void mac_selinux_create_file_clear(void) {
#ifdef HAVE_SELINUX
#if HAVE_SELINUX
PROTECT_ERRNO;
if (!mac_selinux_use())
@ -367,7 +367,7 @@ void mac_selinux_create_file_clear(void) {
int mac_selinux_create_socket_prepare(const char *label) {
#ifdef HAVE_SELINUX
#if HAVE_SELINUX
if (!mac_selinux_use())
return 0;
@ -386,7 +386,7 @@ int mac_selinux_create_socket_prepare(const char *label) {
void mac_selinux_create_socket_clear(void) {
#ifdef HAVE_SELINUX
#if HAVE_SELINUX
PROTECT_ERRNO;
if (!mac_selinux_use())
@ -400,7 +400,7 @@ int mac_selinux_bind(int fd, const struct sockaddr *addr, socklen_t addrlen) {
/* 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;

View File

@ -35,7 +35,7 @@
#include "string-table.h"
#include "xattr-util.h"
#ifdef HAVE_SMACK
#if ENABLE_SMACK
bool mac_smack_use(void) {
static int cached_use = -1;

View File

@ -48,7 +48,7 @@
#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

View File

@ -826,7 +826,7 @@ int free_and_strdup(char **p, const char *s) {
return 1;
}
#if !HAVE_DECL_EXPLICIT_BZERO
#if !HAVE_EXPLICIT_BZERO
/*
* Pointer to memset is volatile so that compiler must de-reference
* the pointer and can't assume that it points to any function in

View File

@ -189,7 +189,7 @@ static inline void *memmem_safe(const void *haystack, size_t haystacklen, const
return memmem(haystack, haystacklen, needle, needlelen);
}
#if !HAVE_DECL_EXPLICIT_BZERO
#if !HAVE_EXPLICIT_BZERO
void explicit_bzero(void *p, size_t l);
#endif

View File

@ -1650,7 +1650,7 @@ static EFI_STATUS image_start(EFI_HANDLE parent_image, const Config *config, con
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,

View File

@ -11,7 +11,7 @@
*
*/
#ifdef ENABLE_TPM
#if ENABLE_TPM
#include <efi.h>
#include <efilib.h>

View File

@ -30,7 +30,7 @@ stub_sources = '''
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')
@ -64,7 +64,7 @@ if have_gnu_efi
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(

View File

@ -87,7 +87,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) {
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,

View File

@ -22,7 +22,7 @@
#include "audit-fd.h"
#ifdef HAVE_AUDIT
#if HAVE_AUDIT
#include <libaudit.h>
#include <stdbool.h>

View File

@ -19,7 +19,7 @@
#include <sys/prctl.h>
#ifdef HAVE_SECCOMP
#if HAVE_SECCOMP
#include <seccomp.h>
#endif
@ -42,7 +42,7 @@
#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"
@ -376,7 +376,7 @@ static int property_get_syscall_filter(
_cleanup_strv_free_ char **l = NULL;
int r;
#ifdef HAVE_SECCOMP
#if HAVE_SECCOMP
Iterator i;
void *id;
#endif
@ -393,7 +393,7 @@ static int property_get_syscall_filter(
if (r < 0)
return r;
#ifdef HAVE_SECCOMP
#if HAVE_SECCOMP
SET_FOREACH(id, c->syscall_filter, i) {
char *name;
@ -429,7 +429,7 @@ static int property_get_syscall_archs(
_cleanup_strv_free_ char **l = NULL;
int r;
#ifdef HAVE_SECCOMP
#if HAVE_SECCOMP
Iterator i;
void *id;
#endif
@ -438,7 +438,7 @@ static int property_get_syscall_archs(
assert(reply);
assert(c);
#ifdef HAVE_SECCOMP
#if HAVE_SECCOMP
SET_FOREACH(id, c->syscall_archs, i) {
const char *name;
@ -1185,7 +1185,7 @@ int bus_exec_context_set_transient_property(
return 1;
#ifdef HAVE_SECCOMP
#if HAVE_SECCOMP
} else if (streq(name, "SystemCallFilter")) {
int whitelist;

View File

@ -211,7 +211,7 @@ failed:
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;
@ -535,7 +535,7 @@ static int bus_setup_api_vtables(Manager *m, sd_bus *bus) {
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");

View File

@ -37,19 +37,19 @@
#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
@ -57,7 +57,7 @@
#include "af-list.h"
#include "alloc-util.h"
#ifdef HAVE_APPARMOR
#if HAVE_APPARMOR
#include "apparmor-util.h"
#endif
#include "async.h"
@ -88,7 +88,7 @@
#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"
@ -1019,7 +1019,7 @@ static int enforce_user(const ExecContext *context, uid_t uid) {
return 0;
}
#ifdef HAVE_PAM
#if HAVE_PAM
static int null_conv(
int num_msg,
@ -1043,7 +1043,7 @@ static int setup_pam(
char ***env,
int fds[], unsigned n_fds) {
#ifdef HAVE_PAM
#if HAVE_PAM
static const struct pam_conv conv = {
.conv = null_conv,
@ -1318,7 +1318,7 @@ static bool context_has_no_new_privileges(const ExecContext *c) {
c->lock_personality;
}
#ifdef HAVE_SECCOMP
#if HAVE_SECCOMP
static bool skip_seccomp_unavailable(const Unit* u, const char* msg) {
@ -2688,13 +2688,13 @@ static int exec_child(
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 ENABLE_SMACK
bool use_smack = false;
#endif
#ifdef HAVE_APPARMOR
#if HAVE_APPARMOR
bool use_apparmor = false;
#endif
uid_t uid = UID_INVALID;
@ -3048,13 +3048,13 @@ static int exec_child(
* 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 ENABLE_SMACK
use_smack = mac_smack_use();
#endif
#ifdef HAVE_APPARMOR
#if HAVE_APPARMOR
use_apparmor = mac_apparmor_use();
#endif
}
@ -3101,7 +3101,7 @@ static int exec_child(
}
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) {
@ -3223,7 +3223,7 @@ static int exec_child(
* 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;
@ -3237,7 +3237,7 @@ static int exec_child(
}
#endif
#ifdef HAVE_SMACK
#if ENABLE_SMACK
if (use_smack) {
r = setup_smack(context, command);
if (r < 0) {
@ -3247,7 +3247,7 @@ static int exec_child(
}
#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) {
@ -3271,7 +3271,7 @@ static int exec_child(
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;
@ -4118,7 +4118,7 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) {
prefix, yes_no(c->lock_personality));
if (c->syscall_filter) {
#ifdef HAVE_SECCOMP
#if HAVE_SECCOMP
Iterator j;
void *id;
bool first = true;
@ -4131,7 +4131,7 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) {
if (!c->syscall_whitelist)
fputc('~', f);
#ifdef HAVE_SECCOMP
#if HAVE_SECCOMP
SET_FOREACH(id, c->syscall_filter, j) {
_cleanup_free_ char *name = NULL;
@ -4149,7 +4149,7 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) {
}
if (c->syscall_archs) {
#ifdef HAVE_SECCOMP
#if HAVE_SECCOMP
Iterator j;
void *id;
#endif
@ -4158,7 +4158,7 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) {
"%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

View File

@ -33,7 +33,7 @@
#define IMA_POLICY_PATH "/etc/ima/ima-policy"
int ima_setup(void) {
#ifdef HAVE_IMA
#if ENABLE_IMA
_cleanup_fclose_ FILE *input = NULL;
_cleanup_close_ int imafd = -1;
unsigned lineno = 0;
@ -93,6 +93,6 @@ int ima_setup(void) {
done:
log_info("Successfully loaded the IMA custom policy "IMA_POLICY_PATH".");
#endif /* HAVE_IMA */
#endif /* ENABLE_IMA */
return 0;
}

View File

@ -21,7 +21,7 @@
#include <string.h>
#include <unistd.h>
#ifdef HAVE_KMOD
#if HAVE_KMOD
#include <libkmod.h>
#endif
@ -33,7 +33,7 @@
#include "macro.h"
#include "string-util.h"
#ifdef HAVE_KMOD
#if HAVE_KMOD
static void systemd_kmod_log(
void *data,
int priority,
@ -85,7 +85,7 @@ static bool has_virtio_rng(void) {
#endif
int kmod_setup(void) {
#ifdef HAVE_KMOD
#if HAVE_KMOD
static const struct {
const char *module;
@ -103,7 +103,7 @@ int kmod_setup(void) {
/* 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

View File

@ -131,7 +131,7 @@ m4_ifdef(`HAVE_SELINUX',
m4_ifdef(`HAVE_APPARMOR',
`$1.AppArmorProfile, config_parse_exec_apparmor_profile, 0, offsetof($1, exec_context)',
`$1.AppArmorProfile, config_parse_warn_compat, DISABLED_CONFIGURATION, 0')
m4_ifdef(`HAVE_SMACK',
m4_ifdef(`ENABLE_SMACK',
`$1.SmackProcessLabel, config_parse_exec_smack_process_label, 0, offsetof($1, exec_context)',
`$1.SmackProcessLabel, config_parse_warn_compat, DISABLED_CONFIGURATION, 0')'
)m4_dnl
@ -356,7 +356,7 @@ Socket.FileDescriptorName, config_parse_fdname, 0,
Socket.Service, config_parse_socket_service, 0, 0
Socket.TriggerLimitIntervalSec, config_parse_sec, 0, offsetof(Socket, trigger_limit.interval)
Socket.TriggerLimitBurst, config_parse_unsigned, 0, offsetof(Socket, trigger_limit.burst)
m4_ifdef(`HAVE_SMACK',
m4_ifdef(`ENABLE_SMACK',
`Socket.SmackLabel, config_parse_unit_string_printf, 0, offsetof(Socket, smack)
Socket.SmackLabelIPIn, config_parse_unit_string_printf, 0, offsetof(Socket, smack_ip_in)
Socket.SmackLabelIPOut, config_parse_unit_string_printf, 0, offsetof(Socket, smack_ip_out)',

View File

@ -22,7 +22,7 @@
#include <fcntl.h>
#include <linux/fs.h>
#include <linux/oom.h>
#ifdef HAVE_SECCOMP
#if HAVE_SECCOMP
#include <seccomp.h>
#endif
#include <sched.h>
@ -54,7 +54,7 @@
#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"
@ -1234,7 +1234,7 @@ int config_parse_limit(
return 0;
}
#ifdef HAVE_SYSV_COMPAT
#if HAVE_SYSV_COMPAT
int config_parse_sysv_priority(const char *unit,
const char *filename,
unsigned line,
@ -2623,7 +2623,7 @@ int config_parse_documentation(const char *unit,
return r;
}
#ifdef HAVE_SECCOMP
#if HAVE_SECCOMP
static int syscall_filter_parse_one(
const char *unit,
@ -4484,7 +4484,7 @@ void unit_dump_config_items(FILE *f) {
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 || !ENABLE_SMACK || !HAVE_APPARMOR
{ config_parse_warn_compat, "NOTSUPPORTED" },
#endif
{ config_parse_int, "INTEGER" },
@ -4517,7 +4517,7 @@ void unit_dump_config_items(FILE *f) {
{ 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" },
@ -4547,7 +4547,7 @@ void unit_dump_config_items(FILE *f) {
{ 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" },
@ -4567,7 +4567,7 @@ void unit_dump_config_items(FILE *f) {
{ 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" },

View File

@ -28,10 +28,10 @@
#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
@ -74,7 +74,7 @@
#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"
@ -717,7 +717,7 @@ static int parse_config_file(void) {
{ "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 },
@ -1264,7 +1264,7 @@ oom:
}
static int enforce_syscall_archs(Set *archs) {
#ifdef HAVE_SECCOMP
#if HAVE_SECCOMP
int r;
if (!is_seccomp_available())
@ -1411,7 +1411,7 @@ int main(int argc, char *argv[]) {
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. */
@ -2172,7 +2172,7 @@ finish:
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

View File

@ -30,7 +30,7 @@
#include <sys/wait.h>
#include <unistd.h>
#ifdef HAVE_AUDIT
#if HAVE_AUDIT
#include <libaudit.h>
#endif
@ -620,7 +620,7 @@ int manager_new(UnitFileScope scope, unsigned test_run_flags, Manager **_m) {
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
@ -2455,7 +2455,7 @@ int manager_get_job_from_dbus_path(Manager *m, const char *s, Job **_j) {
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;

View File

@ -64,7 +64,7 @@ typedef struct MountPoint {
* 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 ENABLE_SMACK
#define N_EARLY_MOUNT 5
#else
#define N_EARLY_MOUNT 4
@ -79,7 +79,7 @@ static const MountPoint mount_table[] = {
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 ENABLE_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,
@ -89,7 +89,7 @@ static const MountPoint mount_table[] = {
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 ENABLE_SMACK
{ "tmpfs", "/run", "tmpfs", "mode=755,smackfsroot=*", MS_NOSUID|MS_NODEV|MS_STRICTATIME,
mac_smack_use, MNT_FATAL },
#endif
@ -111,7 +111,7 @@ static const MountPoint mount_table[] = {
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
@ -336,7 +336,7 @@ int mount_cgroup_controllers(char ***join_controllers) {
return 0;
}
#if defined(HAVE_SELINUX) || defined(HAVE_SMACK)
#if HAVE_SELINUX || ENABLE_SMACK
static int nftw_cb(
const char *fpath,
const struct stat *sb,
@ -367,7 +367,7 @@ int mount_setup(bool loaded_policy) {
if (r < 0)
return r;
#if defined(HAVE_SELINUX) || defined(HAVE_SMACK)
#if HAVE_SELINUX || ENABLE_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

View File

@ -107,7 +107,7 @@ static const MountEntry protect_kernel_tunables_table[] = {
/* 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 },

View File

@ -19,13 +19,13 @@
#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
@ -112,7 +112,7 @@ _printf_(2, 3) static int log_callback(int type, const char *fmt, ...) {
va_list ap;
const char *fmt2;
#ifdef HAVE_AUDIT
#if HAVE_AUDIT
int fd;
fd = get_audit_fd();

View File

@ -26,7 +26,7 @@
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))

View File

@ -21,7 +21,7 @@
#include <stdio.h>
#include <unistd.h>
#ifdef HAVE_SELINUX
#if HAVE_SELINUX
#include <selinux/selinux.h>
#endif
@ -32,7 +32,7 @@
#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;
@ -41,7 +41,7 @@ static int null_log(int type, const char *fmt, ...) {
int mac_selinux_setup(bool *loaded_policy) {
#ifdef HAVE_SELINUX
#if HAVE_SELINUX
int enforce = 0;
usec_t before_load, after_load;
char *con;

View File

@ -36,7 +36,7 @@
#include "string-util.h"
#include "util.h"
#ifdef HAVE_SMACK
#if ENABLE_SMACK
static int write_access2_rules(const char* srcdir) {
_cleanup_close_ int load2_fd = -1, change_fd = -1;
@ -316,7 +316,7 @@ static int write_onlycap_list(void) {
int mac_smack_setup(bool *loaded_policy) {
#ifdef HAVE_SMACK
#if ENABLE_SMACK
int r;

View File

@ -375,7 +375,7 @@ static int delete_dm(dev_t devnum) {
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");

View File

@ -23,7 +23,7 @@
#include <sys/xattr.h>
#include <unistd.h>
#ifdef HAVE_ELFUTILS
#if HAVE_ELFUTILS
#include <dwarf.h>
#include <elfutils/libdwfl.h>
#endif
@ -156,7 +156,7 @@ static inline uint64_t storage_size_max(void) {
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;
@ -393,7 +393,7 @@ static int save_external_coredump(
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)) {
@ -765,7 +765,7 @@ static int submit_coredump(
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;

View File

@ -799,7 +799,7 @@ static int save_core(sd_journal *j, FILE *file, char **path, bool *unlink_temp)
}
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);

View File

@ -4,7 +4,7 @@ systemd_coredump_sources = files('''
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

View File

@ -49,7 +49,7 @@ static const char prefixes[] =
"/usr/local/share\0"
"/usr/lib\0"
"/usr/share\0"
#ifdef HAVE_SPLIT_USR
#if HAVE_SPLIT_USR
"/lib\0"
#endif
;
@ -392,7 +392,7 @@ static int enumerate_dir(
}
static int should_skip_prefix(const char* p) {
#ifdef HAVE_SPLIT_USR
#if HAVE_SPLIT_USR
int r;
_cleanup_free_ char *target = NULL;

View File

@ -131,7 +131,7 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
}
}
#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;
@ -147,7 +147,7 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
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;

View File

@ -323,7 +323,7 @@ static int add_swap(const char *path) {
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,
@ -612,7 +612,7 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
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
@ -624,7 +624,7 @@ static int add_root_cryptsetup(void) {
static int add_root_mount(void) {
#ifdef ENABLE_EFI
#if ENABLE_EFI
int r;
if (!is_efi_boot()) {

View File

@ -1,4 +1,4 @@
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',

View File

@ -48,7 +48,7 @@ systemd_export_sources = files('''
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',

View File

@ -946,7 +946,7 @@ static int parse_argv(int argc, char *argv[]) {
break;
case ARG_TRUST:
#ifdef HAVE_GNUTLS
#if HAVE_GNUTLS
if (arg_trust_pem) {
log_error("CA certificate file specified twice");
return -EINVAL;

View File

@ -1384,7 +1384,7 @@ static int parse_argv(int argc, char *argv[]) {
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();
@ -1442,7 +1442,7 @@ static int parse_argv(int argc, char *argv[]) {
break;
case ARG_GNUTLS_LOG: {
#ifdef HAVE_GNUTLS
#if HAVE_GNUTLS
const char* p = optarg;
for (;;) {
_cleanup_free_ char *word = NULL;

View File

@ -21,7 +21,7 @@ systemd_journal_gatewayd_sources = files('''
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',
@ -30,7 +30,7 @@ if conf.get('ENABLE_REMOTE', false) and conf.get('HAVE_LIBCURL', false)
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',

View File

@ -22,7 +22,7 @@
#include <stdio.h>
#include <string.h>
#ifdef HAVE_GNUTLS
#if HAVE_GNUTLS
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
#endif
@ -115,7 +115,7 @@ int mhd_respondf(struct MHD_Connection *connection,
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];

View File

@ -19,7 +19,7 @@
#include <stdio.h>
#include <linux/audit.h>
#ifdef HAVE_AUDIT
#if HAVE_AUDIT
# include <libaudit.h>
#endif

View File

@ -23,11 +23,11 @@
#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
@ -43,7 +43,7 @@
#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
@ -59,7 +59,7 @@ DEFINE_STRING_TABLE_LOOKUP(object_compressed, int);
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
@ -97,7 +97,7 @@ int compress_blob_xz(const void *src, uint64_t src_size,
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);
@ -133,7 +133,7 @@ int compress_blob_lz4(const void *src, uint64_t src_size,
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;
@ -193,7 +193,7 @@ int decompress_blob_xz(const void *src, uint64_t src_size,
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 */
@ -249,7 +249,7 @@ int decompress_startswith_xz(const void *src, uint64_t src_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;
@ -307,7 +307,7 @@ int decompress_startswith_lz4(const void *src, uint64_t src_size,
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 */
@ -372,7 +372,7 @@ int decompress_startswith(int compression,
}
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];
@ -449,7 +449,7 @@ int compress_stream_xz(int fdf, int fdt, uint64_t max_bytes) {
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;
@ -542,7 +542,7 @@ int compress_stream_lz4(int fdf, int fdt, uint64_t max_bytes) {
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;
@ -616,7 +616,7 @@ int decompress_stream_xz(int fdf, int fdt, uint64_t max_bytes) {
}
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;

View File

@ -34,7 +34,7 @@ int compress_blob_lz4(const void *src, uint64_t src_size,
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;
@ -74,7 +74,7 @@ int compress_stream_lz4(int fdf, int fdt, uint64_t max_bytes);
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

View File

@ -162,11 +162,11 @@ enum {
#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
@ -177,7 +177,7 @@ enum {
};
#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

View File

@ -331,7 +331,7 @@ bool journal_file_is_offlining(JournalFile *f) {
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;
@ -378,11 +378,11 @@ JournalFile* journal_file_close(JournalFile *f) {
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
@ -1401,7 +1401,7 @@ int journal_file_find_data_object_with_hash(
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;
@ -1513,7 +1513,7 @@ static int journal_file_append_field(
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;
@ -1565,7 +1565,7 @@ static int journal_file_append_data(
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;
@ -1590,7 +1590,7 @@ static int journal_file_append_data(
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;
@ -1704,7 +1704,7 @@ static int link_entry_into_array(JournalFile *f,
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;
@ -1854,7 +1854,7 @@ static int journal_file_append_entry_internal(
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;
@ -1990,7 +1990,7 @@ int journal_file_append_entry(JournalFile *f, const dual_timestamp *ts, const st
ts = &_ts;
}
#ifdef HAVE_GCRYPT
#if HAVE_GCRYPT
r = journal_file_maybe_append_tag(f, ts->realtime);
if (r < 0)
return r;
@ -3259,12 +3259,12 @@ int journal_file_open(
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
@ -3335,7 +3335,7 @@ int journal_file_open(
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) {
@ -3376,7 +3376,7 @@ int journal_file_open(
goto fail;
}
#ifdef HAVE_GCRYPT
#if HAVE_GCRYPT
if (!newly_created && f->writable) {
r = journal_file_fss_load(f);
if (r < 0)
@ -3396,7 +3396,7 @@ int journal_file_open(
goto fail;
}
#ifdef HAVE_GCRYPT
#if HAVE_GCRYPT
r = journal_file_hmac_setup(f);
if (r < 0)
goto fail;
@ -3411,7 +3411,7 @@ int journal_file_open(
if (r < 0)
goto fail;
#ifdef HAVE_GCRYPT
#if HAVE_GCRYPT
r = journal_file_append_first_tag(f);
if (r < 0)
goto fail;
@ -3622,7 +3622,7 @@ int journal_file_copy_entry(JournalFile *from, JournalFile *to, Object *o, uint6
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,

View File

@ -21,7 +21,7 @@
#include <inttypes.h>
#ifdef HAVE_GCRYPT
#if HAVE_GCRYPT
#include <gcrypt.h>
#endif
@ -121,12 +121,12 @@ typedef struct JournalFile {
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;

View File

@ -834,13 +834,13 @@ int journal_file_verify(
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.");
@ -1103,7 +1103,7 @@ int journal_file_verify(
goto fail;
}
#ifdef HAVE_GCRYPT
#if HAVE_GCRYPT
if (f->seal) {
uint64_t q, rt;

View File

@ -105,7 +105,7 @@ static char **arg_file = NULL;
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
@ -313,7 +313,7 @@ static void help(void) {
" -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"
@ -336,7 +336,7 @@ static void help(void) {
" --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);
@ -669,7 +669,7 @@ static int parse_argv(int argc, char *argv[]) {
arg_action = ACTION_VACUUM;
break;
#ifdef HAVE_GCRYPT
#if HAVE_GCRYPT
case ARG_FORCE:
arg_force = true;
break;
@ -1561,7 +1561,7 @@ static int add_syslog_identifier(sd_journal *j) {
}
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;
@ -1727,7 +1727,7 @@ static int setup_keys(void) {
} 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);
@ -1769,7 +1769,7 @@ static int verify(sd_journal *j) {
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

View File

@ -17,7 +17,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#ifdef HAVE_SELINUX
#if HAVE_SELINUX
#include <selinux/selinux.h>
#endif
@ -227,7 +227,7 @@ static int client_context_read_label(
free_and_replace(c->label, l);
c->label_size = label_size;
}
#ifdef HAVE_SELINUX
#if HAVE_SELINUX
else {
char *con;

View File

@ -521,7 +521,7 @@ int server_open_native_socket(Server*s) {
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)

View File

@ -17,7 +17,7 @@
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>
@ -240,12 +240,12 @@ void server_space_usage_message(Server *s, JournalStorage *storage) {
}
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;
@ -1868,7 +1868,7 @@ int server_init(Server *s) {
}
void server_maybe_append_tags(Server *s) {
#ifdef HAVE_GCRYPT
#if HAVE_GCRYPT
JournalFile *f;
Iterator i;
usec_t n;

View File

@ -20,7 +20,7 @@
#include <stddef.h>
#include <unistd.h>
#ifdef HAVE_SELINUX
#if HAVE_SELINUX
#include <selinux/selinux.h>
#endif

View File

@ -414,7 +414,7 @@ int server_open_syslog_socket(Server *s) {
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)

View File

@ -91,7 +91,7 @@ int main(int argc, char *argv[]) {
t = server.oldest_file_usec + server.max_retention_usec - n;
}
#ifdef HAVE_GCRYPT
#if HAVE_GCRYPT
if (server.system_journal) {
usec_t u;

View File

@ -20,7 +20,7 @@ journal_internal_sources = files('''
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
@ -36,7 +36,7 @@ endif
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
@ -97,7 +97,7 @@ systemd_cat_sources = files('cat.c')
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

View File

@ -84,7 +84,7 @@ struct MMapCache {
#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
@ -225,7 +225,7 @@ static void context_detach_window(Context *c) {
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);

View File

@ -2152,7 +2152,7 @@ _public_ int sd_journal_get_data(sd_journal *j, const char *field, const void **
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,
@ -2216,7 +2216,7 @@ static int return_data(sd_journal *j, JournalFile *f, Object *o, const void **da
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;

View File

@ -31,7 +31,7 @@ typedef int (compress_t)(const void *src, uint64_t src_size, void *dst,
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;
@ -157,7 +157,7 @@ static void test_compress_decompress(const char* label, const char* type,
#endif
int main(int argc, char *argv[]) {
#if defined(HAVE_XZ) || defined(HAVE_LZ4)
#if HAVE_XZ || HAVE_LZ4
const char *i;
int r;
@ -183,10 +183,10 @@ int main(int argc, char *argv[]) {
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
}

View File

@ -17,7 +17,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#ifdef HAVE_LZ4
#if HAVE_LZ4
#include <lz4.h>
#endif
@ -29,13 +29,13 @@
#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
@ -54,7 +54,7 @@ typedef int (decompress_sw_t)(const void *src, uint64_t src_size,
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,
@ -206,7 +206,7 @@ static void test_compress_stream(int compression,
}
#endif
#ifdef HAVE_LZ4
#if HAVE_LZ4
static void test_lz4_decompress_partial(void) {
char buf[20000];
size_t buf_size = sizeof(buf), compressed;
@ -249,7 +249,7 @@ static void test_lz4_decompress_partial(void) {
#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";
@ -268,7 +268,7 @@ int main(int argc, char *argv[]) {
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,
@ -290,7 +290,7 @@ int main(int argc, char *argv[]) {
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,

View File

@ -58,7 +58,7 @@ static void test_non_empty(void) {
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);

View File

@ -17,7 +17,7 @@
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

View File

@ -17,7 +17,7 @@
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

View File

@ -17,7 +17,7 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#ifdef HAVE_GLIB
#if HAVE_GLIB
#include <glib.h>
#endif
@ -155,7 +155,7 @@ static void test_marshal(void) {
assert_se(bus_message_seal(m, 4711, 0) >= 0);
#ifdef HAVE_GLIB
#if HAVE_GLIB
{
GVariant *v;
char *t;
@ -184,7 +184,7 @@ static void test_marshal(void) {
assert_se(bus_message_get_blob(m, &blob, &sz) >= 0);
#ifdef HAVE_GLIB
#if HAVE_GLIB
{
GVariant *v;
char *t;

View File

@ -20,11 +20,11 @@
#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
@ -215,7 +215,7 @@ int main(int argc, char *argv[]) {
log_info("message size = %zu, contents =\n%s", sz, h);
free(h);
#ifdef HAVE_GLIB
#if HAVE_GLIB
{
GDBusMessage *g;
char *p;
@ -232,7 +232,7 @@ int main(int argc, char *argv[]) {
}
#endif
#ifdef HAVE_DBUS
#if HAVE_DBUS
{
DBusMessage *w;
DBusError error;

View File

@ -317,7 +317,7 @@ static const char hwdb_bin_paths[] =
"/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";

View File

@ -493,7 +493,7 @@ static int get_search(uint64_t type, char ***list) {
"/usr/local/bin",
"/usr/sbin",
"/usr/bin",
#ifdef HAVE_SPLIT_USR
#if HAVE_SPLIT_USR
"/sbin",
"/bin",
#endif
@ -507,7 +507,7 @@ static int get_search(uint64_t type, char ***list) {
false,
"/usr/local/lib",
"/usr/lib",
#ifdef HAVE_SPLIT_USR
#if HAVE_SPLIT_USR
"/lib",
#endif
NULL);
@ -519,7 +519,7 @@ static int get_search(uint64_t type, char ***list) {
"LD_LIBRARY_PATH",
true,
LIBDIR,
#ifdef HAVE_SPLIT_USR
#if HAVE_SPLIT_USR
ROOTLIBDIR,
#endif
NULL);

View File

@ -22,7 +22,7 @@
#include <string.h>
#include <unistd.h>
#ifdef HAVE_XKBCOMMON
#if HAVE_XKBCOMMON
#include <xkbcommon/xkbcommon.h>
#include <dlfcn.h>
#endif
@ -429,7 +429,7 @@ static int method_set_vc_keyboard(sd_bus_message *m, void *userdata, sd_bus_erro
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) {

View File

@ -6,7 +6,7 @@ systemd_localed_sources = files('''
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',
@ -27,7 +27,7 @@ endif
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)

View File

@ -24,7 +24,7 @@
#include "libudev.h"
#ifdef HAVE_ACL
#if HAVE_ACL
int devnode_acl(const char *path,
bool flush,

View File

@ -39,7 +39,7 @@ liblogind_core_sources = files('''
'''.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
@ -55,7 +55,7 @@ loginctl_sources = files('''
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',

View File

@ -21,7 +21,7 @@ libmachine_core = static_library(
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',

View File

@ -81,7 +81,7 @@ networkctl_sources = files('networkctl.c')
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',

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