diff options
Diffstat (limited to 'meta/recipes-core/systemd')
59 files changed, 2760 insertions, 2453 deletions
diff --git a/meta/recipes-core/systemd/systemd-boot-native_255.4.bb b/meta/recipes-core/systemd/systemd-boot-native_255.4.bb new file mode 100644 index 0000000000..73db59b14e --- /dev/null +++ b/meta/recipes-core/systemd/systemd-boot-native_255.4.bb @@ -0,0 +1,15 @@ +require systemd.inc + +inherit native + +deltask do_configure +deltask do_compile + +do_install () { + install -Dm 0755 ${S}/src/ukify/ukify.py ${D}${bindir}/ukify +} +addtask install after do_unpack + +PACKAGES = "${PN}" + +FILES:${PN} = "${bindir}/ukify" diff --git a/meta/recipes-core/systemd/systemd-boot_246.6.bb b/meta/recipes-core/systemd/systemd-boot_255.4.bb index f92c639810..4ee25ee72f 100644 --- a/meta/recipes-core/systemd/systemd-boot_246.6.bb +++ b/meta/recipes-core/systemd/systemd-boot_255.4.bb @@ -3,29 +3,31 @@ FILESEXTRAPATHS =. "${FILE_DIRNAME}/systemd:" require conf/image-uefi.conf -DEPENDS = "intltool-native libcap util-linux gnu-efi gperf-native" +DEPENDS = "intltool-native libcap util-linux gperf-native python3-jinja2-native python3-pyelftools-native" inherit meson pkgconfig gettext inherit deploy -LDFLAGS_prepend = "${@ " ".join(d.getVar('LD').split()[1:])} " +LDFLAGS:prepend = "${@ " ".join(d.getVar('LD').split()[1:])} " -do_write_config[vardeps] += "CC OBJCOPY" -do_write_config_append() { +EFI_LD = "bfd" +LDFLAGS:append = " -fuse-ld=${EFI_LD}" + +do_write_config[vardeps] += "EFI_LD" +do_write_config:append() { cat >${WORKDIR}/meson-${PN}.cross <<EOF [binaries] -efi_cc = ${@meson_array('CC', d)} -objcopy = ${@meson_array('OBJCOPY', d)} +c_ld = ${@meson_array('EFI_LD', d)} EOF } +MESON_CROSS_FILE:append = " --cross-file ${WORKDIR}/meson-${PN}.cross" + +MESON_TARGET = "systemd-boot" + EXTRA_OEMESON += "-Defi=true \ - -Dgnu-efi=true \ - -Defi-includedir=${STAGING_INCDIR}/efi \ - -Defi-libdir=${STAGING_LIBDIR} \ - -Defi-ld=${@ d.getVar('LD').split()[0]} \ + -Dbootloader=true \ -Dman=false \ - --cross-file ${WORKDIR}/meson-${PN}.cross \ " # install to the image as boot*.efi if its the EFI_PROVIDER, @@ -41,23 +43,14 @@ python __anonymous () { d.setVar("SYSTEMD_BOOT_IMAGE_PREFIX", prefix) } -FILES_${PN} = "${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE}" +FILES:${PN} = "${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE}" -RDEPENDS_${PN} += "virtual/systemd-bootconf" +RDEPENDS:${PN} += "virtual-systemd-bootconf" -# Imported from the old gummiboot recipe -TUNE_CCARGS_remove = "-mfpmath=sse" -COMPATIBLE_HOST = "(x86_64.*|i.86.*)-linux" -COMPATIBLE_HOST_x86-x32 = "null" +CFLAGS:append:libc-musl = " -D__DEFINED_wchar_t" -do_compile() { - SYSTEMD_BOOT_EFI_ARCH="ia32" - if [ "${TARGET_ARCH}" = "x86_64" ]; then - SYSTEMD_BOOT_EFI_ARCH="x64" - fi - - ninja src/boot/efi/${SYSTEMD_BOOT_IMAGE_PREFIX}${SYSTEMD_BOOT_IMAGE} -} +COMPATIBLE_HOST = "(aarch64.*|arm.*|x86_64.*|i.86.*)-linux" +COMPATIBLE_HOST:x86-x32 = "null" do_install() { install -d ${D}${EFI_FILES_PATH} @@ -66,5 +59,9 @@ do_install() { do_deploy () { install ${B}/src/boot/efi/systemd-boot*.efi ${DEPLOYDIR} + install ${B}/src/boot/efi/linux*.efi.stub ${DEPLOYDIR} + install ${B}/src/boot/efi/addon*.efi.stub ${DEPLOYDIR} } + addtask deploy before do_build after do_compile + diff --git a/meta/recipes-core/systemd/systemd-bootconf_1.00.bb b/meta/recipes-core/systemd/systemd-bootconf_1.00.bb index d13b8c518f..19637546a9 100644 --- a/meta/recipes-core/systemd/systemd-bootconf_1.00.bb +++ b/meta/recipes-core/systemd/systemd-bootconf_1.00.bb @@ -2,7 +2,7 @@ LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" SUMMARY = "Basic systemd-boot configuration files" -RPROVIDES_${PN} += "virtual/systemd-bootconf" +RPROVIDES:${PN} += "virtual-systemd-bootconf" PACKAGE_ARCH = "${MACHINE_ARCH}" inherit systemd-boot-cfg @@ -12,7 +12,7 @@ S = "${WORKDIR}" LABELS = "boot" ROOT ?= "root=/dev/sda2" -APPEND_append = " ${ROOT}" +APPEND:append = " ${ROOT}" python do_configure() { bb.build.exec_func('build_efi_cfg', d) @@ -29,4 +29,4 @@ do_install() { install *.conf ${D}/boot/loader/entries/ } -FILES_${PN} = "/boot/loader/* /boot/loader/entries/*" +FILES:${PN} = "/boot/loader/* /boot/loader/entries/*" diff --git a/meta/recipes-core/systemd/systemd-compat-units.bb b/meta/recipes-core/systemd/systemd-compat-units.bb index 361dc1cbb4..c03d97f9c9 100644 --- a/meta/recipes-core/systemd/systemd-compat-units.bb +++ b/meta/recipes-core/systemd/systemd-compat-units.bb @@ -2,7 +2,6 @@ SUMMARY = "Enhances systemd compatilibity with existing SysVinit scripts" HOMEPAGE = "http://www.freedesktop.org/wiki/Software/systemd" LICENSE = "MIT" -PR = "r29" PACKAGE_WRITE_DEPS += "systemd-systemctl-native" @@ -12,9 +11,10 @@ inherit features_check INHIBIT_DEFAULT_DEPS = "1" -ALLOW_EMPTY_${PN} = "1" +ALLOW_EMPTY:${PN} = "1" -REQUIRED_DISTRO_FEATURES = "systemd" +REQUIRED_DISTRO_FEATURES += "systemd" +REQUIRED_DISTRO_FEATURES += "usrmerge" SYSTEMD_DISABLED_SYSV_SERVICES = " \ busybox-udhcpc \ @@ -25,9 +25,10 @@ SYSTEMD_DISABLED_SYSV_SERVICES = " \ syslog.busybox \ " -pkg_postinst_${PN} () { +pkg_postinst:${PN} () { - cd $D${sysconfdir}/init.d || exit 0 + test -d $D${sysconfdir}/init.d || exit 0 + cd $D${sysconfdir}/init.d echo "Disabling the following sysv scripts: " @@ -38,7 +39,7 @@ pkg_postinst_${PN} () { fi for i in ${SYSTEMD_DISABLED_SYSV_SERVICES} ; do - if [ -e $i -o -e $i.sh ] && ! [ -e $D${sysconfdir}/systemd/system/$i.service -o -e $D${systemd_unitdir}/system/$i.service ] ; then + if [ -e $i -o -e $i.sh ] && ! [ -e $D${sysconfdir}/systemd/system/$i.service -o -e $D${systemd_system_unitdir}/$i.service ] ; then echo -n "$i: " systemctl $OPTS mask $i.service fi @@ -46,4 +47,4 @@ pkg_postinst_${PN} () { echo } -RDEPENDS_${PN} = "systemd" +RDEPENDS:${PN} = "systemd" diff --git a/meta/recipes-core/systemd/systemd-conf/wired.network b/meta/recipes-core/systemd/systemd-conf/wired.network index dcf3534596..7406287248 100644 --- a/meta/recipes-core/systemd/systemd-conf/wired.network +++ b/meta/recipes-core/systemd/systemd-conf/wired.network @@ -1,6 +1,8 @@ [Match] -Name=en* eth* +Type=ether +Name=!veth* KernelCommandLine=!nfsroot +KernelCommandLine=!ip [Network] DHCP=yes diff --git a/meta/recipes-core/systemd/systemd-conf_246.1.bb b/meta/recipes-core/systemd/systemd-conf_1.0.bb index d9ec023bfd..2355936631 100644 --- a/meta/recipes-core/systemd/systemd-conf_246.1.bb +++ b/meta/recipes-core/systemd/systemd-conf_1.0.bb @@ -5,6 +5,14 @@ DefaultTimeoutStartSec setting." LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" +inherit features_check +REQUIRED_DISTRO_FEATURES += "usrmerge" + +PE = "1" + +PACKAGECONFIG ??= "dhcp-ethernet" +PACKAGECONFIG[dhcp-ethernet] = "" + SRC_URI = "\ file://journald.conf \ file://logind.conf \ @@ -17,20 +25,20 @@ do_install() { install -D -m0644 ${WORKDIR}/journald.conf ${D}${systemd_unitdir}/journald.conf.d/00-${PN}.conf install -D -m0644 ${WORKDIR}/logind.conf ${D}${systemd_unitdir}/logind.conf.d/00-${PN}.conf install -D -m0644 ${WORKDIR}/system.conf ${D}${systemd_unitdir}/system.conf.d/00-${PN}.conf - install -D -m0644 ${WORKDIR}/wired.network ${D}${systemd_unitdir}/network/80-wired.network + + if ${@bb.utils.contains('PACKAGECONFIG', 'dhcp-ethernet', 'true', 'false', d)}; then + install -D -m0644 ${WORKDIR}/wired.network ${D}${systemd_unitdir}/network/80-wired.network + fi } # Based on change from YP bug 8141, OE commit 5196d7bacaef1076c361adaa2867be31759c1b52 -do_install_append_qemuall() { +do_install:append:qemuall() { install -D -m0644 ${WORKDIR}/system.conf-qemuall ${D}${systemd_unitdir}/system.conf.d/01-${PN}.conf - - # Do not install wired.network for qemu bsps - rm -rf ${D}${systemd_unitdir}/network } PACKAGE_ARCH = "${MACHINE_ARCH}" -FILES_${PN} = "\ +FILES:${PN} = "\ ${systemd_unitdir}/journald.conf.d/ \ ${systemd_unitdir}/logind.conf.d/ \ ${systemd_unitdir}/system.conf.d/ \ diff --git a/meta/recipes-core/systemd/systemd-machine-units_1.0.bb b/meta/recipes-core/systemd/systemd-machine-units_1.0.bb index 02756f43d7..8df7ff7cf1 100644 --- a/meta/recipes-core/systemd/systemd-machine-units_1.0.bb +++ b/meta/recipes-core/systemd/systemd-machine-units_1.0.bb @@ -5,9 +5,9 @@ LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda PACKAGE_ARCH = "${MACHINE_ARCH}" -PR = "r19" -inherit systemd -SYSTEMD_SERVICE_${PN} = "" +inherit systemd features_check +REQUIRED_DISTRO_FEATURES += "usrmerge" +SYSTEMD_SERVICE:${PN} = "" -ALLOW_EMPTY_${PN} = "1" +ALLOW_EMPTY:${PN} = "1" diff --git a/meta/recipes-core/systemd/systemd-serialgetty.bb b/meta/recipes-core/systemd/systemd-serialgetty.bb index d142b30f7e..44a93ac684 100644 --- a/meta/recipes-core/systemd/systemd-serialgetty.bb +++ b/meta/recipes-core/systemd/systemd-serialgetty.bb @@ -1,9 +1,8 @@ SUMMARY = "Serial terminal support for systemd" HOMEPAGE = "https://www.freedesktop.org/wiki/Software/systemd/" -LICENSE = "GPLv2+" -LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" +LICENSE = "GPL-2.0-or-later" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6" -PR = "r5" SERIAL_CONSOLES ?= "115200;ttyS0" SERIAL_TERM ?= "linux" @@ -14,16 +13,17 @@ S = "${WORKDIR}" # As this package is tied to systemd, only build it when we're also building systemd. inherit features_check -REQUIRED_DISTRO_FEATURES = "systemd" +REQUIRED_DISTRO_FEATURES += "systemd" +REQUIRED_DISTRO_FEATURES += "usrmerge" do_install() { if [ ! -z "${SERIAL_CONSOLES}" ] ; then default_baudrate=`echo "${SERIAL_CONSOLES}" | sed 's/\;.*//'` - install -d ${D}${systemd_unitdir}/system/ + install -d ${D}${systemd_system_unitdir}/ install -d ${D}${sysconfdir}/systemd/system/getty.target.wants/ - install -m 0644 ${WORKDIR}/serial-getty@.service ${D}${systemd_unitdir}/system/ - sed -i -e "s/\@BAUDRATE\@/$default_baudrate/g" ${D}${systemd_unitdir}/system/serial-getty@.service - sed -i -e "s/\@TERM\@/${SERIAL_TERM}/g" ${D}${systemd_unitdir}/system/serial-getty@.service + install -m 0644 ${WORKDIR}/serial-getty@.service ${D}${systemd_system_unitdir}/ + sed -i -e "s/\@BAUDRATE\@/$default_baudrate/g" ${D}${systemd_system_unitdir}/serial-getty@.service + sed -i -e "s/\@TERM\@/${SERIAL_TERM}/g" ${D}${systemd_system_unitdir}/serial-getty@.service tmp="${SERIAL_CONSOLES}" for entry in $tmp ; do @@ -31,14 +31,14 @@ do_install() { ttydev=`echo $entry | sed -e 's/^[0-9]*\;//' -e 's/\;.*//'` if [ "$baudrate" = "$default_baudrate" ] ; then # enable the service - ln -sf ${systemd_unitdir}/system/serial-getty@.service \ + ln -sf ${systemd_system_unitdir}/serial-getty@.service \ ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty@$ttydev.service else # install custom service file for the non-default baudrate - install -m 0644 ${WORKDIR}/serial-getty@.service ${D}${systemd_unitdir}/system/serial-getty$baudrate@.service - sed -i -e "s/\@BAUDRATE\@/$baudrate/g" ${D}${systemd_unitdir}/system/serial-getty$baudrate@.service + install -m 0644 ${WORKDIR}/serial-getty@.service ${D}${systemd_system_unitdir}/serial-getty$baudrate@.service + sed -i -e "s/\@BAUDRATE\@/$baudrate/g" ${D}${systemd_system_unitdir}/serial-getty$baudrate@.service # enable the service - ln -sf ${systemd_unitdir}/system/serial-getty$baudrate@.service \ + ln -sf ${systemd_system_unitdir}/serial-getty$baudrate@.service \ ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty$baudrate@$ttydev.service fi done @@ -46,7 +46,7 @@ do_install() { } # This is a machine specific file -FILES_${PN} = "${systemd_unitdir}/system/*.service ${sysconfdir}" +FILES:${PN} = "${systemd_system_unitdir}/*.service ${sysconfdir}" PACKAGE_ARCH = "${MACHINE_ARCH}" -ALLOW_EMPTY_${PN} = "1" +ALLOW_EMPTY:${PN} = "1" diff --git a/meta/recipes-core/systemd/systemd-systemctl-native.bb b/meta/recipes-core/systemd/systemd-systemctl-native.bb index fadc8433d8..54283bcba1 100644 --- a/meta/recipes-core/systemd/systemd-systemctl-native.bb +++ b/meta/recipes-core/systemd/systemd-systemctl-native.bb @@ -3,7 +3,6 @@ SUMMARY = "Wrapper for enabling systemd services" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" -PR = "r6" inherit native diff --git a/meta/recipes-core/systemd/systemd-systemctl/systemctl b/meta/recipes-core/systemd/systemd-systemctl/systemctl index 990de1ab39..2229bc7b6d 100755 --- a/meta/recipes-core/systemd/systemd-systemctl/systemctl +++ b/meta/recipes-core/systemd/systemd-systemctl/systemctl @@ -11,6 +11,7 @@ import re import sys from collections import namedtuple +from itertools import chain from pathlib import Path version = 1.0 @@ -25,12 +26,19 @@ locations = list() class SystemdFile(): """Class representing a single systemd configuration file""" - def __init__(self, root, path): + + _clearable_keys = ['WantedBy'] + + def __init__(self, root, path, instance_unit_name): self.sections = dict() self._parse(root, path) dirname = os.path.basename(path.name) + ".d" for location in locations: - for path2 in sorted((root / location / "system" / dirname).glob("*.conf")): + files = (root / location / "system" / dirname).glob("*.conf") + if instance_unit_name: + inst_dirname = instance_unit_name + ".d" + files = chain(files, (root / location / "system" / inst_dirname).glob("*.conf")) + for path2 in sorted(files): self._parse(root, path2) def _parse(self, root, path): @@ -75,6 +83,14 @@ class SystemdFile(): v = m.group('value') if k not in section: section[k] = list() + + # If we come across a "key=" line for a "clearable key", then + # forget all preceding assignments. This works because we are + # processing files in correct parse order. + if k in self._clearable_keys and not v: + del section[k] + continue + section[k].extend(v.split()) def get(self, section, prop): @@ -160,7 +176,9 @@ def add_link(path, target): class SystemdUnitNotFoundError(Exception): - pass + def __init__(self, path, unit): + self.path = path + self.unit = unit class SystemdUnit(): @@ -177,24 +195,29 @@ class SystemdUnit(): raise SystemdUnitNotFoundError(self.root, unit) - def _process_deps(self, config, service, location, prop, dirstem): + def _process_deps(self, config, service, location, prop, dirstem, instance): systemdir = self.root / SYSCONFDIR / "systemd" / "system" target = ROOT / location.relative_to(self.root) try: for dependent in config.get('Install', prop): + # expand any %i to instance (ignoring escape sequence %%) + dependent = re.sub("([^%](%%)*)%i", "\\g<1>{}".format(instance), dependent) wants = systemdir / "{}.{}".format(dependent, dirstem) / service add_link(wants, target) except KeyError: pass - def enable(self): + def enable(self, units_enabled=[]): # if we're enabling an instance, first extract the actual instance # then figure out what the template unit is template = re.match(r"[^@]+@(?P<instance>[^\.]*)\.", self.unit) + instance_unit_name = None if template: instance = template.group('instance') + if instance != "": + instance_unit_name = self.unit unit = re.sub(r"@[^\.]*\.", "@.", self.unit, 1) else: instance = None @@ -206,7 +229,7 @@ class SystemdUnit(): # ignore aliases return - config = SystemdFile(self.root, path) + config = SystemdFile(self.root, path, instance_unit_name) if instance == "": try: default_instance = config.get('Install', 'DefaultInstance')[0] @@ -219,12 +242,17 @@ class SystemdUnit(): else: service = self.unit - self._process_deps(config, service, path, 'WantedBy', 'wants') - self._process_deps(config, service, path, 'RequiredBy', 'requires') + self._process_deps(config, service, path, 'WantedBy', 'wants', instance) + self._process_deps(config, service, path, 'RequiredBy', 'requires', instance) try: for also in config.get('Install', 'Also'): - SystemdUnit(self.root, also).enable() + try: + units_enabled.append(unit) + if also not in units_enabled: + SystemdUnit(self.root, also).enable(units_enabled) + except SystemdUnitNotFoundError as e: + sys.exit("Error: Systemctl also enable issue with %s (%s)" % (service, e.unit)) except KeyError: pass @@ -265,7 +293,10 @@ def preset_all(root): state = presets.state(service) if state == "enable" or state is None: - SystemdUnit(root, service).enable() + try: + SystemdUnit(root, service).enable() + except SystemdUnitNotFoundError: + sys.exit("Error: Systemctl preset_all issue in %s" % service) # If we populate the systemd links we also create /etc/machine-id, which # allows systemd to boot with the filesystem read-only before generating @@ -282,7 +313,7 @@ def main(): sys.exit("Python 3.4 or greater is required") parser = argparse.ArgumentParser() - parser.add_argument('command', nargs=1, choices=['enable', 'mask', + parser.add_argument('command', nargs='?', choices=['enable', 'mask', 'preset-all']) parser.add_argument('service', nargs=argparse.REMAINDER) parser.add_argument('--root') @@ -300,13 +331,23 @@ def main(): locations.append(BASE_LIBDIR / "systemd") locations.append(LIBDIR / "systemd") - command = args.command[0] + command = args.command + if not command: + parser.print_help() + return 0 + if command == "mask": for service in args.service: - SystemdUnit(root, service).mask() + try: + SystemdUnit(root, service).mask() + except SystemdUnitNotFoundError as e: + sys.exit("Error: Systemctl main mask issue in %s (%s)" % (service, e.unit)) elif command == "enable": for service in args.service: - SystemdUnit(root, service).enable() + try: + SystemdUnit(root, service).enable() + except SystemdUnitNotFoundError as e: + sys.exit("Error: Systemctl main enable issue in %s (%s)" % (service, e.unit)) elif command == "preset-all": if len(args.service) != 0: sys.exit("Too many arguments.") diff --git a/meta/recipes-core/systemd/systemd.inc b/meta/recipes-core/systemd/systemd.inc index 1733565fc0..a35db5091e 100644 --- a/meta/recipes-core/systemd/systemd.inc +++ b/meta/recipes-core/systemd/systemd.inc @@ -10,12 +10,13 @@ state, maintains mount and automount points and implements an \ elaborate transactional dependency-based service control logic. It can \ work as a drop-in replacement for sysvinit." -LICENSE = "GPLv2 & LGPLv2.1" +LICENSE = "GPL-2.0-only & LGPL-2.1-or-later" +LICENSE:libsystemd = "LGPL-2.1-or-later" LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \ file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c" -SRCREV = "2ee1c57c4ff4fd3349cf03c2e89fbd18ca0b3a4a" -SRCBRANCH = "v246-stable" -SRC_URI = "git://github.com/systemd/systemd-stable.git;protocol=git;branch=${SRCBRANCH}" +SRCREV = "387a14a7b67b8b76adaed4175e14bb7e39b2f738" +SRCBRANCH = "v255-stable" +SRC_URI = "git://github.com/systemd/systemd-stable.git;protocol=https;branch=${SRCBRANCH}" S = "${WORKDIR}/git" diff --git a/meta/recipes-core/systemd/systemd/00-create-volatile.conf b/meta/recipes-core/systemd/systemd/00-create-volatile.conf index 87cbe1e7d3..c4277221a2 100644 --- a/meta/recipes-core/systemd/systemd/00-create-volatile.conf +++ b/meta/recipes-core/systemd/systemd/00-create-volatile.conf @@ -3,5 +3,6 @@ # inside /var/log. +d /run/lock 1777 - - - d /var/volatile/log - - - - d /var/volatile/tmp 1777 - - diff --git a/meta/recipes-core/systemd/systemd/00-hostnamed-network-user.conf b/meta/recipes-core/systemd/systemd/00-hostnamed-network-user.conf new file mode 100644 index 0000000000..6b224ba9b9 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/00-hostnamed-network-user.conf @@ -0,0 +1,6 @@ +[Service] +# By running with these options instead of root, networkd is allowed to request +# a hostname change via DBUS when policykit is not present +User=systemd-network +Group=systemd-hostname +AmbientCapabilities=CAP_SYS_ADMIN diff --git a/meta/recipes-core/systemd/systemd/0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch b/meta/recipes-core/systemd/systemd/0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch deleted file mode 100644 index 2676c144f2..0000000000 --- a/meta/recipes-core/systemd/systemd/0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch +++ /dev/null @@ -1,81 +0,0 @@ -From 564830719be2017c4953589d50f21a9e856a4ecc Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Thu, 21 Feb 2019 16:23:24 +0800 -Subject: [PATCH] binfmt: Don't install dependency links at install time for - the binfmt services - -use [Install] blocks so that they get created when the service is enabled -like a traditional service. - -The [Install] blocks were rejected upstream as they don't have a way to -"enable" it on install without static symlinks which can't be disabled, -only masked. We however can do that in a postinst. - -Upstream-Status: Denied - -Signed-off-by: Ross Burton <ross.burton@intel.com> -Signed-off-by: Khem Raj <raj.khem@gmail.com> -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> -[rebased for systemd 243] -Signed-off-by: Scott Murray <scott.murray@konsulko.com> - ---- - units/meson.build | 6 ++---- - units/proc-sys-fs-binfmt_misc.automount | 3 +++ - units/systemd-binfmt.service.in | 4 ++++ - 3 files changed, 9 insertions(+), 4 deletions(-) - -Index: systemd-stable/units/meson.build -=================================================================== ---- systemd-stable.orig/units/meson.build -+++ systemd-stable/units/meson.build -@@ -54,8 +54,7 @@ units = [ - ['poweroff.target', '', - (with_runlevels ? 'runlevel0.target' : '')], - ['printer.target', ''], -- ['proc-sys-fs-binfmt_misc.automount', 'ENABLE_BINFMT', -- 'sysinit.target.wants/'], -+ ['proc-sys-fs-binfmt_misc.automount', 'ENABLE_BINFMT'], - ['proc-sys-fs-binfmt_misc.mount', 'ENABLE_BINFMT'], - ['reboot.target', '', - (with_runlevels ? 'runlevel6.target ctrl-alt-del.target' : 'ctrl-alt-del.target')], -@@ -162,8 +161,7 @@ in_units = [ - ['rc-local.service', 'HAVE_SYSV_COMPAT'], - ['rescue.service', ''], - ['systemd-backlight@.service', 'ENABLE_BACKLIGHT'], -- ['systemd-binfmt.service', 'ENABLE_BINFMT', -- 'sysinit.target.wants/'], -+ ['systemd-binfmt.service', 'ENABLE_BINFMT'], - ['systemd-bless-boot.service', 'ENABLE_EFI HAVE_BLKID'], - ['systemd-boot-check-no-failures.service', ''], - ['systemd-coredump@.service', 'ENABLE_COREDUMP'], -Index: systemd-stable/units/proc-sys-fs-binfmt_misc.automount -=================================================================== ---- systemd-stable.orig/units/proc-sys-fs-binfmt_misc.automount -+++ systemd-stable/units/proc-sys-fs-binfmt_misc.automount -@@ -18,3 +18,6 @@ ConditionPathIsReadWrite=/proc/sys/ - - [Automount] - Where=/proc/sys/fs/binfmt_misc -+ -+[Install] -+WantedBy=sysinit.target -Index: systemd-stable/units/systemd-binfmt.service.in -=================================================================== ---- systemd-stable.orig/units/systemd-binfmt.service.in -+++ systemd-stable/units/systemd-binfmt.service.in -@@ -14,6 +14,7 @@ Documentation=https://www.kernel.org/doc - Documentation=https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems - DefaultDependencies=no - Conflicts=shutdown.target -+Wants=proc-sys-fs-binfmt_misc.automount - After=proc-sys-fs-binfmt_misc.automount - After=proc-sys-fs-binfmt_misc.mount - Before=sysinit.target shutdown.target -@@ -30,3 +31,6 @@ RemainAfterExit=yes - ExecStart=@rootlibexecdir@/systemd-binfmt - ExecStop=@rootlibexecdir@/systemd-binfmt --unregister - TimeoutSec=90s -+ -+[Install] -+WantedBy=sysinit.target diff --git a/meta/recipes-core/systemd/systemd/0001-do-not-disable-buffer-in-writing-files.patch b/meta/recipes-core/systemd/systemd/0001-do-not-disable-buffer-in-writing-files.patch deleted file mode 100644 index 39a975319b..0000000000 --- a/meta/recipes-core/systemd/systemd/0001-do-not-disable-buffer-in-writing-files.patch +++ /dev/null @@ -1,411 +0,0 @@ -From f92fd7e77ed5aab2dda01a20e6891c37f09415d3 Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Fri, 1 Mar 2019 15:22:15 +0800 -Subject: [PATCH] do not disable buffer in writing files - -Do not disable buffer in writing files, otherwise we get -failure at boot for musl like below. - - [!!!!!!] Failed to allocate manager object. - -And there will be other failures, critical or not critical. -This is specific to musl. - -Upstream-Status: Inappropriate [musl] - -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> -[Rebased for v242] -Signed-off-by: Andrej Valek <andrej.valek@siemens.com> -[rebased for systemd 243] -Signed-off-by: Scott Murray <scott.murray@konsulko.com> - ---- - src/basic/cgroup-util.c | 10 +++++----- - src/basic/procfs-util.c | 4 ++-- - src/basic/smack-util.c | 2 +- - src/basic/util.c | 2 +- - src/binfmt/binfmt.c | 6 +++--- - src/core/main.c | 4 ++-- - src/core/smack-setup.c | 8 ++++---- - src/hibernate-resume/hibernate-resume.c | 2 +- - src/libsystemd/sd-device/sd-device.c | 2 +- - src/login/logind-dbus.c | 2 +- - src/nspawn/nspawn-cgroup.c | 2 +- - src/nspawn/nspawn.c | 6 +++--- - src/shared/cgroup-setup.c | 4 ++-- - src/shared/sysctl-util.c | 2 +- - src/sleep/sleep.c | 8 ++++---- - src/udev/udevadm-trigger.c | 2 +- - src/udev/udevd.c | 2 +- - src/vconsole/vconsole-setup.c | 2 +- - 18 files changed, 35 insertions(+), 35 deletions(-) - -Index: systemd-stable/src/basic/cgroup-util.c -=================================================================== ---- systemd-stable.orig/src/basic/cgroup-util.c -+++ systemd-stable/src/basic/cgroup-util.c -@@ -769,7 +769,7 @@ int cg_install_release_agent(const char - - sc = strstrip(contents); - if (isempty(sc)) { -- r = write_string_file(fs, agent, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file(fs, agent, 0); - if (r < 0) - return r; - } else if (!path_equal(sc, agent)) -@@ -787,7 +787,7 @@ int cg_install_release_agent(const char - - sc = strstrip(contents); - if (streq(sc, "0")) { -- r = write_string_file(fs, "1", WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file(fs, "1", 0); - if (r < 0) - return r; - -@@ -814,7 +814,7 @@ int cg_uninstall_release_agent(const cha - if (r < 0) - return r; - -- r = write_string_file(fs, "0", WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file(fs, "0", 0); - if (r < 0) - return r; - -@@ -824,7 +824,7 @@ int cg_uninstall_release_agent(const cha - if (r < 0) - return r; - -- r = write_string_file(fs, "", WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file(fs, "", 0); - if (r < 0) - return r; - -@@ -1656,7 +1656,7 @@ int cg_set_attribute(const char *control - if (r < 0) - return r; - -- return write_string_file(p, value, WRITE_STRING_FILE_DISABLE_BUFFER); -+ return write_string_file(p, value, 0); - } - - int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret) { -Index: systemd-stable/src/basic/procfs-util.c -=================================================================== ---- systemd-stable.orig/src/basic/procfs-util.c -+++ systemd-stable/src/basic/procfs-util.c -@@ -86,13 +86,13 @@ int procfs_tasks_set_limit(uint64_t limi - * decrease it, as threads-max is the much more relevant sysctl. */ - if (limit > pid_max-1) { - sprintf(buffer, "%" PRIu64, limit+1); /* Add one, since PID 0 is not a valid PID */ -- r = write_string_file("/proc/sys/kernel/pid_max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file("/proc/sys/kernel/pid_max", buffer, 0); - if (r < 0) - return r; - } - - sprintf(buffer, "%" PRIu64, limit); -- r = write_string_file("/proc/sys/kernel/threads-max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file("/proc/sys/kernel/threads-max", buffer, 0); - if (r < 0) { - uint64_t threads_max; - -Index: systemd-stable/src/basic/smack-util.c -=================================================================== ---- systemd-stable.orig/src/basic/smack-util.c -+++ systemd-stable/src/basic/smack-util.c -@@ -114,7 +114,7 @@ int mac_smack_apply_pid(pid_t pid, const - return 0; - - p = procfs_file_alloca(pid, "attr/current"); -- r = write_string_file(p, label, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file(p, label, 0); - if (r < 0) - return r; - -Index: systemd-stable/src/basic/util.c -=================================================================== ---- systemd-stable.orig/src/basic/util.c -+++ systemd-stable/src/basic/util.c -@@ -267,7 +267,7 @@ void disable_coredumps(void) { - if (detect_container() > 0) - return; - -- r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", 0); - if (r < 0) - log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m"); - } -Index: systemd-stable/src/binfmt/binfmt.c -=================================================================== ---- systemd-stable.orig/src/binfmt/binfmt.c -+++ systemd-stable/src/binfmt/binfmt.c -@@ -48,7 +48,7 @@ static int delete_rule(const char *rule) - if (!fn) - return log_oom(); - -- return write_string_file(fn, "-1", WRITE_STRING_FILE_DISABLE_BUFFER); -+ return write_string_file(fn, "-1", 0); - } - - static int apply_rule(const char *rule) { -@@ -56,7 +56,7 @@ static int apply_rule(const char *rule) - - (void) delete_rule(rule); - -- r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, 0); - if (r < 0) - return log_error_errno(r, "Failed to add binary format: %m"); - -@@ -223,7 +223,7 @@ static int run(int argc, char *argv[]) { - } - - /* Flush out all rules */ -- (void) write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER); -+ (void) write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0); - - STRV_FOREACH(f, files) { - k = apply_file(*f, true); -Index: systemd-stable/src/core/main.c -=================================================================== ---- systemd-stable.orig/src/core/main.c -+++ systemd-stable/src/core/main.c -@@ -1382,7 +1382,7 @@ static int bump_unix_max_dgram_qlen(void - if (v >= DEFAULT_UNIX_MAX_DGRAM_QLEN) - return 0; - -- r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", WRITE_STRING_FILE_DISABLE_BUFFER, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN); -+ r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", 0, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN); - if (r < 0) - return log_full_errno(IN_SET(r, -EROFS, -EPERM, -EACCES) ? LOG_DEBUG : LOG_WARNING, r, - "Failed to bump AF_UNIX datagram queue length, ignoring: %m"); -@@ -1668,7 +1668,7 @@ static void initialize_core_pattern(bool - if (getpid_cached() != 1) - return; - -- r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, 0); - if (r < 0) - log_warning_errno(r, "Failed to write '%s' to /proc/sys/kernel/core_pattern, ignoring: %m", arg_early_core_pattern); - } -Index: systemd-stable/src/core/smack-setup.c -=================================================================== ---- systemd-stable.orig/src/core/smack-setup.c -+++ systemd-stable/src/core/smack-setup.c -@@ -325,17 +325,17 @@ int mac_smack_setup(bool *loaded_policy) - } - - #ifdef SMACK_RUN_LABEL -- r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, 0); - if (r < 0) - log_warning_errno(r, "Failed to set SMACK label \"" SMACK_RUN_LABEL "\" on self: %m"); -- r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, 0); - if (r < 0) - log_warning_errno(r, "Failed to set SMACK ambient label \"" SMACK_RUN_LABEL "\": %m"); - r = write_string_file("/sys/fs/smackfs/netlabel", -- "0.0.0.0/0 " SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); -+ "0.0.0.0/0 " SMACK_RUN_LABEL, 0); - if (r < 0) - log_warning_errno(r, "Failed to set SMACK netlabel rule \"0.0.0.0/0 " SMACK_RUN_LABEL "\": %m"); -- r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", 0); - if (r < 0) - log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m"); - #endif -Index: systemd-stable/src/hibernate-resume/hibernate-resume.c -=================================================================== ---- systemd-stable.orig/src/hibernate-resume/hibernate-resume.c -+++ systemd-stable/src/hibernate-resume/hibernate-resume.c -@@ -45,7 +45,7 @@ int main(int argc, char *argv[]) { - return EXIT_FAILURE; - } - -- r = write_string_file("/sys/power/resume", major_minor, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file("/sys/power/resume", major_minor, 0); - if (r < 0) { - log_error_errno(r, "Failed to write '%s' to /sys/power/resume: %m", major_minor); - return EXIT_FAILURE; -Index: systemd-stable/src/libsystemd/sd-device/sd-device.c -=================================================================== ---- systemd-stable.orig/src/libsystemd/sd-device/sd-device.c -+++ systemd-stable/src/libsystemd/sd-device/sd-device.c -@@ -1877,7 +1877,7 @@ _public_ int sd_device_set_sysattr_value - if (!value) - return -ENOMEM; - -- r = write_string_file(path, value, WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_NOFOLLOW); -+ r = write_string_file(path, value, 0 | WRITE_STRING_FILE_NOFOLLOW); - if (r < 0) { - if (r == -ELOOP) - return -EINVAL; -Index: systemd-stable/src/login/logind-dbus.c -=================================================================== ---- systemd-stable.orig/src/login/logind-dbus.c -+++ systemd-stable/src/login/logind-dbus.c -@@ -1341,7 +1341,7 @@ static int trigger_device(Manager *m, sd - if (!t) - return -ENOMEM; - -- (void) write_string_file(t, "change", WRITE_STRING_FILE_DISABLE_BUFFER); -+ (void) write_string_file(t, "change", 0); - } - - return 0; -Index: systemd-stable/src/nspawn/nspawn-cgroup.c -=================================================================== ---- systemd-stable.orig/src/nspawn/nspawn-cgroup.c -+++ systemd-stable/src/nspawn/nspawn-cgroup.c -@@ -124,7 +124,7 @@ int sync_cgroup(pid_t pid, CGroupUnified - fn = strjoina(tree, cgroup, "/cgroup.procs"); - - sprintf(pid_string, PID_FMT, pid); -- r = write_string_file(fn, pid_string, WRITE_STRING_FILE_DISABLE_BUFFER|WRITE_STRING_FILE_MKDIR_0755); -+ r = write_string_file(fn, pid_string, WRITE_STRING_FILE_MKDIR_0755); - if (r < 0) { - log_error_errno(r, "Failed to move process: %m"); - goto finish; -Index: systemd-stable/src/nspawn/nspawn.c -=================================================================== ---- systemd-stable.orig/src/nspawn/nspawn.c -+++ systemd-stable/src/nspawn/nspawn.c -@@ -2493,7 +2493,7 @@ static int reset_audit_loginuid(void) { - if (streq(p, "4294967295")) - return 0; - -- r = write_string_file("/proc/self/loginuid", "4294967295", WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file("/proc/self/loginuid", "4294967295", 0); - if (r < 0) { - log_error_errno(r, - "Failed to reset audit login UID. This probably means that your kernel is too\n" -@@ -3726,13 +3726,13 @@ static int setup_uid_map(pid_t pid) { - - xsprintf(uid_map, "/proc/" PID_FMT "/uid_map", pid); - xsprintf(line, UID_FMT " " UID_FMT " " UID_FMT "\n", 0, arg_uid_shift, arg_uid_range); -- r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file(uid_map, line, 0); - if (r < 0) - return log_error_errno(r, "Failed to write UID map: %m"); - - /* We always assign the same UID and GID ranges */ - xsprintf(uid_map, "/proc/" PID_FMT "/gid_map", pid); -- r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file(uid_map, line, 0); - if (r < 0) - return log_error_errno(r, "Failed to write GID map: %m"); - -Index: systemd-stable/src/shared/cgroup-setup.c -=================================================================== ---- systemd-stable.orig/src/shared/cgroup-setup.c -+++ systemd-stable/src/shared/cgroup-setup.c -@@ -267,7 +267,7 @@ int cg_attach(const char *controller, co - - xsprintf(c, PID_FMT "\n", pid); - -- r = write_string_file(fs, c, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file(fs, c, 0); - if (r < 0) - return r; - -@@ -817,7 +817,7 @@ int cg_enable_everywhere( - return log_debug_errno(errno, "Failed to open cgroup.subtree_control file of %s: %m", p); - } - -- r = write_string_stream(f, s, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_stream(f, s, 0); - if (r < 0) { - log_debug_errno(r, "Failed to %s controller %s for %s (%s): %m", - FLAGS_SET(mask, bit) ? "enable" : "disable", n, p, fs); -Index: systemd-stable/src/shared/sysctl-util.c -=================================================================== ---- systemd-stable.orig/src/shared/sysctl-util.c -+++ systemd-stable/src/shared/sysctl-util.c -@@ -93,7 +93,7 @@ int sysctl_write_ip_property(int af, con - - log_debug("Setting '%s' to '%s'", p, value); - -- return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER); -+ return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | 0); - } - - int sysctl_read(const char *property, char **content) { -Index: systemd-stable/src/sleep/sleep.c -=================================================================== ---- systemd-stable.orig/src/sleep/sleep.c -+++ systemd-stable/src/sleep/sleep.c -@@ -48,7 +48,7 @@ static int write_hibernate_location_info - assert(hibernate_location->swap); - - xsprintf(resume_str, "%u:%u", major(hibernate_location->devno), minor(hibernate_location->devno)); -- r = write_string_file("/sys/power/resume", resume_str, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file("/sys/power/resume", resume_str, 0); - if (r < 0) - return log_debug_errno(r, "Failed to write partition device to /sys/power/resume for '%s': '%s': %m", - hibernate_location->swap->device, resume_str); -@@ -75,7 +75,7 @@ static int write_hibernate_location_info - } - - xsprintf(offset_str, "%" PRIu64, hibernate_location->offset); -- r = write_string_file("/sys/power/resume_offset", offset_str, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file("/sys/power/resume_offset", offset_str, 0); - if (r < 0) - return log_debug_errno(r, "Failed to write swap file offset to /sys/power/resume_offset for '%s': '%s': %m", - hibernate_location->swap->device, offset_str); -@@ -92,7 +92,7 @@ static int write_mode(char **modes) { - STRV_FOREACH(mode, modes) { - int k; - -- k = write_string_file("/sys/power/disk", *mode, WRITE_STRING_FILE_DISABLE_BUFFER); -+ k = write_string_file("/sys/power/disk", *mode, 0); - if (k >= 0) - return 0; - -@@ -114,7 +114,7 @@ static int write_state(FILE **f, char ** - STRV_FOREACH(state, states) { - int k; - -- k = write_string_stream(*f, *state, WRITE_STRING_FILE_DISABLE_BUFFER); -+ k = write_string_stream(*f, *state, 0); - if (k >= 0) - return 0; - log_debug_errno(k, "Failed to write '%s' to /sys/power/state: %m", *state); -Index: systemd-stable/src/udev/udevadm-trigger.c -=================================================================== ---- systemd-stable.orig/src/udev/udevadm-trigger.c -+++ systemd-stable/src/udev/udevadm-trigger.c -@@ -43,7 +43,7 @@ static int exec_list(sd_device_enumerato - if (!filename) - return log_oom(); - -- r = write_string_file(filename, action, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file(filename, action, 0); - if (r < 0) { - bool ignore = IN_SET(r, -ENOENT, -EACCES, -ENODEV, -EROFS); - -Index: systemd-stable/src/udev/udevd.c -=================================================================== ---- systemd-stable.orig/src/udev/udevd.c -+++ systemd-stable/src/udev/udevd.c -@@ -1153,7 +1153,7 @@ static int synthesize_change_one(sd_devi - - filename = strjoina(syspath, "/uevent"); - log_device_debug(dev, "device is closed, synthesising 'change' on %s", syspath); -- r = write_string_file(filename, "change", WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file(filename, "change", 0); - if (r < 0) - return log_device_debug_errno(dev, r, "Failed to write 'change' to %s: %m", filename); - return 0; -Index: systemd-stable/src/vconsole/vconsole-setup.c -=================================================================== ---- systemd-stable.orig/src/vconsole/vconsole-setup.c -+++ systemd-stable/src/vconsole/vconsole-setup.c -@@ -116,7 +116,7 @@ static int toggle_utf8_vc(const char *na - static int toggle_utf8_sysfs(bool utf8) { - int r; - -- r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), 0); - if (r < 0) - return log_warning_errno(r, "Failed to %s sysfs UTF-8 flag: %m", enable_disable(utf8)); - diff --git a/meta/recipes-core/systemd/systemd/0001-logind-Restore-chvt-as-non-root-user-without-polkit.patch b/meta/recipes-core/systemd/systemd/0001-logind-Restore-chvt-as-non-root-user-without-polkit.patch deleted file mode 100644 index 89ef39bc3e..0000000000 --- a/meta/recipes-core/systemd/systemd/0001-logind-Restore-chvt-as-non-root-user-without-polkit.patch +++ /dev/null @@ -1,227 +0,0 @@ -From 150d9cade6d475570395cb418b824524dead9577 Mon Sep 17 00:00:00 2001 -From: Joshua Watt <JPEWhacker@gmail.com> -Date: Fri, 30 Oct 2020 08:15:43 -0500 -Subject: [PATCH] logind: Restore chvt as non-root user without polkit - -4acf0cfd2f ("logind: check PolicyKit before allowing VT switch") broke -the ability to write user sessions that run graphical sessions (e.g. -weston/X11). This was partially amended in 19bb87fbfa ("login: allow -non-console sessions to change vt") by changing the default PolicyKit -policy so that non-root users are again allowed to switch the VT. This -makes the policy when PolKit is not enabled (as on many embedded -systems) match the default PolKit policy and allows launching graphical -sessions as a non-root user. - -Closes #17473 ---- - src/login/logind-dbus.c | 11 ++------- - src/login/logind-polkit.c | 26 +++++++++++++++++++++ - src/login/logind-polkit.h | 10 ++++++++ - src/login/logind-seat-dbus.c | 41 ++++----------------------------- - src/login/logind-session-dbus.c | 11 ++------- - src/login/meson.build | 1 + - 6 files changed, 46 insertions(+), 54 deletions(-) - create mode 100644 src/login/logind-polkit.c - create mode 100644 src/login/logind-polkit.h - -diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c -index 0f83ed99bc..a3765d88ba 100644 ---- a/src/login/logind-dbus.c -+++ b/src/login/logind-dbus.c -@@ -30,6 +30,7 @@ - #include "format-util.h" - #include "fs-util.h" - #include "logind-dbus.h" -+#include "logind-polkit.h" - #include "logind-seat-dbus.h" - #include "logind-session-dbus.h" - #include "logind-user-dbus.h" -@@ -1047,15 +1048,7 @@ static int method_activate_session_on_seat(sd_bus_message *message, void *userda - return sd_bus_error_setf(error, BUS_ERROR_SESSION_NOT_ON_SEAT, - "Session %s not on seat %s", session_name, seat_name); - -- r = bus_verify_polkit_async( -- message, -- CAP_SYS_ADMIN, -- "org.freedesktop.login1.chvt", -- NULL, -- false, -- UID_INVALID, -- &m->polkit_registry, -- error); -+ r = check_polkit_chvt(message, m, error); - if (r < 0) - return r; - if (r == 0) -diff --git a/src/login/logind-polkit.c b/src/login/logind-polkit.c -new file mode 100644 -index 0000000000..9072570cc6 ---- /dev/null -+++ b/src/login/logind-polkit.c -@@ -0,0 +1,26 @@ -+/* SPDX-License-Identifier: LGPL-2.1+ */ -+ -+#include "bus-polkit.h" -+#include "logind-polkit.h" -+#include "missing_capability.h" -+#include "user-util.h" -+ -+int check_polkit_chvt(sd_bus_message *message, Manager *manager, sd_bus_error *error) { -+#if ENABLE_POLKIT -+ return bus_verify_polkit_async( -+ message, -+ CAP_SYS_ADMIN, -+ "org.freedesktop.login1.chvt", -+ NULL, -+ false, -+ UID_INVALID, -+ &manager->polkit_registry, -+ error); -+#else -+ /* Allow chvt when polkit is not present. This allows a service to start a graphical session as a -+ * non-root user when polkit is not compiled in, matching the default polkit policy */ -+ return 1; -+#endif -+} -+ -+ -diff --git a/src/login/logind-polkit.h b/src/login/logind-polkit.h -new file mode 100644 -index 0000000000..476c077a8a ---- /dev/null -+++ b/src/login/logind-polkit.h -@@ -0,0 +1,10 @@ -+/* SPDX-License-Identifier: LGPL-2.1+ */ -+#pragma once -+ -+#include "sd-bus.h" -+ -+#include "bus-object.h" -+#include "logind.h" -+ -+int check_polkit_chvt(sd_bus_message *message, Manager *manager, sd_bus_error *error); -+ -diff --git a/src/login/logind-seat-dbus.c b/src/login/logind-seat-dbus.c -index a945132284..f22e9e2734 100644 ---- a/src/login/logind-seat-dbus.c -+++ b/src/login/logind-seat-dbus.c -@@ -9,6 +9,7 @@ - #include "bus-polkit.h" - #include "bus-util.h" - #include "logind-dbus.h" -+#include "logind-polkit.h" - #include "logind-seat-dbus.h" - #include "logind-seat.h" - #include "logind-session-dbus.h" -@@ -179,15 +180,7 @@ static int method_activate_session(sd_bus_message *message, void *userdata, sd_b - if (session->seat != s) - return sd_bus_error_setf(error, BUS_ERROR_SESSION_NOT_ON_SEAT, "Session %s not on seat %s", name, s->id); - -- r = bus_verify_polkit_async( -- message, -- CAP_SYS_ADMIN, -- "org.freedesktop.login1.chvt", -- NULL, -- false, -- UID_INVALID, -- &s->manager->polkit_registry, -- error); -+ r = check_polkit_chvt(message, s->manager, error); - if (r < 0) - return r; - if (r == 0) -@@ -215,15 +208,7 @@ static int method_switch_to(sd_bus_message *message, void *userdata, sd_bus_erro - if (to <= 0) - return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid virtual terminal"); - -- r = bus_verify_polkit_async( -- message, -- CAP_SYS_ADMIN, -- "org.freedesktop.login1.chvt", -- NULL, -- false, -- UID_INVALID, -- &s->manager->polkit_registry, -- error); -+ r = check_polkit_chvt(message, s->manager, error); - if (r < 0) - return r; - if (r == 0) -@@ -243,15 +228,7 @@ static int method_switch_to_next(sd_bus_message *message, void *userdata, sd_bus - assert(message); - assert(s); - -- r = bus_verify_polkit_async( -- message, -- CAP_SYS_ADMIN, -- "org.freedesktop.login1.chvt", -- NULL, -- false, -- UID_INVALID, -- &s->manager->polkit_registry, -- error); -+ r = check_polkit_chvt(message, s->manager, error); - if (r < 0) - return r; - if (r == 0) -@@ -271,15 +248,7 @@ static int method_switch_to_previous(sd_bus_message *message, void *userdata, sd - assert(message); - assert(s); - -- r = bus_verify_polkit_async( -- message, -- CAP_SYS_ADMIN, -- "org.freedesktop.login1.chvt", -- NULL, -- false, -- UID_INVALID, -- &s->manager->polkit_registry, -- error); -+ r = check_polkit_chvt(message, s->manager, error); - if (r < 0) - return r; - if (r == 0) -diff --git a/src/login/logind-session-dbus.c b/src/login/logind-session-dbus.c -index ccc5ac8df2..57c8a4e900 100644 ---- a/src/login/logind-session-dbus.c -+++ b/src/login/logind-session-dbus.c -@@ -11,6 +11,7 @@ - #include "fd-util.h" - #include "logind-brightness.h" - #include "logind-dbus.h" -+#include "logind-polkit.h" - #include "logind-seat-dbus.h" - #include "logind-session-dbus.h" - #include "logind-session-device.h" -@@ -192,15 +193,7 @@ int bus_session_method_activate(sd_bus_message *message, void *userdata, sd_bus_ - assert(message); - assert(s); - -- r = bus_verify_polkit_async( -- message, -- CAP_SYS_ADMIN, -- "org.freedesktop.login1.chvt", -- NULL, -- false, -- UID_INVALID, -- &s->manager->polkit_registry, -- error); -+ r = check_polkit_chvt(message, s->manager, error); - if (r < 0) - return r; - if (r == 0) -diff --git a/src/login/meson.build b/src/login/meson.build -index 0a7d3d5440..7e46be2add 100644 ---- a/src/login/meson.build -+++ b/src/login/meson.build -@@ -26,6 +26,7 @@ liblogind_core_sources = files(''' - logind-device.h - logind-inhibit.c - logind-inhibit.h -+ logind-polkit.c - logind-seat-dbus.c - logind-seat-dbus.h - logind-seat.c --- -2.28.0 - diff --git a/meta/recipes-core/systemd/systemd/0001-missing_type.h-add-comparison_fn_t.patch b/meta/recipes-core/systemd/systemd/0001-missing_type.h-add-comparison_fn_t.patch new file mode 100644 index 0000000000..2aa5dee6b5 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0001-missing_type.h-add-comparison_fn_t.patch @@ -0,0 +1,61 @@ +From 01195eb9f7d59139fb45df506ac6b3968c14a57f Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Mon, 25 Feb 2019 13:55:12 +0800 +Subject: [PATCH 01/22] missing_type.h: add comparison_fn_t + +Make it work with musl where comparison_fn_t and is not provided. + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> +[Rebased for v244] +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +[Rebased for v242] +Signed-off-by: Andrej Valek <andrej.valek@siemens.com> +[Rebased for v250, Drop __compare_fn_t] +Signed-off-by: Jiaqing Zhao <jiaqing.zhao@linux.intel.com> +--- + src/basic/missing_type.h | 4 ++++ + src/basic/sort-util.h | 1 + + src/libsystemd/sd-journal/catalog.c | 1 + + 3 files changed, 6 insertions(+) + +diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h +index f6233090a9..6c0456349d 100644 +--- a/src/basic/missing_type.h ++++ b/src/basic/missing_type.h +@@ -10,3 +10,7 @@ + #if !HAVE_CHAR16_T + #define char16_t uint16_t + #endif ++ ++#ifndef __GLIBC__ ++typedef int (*comparison_fn_t)(const void *, const void *); ++#endif +diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h +index 9c818bd747..ef10c8be2c 100644 +--- a/src/basic/sort-util.h ++++ b/src/basic/sort-util.h +@@ -4,6 +4,7 @@ + #include <stdlib.h> + + #include "macro.h" ++#include "missing_type.h" + + /* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the + * external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that +diff --git a/src/libsystemd/sd-journal/catalog.c b/src/libsystemd/sd-journal/catalog.c +index ae91534198..7f67eea38b 100644 +--- a/src/libsystemd/sd-journal/catalog.c ++++ b/src/libsystemd/sd-journal/catalog.c +@@ -28,6 +28,7 @@ + #include "string-util.h" + #include "strv.h" + #include "tmpfile-util.h" ++#include "missing_type.h" + + const char * const catalog_file_dirs[] = { + "/usr/local/lib/systemd/catalog/", +-- +2.34.1 + diff --git a/meta/recipes-core/systemd/systemd/0001-systemd.pc.in-use-ROOTPREFIX-without-suffixed-slash.patch b/meta/recipes-core/systemd/systemd/0001-systemd.pc.in-use-ROOTPREFIX-without-suffixed-slash.patch deleted file mode 100644 index 622a4108bb..0000000000 --- a/meta/recipes-core/systemd/systemd/0001-systemd.pc.in-use-ROOTPREFIX-without-suffixed-slash.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 58860e0f248576a80ff2af256ba42713c186ae93 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Tue, 29 Sep 2020 18:01:41 -0700 -Subject: [PATCH] systemd.pc.in: use ROOTPREFIX without suffixed slash - -This complements the commit -https://github.com/poettering/systemd/commit/b612c26ceb9f56af0271fc9f07c1724d2d260a8a - -Upstream-Status: Pending -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- - src/core/systemd.pc.in | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - ---- a/src/core/systemd.pc.in -+++ b/src/core/systemd.pc.in -@@ -65,16 +65,16 @@ systemdshutdowndir=${systemd_shutdown_di - tmpfiles_dir=${prefix}/lib/tmpfiles.d - tmpfilesdir=${tmpfiles_dir} - --sysusers_dir=${rootprefix}/lib/sysusers.d -+sysusers_dir=${prefix}/lib/sysusers.d - sysusersdir=${sysusers_dir} - --sysctl_dir=${rootprefix}/lib/sysctl.d -+sysctl_dir=${prefix}/lib/sysctl.d - sysctldir=${sysctl_dir} - --binfmt_dir=${rootprefix}/lib/binfmt.d -+binfmt_dir=${prefix}/lib/binfmt.d - binfmtdir=${binfmt_dir} - --modules_load_dir=${rootprefix}/lib/modules-load.d -+modules_load_dir=${prefix}/lib/modules-load.d - modulesloaddir=${modules_load_dir} - - catalog_dir=${prefix}/lib/systemd/catalog diff --git a/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch b/meta/recipes-core/systemd/systemd/0002-add-fallback-parse_printf_format-implementation.patch index e65c543614..900a931632 100644 --- a/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch +++ b/meta/recipes-core/systemd/systemd/0002-add-fallback-parse_printf_format-implementation.patch @@ -1,7 +1,7 @@ -From 8af168cefca01f8f2da336f1c82620c284dc74f2 Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Mon, 25 Feb 2019 14:04:21 +0800 -Subject: [PATCH] add fallback parse_printf_format implementation +From 872b72739e62123867ce6c4f82aa37de24cc3f75 Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin <alex.kanavin@gmail.com> +Date: Sat, 22 May 2021 20:26:24 +0200 +Subject: [PATCH 02/22] add fallback parse_printf_format implementation Upstream-Status: Inappropriate [musl specific] @@ -10,50 +10,50 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Chen Qi <Qi.Chen@windriver.com> [rebased for systemd 243] Signed-off-by: Scott Murray <scott.murray@konsulko.com> - --- - meson.build | 1 + - src/basic/meson.build | 5 + - src/basic/parse-printf-format.c | 273 ++++++++++++++++++++++++++++++++ - src/basic/parse-printf-format.h | 57 +++++++ - src/basic/stdio-util.h | 2 +- - src/journal/journal-send.c | 2 +- + meson.build | 1 + + src/basic/meson.build | 5 + + src/basic/parse-printf-format.c | 273 +++++++++++++++++++++++ + src/basic/parse-printf-format.h | 57 +++++ + src/basic/stdio-util.h | 2 +- + src/libsystemd/sd-journal/journal-send.c | 2 +- 6 files changed, 338 insertions(+), 2 deletions(-) create mode 100644 src/basic/parse-printf-format.c create mode 100644 src/basic/parse-printf-format.h -Index: systemd-stable/meson.build -=================================================================== ---- systemd-stable.orig/meson.build -+++ systemd-stable/meson.build -@@ -638,6 +638,7 @@ endif +diff --git a/meson.build b/meson.build +index 7419e2b0b0..01fd3ffc19 100644 +--- a/meson.build ++++ b/meson.build +@@ -725,6 +725,7 @@ endif foreach header : ['crypt.h', 'linux/memfd.h', 'linux/vm_sockets.h', + 'printf.h', 'sys/auxv.h', + 'threads.h', 'valgrind/memcheck.h', - 'valgrind/valgrind.h', -Index: systemd-stable/src/basic/meson.build -=================================================================== ---- systemd-stable.orig/src/basic/meson.build -+++ systemd-stable/src/basic/meson.build -@@ -317,6 +317,11 @@ foreach item : [['af', af_list_txt, - endforeach +diff --git a/src/basic/meson.build b/src/basic/meson.build +index d7450d8b44..c3e3daf4bd 100644 +--- a/src/basic/meson.build ++++ b/src/basic/meson.build +@@ -183,6 +183,11 @@ endforeach basic_sources += generated_gperf_headers -+ + +if conf.get('HAVE_PRINTF_H') != 1 + basic_sources += [files('parse-printf-format.c')] +endif + - basic_gcrypt_sources = files( - 'gcrypt-util.c', - 'gcrypt-util.h') -Index: systemd-stable/src/basic/parse-printf-format.c -=================================================================== ++ + ############################################################ + + arch_list = [ +diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c +new file mode 100644 +index 0000000000..49437e5445 --- /dev/null -+++ systemd-stable/src/basic/parse-printf-format.c ++++ b/src/basic/parse-printf-format.c @@ -0,0 +1,273 @@ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + @@ -328,10 +328,11 @@ Index: systemd-stable/src/basic/parse-printf-format.c + + return last; +} -Index: systemd-stable/src/basic/parse-printf-format.h -=================================================================== +diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h +new file mode 100644 +index 0000000000..47be7522d7 --- /dev/null -+++ systemd-stable/src/basic/parse-printf-format.h ++++ b/src/basic/parse-printf-format.h @@ -0,0 +1,57 @@ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + @@ -390,12 +391,12 @@ Index: systemd-stable/src/basic/parse-printf-format.h +size_t parse_printf_format(const char *fmt, size_t n, int *types); + +#endif /* HAVE_PRINTF_H */ -Index: systemd-stable/src/basic/stdio-util.h -=================================================================== ---- systemd-stable.orig/src/basic/stdio-util.h -+++ systemd-stable/src/basic/stdio-util.h -@@ -1,13 +1,13 @@ - /* SPDX-License-Identifier: LGPL-2.1+ */ +diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h +index 4e93ac90c9..f9deb6f662 100644 +--- a/src/basic/stdio-util.h ++++ b/src/basic/stdio-util.h +@@ -1,12 +1,12 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include <printf.h> @@ -404,15 +405,14 @@ Index: systemd-stable/src/basic/stdio-util.h #include <sys/types.h> #include "macro.h" - #include "memory-util.h" +#include "parse-printf-format.h" - #define snprintf_ok(buf, len, fmt, ...) \ - ((size_t) snprintf(buf, len, fmt, __VA_ARGS__) < (len)) -Index: systemd-stable/src/journal/journal-send.c -=================================================================== ---- systemd-stable.orig/src/journal/journal-send.c -+++ systemd-stable/src/journal/journal-send.c + _printf_(3, 4) + static inline char *snprintf_ok(char *buf, size_t len, const char *format, ...) { +diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c +index be23b2fe75..69a2eb6404 100644 +--- a/src/libsystemd/sd-journal/journal-send.c ++++ b/src/libsystemd/sd-journal/journal-send.c @@ -2,7 +2,6 @@ #include <errno.h> @@ -421,7 +421,7 @@ Index: systemd-stable/src/journal/journal-send.c #include <stddef.h> #include <sys/un.h> #include <unistd.h> -@@ -21,6 +20,7 @@ +@@ -28,6 +27,7 @@ #include "stdio-util.h" #include "string-util.h" #include "tmpfile-util.h" @@ -429,3 +429,6 @@ Index: systemd-stable/src/journal/journal-send.c #define SNDBUF_SIZE (8*1024*1024) +-- +2.34.1 + diff --git a/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch b/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch new file mode 100644 index 0000000000..be231cf6b2 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch @@ -0,0 +1,79 @@ +From 29a58009a172e369ad7166e16dab2f4945c6b0d2 Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Thu, 21 Feb 2019 16:23:24 +0800 +Subject: [PATCH 1/2] binfmt: Don't install dependency links at install time + for the binfmt services + +use [Install] blocks so that they get created when the service is enabled +like a traditional service. + +The [Install] blocks were rejected upstream as they don't have a way to +"enable" it on install without static symlinks which can't be disabled, +only masked. We however can do that in a postinst. + +Upstream-Status: Denied + +Signed-off-by: Ross Burton <ross.burton@intel.com> +Signed-off-by: Khem Raj <raj.khem@gmail.com> +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +[rebased for systemd 243] +Signed-off-by: Scott Murray <scott.murray@konsulko.com> +--- + units/meson.build | 2 -- + units/proc-sys-fs-binfmt_misc.automount | 3 +++ + units/systemd-binfmt.service.in | 4 ++++ + 3 files changed, 7 insertions(+), 2 deletions(-) + +diff --git a/units/meson.build b/units/meson.build +index e7bfb7f838..1d5ec4b178 100644 +--- a/units/meson.build ++++ b/units/meson.build +@@ -154,7 +154,6 @@ units = [ + { + 'file' : 'proc-sys-fs-binfmt_misc.automount', + 'conditions' : ['ENABLE_BINFMT'], +- 'symlinks' : ['sysinit.target.wants/'], + }, + { + 'file' : 'proc-sys-fs-binfmt_misc.mount', +@@ -251,7 +250,6 @@ units = [ + { + 'file' : 'systemd-binfmt.service.in', + 'conditions' : ['ENABLE_BINFMT'], +- 'symlinks' : ['sysinit.target.wants/'], + }, + { + 'file' : 'systemd-bless-boot.service.in', +diff --git a/units/proc-sys-fs-binfmt_misc.automount b/units/proc-sys-fs-binfmt_misc.automount +index 5d212015a5..6c2900ca77 100644 +--- a/units/proc-sys-fs-binfmt_misc.automount ++++ b/units/proc-sys-fs-binfmt_misc.automount +@@ -22,3 +22,6 @@ Before=shutdown.target + + [Automount] + Where=/proc/sys/fs/binfmt_misc ++ ++[Install] ++WantedBy=sysinit.target +diff --git a/units/systemd-binfmt.service.in b/units/systemd-binfmt.service.in +index 6861c76674..531e9fbd90 100644 +--- a/units/systemd-binfmt.service.in ++++ b/units/systemd-binfmt.service.in +@@ -14,6 +14,7 @@ Documentation=https://docs.kernel.org/admin-guide/binfmt-misc.html + Documentation=https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems + DefaultDependencies=no + Conflicts=shutdown.target ++Wants=proc-sys-fs-binfmt_misc.automount + After=proc-sys-fs-binfmt_misc.automount + After=proc-sys-fs-binfmt_misc.mount + After=local-fs.target +@@ -31,3 +32,6 @@ RemainAfterExit=yes + ExecStart={{LIBEXECDIR}}/systemd-binfmt + ExecStop={{LIBEXECDIR}}/systemd-binfmt --unregister + TimeoutSec=90s ++ ++[Install] ++WantedBy=sysinit.target +-- +2.34.1 + diff --git a/meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch b/meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch deleted file mode 100644 index 30fe9a14df..0000000000 --- a/meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch +++ /dev/null @@ -1,161 +0,0 @@ -From 3eb12a6ba0bce149717eaabeb1505d379b3d705a Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Mon, 25 Feb 2019 13:41:41 +0800 -Subject: [PATCH] don't use glibc-specific qsort_r - -Upstream-Status: Inappropriate [musl specific] - -Signed-off-by: Khem Raj <raj.khem@gmail.com> -[Rebased for v241] -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> -[Rebased for v242] -Signed-off-by: Andrej Valek <andrej.valek@siemens.com> - ---- - src/basic/sort-util.h | 14 ------------ - src/libsystemd/sd-hwdb/hwdb-util.c | 19 +++++++++++----- - src/shared/format-table.c | 36 ++++++++++++++++++++---------- - 3 files changed, 38 insertions(+), 31 deletions(-) - -Index: systemd-stable/src/basic/sort-util.h -=================================================================== ---- systemd-stable.orig/src/basic/sort-util.h -+++ systemd-stable/src/basic/sort-util.h -@@ -54,17 +54,3 @@ static inline void _qsort_safe(void *bas - int (*_func_)(const typeof(p[0])*, const typeof(p[0])*) = func; \ - _qsort_safe((p), (n), sizeof((p)[0]), (__compar_fn_t) _func_); \ - }) -- --static inline void qsort_r_safe(void *base, size_t nmemb, size_t size, __compar_d_fn_t compar, void *userdata) { -- if (nmemb <= 1) -- return; -- -- assert(base); -- qsort_r(base, nmemb, size, compar, userdata); --} -- --#define typesafe_qsort_r(p, n, func, userdata) \ -- ({ \ -- int (*_func_)(const typeof(p[0])*, const typeof(p[0])*, typeof(userdata)) = func; \ -- qsort_r_safe((p), (n), sizeof((p)[0]), (__compar_d_fn_t) _func_, userdata); \ -- }) -Index: systemd-stable/src/libsystemd/sd-hwdb/hwdb-util.c -=================================================================== ---- systemd-stable.orig/src/libsystemd/sd-hwdb/hwdb-util.c -+++ systemd-stable/src/libsystemd/sd-hwdb/hwdb-util.c -@@ -128,9 +128,13 @@ static void trie_free(struct trie *trie) - - DEFINE_TRIVIAL_CLEANUP_FUNC(struct trie*, trie_free); - --static int trie_values_cmp(const struct trie_value_entry *a, const struct trie_value_entry *b, struct trie *trie) { -- return strcmp(trie->strings->buf + a->key_off, -- trie->strings->buf + b->key_off); -+static struct trie *trie_node_add_value_trie; -+static int trie_values_cmp(const void *v1, const void *v2) { -+ const struct trie_value_entry *a = v1; -+ const struct trie_value_entry *b = v2; -+ -+ return strcmp(trie_node_add_value_trie->strings->buf + a->key_off, -+ trie_node_add_value_trie->strings->buf + b->key_off); - } - - static int trie_node_add_value(struct trie *trie, struct trie_node *node, -@@ -158,7 +162,10 @@ static int trie_node_add_value(struct tr - .value_off = v, - }; - -- val = typesafe_bsearch_r(&search, node->values, node->values_count, trie_values_cmp, trie); -+ trie_node_add_value_trie = trie; -+ val = bsearch(&search, node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp); -+ trie_node_add_value_trie = NULL; -+ - if (val) { - /* At this point we have 2 identical properties on the same match-string. - * Since we process files in order, we just replace the previous value. */ -@@ -184,7 +191,9 @@ static int trie_node_add_value(struct tr - .line_number = line_number, - }; - node->values_count++; -- typesafe_qsort_r(node->values, node->values_count, trie_values_cmp, trie); -+ trie_node_add_value_trie = trie; -+ qsort(node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp); -+ trie_node_add_value_trie = NULL; - return 0; - } - -Index: systemd-stable/src/shared/format-table.c -=================================================================== ---- systemd-stable.orig/src/shared/format-table.c -+++ systemd-stable/src/shared/format-table.c -@@ -1246,31 +1246,33 @@ static int cell_data_compare(TableData * - return CMP(index_a, index_b); - } - --static int table_data_compare(const size_t *a, const size_t *b, Table *t) { -+static Table *user_table; -+static int table_data_compare(const void *x, const void *y) { -+ const size_t *a = x, *b=y; - size_t i; - int r; - -- assert(t); -- assert(t->sort_map); -+ assert(user_table); -+ assert(user_table->sort_map); - - /* Make sure the header stays at the beginning */ -- if (*a < t->n_columns && *b < t->n_columns) -+ if (*a < user_table->n_columns && *b < user_table->n_columns) - return 0; -- if (*a < t->n_columns) -+ if (*a < user_table->n_columns) - return -1; -- if (*b < t->n_columns) -+ if (*b < user_table->n_columns) - return 1; - - /* Order other lines by the sorting map */ -- for (i = 0; i < t->n_sort_map; i++) { -+ for (i = 0; i < user_table->n_sort_map; i++) { - TableData *d, *dd; - -- d = t->data[*a + t->sort_map[i]]; -- dd = t->data[*b + t->sort_map[i]]; -+ d = user_table->data[*a + user_table->sort_map[i]]; -+ dd = user_table->data[*b + user_table->sort_map[i]]; - - r = cell_data_compare(d, *a, dd, *b); - if (r != 0) -- return t->reverse_map && t->reverse_map[t->sort_map[i]] ? -r : r; -+ return user_table->reverse_map && user_table->reverse_map[user_table->sort_map[i]] ? -r : r; - } - - /* Order identical lines by the order there were originally added in */ -@@ -1798,7 +1800,12 @@ int table_print(Table *t, FILE *f) { - for (i = 0; i < n_rows; i++) - sorted[i] = i * t->n_columns; - -- typesafe_qsort_r(sorted, n_rows, table_data_compare, t); -+ if (n_rows <= 1) -+ return 0; -+ assert(sorted); -+ user_table = t; -+ qsort(sorted, n_rows, sizeof(size_t), table_data_compare); -+ user_table = NULL; - } - - if (t->display_map) -@@ -2375,7 +2382,12 @@ int table_to_json(Table *t, JsonVariant - for (i = 0; i < n_rows; i++) - sorted[i] = i * t->n_columns; - -- typesafe_qsort_r(sorted, n_rows, table_data_compare, t); -+ if (n_rows <= 1) -+ return 0; -+ assert(sorted); -+ user_table = t; -+ qsort(sorted, n_rows, sizeof(size_t), table_data_compare); -+ user_table = NULL; - } - - if (t->display_map) diff --git a/meta/recipes-core/systemd/systemd/0002-src-login-brightness.c-include-sys-wait.h.patch b/meta/recipes-core/systemd/systemd/0002-src-login-brightness.c-include-sys-wait.h.patch deleted file mode 100644 index ba7424d876..0000000000 --- a/meta/recipes-core/systemd/systemd/0002-src-login-brightness.c-include-sys-wait.h.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 106922335ec502bcb4451c54a89be49f88fa54de Mon Sep 17 00:00:00 2001 -From: Scott Murray <scott.murray@konsulko.com> -Date: Fri, 13 Sep 2019 19:26:27 -0400 -Subject: [PATCH] Include sys/wait.h - -Fixes: -src/login/logind-brightness.c:158:85: error: 'WEXITED' undeclared (first use in this function); did you mean 'WIFEXITED'? - 158 | r = sd_event_add_child(w->manager->event, &w->child_event_source, w->child, WEXITED, on_brightness_writer_exit, w); - | ^~~~~~~ - -Upstream-Status: Pending - -Signed-off-by: Scott Murray <scott.murray@konsulko.com> - ---- - src/login/logind-brightness.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/login/logind-brightness.c b/src/login/logind-brightness.c -index 3f4b65e1fdf1..5af7e3d5ce3f 100644 ---- a/src/login/logind-brightness.c -+++ b/src/login/logind-brightness.c -@@ -1,5 +1,6 @@ - /* SPDX-License-Identifier: LGPL-2.1+ */ - -+#include <sys/wait.h> - #include "bus-util.h" - #include "device-util.h" - #include "hash-funcs.h" diff --git a/meta/recipes-core/systemd/systemd/0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch b/meta/recipes-core/systemd/systemd/0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch deleted file mode 100644 index 1404895143..0000000000 --- a/meta/recipes-core/systemd/systemd/0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 233de872b9b033ec842c2135152d2e006ac44c16 Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Mon, 25 Feb 2019 13:55:12 +0800 -Subject: [PATCH] missing_type.h: add __compare_fn_t and comparison_fn_t - -Make it work with musl where comparison_fn_t and __compare_fn_t -is not provided. - -Upstream-Status: Inappropriate [musl specific] - -Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> -[Rebased for v244] -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> -[Rebased for v242] -Signed-off-by: Andrej Valek <andrej.valek@siemens.com> - ---- - src/basic/missing_type.h | 9 +++++++++ - src/basic/sort-util.h | 1 + - src/core/kmod-setup.c | 1 + - src/journal/catalog.c | 1 + - 4 files changed, 12 insertions(+) - -diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h -index bf8a6caa1b46..c487e65e7bde 100644 ---- a/src/basic/missing_type.h -+++ b/src/basic/missing_type.h -@@ -10,3 +10,12 @@ - #if !HAVE_CHAR16_T - #define char16_t uint16_t - #endif -+ -+#ifndef __GLIBC__ -+typedef int (*comparison_fn_t)(const void *, const void *); -+#endif -+ -+#ifndef __COMPAR_FN_T -+#define __COMPAR_FN_T -+typedef int (*__compar_fn_t)(const void *, const void *); -+#endif -diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h -index 27d68b341cf3..307ea4ac0e8e 100644 ---- a/src/basic/sort-util.h -+++ b/src/basic/sort-util.h -@@ -4,6 +4,7 @@ - #include <stdlib.h> - - #include "macro.h" -+#include "missing_type.h" - - void *xbsearch_r(const void *key, const void *base, size_t nmemb, size_t size, - __compar_d_fn_t compar, void *arg); -diff --git a/src/core/kmod-setup.c b/src/core/kmod-setup.c -index 128674327362..09ccd613e32c 100644 ---- a/src/core/kmod-setup.c -+++ b/src/core/kmod-setup.c -@@ -10,6 +10,7 @@ - #include "kmod-setup.h" - #include "macro.h" - #include "string-util.h" -+#include "missing_type.h" - - #if HAVE_KMOD - #include "module-util.h" -diff --git a/src/journal/catalog.c b/src/journal/catalog.c -index 70b2c8b46c4e..d574a64586f1 100644 ---- a/src/journal/catalog.c -+++ b/src/journal/catalog.c -@@ -28,6 +28,7 @@ - #include "string-util.h" - #include "strv.h" - #include "tmpfile-util.h" -+#include "missing_type.h" - - const char * const catalog_file_dirs[] = { - "/usr/local/lib/systemd/catalog/", diff --git a/meta/recipes-core/systemd/systemd/0003-src-basic-copy.c-include-signal.h.patch b/meta/recipes-core/systemd/systemd/0003-src-basic-copy.c-include-signal.h.patch deleted file mode 100644 index 538a99c7d7..0000000000 --- a/meta/recipes-core/systemd/systemd/0003-src-basic-copy.c-include-signal.h.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 082d2eb2a65525890a913723764e67a36ee75384 Mon Sep 17 00:00:00 2001 -From: Scott Murray <scott.murray@konsulko.com> -Date: Fri, 13 Sep 2019 19:26:27 -0400 -Subject: [PATCH] Include signal.h - -Fixes several signal set related errors: -src/basic/copy.c:92:19: error: implicit declaration of function 'sigemptyset' [-Werror=implicit-function-declaration] -src/basic/copy.c:93:19: error: implicit declaration of function 'sigaddset' [-Werror=implicit-function-declaration] -src/basic/copy.c:93:34: error: 'SIGINT' undeclared (first use in this function) -src/basic/copy.c:95:13: error: implicit declaration of function 'sigtimedwait' [-Werror=implicit-function-declaration] - -Upstream-Status: Pending - -Signed-off-by: Scott Murray <scott.murray@konsulko.com> - ---- - src/basic/copy.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/basic/copy.c b/src/basic/copy.c -index 9028868f696d..5168586fa522 100644 ---- a/src/basic/copy.c -+++ b/src/basic/copy.c -@@ -8,6 +8,7 @@ - #include <sys/sendfile.h> - #include <sys/xattr.h> - #include <unistd.h> -+#include <signal.h> - - #include "alloc-util.h" - #include "btrfs-util.h" diff --git a/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch b/meta/recipes-core/systemd/systemd/0003-src-basic-missing.h-check-for-missing-strndupa.patch index 8e7a2fb6e4..5595b5bc23 100644 --- a/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch +++ b/meta/recipes-core/systemd/systemd/0003-src-basic-missing.h-check-for-missing-strndupa.patch @@ -1,7 +1,7 @@ -From 7e771de87cf728a8678f1f28f391bba3589e2496 Mon Sep 17 00:00:00 2001 +From 87f1d38f40c5fe9cadf2b2de442473e4e5605788 Mon Sep 17 00:00:00 2001 From: Chen Qi <Qi.Chen@windriver.com> Date: Mon, 25 Feb 2019 14:18:21 +0800 -Subject: [PATCH] src/basic/missing.h: check for missing strndupa +Subject: [PATCH 03/22] src/basic/missing.h: check for missing strndupa include missing.h for definition of strndupa @@ -15,7 +15,11 @@ Signed-off-by: Andrej Valek <andrej.valek@siemens.com> Signed-off-by: Scott Murray <scott.murray@konsulko.com> Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> [rebased for systemd 244] - +[Rebased for v247] +Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com> +[Rebased for v254] +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +[Rebased for v255.1] --- meson.build | 1 + src/backlight/backlight.c | 1 + @@ -24,11 +28,12 @@ Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> src/basic/log.c | 1 + src/basic/missing_stdlib.h | 12 ++++++++++++ src/basic/mkdir.c | 1 + + src/basic/mountpoint-util.c | 1 + src/basic/parse-util.c | 1 + src/basic/path-lookup.c | 1 + + src/basic/percent-util.c | 1 + src/basic/proc-cmdline.c | 1 + src/basic/procfs-util.c | 1 + - src/basic/selinux-util.c | 1 + src/basic/time-util.c | 1 + src/boot/bless-boot.c | 1 + src/core/dbus-cgroup.c | 1 + @@ -38,15 +43,15 @@ Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> src/core/kmod-setup.c | 1 + src/core/service.c | 1 + src/coredump/coredump-vacuum.c | 1 + + src/fstab-generator/fstab-generator.c | 1 + src/journal-remote/journal-remote-main.c | 1 + src/journal/journalctl.c | 1 + - src/journal/sd-journal.c | 1 + src/libsystemd/sd-bus/bus-message.c | 1 + src/libsystemd/sd-bus/bus-objects.c | 1 + src/libsystemd/sd-bus/bus-socket.c | 1 + src/libsystemd/sd-bus/sd-bus.c | 1 + src/libsystemd/sd-bus/test-bus-benchmark.c | 1 + - src/locale/keymap-util.c | 1 + + src/libsystemd/sd-journal/sd-journal.c | 1 + src/login/pam_systemd.c | 1 + src/network/generator/network-generator.c | 1 + src/nspawn/nspawn-settings.c | 1 + @@ -61,40 +66,40 @@ Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> src/shared/journal-importer.c | 1 + src/shared/logs-show.c | 1 + src/shared/pager.c | 1 + - src/shared/uid-range.c | 1 + src/socket-proxy/socket-proxyd.c | 1 + src/test/test-hexdecoct.c | 1 + + src/udev/udev-builtin-net_id.c | 1 + src/udev/udev-builtin-path_id.c | 1 + src/udev/udev-event.c | 1 + src/udev/udev-rules.c | 1 + - 50 files changed, 61 insertions(+) + 51 files changed, 62 insertions(+) diff --git a/meson.build b/meson.build -index 9187439bdd..bea9935a91 100644 +index 01fd3ffc19..61a872b753 100644 --- a/meson.build +++ b/meson.build -@@ -527,6 +527,7 @@ foreach ident : [ - #include <unistd.h> - #include <signal.h> - #include <sys/wait.h>'''], -+ ['strndupa' , '''#include <string.h>'''], - ] +@@ -567,6 +567,7 @@ foreach ident : ['secure_getenv', '__secure_getenv'] + endforeach - have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE') + foreach ident : [ ++ ['strndupa' , '''#include <string.h>'''], + ['memfd_create', '''#include <sys/mman.h>'''], + ['gettid', '''#include <sys/types.h> + #include <unistd.h>'''], diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c -index 3a644363e1..73946a829b 100644 +index 5ac9f904a9..99d5122dd7 100644 --- a/src/backlight/backlight.c +++ b/src/backlight/backlight.c -@@ -17,6 +17,7 @@ +@@ -20,6 +20,7 @@ #include "string-util.h" #include "strv.h" - #include "util.h" + #include "terminal-util.h" +#include "missing_stdlib.h" - static int find_pci_or_platform_parent(sd_device *device, sd_device **ret) { - const char *subsystem, *sysname, *value; + #define PCI_CLASS_GRAPHICS_CARD 0x30000 + diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c -index e94fcfad02..856a7068b0 100644 +index 18b16ecc0e..d2be79622f 100644 --- a/src/basic/cgroup-util.c +++ b/src/basic/cgroup-util.c @@ -38,6 +38,7 @@ @@ -103,34 +108,34 @@ index e94fcfad02..856a7068b0 100644 #include "xattr-util.h" +#include "missing_stdlib.h" - static int cg_enumerate_items(const char *controller, const char *path, FILE **_f, const char *item) { + static int cg_enumerate_items(const char *controller, const char *path, FILE **ret, const char *item) { _cleanup_free_ char *fs = NULL; diff --git a/src/basic/env-util.c b/src/basic/env-util.c -index b8dc98915f..5049b37594 100644 +index d3bf73385f..16b17358ca 100644 --- a/src/basic/env-util.c +++ b/src/basic/env-util.c -@@ -15,6 +15,7 @@ +@@ -19,6 +19,7 @@ #include "string-util.h" #include "strv.h" #include "utf8.h" +#include "missing_stdlib.h" - #define VALID_CHARS_ENV_NAME \ - DIGITS LETTERS \ + /* We follow bash for the character set. Different shells have different rules. */ + #define VALID_BASH_ENV_NAME_CHARS \ diff --git a/src/basic/log.c b/src/basic/log.c -index c6fe203808..b7ef932d28 100644 +index 1470611a75..9924ec2b9a 100644 --- a/src/basic/log.c +++ b/src/basic/log.c -@@ -35,6 +35,7 @@ +@@ -40,6 +40,7 @@ #include "terminal-util.h" #include "time-util.h" #include "utf8.h" +#include "missing_stdlib.h" #define SNDBUF_SIZE (8*1024*1024) - + #define IOVEC_MAX 256U diff --git a/src/basic/missing_stdlib.h b/src/basic/missing_stdlib.h -index 188a8d4406..1e16ec287a 100644 +index 8c76f93eb2..9068bfb4f0 100644 --- a/src/basic/missing_stdlib.h +++ b/src/basic/missing_stdlib.h @@ -11,3 +11,15 @@ @@ -150,22 +155,34 @@ index 188a8d4406..1e16ec287a 100644 + }) +#endif diff --git a/src/basic/mkdir.c b/src/basic/mkdir.c -index 6ebc2b95fd..88f4359bab 100644 +index c770e5ed32..1fd8816cd0 100644 --- a/src/basic/mkdir.c +++ b/src/basic/mkdir.c -@@ -13,6 +13,7 @@ +@@ -16,6 +16,7 @@ #include "stat-util.h" #include "stdio-util.h" #include "user-util.h" +#include "missing_stdlib.h" - int mkdir_safe_internal( - const char *path, + int mkdirat_safe_internal( + int dir_fd, +diff --git a/src/basic/mountpoint-util.c b/src/basic/mountpoint-util.c +index bf67f7e01a..409f8d8a73 100644 +--- a/src/basic/mountpoint-util.c ++++ b/src/basic/mountpoint-util.c +@@ -18,6 +18,7 @@ + #include "missing_stat.h" + #include "missing_syscall.h" + #include "mkdir.h" ++#include "missing_stdlib.h" + #include "mountpoint-util.h" + #include "nulstr-util.h" + #include "parse-util.h" diff --git a/src/basic/parse-util.c b/src/basic/parse-util.c -index 44f0438cf4..54b4133343 100644 +index 0430e33e40..f3728de026 100644 --- a/src/basic/parse-util.c +++ b/src/basic/parse-util.c -@@ -19,6 +19,7 @@ +@@ -18,6 +18,7 @@ #include "stat-util.h" #include "string-util.h" #include "strv.h" @@ -174,10 +191,10 @@ index 44f0438cf4..54b4133343 100644 int parse_boolean(const char *v) { if (!v) diff --git a/src/basic/path-lookup.c b/src/basic/path-lookup.c -index 52968dee34..2f4f7e3dcd 100644 +index 4e3d59fc56..726e240df0 100644 --- a/src/basic/path-lookup.c +++ b/src/basic/path-lookup.c -@@ -15,6 +15,7 @@ +@@ -16,6 +16,7 @@ #include "strv.h" #include "tmpfile-util.h" #include "user-util.h" @@ -185,47 +202,47 @@ index 52968dee34..2f4f7e3dcd 100644 int xdg_user_runtime_dir(char **ret, const char *suffix) { const char *e; +diff --git a/src/basic/percent-util.c b/src/basic/percent-util.c +index cab9d0eaea..5f6ca258e9 100644 +--- a/src/basic/percent-util.c ++++ b/src/basic/percent-util.c +@@ -3,6 +3,7 @@ + #include "percent-util.h" + #include "string-util.h" + #include "parse-util.h" ++#include "missing_stdlib.h" + + static int parse_parts_value_whole(const char *p, const char *symbol) { + const char *pc, *n; diff --git a/src/basic/proc-cmdline.c b/src/basic/proc-cmdline.c -index ba47ca5812..8baf728fde 100644 +index 522d8de1f4..7c129dc0fc 100644 --- a/src/basic/proc-cmdline.c +++ b/src/basic/proc-cmdline.c -@@ -15,6 +15,7 @@ +@@ -16,6 +16,7 @@ #include "string-util.h" - #include "util.h" + #include "strv.h" #include "virt.h" +#include "missing_stdlib.h" - int proc_cmdline(char **ret) { - const char *e; + int proc_cmdline_filter_pid1_args(char **argv, char ***ret) { + enum { diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c -index 7aaf95bfce..da7e836f14 100644 +index d7cfcd9105..6cb0ddf575 100644 --- a/src/basic/procfs-util.c +++ b/src/basic/procfs-util.c -@@ -11,6 +11,7 @@ +@@ -12,6 +12,7 @@ #include "procfs-util.h" #include "stdio-util.h" #include "string-util.h" +#include "missing_stdlib.h" - int procfs_tasks_get_limit(uint64_t *ret) { + int procfs_get_pid_max(uint64_t *ret) { _cleanup_free_ char *value = NULL; -diff --git a/src/basic/selinux-util.c b/src/basic/selinux-util.c -index c94ee26bd9..14e35b4653 100644 ---- a/src/basic/selinux-util.c -+++ b/src/basic/selinux-util.c -@@ -27,6 +27,7 @@ - #include "selinux-util.h" - #include "stdio-util.h" - #include "time-util.h" -+#include "missing_stdlib.h" - - #if HAVE_SELINUX - DEFINE_TRIVIAL_CLEANUP_FUNC(context_t, context_free); diff --git a/src/basic/time-util.c b/src/basic/time-util.c -index 15cc1b8851..02bb3f01f9 100644 +index f9014dc560..1d7840a5b5 100644 --- a/src/basic/time-util.c +++ b/src/basic/time-util.c -@@ -26,6 +26,7 @@ +@@ -27,6 +27,7 @@ #include "string-util.h" #include "strv.h" #include "time-util.h" @@ -234,11 +251,11 @@ index 15cc1b8851..02bb3f01f9 100644 static clockid_t map_clock_id(clockid_t c) { diff --git a/src/boot/bless-boot.c b/src/boot/bless-boot.c -index b96e1f927f..cba979baca 100644 +index 0c0b4f23c7..68fe5ca509 100644 --- a/src/boot/bless-boot.c +++ b/src/boot/bless-boot.c -@@ -18,6 +18,7 @@ - #include "util.h" +@@ -22,6 +22,7 @@ + #include "terminal-util.h" #include "verbs.h" #include "virt.h" +#include "missing_stdlib.h" @@ -246,22 +263,22 @@ index b96e1f927f..cba979baca 100644 static char **arg_path = NULL; diff --git a/src/core/dbus-cgroup.c b/src/core/dbus-cgroup.c -index b7d2e32639..fdbc1df95e 100644 +index 4237e694c0..05f9d9d9a9 100644 --- a/src/core/dbus-cgroup.c +++ b/src/core/dbus-cgroup.c -@@ -15,6 +15,7 @@ - #include "fileio.h" - #include "limits-util.h" +@@ -25,6 +25,7 @@ + #include "parse-util.h" #include "path-util.h" + #include "percent-util.h" +#include "missing_stdlib.h" + #include "socket-util.h" - BUS_DEFINE_PROPERTY_GET(bus_property_get_tasks_max, "t", TasksMax, tasks_max_resolve); - + BUS_DEFINE_PROPERTY_GET(bus_property_get_tasks_max, "t", CGroupTasksMax, cgroup_tasks_max_resolve); diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c -index 50f7ada8ce..5c760ee487 100644 +index 4daa1cefd3..2c77901471 100644 --- a/src/core/dbus-execute.c +++ b/src/core/dbus-execute.c -@@ -41,6 +41,7 @@ +@@ -42,6 +42,7 @@ #include "unit-printf.h" #include "user-util.h" #include "utf8.h" @@ -270,10 +287,10 @@ index 50f7ada8ce..5c760ee487 100644 BUS_DEFINE_PROPERTY_GET_ENUM(bus_property_get_exec_output, exec_output, ExecOutput); static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_exec_input, exec_input, ExecInput); diff --git a/src/core/dbus-util.c b/src/core/dbus-util.c -index 951450e53d..50d134e9a1 100644 +index d680a64268..e59f48103e 100644 --- a/src/core/dbus-util.c +++ b/src/core/dbus-util.c -@@ -7,6 +7,7 @@ +@@ -9,6 +9,7 @@ #include "unit-printf.h" #include "user-util.h" #include "unit.h" @@ -282,46 +299,46 @@ index 951450e53d..50d134e9a1 100644 int bus_property_get_triggered_unit( sd_bus *bus, diff --git a/src/core/execute.c b/src/core/execute.c -index 2a4840a3a9..d3f1e0e0f8 100644 +index ef0bf88687..bd3da0c401 100644 --- a/src/core/execute.c +++ b/src/core/execute.c -@@ -89,6 +89,7 @@ - #include "unit.h" +@@ -72,6 +72,7 @@ + #include "unit-serialize.h" #include "user-util.h" #include "utmp-wtmp.h" +#include "missing_stdlib.h" - #define IDLE_TIMEOUT_USEC (5*USEC_PER_SEC) - #define IDLE_TIMEOUT2_USEC (1*USEC_PER_SEC) + static bool is_terminal_input(ExecInput i) { + return IN_SET(i, diff --git a/src/core/kmod-setup.c b/src/core/kmod-setup.c -index 09ccd613e3..f4e64fa283 100644 +index b8e3f7aadd..8ce8ca68d8 100644 --- a/src/core/kmod-setup.c +++ b/src/core/kmod-setup.c -@@ -11,6 +11,7 @@ - #include "macro.h" +@@ -13,6 +13,7 @@ #include "string-util.h" - #include "missing_type.h" + #include "strv.h" + #include "virt.h" +#include "missing_stdlib.h" #if HAVE_KMOD #include "module-util.h" diff --git a/src/core/service.c b/src/core/service.c -index 00e61945ba..1ecab28354 100644 +index b9eb40c555..268fe7573b 100644 --- a/src/core/service.c +++ b/src/core/service.c -@@ -41,6 +41,7 @@ +@@ -45,6 +45,7 @@ + #include "unit-name.h" #include "unit.h" #include "utf8.h" - #include "util.h" +#include "missing_stdlib.h" - static const UnitActiveState state_translation_table[_SERVICE_STATE_MAX] = { - [SERVICE_DEAD] = UNIT_INACTIVE, + #define service_spawn(...) service_spawn_internal(__func__, __VA_ARGS__) + diff --git a/src/coredump/coredump-vacuum.c b/src/coredump/coredump-vacuum.c -index 35885dfb47..bb9f0660a6 100644 +index 7e0c98cb7d..978a7f5874 100644 --- a/src/coredump/coredump-vacuum.c +++ b/src/coredump/coredump-vacuum.c -@@ -16,6 +16,7 @@ +@@ -17,6 +17,7 @@ #include "string-util.h" #include "time-util.h" #include "user-util.h" @@ -329,11 +346,23 @@ index 35885dfb47..bb9f0660a6 100644 #define DEFAULT_MAX_USE_LOWER (uint64_t) (1ULL*1024ULL*1024ULL) /* 1 MiB */ #define DEFAULT_MAX_USE_UPPER (uint64_t) (4ULL*1024ULL*1024ULL*1024ULL) /* 4 GiB */ +diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c +index 016f3baa7f..b1def81313 100644 +--- a/src/fstab-generator/fstab-generator.c ++++ b/src/fstab-generator/fstab-generator.c +@@ -37,6 +37,7 @@ + #include "unit-name.h" + #include "virt.h" + #include "volatile-util.h" ++#include "missing_stdlib.h" + + typedef enum MountPointFlags { + MOUNT_NOAUTO = 1 << 0, diff --git a/src/journal-remote/journal-remote-main.c b/src/journal-remote/journal-remote-main.c -index 77dfdefd64..e21ecbeff8 100644 +index da0f20d3ce..f22ce41908 100644 --- a/src/journal-remote/journal-remote-main.c +++ b/src/journal-remote/journal-remote-main.c -@@ -22,6 +22,7 @@ +@@ -27,6 +27,7 @@ #include "stat-util.h" #include "string-table.h" #include "strv.h" @@ -342,10 +371,10 @@ index 77dfdefd64..e21ecbeff8 100644 #define PRIV_KEY_FILE CERTIFICATE_ROOT "/private/journal-remote.pem" #define CERT_FILE CERTIFICATE_ROOT "/certs/journal-remote.pem" diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c -index 8d4897b942..15476b3c83 100644 +index 7f3dcd56a4..41b7cbaaf1 100644 --- a/src/journal/journalctl.c +++ b/src/journal/journalctl.c -@@ -69,6 +69,7 @@ +@@ -77,6 +77,7 @@ #include "unit-name.h" #include "user-util.h" #include "varlink.h" @@ -353,36 +382,24 @@ index 8d4897b942..15476b3c83 100644 #define DEFAULT_FSS_INTERVAL_USEC (15*USEC_PER_MINUTE) #define PROCESS_INOTIFY_INTERVAL 1024 /* Every 1,024 messages processed */ -diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c -index 6fb0abb419..2d94d9938e 100644 ---- a/src/journal/sd-journal.c -+++ b/src/journal/sd-journal.c -@@ -40,6 +40,7 @@ - #include "string-util.h" - #include "strv.h" - #include "syslog-util.h" -+#include "missing_stdlib.h" - - #define JOURNAL_FILES_MAX 7168 - diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c -index 55e35cd902..0ed98f9224 100644 +index ff0228081f..9066fcb133 100644 --- a/src/libsystemd/sd-bus/bus-message.c +++ b/src/libsystemd/sd-bus/bus-message.c -@@ -21,6 +21,7 @@ +@@ -19,6 +19,7 @@ #include "strv.h" #include "time-util.h" #include "utf8.h" +#include "missing_stdlib.h" static int message_append_basic(sd_bus_message *m, char type, const void *p, const void **stored); - + static int message_parse_fields(sd_bus_message *m); diff --git a/src/libsystemd/sd-bus/bus-objects.c b/src/libsystemd/sd-bus/bus-objects.c -index 6abac8822c..c74c9cd7fa 100644 +index c25c40ff37..57a5da704f 100644 --- a/src/libsystemd/sd-bus/bus-objects.c +++ b/src/libsystemd/sd-bus/bus-objects.c -@@ -13,6 +13,7 @@ - #include "set.h" +@@ -11,6 +11,7 @@ + #include "missing_capability.h" #include "string-util.h" #include "strv.h" +#include "missing_stdlib.h" @@ -390,10 +407,10 @@ index 6abac8822c..c74c9cd7fa 100644 static int node_vtable_get_userdata( sd_bus *bus, diff --git a/src/libsystemd/sd-bus/bus-socket.c b/src/libsystemd/sd-bus/bus-socket.c -index fc7e8e844a..7af4dd2712 100644 +index 3c59d0d615..746922d46f 100644 --- a/src/libsystemd/sd-bus/bus-socket.c +++ b/src/libsystemd/sd-bus/bus-socket.c -@@ -28,6 +28,7 @@ +@@ -29,6 +29,7 @@ #include "string-util.h" #include "user-util.h" #include "utf8.h" @@ -402,58 +419,58 @@ index fc7e8e844a..7af4dd2712 100644 #define SNDBUF_SIZE (8*1024*1024) diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c -index 9de5e454a6..fe86c93c63 100644 +index 4a0259f8bb..aaa90d2223 100644 --- a/src/libsystemd/sd-bus/sd-bus.c +++ b/src/libsystemd/sd-bus/sd-bus.c -@@ -41,6 +41,7 @@ - #include "process-util.h" +@@ -46,6 +46,7 @@ #include "string-util.h" #include "strv.h" + #include "user-util.h" +#include "missing_stdlib.h" #define log_debug_bus_message(m) \ do { \ diff --git a/src/libsystemd/sd-bus/test-bus-benchmark.c b/src/libsystemd/sd-bus/test-bus-benchmark.c -index 8de0a859ee..58044b6ba9 100644 +index d988588de0..458df8df9a 100644 --- a/src/libsystemd/sd-bus/test-bus-benchmark.c +++ b/src/libsystemd/sd-bus/test-bus-benchmark.c @@ -14,6 +14,7 @@ - #include "missing_resource.h" + #include "string-util.h" + #include "tests.h" #include "time-util.h" - #include "util.h" +#include "missing_stdlib.h" #define MAX_SIZE (2*1024*1024) -diff --git a/src/locale/keymap-util.c b/src/locale/keymap-util.c -index 233d081300..40a32b9700 100644 ---- a/src/locale/keymap-util.c -+++ b/src/locale/keymap-util.c -@@ -21,6 +21,7 @@ - #include "string-util.h" +diff --git a/src/libsystemd/sd-journal/sd-journal.c b/src/libsystemd/sd-journal/sd-journal.c +index 6b9ff0a4ed..4a5027ad0f 100644 +--- a/src/libsystemd/sd-journal/sd-journal.c ++++ b/src/libsystemd/sd-journal/sd-journal.c +@@ -44,6 +44,7 @@ #include "strv.h" - #include "tmpfile-util.h" + #include "syslog-util.h" + #include "uid-alloc-range.h" +#include "missing_stdlib.h" - static bool startswith_comma(const char *s, const char *prefix) { - s = startswith(s, prefix); + #define JOURNAL_FILES_RECHECK_USEC (2 * USEC_PER_SEC) + diff --git a/src/login/pam_systemd.c b/src/login/pam_systemd.c -index 16f4289585..6c5e438b36 100644 +index b8da266e27..4bb8dd9496 100644 --- a/src/login/pam_systemd.c +++ b/src/login/pam_systemd.c -@@ -31,6 +31,7 @@ - #include "locale-util.h" +@@ -35,6 +35,7 @@ #include "login-util.h" #include "macro.h" + #include "missing_syscall.h" +#include "missing_stdlib.h" #include "pam-util.h" #include "parse-util.h" #include "path-util.h" diff --git a/src/network/generator/network-generator.c b/src/network/generator/network-generator.c -index bed1e42697..e4847c2bee 100644 +index 48527a2c73..9777fe0561 100644 --- a/src/network/generator/network-generator.c +++ b/src/network/generator/network-generator.c -@@ -13,6 +13,7 @@ +@@ -14,6 +14,7 @@ #include "string-table.h" #include "string-util.h" #include "strv.h" @@ -462,70 +479,70 @@ index bed1e42697..e4847c2bee 100644 /* # .network diff --git a/src/nspawn/nspawn-settings.c b/src/nspawn/nspawn-settings.c -index d341fa25aa..91646bc2c2 100644 +index 161b1c1c70..ba1c459f78 100644 --- a/src/nspawn/nspawn-settings.c +++ b/src/nspawn/nspawn-settings.c @@ -16,6 +16,7 @@ + #include "string-util.h" #include "strv.h" #include "user-util.h" - #include "util.h" +#include "missing_stdlib.h" Settings *settings_new(void) { Settings *s; diff --git a/src/nss-mymachines/nss-mymachines.c b/src/nss-mymachines/nss-mymachines.c -index 5db0dcef76..681f8677e4 100644 +index c64e79bdff..eda26b0b9a 100644 --- a/src/nss-mymachines/nss-mymachines.c +++ b/src/nss-mymachines/nss-mymachines.c -@@ -19,6 +19,7 @@ +@@ -21,6 +21,7 @@ #include "nss-util.h" #include "signal-util.h" #include "string-util.h" +#include "missing_stdlib.h" - NSS_GETHOSTBYNAME_PROTOTYPES(mymachines); - NSS_GETPW_PROTOTYPES(mymachines); + static void setup_logging_once(void) { + static pthread_once_t once = PTHREAD_ONCE_INIT; diff --git a/src/portable/portable.c b/src/portable/portable.c -index 3a1367ec2b..f29336cb1e 100644 +index d4b448a627..bb26623565 100644 --- a/src/portable/portable.c +++ b/src/portable/portable.c -@@ -31,6 +31,7 @@ +@@ -40,6 +40,7 @@ #include "strv.h" #include "tmpfile-util.h" #include "user-util.h" +#include "missing_stdlib.h" - static const char profile_dirs[] = CONF_PATHS_NULSTR("systemd/portable/profile"); - + /* Markers used in the first line of our 20-portable.conf unit file drop-in to determine, that a) the unit file was + * dropped there by the portable service logic and b) for which image it was dropped there. */ diff --git a/src/resolve/resolvectl.c b/src/resolve/resolvectl.c -index 3072b984e5..c46ae374bf 100644 +index afa537f160..32ccee4ae5 100644 --- a/src/resolve/resolvectl.c +++ b/src/resolve/resolvectl.c -@@ -36,6 +36,7 @@ - #include "strv.h" - #include "terminal-util.h" +@@ -48,6 +48,7 @@ + #include "varlink.h" + #include "verb-log-control.h" #include "verbs.h" +#include "missing_stdlib.h" static int arg_family = AF_UNSPEC; static int arg_ifindex = 0; diff --git a/src/shared/bus-get-properties.c b/src/shared/bus-get-properties.c -index 8ad4694046..da5082c02a 100644 +index 53e5d6b99f..851ecd5644 100644 --- a/src/shared/bus-get-properties.c +++ b/src/shared/bus-get-properties.c -@@ -3,6 +3,7 @@ - #include "bus-get-properties.h" +@@ -4,6 +4,7 @@ #include "rlimit-util.h" + #include "stdio-util.h" #include "string-util.h" +#include "missing_stdlib.h" int bus_property_get_bool( sd_bus *bus, diff --git a/src/shared/bus-unit-procs.c b/src/shared/bus-unit-procs.c -index b21fe39326..af2640005c 100644 +index 8b462b5627..183ce1c18e 100644 --- a/src/shared/bus-unit-procs.c +++ b/src/shared/bus-unit-procs.c -@@ -10,6 +10,7 @@ +@@ -11,6 +11,7 @@ #include "sort-util.h" #include "string-util.h" #include "terminal-util.h" @@ -534,10 +551,10 @@ index b21fe39326..af2640005c 100644 struct CGroupInfo { char *cgroup_path; diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c -index f2652ed9a5..eb019fc89f 100644 +index 4ee9706847..30c8084847 100644 --- a/src/shared/bus-unit-util.c +++ b/src/shared/bus-unit-util.c -@@ -39,6 +39,7 @@ +@@ -50,6 +50,7 @@ #include "unit-def.h" #include "user-util.h" #include "utf8.h" @@ -546,22 +563,22 @@ index f2652ed9a5..eb019fc89f 100644 int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u) { assert(message); diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c -index 77c1c62182..5cd31f3c15 100644 +index 4123152d93..74f148c8b4 100644 --- a/src/shared/bus-util.c +++ b/src/shared/bus-util.c -@@ -22,6 +22,7 @@ +@@ -24,6 +24,7 @@ + #include "path-util.h" #include "socket-util.h" #include "stdio-util.h" - /* #include "string-util.h" */ +#include "missing_stdlib.h" static int name_owner_change_callback(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) { - sd_event *e = userdata; + sd_event *e = ASSERT_PTR(userdata); diff --git a/src/shared/dns-domain.c b/src/shared/dns-domain.c -index b812665315..8e68f7f8fc 100644 +index b41c9b06ca..e69050a507 100644 --- a/src/shared/dns-domain.c +++ b/src/shared/dns-domain.c -@@ -23,6 +23,7 @@ +@@ -18,6 +18,7 @@ #include "string-util.h" #include "strv.h" #include "utf8.h" @@ -570,110 +587,113 @@ index b812665315..8e68f7f8fc 100644 int dns_label_unescape(const char **name, char *dest, size_t sz, DNSLabelFlags flags) { const char *n; diff --git a/src/shared/journal-importer.c b/src/shared/journal-importer.c -index 7c4fc7021d..3fbaf5a639 100644 +index 83e9834bbf..74eaae6f5e 100644 --- a/src/shared/journal-importer.c +++ b/src/shared/journal-importer.c -@@ -14,6 +14,7 @@ - #include "parse-util.h" +@@ -16,6 +16,7 @@ #include "string-util.h" + #include "strv.h" #include "unaligned.h" +#include "missing_stdlib.h" enum { IMPORTER_STATE_LINE = 0, /* waiting to read, or reading line */ diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c -index 899e894ab7..628854ac9c 100644 +index a5d04003bd..10392c132d 100644 --- a/src/shared/logs-show.c +++ b/src/shared/logs-show.c @@ -41,6 +41,7 @@ + #include "time-util.h" #include "utf8.h" - #include "util.h" #include "web-util.h" +#include "missing_stdlib.h" /* up to three lines (each up to 100 characters) or 300 characters, whichever is less */ #define PRINT_LINE_THRESHOLD 3 diff --git a/src/shared/pager.c b/src/shared/pager.c -index e03be6d23b..50e3d1f75c 100644 +index 19deefab56..6b6d0af1a0 100644 --- a/src/shared/pager.c +++ b/src/shared/pager.c -@@ -23,6 +23,7 @@ +@@ -25,6 +25,7 @@ + #include "string-util.h" #include "strv.h" #include "terminal-util.h" - #include "util.h" +#include "missing_stdlib.h" static pid_t pager_pid = 0; -diff --git a/src/shared/uid-range.c b/src/shared/uid-range.c -index 7cb7d8a477..8e7d7f9e7c 100644 ---- a/src/shared/uid-range.c -+++ b/src/shared/uid-range.c -@@ -9,6 +9,7 @@ - #include "sort-util.h" - #include "uid-range.h" - #include "user-util.h" -+#include "missing_stdlib.h" - - static bool uid_range_intersect(UidRange *range, uid_t start, uid_t nr) { - assert(range); diff --git a/src/socket-proxy/socket-proxyd.c b/src/socket-proxy/socket-proxyd.c -index b461aead60..9941695ed9 100644 +index 287fd6c181..8f8d5493da 100644 --- a/src/socket-proxy/socket-proxyd.c +++ b/src/socket-proxy/socket-proxyd.c -@@ -26,6 +26,7 @@ +@@ -27,6 +27,7 @@ + #include "set.h" #include "socket-util.h" #include "string-util.h" - #include "util.h" +#include "missing_stdlib.h" #define BUFFER_SIZE (256 * 1024) diff --git a/src/test/test-hexdecoct.c b/src/test/test-hexdecoct.c -index 52217429b1..70708dedf3 100644 +index f884008660..987e180697 100644 --- a/src/test/test-hexdecoct.c +++ b/src/test/test-hexdecoct.c -@@ -6,6 +6,7 @@ - #include "hexdecoct.h" +@@ -7,6 +7,7 @@ #include "macro.h" + #include "random-util.h" #include "string-util.h" +#include "missing_stdlib.h" + #include "tests.h" + + TEST(hexchar) { +diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c +index 91b40088f4..f528a46b8e 100644 +--- a/src/udev/udev-builtin-net_id.c ++++ b/src/udev/udev-builtin-net_id.c +@@ -39,6 +39,7 @@ + #include "strv.h" + #include "strxcpyx.h" + #include "udev-builtin.h" ++#include "missing_stdlib.h" - static void test_hexchar(void) { - assert_se(hexchar(0xa) == 'a'); + #define ONBOARD_14BIT_INDEX_MAX ((1U << 14) - 1) + #define ONBOARD_16BIT_INDEX_MAX ((1U << 16) - 1) diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c -index 6c020ac0ed..10723ec46c 100644 +index 467c9a6ad3..f74dae60af 100644 --- a/src/udev/udev-builtin-path_id.c +++ b/src/udev/udev-builtin-path_id.c -@@ -22,6 +22,7 @@ - #include "strv.h" +@@ -24,6 +24,7 @@ #include "sysexits.h" #include "udev-builtin.h" + #include "udev-util.h" +#include "missing_stdlib.h" _printf_(2,3) static void path_prepend(char **path, const char *fmt, ...) { diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c -index e1c2baf7f2..62d4086802 100644 +index ed22c8b679..19ebe20237 100644 --- a/src/udev/udev-event.c +++ b/src/udev/udev-event.c -@@ -34,6 +34,7 @@ +@@ -16,6 +16,7 @@ #include "udev-util.h" #include "udev-watch.h" #include "user-util.h" +#include "missing_stdlib.h" - typedef struct Spawn { - sd_device *device; + UdevEvent *udev_event_new(sd_device *dev, usec_t exec_delay_usec, sd_netlink *rtnl, int log_level) { + UdevEvent *event; diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c -index c36f032f66..36970813d8 100644 +index 5f12002394..febe345b4c 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c -@@ -30,6 +30,7 @@ - #include "udev-rules.h" +@@ -41,6 +41,7 @@ + #include "udev-util.h" #include "user-util.h" #include "virt.h" +#include "missing_stdlib.h" - #define RULES_DIRS (const char* const*) CONF_PATHS_STRV("udev/rules.d") + #define RULES_DIRS ((const char* const*) CONF_PATHS_STRV("udev/rules.d")) +-- +2.34.1 + diff --git a/meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not.patch b/meta/recipes-core/systemd/systemd/0004-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch index dd6ecebeb4..15877bea88 100644 --- a/meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not.patch +++ b/meta/recipes-core/systemd/systemd/0004-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch @@ -1,7 +1,8 @@ -From 77f98727f1d19a8fb327b55c92f1a9ee7b859e9f Mon Sep 17 00:00:00 2001 +From 5325ab5813617f35f03806ec420829dde7104387 Mon Sep 17 00:00:00 2001 From: Chen Qi <Qi.Chen@windriver.com> Date: Mon, 25 Feb 2019 14:56:21 +0800 -Subject: [PATCH] don't fail if GLOB_BRACE and GLOB_ALTDIRFUNC is not defined +Subject: [PATCH 04/22] don't fail if GLOB_BRACE and GLOB_ALTDIRFUNC is not + defined If the standard library doesn't provide brace expansion users just won't get it. @@ -16,17 +17,16 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Chen Qi <Qi.Chen@windriver.com> [rebased for systemd 243] Signed-off-by: Scott Murray <scott.murray@konsulko.com> - --- src/basic/glob-util.c | 12 ++++++++++++ src/test/test-glob-util.c | 16 ++++++++++++++++ src/tmpfiles/tmpfiles.c | 10 ++++++++++ 3 files changed, 38 insertions(+) -Index: systemd-stable/src/basic/glob-util.c -=================================================================== ---- systemd-stable.orig/src/basic/glob-util.c -+++ systemd-stable/src/basic/glob-util.c +diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c +index 802ca8c655..23818a67c6 100644 +--- a/src/basic/glob-util.c ++++ b/src/basic/glob-util.c @@ -12,6 +12,12 @@ #include "path-util.h" #include "strv.h" @@ -48,7 +48,7 @@ Index: systemd-stable/src/basic/glob-util.c /* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */ assert(!(flags & GLOB_ALTDIRFUNC)); -@@ -32,9 +39,14 @@ int safe_glob(const char *path, int flag +@@ -32,9 +39,14 @@ int safe_glob(const char *path, int flags, glob_t *pglob) { pglob->gl_lstat = lstat; if (!pglob->gl_stat) pglob->gl_stat = stat; @@ -63,13 +63,13 @@ Index: systemd-stable/src/basic/glob-util.c if (k == GLOB_NOMATCH) return -ENOENT; if (k == GLOB_NOSPACE) -Index: systemd-stable/src/test/test-glob-util.c -=================================================================== ---- systemd-stable.orig/src/test/test-glob-util.c -+++ systemd-stable/src/test/test-glob-util.c -@@ -12,6 +12,12 @@ - #include "rm-rf.h" - #include "tmpfile-util.h" +diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c +index 9b3e73cce0..3790ba3be5 100644 +--- a/src/test/test-glob-util.c ++++ b/src/test/test-glob-util.c +@@ -34,6 +34,12 @@ TEST(glob_first) { + assert_se(first == NULL); + } +/* Don't fail if the standard library + * doesn't provide brace expansion */ @@ -77,10 +77,10 @@ Index: systemd-stable/src/test/test-glob-util.c +#define GLOB_BRACE 0 +#endif + - static void test_glob_exists(void) { + TEST(glob_exists) { char name[] = "/tmp/test-glob_exists.XXXXXX"; - int fd = -1; -@@ -39,11 +45,13 @@ static void test_glob_no_dot(void) { + int fd = -EBADF; +@@ -61,11 +67,13 @@ TEST(glob_no_dot) { const char *fn; _cleanup_globfree_ glob_t g = { @@ -94,7 +94,7 @@ Index: systemd-stable/src/test/test-glob-util.c }; int r; -@@ -51,11 +59,19 @@ static void test_glob_no_dot(void) { +@@ -73,11 +81,19 @@ TEST(glob_no_dot) { assert_se(mkdtemp(template)); fn = strjoina(template, "/*"); @@ -114,13 +114,13 @@ Index: systemd-stable/src/test/test-glob-util.c assert_se(r == GLOB_NOMATCH); (void) rm_rf(template, REMOVE_ROOT|REMOVE_PHYSICAL); -Index: systemd-stable/src/tmpfiles/tmpfiles.c -=================================================================== ---- systemd-stable.orig/src/tmpfiles/tmpfiles.c -+++ systemd-stable/src/tmpfiles/tmpfiles.c -@@ -59,6 +59,12 @@ - #include "umask-util.h" +diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c +index 230ec09b97..2cc5f391d7 100644 +--- a/src/tmpfiles/tmpfiles.c ++++ b/src/tmpfiles/tmpfiles.c +@@ -73,6 +73,12 @@ #include "user-util.h" + #include "virt.h" +/* Don't fail if the standard library + * doesn't provide brace expansion */ @@ -131,23 +131,26 @@ Index: systemd-stable/src/tmpfiles/tmpfiles.c /* This reads all files listed in /etc/tmpfiles.d/?*.conf and creates * them in the file system. This is intended to be used to create * properly owned directories beneath /tmp, /var/tmp, /run, which are -@@ -1867,7 +1873,9 @@ finish: +@@ -2434,7 +2440,9 @@ finish: - static int glob_item(Item *i, action_t action) { + static int glob_item(Context *c, Item *i, action_t action) { _cleanup_globfree_ glob_t g = { +#ifdef GLOB_ALTDIRFUNC .gl_opendir = (void *(*)(const char *)) opendir_nomod, +#endif }; int r = 0, k; - char **fn; -@@ -1887,7 +1895,9 @@ static int glob_item(Item *i, action_t a - static int glob_item_recursively(Item *i, fdaction_t action) { +@@ -2461,7 +2469,9 @@ static int glob_item_recursively( + fdaction_t action) { + _cleanup_globfree_ glob_t g = { +#ifdef GLOB_ALTDIRFUNC .gl_opendir = (void *(*)(const char *)) opendir_nomod, +#endif }; int r = 0, k; - char **fn; + +-- +2.34.1 + diff --git a/meta/recipes-core/systemd/systemd/0005-add-missing-FTW_-macros-for-musl.patch b/meta/recipes-core/systemd/systemd/0005-add-missing-FTW_-macros-for-musl.patch new file mode 100644 index 0000000000..a1dfca22cd --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0005-add-missing-FTW_-macros-for-musl.patch @@ -0,0 +1,44 @@ +From dad7f897c0de654fa5592fda3e90f874639849f9 Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Mon, 25 Feb 2019 15:00:06 +0800 +Subject: [PATCH 05/22] add missing FTW_ macros for musl + +This is to avoid build failures like below for musl. + + locale-util.c:296:24: error: 'FTW_STOP' undeclared + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +--- + src/basic/missing_type.h | 4 ++++ + src/test/test-recurse-dir.c | 1 + + 2 files changed, 5 insertions(+) + +diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h +index 6c0456349d..73a5b90e3c 100644 +--- a/src/basic/missing_type.h ++++ b/src/basic/missing_type.h +@@ -14,3 +14,7 @@ + #ifndef __GLIBC__ + typedef int (*comparison_fn_t)(const void *, const void *); + #endif ++ ++#ifndef FTW_CONTINUE ++#define FTW_CONTINUE 0 ++#endif +diff --git a/src/test/test-recurse-dir.c b/src/test/test-recurse-dir.c +index 8684d064ec..70fc2b5376 100644 +--- a/src/test/test-recurse-dir.c ++++ b/src/test/test-recurse-dir.c +@@ -8,6 +8,7 @@ + #include "recurse-dir.h" + #include "strv.h" + #include "tests.h" ++#include "missing_type.h" + + static char **list_nftw = NULL; + +-- +2.34.1 + diff --git a/meta/recipes-core/systemd/systemd/0006-Include-netinet-if_ether.h.patch b/meta/recipes-core/systemd/systemd/0006-Include-netinet-if_ether.h.patch deleted file mode 100644 index abc438e4ba..0000000000 --- a/meta/recipes-core/systemd/systemd/0006-Include-netinet-if_ether.h.patch +++ /dev/null @@ -1,279 +0,0 @@ -From 47818052121d135632f5e46c369e3e4706a0f9e0 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Thu, 26 Oct 2017 22:10:42 -0700 -Subject: [PATCH] Include netinet/if_ether.h - -Fixes -/path/to/systemd/recipe-sysroot/usr/include/netinet/if_ether.h:101:8: error: redefinition of 'struct ethhdr' - struct ethhdr { - ^~~~~~ - -and related arphdr, arpreq, and arpreq_old errors -/path/to/systemd/recipe-sysroot/usr/include/net/if_arp.h:22:8: error: redefinition of 'struct arphdr' - struct arphdr { - ^~~~~~ - -The latter requires removing some includes of net/if_arp.h to avoid -conflicting with netinet/if_ether.h. - -Upstream-Status: Inappropriate [musl specific] - -Signed-off-by: Khem Raj <raj.khem@gmail.com> -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> -[rebased for systemd 243] -Signed-off-by: Scott Murray <scott.murray@konsulko.com> - -Upstream-Status: Inappropriate [musl specific] - -Signed-off-by: Khem Raj <raj.khem@gmail.com> -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> -[rebased for systemd 243] -Signed-off-by: Scott Murray <scott.murray@konsulko.com> - ---- - src/libsystemd-network/sd-dhcp6-client.c | 1 - - src/libsystemd/sd-netlink/netlink-types.c | 1 + - src/machine/machine-dbus.c | 1 + - src/network/netdev/bond.c | 1 + - src/network/netdev/bridge.c | 1 + - src/network/netdev/macsec.c | 1 + - src/network/netdev/netdev-gperf.gperf | 1 + - src/network/netdev/netdev.c | 1 + - src/network/networkd-brvlan.c | 1 + - src/network/networkd-dhcp-common.c | 1 + - src/network/networkd-dhcp4.c | 2 +- - src/network/networkd-dhcp6.c | 2 +- - src/network/networkd-link.c | 2 +- - src/network/networkd-network.c | 1 + - src/network/test-network-tables.c | 1 + - src/shared/ethtool-util.c | 1 + - src/shared/ethtool-util.h | 1 + - src/udev/net/link-config.c | 1 + - src/udev/udev-builtin-net_setup_link.c | 1 + - 19 files changed, 18 insertions(+), 4 deletions(-) - -Index: systemd-stable/src/libsystemd-network/sd-dhcp6-client.c -=================================================================== ---- systemd-stable.orig/src/libsystemd-network/sd-dhcp6-client.c -+++ systemd-stable/src/libsystemd-network/sd-dhcp6-client.c -@@ -5,7 +5,6 @@ - - #include <errno.h> - #include <sys/ioctl.h> --#include <linux/if_arp.h> - #include <linux/if_infiniband.h> - - #include "sd-dhcp6-client.h" -Index: systemd-stable/src/libsystemd/sd-netlink/netlink-types.c -=================================================================== ---- systemd-stable.orig/src/libsystemd/sd-netlink/netlink-types.c -+++ systemd-stable/src/libsystemd/sd-netlink/netlink-types.c -@@ -3,6 +3,7 @@ - #include <netinet/in.h> - #include <stdint.h> - #include <sys/socket.h> -+#include <netinet/if_ether.h> - #include <linux/can/vxcan.h> - #include <linux/netlink.h> - #include <linux/rtnetlink.h> -Index: systemd-stable/src/machine/machine-dbus.c -=================================================================== ---- systemd-stable.orig/src/machine/machine-dbus.c -+++ systemd-stable/src/machine/machine-dbus.c -@@ -3,6 +3,7 @@ - #include <errno.h> - #include <sys/mount.h> - #include <sys/wait.h> -+#include <netinet/if_ether.h> - - /* When we include libgen.h because we need dirname() we immediately - * undefine basename() since libgen.h defines it as a macro to the POSIX -Index: systemd-stable/src/network/netdev/bond.c -=================================================================== ---- systemd-stable.orig/src/network/netdev/bond.c -+++ systemd-stable/src/network/netdev/bond.c -@@ -1,5 +1,6 @@ - /* SPDX-License-Identifier: LGPL-2.1+ */ - -+#include <netinet/if_ether.h> - #include "alloc-util.h" - #include "bond.h" - #include "bond-util.h" -Index: systemd-stable/src/network/netdev/bridge.c -=================================================================== ---- systemd-stable.orig/src/network/netdev/bridge.c -+++ systemd-stable/src/network/netdev/bridge.c -@@ -1,5 +1,6 @@ - /* SPDX-License-Identifier: LGPL-2.1+ */ - -+#include <netinet/if_ether.h> - #include <net/if.h> - - #include "bridge.h" -Index: systemd-stable/src/network/netdev/macsec.c -=================================================================== ---- systemd-stable.orig/src/network/netdev/macsec.c -+++ systemd-stable/src/network/netdev/macsec.c -@@ -1,5 +1,6 @@ - /* SPDX-License-Identifier: LGPL-2.1+ */ - -+#include <netinet/if_ether.h> - #include <netinet/in.h> - #include <linux/if_ether.h> - #include <linux/if_macsec.h> -Index: systemd-stable/src/network/netdev/netdev-gperf.gperf -=================================================================== ---- systemd-stable.orig/src/network/netdev/netdev-gperf.gperf -+++ systemd-stable/src/network/netdev/netdev-gperf.gperf -@@ -2,6 +2,7 @@ - #if __GNUC__ >= 7 - _Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"") - #endif -+#include <netinet/if_ether.h> - #include <stddef.h> - #include "bond.h" - #include "bridge.h" -Index: systemd-stable/src/network/netdev/netdev.c -=================================================================== ---- systemd-stable.orig/src/network/netdev/netdev.c -+++ systemd-stable/src/network/netdev/netdev.c -@@ -1,5 +1,6 @@ - /* SPDX-License-Identifier: LGPL-2.1+ */ - -+#include <netinet/if_ether.h> - #include <net/if.h> - #include <netinet/in.h> - #include <unistd.h> -Index: systemd-stable/src/network/networkd-brvlan.c -=================================================================== ---- systemd-stable.orig/src/network/networkd-brvlan.c -+++ systemd-stable/src/network/networkd-brvlan.c -@@ -4,6 +4,7 @@ - ***/ - - #include <netinet/in.h> -+#include <netinet/if_ether.h> - #include <linux/if_bridge.h> - #include <stdbool.h> - -Index: systemd-stable/src/network/networkd-dhcp-common.c -=================================================================== ---- systemd-stable.orig/src/network/networkd-dhcp-common.c -+++ systemd-stable/src/network/networkd-dhcp-common.c -@@ -5,6 +5,7 @@ - #include "escape.h" - #include "in-addr-util.h" - #include "networkd-dhcp-common.h" -+#include <netinet/if_ether.h> - #include "networkd-network.h" - #include "parse-util.h" - #include "string-table.h" -Index: systemd-stable/src/network/networkd-dhcp4.c -=================================================================== ---- systemd-stable.orig/src/network/networkd-dhcp4.c -+++ systemd-stable/src/network/networkd-dhcp4.c -@@ -1,9 +1,9 @@ - /* SPDX-License-Identifier: LGPL-2.1+ */ - -+#include <netinet/if_ether.h> - #include <netinet/in.h> - #include <netinet/ip.h> - #include <linux/if.h> --#include <linux/if_arp.h> - - #include "escape.h" - #include "alloc-util.h" -Index: systemd-stable/src/network/networkd-dhcp6.c -=================================================================== ---- systemd-stable.orig/src/network/networkd-dhcp6.c -+++ systemd-stable/src/network/networkd-dhcp6.c -@@ -3,9 +3,9 @@ - Copyright © 2014 Intel Corporation. All rights reserved. - ***/ - -+#include <netinet/if_ether.h> - #include <netinet/in.h> - #include <linux/if.h> --#include <linux/if_arp.h> - - #include "sd-dhcp6-client.h" - -Index: systemd-stable/src/network/networkd-link.c -=================================================================== ---- systemd-stable.orig/src/network/networkd-link.c -+++ systemd-stable/src/network/networkd-link.c -@@ -1,8 +1,8 @@ - /* SPDX-License-Identifier: LGPL-2.1+ */ - -+#include <netinet/if_ether.h> - #include <netinet/in.h> - #include <linux/if.h> --#include <linux/if_arp.h> - #include <linux/if_link.h> - #include <unistd.h> - -Index: systemd-stable/src/network/networkd-network.c -=================================================================== ---- systemd-stable.orig/src/network/networkd-network.c -+++ systemd-stable/src/network/networkd-network.c -@@ -1,5 +1,6 @@ - /* SPDX-License-Identifier: LGPL-2.1+ */ - -+#include <netinet/if_ether.h> - #include <net/if.h> - #include <netinet/in.h> - #include <linux/netdevice.h> -Index: systemd-stable/src/network/test-network-tables.c -=================================================================== ---- systemd-stable.orig/src/network/test-network-tables.c -+++ systemd-stable/src/network/test-network-tables.c -@@ -1,3 +1,4 @@ -+#include <netinet/if_ether.h> - #include "bond.h" - #include "dhcp6-internal.h" - #include "dhcp6-protocol.h" -Index: systemd-stable/src/shared/ethtool-util.c -=================================================================== ---- systemd-stable.orig/src/shared/ethtool-util.c -+++ systemd-stable/src/shared/ethtool-util.c -@@ -1,5 +1,6 @@ - /* SPDX-License-Identifier: LGPL-2.1+ */ - -+#include <netinet/if_ether.h> - #include <net/if.h> - #include <sys/ioctl.h> - #include <linux/ethtool.h> -Index: systemd-stable/src/shared/ethtool-util.h -=================================================================== ---- systemd-stable.orig/src/shared/ethtool-util.h -+++ systemd-stable/src/shared/ethtool-util.h -@@ -3,6 +3,7 @@ - - #include <macro.h> - #include <net/ethernet.h> -+#include <netinet/if_ether.h> - #include <linux/ethtool.h> - - #include "conf-parser.h" -Index: systemd-stable/src/udev/net/link-config.c -=================================================================== ---- systemd-stable.orig/src/udev/net/link-config.c -+++ systemd-stable/src/udev/net/link-config.c -@@ -1,5 +1,6 @@ - /* SPDX-License-Identifier: LGPL-2.1+ */ - -+#include <netinet/if_ether.h> - #include <linux/netdevice.h> - #include <netinet/ether.h> - #include <unistd.h> -Index: systemd-stable/src/udev/udev-builtin-net_setup_link.c -=================================================================== ---- systemd-stable.orig/src/udev/udev-builtin-net_setup_link.c -+++ systemd-stable/src/udev/udev-builtin-net_setup_link.c -@@ -1,5 +1,6 @@ - /* SPDX-License-Identifier: LGPL-2.1+ */ - -+#include <netinet/if_ether.h> - #include "device-util.h" - #include "alloc-util.h" - #include "link-config.h" diff --git a/meta/recipes-core/systemd/systemd/0006-Use-uintmax_t-for-handling-rlim_t.patch b/meta/recipes-core/systemd/systemd/0006-Use-uintmax_t-for-handling-rlim_t.patch new file mode 100644 index 0000000000..4be14b72ec --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0006-Use-uintmax_t-for-handling-rlim_t.patch @@ -0,0 +1,106 @@ +From 96e975a2412a20e5f80bd3ab144057d275eb8597 Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Mon, 25 Feb 2019 15:12:41 +0800 +Subject: [PATCH 06/22] Use uintmax_t for handling rlim_t + +PRIu{32,64} is not right format to represent rlim_t type +therefore use %ju and typecast the rlim_t variables to +uintmax_t. + +Fixes portablility errors like + +execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=] +| fprintf(f, "%s%s: " RLIM_FMT "\n", +| ^~~~~~~~ +| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max); +| ~~~~~~~~~~~~~~~~~~~~~~ + +Upstream-Status: Denied [https://github.com/systemd/systemd/pull/7199] + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +[Rebased for v241] +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +--- + src/basic/format-util.h | 8 +------- + src/basic/rlimit-util.c | 12 ++++++------ + src/core/execute.c | 4 ++-- + 3 files changed, 9 insertions(+), 15 deletions(-) + +diff --git a/src/basic/format-util.h b/src/basic/format-util.h +index 8719df3e29..9becc96066 100644 +--- a/src/basic/format-util.h ++++ b/src/basic/format-util.h +@@ -34,13 +34,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t)); + # error Unknown timex member size + #endif + +-#if SIZEOF_RLIM_T == 8 +-# define RLIM_FMT "%" PRIu64 +-#elif SIZEOF_RLIM_T == 4 +-# define RLIM_FMT "%" PRIu32 +-#else +-# error Unknown rlim_t size +-#endif ++#define RLIM_FMT "%ju" + + #if SIZEOF_DEV_T == 8 + # define DEV_FMT "%" PRIu64 +diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c +index c1f0b2b974..61c5412582 100644 +--- a/src/basic/rlimit-util.c ++++ b/src/basic/rlimit-util.c +@@ -44,7 +44,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) { + fixed.rlim_max == highest.rlim_max) + return 0; + +- log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", rlim->rlim_max, rlimit_to_string(resource), fixed.rlim_max); ++ log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", (uintmax_t)rlim->rlim_max, rlimit_to_string(resource), (uintmax_t)fixed.rlim_max); + + return RET_NERRNO(setrlimit(resource, &fixed)); + } +@@ -307,13 +307,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) { + if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY) + r = free_and_strdup(&s, "infinity"); + else if (rl->rlim_cur >= RLIM_INFINITY) +- r = asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max); ++ r = asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max); + else if (rl->rlim_max >= RLIM_INFINITY) +- r = asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur); ++ r = asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur); + else if (rl->rlim_cur == rl->rlim_max) +- r = asprintf(&s, RLIM_FMT, rl->rlim_cur); ++ r = asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur); + else +- r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max); ++ r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max); + if (r < 0) + return -ENOMEM; + +@@ -422,7 +422,7 @@ int rlimit_nofile_safe(void) { + rl.rlim_max = MIN(rl.rlim_max, (rlim_t) read_nr_open()); + rl.rlim_cur = MIN((rlim_t) FD_SETSIZE, rl.rlim_max); + if (setrlimit(RLIMIT_NOFILE, &rl) < 0) +- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur); ++ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur); + + return 1; + } +diff --git a/src/core/execute.c b/src/core/execute.c +index bd3da0c401..df1870fd2f 100644 +--- a/src/core/execute.c ++++ b/src/core/execute.c +@@ -1045,9 +1045,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) { + for (unsigned i = 0; i < RLIM_NLIMITS; i++) + if (c->rlimit[i]) { + fprintf(f, "%sLimit%s: " RLIM_FMT "\n", +- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max); ++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max); + fprintf(f, "%sLimit%sSoft: " RLIM_FMT "\n", +- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur); ++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur); + } + + if (c->ioprio_set) { +-- +2.34.1 + diff --git a/meta/recipes-core/systemd/systemd/0015-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch b/meta/recipes-core/systemd/systemd/0007-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch index 0a7594c068..8d6084239e 100644 --- a/meta/recipes-core/systemd/systemd/0015-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch +++ b/meta/recipes-core/systemd/systemd/0007-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch @@ -1,7 +1,7 @@ -From e6f871078d8d6f076c84f908fa57af15417ab87d Mon Sep 17 00:00:00 2001 +From 4842cff4f1329f0b5034b529d56f8ad1f234ac4c Mon Sep 17 00:00:00 2001 From: Andre McCurdy <armccurdy@gmail.com> Date: Tue, 10 Oct 2017 14:33:30 -0700 -Subject: [PATCH] don't pass AT_SYMLINK_NOFOLLOW flag to faccessat() +Subject: [PATCH 07/22] don't pass AT_SYMLINK_NOFOLLOW flag to faccessat() Avoid using AT_SYMLINK_NOFOLLOW flag. It doesn't seem like the right thing to do and it's not portable (not supported by musl). See: @@ -25,21 +25,19 @@ just historical and not actually necessary or desired behaviour? Upstream-Status: Inappropriate [musl specific] Signed-off-by: Andre McCurdy <armccurdy@gmail.com> - --- - src/basic/fs-util.h | 22 +++++++++++++++++++++- + src/basic/fs-util.h | 21 ++++++++++++++++++++- src/shared/base-filesystem.c | 6 +++--- - 2 files changed, 24 insertions(+), 4 deletions(-) + 2 files changed, 23 insertions(+), 4 deletions(-) -Index: systemd-stable/src/basic/fs-util.h -=================================================================== ---- systemd-stable.orig/src/basic/fs-util.h -+++ systemd-stable/src/basic/fs-util.h -@@ -42,7 +42,27 @@ int fchmod_opath(int fd, mode_t m); +diff --git a/src/basic/fs-util.h b/src/basic/fs-util.h +index 1023ab73ca..c78ff6f27f 100644 +--- a/src/basic/fs-util.h ++++ b/src/basic/fs-util.h +@@ -49,8 +49,27 @@ int futimens_opath(int fd, const struct timespec ts[2]); int fd_warn_permissions(const char *path, int fd); int stat_warn_permissions(const char *path, const struct stat *st); --#define laccess(path, mode) faccessat(AT_FDCWD, (path), (mode), AT_SYMLINK_NOFOLLOW) +/* + Avoid using AT_SYMLINK_NOFOLLOW flag. It doesn't seem like the right thing to + do and it's not portable (not supported by musl). See: @@ -59,25 +57,26 @@ Index: systemd-stable/src/basic/fs-util.h + or why it needs to return success for broken symlinks. Maybe just historical + and not actually necessary or desired behaviour? +*/ -+ -+#define laccess(path, mode) faccessat(AT_FDCWD, (path), (mode), 0) + #define laccess(path, mode) \ +- RET_NERRNO(faccessat(AT_FDCWD, (path), (mode), AT_SYMLINK_NOFOLLOW)) ++ RET_NERRNO(faccessat(AT_FDCWD, (path), (mode), 0)) int touch_file(const char *path, bool parents, usec_t stamp, uid_t uid, gid_t gid, mode_t mode); - int touch(const char *path); -Index: systemd-stable/src/shared/base-filesystem.c -=================================================================== ---- systemd-stable.orig/src/shared/base-filesystem.c -+++ systemd-stable/src/shared/base-filesystem.c -@@ -54,7 +54,7 @@ int base_filesystem_create(const char *r - return log_error_errno(errno, "Failed to open root file system: %m"); - for (i = 0; i < ELEMENTSOF(table); i ++) { +diff --git a/src/shared/base-filesystem.c b/src/shared/base-filesystem.c +index 569ef466c3..7ae921a113 100644 +--- a/src/shared/base-filesystem.c ++++ b/src/shared/base-filesystem.c +@@ -145,7 +145,7 @@ int base_filesystem_create_fd(int fd, const char *root, uid_t uid, gid_t gid) { + /* The "root" parameter is decoration only – it's only used as part of log messages */ + + for (size_t i = 0; i < ELEMENTSOF(table); i++) { - if (faccessat(fd, table[i].dir, F_OK, AT_SYMLINK_NOFOLLOW) >= 0) + if (faccessat(fd, table[i].dir, F_OK, 0) >= 0) continue; - if (table[i].target) { -@@ -62,7 +62,7 @@ int base_filesystem_create(const char *r + if (table[i].target) { /* Create as symlink? */ +@@ -153,7 +153,7 @@ int base_filesystem_create_fd(int fd, const char *root, uid_t uid, gid_t gid) { /* check if one of the targets exists */ NULSTR_FOREACH(s, table[i].target) { @@ -86,7 +85,7 @@ Index: systemd-stable/src/shared/base-filesystem.c continue; /* check if a specific file exists at the target path */ -@@ -73,7 +73,7 @@ int base_filesystem_create(const char *r +@@ -164,7 +164,7 @@ int base_filesystem_create_fd(int fd, const char *root, uid_t uid, gid_t gid) { if (!p) return log_oom(); @@ -95,3 +94,6 @@ Index: systemd-stable/src/shared/base-filesystem.c continue; } +-- +2.34.1 + diff --git a/meta/recipes-core/systemd/systemd/0008-Define-glibc-compatible-basename-for-non-glibc-syste.patch b/meta/recipes-core/systemd/systemd/0008-Define-glibc-compatible-basename-for-non-glibc-syste.patch new file mode 100644 index 0000000000..c1a8bb19fe --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0008-Define-glibc-compatible-basename-for-non-glibc-syste.patch @@ -0,0 +1,34 @@ +From bab07e779ff23d5593bb118efaaa31b60a6dce87 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Sun, 27 May 2018 08:36:44 -0700 +Subject: [PATCH 08/22] Define glibc compatible basename() for non-glibc + systems + +Fixes builds with musl, even though systemd is adamant about +using non-posix basename implementation, we have a way out + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + src/basic/string-util.h | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/basic/string-util.h b/src/basic/string-util.h +index b6d8be3083..0a29036c4c 100644 +--- a/src/basic/string-util.h ++++ b/src/basic/string-util.h +@@ -26,6 +26,10 @@ + #define URI_UNRESERVED ALPHANUMERICAL "-._~" /* [RFC3986] */ + #define URI_VALID URI_RESERVED URI_UNRESERVED /* [RFC3986] */ + ++#if !defined(__GLIBC__) ++#define basename(src) (strrchr(src,'/') ? strrchr(src,'/')+1 : src) ++#endif ++ + static inline char* strstr_ptr(const char *haystack, const char *needle) { + if (!haystack || !needle) + return NULL; +-- +2.34.1 + diff --git a/meta/recipes-core/systemd/systemd/0008-add-missing-FTW_-macros-for-musl.patch b/meta/recipes-core/systemd/systemd/0008-add-missing-FTW_-macros-for-musl.patch deleted file mode 100644 index 1f618932ea..0000000000 --- a/meta/recipes-core/systemd/systemd/0008-add-missing-FTW_-macros-for-musl.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 7c440cfc53aa52c9dc91c3a8c105bcf314c53af6 Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Mon, 25 Feb 2019 15:00:06 +0800 -Subject: [PATCH] add missing FTW_ macros for musl - -This is to avoid build failures like below for musl. - - locale-util.c:296:24: error: 'FTW_STOP' undeclared - -Upstream-Status: Inappropriate [musl specific] - -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> - ---- - src/basic/missing_type.h | 20 ++++++++++++++++++++ - 1 file changed, 20 insertions(+) - -diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h -index c487e65e7bde..23602ebbd533 100644 ---- a/src/basic/missing_type.h -+++ b/src/basic/missing_type.h -@@ -19,3 +19,23 @@ typedef int (*comparison_fn_t)(const void *, const void *); - #define __COMPAR_FN_T - typedef int (*__compar_fn_t)(const void *, const void *); - #endif -+ -+#ifndef FTW_ACTIONRETVAL -+#define FTW_ACTIONRETVAL 16 -+#endif -+ -+#ifndef FTW_CONTINUE -+#define FTW_CONTINUE 0 -+#endif -+ -+#ifndef FTW_STOP -+#define FTW_STOP 1 -+#endif -+ -+#ifndef FTW_SKIP_SUBTREE -+#define FTW_SKIP_SUBTREE 2 -+#endif -+ -+#ifndef FTW_SKIP_SIBLINGS -+#define FTW_SKIP_SIBLINGS 3 -+#endif diff --git a/meta/recipes-core/systemd/systemd/0003-implment-systemd-sysv-install-for-OE.patch b/meta/recipes-core/systemd/systemd/0008-implment-systemd-sysv-install-for-OE.patch index c6204786b3..acff18dc43 100644 --- a/meta/recipes-core/systemd/systemd/0003-implment-systemd-sysv-install-for-OE.patch +++ b/meta/recipes-core/systemd/systemd/0008-implment-systemd-sysv-install-for-OE.patch @@ -1,4 +1,4 @@ -From f9078501a1495c9991431d1435d081cd2e830328 Mon Sep 17 00:00:00 2001 +From 5712d56f1cd654d2e5d2e9117ff77fe4c299f76b Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Sat, 5 Sep 2015 06:31:47 +0000 Subject: [PATCH] implment systemd-sysv-install for OE @@ -9,16 +9,15 @@ to check the status of the sysv service Upstream-Status: Inappropriate [OE-Specific] Signed-off-by: Khem Raj <raj.khem@gmail.com> - --- src/systemctl/systemd-sysv-install.SKELETON | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/systemctl/systemd-sysv-install.SKELETON b/src/systemctl/systemd-sysv-install.SKELETON -index 8c16cf99913f..9f078a121469 100755 +index cb58d8243b..000bdf6165 100755 --- a/src/systemctl/systemd-sysv-install.SKELETON +++ b/src/systemctl/systemd-sysv-install.SKELETON -@@ -32,17 +32,17 @@ case "$1" in +@@ -34,17 +34,17 @@ case "$1" in enable) # call the command to enable SysV init script $NAME here # (consider optional $ROOT) @@ -39,3 +38,6 @@ index 8c16cf99913f..9f078a121469 100755 ;; *) usage ;; +-- +2.39.2 + diff --git a/meta/recipes-core/systemd/systemd/0017-Do-not-disable-buffering-when-writing-to-oom_score_a.patch b/meta/recipes-core/systemd/systemd/0009-Do-not-disable-buffering-when-writing-to-oom_score_a.patch index 3d456ec83a..3ff0177ae3 100644 --- a/meta/recipes-core/systemd/systemd/0017-Do-not-disable-buffering-when-writing-to-oom_score_a.patch +++ b/meta/recipes-core/systemd/systemd/0009-Do-not-disable-buffering-when-writing-to-oom_score_a.patch @@ -1,7 +1,7 @@ -From bb28a9c870bb47dcdb1ccebaa8e3a5a86730a244 Mon Sep 17 00:00:00 2001 +From 25093c5017725b8577c444dfea0f42ad85b43522 Mon Sep 17 00:00:00 2001 From: Chen Qi <Qi.Chen@windriver.com> Date: Wed, 4 Jul 2018 15:00:44 +0800 -Subject: [PATCH] Do not disable buffering when writing to oom_score_adj +Subject: [PATCH 09/22] Do not disable buffering when writing to oom_score_adj On musl, disabling buffering when writing to oom_score_adj will cause the following error. @@ -19,21 +19,23 @@ Upstream-Status: Inappropriate [musl specific] Signed-off-by: Chen Qi <Qi.Chen@windriver.com> [rebased for systemd 243] Signed-off-by: Scott Murray <scott.murray@konsulko.com> - --- src/basic/process-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -Index: systemd-stable/src/basic/process-util.c -=================================================================== ---- systemd-stable.orig/src/basic/process-util.c -+++ systemd-stable/src/basic/process-util.c -@@ -1536,7 +1536,7 @@ int set_oom_score_adjust(int value) { - sprintf(t, "%i", value); +diff --git a/src/basic/process-util.c b/src/basic/process-util.c +index 201c5596ae..ea51595b6c 100644 +--- a/src/basic/process-util.c ++++ b/src/basic/process-util.c +@@ -1716,7 +1716,7 @@ int set_oom_score_adjust(int value) { + xsprintf(t, "%i", value); return write_string_file("/proc/self/oom_score_adj", t, - WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_DISABLE_BUFFER); + WRITE_STRING_FILE_VERIFY_ON_FAILURE); } - int pidfd_get_pid(int fd, pid_t *ret) { + int get_oom_score_adjust(int *ret) { +-- +2.34.1 + diff --git a/meta/recipes-core/systemd/systemd/0018-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch b/meta/recipes-core/systemd/systemd/0010-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch index 48fd007e11..cf59ac7d06 100644 --- a/meta/recipes-core/systemd/systemd/0018-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch +++ b/meta/recipes-core/systemd/systemd/0010-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch @@ -1,7 +1,7 @@ -From 4938705454cf46cfe8deac8ce457d5d2432cbead Mon Sep 17 00:00:00 2001 +From 2adbe9773cd65c48eec9df96868d4a738927c8d9 Mon Sep 17 00:00:00 2001 From: Chen Qi <Qi.Chen@windriver.com> Date: Tue, 10 Jul 2018 15:40:17 +0800 -Subject: [PATCH] distinguish XSI-compliant strerror_r from GNU-specifi +Subject: [PATCH 10/22] distinguish XSI-compliant strerror_r from GNU-specifi strerror_r XSI-compliant strerror_r and GNU-specifi strerror_r are different. @@ -18,34 +18,16 @@ assigned to (char *) variable, resulting in segment fault. Upstream-Status: Inappropriate [musl specific] Signed-off-by: Chen Qi <Qi.Chen@windriver.com> - --- - src/journal/journal-send.c | 5 +++++ - src/libsystemd/sd-bus/bus-error.c | 5 +++++ - 2 files changed, 10 insertions(+) - -Index: systemd-stable/src/journal/journal-send.c -=================================================================== ---- systemd-stable.orig/src/journal/journal-send.c -+++ systemd-stable/src/journal/journal-send.c -@@ -348,7 +348,12 @@ static int fill_iovec_perror_and_send(co - char* j; - - errno = 0; -+#ifndef __GLIBC__ -+ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k); -+ j = buffer + 8 + k; -+#else - j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k); -+#endif - if (errno == 0) { - char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1]; - -Index: systemd-stable/src/libsystemd/sd-bus/bus-error.c -=================================================================== ---- systemd-stable.orig/src/libsystemd/sd-bus/bus-error.c -+++ systemd-stable/src/libsystemd/sd-bus/bus-error.c -@@ -379,7 +379,12 @@ static void bus_error_strerror(sd_bus_er + src/libsystemd/sd-bus/bus-error.c | 11 ++++++++++- + src/libsystemd/sd-journal/journal-send.c | 5 +++++ + 2 files changed, 15 insertions(+), 1 deletion(-) + +diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c +index 77b2e1a0fd..fdba0e0142 100644 +--- a/src/libsystemd/sd-bus/bus-error.c ++++ b/src/libsystemd/sd-bus/bus-error.c +@@ -408,7 +408,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) { return; errno = 0; @@ -58,3 +40,37 @@ Index: systemd-stable/src/libsystemd/sd-bus/bus-error.c if (errno == ERANGE || strlen(x) >= k - 1) { free(m); k *= 2; +@@ -593,8 +598,12 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static + + if (e && e->message) + return e->message; +- ++#ifndef __GLIBC__ ++ strerror_r(abs(error), buf, ERRNO_BUF_LEN); ++ return buf; ++#else + return strerror_r(abs(error), buf, ERRNO_BUF_LEN); ++#endif + } + + static bool map_ok(const sd_bus_error_map *map) { +diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c +index 69a2eb6404..1561859650 100644 +--- a/src/libsystemd/sd-journal/journal-send.c ++++ b/src/libsystemd/sd-journal/journal-send.c +@@ -361,7 +361,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove + char* j; + + errno = 0; ++#ifndef __GLIBC__ ++ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k); ++ j = buffer + 8 + k; ++#else + j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k); ++#endif + if (errno == 0) { + char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1]; + +-- +2.34.1 + diff --git a/meta/recipes-core/systemd/systemd/0010-fix-missing-of-__register_atfork-for-non-glibc-build.patch b/meta/recipes-core/systemd/systemd/0010-fix-missing-of-__register_atfork-for-non-glibc-build.patch deleted file mode 100644 index 15055161fc..0000000000 --- a/meta/recipes-core/systemd/systemd/0010-fix-missing-of-__register_atfork-for-non-glibc-build.patch +++ /dev/null @@ -1,43 +0,0 @@ -From eed7427db98cc01db7e9b3479655d68b044bc85b Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Mon, 25 Feb 2019 15:03:47 +0800 -Subject: [PATCH] fix missing of __register_atfork for non-glibc builds - -Upstream-Status: Inappropriate [musl specific] - -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> - ---- - src/basic/process-util.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -Index: systemd-stable/src/basic/process-util.c -=================================================================== ---- systemd-stable.orig/src/basic/process-util.c -+++ systemd-stable/src/basic/process-util.c -@@ -18,6 +18,9 @@ - #if HAVE_VALGRIND_VALGRIND_H - #include <valgrind/valgrind.h> - #endif -+#ifndef __GLIBC__ -+#include <pthread.h> -+#endif - - #include "alloc-util.h" - #include "architecture.h" -@@ -1143,11 +1146,15 @@ void reset_cached_pid(void) { - cached_pid = CACHED_PID_UNSET; - } - -+#ifdef __GLIBC__ - /* We use glibc __register_atfork() + __dso_handle directly here, as they are not included in the glibc - * headers. __register_atfork() is mostly equivalent to pthread_atfork(), but doesn't require us to link against - * libpthread, as it is part of glibc anyway. */ - extern int __register_atfork(void (*prepare) (void), void (*parent) (void), void (*child) (void), void *dso_handle); - extern void* __dso_handle _weak_; -+#else -+#define __register_atfork(prepare,parent,child,dso) pthread_atfork(prepare,parent,child) -+#endif - - pid_t getpid_cached(void) { - static bool installed = false; diff --git a/meta/recipes-core/systemd/systemd/0011-Use-uintmax_t-for-handling-rlim_t.patch b/meta/recipes-core/systemd/systemd/0011-Use-uintmax_t-for-handling-rlim_t.patch deleted file mode 100644 index a6fcd2f5da..0000000000 --- a/meta/recipes-core/systemd/systemd/0011-Use-uintmax_t-for-handling-rlim_t.patch +++ /dev/null @@ -1,95 +0,0 @@ -From 4aa91347ae975051dbe4dd2f98a1f4f459f2604f Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Mon, 25 Feb 2019 15:12:41 +0800 -Subject: [PATCH] Use uintmax_t for handling rlim_t - -PRIu{32,64} is not right format to represent rlim_t type -therefore use %ju and typecast the rlim_t variables to -uintmax_t. - -Fixes portablility errors like - -execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=] -| fprintf(f, "%s%s: " RLIM_FMT "\n", -| ^~~~~~~~ -| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max); -| ~~~~~~~~~~~~~~~~~~~~~~ - -Upstream-Status: Denied [https://github.com/systemd/systemd/pull/7199] - -Signed-off-by: Khem Raj <raj.khem@gmail.com> -[Rebased for v241] -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> - ---- - src/basic/format-util.h | 8 +------- - src/basic/rlimit-util.c | 10 +++++----- - src/core/execute.c | 4 ++-- - 3 files changed, 8 insertions(+), 14 deletions(-) - -Index: systemd-stable/src/basic/format-util.h -=================================================================== ---- systemd-stable.orig/src/basic/format-util.h -+++ systemd-stable/src/basic/format-util.h -@@ -32,13 +32,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32 - # define PRI_TIMEX "li" - #endif - --#if SIZEOF_RLIM_T == 8 --# define RLIM_FMT "%" PRIu64 --#elif SIZEOF_RLIM_T == 4 --# define RLIM_FMT "%" PRIu32 --#else --# error Unknown rlim_t size --#endif -+#define RLIM_FMT "%ju" - - #if SIZEOF_DEV_T == 8 - # define DEV_FMT "%" PRIu64 -Index: systemd-stable/src/basic/rlimit-util.c -=================================================================== ---- systemd-stable.orig/src/basic/rlimit-util.c -+++ systemd-stable/src/basic/rlimit-util.c -@@ -306,13 +306,13 @@ int rlimit_format(const struct rlimit *r - if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY) - s = strdup("infinity"); - else if (rl->rlim_cur >= RLIM_INFINITY) -- (void) asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max); -+ (void) asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max); - else if (rl->rlim_max >= RLIM_INFINITY) -- (void) asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur); -+ (void) asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur); - else if (rl->rlim_cur == rl->rlim_max) -- (void) asprintf(&s, RLIM_FMT, rl->rlim_cur); -+ (void) asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur); - else -- (void) asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max); -+ (void) asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max); - - if (!s) - return -ENOMEM; -@@ -403,7 +403,7 @@ int rlimit_nofile_safe(void) { - - rl.rlim_cur = FD_SETSIZE; - if (setrlimit(RLIMIT_NOFILE, &rl) < 0) -- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur); -+ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur); - - return 1; - } -Index: systemd-stable/src/core/execute.c -=================================================================== ---- systemd-stable.orig/src/core/execute.c -+++ systemd-stable/src/core/execute.c -@@ -4686,9 +4686,9 @@ void exec_context_dump(const ExecContext - for (i = 0; i < RLIM_NLIMITS; i++) - if (c->rlimit[i]) { - fprintf(f, "%sLimit%s: " RLIM_FMT "\n", -- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max); -+ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max); - fprintf(f, "%sLimit%sSoft: " RLIM_FMT "\n", -- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur); -+ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur); - } - - if (c->ioprio_set) { diff --git a/meta/recipes-core/systemd/systemd/0021-avoid-redefinition-of-prctl_mm_map-structure.patch b/meta/recipes-core/systemd/systemd/0011-avoid-redefinition-of-prctl_mm_map-structure.patch index 7dacc36837..e481b2e2e4 100644 --- a/meta/recipes-core/systemd/systemd/0021-avoid-redefinition-of-prctl_mm_map-structure.patch +++ b/meta/recipes-core/systemd/systemd/0011-avoid-redefinition-of-prctl_mm_map-structure.patch @@ -1,7 +1,7 @@ -From 6364ff5534678c158a7fb8d4e50d0a6ce72c1ad8 Mon Sep 17 00:00:00 2001 +From 49c446cfb78cf74a909bed8c3798b77a5469866a Mon Sep 17 00:00:00 2001 From: Chen Qi <Qi.Chen@windriver.com> Date: Mon, 25 Feb 2019 15:44:54 +0800 -Subject: [PATCH] avoid redefinition of prctl_mm_map structure +Subject: [PATCH 11/22] avoid redefinition of prctl_mm_map structure Fix the following compile failure: error: redefinition of 'struct prctl_mm_map' @@ -9,17 +9,16 @@ error: redefinition of 'struct prctl_mm_map' Upstream-Status: Inappropriate [musl specific] Signed-off-by: Chen Qi <Qi.Chen@windriver.com> - --- src/basic/missing_prctl.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h -index f80cd17f346b..47e489354053 100644 +index 7d9e395c92..88c2d7dfac 100644 --- a/src/basic/missing_prctl.h +++ b/src/basic/missing_prctl.h @@ -1,7 +1,9 @@ - /* SPDX-License-Identifier: LGPL-2.1+ */ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once +#ifdef __GLIBC__ @@ -28,3 +27,6 @@ index f80cd17f346b..47e489354053 100644 /* 58319057b7847667f0c9585b9de0e8932b0fdb08 (4.3) */ #ifndef PR_CAP_AMBIENT +-- +2.34.1 + diff --git a/meta/recipes-core/systemd/systemd/0012-do-not-disable-buffer-in-writing-files.patch b/meta/recipes-core/systemd/systemd/0012-do-not-disable-buffer-in-writing-files.patch new file mode 100644 index 0000000000..66be79077e --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0012-do-not-disable-buffer-in-writing-files.patch @@ -0,0 +1,562 @@ +From e4885a8e60f883d9217e26e1db3754c2906aca31 Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Fri, 1 Mar 2019 15:22:15 +0800 +Subject: [PATCH 12/22] do not disable buffer in writing files + +Do not disable buffer in writing files, otherwise we get +failure at boot for musl like below. + + [!!!!!!] Failed to allocate manager object. + +And there will be other failures, critical or not critical. +This is specific to musl. + +Upstream-Status: Inappropriate [musl] + +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +[Rebased for v242] +Signed-off-by: Andrej Valek <andrej.valek@siemens.com> +[rebased for systemd 243] +Signed-off-by: Scott Murray <scott.murray@konsulko.com> +[rebased for systemd 254] +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +[rebased for systemd 255.1] +--- + src/basic/cgroup-util.c | 12 ++++++------ + src/basic/namespace-util.c | 4 ++-- + src/basic/procfs-util.c | 4 ++-- + src/basic/sysctl-util.c | 2 +- + src/binfmt/binfmt.c | 6 +++--- + src/core/cgroup.c | 2 +- + src/core/main.c | 2 +- + src/core/smack-setup.c | 8 ++++---- + src/home/homework.c | 2 +- + src/libsystemd/sd-device/sd-device.c | 2 +- + src/nspawn/nspawn-cgroup.c | 2 +- + src/nspawn/nspawn.c | 6 +++--- + src/shared/binfmt-util.c | 2 +- + src/shared/cgroup-setup.c | 4 ++-- + src/shared/coredump-util.c | 4 ++-- + src/shared/hibernate-util.c | 4 ++-- + src/shared/smack-util.c | 2 +- + src/shared/watchdog.c | 2 +- + src/sleep/sleep.c | 4 ++-- + src/storagetm/storagetm.c | 24 ++++++++++++------------ + src/udev/udev-rules.c | 1 - + src/vconsole/vconsole-setup.c | 2 +- + 22 files changed, 50 insertions(+), 51 deletions(-) + +diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c +index d2be79622f..e65fecb68d 100644 +--- a/src/basic/cgroup-util.c ++++ b/src/basic/cgroup-util.c +@@ -417,7 +417,7 @@ int cg_kill_kernel_sigkill(const char *path) { + if (r < 0) + return r; + +- r = write_string_file(killfile, "1", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(killfile, "1", 0); + if (r < 0) + return r; + +@@ -843,7 +843,7 @@ int cg_install_release_agent(const char *controller, const char *agent) { + + sc = strstrip(contents); + if (isempty(sc)) { +- r = write_string_file(fs, agent, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(fs, agent, 0); + if (r < 0) + return r; + } else if (!path_equal(sc, agent)) +@@ -861,7 +861,7 @@ int cg_install_release_agent(const char *controller, const char *agent) { + + sc = strstrip(contents); + if (streq(sc, "0")) { +- r = write_string_file(fs, "1", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(fs, "1", 0); + if (r < 0) + return r; + +@@ -888,7 +888,7 @@ int cg_uninstall_release_agent(const char *controller) { + if (r < 0) + return r; + +- r = write_string_file(fs, "0", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(fs, "0", 0); + if (r < 0) + return r; + +@@ -898,7 +898,7 @@ int cg_uninstall_release_agent(const char *controller) { + if (r < 0) + return r; + +- r = write_string_file(fs, "", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(fs, "", 0); + if (r < 0) + return r; + +@@ -1814,7 +1814,7 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri + if (r < 0) + return r; + +- return write_string_file(p, value, WRITE_STRING_FILE_DISABLE_BUFFER); ++ return write_string_file(p, value, 0); + } + + int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret) { +diff --git a/src/basic/namespace-util.c b/src/basic/namespace-util.c +index 2101f617ad..63817bae17 100644 +--- a/src/basic/namespace-util.c ++++ b/src/basic/namespace-util.c +@@ -227,12 +227,12 @@ int userns_acquire(const char *uid_map, const char *gid_map) { + freeze(); + + xsprintf(path, "/proc/" PID_FMT "/uid_map", pid); +- r = write_string_file(path, uid_map, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(path, uid_map, 0); + if (r < 0) + return log_error_errno(r, "Failed to write UID map: %m"); + + xsprintf(path, "/proc/" PID_FMT "/gid_map", pid); +- r = write_string_file(path, gid_map, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(path, gid_map, 0); + if (r < 0) + return log_error_errno(r, "Failed to write GID map: %m"); + +diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c +index 6cb0ddf575..247cf9e1d1 100644 +--- a/src/basic/procfs-util.c ++++ b/src/basic/procfs-util.c +@@ -64,13 +64,13 @@ int procfs_tasks_set_limit(uint64_t limit) { + * decrease it, as threads-max is the much more relevant sysctl. */ + if (limit > pid_max-1) { + sprintf(buffer, "%" PRIu64, limit+1); /* Add one, since PID 0 is not a valid PID */ +- r = write_string_file("/proc/sys/kernel/pid_max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/sys/kernel/pid_max", buffer, 0); + if (r < 0) + return r; + } + + sprintf(buffer, "%" PRIu64, limit); +- r = write_string_file("/proc/sys/kernel/threads-max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/sys/kernel/threads-max", buffer, 0); + if (r < 0) { + uint64_t threads_max; + +diff --git a/src/basic/sysctl-util.c b/src/basic/sysctl-util.c +index b66a6622ae..8d1c93008a 100644 +--- a/src/basic/sysctl-util.c ++++ b/src/basic/sysctl-util.c +@@ -58,7 +58,7 @@ int sysctl_write(const char *property, const char *value) { + + log_debug("Setting '%s' to '%s'", p, value); + +- return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_SUPPRESS_REDUNDANT_VIRTUAL); ++ return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_SUPPRESS_REDUNDANT_VIRTUAL); + } + + int sysctl_writef(const char *property, const char *format, ...) { +diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c +index d21f3f79ff..258607cc7e 100644 +--- a/src/binfmt/binfmt.c ++++ b/src/binfmt/binfmt.c +@@ -30,7 +30,7 @@ static bool arg_unregister = false; + + static int delete_rule(const char *rulename) { + const char *fn = strjoina("/proc/sys/fs/binfmt_misc/", rulename); +- return write_string_file(fn, "-1", WRITE_STRING_FILE_DISABLE_BUFFER); ++ return write_string_file(fn, "-1", 0); + } + + static int apply_rule(const char *filename, unsigned line, const char *rule) { +@@ -58,7 +58,7 @@ static int apply_rule(const char *filename, unsigned line, const char *rule) { + if (r >= 0) + log_debug("%s:%u: Rule '%s' deleted.", filename, line, rulename); + +- r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, 0); + if (r < 0) + return log_error_errno(r, "%s:%u: Failed to add binary format '%s': %m", + filename, line, rulename); +@@ -248,7 +248,7 @@ static int run(int argc, char *argv[]) { + return r; + + /* Flush out all rules */ +- r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0); + if (r < 0) + log_warning_errno(r, "Failed to flush binfmt_misc rules, ignoring: %m"); + else +diff --git a/src/core/cgroup.c b/src/core/cgroup.c +index 61ac4df1a6..ea18970196 100644 +--- a/src/core/cgroup.c ++++ b/src/core/cgroup.c +@@ -4578,7 +4578,7 @@ int unit_cgroup_freezer_action(Unit *u, FreezerAction action) { + u->freezer_state = FREEZER_THAWING; + } + +- r = write_string_file(path, one_zero(action == FREEZER_FREEZE), WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(path, one_zero(action == FREEZER_FREEZE), 0); + if (r < 0) + return r; + +diff --git a/src/core/main.c b/src/core/main.c +index 3f71cc0947..0e5aec3e9e 100644 +--- a/src/core/main.c ++++ b/src/core/main.c +@@ -1678,7 +1678,7 @@ static void initialize_core_pattern(bool skip_setup) { + if (getpid_cached() != 1) + return; + +- r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, 0); + if (r < 0) + log_warning_errno(r, "Failed to write '%s' to /proc/sys/kernel/core_pattern, ignoring: %m", + arg_early_core_pattern); +diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c +index 7ea902b6f9..1aef2988d0 100644 +--- a/src/core/smack-setup.c ++++ b/src/core/smack-setup.c +@@ -321,17 +321,17 @@ int mac_smack_setup(bool *loaded_policy) { + } + + #if HAVE_SMACK_RUN_LABEL +- r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, 0); + if (r < 0) + log_warning_errno(r, "Failed to set SMACK label \"" SMACK_RUN_LABEL "\" on self: %m"); +- r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, 0); + if (r < 0) + log_warning_errno(r, "Failed to set SMACK ambient label \"" SMACK_RUN_LABEL "\": %m"); + r = write_string_file("/sys/fs/smackfs/netlabel", +- "0.0.0.0/0 " SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); ++ "0.0.0.0/0 " SMACK_RUN_LABEL, 0); + if (r < 0) + log_warning_errno(r, "Failed to set SMACK netlabel rule \"0.0.0.0/0 " SMACK_RUN_LABEL "\": %m"); +- r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", 0); + if (r < 0) + log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m"); + #endif +diff --git a/src/home/homework.c b/src/home/homework.c +index 066483e342..5f92dd7064 100644 +--- a/src/home/homework.c ++++ b/src/home/homework.c +@@ -278,7 +278,7 @@ static void drop_caches_now(void) { + * for details. We write "2" into /proc/sys/vm/drop_caches to ensure dentries/inodes are flushed, but + * not more. */ + +- r = write_string_file("/proc/sys/vm/drop_caches", "2\n", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/sys/vm/drop_caches", "2\n", 0); + if (r < 0) + log_warning_errno(r, "Failed to drop caches, ignoring: %m"); + else +diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c +index 2fbc619a34..09d9591e37 100644 +--- a/src/libsystemd/sd-device/sd-device.c ++++ b/src/libsystemd/sd-device/sd-device.c +@@ -2516,7 +2516,7 @@ _public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr, + if (!value) + return -ENOMEM; + +- r = write_string_file(path, value, WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_NOFOLLOW); ++ r = write_string_file(path, value, 0 | WRITE_STRING_FILE_NOFOLLOW); + if (r < 0) { + /* On failure, clear cache entry, as we do not know how it fails. */ + device_remove_cached_sysattr_value(device, sysattr); +diff --git a/src/nspawn/nspawn-cgroup.c b/src/nspawn/nspawn-cgroup.c +index a5002437c6..b12e6cd9c9 100644 +--- a/src/nspawn/nspawn-cgroup.c ++++ b/src/nspawn/nspawn-cgroup.c +@@ -124,7 +124,7 @@ int sync_cgroup(pid_t pid, CGroupUnified unified_requested, uid_t uid_shift) { + fn = strjoina(tree, cgroup, "/cgroup.procs"); + + sprintf(pid_string, PID_FMT, pid); +- r = write_string_file(fn, pid_string, WRITE_STRING_FILE_DISABLE_BUFFER|WRITE_STRING_FILE_MKDIR_0755); ++ r = write_string_file(fn, pid_string, WRITE_STRING_FILE_MKDIR_0755); + if (r < 0) { + log_error_errno(r, "Failed to move process: %m"); + goto finish; +diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c +index 6ab604d3dc..bbec6b686c 100644 +--- a/src/nspawn/nspawn.c ++++ b/src/nspawn/nspawn.c +@@ -2688,7 +2688,7 @@ static int reset_audit_loginuid(void) { + if (streq(p, "4294967295")) + return 0; + +- r = write_string_file("/proc/self/loginuid", "4294967295", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/self/loginuid", "4294967295", 0); + if (r < 0) { + log_error_errno(r, + "Failed to reset audit login UID. This probably means that your kernel is too\n" +@@ -4141,7 +4141,7 @@ static int setup_uid_map( + return log_oom(); + + xsprintf(uid_map, "/proc/" PID_FMT "/uid_map", pid); +- r = write_string_file(uid_map, s, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(uid_map, s, 0); + if (r < 0) + return log_error_errno(r, "Failed to write UID map: %m"); + +@@ -4151,7 +4151,7 @@ static int setup_uid_map( + return log_oom(); + + xsprintf(uid_map, "/proc/" PID_FMT "/gid_map", pid); +- r = write_string_file(uid_map, s, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(uid_map, s, 0); + if (r < 0) + return log_error_errno(r, "Failed to write GID map: %m"); + +diff --git a/src/shared/binfmt-util.c b/src/shared/binfmt-util.c +index a26175474b..1413a9c72c 100644 +--- a/src/shared/binfmt-util.c ++++ b/src/shared/binfmt-util.c +@@ -46,7 +46,7 @@ int disable_binfmt(void) { + return 0; + } + +- r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0); + if (r < 0) + return log_warning_errno(r, "Failed to unregister binfmt_misc entries: %m"); + +diff --git a/src/shared/cgroup-setup.c b/src/shared/cgroup-setup.c +index 934a16eaf3..c921ced861 100644 +--- a/src/shared/cgroup-setup.c ++++ b/src/shared/cgroup-setup.c +@@ -351,7 +351,7 @@ int cg_attach(const char *controller, const char *path, pid_t pid) { + + xsprintf(c, PID_FMT "\n", pid); + +- r = write_string_file(fs, c, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(fs, c, 0); + if (r == -EOPNOTSUPP && cg_is_threaded(path) > 0) + /* When the threaded mode is used, we cannot read/write the file. Let's return recognizable error. */ + return -EUCLEAN; +@@ -966,7 +966,7 @@ int cg_enable_everywhere( + return log_debug_errno(errno, "Failed to open cgroup.subtree_control file of %s: %m", p); + } + +- r = write_string_stream(f, s, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_stream(f, s, 0); + if (r < 0) { + log_debug_errno(r, "Failed to %s controller %s for %s (%s): %m", + FLAGS_SET(mask, bit) ? "enable" : "disable", n, p, fs); +diff --git a/src/shared/coredump-util.c b/src/shared/coredump-util.c +index 805503f366..01a7ccb291 100644 +--- a/src/shared/coredump-util.c ++++ b/src/shared/coredump-util.c +@@ -163,7 +163,7 @@ int set_coredump_filter(uint64_t value) { + xsprintf(t, "0x%"PRIx64, value); + + return write_string_file("/proc/self/coredump_filter", t, +- WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_DISABLE_BUFFER); ++ 0); + } + + /* Turn off core dumps but only if we're running outside of a container. */ +@@ -173,7 +173,7 @@ void disable_coredumps(void) { + if (detect_container() > 0) + return; + +- r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", 0); + if (r < 0) + log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m"); + } +diff --git a/src/shared/hibernate-util.c b/src/shared/hibernate-util.c +index 3eb13d48f6..d09b901be1 100644 +--- a/src/shared/hibernate-util.c ++++ b/src/shared/hibernate-util.c +@@ -481,7 +481,7 @@ int write_resume_config(dev_t devno, uint64_t offset, const char *device) { + + /* We write the offset first since it's safer. Note that this file is only available in 4.17+, so + * fail gracefully if it doesn't exist and we're only overwriting it with 0. */ +- r = write_string_file("/sys/power/resume_offset", offset_str, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/sys/power/resume_offset", offset_str, 0); + if (r == -ENOENT) { + if (offset != 0) + return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), +@@ -497,7 +497,7 @@ int write_resume_config(dev_t devno, uint64_t offset, const char *device) { + log_debug("Wrote resume_offset=%s for device '%s' to /sys/power/resume_offset.", + offset_str, device); + +- r = write_string_file("/sys/power/resume", devno_str, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/sys/power/resume", devno_str, 0); + if (r < 0) + return log_error_errno(r, + "Failed to write device '%s' (%s) to /sys/power/resume: %m", +diff --git a/src/shared/smack-util.c b/src/shared/smack-util.c +index 1f88e724d0..feb18b320a 100644 +--- a/src/shared/smack-util.c ++++ b/src/shared/smack-util.c +@@ -113,7 +113,7 @@ int mac_smack_apply_pid(pid_t pid, const char *label) { + return 0; + + p = procfs_file_alloca(pid, "attr/current"); +- r = write_string_file(p, label, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(p, label, 0); + if (r < 0) + return r; + +diff --git a/src/shared/watchdog.c b/src/shared/watchdog.c +index 4c1a968718..6faf6806a5 100644 +--- a/src/shared/watchdog.c ++++ b/src/shared/watchdog.c +@@ -93,7 +93,7 @@ static int set_pretimeout_governor(const char *governor) { + + r = write_string_file(sys_fn, + governor, +- WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_VERIFY_IGNORE_NEWLINE); ++ WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_VERIFY_IGNORE_NEWLINE); + if (r < 0) + return log_error_errno(r, "Failed to set pretimeout_governor to '%s': %m", governor); + +diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c +index 21af3e9e52..6d4b84b5d5 100644 +--- a/src/sleep/sleep.c ++++ b/src/sleep/sleep.c +@@ -137,7 +137,7 @@ static int write_state(int fd, char * const *states) { + if (k < 0) + return RET_GATHER(r, k); + +- k = write_string_stream(f, *state, WRITE_STRING_FILE_DISABLE_BUFFER); ++ k = write_string_stream(f, *state, 0); + if (k >= 0) { + log_debug("Using sleep state '%s'.", *state); + return 0; +@@ -155,7 +155,7 @@ static int write_mode(char * const *modes) { + STRV_FOREACH(mode, modes) { + int k; + +- k = write_string_file("/sys/power/disk", *mode, WRITE_STRING_FILE_DISABLE_BUFFER); ++ k = write_string_file("/sys/power/disk", *mode, 0); + if (k >= 0) { + log_debug("Using sleep disk mode '%s'.", *mode); + return 0; +diff --git a/src/storagetm/storagetm.c b/src/storagetm/storagetm.c +index ae63baaf79..82eeca479a 100644 +--- a/src/storagetm/storagetm.c ++++ b/src/storagetm/storagetm.c +@@ -186,7 +186,7 @@ static int nvme_subsystem_unlink(NvmeSubsystem *s) { + if (!enable_fn) + return log_oom(); + +- r = write_string_file_at(namespaces_fd, enable_fn, "0", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file_at(namespaces_fd, enable_fn, "0", 0); + if (r < 0) + log_warning_errno(r, "Failed to disable namespace '%s' of NVME subsystem '%s', ignoring: %m", e->d_name, s->name); + +@@ -254,7 +254,7 @@ static int nvme_subsystem_write_metadata(int subsystem_fd, sd_device *device) { + _cleanup_free_ char *truncated = strndup(w, 40); /* kernel refuses more than 40 chars (as per nvme spec) */ + + /* The default string stored in 'attr_model' is "Linux" btw. */ +- r = write_string_file_at(subsystem_fd, "attr_model", truncated, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file_at(subsystem_fd, "attr_model", truncated, 0); + if (r < 0) + log_warning_errno(r, "Failed to set model of subsystem to '%s', ignoring: %m", w); + } +@@ -268,7 +268,7 @@ static int nvme_subsystem_write_metadata(int subsystem_fd, sd_device *device) { + return log_oom(); + + /* The default string stored in 'attr_firmware' is `uname -r` btw, but truncated to 8 chars. */ +- r = write_string_file_at(subsystem_fd, "attr_firmware", truncated, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file_at(subsystem_fd, "attr_firmware", truncated, 0); + if (r < 0) + log_warning_errno(r, "Failed to set model of subsystem to '%s', ignoring: %m", truncated); + } +@@ -295,7 +295,7 @@ static int nvme_subsystem_write_metadata(int subsystem_fd, sd_device *device) { + if (!truncated) + return log_oom(); + +- r = write_string_file_at(subsystem_fd, "attr_serial", truncated, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file_at(subsystem_fd, "attr_serial", truncated, 0); + if (r < 0) + log_warning_errno(r, "Failed to set serial of subsystem to '%s', ignoring: %m", truncated); + } +@@ -345,7 +345,7 @@ static int nvme_namespace_write_metadata(int namespace_fd, sd_device *device, co + id = id128_digest(j, l); + } + +- r = write_string_file_at(namespace_fd, "device_uuid", SD_ID128_TO_UUID_STRING(id), WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file_at(namespace_fd, "device_uuid", SD_ID128_TO_UUID_STRING(id), 0); + if (r < 0) + log_warning_errno(r, "Failed to set uuid of namespace to '%s', ignoring: %m", SD_ID128_TO_UUID_STRING(id)); + +@@ -408,7 +408,7 @@ static int nvme_subsystem_add(const char *node, int consumed_fd, sd_device *devi + if (subsystem_fd < 0) + return log_error_errno(subsystem_fd, "Failed to create NVME subsystem '%s': %m", j); + +- r = write_string_file_at(subsystem_fd, "attr_allow_any_host", "1", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file_at(subsystem_fd, "attr_allow_any_host", "1", 0); + if (r < 0) + return log_error_errno(r, "Failed to set 'attr_allow_any_host' flag: %m"); + +@@ -423,11 +423,11 @@ static int nvme_subsystem_add(const char *node, int consumed_fd, sd_device *devi + + /* We use /proc/$PID/fd/$FD rather than /proc/self/fd/$FD, because this string is visible to others + * via configfs, and by including the PID it's clear to who the stuff belongs. */ +- r = write_string_file_at(namespace_fd, "device_path", FORMAT_PROC_PID_FD_PATH(0, fd), WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file_at(namespace_fd, "device_path", FORMAT_PROC_PID_FD_PATH(0, fd), 0); + if (r < 0) + return log_error_errno(r, "Failed to write 'device_path' attribute: %m"); + +- r = write_string_file_at(namespace_fd, "enable", "1", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file_at(namespace_fd, "enable", "1", 0); + if (r < 0) + return log_error_errno(r, "Failed to write 'enable' attribute: %m"); + +@@ -557,19 +557,19 @@ static int nvme_port_add_portnr( + return 0; + } + +- r = write_string_file_at(port_fd, "addr_adrfam", af_to_ipv4_ipv6(ip_family), WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file_at(port_fd, "addr_adrfam", af_to_ipv4_ipv6(ip_family), 0); + if (r < 0) + return log_error_errno(r, "Failed to set address family on NVME port %" PRIu16 ": %m", portnr); + +- r = write_string_file_at(port_fd, "addr_trtype", "tcp", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file_at(port_fd, "addr_trtype", "tcp", 0); + if (r < 0) + return log_error_errno(r, "Failed to set transport type on NVME port %" PRIu16 ": %m", portnr); + +- r = write_string_file_at(port_fd, "addr_trsvcid", fname, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file_at(port_fd, "addr_trsvcid", fname, 0); + if (r < 0) + return log_error_errno(r, "Failed to set IP port on NVME port %" PRIu16 ": %m", portnr); + +- r = write_string_file_at(port_fd, "addr_traddr", ip_family == AF_INET6 ? "::" : "0.0.0.0", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file_at(port_fd, "addr_traddr", ip_family == AF_INET6 ? "::" : "0.0.0.0", 0); + if (r < 0) + return log_error_errno(r, "Failed to set IP address on NVME port %" PRIu16 ": %m", portnr); + +diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c +index febe345b4c..a90b610ba1 100644 +--- a/src/udev/udev-rules.c ++++ b/src/udev/udev-rules.c +@@ -2711,7 +2711,6 @@ static int udev_rule_apply_token_to_event( + log_event_debug(dev, token, "ATTR '%s' writing '%s'", buf, value); + r = write_string_file(buf, value, + WRITE_STRING_FILE_VERIFY_ON_FAILURE | +- WRITE_STRING_FILE_DISABLE_BUFFER | + WRITE_STRING_FILE_AVOID_NEWLINE | + WRITE_STRING_FILE_VERIFY_IGNORE_NEWLINE); + if (r < 0) +diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c +index 4d82c65f0a..3a3d861b83 100644 +--- a/src/vconsole/vconsole-setup.c ++++ b/src/vconsole/vconsole-setup.c +@@ -261,7 +261,7 @@ static int toggle_utf8_vc(const char *name, int fd, bool utf8) { + static int toggle_utf8_sysfs(bool utf8) { + int r; + +- r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), 0); + if (r < 0) + return log_warning_errno(r, "Failed to %s sysfs UTF-8 flag: %m", enable_disable(utf8)); + +-- +2.34.1 + diff --git a/meta/recipes-core/systemd/systemd/0004-src-shared-cpu-set-util.h-add-__cpu_mask-definition.patch b/meta/recipes-core/systemd/systemd/0013-Handle-__cpu_mask-usage.patch index d394444c1c..43f75373a6 100644 --- a/meta/recipes-core/systemd/systemd/0004-src-shared-cpu-set-util.h-add-__cpu_mask-definition.patch +++ b/meta/recipes-core/systemd/systemd/0013-Handle-__cpu_mask-usage.patch @@ -1,7 +1,7 @@ -From dbe8b3ee45580defeefcac929b897c5437ffc50b Mon Sep 17 00:00:00 2001 +From 2f90f8463423cfbb7e83fcef42f1071018c3b56e Mon Sep 17 00:00:00 2001 From: Scott Murray <scott.murray@konsulko.com> Date: Fri, 13 Sep 2019 19:26:27 -0400 -Subject: [PATCH] Handle __cpu_mask usage +Subject: [PATCH 13/22] Handle __cpu_mask usage Fixes errors: @@ -18,14 +18,13 @@ add a typedef to cpu-set-util.h defining __cpu_mask appropriately. Upstream-Status: Inappropriate [musl specific] Signed-off-by: Scott Murray <scott.murray@konsulko.com> - --- src/shared/cpu-set-util.h | 2 ++ src/test/test-sizeof.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/shared/cpu-set-util.h b/src/shared/cpu-set-util.h -index 27812dfd5923..0ab40731ea93 100644 +index 3c63a58826..4c2d4347fc 100644 --- a/src/shared/cpu-set-util.h +++ b/src/shared/cpu-set-util.h @@ -6,6 +6,8 @@ @@ -38,17 +37,17 @@ index 27812dfd5923..0ab40731ea93 100644 typedef struct CPUSet { cpu_set_t *set; diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c -index c65062d2562c..8b6eefa9cdae 100644 +index ea0c58770e..b65c0bd370 100644 --- a/src/test/test-sizeof.c +++ b/src/test/test-sizeof.c @@ -1,6 +1,5 @@ - /* SPDX-License-Identifier: LGPL-2.1+ */ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ -#include <sched.h> #include <stdio.h> #include <string.h> - #include <sys/types.h> -@@ -10,6 +9,7 @@ + #include <sys/resource.h> +@@ -12,6 +11,7 @@ #include <float.h> #include "time-util.h" @@ -56,3 +55,6 @@ index c65062d2562c..8b6eefa9cdae 100644 /* Print information about various types. Useful when diagnosing * gcc diagnostics on an unfamiliar architecture. */ +-- +2.34.1 + diff --git a/meta/recipes-core/systemd/systemd/0001-Handle-missing-gshadow.patch b/meta/recipes-core/systemd/systemd/0014-Handle-missing-gshadow.patch index c5960a0d60..a751e1ba6f 100644 --- a/meta/recipes-core/systemd/systemd/0001-Handle-missing-gshadow.patch +++ b/meta/recipes-core/systemd/systemd/0014-Handle-missing-gshadow.patch @@ -1,22 +1,26 @@ -From ef9580ea1e2f1e57af3c7dcb0ec392ba8dbb5c8d Mon Sep 17 00:00:00 2001 +From b7c827bb44edbb6251c9fcdb80aa03982c0e7bf3 Mon Sep 17 00:00:00 2001 From: Alex Kiernan <alex.kiernan@gmail.com> Date: Tue, 10 Mar 2020 11:05:20 +0000 -Subject: [PATCH] Handle missing gshadow +Subject: [PATCH 14/22] Handle missing gshadow gshadow usage is now present in the userdb code. Mask all uses of it to allow compilation on musl Upstream-Status: Inappropriate [musl specific] Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> +[Rebased for v247] +Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com> --- - src/shared/group-record-nss.c | 20 ++++++++++++++++++++ - src/shared/group-record-nss.h | 4 ++++ - src/shared/userdb.c | 6 ++++++ - 3 files changed, 30 insertions(+) + src/shared/user-record-nss.c | 20 ++++++++++++++++++++ + src/shared/user-record-nss.h | 4 ++++ + src/shared/userdb.c | 7 ++++++- + 3 files changed, 30 insertions(+), 1 deletion(-) ---- a/src/shared/group-record-nss.c -+++ b/src/shared/group-record-nss.c -@@ -19,8 +19,10 @@ int nss_group_to_group_record( +diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c +index 414a49331b..1a4e1b628c 100644 +--- a/src/shared/user-record-nss.c ++++ b/src/shared/user-record-nss.c +@@ -329,8 +329,10 @@ int nss_group_to_group_record( if (isempty(grp->gr_name)) return -EINVAL; @@ -27,23 +31,23 @@ Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> g = group_record_new(); if (!g) -@@ -36,6 +38,7 @@ int nss_group_to_group_record( +@@ -346,6 +348,7 @@ int nss_group_to_group_record( g->gid = grp->gr_gid; +#if ENABLE_GSHADOW if (sgrp) { - if (looks_like_hashed_password(sgrp->sg_passwd)) { + if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) { g->hashed_password = strv_new(sgrp->sg_passwd); -@@ -51,6 +54,7 @@ int nss_group_to_group_record( - if (!g->administrators) - return -ENOMEM; +@@ -361,6 +364,7 @@ int nss_group_to_group_record( + if (r < 0) + return r; } +#endif r = json_build(&g->json, JSON_BUILD_OBJECT( JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)), -@@ -76,6 +80,7 @@ int nss_sgrp_for_group(const struct grou +@@ -387,6 +391,7 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re assert(ret_sgrp); assert(ret_buffer); @@ -51,7 +55,7 @@ Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> for (;;) { _cleanup_free_ char *buf = NULL; struct sgrp sgrp, *result; -@@ -104,6 +109,9 @@ int nss_sgrp_for_group(const struct grou +@@ -415,6 +420,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re buflen *= 2; buf = mfree(buf); } @@ -61,7 +65,7 @@ Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> } int nss_group_record_by_name( -@@ -115,7 +123,9 @@ int nss_group_record_by_name( +@@ -426,7 +434,9 @@ int nss_group_record_by_name( struct group grp, *result; bool incomplete = false; size_t buflen = 4096; @@ -71,7 +75,7 @@ Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> int r; assert(name); -@@ -145,6 +155,7 @@ int nss_group_record_by_name( +@@ -455,6 +465,7 @@ int nss_group_record_by_name( buf = mfree(buf); } @@ -79,7 +83,7 @@ Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> if (with_shadow) { r = nss_sgrp_for_group(result, &sgrp, &sbuf); if (r < 0) { -@@ -156,6 +167,9 @@ int nss_group_record_by_name( +@@ -466,6 +477,9 @@ int nss_group_record_by_name( incomplete = true; r = nss_group_to_group_record(result, sresult, ret); @@ -89,7 +93,7 @@ Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> if (r < 0) return r; -@@ -172,7 +186,9 @@ int nss_group_record_by_gid( +@@ -483,7 +497,9 @@ int nss_group_record_by_gid( struct group grp, *result; bool incomplete = false; size_t buflen = 4096; @@ -98,8 +102,8 @@ Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> +#endif int r; - assert(ret); -@@ -200,6 +216,7 @@ int nss_group_record_by_gid( + for (;;) { +@@ -509,6 +525,7 @@ int nss_group_record_by_gid( buf = mfree(buf); } @@ -107,7 +111,7 @@ Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> if (with_shadow) { r = nss_sgrp_for_group(result, &sgrp, &sbuf); if (r < 0) { -@@ -211,6 +228,9 @@ int nss_group_record_by_gid( +@@ -520,6 +537,9 @@ int nss_group_record_by_gid( incomplete = true; r = nss_group_to_group_record(result, sresult, ret); @@ -117,8 +121,10 @@ Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> if (r < 0) return r; ---- a/src/shared/group-record-nss.h -+++ b/src/shared/group-record-nss.h +diff --git a/src/shared/user-record-nss.h b/src/shared/user-record-nss.h +index 22ab04d6ee..4e52e7a911 100644 +--- a/src/shared/user-record-nss.h ++++ b/src/shared/user-record-nss.h @@ -2,7 +2,11 @@ #pragma once @@ -128,29 +134,31 @@ Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> +#else +struct sgrp; +#endif + #include <pwd.h> + #include <shadow.h> - #include "group-record.h" - +diff --git a/src/shared/userdb.c b/src/shared/userdb.c +index f60d48ace4..e878199a28 100644 --- a/src/shared/userdb.c +++ b/src/shared/userdb.c -@@ -930,13 +930,16 @@ int groupdb_iterator_get(UserDBIterator +@@ -1038,13 +1038,15 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) { if (gr) { _cleanup_free_ char *buffer = NULL; bool incomplete = false; +#if ENABLE_GSHADOW struct sgrp sgrp; +- +#endif - if (streq_ptr(gr->gr_name, "root")) iterator->synthesize_root = false; if (gr->gr_gid == GID_NOBODY) iterator->synthesize_nobody = false; +#if ENABLE_GSHADOW - r = nss_sgrp_for_group(gr, &sgrp, &buffer); - if (r < 0) { - log_debug_errno(r, "Failed to acquire shadow entry for group %s, ignoring: %m", gr->gr_name); -@@ -944,6 +947,9 @@ int groupdb_iterator_get(UserDBIterator + if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) { + r = nss_sgrp_for_group(gr, &sgrp, &buffer); + if (r < 0) { +@@ -1057,6 +1059,9 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) { } r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret); @@ -160,3 +168,6 @@ Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> if (r < 0) return r; +-- +2.34.1 + diff --git a/meta/recipes-core/systemd/systemd/0014-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch b/meta/recipes-core/systemd/systemd/0014-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch deleted file mode 100644 index 049096d2a9..0000000000 --- a/meta/recipes-core/systemd/systemd/0014-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 62fac5e3ff0fccd329cdc49605258b6d0e573a3e Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Wed, 28 Feb 2018 21:25:22 -0800 -Subject: [PATCH] test-sizeof.c: Disable tests for missing typedefs in musl - -Upstream-Status: Inappropriate [musl specific] - -Signed-off-by: Khem Raj <raj.khem@gmail.com> -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> - ---- - src/test/test-sizeof.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c -index 1020e0cb3153..c65062d2562c 100644 ---- a/src/test/test-sizeof.c -+++ b/src/test/test-sizeof.c -@@ -44,8 +44,10 @@ int main(void) { - info(unsigned); - info(long unsigned); - info(long long unsigned); -+#ifdef __GLIBC__ - info(__syscall_ulong_t); - info(__syscall_slong_t); -+#endif - - info(float); - info(double); -@@ -63,7 +65,9 @@ int main(void) { - info(ssize_t); - info(time_t); - info(usec_t); -+#ifdef __GLIBC__ - info(__time_t); -+#endif - info(pid_t); - info(uid_t); - info(gid_t); diff --git a/meta/recipes-core/systemd/systemd/0015-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch b/meta/recipes-core/systemd/systemd/0015-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch new file mode 100644 index 0000000000..e112766a9b --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0015-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch @@ -0,0 +1,49 @@ +From 3dc9d9d410bcce54fddfd94f43f7f77f3aa8e281 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Mon, 12 Apr 2021 23:44:53 -0700 +Subject: [PATCH 15/22] missing_syscall.h: Define MIPS ABI defines for musl + +musl does not define _MIPS_SIM_ABI32, _MIPS_SIM_NABI32, _MIPS_SIM_ABI64 +unlike glibc where these are provided by libc headers, therefore define +them here in case they are undefined + +Upstream-Status: Pending + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + src/basic/missing_syscall.h | 6 ++++++ + src/shared/base-filesystem.c | 1 + + 2 files changed, 7 insertions(+) + +diff --git a/src/basic/missing_syscall.h b/src/basic/missing_syscall.h +index d795efd8f2..d6729d3c1d 100644 +--- a/src/basic/missing_syscall.h ++++ b/src/basic/missing_syscall.h +@@ -20,6 +20,12 @@ + #include <asm/sgidefs.h> + #endif + ++#ifndef _MIPS_SIM_ABI32 ++#define _MIPS_SIM_ABI32 1 ++#define _MIPS_SIM_NABI32 2 ++#define _MIPS_SIM_ABI64 3 ++#endif ++ + #include "macro.h" + #include "missing_keyctl.h" + #include "missing_stat.h" +diff --git a/src/shared/base-filesystem.c b/src/shared/base-filesystem.c +index 7ae921a113..0ef9d1fd39 100644 +--- a/src/shared/base-filesystem.c ++++ b/src/shared/base-filesystem.c +@@ -20,6 +20,7 @@ + #include "string-util.h" + #include "umask-util.h" + #include "user-util.h" ++#include "missing_syscall.h" + + typedef struct BaseFilesystem { + const char *dir; /* directory or symlink to create */ +-- +2.34.1 + diff --git a/meta/recipes-core/systemd/systemd/0016-Define-glibc-compatible-basename-for-non-glibc-syste.patch b/meta/recipes-core/systemd/systemd/0016-Define-glibc-compatible-basename-for-non-glibc-syste.patch deleted file mode 100644 index 67d5041917..0000000000 --- a/meta/recipes-core/systemd/systemd/0016-Define-glibc-compatible-basename-for-non-glibc-syste.patch +++ /dev/null @@ -1,32 +0,0 @@ -From ec335ef3bb903a7eaf054103cc51411e71e6448c Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Sun, 27 May 2018 08:36:44 -0700 -Subject: [PATCH] Define glibc compatible basename() for non-glibc systems - -Fixes builds with musl, even though systemd is adamant about -using non-posix basename implementation, we have a way out - -Upstream-Status: Inappropriate [musl specific] - -Signed-off-by: Khem Raj <raj.khem@gmail.com> - ---- - src/machine/machine-dbus.c | 5 +++++ - 1 file changed, 5 insertions(+) - -Index: systemd-stable/src/machine/machine-dbus.c -=================================================================== ---- systemd-stable.orig/src/machine/machine-dbus.c -+++ systemd-stable/src/machine/machine-dbus.c -@@ -11,6 +11,11 @@ - #include <libgen.h> - #undef basename - -+#if !defined(__GLIBC__) -+#include <string.h> -+#define basename(src) (strrchr(src,'/') ? strrchr(src,'/')+1 : src) -+#endif -+ - #include "alloc-util.h" - #include "bus-common-errors.h" - #include "bus-get-properties.h" diff --git a/meta/recipes-core/systemd/systemd/0016-pass-correct-parameters-to-getdents64.patch b/meta/recipes-core/systemd/systemd/0016-pass-correct-parameters-to-getdents64.patch new file mode 100644 index 0000000000..0be817e62d --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0016-pass-correct-parameters-to-getdents64.patch @@ -0,0 +1,37 @@ +From 0994b59dba9f248ad31cb7087046dc00b72cb4ea Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 21 Jan 2022 15:15:11 -0800 +Subject: [PATCH 16/22] pass correct parameters to getdents64 + +Fixes +../git/src/basic/recurse-dir.c:57:40: error: incompatible pointer types passing 'uint8_t *' (aka 'unsigned char *') to parameter of type 'struct dirent *' [-Werror,-Wincompatible-pointer-types] + n = getdents64(dir_fd, (uint8_t*) de->buffer + de->buffer_size, bs - de->buffer_size); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +../git/src/basic/stat-util.c:102:28: error: incompatible pointer types passing 'union (unnamed union at ../git/src/basic/stat-util.c:78:9) *' to parameter of type 'struct dirent *' [-Werror,-Wincompatible-pointer-types] + n = getdents64(fd, &buffer, sizeof(buffer)); + ^~~~~~~ + +Upstream-Status: Inappropriate [musl specific] +Signed-off-by: Khem Raj <raj.khem@gmail.com> +Signed-off-by: Jiaqing Zhao <jiaqing.zhao@linux.intel.com> +--- + src/basic/recurse-dir.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/basic/recurse-dir.c b/src/basic/recurse-dir.c +index 5e98b7a5d8..aef065047b 100644 +--- a/src/basic/recurse-dir.c ++++ b/src/basic/recurse-dir.c +@@ -55,7 +55,7 @@ int readdir_all(int dir_fd, + bs = MIN(MALLOC_SIZEOF_SAFE(de) - offsetof(DirectoryEntries, buffer), (size_t) SSIZE_MAX); + assert(bs > de->buffer_size); + +- n = getdents64(dir_fd, (uint8_t*) de->buffer + de->buffer_size, bs - de->buffer_size); ++ n = getdents64(dir_fd, (struct dirent*)((uint8_t*) de->buffer + de->buffer_size), bs - de->buffer_size); + if (n < 0) + return -errno; + if (n == 0) +-- +2.34.1 + diff --git a/meta/recipes-core/systemd/systemd/0017-Adjust-for-musl-headers.patch b/meta/recipes-core/systemd/systemd/0017-Adjust-for-musl-headers.patch new file mode 100644 index 0000000000..4176522a1c --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0017-Adjust-for-musl-headers.patch @@ -0,0 +1,572 @@ +From 3c094d443ca30f19114392fd8ef274af6eabc12d Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 21 Jan 2022 22:19:37 -0800 +Subject: [PATCH 17/22] Adjust for musl headers + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Khem Raj <raj.khem@gmail.com> + +[Rebased for v255.1] +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +--- + src/libsystemd-network/sd-dhcp6-client.c | 2 +- + src/network/netdev/bareudp.c | 2 +- + src/network/netdev/batadv.c | 2 +- + src/network/netdev/bond.c | 2 +- + src/network/netdev/bridge.c | 2 +- + src/network/netdev/dummy.c | 2 +- + src/network/netdev/geneve.c | 2 +- + src/network/netdev/ifb.c | 2 +- + src/network/netdev/ipoib.c | 2 +- + src/network/netdev/ipvlan.c | 2 +- + src/network/netdev/macsec.c | 2 +- + src/network/netdev/macvlan.c | 2 +- + src/network/netdev/netdev.c | 2 +- + src/network/netdev/netdevsim.c | 2 +- + src/network/netdev/nlmon.c | 2 +- + src/network/netdev/tunnel.c | 2 +- + src/network/netdev/vcan.c | 2 +- + src/network/netdev/veth.c | 2 +- + src/network/netdev/vlan.c | 2 +- + src/network/netdev/vrf.c | 2 +- + src/network/netdev/vxcan.c | 2 +- + src/network/netdev/vxlan.c | 2 +- + src/network/netdev/wireguard.c | 2 +- + src/network/netdev/xfrm.c | 2 +- + src/network/networkd-bridge-mdb.c | 4 ++-- + src/network/networkd-dhcp-common.c | 3 ++- + src/network/networkd-dhcp-prefix-delegation.c | 3 ++- + src/network/networkd-dhcp-server.c | 2 +- + src/network/networkd-dhcp4.c | 2 +- + src/network/networkd-ipv6ll.c | 2 +- + src/network/networkd-link.c | 2 +- + src/network/networkd-ndisc.c | 2 +- + src/network/networkd-route.c | 8 ++++---- + src/network/networkd-setlink.c | 2 +- + src/network/networkd-sysctl.c | 2 +- + src/shared/linux/ethtool.h | 3 ++- + src/shared/netif-util.c | 2 +- + src/udev/udev-builtin-net_id.c | 2 +- + 38 files changed, 45 insertions(+), 42 deletions(-) + +diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c +index c20367dfc9..b8d4cd8c2a 100644 +--- a/src/libsystemd-network/sd-dhcp6-client.c ++++ b/src/libsystemd-network/sd-dhcp6-client.c +@@ -5,7 +5,7 @@ + + #include <errno.h> + #include <sys/ioctl.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/if_infiniband.h> + + #include "sd-dhcp6-client.h" +diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c +index 1df886573b..c8b6714726 100644 +--- a/src/network/netdev/bareudp.c ++++ b/src/network/netdev/bareudp.c +@@ -2,7 +2,7 @@ + * Copyright © 2020 VMware, Inc. */ + + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "bareudp.h" + #include "netlink-util.h" +diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c +index 26da0231d4..2e8002af8c 100644 +--- a/src/network/netdev/batadv.c ++++ b/src/network/netdev/batadv.c +@@ -3,7 +3,7 @@ + #include <inttypes.h> + #include <netinet/in.h> + #include <linux/genetlink.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "batadv.h" + #include "fileio.h" +diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c +index 4d75a0d6bf..985b3197e0 100644 +--- a/src/network/netdev/bond.c ++++ b/src/network/netdev/bond.c +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "alloc-util.h" + #include "bond.h" +diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c +index 3e394edadf..f12f667687 100644 +--- a/src/network/netdev/bridge.c ++++ b/src/network/netdev/bridge.c +@@ -2,7 +2,7 @@ + + #include <net/if.h> + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/if_bridge.h> + + #include "bridge.h" +diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c +index 00df1d2787..77b506b422 100644 +--- a/src/network/netdev/dummy.c ++++ b/src/network/netdev/dummy.c +@@ -1,6 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "dummy.h" + +diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c +index bc655ec7ff..a77e8e17e4 100644 +--- a/src/network/netdev/geneve.c ++++ b/src/network/netdev/geneve.c +@@ -2,7 +2,7 @@ + + #include <net/if.h> + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "alloc-util.h" + #include "conf-parser.h" +diff --git a/src/network/netdev/ifb.c b/src/network/netdev/ifb.c +index d7ff44cb9e..e037629ae4 100644 +--- a/src/network/netdev/ifb.c ++++ b/src/network/netdev/ifb.c +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later + * Copyright © 2019 VMware, Inc. */ + +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "ifb.h" + +diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c +index d5fe299b7b..c9c8002eac 100644 +--- a/src/network/netdev/ipoib.c ++++ b/src/network/netdev/ipoib.c +@@ -1,6 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/if_link.h> + + #include "ipoib.h" +diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c +index 05d5d010f6..d440f49537 100644 +--- a/src/network/netdev/ipvlan.c ++++ b/src/network/netdev/ipvlan.c +@@ -2,7 +2,7 @@ + + #include <net/if.h> + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "conf-parser.h" + #include "ipvlan.h" +diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c +index 17d6acefb6..679d0984f9 100644 +--- a/src/network/netdev/macsec.c ++++ b/src/network/netdev/macsec.c +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/if_ether.h> + #include <linux/if_macsec.h> + #include <linux/genetlink.h> +diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c +index 203807e3a5..8ab09a387e 100644 +--- a/src/network/netdev/macvlan.c ++++ b/src/network/netdev/macvlan.c +@@ -2,7 +2,7 @@ + + #include <net/if.h> + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "conf-parser.h" + #include "macvlan.h" +diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c +index 57127a861a..7f787d0b9f 100644 +--- a/src/network/netdev/netdev.c ++++ b/src/network/netdev/netdev.c +@@ -2,7 +2,7 @@ + + #include <net/if.h> + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <unistd.h> + + #include "alloc-util.h" +diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c +index 15d5c132f9..a3ffa48b15 100644 +--- a/src/network/netdev/netdevsim.c ++++ b/src/network/netdev/netdevsim.c +@@ -1,6 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "netdevsim.h" + +diff --git a/src/network/netdev/nlmon.c b/src/network/netdev/nlmon.c +index ff372092e6..eef66811f4 100644 +--- a/src/network/netdev/nlmon.c ++++ b/src/network/netdev/nlmon.c +@@ -1,6 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "nlmon.h" + +diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c +index db84e7cf6e..93d5642962 100644 +--- a/src/network/netdev/tunnel.c ++++ b/src/network/netdev/tunnel.c +@@ -2,7 +2,7 @@ + + #include <netinet/in.h> + #include <linux/fou.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/if_tunnel.h> + #include <linux/ip.h> + #include <linux/ip6_tunnel.h> +diff --git a/src/network/netdev/vcan.c b/src/network/netdev/vcan.c +index 380547ee1e..137c1adf8a 100644 +--- a/src/network/netdev/vcan.c ++++ b/src/network/netdev/vcan.c +@@ -1,6 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "vcan.h" + +diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c +index e0f5b4ebb1..8a424ed03d 100644 +--- a/src/network/netdev/veth.c ++++ b/src/network/netdev/veth.c +@@ -3,7 +3,7 @@ + #include <errno.h> + #include <net/if.h> + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/veth.h> + + #include "netlink-util.h" +diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c +index 2390206993..efec630e30 100644 +--- a/src/network/netdev/vlan.c ++++ b/src/network/netdev/vlan.c +@@ -2,7 +2,7 @@ + + #include <errno.h> + #include <net/if.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/if_vlan.h> + + #include "parse-util.h" +diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c +index b75ec2bcc6..6aeeea640b 100644 +--- a/src/network/netdev/vrf.c ++++ b/src/network/netdev/vrf.c +@@ -2,7 +2,7 @@ + + #include <net/if.h> + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "vrf.h" + +diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c +index c0343f45b6..f9e718f40b 100644 +--- a/src/network/netdev/vxcan.c ++++ b/src/network/netdev/vxcan.c +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + + #include <linux/can/vxcan.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "vxcan.h" + +diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c +index b11fdbbd0d..a971a917f0 100644 +--- a/src/network/netdev/vxlan.c ++++ b/src/network/netdev/vxlan.c +@@ -2,7 +2,7 @@ + + #include <net/if.h> + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "conf-parser.h" + #include "alloc-util.h" +diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c +index 4c7d837c41..6df6dfb816 100644 +--- a/src/network/netdev/wireguard.c ++++ b/src/network/netdev/wireguard.c +@@ -6,7 +6,7 @@ + #include <sys/ioctl.h> + #include <net/if.h> + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/ipv6_route.h> + + #include "sd-resolve.h" +diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c +index 905bfc0bdf..39e34dbb3b 100644 +--- a/src/network/netdev/xfrm.c ++++ b/src/network/netdev/xfrm.c +@@ -1,6 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "missing_network.h" + #include "xfrm.h" +diff --git a/src/network/networkd-bridge-mdb.c b/src/network/networkd-bridge-mdb.c +index bd1a9745dc..949d3da029 100644 +--- a/src/network/networkd-bridge-mdb.c ++++ b/src/network/networkd-bridge-mdb.c +@@ -1,7 +1,5 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <net/if.h> +-#include <linux/if_bridge.h> + + #include "netlink-util.h" + #include "networkd-bridge-mdb.h" +@@ -11,6 +9,8 @@ + #include "networkd-queue.h" + #include "string-util.h" + #include "vlan-util.h" ++#include <net/if.h> ++#include <linux/if_bridge.h> + + #define STATIC_BRIDGE_MDB_ENTRIES_PER_NETWORK_MAX 1024U + +diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c +index 080b15387c..efe8283957 100644 +--- a/src/network/networkd-dhcp-common.c ++++ b/src/network/networkd-dhcp-common.c +@@ -1,7 +1,8 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> ++#include <net/if.h> + + #include "bus-error.h" + #include "bus-locator.h" +diff --git a/src/network/networkd-dhcp-prefix-delegation.c b/src/network/networkd-dhcp-prefix-delegation.c +index af2fe9efcd..511565700f 100644 +--- a/src/network/networkd-dhcp-prefix-delegation.c ++++ b/src/network/networkd-dhcp-prefix-delegation.c +@@ -1,6 +1,5 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <linux/ipv6_route.h> + + #include "dhcp6-lease-internal.h" + #include "hashmap.h" +@@ -20,6 +19,8 @@ + #include "strv.h" + #include "tunnel.h" + ++#include <linux/ipv6_route.h> ++ + bool link_dhcp_pd_is_enabled(Link *link) { + assert(link); + +diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c +index 607fe0053c..9ce4005874 100644 +--- a/src/network/networkd-dhcp-server.c ++++ b/src/network/networkd-dhcp-server.c +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/if.h> + + #include "sd-dhcp-server.h" +diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c +index efbae6d868..1ea2151d50 100644 +--- a/src/network/networkd-dhcp4.c ++++ b/src/network/networkd-dhcp4.c +@@ -3,7 +3,7 @@ + #include <netinet/in.h> + #include <netinet/ip.h> + #include <linux/if.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "alloc-util.h" + #include "dhcp-client-internal.h" +diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c +index 32229a3fc7..662a345d6e 100644 +--- a/src/network/networkd-ipv6ll.c ++++ b/src/network/networkd-ipv6ll.c +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + + #include <linux/if.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "in-addr-util.h" + #include "networkd-address.h" +diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c +index ee5f0f2c0a..ea5269a2de 100644 +--- a/src/network/networkd-link.c ++++ b/src/network/networkd-link.c +@@ -3,7 +3,7 @@ + #include <net/if.h> + #include <netinet/in.h> + #include <linux/if.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/if_link.h> + #include <linux/netdevice.h> + #include <sys/socket.h> +diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c +index ab9eeb13a5..dd96fe7483 100644 +--- a/src/network/networkd-ndisc.c ++++ b/src/network/networkd-ndisc.c +@@ -6,7 +6,7 @@ + #include <arpa/inet.h> + #include <netinet/icmp6.h> + #include <linux/if.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "sd-ndisc.h" + +diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c +index 7218d799fc..30d5574eae 100644 +--- a/src/network/networkd-route.c ++++ b/src/network/networkd-route.c +@@ -1,9 +1,5 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <linux/icmpv6.h> +-#include <linux/ipv6_route.h> +-#include <linux/nexthop.h> +- + #include "alloc-util.h" + #include "event-util.h" + #include "netlink-util.h" +@@ -21,6 +17,10 @@ + #include "vrf.h" + #include "wireguard.h" + ++#include <linux/icmpv6.h> ++#include <linux/ipv6_route.h> ++#include <linux/nexthop.h> ++ + int route_new(Route **ret) { + _cleanup_(route_freep) Route *route = NULL; + +diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c +index 2298f9ea3a..7d5f87de53 100644 +--- a/src/network/networkd-setlink.c ++++ b/src/network/networkd-setlink.c +@@ -2,7 +2,7 @@ + + #include <netinet/in.h> + #include <linux/if.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/if_bridge.h> + + #include "missing_network.h" +diff --git a/src/network/networkd-sysctl.c b/src/network/networkd-sysctl.c +index 2b226b2e2a..f12a474e2f 100644 +--- a/src/network/networkd-sysctl.c ++++ b/src/network/networkd-sysctl.c +@@ -2,7 +2,7 @@ + + #include <netinet/in.h> + #include <linux/if.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "missing_network.h" + #include "networkd-link.h" +diff --git a/src/shared/linux/ethtool.h b/src/shared/linux/ethtool.h +index 3d1da515c0..3fca9a4faf 100644 +--- a/src/shared/linux/ethtool.h ++++ b/src/shared/linux/ethtool.h +@@ -16,7 +16,8 @@ + + #include <linux/const.h> + #include <linux/types.h> +-#include <linux/if_ether.h> ++#include <netinet/if_ether.h> ++//#include <linux/if_ether.h> + + #include <limits.h> /* for INT_MAX */ + +diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c +index f56c5646c1..5af28ff119 100644 +--- a/src/shared/netif-util.c ++++ b/src/shared/netif-util.c +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + + #include <linux/if.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "arphrd-util.h" + #include "device-util.h" +diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c +index f528a46b8e..830318cda5 100644 +--- a/src/udev/udev-builtin-net_id.c ++++ b/src/udev/udev-builtin-net_id.c +@@ -18,7 +18,7 @@ + #include <stdarg.h> + #include <unistd.h> + #include <linux/if.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/netdevice.h> + #include <linux/pci_regs.h> + +-- +2.34.1 + diff --git a/meta/recipes-core/systemd/systemd/0018-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch b/meta/recipes-core/systemd/systemd/0018-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch new file mode 100644 index 0000000000..75f6b9094a --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0018-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch @@ -0,0 +1,52 @@ +From be02bd0876a061728661535a709d313e39fe1ac3 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Tue, 8 Nov 2022 13:31:34 -0800 +Subject: [PATCH 18/22] test-bus-error: strerror() is assumed to be GNU + specific version mark it so + +Upstream-Status: Inappropriate [Upstream systemd only supports glibc] + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + src/libsystemd/sd-bus/test-bus-error.c | 2 ++ + src/test/test-errno-util.c | 3 ++- + 2 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/libsystemd/sd-bus/test-bus-error.c b/src/libsystemd/sd-bus/test-bus-error.c +index a55f3f9856..4123bf3da0 100644 +--- a/src/libsystemd/sd-bus/test-bus-error.c ++++ b/src/libsystemd/sd-bus/test-bus-error.c +@@ -99,7 +99,9 @@ TEST(error) { + assert_se(!sd_bus_error_is_set(&error)); + assert_se(sd_bus_error_set_errno(&error, EBUSY) == -EBUSY); + assert_se(streq(error.name, "System.Error.EBUSY")); ++#ifdef __GLIBC__ + assert_se(streq(error.message, STRERROR(EBUSY))); ++#endif + assert_se(sd_bus_error_has_name(&error, "System.Error.EBUSY")); + assert_se(sd_bus_error_get_errno(&error) == EBUSY); + assert_se(sd_bus_error_is_set(&error)); +diff --git a/src/test/test-errno-util.c b/src/test/test-errno-util.c +index 376d532281..967cfd4d67 100644 +--- a/src/test/test-errno-util.c ++++ b/src/test/test-errno-util.c +@@ -4,7 +4,7 @@ + #include "stdio-util.h" + #include "string-util.h" + #include "tests.h" +- ++#ifdef __GLIBC__ + TEST(strerror_not_threadsafe) { + /* Just check that strerror really is not thread-safe. */ + log_info("strerror(%d) → %s", 200, strerror(200)); +@@ -46,6 +46,7 @@ TEST(STRERROR_OR_ELSE) { + log_info("STRERROR_OR_ELSE(EPERM, \"EOF\") → %s", STRERROR_OR_EOF(EPERM)); + log_info("STRERROR_OR_ELSE(-EPERM, \"EOF\") → %s", STRERROR_OR_EOF(-EPERM)); + } ++#endif /* __GLIBC__ */ + + TEST(PROTECT_ERRNO) { + errno = 12; +-- +2.34.1 + diff --git a/meta/recipes-core/systemd/systemd/0019-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch b/meta/recipes-core/systemd/systemd/0019-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch deleted file mode 100644 index 3b8064677f..0000000000 --- a/meta/recipes-core/systemd/systemd/0019-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 1c4c73a7cc0fb59eb68ab70699f7f51af5c163b2 Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Mon, 25 Feb 2019 15:18:00 +0800 -Subject: [PATCH] Hide __start_BUS_ERROR_MAP and __stop_BUS_ERROR_MAP - -for currently unknown reasons they get exported to the shared libries -even without being listed in the sym file - -Upstream-Status: Pending - -Signed-off-by: Khem Raj <raj.khem@gmail.com> -[Rebased for v241] -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> - ---- - src/libsystemd/sd-bus/bus-error.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c -index 28a5159c4480..962a4de10c56 100644 ---- a/src/libsystemd/sd-bus/bus-error.c -+++ b/src/libsystemd/sd-bus/bus-error.c -@@ -54,8 +54,8 @@ BUS_ERROR_MAP_ELF_REGISTER const sd_bus_error_map bus_standard_errors[] = { - }; - - /* GCC maps this magically to the beginning and end of the BUS_ERROR_MAP section */ --extern const sd_bus_error_map __start_SYSTEMD_BUS_ERROR_MAP[]; --extern const sd_bus_error_map __stop_SYSTEMD_BUS_ERROR_MAP[]; -+extern const sd_bus_error_map __start_SYSTEMD_BUS_ERROR_MAP[] _hidden_; -+extern const sd_bus_error_map __stop_SYSTEMD_BUS_ERROR_MAP[] _hidden_; - - /* Additional maps registered with sd_bus_error_add_map() are in this - * NULL terminated array */ diff --git a/meta/recipes-core/systemd/systemd/0019-errno-util-Make-STRERROR-portable-for-musl.patch b/meta/recipes-core/systemd/systemd/0019-errno-util-Make-STRERROR-portable-for-musl.patch new file mode 100644 index 0000000000..e038b73678 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0019-errno-util-Make-STRERROR-portable-for-musl.patch @@ -0,0 +1,42 @@ +From 46d80840bfe37e67d4f18c37a77751ea1fe63a07 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Mon, 23 Jan 2023 23:39:46 -0800 +Subject: [PATCH 19/22] errno-util: Make STRERROR portable for musl + +Sadly, systemd has decided to use yet another GNU extention in a macro +lets make this such that we can use XSI compliant strerror_r() for +non-glibc hosts + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + src/basic/errno-util.h | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/src/basic/errno-util.h b/src/basic/errno-util.h +index 27804e6382..274c1c6ef1 100644 +--- a/src/basic/errno-util.h ++++ b/src/basic/errno-util.h +@@ -15,8 +15,16 @@ + * https://stackoverflow.com/questions/34880638/compound-literal-lifetime-and-if-blocks + * + * Note that we use the GNU variant of strerror_r() here. */ +-#define STRERROR(errnum) strerror_r(abs(errnum), (char[ERRNO_BUF_LEN]){}, ERRNO_BUF_LEN) +- ++static inline const char * STRERROR(int errnum); ++ ++static inline const char * STRERROR(int errnum) { ++#ifdef __GLIBC__ ++ return strerror_r(abs(errnum), (char[ERRNO_BUF_LEN]){}, ERRNO_BUF_LEN); ++#else ++ static __thread char buf[ERRNO_BUF_LEN]; ++ return strerror_r(abs(errnum), buf, ERRNO_BUF_LEN) ? "unknown error" : buf; ++#endif ++} + /* A helper to print an error message or message for functions that return 0 on EOF. + * Note that we can't use ({ … }) to define a temporary variable, so errnum is + * evaluated twice. */ +-- +2.34.1 + diff --git a/meta/recipes-core/systemd/systemd/0020-missing_type.h-add-__compar_d_fn_t-definition.patch b/meta/recipes-core/systemd/systemd/0020-missing_type.h-add-__compar_d_fn_t-definition.patch deleted file mode 100644 index db4041bbb1..0000000000 --- a/meta/recipes-core/systemd/systemd/0020-missing_type.h-add-__compar_d_fn_t-definition.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 8303d49cabaf3ab8890ba1d266972c721dfe6ee8 Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Mon, 25 Feb 2019 15:27:54 +0800 -Subject: [PATCH] missing_type.h: add __compar_d_fn_t definition - -Fix the following compile failure: -src/basic/util.h:71:18: error: unknown type name '__compar_d_fn_t'; did you mean '__compar_fn_t'? - -Upstream-Status: Inappropriate [musl specific] - -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> - ---- - src/basic/missing_type.h | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h -index 23602ebbd533..917d314a81bf 100644 ---- a/src/basic/missing_type.h -+++ b/src/basic/missing_type.h -@@ -13,6 +13,7 @@ - - #ifndef __GLIBC__ - typedef int (*comparison_fn_t)(const void *, const void *); -+typedef int (*__compar_d_fn_t) (const void *, const void *, void *); - #endif - - #ifndef __COMPAR_FN_T diff --git a/meta/recipes-core/systemd/systemd/0020-sd-event-Make-malloc_trim-conditional-on-glibc.patch b/meta/recipes-core/systemd/systemd/0020-sd-event-Make-malloc_trim-conditional-on-glibc.patch new file mode 100644 index 0000000000..b83fffe793 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0020-sd-event-Make-malloc_trim-conditional-on-glibc.patch @@ -0,0 +1,39 @@ +From 9eb4867b4e2dbdb2484ae854022aff97e2f0feb3 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Wed, 2 Aug 2023 12:06:27 -0700 +Subject: [PATCH 20/22] sd-event: Make malloc_trim() conditional on glibc + +musl does not have this API + +Upstream-Status: Inappropriate [musl-specific] +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + src/libsystemd/sd-event/sd-event.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c +index 288798a0dc..6419a7f216 100644 +--- a/src/libsystemd/sd-event/sd-event.c ++++ b/src/libsystemd/sd-event/sd-event.c +@@ -1874,7 +1874,7 @@ _public_ int sd_event_add_exit( + } + + _public_ int sd_event_trim_memory(void) { +- int r; ++ int r = 0; + + /* A default implementation of a memory pressure callback. Simply releases our own allocation caches + * and glibc's. This is automatically used when people call sd_event_add_memory_pressure() with a +@@ -1888,7 +1888,9 @@ _public_ int sd_event_trim_memory(void) { + + usec_t before_timestamp = now(CLOCK_MONOTONIC); + hashmap_trim_pools(); ++#ifdef __GLIBC__ + r = malloc_trim(0); ++#endif + usec_t after_timestamp = now(CLOCK_MONOTONIC); + + if (r > 0) +-- +2.34.1 + diff --git a/meta/recipes-core/systemd/systemd/0021-Handle-missing-LOCK_EX.patch b/meta/recipes-core/systemd/systemd/0021-Handle-missing-LOCK_EX.patch deleted file mode 100644 index 67d9162c08..0000000000 --- a/meta/recipes-core/systemd/systemd/0021-Handle-missing-LOCK_EX.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 190854c2114dc6e74c8859dc251e3737e3c0f353 Mon Sep 17 00:00:00 2001 -From: Alex Kiernan <alex.kiernan@gmail.com> -Date: Fri, 7 Aug 2020 15:19:27 +0000 -Subject: [PATCH] Handle missing LOCK_EX - -Upstream-Status: Inappropriate [musl specific] -Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> ---- - src/partition/makefs.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/partition/makefs.c b/src/partition/makefs.c -index 97f50c9033..7f55acd229 100644 ---- a/src/partition/makefs.c -+++ b/src/partition/makefs.c -@@ -5,6 +5,7 @@ - #include <sys/stat.h> - #include <sys/types.h> - #include <unistd.h> -+#include <sys/file.h> - - #include "alloc-util.h" - #include "blockdev-util.h" diff --git a/meta/recipes-core/systemd/systemd/0021-shared-Do-not-use-malloc_info-on-musl.patch b/meta/recipes-core/systemd/systemd/0021-shared-Do-not-use-malloc_info-on-musl.patch new file mode 100644 index 0000000000..7eff069bb7 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0021-shared-Do-not-use-malloc_info-on-musl.patch @@ -0,0 +1,57 @@ +From 502597b9ddd6b145541b23fadca0b1d3ca9f6367 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Wed, 2 Aug 2023 12:20:40 -0700 +Subject: [PATCH 21/22] shared: Do not use malloc_info on musl + +Upstream-Status: Inappropriate [musl-specific] +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + src/shared/bus-util.c | 5 +++-- + src/shared/common-signal.c | 4 ++-- + 2 files changed, 5 insertions(+), 4 deletions(-) + +diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c +index 74f148c8b4..2d862a123d 100644 +--- a/src/shared/bus-util.c ++++ b/src/shared/bus-util.c +@@ -611,15 +611,16 @@ static int method_dump_memory_state_by_fd(sd_bus_message *message, void *userdat + _cleanup_close_ int fd = -EBADF; + size_t dump_size; + FILE *f; +- int r; ++ int r = 0; + + assert(message); + + f = memstream_init(&m); + if (!f) + return -ENOMEM; +- ++#ifdef __GLIBC__ + r = RET_NERRNO(malloc_info(/* options= */ 0, f)); ++#endif + if (r < 0) + return r; + +diff --git a/src/shared/common-signal.c b/src/shared/common-signal.c +index 8e70e365dd..9e782caec9 100644 +--- a/src/shared/common-signal.c ++++ b/src/shared/common-signal.c +@@ -65,12 +65,12 @@ int sigrtmin18_handler(sd_event_source *s, const struct signalfd_siginfo *si, vo + log_oom(); + break; + } +- ++#ifdef __GLIBC__ + if (malloc_info(0, f) < 0) { + log_error_errno(errno, "Failed to invoke malloc_info(): %m"); + break; + } +- ++#endif + (void) memstream_dump(LOG_INFO, &m); + break; + } +-- +2.34.1 + diff --git a/meta/recipes-core/systemd/systemd/0022-Fix-incompatible-pointer-type-struct-sockaddr_un.patch b/meta/recipes-core/systemd/systemd/0022-Fix-incompatible-pointer-type-struct-sockaddr_un.patch deleted file mode 100644 index d57ca1fd39..0000000000 --- a/meta/recipes-core/systemd/systemd/0022-Fix-incompatible-pointer-type-struct-sockaddr_un.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 328c39fae2631deb5737dd56f46159dd6b4cdbed Mon Sep 17 00:00:00 2001 -From: Alex Kiernan <alex.kiernan@gmail.com> -Date: Fri, 7 Aug 2020 15:20:17 +0000 -Subject: [PATCH] Fix incompatible pointer type struct sockaddr_un * - -| ../../../../../../workspace/sources/systemd/src/nspawn/nspawn.c: In function 'cant_be_in_netns': -| ../../../../../../workspace/sources/systemd/src/nspawn/nspawn.c:4893:25: error: passing argument 2 of 'connect' from incompatible pointer type [-Werror=incompatible-pointer-types] -| 4893 | if (connect(fd, &sa.un, SOCKADDR_UN_LEN(sa.un)) < 0) { -| | ^~~~~~ -| | | -| | struct sockaddr_un * -| In file included from ../../../../../../workspace/sources/systemd/src/systemd/sd-daemon.h:22, -| from ../../../../../../workspace/sources/systemd/src/nspawn/nspawn.c:21: -| /home/ubuntu/poky/build/tmp/work/core2-64-poky-linux-musl/systemd/1_246-r0/recipe-sysroot/usr/include/sys/socket.h:384:19: note: expected 'const struct sockaddr *' but argument is of type 'struct sockaddr_un *' -| 384 | int connect (int, const struct sockaddr *, socklen_t); -| | ^~~~~~~~~~~~~~~~~~~~~~~ -| cc1: some warnings being treated as errors - -Upstream-Status: Inappropriate [musl specific] -Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> ---- - src/nspawn/nspawn.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c -index 0450c9f795..7305db04ef 100644 ---- a/src/nspawn/nspawn.c -+++ b/src/nspawn/nspawn.c -@@ -4890,7 +4890,7 @@ static int cant_be_in_netns(void) { - if (fd < 0) - return log_error_errno(errno, "Failed to allocate udev control socket: %m"); - -- if (connect(fd, &sa.un, SOCKADDR_UN_LEN(sa.un)) < 0) { -+ if (connect(fd, (struct sockaddr *)&sa.un, SOCKADDR_UN_LEN(sa.un)) < 0) { - - if (errno == ENOENT || ERRNO_IS_DISCONNECT(errno)) - return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), diff --git a/meta/recipes-core/systemd/systemd/0022-avoid-missing-LOCK_EX-declaration.patch b/meta/recipes-core/systemd/systemd/0022-avoid-missing-LOCK_EX-declaration.patch new file mode 100644 index 0000000000..24f3bf74a0 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0022-avoid-missing-LOCK_EX-declaration.patch @@ -0,0 +1,43 @@ +From fd52f1764647e03a35e8f0ed0ef952049073ccbd Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Tue, 2 Jan 2024 11:03:27 +0800 +Subject: [PATCH 22/22] avoid missing LOCK_EX declaration + +This only happens on MUSL. Include sys/file.h to avoid compilation +error about missing LOCK_EX declaration. + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +--- + src/core/exec-invoke.c | 1 + + src/shared/dev-setup.h | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/src/core/exec-invoke.c b/src/core/exec-invoke.c +index 70d963e269..7084811439 100644 +--- a/src/core/exec-invoke.c ++++ b/src/core/exec-invoke.c +@@ -4,6 +4,7 @@ + #include <sys/ioctl.h> + #include <sys/mount.h> + #include <sys/prctl.h> ++#include <sys/file.h> + + #if HAVE_PAM + #include <security/pam_appl.h> +diff --git a/src/shared/dev-setup.h b/src/shared/dev-setup.h +index 5339bc4e5e..0697495f23 100644 +--- a/src/shared/dev-setup.h ++++ b/src/shared/dev-setup.h +@@ -2,6 +2,7 @@ + #pragma once + + #include <sys/types.h> ++#include <sys/file.h> + + int lock_dev_console(void); + +-- +2.34.1 + diff --git a/meta/recipes-core/systemd/systemd/0024-test-json.c-define-M_PIl.patch b/meta/recipes-core/systemd/systemd/0024-test-json.c-define-M_PIl.patch deleted file mode 100644 index 80beada3d3..0000000000 --- a/meta/recipes-core/systemd/systemd/0024-test-json.c-define-M_PIl.patch +++ /dev/null @@ -1,31 +0,0 @@ -From a05cc5fb3dc0e51682c40196285cdda34ec90783 Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Mon, 25 Feb 2019 16:53:06 +0800 -Subject: [PATCH] test-json.c: define M_PIl - -Fix the following compile failure: -src/test/test-json.c:305:50: error: 'M_PIl' undeclared (first use in this function); did you mean 'M_PI'? - -Upstream-Status: Inappropriate [musl specific] - -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> - ---- - src/test/test-json.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/src/test/test-json.c b/src/test/test-json.c -index a6613043b924..ca823ea79f05 100644 ---- a/src/test/test-json.c -+++ b/src/test/test-json.c -@@ -12,6 +12,10 @@ - #include "tests.h" - #include "util.h" - -+#ifndef M_PIl -+#define M_PIl 3.141592653589793238462643383279502884L -+#endif -+ - static void test_tokenizer(const char *data, ...) { - unsigned line = 0, column = 0; - void *state = NULL; diff --git a/meta/recipes-core/systemd/systemd/org.freedesktop.hostname1_no_polkit.conf b/meta/recipes-core/systemd/systemd/org.freedesktop.hostname1_no_polkit.conf new file mode 100644 index 0000000000..f4d0271cdb --- /dev/null +++ b/meta/recipes-core/systemd/systemd/org.freedesktop.hostname1_no_polkit.conf @@ -0,0 +1,11 @@ +<?xml version="1.0"?> <!--*-nxml-*--> +<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" + "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> + +<busconfig> + <policy group="systemd-hostname"> + <allow own="org.freedesktop.hostname1"/> + <allow send_destination="org.freedesktop.hostname1"/> + <allow receive_sender="org.freedesktop.hostname1"/> + </policy> +</busconfig> diff --git a/meta/recipes-core/systemd/systemd/selinux-hook-handling-to-enumerate-nexthop.patch b/meta/recipes-core/systemd/systemd/selinux-hook-handling-to-enumerate-nexthop.patch deleted file mode 100644 index b1c92ed713..0000000000 --- a/meta/recipes-core/systemd/systemd/selinux-hook-handling-to-enumerate-nexthop.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 92b555aaabf710e0a672a7244e8c0e3963075133 Mon Sep 17 00:00:00 2001 -From: Purushottam choudhary <purushottam.choudhary@kpit.com> -Date: Wed, 28 Oct 2020 22:11:49 +0530 -Subject: [PATCH] network: selinux hook handling to enumerate nexthop - -When selinux is enabled, the call of -manager_rtnl_enumerate_nexthop() fails. - -This fix is to facilitate selinux hook handling for enumerating -nexthop. - -In manager_rtnl_enumerate_nexthop() there is a check -if "Not supported" is returned by the send_netlink() call. - -This check expects that -EOPNOTSUPP is returned, -the selinux hook seems to return -EINVAL instead. - -This happens in kernel older than 5.3 -(more specificallytorvalds/linux@65ee00a) as it does not support -nexthop handling through netlink. - -And if SELinux is enforced in the order kernel, callingRTM_GETNEXTHOP -returns -EINVAL. - -Thus adding a call in the manager_rtnl_enumerate_nexthop for the -extra return -EINVAL. - -Upstream-Status: Backport -https://github.com/systemd/systemd/commit/92b555aaabf710e0a672a7244e8c0e3963075133 ---- - src/network/networkd-manager.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c -index a6c1a39..2a9be85 100644 ---- a/src/network/networkd-manager.c -+++ b/src/network/networkd-manager.c -@@ -2121,7 +2121,7 @@ int manager_rtnl_enumerate_nexthop(Manager *m) { - - r = sd_netlink_call(m->rtnl, req, 0, &reply); - if (r < 0) { -- if (r == -EOPNOTSUPP) { -+ if (r == -EOPNOTSUPP || r == -EINVAL) { - log_debug("Nexthop are not supported by the kernel. Ignoring."); - return 0; - } diff --git a/meta/recipes-core/systemd/systemd_246.6.bb b/meta/recipes-core/systemd/systemd_255.4.bb index d9e7b1a00c..f58a1bc2b6 100644 --- a/meta/recipes-core/systemd/systemd_246.6.bb +++ b/meta/recipes-core/systemd/systemd_255.4.bb @@ -4,70 +4,75 @@ PROVIDES = "udev" PE = "1" -DEPENDS = "intltool-native gperf-native libcap util-linux" +DEPENDS = "intltool-native gperf-native libcap util-linux python3-jinja2-native" SECTION = "base/shell" inherit useradd pkgconfig meson perlnative update-rc.d update-alternatives qemu systemd gettext bash-completion manpages features_check +# unmerged-usr support is deprecated upstream, taints the system and will be +# removed in the near future. Fail the build if it is not enabled. +REQUIRED_DISTRO_FEATURES += "usrmerge" + # As this recipe builds udev, respect systemd being in DISTRO_FEATURES so # that we don't build both udev and systemd in world builds. -REQUIRED_DISTRO_FEATURES = "systemd" +REQUIRED_DISTRO_FEATURES += "systemd" -SRC_URI += "file://touchscreen.rules \ +SRC_URI += " \ + file://touchscreen.rules \ file://00-create-volatile.conf \ + ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://org.freedesktop.hostname1_no_polkit.conf', '', d)} \ + ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://00-hostnamed-network-user.conf', '', d)} \ file://init \ file://99-default.preset \ file://systemd-pager.sh \ - file://0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch \ - file://0003-implment-systemd-sysv-install-for-OE.patch \ - file://0001-systemd.pc.in-use-ROOTPREFIX-without-suffixed-slash.patch \ - file://selinux-hook-handling-to-enumerate-nexthop.patch \ - file://0001-logind-Restore-chvt-as-non-root-user-without-polkit.patch \ + file://0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch \ + file://0008-implment-systemd-sysv-install-for-OE.patch \ " # patches needed by musl -SRC_URI_append_libc-musl = " ${SRC_URI_MUSL}" +SRC_URI:append:libc-musl = " ${SRC_URI_MUSL}" SRC_URI_MUSL = "\ - file://0002-don-t-use-glibc-specific-qsort_r.patch \ - file://0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch \ - file://0004-add-fallback-parse_printf_format-implementation.patch \ - file://0005-src-basic-missing.h-check-for-missing-strndupa.patch \ - file://0006-Include-netinet-if_ether.h.patch \ - file://0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not.patch \ - file://0008-add-missing-FTW_-macros-for-musl.patch \ - file://0010-fix-missing-of-__register_atfork-for-non-glibc-build.patch \ - file://0011-Use-uintmax_t-for-handling-rlim_t.patch \ - file://0014-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch \ - file://0015-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch \ - file://0016-Define-glibc-compatible-basename-for-non-glibc-syste.patch \ - file://0017-Do-not-disable-buffering-when-writing-to-oom_score_a.patch \ - file://0018-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch \ - file://0019-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch \ - file://0020-missing_type.h-add-__compar_d_fn_t-definition.patch \ - file://0021-avoid-redefinition-of-prctl_mm_map-structure.patch \ - file://0021-Handle-missing-LOCK_EX.patch \ - file://0022-Fix-incompatible-pointer-type-struct-sockaddr_un.patch \ - file://0024-test-json.c-define-M_PIl.patch \ - file://0001-do-not-disable-buffer-in-writing-files.patch \ - file://0002-src-login-brightness.c-include-sys-wait.h.patch \ - file://0003-src-basic-copy.c-include-signal.h.patch \ - file://0004-src-shared-cpu-set-util.h-add-__cpu_mask-definition.patch \ - file://0001-Handle-missing-gshadow.patch \ + file://0001-missing_type.h-add-comparison_fn_t.patch \ + file://0002-add-fallback-parse_printf_format-implementation.patch \ + file://0003-src-basic-missing.h-check-for-missing-strndupa.patch \ + file://0004-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch \ + file://0005-add-missing-FTW_-macros-for-musl.patch \ + file://0006-Use-uintmax_t-for-handling-rlim_t.patch \ + file://0007-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch \ + file://0008-Define-glibc-compatible-basename-for-non-glibc-syste.patch \ + file://0009-Do-not-disable-buffering-when-writing-to-oom_score_a.patch \ + file://0010-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch \ + file://0011-avoid-redefinition-of-prctl_mm_map-structure.patch \ + file://0012-do-not-disable-buffer-in-writing-files.patch \ + file://0013-Handle-__cpu_mask-usage.patch \ + file://0014-Handle-missing-gshadow.patch \ + file://0015-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch \ + file://0016-pass-correct-parameters-to-getdents64.patch \ + file://0017-Adjust-for-musl-headers.patch \ + file://0018-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch \ + file://0019-errno-util-Make-STRERROR-portable-for-musl.patch \ + file://0020-sd-event-Make-malloc_trim-conditional-on-glibc.patch \ + file://0021-shared-Do-not-use-malloc_info-on-musl.patch \ + file://0022-avoid-missing-LOCK_EX-declaration.patch \ " PAM_PLUGINS = " \ pam-plugin-unix \ pam-plugin-loginuid \ pam-plugin-keyinit \ + pam-plugin-namespace \ " PACKAGECONFIG ??= " \ - ${@bb.utils.filter('DISTRO_FEATURES', 'acl audit efi ldconfig pam selinux smack usrmerge polkit', d)} \ + ${@bb.utils.filter('DISTRO_FEATURES', 'acl audit efi ldconfig pam pni-names selinux smack usrmerge polkit seccomp', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'minidebuginfo', 'coredump elfutils', '', d)} \ ${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'rfkill', '', d)} \ ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '', d)} \ + ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '', 'link-udev-shared', d)} \ backlight \ binfmt \ + cgroupv2 \ gshadow \ hibernate \ hostnamed \ @@ -93,10 +98,11 @@ PACKAGECONFIG ??= " \ userdb \ utmp \ vconsole \ - xz \ + wheel-group \ + zstd \ " -PACKAGECONFIG_remove_libc-musl = " \ +PACKAGECONFIG:remove:libc-musl = " \ gshadow \ idn \ localed \ @@ -109,7 +115,13 @@ PACKAGECONFIG_remove_libc-musl = " \ utmp \ " -CFLAGS_append_libc-musl = " -D__UAPI_DEF_ETHHDR=0 " +# https://github.com/seccomp/libseccomp/issues/347 +PACKAGECONFIG:remove:mipsarch = "seccomp" + +TARGET_CC_ARCH:append:libc-musl = " -D__UAPI_DEF_ETHHDR=0 -D_LARGEFILE64_SOURCE" + +# Some of the dependencies are weak-style recommends - if not available at runtime, +# systemd won't fail but the library-related feature will be skipped with a warning. # Use the upstream systemd serial-getty@.service and rely on # systemd-getty-generator instead of using the OE-core specific @@ -123,12 +135,21 @@ PACKAGECONFIG[binfmt] = "-Dbinfmt=true,-Dbinfmt=false" PACKAGECONFIG[bzip2] = "-Dbzip2=true,-Dbzip2=false,bzip2" PACKAGECONFIG[cgroupv2] = "-Ddefault-hierarchy=unified,-Ddefault-hierarchy=hybrid" PACKAGECONFIG[coredump] = "-Dcoredump=true,-Dcoredump=false" -PACKAGECONFIG[cryptsetup] = "-Dlibcryptsetup=true,-Dlibcryptsetup=false,cryptsetup" +PACKAGECONFIG[cryptsetup] = "-Dlibcryptsetup=true,-Dlibcryptsetup=false,cryptsetup,,cryptsetup" +PACKAGECONFIG[cryptsetup-plugins] = "-Dlibcryptsetup-plugins=true,-Dlibcryptsetup-plugins=false,cryptsetup,,cryptsetup" +PACKAGECONFIG[tpm2] = "-Dtpm2=true,-Dtpm2=false,tpm2-tss,tpm2-tss libtss2 libtss2-tcti-device" +# If multiple compression libraries are enabled, the format to use for compression is chosen implicitly, +# so if you want to compress with e.g. lz4 you cannot enable zstd, so you cannot read zstd-compressed journal files. +# This option allows to enable all compression formats for reading, but choosing a specific one for writing. +PACKAGECONFIG[default-compression-lz4] = "-Dlz4=true -Ddefault-compression=lz4,,lz4" +PACKAGECONFIG[default-compression-xz] = "-Dxz=true -Ddefault-compression=xz,,xz" +PACKAGECONFIG[default-compression-zstd] = "-Dzstd=true -Ddefault-compression=zstd,,zstd" PACKAGECONFIG[dbus] = "-Ddbus=true,-Ddbus=false,dbus" -PACKAGECONFIG[efi] = "-Defi=true,-Defi=false" -PACKAGECONFIG[gnu-efi] = "-Dgnu-efi=true -Defi-libdir=${STAGING_LIBDIR} -Defi-includedir=${STAGING_INCDIR}/efi,-Dgnu-efi=false,gnu-efi" -PACKAGECONFIG[elfutils] = "-Delfutils=true,-Delfutils=false,elfutils" +PACKAGECONFIG[efi] = "-Defi=true -Dbootloader=true,-Defi=false -Dbootloader=false,python3-pyelftools-native" +PACKAGECONFIG[elfutils] = "-Delfutils=true,-Delfutils=false,elfutils,,libelf libdw" PACKAGECONFIG[firstboot] = "-Dfirstboot=true,-Dfirstboot=false" +PACKAGECONFIG[repart] = "-Drepart=true,-Drepart=false" +PACKAGECONFIG[homed] = "-Dhomed=true,-Dhomed=false" # Sign the journal for anti-tampering PACKAGECONFIG[gcrypt] = "-Dgcrypt=true,-Dgcrypt=false,libgcrypt" PACKAGECONFIG[gnutls] = "-Dgnutls=true,-Dgnutls=false,gnutls" @@ -137,15 +158,19 @@ PACKAGECONFIG[hibernate] = "-Dhibernate=true,-Dhibernate=false" PACKAGECONFIG[hostnamed] = "-Dhostnamed=true,-Dhostnamed=false" PACKAGECONFIG[idn] = "-Didn=true,-Didn=false" PACKAGECONFIG[ima] = "-Dima=true,-Dima=false" -# importd requires curl/xz/zlib/bzip2/gcrypt -PACKAGECONFIG[importd] = "-Dimportd=true,-Dimportd=false" +# importd requires journal-upload/xz/zlib/bzip2/gcrypt +PACKAGECONFIG[importd] = "-Dimportd=true,-Dimportd=false,glib-2.0" # Update NAT firewall rules PACKAGECONFIG[iptc] = "-Dlibiptc=true,-Dlibiptc=false,iptables" +PACKAGECONFIG[journal-color] = ",,,less" PACKAGECONFIG[journal-upload] = "-Dlibcurl=true,-Dlibcurl=false,curl" PACKAGECONFIG[kmod] = "-Dkmod=true,-Dkmod=false,kmod" PACKAGECONFIG[ldconfig] = "-Dldconfig=true,-Dldconfig=false,,ldconfig" -PACKAGECONFIG[libidn] = "-Dlibidn=true,-Dlibidn=false,libidn" -PACKAGECONFIG[libidn2] = "-Dlibidn2=true,-Dlibidn2=false,libidn2" +PACKAGECONFIG[libidn] = "-Dlibidn=true,-Dlibidn=false,libidn,,libidn" +PACKAGECONFIG[libidn2] = "-Dlibidn2=true,-Dlibidn2=false,libidn2,,libidn2" +# Link udev shared with systemd helper library. +# If enabled the udev package depends on the systemd package (which has the needed shared library). +PACKAGECONFIG[link-udev-shared] = "-Dlink-udev-shared=true,-Dlink-udev-shared=false" PACKAGECONFIG[localed] = "-Dlocaled=true,-Dlocaled=false" PACKAGECONFIG[logind] = "-Dlogind=true,-Dlogind=false" PACKAGECONFIG[lz4] = "-Dlz4=true,-Dlz4=false,lz4" @@ -154,26 +179,36 @@ PACKAGECONFIG[manpages] = "-Dman=true,-Dman=false,libxslt-native xmlto-native do PACKAGECONFIG[microhttpd] = "-Dmicrohttpd=true,-Dmicrohttpd=false,libmicrohttpd" PACKAGECONFIG[myhostname] = "-Dnss-myhostname=true,-Dnss-myhostname=false,,libnss-myhostname" PACKAGECONFIG[networkd] = "-Dnetworkd=true,-Dnetworkd=false" -PACKAGECONFIG[nss] = "-Dnss-systemd=true,-Dnss-systemd=false" +PACKAGECONFIG[no-dns-fallback] = "-Ddns-servers=" +PACKAGECONFIG[no-ntp-fallback] = "-Dntp-servers=" +PACKAGECONFIG[nss] = "-Dnss-systemd=true,-Dnss-systemd=false,,libnss-systemd" PACKAGECONFIG[nss-mymachines] = "-Dnss-mymachines=true,-Dnss-mymachines=false" PACKAGECONFIG[nss-resolve] = "-Dnss-resolve=true,-Dnss-resolve=false" +PACKAGECONFIG[oomd] = "-Doomd=true,-Doomd=false" PACKAGECONFIG[openssl] = "-Dopenssl=true,-Dopenssl=false,openssl" +PACKAGECONFIG[p11kit] = "-Dp11kit=true,-Dp11kit=false,p11-kit" PACKAGECONFIG[pam] = "-Dpam=true,-Dpam=false,libpam,${PAM_PLUGINS}" PACKAGECONFIG[pcre2] = "-Dpcre2=true,-Dpcre2=false,libpcre2" PACKAGECONFIG[polkit] = "-Dpolkit=true,-Dpolkit=false" +# If polkit is disabled and networkd+hostnamed are in use, enabling this option and +# using dbus-broker will allow networkd to be authorized to change the +# hostname without acquiring additional privileges +PACKAGECONFIG[polkit_hostnamed_fallback] = ",,,,dbus-broker,polkit" PACKAGECONFIG[portabled] = "-Dportabled=true,-Dportabled=false" -PACKAGECONFIG[qrencode] = "-Dqrencode=true,-Dqrencode=false,qrencode" +PACKAGECONFIG[pstore] = "-Dpstore=true,-Dpstore=false" +PACKAGECONFIG[pni-names] = ",,," +PACKAGECONFIG[qrencode] = "-Dqrencode=true,-Dqrencode=false,qrencode,,qrencode" PACKAGECONFIG[quotacheck] = "-Dquotacheck=true,-Dquotacheck=false" PACKAGECONFIG[randomseed] = "-Drandomseed=true,-Drandomseed=false" PACKAGECONFIG[resolved] = "-Dresolve=true,-Dresolve=false" PACKAGECONFIG[rfkill] = "-Drfkill=true,-Drfkill=false" -# libseccomp is found in meta-security PACKAGECONFIG[seccomp] = "-Dseccomp=true,-Dseccomp=false,libseccomp" PACKAGECONFIG[selinux] = "-Dselinux=true,-Dselinux=false,libselinux,initscripts-sushell" PACKAGECONFIG[smack] = "-Dsmack=true,-Dsmack=false" +PACKAGECONFIG[sysext] = "-Dsysext=true, -Dsysext=false" PACKAGECONFIG[sysusers] = "-Dsysusers=true,-Dsysusers=false" PACKAGECONFIG[sysvinit] = "-Dsysvinit-path=${sysconfdir}/init.d -Dsysvrcnd-path=${sysconfdir},-Dsysvinit-path= -Dsysvrcnd-path=,,systemd-compat-units update-rc.d" -# When enabled use reproducble build timestamp if set as time epoch, +# When enabled use reproducible build timestamp if set as time epoch, # or build time if not. When disabled, time epoch is unset. def build_epoch(d): epoch = d.getVar('SOURCE_DATE_EPOCH') or "-1" @@ -187,11 +222,15 @@ PACKAGECONFIG[userdb] = "-Duserdb=true,-Duserdb=false" PACKAGECONFIG[utmp] = "-Dutmp=true,-Dutmp=false" PACKAGECONFIG[valgrind] = "-DVALGRIND=1,,valgrind" PACKAGECONFIG[vconsole] = "-Dvconsole=true,-Dvconsole=false,,${PN}-vconsole-setup" +PACKAGECONFIG[wheel-group] = "-Dwheel-group=true, -Dwheel-group=false" PACKAGECONFIG[xdg-autostart] = "-Dxdg-autostart=true,-Dxdg-autostart=false" # Verify keymaps on locale change PACKAGECONFIG[xkbcommon] = "-Dxkbcommon=true,-Dxkbcommon=false,libxkbcommon" PACKAGECONFIG[xz] = "-Dxz=true,-Dxz=false,xz" PACKAGECONFIG[zlib] = "-Dzlib=true,-Dzlib=false,zlib" +PACKAGECONFIG[zstd] = "-Dzstd=true,-Dzstd=false,zstd" + +RESOLV_CONF ??= "" # Helper variables to clarify locations. This mirrors the logic in systemd's # build system. @@ -199,19 +238,23 @@ rootprefix ?= "${root_prefix}" rootlibdir ?= "${base_libdir}" rootlibexecdir = "${rootprefix}/lib" -# This links udev statically with systemd helper library. -# Otherwise udev package would depend on systemd package (which has the needed shared library), -# and always pull it into images. -EXTRA_OEMESON += "-Dlink-udev-shared=false" - EXTRA_OEMESON += "-Dnobody-user=nobody \ - -Dnobody-group=nobody \ + -Dnobody-group=nogroup \ -Drootlibdir=${rootlibdir} \ -Drootprefix=${rootprefix} \ -Ddefault-locale=C \ + -Dmode=release \ + -Dsystem-alloc-uid-min=101 \ + -Dsystem-uid-max=999 \ + -Dsystem-alloc-gid-min=101 \ + -Dsystem-gid-max=999 \ + -Dcreate-log-dirs=false \ + ${@bb.utils.contains('DISTRO_FEATURES', 'zeroconf', '-Ddefault-mdns=no -Ddefault-llmnr=no', '', d)} \ " -# Hardcode target binary paths to avoid using paths from sysroot +# Hardcode target binary paths to avoid using paths from sysroot or worse +# it pokes for these binaries on build host and encodes that distro assumption +# into target EXTRA_OEMESON += "-Dkexec-path=${sbindir}/kexec \ -Dkmod-path=${base_bindir}/kmod \ -Dmount-path=${base_bindir}/mount \ @@ -219,14 +262,29 @@ EXTRA_OEMESON += "-Dkexec-path=${sbindir}/kexec \ -Dquotaon-path=${sbindir}/quotaon \ -Dsulogin-path=${base_sbindir}/sulogin \ -Dnologin-path=${base_sbindir}/nologin \ - -Dumount-path=${base_bindir}/umount" + -Dumount-path=${base_bindir}/umount \ + -Dloadkeys-path=${bindir}/loadkeys \ + -Dsetfont-path=${bindir}/setfont" + +# The 60 seconds is watchdog's default vaule. +WATCHDOG_TIMEOUT ??= "60" do_install() { meson_do_install + if ${@bb.utils.contains('PACKAGECONFIG', 'sysusers', 'true', 'false', d)}; then + # Change the root user's home directory in /lib/sysusers.d/basic.conf. + # This is done merely for backward compatibility with previous systemd recipes. + # systemd hardcodes root user's HOME to be "/root". Changing to use other values + # may have unexpected runtime behaviors. + if [ "${ROOT_HOME}" != "/root" ]; then + bbwarn "Using ${ROOT_HOME} as root user's home directory is not fully supported by systemd" + sed -i -e 's#/root#${ROOT_HOME}#g' ${D}${exec_prefix}/lib/sysusers.d/basic.conf + fi + fi install -d ${D}/${base_sbindir} if ${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', 'false', 'true', d)}; then # Provided by a separate recipe - rm ${D}${systemd_unitdir}/system/serial-getty* -f + rm ${D}${systemd_system_unitdir}/serial-getty* -f fi # Provide support for initramfs @@ -234,12 +292,12 @@ do_install() { [ ! -e ${D}/${base_sbindir}/udevd ] && ln -s ${rootlibexecdir}/systemd/systemd-udevd ${D}/${base_sbindir}/udevd install -d ${D}${sysconfdir}/udev/rules.d/ - install -d ${D}${sysconfdir}/tmpfiles.d + install -d ${D}${nonarch_libdir}/tmpfiles.d for rule in $(find ${WORKDIR} -maxdepth 1 -type f -name "*.rules"); do install -m 0644 $rule ${D}${sysconfdir}/udev/rules.d/ done - install -m 0644 ${WORKDIR}/00-create-volatile.conf ${D}${sysconfdir}/tmpfiles.d/ + install -m 0644 ${WORKDIR}/00-create-volatile.conf ${D}${nonarch_libdir}/tmpfiles.d/ if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then install -d ${D}${sysconfdir}/init.d @@ -248,33 +306,44 @@ do_install() { install -Dm 0755 ${S}/src/systemctl/systemd-sysv-install.SKELETON ${D}${systemd_unitdir}/systemd-sysv-install fi - chown root:systemd-journal ${D}/${localstatedir}/log/journal + if "${@'true' if oe.types.boolean(d.getVar('VOLATILE_LOG_DIR')) else 'false'}"; then + # /var/log is typically a symbolic link to inside /var/volatile, + # which is expected to be empty. + rm -rf ${D}${localstatedir}/log + elif [ -e ${D}${localstatedir}/log/journal ]; then + chown root:systemd-journal ${D}${localstatedir}/log/journal - # Delete journal README, as log can be symlinked inside volatile. - rm -f ${D}/${localstatedir}/log/README + # journal-remote creates this at start + rm -rf ${D}${localstatedir}/log/journal/remote + fi - # journal-remote creates this at start - rm -rf ${D}/${localstatedir}/log/journal/remote + # if the user requests /tmp be on persistent storage (i.e. not volatile) + # then don't use a tmpfs for /tmp + if [ "${VOLATILE_TMP_DIR}" != "yes" ]; then + rm -f ${D}${rootlibdir}/systemd/system/tmp.mount + rm -f ${D}${rootlibdir}/systemd/system/local-fs.target.wants/tmp.mount + fi - install -d ${D}${systemd_unitdir}/system/graphical.target.wants - install -d ${D}${systemd_unitdir}/system/multi-user.target.wants - install -d ${D}${systemd_unitdir}/system/poweroff.target.wants - install -d ${D}${systemd_unitdir}/system/reboot.target.wants - install -d ${D}${systemd_unitdir}/system/rescue.target.wants + install -d ${D}${systemd_system_unitdir}/graphical.target.wants + install -d ${D}${systemd_system_unitdir}/multi-user.target.wants + install -d ${D}${systemd_system_unitdir}/poweroff.target.wants + install -d ${D}${systemd_system_unitdir}/reboot.target.wants + install -d ${D}${systemd_system_unitdir}/rescue.target.wants # Create symlinks for systemd-update-utmp-runlevel.service if ${@bb.utils.contains('PACKAGECONFIG', 'utmp', 'true', 'false', d)}; then - ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/graphical.target.wants/systemd-update-utmp-runlevel.service - ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/multi-user.target.wants/systemd-update-utmp-runlevel.service - ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/poweroff.target.wants/systemd-update-utmp-runlevel.service - ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/reboot.target.wants/systemd-update-utmp-runlevel.service - ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/rescue.target.wants/systemd-update-utmp-runlevel.service + ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/graphical.target.wants/systemd-update-utmp-runlevel.service + ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/multi-user.target.wants/systemd-update-utmp-runlevel.service + ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/poweroff.target.wants/systemd-update-utmp-runlevel.service + ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/reboot.target.wants/systemd-update-utmp-runlevel.service + ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/rescue.target.wants/systemd-update-utmp-runlevel.service fi # this file is needed to exist if networkd is disabled but timesyncd is still in use since timesyncd checks it # for existence else it fails - if [ -s ${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf ]; then - ${@bb.utils.contains('PACKAGECONFIG', 'networkd', ':', 'sed -i -e "\$ad /run/systemd/netif/links 0755 root root -" ${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf', d)} + if [ -s ${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf ] && + ! ${@bb.utils.contains('PACKAGECONFIG', 'networkd', 'true', 'false', d)}; then + echo 'd /run/systemd/netif/links 0755 root root -' >>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf fi if ! ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'true', 'false', d)}; then echo 'L! ${sysconfdir}/resolv.conf - - - - ../run/systemd/resolve/resolv.conf' >>${D}${exec_prefix}/lib/tmpfiles.d/etc.conf @@ -282,8 +351,9 @@ do_install() { echo 'f /run/systemd/resolve/resolv.conf 0644 root root' >>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf ln -s ../run/systemd/resolve/resolv.conf ${D}${sysconfdir}/resolv-conf.systemd else - sed -i -e "s%^L! /etc/resolv.conf.*$%L! /etc/resolv.conf - - - - ../run/systemd/resolve/resolv.conf%g" ${D}${exec_prefix}/lib/tmpfiles.d/etc.conf - ln -s ../run/systemd/resolve/resolv.conf ${D}${sysconfdir}/resolv-conf.systemd + resolv_conf="${@bb.utils.contains('RESOLV_CONF', 'stub-resolv', 'run/systemd/resolve/stub-resolv.conf', 'run/systemd/resolve/resolv.conf', d)}" + sed -i -e "s%^L! /etc/resolv.conf.*$%L! /etc/resolv.conf - - - - ../${resolv_conf}%g" ${D}${exec_prefix}/lib/tmpfiles.d/etc.conf + ln -s ../${resolv_conf} ${D}${sysconfdir}/resolv-conf.systemd fi if ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'false', 'true', d)}; then rm ${D}${exec_prefix}/lib/tmpfiles.d/x11.conf @@ -298,135 +368,167 @@ do_install() { fi fi + # If polkit is not available and a fallback was requested, install a drop-in that allows networkd to + # request hostname changes via DBUS without elevating its privileges + if ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'true', 'false', d)}; then + install -d ${D}${systemd_system_unitdir}/systemd-hostnamed.service.d/ + install -m 0644 ${WORKDIR}/00-hostnamed-network-user.conf ${D}${systemd_system_unitdir}/systemd-hostnamed.service.d/ + install -d ${D}${datadir}/dbus-1/system.d/ + install -m 0644 ${WORKDIR}/org.freedesktop.hostname1_no_polkit.conf ${D}${datadir}/dbus-1/system.d/ + fi + # create link for existing udev rules ln -s ${base_bindir}/udevadm ${D}${base_sbindir}/udevadm - # duplicate udevadm for postinst script - install -d ${D}${libexecdir} - ln ${D}${base_bindir}/udevadm ${D}${libexecdir}/${MLPREFIX}udevadm - # install default policy for presets # https://www.freedesktop.org/wiki/Software/systemd/Preset/#howto install -Dm 0644 ${WORKDIR}/99-default.preset ${D}${systemd_unitdir}/system-preset/99-default.preset # add a profile fragment to disable systemd pager with busybox less install -Dm 0644 ${WORKDIR}/systemd-pager.sh ${D}${sysconfdir}/profile.d/systemd-pager.sh + + if [ -n "${WATCHDOG_TIMEOUT}" ]; then + sed -i -e 's/#RebootWatchdogSec=10min/RebootWatchdogSec=${WATCHDOG_TIMEOUT}/' \ + ${D}/${sysconfdir}/systemd/system.conf + fi + + if ${@bb.utils.contains('PACKAGECONFIG', 'pni-names', 'true', 'false', d)}; then + if ! grep -q '^NamePolicy=.*mac' ${D}${rootlibexecdir}/systemd/network/99-default.link; then + sed -i '/^NamePolicy=/s/$/ mac/' ${D}${rootlibexecdir}/systemd/network/99-default.link + fi + if ! grep -q 'AlternativeNamesPolicy=.*mac' ${D}${rootlibexecdir}/systemd/network/99-default.link; then + sed -i '/AlternativeNamesPolicy=/s/$/ mac/' ${D}${rootlibexecdir}/systemd/network/99-default.link + fi + fi } -python populate_packages_prepend (){ +python populate_packages:prepend (){ systemdlibdir = d.getVar("rootlibdir") - do_split_packages(d, systemdlibdir, '^lib(.*)\.so\.*', 'lib%s', 'Systemd %s library', extra_depends='', allow_links=True) + do_split_packages(d, systemdlibdir, r'^lib(.*)\.so\.*', 'lib%s', 'Systemd %s library', extra_depends='', allow_links=True) } PACKAGES_DYNAMIC += "^lib(udev|systemd|nss).*" PACKAGE_BEFORE_PN = "\ - ${PN}-gui \ - ${PN}-vconsole-setup \ - ${PN}-initramfs \ ${PN}-analyze \ - ${PN}-kernel-install \ - ${PN}-rpm-macros \ ${PN}-binfmt \ - ${PN}-zsh-completion \ ${PN}-container \ + ${PN}-crypt \ + ${PN}-extra-utils \ + ${PN}-gui \ + ${PN}-initramfs \ ${PN}-journal-gatewayd \ ${PN}-journal-upload \ ${PN}-journal-remote \ - ${PN}-extra-utils \ + ${PN}-kernel-install \ + ${PN}-rpm-macros \ ${PN}-udev-rules \ + ${PN}-vconsole-setup \ + ${PN}-zsh-completion \ + libsystemd-shared \ udev \ + udev-bash-completion \ udev-hwdb \ " -SUMMARY_${PN}-container = "Tools for containers and VMs" -DESCRIPTION_${PN}-container = "Systemd tools to spawn and manage containers and virtual machines." +SUMMARY:${PN}-container = "Tools for containers and VMs" +DESCRIPTION:${PN}-container = "Systemd tools to spawn and manage containers and virtual machines." + +SUMMARY:${PN}-journal-gatewayd = "HTTP server for journal events" +DESCRIPTION:${PN}-journal-gatewayd = "systemd-journal-gatewayd serves journal events over the network. Clients must connect using HTTP. The server listens on port 19531 by default." -SUMMARY_${PN}-journal-gatewayd = "HTTP server for journal events" -DESCRIPTION_${PN}-journal-gatewayd = "systemd-journal-gatewayd serves journal events over the network. Clients must connect using HTTP. The server listens on port 19531 by default." +SUMMARY:${PN}-journal-upload = "Send journal messages over the network" +DESCRIPTION:${PN}-journal-upload = "systemd-journal-upload uploads journal entries to a specified URL." -SUMMARY_${PN}-journal-upload = "Send journal messages over the network" -DESCRIPTION_${PN}-journal-upload = "systemd-journal-upload uploads journal entries to a specified URL." +SUMMARY:${PN}-journal-remote = "Receive journal messages over the network" +DESCRIPTION:${PN}-journal-remote = "systemd-journal-remote is a command to receive serialized journal events and store them to journal files." -SUMMARY_${PN}-journal-remote = "Receive journal messages over the network" -DESCRIPTION_${PN}-journal-remote = "systemd-journal-remote is a command to receive serialized journal events and store them to journal files." +SUMMARY:libsystemd-shared = "Systemd shared library" SYSTEMD_PACKAGES = "${@bb.utils.contains('PACKAGECONFIG', 'binfmt', '${PN}-binfmt', '', d)} \ ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-gatewayd', '', d)} \ ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-remote', '', d)} \ ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \ " -SYSTEMD_SERVICE_${PN}-binfmt = "systemd-binfmt.service" +SYSTEMD_SERVICE:${PN}-binfmt = "systemd-binfmt.service" -USERADD_PACKAGES = "${PN} ${PN}-extra-utils \ - ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-gateway', '', d)} \ +USERADD_PACKAGES = "${PN} \ + udev \ + ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-gatewayd', '', d)} \ ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-remote', '', d)} \ ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \ " -GROUPADD_PARAM_${PN} = "-r systemd-journal" -USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'coredump', '--system -d / -M --shell /bin/nologin systemd-coredump;', '', d)}" -USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'networkd', '--system -d / -M --shell /bin/nologin systemd-network;', '', d)}" -USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'polkit', '--system --no-create-home --user-group --home-dir ${sysconfdir}/polkit-1 polkitd;', '', d)}" -USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'resolved', '--system -d / -M --shell /bin/nologin systemd-resolve;', '', d)}" -USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'timesyncd', '--system -d / -M --shell /bin/nologin systemd-timesync;', '', d)}" -USERADD_PARAM_${PN}-extra-utils = "--system -d / -M --shell /bin/nologin systemd-bus-proxy" -USERADD_PARAM_${PN}-journal-gateway = "--system -d / -M --shell /bin/nologin systemd-journal-gateway" -USERADD_PARAM_${PN}-journal-remote = "--system -d / -M --shell /bin/nologin systemd-journal-remote" -USERADD_PARAM_${PN}-journal-upload = "--system -d / -M --shell /bin/nologin systemd-journal-upload" - -FILES_${PN}-analyze = "${bindir}/systemd-analyze" - -FILES_${PN}-initramfs = "/init" -RDEPENDS_${PN}-initramfs = "${PN}" - -FILES_${PN}-gui = "${bindir}/systemadm" - -FILES_${PN}-vconsole-setup = "${rootlibexecdir}/systemd/systemd-vconsole-setup \ - ${systemd_unitdir}/system/systemd-vconsole-setup.service \ - ${systemd_unitdir}/system/sysinit.target.wants/systemd-vconsole-setup.service" - -RDEPENDS_${PN}-kernel-install += "bash" -FILES_${PN}-kernel-install = "${bindir}/kernel-install \ +GROUPADD_PARAM:${PN} = "-r systemd-journal;" +GROUPADD_PARAM:udev = "-r render" +GROUPADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', '-r systemd-hostname;', '', d)}" +USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'coredump', '--system -d / -M --shell /sbin/nologin systemd-coredump;', '', d)}" +USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'networkd', '--system -d / -M --shell /sbin/nologin systemd-network;', '', d)}" +USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'polkit', '--system --no-create-home --user-group --home-dir ${sysconfdir}/polkit-1 polkitd;', '', d)}" +USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'resolved', '--system -d / -M --shell /sbin/nologin systemd-resolve;', '', d)}" +USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'timesyncd', '--system -d / -M --shell /sbin/nologin systemd-timesync;', '', d)}" +USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'oomd', '--system -d / -M --shell /sbin/nologin systemd-oom;', '', d)}" +USERADD_PARAM:${PN}-journal-gatewayd = "--system -d / -M --shell /sbin/nologin systemd-journal-gateway" +USERADD_PARAM:${PN}-journal-remote = "--system -d / -M --shell /sbin/nologin systemd-journal-remote" +USERADD_PARAM:${PN}-journal-upload = "--system -d / -M --shell /sbin/nologin systemd-journal-upload" + +FILES:${PN}-analyze = "${bindir}/systemd-analyze" + +FILES:${PN}-crypt = "${bindir}/systemd-cryptenroll \ + ${libdir}/cryptsetup \ + " +RRECOMMENDS:${PN} += "${PN}-crypt" + +FILES:${PN}-initramfs = "/init" +RDEPENDS:${PN}-initramfs = "${PN}" + +FILES:${PN}-gui = "${bindir}/systemadm" + +FILES:${PN}-vconsole-setup = "${rootlibexecdir}/systemd/systemd-vconsole-setup \ + ${systemd_system_unitdir}/systemd-vconsole-setup.service \ + ${systemd_system_unitdir}/sysinit.target.wants/systemd-vconsole-setup.service" + +RDEPENDS:${PN}-kernel-install += "bash" +FILES:${PN}-kernel-install = "${bindir}/kernel-install \ ${sysconfdir}/kernel/ \ ${exec_prefix}/lib/kernel \ " -FILES_${PN}-rpm-macros = "${exec_prefix}/lib/rpm \ +FILES:${PN}-rpm-macros = "${exec_prefix}/lib/rpm \ " -FILES_${PN}-zsh-completion = "${datadir}/zsh/site-functions" +FILES:${PN}-zsh-completion = "${datadir}/zsh/site-functions" -FILES_${PN}-binfmt = "${sysconfdir}/binfmt.d/ \ +FILES:${PN}-binfmt = "${sysconfdir}/binfmt.d/ \ ${exec_prefix}/lib/binfmt.d \ ${rootlibexecdir}/systemd/systemd-binfmt \ - ${systemd_unitdir}/system/proc-sys-fs-binfmt_misc.* \ - ${systemd_unitdir}/system/systemd-binfmt.service" -RRECOMMENDS_${PN}-binfmt = "kernel-module-binfmt-misc" + ${systemd_system_unitdir}/proc-sys-fs-binfmt_misc.* \ + ${systemd_system_unitdir}/systemd-binfmt.service" +RRECOMMENDS:${PN}-binfmt = "${@bb.utils.contains('PACKAGECONFIG', 'binfmt', 'kernel-module-binfmt-misc', '', d)}" -RRECOMMENDS_${PN}-vconsole-setup = "kbd kbd-consolefonts kbd-keymaps" +RDEPENDS:${PN}-vconsole-setup = "${@bb.utils.contains('PACKAGECONFIG', 'vconsole', 'kbd kbd-consolefonts kbd-keymaps', '', d)}" -FILES_${PN}-journal-gatewayd = "${rootlibexecdir}/systemd/systemd-journal-gatewayd \ +FILES:${PN}-journal-gatewayd = "${rootlibexecdir}/systemd/systemd-journal-gatewayd \ ${systemd_system_unitdir}/systemd-journal-gatewayd.service \ ${systemd_system_unitdir}/systemd-journal-gatewayd.socket \ ${systemd_system_unitdir}/sockets.target.wants/systemd-journal-gatewayd.socket \ ${datadir}/systemd/gatewayd/browse.html \ " -SYSTEMD_SERVICE_${PN}-journal-gatewayd = "systemd-journal-gatewayd.socket" +SYSTEMD_SERVICE:${PN}-journal-gatewayd = "systemd-journal-gatewayd.socket" -FILES_${PN}-journal-upload = "${rootlibexecdir}/systemd/systemd-journal-upload \ +FILES:${PN}-journal-upload = "${rootlibexecdir}/systemd/systemd-journal-upload \ ${systemd_system_unitdir}/systemd-journal-upload.service \ ${sysconfdir}/systemd/journal-upload.conf \ " -SYSTEMD_SERVICE_${PN}-journal-upload = "systemd-journal-upload.service" +SYSTEMD_SERVICE:${PN}-journal-upload = "systemd-journal-upload.service" -FILES_${PN}-journal-remote = "${rootlibexecdir}/systemd/systemd-journal-remote \ +FILES:${PN}-journal-remote = "${rootlibexecdir}/systemd/systemd-journal-remote \ ${sysconfdir}/systemd/journal-remote.conf \ ${systemd_system_unitdir}/systemd-journal-remote.service \ ${systemd_system_unitdir}/systemd-journal-remote.socket \ " -SYSTEMD_SERVICE_${PN}-journal-remote = "systemd-journal-remote.socket" +SYSTEMD_SERVICE:${PN}-journal-remote = "systemd-journal-remote.socket" -FILES_${PN}-container = "${sysconfdir}/dbus-1/system.d/org.freedesktop.import1.conf \ +FILES:${PN}-container = "${sysconfdir}/dbus-1/system.d/org.freedesktop.import1.conf \ ${sysconfdir}/dbus-1/system.d/org.freedesktop.machine1.conf \ ${sysconfdir}/systemd/system/multi-user.target.wants/machines.target \ ${base_bindir}/machinectl \ @@ -450,8 +552,8 @@ FILES_${PN}-container = "${sysconfdir}/dbus-1/system.d/org.freedesktop.import1.c ${rootlibexecdir}/systemd/systemd-machined \ ${rootlibexecdir}/systemd/systemd-pull \ ${exec_prefix}/lib/tmpfiles.d/systemd-nspawn.conf \ + ${exec_prefix}/lib/tmpfiles.d/README \ ${systemd_system_unitdir}/systemd-nspawn@.service \ - ${libdir}/libnss_mymachines.so.2 \ ${datadir}/dbus-1/system-services/org.freedesktop.import1.service \ ${datadir}/dbus-1/system-services/org.freedesktop.machine1.service \ ${datadir}/dbus-1/system.d/org.freedesktop.import1.conf \ @@ -460,62 +562,77 @@ FILES_${PN}-container = "${sysconfdir}/dbus-1/system.d/org.freedesktop.import1.c ${datadir}/polkit-1/actions/org.freedesktop.machine1.policy \ " -RRECOMMENDS_${PN}-container += "\ - ${PN}-journal-upload \ - ${PN}-journal-remote \ +RDEPENDS:${PN}-container = "${@bb.utils.contains('PACKAGECONFIG', 'nss-mymachines', 'libnss-mymachines', '', d)}" + +# "machinectl import-tar" uses "tar --numeric-owner", not supported by busybox. +RRECOMMENDS:${PN}-container += "\ ${PN}-journal-gatewayd \ + ${PN}-journal-remote \ + ${PN}-journal-upload \ + kernel-module-dm-mod \ + kernel-module-loop \ + kernel-module-tun \ + tar \ " -FILES_${PN}-extra-utils = "\ +FILES:${PN}-extra-utils = "\ ${base_bindir}/systemd-escape \ ${base_bindir}/systemd-inhibit \ ${bindir}/systemd-detect-virt \ + ${bindir}/systemd-dissect \ ${bindir}/systemd-path \ ${bindir}/systemd-run \ ${bindir}/systemd-cat \ + ${bindir}/systemd-creds \ ${bindir}/systemd-delta \ ${bindir}/systemd-cgls \ ${bindir}/systemd-cgtop \ ${bindir}/systemd-stdio-bridge \ ${base_bindir}/systemd-ask-password \ ${base_bindir}/systemd-tty-ask-password-agent \ - ${systemd_unitdir}/system/systemd-ask-password-console.path \ - ${systemd_unitdir}/system/systemd-ask-password-console.service \ - ${systemd_unitdir}/system/systemd-ask-password-wall.path \ - ${systemd_unitdir}/system/systemd-ask-password-wall.service \ - ${systemd_unitdir}/system/sysinit.target.wants/systemd-ask-password-console.path \ - ${systemd_unitdir}/system/sysinit.target.wants/systemd-ask-password-wall.path \ - ${systemd_unitdir}/system/multi-user.target.wants/systemd-ask-password-wall.path \ + ${base_sbindir}/mount.ddi \ + ${systemd_system_unitdir}/initrd.target.wants/systemd-pcrphase-initrd.path \ + ${systemd_system_unitdir}/systemd-ask-password-console.path \ + ${systemd_system_unitdir}/systemd-ask-password-console.service \ + ${systemd_system_unitdir}/systemd-ask-password-wall.path \ + ${systemd_system_unitdir}/systemd-ask-password-wall.service \ + ${systemd_system_unitdir}/sysinit.target.wants/systemd-ask-password-console.path \ + ${systemd_system_unitdir}/sysinit.target.wants/systemd-ask-password-wall.path \ + ${systemd_system_unitdir}/sysinit.target.wants/systemd-pcrphase.path \ + ${systemd_system_unitdir}/sysinit.target.wants/systemd-pcrphase-sysinit.path \ + ${systemd_system_unitdir}/multi-user.target.wants/systemd-ask-password-wall.path \ ${rootlibexecdir}/systemd/systemd-resolve-host \ ${rootlibexecdir}/systemd/systemd-ac-power \ ${rootlibexecdir}/systemd/systemd-activate \ - ${rootlibexecdir}/systemd/systemd-bus-proxyd \ - ${systemd_unitdir}/system/systemd-bus-proxyd.service \ - ${systemd_unitdir}/system/systemd-bus-proxyd.socket \ + ${rootlibexecdir}/systemd/systemd-measure \ + ${rootlibexecdir}/systemd/systemd-pcrphase \ ${rootlibexecdir}/systemd/systemd-socket-proxyd \ ${rootlibexecdir}/systemd/systemd-reply-password \ ${rootlibexecdir}/systemd/systemd-sleep \ ${rootlibexecdir}/systemd/system-sleep \ - ${systemd_unitdir}/system/systemd-hibernate.service \ - ${systemd_unitdir}/system/systemd-hybrid-sleep.service \ - ${systemd_unitdir}/system/systemd-suspend.service \ - ${systemd_unitdir}/system/sleep.target \ + ${systemd_system_unitdir}/systemd-hibernate.service \ + ${systemd_system_unitdir}/systemd-hybrid-sleep.service \ + ${systemd_system_unitdir}/systemd-pcrphase-initrd.service \ + ${systemd_system_unitdir}/systemd-pcrphase.service \ + ${systemd_system_unitdir}/systemd-pcrphase-sysinit.service \ + ${systemd_system_unitdir}/systemd-suspend.service \ + ${systemd_system_unitdir}/sleep.target \ ${rootlibexecdir}/systemd/systemd-initctl \ - ${systemd_unitdir}/system/systemd-initctl.service \ - ${systemd_unitdir}/system/systemd-initctl.socket \ - ${systemd_unitdir}/system/sockets.target.wants/systemd-initctl.socket \ + ${systemd_system_unitdir}/systemd-initctl.service \ + ${systemd_system_unitdir}/systemd-initctl.socket \ + ${systemd_system_unitdir}/sockets.target.wants/systemd-initctl.socket \ ${rootlibexecdir}/systemd/system-generators/systemd-gpt-auto-generator \ ${rootlibexecdir}/systemd/systemd-cgroups-agent \ " -FILES_${PN}-udev-rules = "\ +FILES:${PN}-udev-rules = "\ ${rootlibexecdir}/udev/rules.d/70-uaccess.rules \ ${rootlibexecdir}/udev/rules.d/71-seat.rules \ ${rootlibexecdir}/udev/rules.d/73-seat-late.rules \ ${rootlibexecdir}/udev/rules.d/99-systemd.rules \ " -CONFFILES_${PN} = "${sysconfdir}/systemd/coredump.conf \ +CONFFILES:${PN} = "${sysconfdir}/systemd/coredump.conf \ ${sysconfdir}/systemd/journald.conf \ ${sysconfdir}/systemd/logind.conf \ ${sysconfdir}/systemd/networkd.conf \ @@ -527,7 +644,7 @@ CONFFILES_${PN} = "${sysconfdir}/systemd/coredump.conf \ ${sysconfdir}/systemd/user.conf \ " -FILES_${PN} = " ${base_bindir}/* \ +FILES:${PN} = " ${base_bindir}/* \ ${base_sbindir}/shutdown \ ${base_sbindir}/halt \ ${base_sbindir}/poweroff \ @@ -541,6 +658,8 @@ FILES_${PN} = " ${base_bindir}/* \ ${datadir}/polkit-1 \ ${datadir}/${BPN} \ ${datadir}/factory \ + ${sysconfdir}/credstore/ \ + ${sysconfdir}/credstore.encrypted/ \ ${sysconfdir}/dbus-1/ \ ${sysconfdir}/modules-load.d/ \ ${sysconfdir}/pam.d/ \ @@ -553,6 +672,9 @@ FILES_${PN} = " ${base_bindir}/* \ ${sysconfdir}/resolv-conf.systemd \ ${sysconfdir}/X11/xinit/xinitrc.d/* \ ${rootlibexecdir}/systemd/* \ + ${rootlibdir}/systemd/libsystemd-core* \ + ${libdir}/pam.d \ + ${nonarch_libdir}/pam.d \ ${systemd_unitdir}/* \ ${base_libdir}/security/*.so \ /cgroup \ @@ -564,56 +686,71 @@ FILES_${PN} = " ${base_bindir}/* \ ${bindir}/resolvectl \ ${bindir}/timedatectl \ ${bindir}/bootctl \ + ${bindir}/oomctl \ + ${bindir}/userdbctl \ + ${exec_prefix}/lib/credstore \ ${exec_prefix}/lib/tmpfiles.d/*.conf \ ${exec_prefix}/lib/systemd \ ${exec_prefix}/lib/modules-load.d \ ${exec_prefix}/lib/sysctl.d \ ${exec_prefix}/lib/sysusers.d \ ${exec_prefix}/lib/environment.d \ + ${exec_prefix}/lib/pcrlock.d \ ${localstatedir} \ ${rootlibexecdir}/modprobe.d/systemd.conf \ + ${rootlibexecdir}/modprobe.d/README \ ${datadir}/dbus-1/system.d/org.freedesktop.timedate1.conf \ ${datadir}/dbus-1/system.d/org.freedesktop.locale1.conf \ ${datadir}/dbus-1/system.d/org.freedesktop.network1.conf \ ${datadir}/dbus-1/system.d/org.freedesktop.resolve1.conf \ ${datadir}/dbus-1/system.d/org.freedesktop.systemd1.conf \ + ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', '${datadir}/dbus-1/system.d/org.freedesktop.hostname1_no_polkit.conf', '', d)} \ ${datadir}/dbus-1/system.d/org.freedesktop.hostname1.conf \ ${datadir}/dbus-1/system.d/org.freedesktop.login1.conf \ ${datadir}/dbus-1/system.d/org.freedesktop.timesync1.conf \ ${datadir}/dbus-1/system.d/org.freedesktop.portable1.conf \ + ${datadir}/dbus-1/system.d/org.freedesktop.oom1.conf \ + ${datadir}/dbus-1/system.d/org.freedesktop.home1.conf \ " -FILES_${PN}-dev += "${base_libdir}/security/*.la ${datadir}/dbus-1/interfaces/ ${sysconfdir}/rpm/macros.systemd" +FILES:${PN}-dev += "${base_libdir}/security/*.la ${datadir}/dbus-1/interfaces/ ${sysconfdir}/rpm/macros.systemd" -RDEPENDS_${PN} += "kmod dbus util-linux-mount util-linux-umount udev (= ${EXTENDPKGV}) systemd-udev-rules util-linux-agetty util-linux-fsck" -RDEPENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', '', 'systemd-serialgetty', d)}" -RDEPENDS_${PN} += "volatile-binds" +RDEPENDS:${PN} += "kmod dbus util-linux-mount util-linux-umount udev (= ${EXTENDPKGV}) systemd-udev-rules util-linux-agetty util-linux-fsck util-linux-swaponoff" +RDEPENDS:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', '', 'systemd-serialgetty', d)}" +RDEPENDS:${PN} += "volatile-binds" -RRECOMMENDS_${PN} += "systemd-extra-utils \ +RRECOMMENDS:${PN} += "systemd-extra-utils \ udev-hwdb \ e2fsprogs-e2fsck \ kernel-module-autofs4 kernel-module-unix kernel-module-ipv6 kernel-module-sch-fq-codel \ os-release \ systemd-conf \ + ${@bb.utils.contains('PACKAGECONFIG', 'logind', 'pam-plugin-umask', '', d)} \ " -INSANE_SKIP_${PN} += "dev-so libdir" -INSANE_SKIP_${PN}-dbg += "libdir" -INSANE_SKIP_${PN}-doc += " libdir" +INSANE_SKIP:${PN} += "dev-so libdir" +INSANE_SKIP:${PN}-dbg += "libdir" +INSANE_SKIP:${PN}-doc += " libdir" +INSANE_SKIP:libsystemd-shared += "libdir" -RPROVIDES_udev = "hotplug" +FILES:libsystemd-shared = "${rootlibdir}/systemd/libsystemd-shared*.so" -RDEPENDS_udev-hwdb += "udev" +RPROVIDES:udev = "hotplug" -FILES_udev += "${base_sbindir}/udevd \ +RDEPENDS:udev-bash-completion += "bash-completion" +RDEPENDS:udev-hwdb += "udev" + +FILES:udev += "${base_sbindir}/udevd \ ${rootlibexecdir}/systemd/network/99-default.link \ ${rootlibexecdir}/systemd/systemd-udevd \ ${rootlibexecdir}/udev/accelerometer \ ${rootlibexecdir}/udev/ata_id \ ${rootlibexecdir}/udev/cdrom_id \ ${rootlibexecdir}/udev/collect \ + ${rootlibexecdir}/udev/dmi_memory_id \ ${rootlibexecdir}/udev/fido_id \ ${rootlibexecdir}/udev/findkeyboards \ + ${rootlibexecdir}/udev/iocost \ ${rootlibexecdir}/udev/keyboard-force-release.sh \ ${rootlibexecdir}/udev/keymap \ ${rootlibexecdir}/udev/mtd_probe \ @@ -625,20 +762,25 @@ FILES_udev += "${base_sbindir}/udevd \ ${rootlibexecdir}/udev/rules.d/60-autosuspend-chromiumos.rules \ ${rootlibexecdir}/udev/rules.d/60-block.rules \ ${rootlibexecdir}/udev/rules.d/60-cdrom_id.rules \ + ${rootlibexecdir}/udev/rules.d/60-dmi-id.rules \ ${rootlibexecdir}/udev/rules.d/60-drm.rules \ ${rootlibexecdir}/udev/rules.d/60-evdev.rules \ ${rootlibexecdir}/udev/rules.d/60-fido-id.rules \ + ${rootlibexecdir}/udev/rules.d/60-infiniband.rules \ ${rootlibexecdir}/udev/rules.d/60-input-id.rules \ ${rootlibexecdir}/udev/rules.d/60-persistent-alsa.rules \ ${rootlibexecdir}/udev/rules.d/60-persistent-input.rules \ ${rootlibexecdir}/udev/rules.d/60-persistent-storage.rules \ + ${rootlibexecdir}/udev/rules.d/60-persistent-storage-mtd.rules \ ${rootlibexecdir}/udev/rules.d/60-persistent-storage-tape.rules \ ${rootlibexecdir}/udev/rules.d/60-persistent-v4l.rules \ ${rootlibexecdir}/udev/rules.d/60-sensor.rules \ ${rootlibexecdir}/udev/rules.d/60-serial.rules \ ${rootlibexecdir}/udev/rules.d/61-autosuspend-manual.rules \ ${rootlibexecdir}/udev/rules.d/64-btrfs.rules \ + ${rootlibexecdir}/udev/rules.d/70-camera.rules \ ${rootlibexecdir}/udev/rules.d/70-joystick.rules \ + ${rootlibexecdir}/udev/rules.d/70-memory.rules \ ${rootlibexecdir}/udev/rules.d/70-mouse.rules \ ${rootlibexecdir}/udev/rules.d/70-power-switch.rules \ ${rootlibexecdir}/udev/rules.d/70-touchpad.rules \ @@ -647,31 +789,42 @@ FILES_udev += "${base_sbindir}/udevd \ ${rootlibexecdir}/udev/rules.d/78-sound-card.rules \ ${rootlibexecdir}/udev/rules.d/80-drivers.rules \ ${rootlibexecdir}/udev/rules.d/80-net-setup-link.rules \ + ${rootlibexecdir}/udev/rules.d/81-net-dhcp.rules \ ${rootlibexecdir}/udev/rules.d/90-vconsole.rules \ + ${rootlibexecdir}/udev/rules.d/90-iocost.rules \ + ${rootlibexecdir}/udev/rules.d/README \ ${sysconfdir}/udev \ ${sysconfdir}/init.d/systemd-udevd \ - ${systemd_unitdir}/system/*udev* \ - ${systemd_unitdir}/system/*.wants/*udev* \ + ${systemd_system_unitdir}/*udev* \ + ${systemd_system_unitdir}/*.wants/*udev* \ ${base_bindir}/systemd-hwdb \ ${base_bindir}/udevadm \ ${base_sbindir}/udevadm \ - ${libexecdir}/${MLPREFIX}udevadm \ - ${datadir}/bash-completion/completions/udevadm \ - ${systemd_unitdir}/system/systemd-hwdb-update.service \ + ${systemd_system_unitdir}/systemd-hwdb-update.service \ " -FILES_udev-hwdb = "${rootlibexecdir}/udev/hwdb.d \ +FILES:udev-bash-completion = "${datadir}/bash-completion/completions/udevadm" +FILES:udev-hwdb = "${rootlibexecdir}/udev/hwdb.d \ " -RCONFLICTS_${PN} = "tiny-init ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'resolvconf', '', d)}" +RCONFLICTS:${PN} = "tiny-init ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'resolvconf', '', d)}" INITSCRIPT_PACKAGES = "udev" -INITSCRIPT_NAME_udev = "systemd-udevd" -INITSCRIPT_PARAMS_udev = "start 03 S ." +INITSCRIPT_NAME:udev = "systemd-udevd" +INITSCRIPT_PARAMS:udev = "start 03 S ." python __anonymous() { if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d): d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1") + + if bb.utils.contains('DISTRO_FEATURES', 'systemd-resolved', True, False, d) and not bb.utils.contains('PACKAGECONFIG', 'nss-resolve resolved', True, False, d): + bb.error("DISTRO_FEATURES[systemd-resolved] requires PACKAGECONFIG[nss-resolve, resolved]") + + if bb.utils.contains('PACKAGECONFIG', 'repart', True, False, d) and not bb.utils.contains('PACKAGECONFIG', 'openssl', True, False, d): + bb.error("PACKAGECONFIG[repart] requires PACKAGECONFIG[openssl]") + + if bb.utils.contains('PACKAGECONFIG', 'homed', True, False, d) and not bb.utils.contains('PACKAGECONFIG', 'userdb openssl cryptsetup', True, False, d): + bb.error("PACKAGECONFIG[homed] requires PACKAGECONFIG[userdb], PACKAGECONFIG[openssl] and PACKAGECONFIG[cryptsetup]") } python do_warn_musl() { @@ -680,7 +833,7 @@ python do_warn_musl() { } addtask warn_musl before do_configure -ALTERNATIVE_${PN} = "halt reboot shutdown poweroff runlevel ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'resolv-conf', '', d)}" +ALTERNATIVE:${PN} = "halt reboot shutdown poweroff runlevel ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'resolv-conf', '', d)}" ALTERNATIVE_TARGET[resolv-conf] = "${sysconfdir}/resolv-conf.systemd" ALTERNATIVE_LINK_NAME[resolv-conf] = "${sysconfdir}/resolv.conf" @@ -706,27 +859,43 @@ ALTERNATIVE_TARGET[runlevel] = "${base_bindir}/systemctl" ALTERNATIVE_LINK_NAME[runlevel] = "${base_sbindir}/runlevel" ALTERNATIVE_PRIORITY[runlevel] ?= "300" -pkg_postinst_${PN}_libc-glibc () { - sed -e '/^hosts:/s/\s*\<myhostname\>//' \ - -e 's/\(^hosts:.*\)\(\<files\>\)\(.*\)\(\<dns\>\)\(.*\)/\1\2 myhostname \3\4\5/' \ - -i $D${sysconfdir}/nsswitch.conf +pkg_postinst:${PN}:libc-glibc () { + if ${@bb.utils.contains('PACKAGECONFIG', 'myhostname', 'true', 'false', d)}; then + sed -e '/^hosts:/s/\s*\<myhostname\>//' \ + -e 's/\(^hosts:.*\)\(\<files\>\)\(.*\)\(\<dns\>\)\(.*\)/\1\2 myhostname \3\4\5/' \ + -i $D${sysconfdir}/nsswitch.conf + fi + if ${@bb.utils.contains('PACKAGECONFIG', 'nss', 'true', 'false', d)}; then + sed -e 's#\(^passwd:.*\)#\1 systemd#' \ + -e 's#\(^group:.*\)#\1 systemd#' \ + -e 's#\(^shadow:.*\)#\1 systemd#' \ + -i $D${sysconfdir}/nsswitch.conf + fi } -pkg_prerm_${PN}_libc-glibc () { - sed -e '/^hosts:/s/\s*\<myhostname\>//' \ - -e '/^hosts:/s/\s*myhostname//' \ - -i $D${sysconfdir}/nsswitch.conf +pkg_prerm:${PN}:libc-glibc () { + if ${@bb.utils.contains('PACKAGECONFIG', 'myhostname', 'true', 'false', d)}; then + sed -e '/^hosts:/s/\s*\<myhostname\>//' \ + -e '/^hosts:/s/\s*myhostname//' \ + -i $D${sysconfdir}/nsswitch.conf + fi + if ${@bb.utils.contains('PACKAGECONFIG', 'nss', 'true', 'false', d)}; then + sed -e '/^passwd:/s#\s*systemd##' \ + -e '/^group:/s#\s*systemd##' \ + -e '/^shadow:/s#\s*systemd##' \ + -i $D${sysconfdir}/nsswitch.conf + fi } PACKAGE_WRITE_DEPS += "qemu-native" -pkg_postinst_udev-hwdb () { +pkg_postinst:udev-hwdb () { if test -n "$D"; then - $INTERCEPT_DIR/postinst_intercept update_udev_hwdb ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} rootlibexecdir="${rootlibexecdir}" PREFERRED_PROVIDER_udev="${PREFERRED_PROVIDER_udev}" + $INTERCEPT_DIR/postinst_intercept update_udev_hwdb ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} rootlibexecdir="${rootlibexecdir}" PREFERRED_PROVIDER_udev="${PREFERRED_PROVIDER_udev}" base_bindir="${base_bindir}" else udevadm hwdb --update fi } -pkg_prerm_udev-hwdb () { +pkg_prerm:udev-hwdb () { rm -f $D${sysconfdir}/udev/hwdb.bin } |