summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/systemd
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/systemd')
-rw-r--r--meta/recipes-core/systemd/systemd-boot-native_255.4.bb15
-rw-r--r--meta/recipes-core/systemd/systemd-boot_255.4.bb (renamed from meta/recipes-core/systemd/systemd-boot_247.3.bb)41
-rw-r--r--meta/recipes-core/systemd/systemd-bootconf_1.00.bb6
-rw-r--r--meta/recipes-core/systemd/systemd-compat-units.bb15
-rw-r--r--meta/recipes-core/systemd/systemd-conf/wired.network2
-rw-r--r--meta/recipes-core/systemd/systemd-conf_1.0.bb (renamed from meta/recipes-core/systemd/systemd-conf_247.3.bb)12
-rw-r--r--meta/recipes-core/systemd/systemd-machine-units_1.0.bb8
-rw-r--r--meta/recipes-core/systemd/systemd-serialgetty.bb26
-rw-r--r--meta/recipes-core/systemd/systemd-systemctl-native.bb1
-rwxr-xr-xmeta/recipes-core/systemd/systemd-systemctl/systemctl61
-rw-r--r--meta/recipes-core/systemd/systemd.inc9
-rw-r--r--meta/recipes-core/systemd/systemd/00-create-volatile.conf1
-rw-r--r--meta/recipes-core/systemd/systemd/0001-analyze-resolve-executable-path-if-it-is-relative.patch39
-rw-r--r--meta/recipes-core/systemd/systemd/0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch81
-rw-r--r--meta/recipes-core/systemd/systemd/0001-logind-Restore-chvt-as-non-root-user-without-polkit.patch227
-rw-r--r--meta/recipes-core/systemd/systemd/0001-missing_type.h-add-comparison_fn_t.patch61
-rw-r--r--meta/recipes-core/systemd/systemd/0001-systemd.pc.in-use-ROOTPREFIX-without-suffixed-slash.patch37
-rw-r--r--meta/recipes-core/systemd/systemd/0002-add-fallback-parse_printf_format-implementation.patch (renamed from meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch)61
-rw-r--r--meta/recipes-core/systemd/systemd/0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch79
-rw-r--r--meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch164
-rw-r--r--meta/recipes-core/systemd/systemd/0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch78
-rw-r--r--meta/recipes-core/systemd/systemd/0003-src-basic-missing.h-check-for-missing-strndupa.patch (renamed from meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch)407
-rw-r--r--meta/recipes-core/systemd/systemd/0004-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch (renamed from meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch)42
-rw-r--r--meta/recipes-core/systemd/systemd/0005-add-missing-FTW_-macros-for-musl.patch44
-rw-r--r--meta/recipes-core/systemd/systemd/0006-Include-netinet-if_ether.h.patch326
-rw-r--r--meta/recipes-core/systemd/systemd/0006-Use-uintmax_t-for-handling-rlim_t.patch (renamed from meta/recipes-core/systemd/systemd/0010-Use-uintmax_t-for-handling-rlim_t.patch)59
-rw-r--r--meta/recipes-core/systemd/systemd/0007-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch (renamed from meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch)36
-rw-r--r--meta/recipes-core/systemd/systemd/0008-Define-glibc-compatible-basename-for-non-glibc-syste.patch34
-rw-r--r--meta/recipes-core/systemd/systemd/0008-add-missing-FTW_-macros-for-musl.patch47
-rw-r--r--meta/recipes-core/systemd/systemd/0008-implment-systemd-sysv-install-for-OE.patch (renamed from meta/recipes-core/systemd/systemd/0003-implment-systemd-sysv-install-for-OE.patch)10
-rw-r--r--meta/recipes-core/systemd/systemd/0009-Do-not-disable-buffering-when-writing-to-oom_score_a.patch (renamed from meta/recipes-core/systemd/systemd/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch)14
-rw-r--r--meta/recipes-core/systemd/systemd/0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch45
-rw-r--r--meta/recipes-core/systemd/systemd/0010-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch (renamed from meta/recipes-core/systemd/systemd/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch)66
-rw-r--r--meta/recipes-core/systemd/systemd/0011-avoid-redefinition-of-prctl_mm_map-structure.patch (renamed from meta/recipes-core/systemd/systemd/0018-avoid-redefinition-of-prctl_mm_map-structure.patch)8
-rw-r--r--meta/recipes-core/systemd/systemd/0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch42
-rw-r--r--meta/recipes-core/systemd/systemd/0012-do-not-disable-buffer-in-writing-files.patch562
-rw-r--r--meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch35
-rw-r--r--meta/recipes-core/systemd/systemd/0013-Handle-__cpu_mask-usage.patch (renamed from meta/recipes-core/systemd/systemd/0025-Handle-__cpu_mask-usage.patch)12
-rw-r--r--meta/recipes-core/systemd/systemd/0014-Handle-missing-gshadow.patch (renamed from meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch)50
-rw-r--r--meta/recipes-core/systemd/systemd/0015-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch49
-rw-r--r--meta/recipes-core/systemd/systemd/0016-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch35
-rw-r--r--meta/recipes-core/systemd/systemd/0016-pass-correct-parameters-to-getdents64.patch37
-rw-r--r--meta/recipes-core/systemd/systemd/0017-Adjust-for-musl-headers.patch572
-rw-r--r--meta/recipes-core/systemd/systemd/0017-missing_type.h-add-__compar_d_fn_t-definition.patch30
-rw-r--r--meta/recipes-core/systemd/systemd/0018-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch52
-rw-r--r--meta/recipes-core/systemd/systemd/0019-Handle-missing-LOCK_EX.patch26
-rw-r--r--meta/recipes-core/systemd/systemd/0019-errno-util-Make-STRERROR-portable-for-musl.patch42
-rw-r--r--meta/recipes-core/systemd/systemd/0020-Fix-incompatible-pointer-type-struct-sockaddr_un.patch40
-rw-r--r--meta/recipes-core/systemd/systemd/0020-sd-event-Make-malloc_trim-conditional-on-glibc.patch39
-rw-r--r--meta/recipes-core/systemd/systemd/0021-shared-Do-not-use-malloc_info-on-musl.patch57
-rw-r--r--meta/recipes-core/systemd/systemd/0021-test-json.c-define-M_PIl.patch33
-rw-r--r--meta/recipes-core/systemd/systemd/0022-avoid-missing-LOCK_EX-declaration.patch43
-rw-r--r--meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch413
-rw-r--r--meta/recipes-core/systemd/systemd/0027-proc-dont-trigger-mount-error-with-invalid-options-o.patch97
-rw-r--r--meta/recipes-core/systemd/systemd_255.4.bb (renamed from meta/recipes-core/systemd/systemd_247.3.bb)531
55 files changed, 2581 insertions, 2378 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 @@
1require systemd.inc
2
3inherit native
4
5deltask do_configure
6deltask do_compile
7
8do_install () {
9 install -Dm 0755 ${S}/src/ukify/ukify.py ${D}${bindir}/ukify
10}
11addtask install after do_unpack
12
13PACKAGES = "${PN}"
14
15FILES:${PN} = "${bindir}/ukify"
diff --git a/meta/recipes-core/systemd/systemd-boot_247.3.bb b/meta/recipes-core/systemd/systemd-boot_255.4.bb
index 249e620f4e..4ee25ee72f 100644
--- a/meta/recipes-core/systemd/systemd-boot_247.3.bb
+++ b/meta/recipes-core/systemd/systemd-boot_255.4.bb
@@ -3,29 +3,31 @@ FILESEXTRAPATHS =. "${FILE_DIRNAME}/systemd:"
3 3
4require conf/image-uefi.conf 4require conf/image-uefi.conf
5 5
6DEPENDS = "intltool-native libcap util-linux gnu-efi gperf-native" 6DEPENDS = "intltool-native libcap util-linux gperf-native python3-jinja2-native python3-pyelftools-native"
7 7
8inherit meson pkgconfig gettext 8inherit meson pkgconfig gettext
9inherit deploy 9inherit deploy
10 10
11LDFLAGS_prepend = "${@ " ".join(d.getVar('LD').split()[1:])} " 11LDFLAGS:prepend = "${@ " ".join(d.getVar('LD').split()[1:])} "
12 12
13do_write_config[vardeps] += "CC OBJCOPY" 13EFI_LD = "bfd"
14do_write_config_append() { 14LDFLAGS:append = " -fuse-ld=${EFI_LD}"
15
16do_write_config[vardeps] += "EFI_LD"
17do_write_config:append() {
15 cat >${WORKDIR}/meson-${PN}.cross <<EOF 18 cat >${WORKDIR}/meson-${PN}.cross <<EOF
16[binaries] 19[binaries]
17efi_cc = ${@meson_array('CC', d)} 20c_ld = ${@meson_array('EFI_LD', d)}
18objcopy = ${@meson_array('OBJCOPY', d)}
19EOF 21EOF
20} 22}
21 23
24MESON_CROSS_FILE:append = " --cross-file ${WORKDIR}/meson-${PN}.cross"
25
26MESON_TARGET = "systemd-boot"
27
22EXTRA_OEMESON += "-Defi=true \ 28EXTRA_OEMESON += "-Defi=true \
23 -Dgnu-efi=true \ 29 -Dbootloader=true \
24 -Defi-includedir=${STAGING_INCDIR}/efi \
25 -Defi-libdir=${STAGING_LIBDIR} \
26 -Defi-ld=${@ d.getVar('LD').split()[0]} \
27 -Dman=false \ 30 -Dman=false \
28 --cross-file ${WORKDIR}/meson-${PN}.cross \
29 " 31 "
30 32
31# install to the image as boot*.efi if its the EFI_PROVIDER, 33# install to the image as boot*.efi if its the EFI_PROVIDER,
@@ -41,21 +43,14 @@ python __anonymous () {
41 d.setVar("SYSTEMD_BOOT_IMAGE_PREFIX", prefix) 43 d.setVar("SYSTEMD_BOOT_IMAGE_PREFIX", prefix)
42} 44}
43 45
44FILES_${PN} = "${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE}" 46FILES:${PN} = "${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE}"
45 47
46RDEPENDS_${PN} += "virtual/systemd-bootconf" 48RDEPENDS:${PN} += "virtual-systemd-bootconf"
47 49
48# Imported from the old gummiboot recipe 50CFLAGS:append:libc-musl = " -D__DEFINED_wchar_t"
49TUNE_CCARGS_remove = "-mfpmath=sse"
50 51
51COMPATIBLE_HOST = "(aarch64.*|arm.*|x86_64.*|i.86.*)-linux" 52COMPATIBLE_HOST = "(aarch64.*|arm.*|x86_64.*|i.86.*)-linux"
52COMPATIBLE_HOST_x86-x32 = "null" 53COMPATIBLE_HOST:x86-x32 = "null"
53
54do_compile() {
55 ninja \
56 src/boot/efi/${SYSTEMD_BOOT_IMAGE_PREFIX}${SYSTEMD_BOOT_IMAGE} \
57 src/boot/efi/linux${EFI_ARCH}.efi.stub
58}
59 54
60do_install() { 55do_install() {
61 install -d ${D}${EFI_FILES_PATH} 56 install -d ${D}${EFI_FILES_PATH}
@@ -65,6 +60,8 @@ do_install() {
65do_deploy () { 60do_deploy () {
66 install ${B}/src/boot/efi/systemd-boot*.efi ${DEPLOYDIR} 61 install ${B}/src/boot/efi/systemd-boot*.efi ${DEPLOYDIR}
67 install ${B}/src/boot/efi/linux*.efi.stub ${DEPLOYDIR} 62 install ${B}/src/boot/efi/linux*.efi.stub ${DEPLOYDIR}
63 install ${B}/src/boot/efi/addon*.efi.stub ${DEPLOYDIR}
68} 64}
69 65
70addtask deploy before do_build after do_compile 66addtask deploy before do_build after do_compile
67
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"
2LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" 2LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
3SUMMARY = "Basic systemd-boot configuration files" 3SUMMARY = "Basic systemd-boot configuration files"
4 4
5RPROVIDES_${PN} += "virtual/systemd-bootconf" 5RPROVIDES:${PN} += "virtual-systemd-bootconf"
6PACKAGE_ARCH = "${MACHINE_ARCH}" 6PACKAGE_ARCH = "${MACHINE_ARCH}"
7 7
8inherit systemd-boot-cfg 8inherit systemd-boot-cfg
@@ -12,7 +12,7 @@ S = "${WORKDIR}"
12LABELS = "boot" 12LABELS = "boot"
13 13
14ROOT ?= "root=/dev/sda2" 14ROOT ?= "root=/dev/sda2"
15APPEND_append = " ${ROOT}" 15APPEND:append = " ${ROOT}"
16 16
17python do_configure() { 17python do_configure() {
18 bb.build.exec_func('build_efi_cfg', d) 18 bb.build.exec_func('build_efi_cfg', d)
@@ -29,4 +29,4 @@ do_install() {
29 install *.conf ${D}/boot/loader/entries/ 29 install *.conf ${D}/boot/loader/entries/
30} 30}
31 31
32FILES_${PN} = "/boot/loader/* /boot/loader/entries/*" 32FILES:${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"
2HOMEPAGE = "http://www.freedesktop.org/wiki/Software/systemd" 2HOMEPAGE = "http://www.freedesktop.org/wiki/Software/systemd"
3LICENSE = "MIT" 3LICENSE = "MIT"
4 4
5PR = "r29"
6 5
7PACKAGE_WRITE_DEPS += "systemd-systemctl-native" 6PACKAGE_WRITE_DEPS += "systemd-systemctl-native"
8 7
@@ -12,9 +11,10 @@ inherit features_check
12 11
13INHIBIT_DEFAULT_DEPS = "1" 12INHIBIT_DEFAULT_DEPS = "1"
14 13
15ALLOW_EMPTY_${PN} = "1" 14ALLOW_EMPTY:${PN} = "1"
16 15
17REQUIRED_DISTRO_FEATURES = "systemd" 16REQUIRED_DISTRO_FEATURES += "systemd"
17REQUIRED_DISTRO_FEATURES += "usrmerge"
18 18
19SYSTEMD_DISABLED_SYSV_SERVICES = " \ 19SYSTEMD_DISABLED_SYSV_SERVICES = " \
20 busybox-udhcpc \ 20 busybox-udhcpc \
@@ -25,9 +25,10 @@ SYSTEMD_DISABLED_SYSV_SERVICES = " \
25 syslog.busybox \ 25 syslog.busybox \
26" 26"
27 27
28pkg_postinst_${PN} () { 28pkg_postinst:${PN} () {
29 29
30 cd $D${sysconfdir}/init.d || exit 0 30 test -d $D${sysconfdir}/init.d || exit 0
31 cd $D${sysconfdir}/init.d
31 32
32 echo "Disabling the following sysv scripts: " 33 echo "Disabling the following sysv scripts: "
33 34
@@ -38,7 +39,7 @@ pkg_postinst_${PN} () {
38 fi 39 fi
39 40
40 for i in ${SYSTEMD_DISABLED_SYSV_SERVICES} ; do 41 for i in ${SYSTEMD_DISABLED_SYSV_SERVICES} ; do
41 if [ -e $i -o -e $i.sh ] && ! [ -e $D${sysconfdir}/systemd/system/$i.service -o -e $D${systemd_unitdir}/system/$i.service ] ; then 42 if [ -e $i -o -e $i.sh ] && ! [ -e $D${sysconfdir}/systemd/system/$i.service -o -e $D${systemd_system_unitdir}/$i.service ] ; then
42 echo -n "$i: " 43 echo -n "$i: "
43 systemctl $OPTS mask $i.service 44 systemctl $OPTS mask $i.service
44 fi 45 fi
@@ -46,4 +47,4 @@ pkg_postinst_${PN} () {
46 echo 47 echo
47} 48}
48 49
49RDEPENDS_${PN} = "systemd" 50RDEPENDS:${PN} = "systemd"
diff --git a/meta/recipes-core/systemd/systemd-conf/wired.network b/meta/recipes-core/systemd/systemd-conf/wired.network
index 09367edb10..7406287248 100644
--- a/meta/recipes-core/systemd/systemd-conf/wired.network
+++ b/meta/recipes-core/systemd/systemd-conf/wired.network
@@ -1,6 +1,8 @@
1[Match] 1[Match]
2Type=ether 2Type=ether
3Name=!veth*
3KernelCommandLine=!nfsroot 4KernelCommandLine=!nfsroot
5KernelCommandLine=!ip
4 6
5[Network] 7[Network]
6DHCP=yes 8DHCP=yes
diff --git a/meta/recipes-core/systemd/systemd-conf_247.3.bb b/meta/recipes-core/systemd/systemd-conf_1.0.bb
index 944b56ff82..2355936631 100644
--- a/meta/recipes-core/systemd/systemd-conf_247.3.bb
+++ b/meta/recipes-core/systemd/systemd-conf_1.0.bb
@@ -5,6 +5,11 @@ DefaultTimeoutStartSec setting."
5LICENSE = "MIT" 5LICENSE = "MIT"
6LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" 6LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
7 7
8inherit features_check
9REQUIRED_DISTRO_FEATURES += "usrmerge"
10
11PE = "1"
12
8PACKAGECONFIG ??= "dhcp-ethernet" 13PACKAGECONFIG ??= "dhcp-ethernet"
9PACKAGECONFIG[dhcp-ethernet] = "" 14PACKAGECONFIG[dhcp-ethernet] = ""
10 15
@@ -27,16 +32,13 @@ do_install() {
27} 32}
28 33
29# Based on change from YP bug 8141, OE commit 5196d7bacaef1076c361adaa2867be31759c1b52 34# Based on change from YP bug 8141, OE commit 5196d7bacaef1076c361adaa2867be31759c1b52
30do_install_append_qemuall() { 35do_install:append:qemuall() {
31 install -D -m0644 ${WORKDIR}/system.conf-qemuall ${D}${systemd_unitdir}/system.conf.d/01-${PN}.conf 36 install -D -m0644 ${WORKDIR}/system.conf-qemuall ${D}${systemd_unitdir}/system.conf.d/01-${PN}.conf
32
33 # Do not install wired.network for qemu bsps
34 rm -rf ${D}${systemd_unitdir}/network
35} 37}
36 38
37PACKAGE_ARCH = "${MACHINE_ARCH}" 39PACKAGE_ARCH = "${MACHINE_ARCH}"
38 40
39FILES_${PN} = "\ 41FILES:${PN} = "\
40 ${systemd_unitdir}/journald.conf.d/ \ 42 ${systemd_unitdir}/journald.conf.d/ \
41 ${systemd_unitdir}/logind.conf.d/ \ 43 ${systemd_unitdir}/logind.conf.d/ \
42 ${systemd_unitdir}/system.conf.d/ \ 44 ${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
5 5
6PACKAGE_ARCH = "${MACHINE_ARCH}" 6PACKAGE_ARCH = "${MACHINE_ARCH}"
7 7
8PR = "r19"
9 8
10inherit systemd 9inherit systemd features_check
11SYSTEMD_SERVICE_${PN} = "" 10REQUIRED_DISTRO_FEATURES += "usrmerge"
11SYSTEMD_SERVICE:${PN} = ""
12 12
13ALLOW_EMPTY_${PN} = "1" 13ALLOW_EMPTY:${PN} = "1"
diff --git a/meta/recipes-core/systemd/systemd-serialgetty.bb b/meta/recipes-core/systemd/systemd-serialgetty.bb
index 34defeb3b1..44a93ac684 100644
--- a/meta/recipes-core/systemd/systemd-serialgetty.bb
+++ b/meta/recipes-core/systemd/systemd-serialgetty.bb
@@ -1,9 +1,8 @@
1SUMMARY = "Serial terminal support for systemd" 1SUMMARY = "Serial terminal support for systemd"
2HOMEPAGE = "https://www.freedesktop.org/wiki/Software/systemd/" 2HOMEPAGE = "https://www.freedesktop.org/wiki/Software/systemd/"
3LICENSE = "GPLv2+" 3LICENSE = "GPL-2.0-or-later"
4LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6" 4LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6"
5 5
6PR = "r5"
7 6
8SERIAL_CONSOLES ?= "115200;ttyS0" 7SERIAL_CONSOLES ?= "115200;ttyS0"
9SERIAL_TERM ?= "linux" 8SERIAL_TERM ?= "linux"
@@ -14,16 +13,17 @@ S = "${WORKDIR}"
14 13
15# As this package is tied to systemd, only build it when we're also building systemd. 14# As this package is tied to systemd, only build it when we're also building systemd.
16inherit features_check 15inherit features_check
17REQUIRED_DISTRO_FEATURES = "systemd" 16REQUIRED_DISTRO_FEATURES += "systemd"
17REQUIRED_DISTRO_FEATURES += "usrmerge"
18 18
19do_install() { 19do_install() {
20 if [ ! -z "${SERIAL_CONSOLES}" ] ; then 20 if [ ! -z "${SERIAL_CONSOLES}" ] ; then
21 default_baudrate=`echo "${SERIAL_CONSOLES}" | sed 's/\;.*//'` 21 default_baudrate=`echo "${SERIAL_CONSOLES}" | sed 's/\;.*//'`
22 install -d ${D}${systemd_unitdir}/system/ 22 install -d ${D}${systemd_system_unitdir}/
23 install -d ${D}${sysconfdir}/systemd/system/getty.target.wants/ 23 install -d ${D}${sysconfdir}/systemd/system/getty.target.wants/
24 install -m 0644 ${WORKDIR}/serial-getty@.service ${D}${systemd_unitdir}/system/ 24 install -m 0644 ${WORKDIR}/serial-getty@.service ${D}${systemd_system_unitdir}/
25 sed -i -e "s/\@BAUDRATE\@/$default_baudrate/g" ${D}${systemd_unitdir}/system/serial-getty@.service 25 sed -i -e "s/\@BAUDRATE\@/$default_baudrate/g" ${D}${systemd_system_unitdir}/serial-getty@.service
26 sed -i -e "s/\@TERM\@/${SERIAL_TERM}/g" ${D}${systemd_unitdir}/system/serial-getty@.service 26 sed -i -e "s/\@TERM\@/${SERIAL_TERM}/g" ${D}${systemd_system_unitdir}/serial-getty@.service
27 27
28 tmp="${SERIAL_CONSOLES}" 28 tmp="${SERIAL_CONSOLES}"
29 for entry in $tmp ; do 29 for entry in $tmp ; do
@@ -31,14 +31,14 @@ do_install() {
31 ttydev=`echo $entry | sed -e 's/^[0-9]*\;//' -e 's/\;.*//'` 31 ttydev=`echo $entry | sed -e 's/^[0-9]*\;//' -e 's/\;.*//'`
32 if [ "$baudrate" = "$default_baudrate" ] ; then 32 if [ "$baudrate" = "$default_baudrate" ] ; then
33 # enable the service 33 # enable the service
34 ln -sf ${systemd_unitdir}/system/serial-getty@.service \ 34 ln -sf ${systemd_system_unitdir}/serial-getty@.service \
35 ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty@$ttydev.service 35 ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty@$ttydev.service
36 else 36 else
37 # install custom service file for the non-default baudrate 37 # install custom service file for the non-default baudrate
38 install -m 0644 ${WORKDIR}/serial-getty@.service ${D}${systemd_unitdir}/system/serial-getty$baudrate@.service 38 install -m 0644 ${WORKDIR}/serial-getty@.service ${D}${systemd_system_unitdir}/serial-getty$baudrate@.service
39 sed -i -e "s/\@BAUDRATE\@/$baudrate/g" ${D}${systemd_unitdir}/system/serial-getty$baudrate@.service 39 sed -i -e "s/\@BAUDRATE\@/$baudrate/g" ${D}${systemd_system_unitdir}/serial-getty$baudrate@.service
40 # enable the service 40 # enable the service
41 ln -sf ${systemd_unitdir}/system/serial-getty$baudrate@.service \ 41 ln -sf ${systemd_system_unitdir}/serial-getty$baudrate@.service \
42 ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty$baudrate@$ttydev.service 42 ${D}${sysconfdir}/systemd/system/getty.target.wants/serial-getty$baudrate@$ttydev.service
43 fi 43 fi
44 done 44 done
@@ -46,7 +46,7 @@ do_install() {
46} 46}
47 47
48# This is a machine specific file 48# This is a machine specific file
49FILES_${PN} = "${systemd_unitdir}/system/*.service ${sysconfdir}" 49FILES:${PN} = "${systemd_system_unitdir}/*.service ${sysconfdir}"
50PACKAGE_ARCH = "${MACHINE_ARCH}" 50PACKAGE_ARCH = "${MACHINE_ARCH}"
51 51
52ALLOW_EMPTY_${PN} = "1" 52ALLOW_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"
3LICENSE = "MIT" 3LICENSE = "MIT"
4LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" 4LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
5 5
6PR = "r6"
7 6
8inherit native 7inherit native
9 8
diff --git a/meta/recipes-core/systemd/systemd-systemctl/systemctl b/meta/recipes-core/systemd/systemd-systemctl/systemctl
index de733e255b..2229bc7b6d 100755
--- a/meta/recipes-core/systemd/systemd-systemctl/systemctl
+++ b/meta/recipes-core/systemd/systemd-systemctl/systemctl
@@ -11,6 +11,7 @@ import re
11import sys 11import sys
12 12
13from collections import namedtuple 13from collections import namedtuple
14from itertools import chain
14from pathlib import Path 15from pathlib import Path
15 16
16version = 1.0 17version = 1.0
@@ -25,12 +26,19 @@ locations = list()
25 26
26class SystemdFile(): 27class SystemdFile():
27 """Class representing a single systemd configuration file""" 28 """Class representing a single systemd configuration file"""
28 def __init__(self, root, path): 29
30 _clearable_keys = ['WantedBy']
31
32 def __init__(self, root, path, instance_unit_name):
29 self.sections = dict() 33 self.sections = dict()
30 self._parse(root, path) 34 self._parse(root, path)
31 dirname = os.path.basename(path.name) + ".d" 35 dirname = os.path.basename(path.name) + ".d"
32 for location in locations: 36 for location in locations:
33 for path2 in sorted((root / location / "system" / dirname).glob("*.conf")): 37 files = (root / location / "system" / dirname).glob("*.conf")
38 if instance_unit_name:
39 inst_dirname = instance_unit_name + ".d"
40 files = chain(files, (root / location / "system" / inst_dirname).glob("*.conf"))
41 for path2 in sorted(files):
34 self._parse(root, path2) 42 self._parse(root, path2)
35 43
36 def _parse(self, root, path): 44 def _parse(self, root, path):
@@ -75,6 +83,14 @@ class SystemdFile():
75 v = m.group('value') 83 v = m.group('value')
76 if k not in section: 84 if k not in section:
77 section[k] = list() 85 section[k] = list()
86
87 # If we come across a "key=" line for a "clearable key", then
88 # forget all preceding assignments. This works because we are
89 # processing files in correct parse order.
90 if k in self._clearable_keys and not v:
91 del section[k]
92 continue
93
78 section[k].extend(v.split()) 94 section[k].extend(v.split())
79 95
80 def get(self, section, prop): 96 def get(self, section, prop):
@@ -160,7 +176,9 @@ def add_link(path, target):
160 176
161 177
162class SystemdUnitNotFoundError(Exception): 178class SystemdUnitNotFoundError(Exception):
163 pass 179 def __init__(self, path, unit):
180 self.path = path
181 self.unit = unit
164 182
165 183
166class SystemdUnit(): 184class SystemdUnit():
@@ -177,24 +195,29 @@ class SystemdUnit():
177 195
178 raise SystemdUnitNotFoundError(self.root, unit) 196 raise SystemdUnitNotFoundError(self.root, unit)
179 197
180 def _process_deps(self, config, service, location, prop, dirstem): 198 def _process_deps(self, config, service, location, prop, dirstem, instance):
181 systemdir = self.root / SYSCONFDIR / "systemd" / "system" 199 systemdir = self.root / SYSCONFDIR / "systemd" / "system"
182 200
183 target = ROOT / location.relative_to(self.root) 201 target = ROOT / location.relative_to(self.root)
184 try: 202 try:
185 for dependent in config.get('Install', prop): 203 for dependent in config.get('Install', prop):
204 # expand any %i to instance (ignoring escape sequence %%)
205 dependent = re.sub("([^%](%%)*)%i", "\\g<1>{}".format(instance), dependent)
186 wants = systemdir / "{}.{}".format(dependent, dirstem) / service 206 wants = systemdir / "{}.{}".format(dependent, dirstem) / service
187 add_link(wants, target) 207 add_link(wants, target)
188 208
189 except KeyError: 209 except KeyError:
190 pass 210 pass
191 211
192 def enable(self): 212 def enable(self, units_enabled=[]):
193 # if we're enabling an instance, first extract the actual instance 213 # if we're enabling an instance, first extract the actual instance
194 # then figure out what the template unit is 214 # then figure out what the template unit is
195 template = re.match(r"[^@]+@(?P<instance>[^\.]*)\.", self.unit) 215 template = re.match(r"[^@]+@(?P<instance>[^\.]*)\.", self.unit)
216 instance_unit_name = None
196 if template: 217 if template:
197 instance = template.group('instance') 218 instance = template.group('instance')
219 if instance != "":
220 instance_unit_name = self.unit
198 unit = re.sub(r"@[^\.]*\.", "@.", self.unit, 1) 221 unit = re.sub(r"@[^\.]*\.", "@.", self.unit, 1)
199 else: 222 else:
200 instance = None 223 instance = None
@@ -206,7 +229,7 @@ class SystemdUnit():
206 # ignore aliases 229 # ignore aliases
207 return 230 return
208 231
209 config = SystemdFile(self.root, path) 232 config = SystemdFile(self.root, path, instance_unit_name)
210 if instance == "": 233 if instance == "":
211 try: 234 try:
212 default_instance = config.get('Install', 'DefaultInstance')[0] 235 default_instance = config.get('Install', 'DefaultInstance')[0]
@@ -219,12 +242,17 @@ class SystemdUnit():
219 else: 242 else:
220 service = self.unit 243 service = self.unit
221 244
222 self._process_deps(config, service, path, 'WantedBy', 'wants') 245 self._process_deps(config, service, path, 'WantedBy', 'wants', instance)
223 self._process_deps(config, service, path, 'RequiredBy', 'requires') 246 self._process_deps(config, service, path, 'RequiredBy', 'requires', instance)
224 247
225 try: 248 try:
226 for also in config.get('Install', 'Also'): 249 for also in config.get('Install', 'Also'):
227 SystemdUnit(self.root, also).enable() 250 try:
251 units_enabled.append(unit)
252 if also not in units_enabled:
253 SystemdUnit(self.root, also).enable(units_enabled)
254 except SystemdUnitNotFoundError as e:
255 sys.exit("Error: Systemctl also enable issue with %s (%s)" % (service, e.unit))
228 256
229 except KeyError: 257 except KeyError:
230 pass 258 pass
@@ -265,7 +293,10 @@ def preset_all(root):
265 state = presets.state(service) 293 state = presets.state(service)
266 294
267 if state == "enable" or state is None: 295 if state == "enable" or state is None:
268 SystemdUnit(root, service).enable() 296 try:
297 SystemdUnit(root, service).enable()
298 except SystemdUnitNotFoundError:
299 sys.exit("Error: Systemctl preset_all issue in %s" % service)
269 300
270 # If we populate the systemd links we also create /etc/machine-id, which 301 # If we populate the systemd links we also create /etc/machine-id, which
271 # allows systemd to boot with the filesystem read-only before generating 302 # allows systemd to boot with the filesystem read-only before generating
@@ -307,10 +338,16 @@ def main():
307 338
308 if command == "mask": 339 if command == "mask":
309 for service in args.service: 340 for service in args.service:
310 SystemdUnit(root, service).mask() 341 try:
342 SystemdUnit(root, service).mask()
343 except SystemdUnitNotFoundError as e:
344 sys.exit("Error: Systemctl main mask issue in %s (%s)" % (service, e.unit))
311 elif command == "enable": 345 elif command == "enable":
312 for service in args.service: 346 for service in args.service:
313 SystemdUnit(root, service).enable() 347 try:
348 SystemdUnit(root, service).enable()
349 except SystemdUnitNotFoundError as e:
350 sys.exit("Error: Systemctl main enable issue in %s (%s)" % (service, e.unit))
314 elif command == "preset-all": 351 elif command == "preset-all":
315 if len(args.service) != 0: 352 if len(args.service) != 0:
316 sys.exit("Too many arguments.") 353 sys.exit("Too many arguments.")
diff --git a/meta/recipes-core/systemd/systemd.inc b/meta/recipes-core/systemd/systemd.inc
index ccff8c8b9e..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 \
10elaborate transactional dependency-based service control logic. It can \ 10elaborate transactional dependency-based service control logic. It can \
11work as a drop-in replacement for sysvinit." 11work as a drop-in replacement for sysvinit."
12 12
13LICENSE = "GPLv2 & LGPLv2.1" 13LICENSE = "GPL-2.0-only & LGPL-2.1-or-later"
14LICENSE:libsystemd = "LGPL-2.1-or-later"
14LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \ 15LIC_FILES_CHKSUM = "file://LICENSE.GPL2;md5=751419260aa954499f7abaabaa882bbe \
15 file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c" 16 file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c"
16 17
17SRCREV = "551dd873b0bdfb9e7e47431b2933c8b910228f0c" 18SRCREV = "387a14a7b67b8b76adaed4175e14bb7e39b2f738"
18SRCBRANCH = "v247-stable" 19SRCBRANCH = "v255-stable"
19SRC_URI = "git://github.com/systemd/systemd-stable.git;protocol=git;branch=${SRCBRANCH}" 20SRC_URI = "git://github.com/systemd/systemd-stable.git;protocol=https;branch=${SRCBRANCH}"
20 21
21S = "${WORKDIR}/git" 22S = "${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 @@
3# inside /var/log. 3# inside /var/log.
4 4
5 5
6d /run/lock 1777 - - -
6d /var/volatile/log - - - - 7d /var/volatile/log - - - -
7d /var/volatile/tmp 1777 - - 8d /var/volatile/tmp 1777 - -
diff --git a/meta/recipes-core/systemd/systemd/0001-analyze-resolve-executable-path-if-it-is-relative.patch b/meta/recipes-core/systemd/systemd/0001-analyze-resolve-executable-path-if-it-is-relative.patch
deleted file mode 100644
index fd7f94a61d..0000000000
--- a/meta/recipes-core/systemd/systemd/0001-analyze-resolve-executable-path-if-it-is-relative.patch
+++ /dev/null
@@ -1,39 +0,0 @@
1From b9b7a8e3825f0433e120f7a6d7d5d635a839cab9 Mon Sep 17 00:00:00 2001
2From: Mingli Yu <mingli.yu@windriver.com>
3Date: Thu, 21 Jan 2021 06:19:44 +0000
4Subject: [PATCH] analyze: resolve executable path if it is relative
5
6Upstream-Status: Backport [https://github.com/systemd/systemd/commit/f1fb046a985521f7d4a662f02546686ff20b7e5d]
7
8Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
9---
10 src/analyze/analyze-verify.c | 7 +++++--
11 1 file changed, 5 insertions(+), 2 deletions(-)
12
13diff --git a/src/analyze/analyze-verify.c b/src/analyze/analyze-verify.c
14index a9c89173bf..969523df18 100644
15--- a/src/analyze/analyze-verify.c
16+++ b/src/analyze/analyze-verify.c
17@@ -115,14 +115,17 @@ static int verify_socket(Unit *u) {
18 }
19
20 int verify_executable(Unit *u, const ExecCommand *exec) {
21+ int r;
22+
23 if (!exec)
24 return 0;
25
26 if (exec->flags & EXEC_COMMAND_IGNORE_FAILURE)
27 return 0;
28
29- if (access(exec->path, X_OK) < 0)
30- return log_unit_error_errno(u, errno, "Command %s is not executable: %m", exec->path);
31+ r = find_executable_full(exec->path, false, NULL);
32+ if (r < 0)
33+ return log_unit_error_errno(u, r, "Command %s is not executable: %m", exec->path);
34
35 return 0;
36 }
37--
382.26.2
39
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 8dd22eeb7b..0000000000
--- a/meta/recipes-core/systemd/systemd/0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch
+++ /dev/null
@@ -1,81 +0,0 @@
1From 564830719be2017c4953589d50f21a9e856a4ecc Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Thu, 21 Feb 2019 16:23:24 +0800
4Subject: [PATCH] binfmt: Don't install dependency links at install time for
5 the binfmt services
6
7use [Install] blocks so that they get created when the service is enabled
8like a traditional service.
9
10The [Install] blocks were rejected upstream as they don't have a way to
11"enable" it on install without static symlinks which can't be disabled,
12only masked. We however can do that in a postinst.
13
14Upstream-Status: Denied
15
16Signed-off-by: Ross Burton <ross.burton@intel.com>
17Signed-off-by: Khem Raj <raj.khem@gmail.com>
18Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
19[rebased for systemd 243]
20Signed-off-by: Scott Murray <scott.murray@konsulko.com>
21
22---
23 units/meson.build | 6 ++----
24 units/proc-sys-fs-binfmt_misc.automount | 3 +++
25 units/systemd-binfmt.service.in | 4 ++++
26 3 files changed, 9 insertions(+), 4 deletions(-)
27
28Index: systemd-stable/units/meson.build
29===================================================================
30--- systemd-stable.orig/units/meson.build
31+++ systemd-stable/units/meson.build
32@@ -55,8 +55,7 @@ units = [
33 ['poweroff.target', '',
34 (with_runlevels ? 'runlevel0.target' : '')],
35 ['printer.target', ''],
36- ['proc-sys-fs-binfmt_misc.automount', 'ENABLE_BINFMT',
37- 'sysinit.target.wants/'],
38+ ['proc-sys-fs-binfmt_misc.automount', 'ENABLE_BINFMT'],
39 ['proc-sys-fs-binfmt_misc.mount', 'ENABLE_BINFMT'],
40 ['reboot.target', '',
41 'ctrl-alt-del.target' + (with_runlevels ? ' runlevel6.target' : '')],
42@@ -166,8 +165,7 @@ in_units = [
43 ['rc-local.service', 'HAVE_SYSV_COMPAT'],
44 ['rescue.service', ''],
45 ['systemd-backlight@.service', 'ENABLE_BACKLIGHT'],
46- ['systemd-binfmt.service', 'ENABLE_BINFMT',
47- 'sysinit.target.wants/'],
48+ ['systemd-binfmt.service', 'ENABLE_BINFMT'],
49 ['systemd-bless-boot.service', 'ENABLE_EFI HAVE_BLKID'],
50 ['systemd-boot-check-no-failures.service', ''],
51 ['systemd-coredump@.service', 'ENABLE_COREDUMP'],
52Index: systemd-stable/units/proc-sys-fs-binfmt_misc.automount
53===================================================================
54--- systemd-stable.orig/units/proc-sys-fs-binfmt_misc.automount
55+++ systemd-stable/units/proc-sys-fs-binfmt_misc.automount
56@@ -18,3 +18,6 @@ ConditionPathIsReadWrite=/proc/sys/
57
58 [Automount]
59 Where=/proc/sys/fs/binfmt_misc
60+
61+[Install]
62+WantedBy=sysinit.target
63Index: systemd-stable/units/systemd-binfmt.service.in
64===================================================================
65--- systemd-stable.orig/units/systemd-binfmt.service.in
66+++ systemd-stable/units/systemd-binfmt.service.in
67@@ -14,6 +14,7 @@ Documentation=https://www.kernel.org/doc/html/latest/admin-guide/binfmt-misc.htm
68 Documentation=https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems
69 DefaultDependencies=no
70 Conflicts=shutdown.target
71+Wants=proc-sys-fs-binfmt_misc.automount
72 After=proc-sys-fs-binfmt_misc.automount
73 After=proc-sys-fs-binfmt_misc.mount
74 Before=sysinit.target shutdown.target
75@@ -30,3 +31,6 @@ RemainAfterExit=yes
76 ExecStart=@rootlibexecdir@/systemd-binfmt
77 ExecStop=@rootlibexecdir@/systemd-binfmt --unregister
78 TimeoutSec=90s
79+
80+[Install]
81+WantedBy=sysinit.target
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 @@
1From 150d9cade6d475570395cb418b824524dead9577 Mon Sep 17 00:00:00 2001
2From: Joshua Watt <JPEWhacker@gmail.com>
3Date: Fri, 30 Oct 2020 08:15:43 -0500
4Subject: [PATCH] logind: Restore chvt as non-root user without polkit
5
64acf0cfd2f ("logind: check PolicyKit before allowing VT switch") broke
7the ability to write user sessions that run graphical sessions (e.g.
8weston/X11). This was partially amended in 19bb87fbfa ("login: allow
9non-console sessions to change vt") by changing the default PolicyKit
10policy so that non-root users are again allowed to switch the VT. This
11makes the policy when PolKit is not enabled (as on many embedded
12systems) match the default PolKit policy and allows launching graphical
13sessions as a non-root user.
14
15Closes #17473
16---
17 src/login/logind-dbus.c | 11 ++-------
18 src/login/logind-polkit.c | 26 +++++++++++++++++++++
19 src/login/logind-polkit.h | 10 ++++++++
20 src/login/logind-seat-dbus.c | 41 ++++-----------------------------
21 src/login/logind-session-dbus.c | 11 ++-------
22 src/login/meson.build | 1 +
23 6 files changed, 46 insertions(+), 54 deletions(-)
24 create mode 100644 src/login/logind-polkit.c
25 create mode 100644 src/login/logind-polkit.h
26
27diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
28index 0f83ed99bc..a3765d88ba 100644
29--- a/src/login/logind-dbus.c
30+++ b/src/login/logind-dbus.c
31@@ -30,6 +30,7 @@
32 #include "format-util.h"
33 #include "fs-util.h"
34 #include "logind-dbus.h"
35+#include "logind-polkit.h"
36 #include "logind-seat-dbus.h"
37 #include "logind-session-dbus.h"
38 #include "logind-user-dbus.h"
39@@ -1047,15 +1048,7 @@ static int method_activate_session_on_seat(sd_bus_message *message, void *userda
40 return sd_bus_error_setf(error, BUS_ERROR_SESSION_NOT_ON_SEAT,
41 "Session %s not on seat %s", session_name, seat_name);
42
43- r = bus_verify_polkit_async(
44- message,
45- CAP_SYS_ADMIN,
46- "org.freedesktop.login1.chvt",
47- NULL,
48- false,
49- UID_INVALID,
50- &m->polkit_registry,
51- error);
52+ r = check_polkit_chvt(message, m, error);
53 if (r < 0)
54 return r;
55 if (r == 0)
56diff --git a/src/login/logind-polkit.c b/src/login/logind-polkit.c
57new file mode 100644
58index 0000000000..9072570cc6
59--- /dev/null
60+++ b/src/login/logind-polkit.c
61@@ -0,0 +1,26 @@
62+/* SPDX-License-Identifier: LGPL-2.1+ */
63+
64+#include "bus-polkit.h"
65+#include "logind-polkit.h"
66+#include "missing_capability.h"
67+#include "user-util.h"
68+
69+int check_polkit_chvt(sd_bus_message *message, Manager *manager, sd_bus_error *error) {
70+#if ENABLE_POLKIT
71+ return bus_verify_polkit_async(
72+ message,
73+ CAP_SYS_ADMIN,
74+ "org.freedesktop.login1.chvt",
75+ NULL,
76+ false,
77+ UID_INVALID,
78+ &manager->polkit_registry,
79+ error);
80+#else
81+ /* Allow chvt when polkit is not present. This allows a service to start a graphical session as a
82+ * non-root user when polkit is not compiled in, matching the default polkit policy */
83+ return 1;
84+#endif
85+}
86+
87+
88diff --git a/src/login/logind-polkit.h b/src/login/logind-polkit.h
89new file mode 100644
90index 0000000000..476c077a8a
91--- /dev/null
92+++ b/src/login/logind-polkit.h
93@@ -0,0 +1,10 @@
94+/* SPDX-License-Identifier: LGPL-2.1+ */
95+#pragma once
96+
97+#include "sd-bus.h"
98+
99+#include "bus-object.h"
100+#include "logind.h"
101+
102+int check_polkit_chvt(sd_bus_message *message, Manager *manager, sd_bus_error *error);
103+
104diff --git a/src/login/logind-seat-dbus.c b/src/login/logind-seat-dbus.c
105index a945132284..f22e9e2734 100644
106--- a/src/login/logind-seat-dbus.c
107+++ b/src/login/logind-seat-dbus.c
108@@ -9,6 +9,7 @@
109 #include "bus-polkit.h"
110 #include "bus-util.h"
111 #include "logind-dbus.h"
112+#include "logind-polkit.h"
113 #include "logind-seat-dbus.h"
114 #include "logind-seat.h"
115 #include "logind-session-dbus.h"
116@@ -179,15 +180,7 @@ static int method_activate_session(sd_bus_message *message, void *userdata, sd_b
117 if (session->seat != s)
118 return sd_bus_error_setf(error, BUS_ERROR_SESSION_NOT_ON_SEAT, "Session %s not on seat %s", name, s->id);
119
120- r = bus_verify_polkit_async(
121- message,
122- CAP_SYS_ADMIN,
123- "org.freedesktop.login1.chvt",
124- NULL,
125- false,
126- UID_INVALID,
127- &s->manager->polkit_registry,
128- error);
129+ r = check_polkit_chvt(message, s->manager, error);
130 if (r < 0)
131 return r;
132 if (r == 0)
133@@ -215,15 +208,7 @@ static int method_switch_to(sd_bus_message *message, void *userdata, sd_bus_erro
134 if (to <= 0)
135 return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid virtual terminal");
136
137- r = bus_verify_polkit_async(
138- message,
139- CAP_SYS_ADMIN,
140- "org.freedesktop.login1.chvt",
141- NULL,
142- false,
143- UID_INVALID,
144- &s->manager->polkit_registry,
145- error);
146+ r = check_polkit_chvt(message, s->manager, error);
147 if (r < 0)
148 return r;
149 if (r == 0)
150@@ -243,15 +228,7 @@ static int method_switch_to_next(sd_bus_message *message, void *userdata, sd_bus
151 assert(message);
152 assert(s);
153
154- r = bus_verify_polkit_async(
155- message,
156- CAP_SYS_ADMIN,
157- "org.freedesktop.login1.chvt",
158- NULL,
159- false,
160- UID_INVALID,
161- &s->manager->polkit_registry,
162- error);
163+ r = check_polkit_chvt(message, s->manager, error);
164 if (r < 0)
165 return r;
166 if (r == 0)
167@@ -271,15 +248,7 @@ static int method_switch_to_previous(sd_bus_message *message, void *userdata, sd
168 assert(message);
169 assert(s);
170
171- r = bus_verify_polkit_async(
172- message,
173- CAP_SYS_ADMIN,
174- "org.freedesktop.login1.chvt",
175- NULL,
176- false,
177- UID_INVALID,
178- &s->manager->polkit_registry,
179- error);
180+ r = check_polkit_chvt(message, s->manager, error);
181 if (r < 0)
182 return r;
183 if (r == 0)
184diff --git a/src/login/logind-session-dbus.c b/src/login/logind-session-dbus.c
185index ccc5ac8df2..57c8a4e900 100644
186--- a/src/login/logind-session-dbus.c
187+++ b/src/login/logind-session-dbus.c
188@@ -11,6 +11,7 @@
189 #include "fd-util.h"
190 #include "logind-brightness.h"
191 #include "logind-dbus.h"
192+#include "logind-polkit.h"
193 #include "logind-seat-dbus.h"
194 #include "logind-session-dbus.h"
195 #include "logind-session-device.h"
196@@ -192,15 +193,7 @@ int bus_session_method_activate(sd_bus_message *message, void *userdata, sd_bus_
197 assert(message);
198 assert(s);
199
200- r = bus_verify_polkit_async(
201- message,
202- CAP_SYS_ADMIN,
203- "org.freedesktop.login1.chvt",
204- NULL,
205- false,
206- UID_INVALID,
207- &s->manager->polkit_registry,
208- error);
209+ r = check_polkit_chvt(message, s->manager, error);
210 if (r < 0)
211 return r;
212 if (r == 0)
213diff --git a/src/login/meson.build b/src/login/meson.build
214index 0a7d3d5440..7e46be2add 100644
215--- a/src/login/meson.build
216+++ b/src/login/meson.build
217@@ -26,6 +26,7 @@ liblogind_core_sources = files('''
218 logind-device.h
219 logind-inhibit.c
220 logind-inhibit.h
221+ logind-polkit.c
222 logind-seat-dbus.c
223 logind-seat-dbus.h
224 logind-seat.c
225--
2262.28.0
227
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 @@
1From 01195eb9f7d59139fb45df506ac6b3968c14a57f Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 13:55:12 +0800
4Subject: [PATCH 01/22] missing_type.h: add comparison_fn_t
5
6Make it work with musl where comparison_fn_t and is not provided.
7
8Upstream-Status: Inappropriate [musl specific]
9
10Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
11[Rebased for v244]
12Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
13[Rebased for v242]
14Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
15[Rebased for v250, Drop __compare_fn_t]
16Signed-off-by: Jiaqing Zhao <jiaqing.zhao@linux.intel.com>
17---
18 src/basic/missing_type.h | 4 ++++
19 src/basic/sort-util.h | 1 +
20 src/libsystemd/sd-journal/catalog.c | 1 +
21 3 files changed, 6 insertions(+)
22
23diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
24index f6233090a9..6c0456349d 100644
25--- a/src/basic/missing_type.h
26+++ b/src/basic/missing_type.h
27@@ -10,3 +10,7 @@
28 #if !HAVE_CHAR16_T
29 #define char16_t uint16_t
30 #endif
31+
32+#ifndef __GLIBC__
33+typedef int (*comparison_fn_t)(const void *, const void *);
34+#endif
35diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
36index 9c818bd747..ef10c8be2c 100644
37--- a/src/basic/sort-util.h
38+++ b/src/basic/sort-util.h
39@@ -4,6 +4,7 @@
40 #include <stdlib.h>
41
42 #include "macro.h"
43+#include "missing_type.h"
44
45 /* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the
46 * external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that
47diff --git a/src/libsystemd/sd-journal/catalog.c b/src/libsystemd/sd-journal/catalog.c
48index ae91534198..7f67eea38b 100644
49--- a/src/libsystemd/sd-journal/catalog.c
50+++ b/src/libsystemd/sd-journal/catalog.c
51@@ -28,6 +28,7 @@
52 #include "string-util.h"
53 #include "strv.h"
54 #include "tmpfile-util.h"
55+#include "missing_type.h"
56
57 const char * const catalog_file_dirs[] = {
58 "/usr/local/lib/systemd/catalog/",
59--
602.34.1
61
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 e49e06672e..0000000000
--- a/meta/recipes-core/systemd/systemd/0001-systemd.pc.in-use-ROOTPREFIX-without-suffixed-slash.patch
+++ /dev/null
@@ -1,37 +0,0 @@
1From 58860e0f248576a80ff2af256ba42713c186ae93 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 29 Sep 2020 18:01:41 -0700
4Subject: [PATCH] systemd.pc.in: use ROOTPREFIX without suffixed slash
5
6This complements the commit
7https://github.com/poettering/systemd/commit/b612c26ceb9f56af0271fc9f07c1724d2d260a8a
8
9Upstream-Status: Pending
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
11---
12 src/core/systemd.pc.in | 8 ++++----
13 1 file changed, 4 insertions(+), 4 deletions(-)
14
15--- a/src/core/systemd.pc.in
16+++ b/src/core/systemd.pc.in
17@@ -65,16 +65,16 @@ systemdshutdowndir=${systemd_shutdown_dir}
18 tmpfiles_dir=/usr/lib/tmpfiles.d
19 tmpfilesdir=${tmpfiles_dir}
20
21-sysusers_dir=${rootprefix}/lib/sysusers.d
22+sysusers_dir=${prefix}/lib/sysusers.d
23 sysusersdir=${sysusers_dir}
24
25-sysctl_dir=${rootprefix}/lib/sysctl.d
26+sysctl_dir=${prefix}/lib/sysctl.d
27 sysctldir=${sysctl_dir}
28
29-binfmt_dir=${rootprefix}/lib/binfmt.d
30+binfmt_dir=${prefix}/lib/binfmt.d
31 binfmtdir=${binfmt_dir}
32
33-modules_load_dir=${rootprefix}/lib/modules-load.d
34+modules_load_dir=${prefix}/lib/modules-load.d
35 modulesloaddir=${modules_load_dir}
36
37 catalog_dir=/usr/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 bdd64a0252..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 @@
1From f3dbe29f7620a063af4d8eb3ea7c48ecd410200d Mon Sep 17 00:00:00 2001 1From 872b72739e62123867ce6c4f82aa37de24cc3f75 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com> 2From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Mon, 25 Feb 2019 14:04:21 +0800 3Date: Sat, 22 May 2021 20:26:24 +0200
4Subject: [PATCH 04/26] add fallback parse_printf_format implementation 4Subject: [PATCH 02/22] add fallback parse_printf_format implementation
5 5
6Upstream-Status: Inappropriate [musl specific] 6Upstream-Status: Inappropriate [musl specific]
7 7
@@ -11,44 +11,44 @@ Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
11[rebased for systemd 243] 11[rebased for systemd 243]
12Signed-off-by: Scott Murray <scott.murray@konsulko.com> 12Signed-off-by: Scott Murray <scott.murray@konsulko.com>
13--- 13---
14 meson.build | 1 + 14 meson.build | 1 +
15 src/basic/meson.build | 5 + 15 src/basic/meson.build | 5 +
16 src/basic/parse-printf-format.c | 273 ++++++++++++++++++++++++++++++++ 16 src/basic/parse-printf-format.c | 273 +++++++++++++++++++++++
17 src/basic/parse-printf-format.h | 57 +++++++ 17 src/basic/parse-printf-format.h | 57 +++++
18 src/basic/stdio-util.h | 2 +- 18 src/basic/stdio-util.h | 2 +-
19 src/journal/journal-send.c | 2 +- 19 src/libsystemd/sd-journal/journal-send.c | 2 +-
20 6 files changed, 338 insertions(+), 2 deletions(-) 20 6 files changed, 338 insertions(+), 2 deletions(-)
21 create mode 100644 src/basic/parse-printf-format.c 21 create mode 100644 src/basic/parse-printf-format.c
22 create mode 100644 src/basic/parse-printf-format.h 22 create mode 100644 src/basic/parse-printf-format.h
23 23
24diff --git a/meson.build b/meson.build 24diff --git a/meson.build b/meson.build
25index f406d595e6..6aa47fc755 100644 25index 7419e2b0b0..01fd3ffc19 100644
26--- a/meson.build 26--- a/meson.build
27+++ b/meson.build 27+++ b/meson.build
28@@ -646,6 +646,7 @@ endif 28@@ -725,6 +725,7 @@ endif
29 foreach header : ['crypt.h', 29 foreach header : ['crypt.h',
30 'linux/memfd.h', 30 'linux/memfd.h',
31 'linux/vm_sockets.h', 31 'linux/vm_sockets.h',
32+ 'printf.h', 32+ 'printf.h',
33 'sys/auxv.h', 33 'sys/auxv.h',
34 'threads.h',
34 'valgrind/memcheck.h', 35 'valgrind/memcheck.h',
35 'valgrind/valgrind.h',
36diff --git a/src/basic/meson.build b/src/basic/meson.build 36diff --git a/src/basic/meson.build b/src/basic/meson.build
37index 1183ea83ad..aa5c958850 100644 37index d7450d8b44..c3e3daf4bd 100644
38--- a/src/basic/meson.build 38--- a/src/basic/meson.build
39+++ b/src/basic/meson.build 39+++ b/src/basic/meson.build
40@@ -322,6 +322,11 @@ foreach item : [['af', af_list_txt, 'af', ''], 40@@ -183,6 +183,11 @@ endforeach
41 endforeach
42 41
43 basic_sources += generated_gperf_headers 42 basic_sources += generated_gperf_headers
44+ 43
45+if conf.get('HAVE_PRINTF_H') != 1 44+if conf.get('HAVE_PRINTF_H') != 1
46+ basic_sources += [files('parse-printf-format.c')] 45+ basic_sources += [files('parse-printf-format.c')]
47+endif 46+endif
48+ 47+
49 basic_gcrypt_sources = files( 48+
50 'gcrypt-util.c', 49 ############################################################
51 'gcrypt-util.h') 50
51 arch_list = [
52diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c 52diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c
53new file mode 100644 53new file mode 100644
54index 0000000000..49437e5445 54index 0000000000..49437e5445
@@ -392,10 +392,10 @@ index 0000000000..47be7522d7
392+ 392+
393+#endif /* HAVE_PRINTF_H */ 393+#endif /* HAVE_PRINTF_H */
394diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h 394diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h
395index 6dc1e72312..cea76b36cf 100644 395index 4e93ac90c9..f9deb6f662 100644
396--- a/src/basic/stdio-util.h 396--- a/src/basic/stdio-util.h
397+++ b/src/basic/stdio-util.h 397+++ b/src/basic/stdio-util.h
398@@ -1,13 +1,13 @@ 398@@ -1,12 +1,12 @@
399 /* SPDX-License-Identifier: LGPL-2.1-or-later */ 399 /* SPDX-License-Identifier: LGPL-2.1-or-later */
400 #pragma once 400 #pragma once
401 401
@@ -405,15 +405,14 @@ index 6dc1e72312..cea76b36cf 100644
405 #include <sys/types.h> 405 #include <sys/types.h>
406 406
407 #include "macro.h" 407 #include "macro.h"
408 #include "memory-util.h"
409+#include "parse-printf-format.h" 408+#include "parse-printf-format.h"
410 409
411 #define snprintf_ok(buf, len, fmt, ...) \ 410 _printf_(3, 4)
412 ((size_t) snprintf(buf, len, fmt, __VA_ARGS__) < (len)) 411 static inline char *snprintf_ok(char *buf, size_t len, const char *format, ...) {
413diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c 412diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
414index fd3fd7ef9c..e8e6ad555b 100644 413index be23b2fe75..69a2eb6404 100644
415--- a/src/journal/journal-send.c 414--- a/src/libsystemd/sd-journal/journal-send.c
416+++ b/src/journal/journal-send.c 415+++ b/src/libsystemd/sd-journal/journal-send.c
417@@ -2,7 +2,6 @@ 416@@ -2,7 +2,6 @@
418 417
419 #include <errno.h> 418 #include <errno.h>
@@ -422,7 +421,7 @@ index fd3fd7ef9c..e8e6ad555b 100644
422 #include <stddef.h> 421 #include <stddef.h>
423 #include <sys/un.h> 422 #include <sys/un.h>
424 #include <unistd.h> 423 #include <unistd.h>
425@@ -21,6 +20,7 @@ 424@@ -28,6 +27,7 @@
426 #include "stdio-util.h" 425 #include "stdio-util.h"
427 #include "string-util.h" 426 #include "string-util.h"
428 #include "tmpfile-util.h" 427 #include "tmpfile-util.h"
@@ -431,5 +430,5 @@ index fd3fd7ef9c..e8e6ad555b 100644
431 #define SNDBUF_SIZE (8*1024*1024) 430 #define SNDBUF_SIZE (8*1024*1024)
432 431
433-- 432--
4342.27.0 4332.34.1
435 434
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 @@
1From 29a58009a172e369ad7166e16dab2f4945c6b0d2 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Thu, 21 Feb 2019 16:23:24 +0800
4Subject: [PATCH 1/2] binfmt: Don't install dependency links at install time
5 for the binfmt services
6
7use [Install] blocks so that they get created when the service is enabled
8like a traditional service.
9
10The [Install] blocks were rejected upstream as they don't have a way to
11"enable" it on install without static symlinks which can't be disabled,
12only masked. We however can do that in a postinst.
13
14Upstream-Status: Denied
15
16Signed-off-by: Ross Burton <ross.burton@intel.com>
17Signed-off-by: Khem Raj <raj.khem@gmail.com>
18Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
19[rebased for systemd 243]
20Signed-off-by: Scott Murray <scott.murray@konsulko.com>
21---
22 units/meson.build | 2 --
23 units/proc-sys-fs-binfmt_misc.automount | 3 +++
24 units/systemd-binfmt.service.in | 4 ++++
25 3 files changed, 7 insertions(+), 2 deletions(-)
26
27diff --git a/units/meson.build b/units/meson.build
28index e7bfb7f838..1d5ec4b178 100644
29--- a/units/meson.build
30+++ b/units/meson.build
31@@ -154,7 +154,6 @@ units = [
32 {
33 'file' : 'proc-sys-fs-binfmt_misc.automount',
34 'conditions' : ['ENABLE_BINFMT'],
35- 'symlinks' : ['sysinit.target.wants/'],
36 },
37 {
38 'file' : 'proc-sys-fs-binfmt_misc.mount',
39@@ -251,7 +250,6 @@ units = [
40 {
41 'file' : 'systemd-binfmt.service.in',
42 'conditions' : ['ENABLE_BINFMT'],
43- 'symlinks' : ['sysinit.target.wants/'],
44 },
45 {
46 'file' : 'systemd-bless-boot.service.in',
47diff --git a/units/proc-sys-fs-binfmt_misc.automount b/units/proc-sys-fs-binfmt_misc.automount
48index 5d212015a5..6c2900ca77 100644
49--- a/units/proc-sys-fs-binfmt_misc.automount
50+++ b/units/proc-sys-fs-binfmt_misc.automount
51@@ -22,3 +22,6 @@ Before=shutdown.target
52
53 [Automount]
54 Where=/proc/sys/fs/binfmt_misc
55+
56+[Install]
57+WantedBy=sysinit.target
58diff --git a/units/systemd-binfmt.service.in b/units/systemd-binfmt.service.in
59index 6861c76674..531e9fbd90 100644
60--- a/units/systemd-binfmt.service.in
61+++ b/units/systemd-binfmt.service.in
62@@ -14,6 +14,7 @@ Documentation=https://docs.kernel.org/admin-guide/binfmt-misc.html
63 Documentation=https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems
64 DefaultDependencies=no
65 Conflicts=shutdown.target
66+Wants=proc-sys-fs-binfmt_misc.automount
67 After=proc-sys-fs-binfmt_misc.automount
68 After=proc-sys-fs-binfmt_misc.mount
69 After=local-fs.target
70@@ -31,3 +32,6 @@ RemainAfterExit=yes
71 ExecStart={{LIBEXECDIR}}/systemd-binfmt
72 ExecStop={{LIBEXECDIR}}/systemd-binfmt --unregister
73 TimeoutSec=90s
74+
75+[Install]
76+WantedBy=sysinit.target
77--
782.34.1
79
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 d856bcb583..0000000000
--- a/meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch
+++ /dev/null
@@ -1,164 +0,0 @@
1From 66ece0b870b3a34fdabc48b88437e6cc354e9fce Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 13:41:41 +0800
4Subject: [PATCH 02/26] don't use glibc-specific qsort_r
5
6Upstream-Status: Inappropriate [musl specific]
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9[Rebased for v241]
10Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
11[Rebased for v242]
12Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
13[Rebased for v247]
14Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
15---
16 src/basic/sort-util.h | 14 ------------
17 src/libsystemd/sd-hwdb/hwdb-util.c | 19 +++++++++++-----
18 src/shared/format-table.c | 36 ++++++++++++++++++++----------
19 3 files changed, 38 insertions(+), 31 deletions(-)
20
21diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
22index 1d194a1f04..3394c9eb72 100644
23--- a/src/basic/sort-util.h
24+++ b/src/basic/sort-util.h
25@@ -54,17 +54,3 @@ static inline void _qsort_safe(void *base, size_t nmemb, size_t size, __compar_f
26 int (*_func_)(const typeof(p[0])*, const typeof(p[0])*) = func; \
27 _qsort_safe((p), (n), sizeof((p)[0]), (__compar_fn_t) _func_); \
28 })
29-
30-static inline void qsort_r_safe(void *base, size_t nmemb, size_t size, __compar_d_fn_t compar, void *userdata) {
31- if (nmemb <= 1)
32- return;
33-
34- assert(base);
35- qsort_r(base, nmemb, size, compar, userdata);
36-}
37-
38-#define typesafe_qsort_r(p, n, func, userdata) \
39- ({ \
40- int (*_func_)(const typeof(p[0])*, const typeof(p[0])*, typeof(userdata)) = func; \
41- qsort_r_safe((p), (n), sizeof((p)[0]), (__compar_d_fn_t) _func_, userdata); \
42- })
43diff --git a/src/libsystemd/sd-hwdb/hwdb-util.c b/src/libsystemd/sd-hwdb/hwdb-util.c
44index 4c94ba9c88..95495dba6d 100644
45--- a/src/libsystemd/sd-hwdb/hwdb-util.c
46+++ b/src/libsystemd/sd-hwdb/hwdb-util.c
47@@ -126,9 +126,13 @@ static void trie_free(struct trie *trie) {
48
49 DEFINE_TRIVIAL_CLEANUP_FUNC(struct trie*, trie_free);
50
51-static int trie_values_cmp(const struct trie_value_entry *a, const struct trie_value_entry *b, struct trie *trie) {
52- return strcmp(trie->strings->buf + a->key_off,
53- trie->strings->buf + b->key_off);
54+static struct trie *trie_node_add_value_trie;
55+static int trie_values_cmp(const void *v1, const void *v2) {
56+ const struct trie_value_entry *a = v1;
57+ const struct trie_value_entry *b = v2;
58+
59+ return strcmp(trie_node_add_value_trie->strings->buf + a->key_off,
60+ trie_node_add_value_trie->strings->buf + b->key_off);
61 }
62
63 static int trie_node_add_value(struct trie *trie, struct trie_node *node,
64@@ -156,7 +160,10 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node,
65 .value_off = v,
66 };
67
68- val = typesafe_bsearch_r(&search, node->values, node->values_count, trie_values_cmp, trie);
69+ trie_node_add_value_trie = trie;
70+ val = bsearch(&search, node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp);
71+ trie_node_add_value_trie = NULL;
72+
73 if (val) {
74 /* At this point we have 2 identical properties on the same match-string.
75 * Since we process files in order, we just replace the previous value. */
76@@ -182,7 +189,9 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node,
77 .line_number = line_number,
78 };
79 node->values_count++;
80- typesafe_qsort_r(node->values, node->values_count, trie_values_cmp, trie);
81+ trie_node_add_value_trie = trie;
82+ qsort(node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp);
83+ trie_node_add_value_trie = NULL;
84 return 0;
85 }
86
87diff --git a/src/shared/format-table.c b/src/shared/format-table.c
88index a13a198b7a..bce10bc607 100644
89--- a/src/shared/format-table.c
90+++ b/src/shared/format-table.c
91@@ -1243,30 +1243,32 @@ static int cell_data_compare(TableData *a, size_t index_a, TableData *b, size_t
92 return CMP(index_a, index_b);
93 }
94
95-static int table_data_compare(const size_t *a, const size_t *b, Table *t) {
96+static Table *user_table;
97+static int table_data_compare(const void *x, const void *y) {
98+ const size_t *a = x, *b=y;
99 int r;
100
101- assert(t);
102- assert(t->sort_map);
103+ assert(user_table);
104+ assert(user_table->sort_map);
105
106 /* Make sure the header stays at the beginning */
107- if (*a < t->n_columns && *b < t->n_columns)
108+ if (*a < user_table->n_columns && *b < user_table->n_columns)
109 return 0;
110- if (*a < t->n_columns)
111+ if (*a < user_table->n_columns)
112 return -1;
113- if (*b < t->n_columns)
114+ if (*b < user_table->n_columns)
115 return 1;
116
117 /* Order other lines by the sorting map */
118- for (size_t i = 0; i < t->n_sort_map; i++) {
119+ for (size_t i = 0; i < user_table->n_sort_map; i++) {
120 TableData *d, *dd;
121
122- d = t->data[*a + t->sort_map[i]];
123- dd = t->data[*b + t->sort_map[i]];
124+ d = user_table->data[*a + user_table->sort_map[i]];
125+ dd = user_table->data[*b + user_table->sort_map[i]];
126
127 r = cell_data_compare(d, *a, dd, *b);
128 if (r != 0)
129- return t->reverse_map && t->reverse_map[t->sort_map[i]] ? -r : r;
130+ return user_table->reverse_map && user_table->reverse_map[user_table->sort_map[i]] ? -r : r;
131 }
132
133 /* Order identical lines by the order there were originally added in */
134@@ -1844,7 +1846,12 @@ int table_print(Table *t, FILE *f) {
135 for (size_t i = 0; i < n_rows; i++)
136 sorted[i] = i * t->n_columns;
137
138- typesafe_qsort_r(sorted, n_rows, table_data_compare, t);
139+ if (n_rows <= 1)
140+ return 0;
141+ assert(sorted);
142+ user_table = t;
143+ qsort(sorted, n_rows, sizeof(size_t), table_data_compare);
144+ user_table = NULL;
145 }
146
147 if (t->display_map)
148@@ -2440,7 +2447,12 @@ int table_to_json(Table *t, JsonVariant **ret) {
149 for (size_t i = 0; i < n_rows; i++)
150 sorted[i] = i * t->n_columns;
151
152- typesafe_qsort_r(sorted, n_rows, table_data_compare, t);
153+ if (n_rows <= 1)
154+ return 0;
155+ assert(sorted);
156+ user_table = t;
157+ qsort(sorted, n_rows, sizeof(size_t), table_data_compare);
158+ user_table = NULL;
159 }
160
161 if (t->display_map)
162--
1632.27.0
164
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 f43a22aa8b..0000000000
--- a/meta/recipes-core/systemd/systemd/0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch
+++ /dev/null
@@ -1,78 +0,0 @@
1From 9f0d5996bbb2db3679a4075fa8301750b786c03b Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 13:55:12 +0800
4Subject: [PATCH 03/26] missing_type.h: add __compare_fn_t and comparison_fn_t
5
6Make it work with musl where comparison_fn_t and __compare_fn_t
7is not provided.
8
9Upstream-Status: Inappropriate [musl specific]
10
11Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
12[Rebased for v244]
13Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
14[Rebased for v242]
15Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
16---
17 src/basic/missing_type.h | 9 +++++++++
18 src/basic/sort-util.h | 1 +
19 src/core/kmod-setup.c | 1 +
20 src/journal/catalog.c | 1 +
21 4 files changed, 12 insertions(+)
22
23diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
24index f6233090a9..aeaf6ad5ec 100644
25--- a/src/basic/missing_type.h
26+++ b/src/basic/missing_type.h
27@@ -10,3 +10,12 @@
28 #if !HAVE_CHAR16_T
29 #define char16_t uint16_t
30 #endif
31+
32+#ifndef __GLIBC__
33+typedef int (*comparison_fn_t)(const void *, const void *);
34+#endif
35+
36+#ifndef __COMPAR_FN_T
37+#define __COMPAR_FN_T
38+typedef int (*__compar_fn_t)(const void *, const void *);
39+#endif
40diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
41index 3394c9eb72..d9cb2aecb6 100644
42--- a/src/basic/sort-util.h
43+++ b/src/basic/sort-util.h
44@@ -4,6 +4,7 @@
45 #include <stdlib.h>
46
47 #include "macro.h"
48+#include "missing_type.h"
49
50 void *xbsearch_r(const void *key, const void *base, size_t nmemb, size_t size,
51 __compar_d_fn_t compar, void *arg);
52diff --git a/src/core/kmod-setup.c b/src/core/kmod-setup.c
53index 8a7f82812a..a56f12f47f 100644
54--- a/src/core/kmod-setup.c
55+++ b/src/core/kmod-setup.c
56@@ -10,6 +10,7 @@
57 #include "kmod-setup.h"
58 #include "macro.h"
59 #include "string-util.h"
60+#include "missing_type.h"
61
62 #if HAVE_KMOD
63 #include "module-util.h"
64diff --git a/src/journal/catalog.c b/src/journal/catalog.c
65index 0f6ad8a29e..4e1077ade4 100644
66--- a/src/journal/catalog.c
67+++ b/src/journal/catalog.c
68@@ -28,6 +28,7 @@
69 #include "string-util.h"
70 #include "strv.h"
71 #include "tmpfile-util.h"
72+#include "missing_type.h"
73
74 const char * const catalog_file_dirs[] = {
75 "/usr/local/lib/systemd/catalog/",
76--
772.27.0
78
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 d63e3c0d09..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 @@
1From 5aeae0ea89f5af74ed5d95bed1d87a03b3801ff0 Mon Sep 17 00:00:00 2001 1From 87f1d38f40c5fe9cadf2b2de442473e4e5605788 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com> 2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 14:18:21 +0800 3Date: Mon, 25 Feb 2019 14:18:21 +0800
4Subject: [PATCH 05/26] src/basic/missing.h: check for missing strndupa 4Subject: [PATCH 03/22] src/basic/missing.h: check for missing strndupa
5 5
6include missing.h for definition of strndupa 6include missing.h for definition of strndupa
7 7
@@ -17,6 +17,9 @@ Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
17[rebased for systemd 244] 17[rebased for systemd 244]
18[Rebased for v247] 18[Rebased for v247]
19Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com> 19Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
20[Rebased for v254]
21Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
22[Rebased for v255.1]
20--- 23---
21 meson.build | 1 + 24 meson.build | 1 +
22 src/backlight/backlight.c | 1 + 25 src/backlight/backlight.c | 1 +
@@ -25,11 +28,12 @@ Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
25 src/basic/log.c | 1 + 28 src/basic/log.c | 1 +
26 src/basic/missing_stdlib.h | 12 ++++++++++++ 29 src/basic/missing_stdlib.h | 12 ++++++++++++
27 src/basic/mkdir.c | 1 + 30 src/basic/mkdir.c | 1 +
31 src/basic/mountpoint-util.c | 1 +
28 src/basic/parse-util.c | 1 + 32 src/basic/parse-util.c | 1 +
29 src/basic/path-lookup.c | 1 + 33 src/basic/path-lookup.c | 1 +
34 src/basic/percent-util.c | 1 +
30 src/basic/proc-cmdline.c | 1 + 35 src/basic/proc-cmdline.c | 1 +
31 src/basic/procfs-util.c | 1 + 36 src/basic/procfs-util.c | 1 +
32 src/basic/selinux-util.c | 1 +
33 src/basic/time-util.c | 1 + 37 src/basic/time-util.c | 1 +
34 src/boot/bless-boot.c | 1 + 38 src/boot/bless-boot.c | 1 +
35 src/core/dbus-cgroup.c | 1 + 39 src/core/dbus-cgroup.c | 1 +
@@ -39,15 +43,15 @@ Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
39 src/core/kmod-setup.c | 1 + 43 src/core/kmod-setup.c | 1 +
40 src/core/service.c | 1 + 44 src/core/service.c | 1 +
41 src/coredump/coredump-vacuum.c | 1 + 45 src/coredump/coredump-vacuum.c | 1 +
46 src/fstab-generator/fstab-generator.c | 1 +
42 src/journal-remote/journal-remote-main.c | 1 + 47 src/journal-remote/journal-remote-main.c | 1 +
43 src/journal/journalctl.c | 1 + 48 src/journal/journalctl.c | 1 +
44 src/journal/sd-journal.c | 1 +
45 src/libsystemd/sd-bus/bus-message.c | 1 + 49 src/libsystemd/sd-bus/bus-message.c | 1 +
46 src/libsystemd/sd-bus/bus-objects.c | 1 + 50 src/libsystemd/sd-bus/bus-objects.c | 1 +
47 src/libsystemd/sd-bus/bus-socket.c | 1 + 51 src/libsystemd/sd-bus/bus-socket.c | 1 +
48 src/libsystemd/sd-bus/sd-bus.c | 1 + 52 src/libsystemd/sd-bus/sd-bus.c | 1 +
49 src/libsystemd/sd-bus/test-bus-benchmark.c | 1 + 53 src/libsystemd/sd-bus/test-bus-benchmark.c | 1 +
50 src/locale/keymap-util.c | 1 + 54 src/libsystemd/sd-journal/sd-journal.c | 1 +
51 src/login/pam_systemd.c | 1 + 55 src/login/pam_systemd.c | 1 +
52 src/network/generator/network-generator.c | 1 + 56 src/network/generator/network-generator.c | 1 +
53 src/nspawn/nspawn-settings.c | 1 + 57 src/nspawn/nspawn-settings.c | 1 +
@@ -62,34 +66,40 @@ Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
62 src/shared/journal-importer.c | 1 + 66 src/shared/journal-importer.c | 1 +
63 src/shared/logs-show.c | 1 + 67 src/shared/logs-show.c | 1 +
64 src/shared/pager.c | 1 + 68 src/shared/pager.c | 1 +
65 src/shared/uid-range.c | 1 +
66 src/socket-proxy/socket-proxyd.c | 1 + 69 src/socket-proxy/socket-proxyd.c | 1 +
67 src/test/test-hexdecoct.c | 1 + 70 src/test/test-hexdecoct.c | 1 +
71 src/udev/udev-builtin-net_id.c | 1 +
68 src/udev/udev-builtin-path_id.c | 1 + 72 src/udev/udev-builtin-path_id.c | 1 +
69 src/udev/udev-event.c | 1 + 73 src/udev/udev-event.c | 1 +
70 src/udev/udev-rules.c | 1 + 74 src/udev/udev-rules.c | 1 +
71 50 files changed, 61 insertions(+) 75 51 files changed, 62 insertions(+)
72 76
77diff --git a/meson.build b/meson.build
78index 01fd3ffc19..61a872b753 100644
73--- a/meson.build 79--- a/meson.build
74+++ b/meson.build 80+++ b/meson.build
75@@ -535,6 +535,7 @@ foreach ident : [ 81@@ -567,6 +567,7 @@ foreach ident : ['secure_getenv', '__secure_getenv']
76 #include <sys/wait.h>'''], 82 endforeach
77 ['mallinfo', '''#include <malloc.h>'''],
78 ['close_range', '''#include <unistd.h>'''],
79+ ['strndupa' , '''#include <string.h>'''],
80 ]
81 83
82 have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE') 84 foreach ident : [
85+ ['strndupa' , '''#include <string.h>'''],
86 ['memfd_create', '''#include <sys/mman.h>'''],
87 ['gettid', '''#include <sys/types.h>
88 #include <unistd.h>'''],
89diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c
90index 5ac9f904a9..99d5122dd7 100644
83--- a/src/backlight/backlight.c 91--- a/src/backlight/backlight.c
84+++ b/src/backlight/backlight.c 92+++ b/src/backlight/backlight.c
85@@ -19,6 +19,7 @@ 93@@ -20,6 +20,7 @@
86 #include "string-util.h" 94 #include "string-util.h"
87 #include "strv.h" 95 #include "strv.h"
88 #include "util.h" 96 #include "terminal-util.h"
89+#include "missing_stdlib.h" 97+#include "missing_stdlib.h"
90 98
91 static int help(void) { 99 #define PCI_CLASS_GRAPHICS_CARD 0x30000
92 _cleanup_free_ char *link = NULL; 100
101diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
102index 18b16ecc0e..d2be79622f 100644
93--- a/src/basic/cgroup-util.c 103--- a/src/basic/cgroup-util.c
94+++ b/src/basic/cgroup-util.c 104+++ b/src/basic/cgroup-util.c
95@@ -38,6 +38,7 @@ 105@@ -38,6 +38,7 @@
@@ -98,11 +108,13 @@ Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
98 #include "xattr-util.h" 108 #include "xattr-util.h"
99+#include "missing_stdlib.h" 109+#include "missing_stdlib.h"
100 110
101 static int cg_enumerate_items(const char *controller, const char *path, FILE **_f, const char *item) { 111 static int cg_enumerate_items(const char *controller, const char *path, FILE **ret, const char *item) {
102 _cleanup_free_ char *fs = NULL; 112 _cleanup_free_ char *fs = NULL;
113diff --git a/src/basic/env-util.c b/src/basic/env-util.c
114index d3bf73385f..16b17358ca 100644
103--- a/src/basic/env-util.c 115--- a/src/basic/env-util.c
104+++ b/src/basic/env-util.c 116+++ b/src/basic/env-util.c
105@@ -15,6 +15,7 @@ 117@@ -19,6 +19,7 @@
106 #include "string-util.h" 118 #include "string-util.h"
107 #include "strv.h" 119 #include "strv.h"
108 #include "utf8.h" 120 #include "utf8.h"
@@ -110,16 +122,20 @@ Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
110 122
111 /* We follow bash for the character set. Different shells have different rules. */ 123 /* We follow bash for the character set. Different shells have different rules. */
112 #define VALID_BASH_ENV_NAME_CHARS \ 124 #define VALID_BASH_ENV_NAME_CHARS \
125diff --git a/src/basic/log.c b/src/basic/log.c
126index 1470611a75..9924ec2b9a 100644
113--- a/src/basic/log.c 127--- a/src/basic/log.c
114+++ b/src/basic/log.c 128+++ b/src/basic/log.c
115@@ -36,6 +36,7 @@ 129@@ -40,6 +40,7 @@
116 #include "terminal-util.h" 130 #include "terminal-util.h"
117 #include "time-util.h" 131 #include "time-util.h"
118 #include "utf8.h" 132 #include "utf8.h"
119+#include "missing_stdlib.h" 133+#include "missing_stdlib.h"
120 134
121 #define SNDBUF_SIZE (8*1024*1024) 135 #define SNDBUF_SIZE (8*1024*1024)
122 136 #define IOVEC_MAX 256U
137diff --git a/src/basic/missing_stdlib.h b/src/basic/missing_stdlib.h
138index 8c76f93eb2..9068bfb4f0 100644
123--- a/src/basic/missing_stdlib.h 139--- a/src/basic/missing_stdlib.h
124+++ b/src/basic/missing_stdlib.h 140+++ b/src/basic/missing_stdlib.h
125@@ -11,3 +11,15 @@ 141@@ -11,3 +11,15 @@
@@ -138,19 +154,35 @@ Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
138+ (char *)memcpy(__new, __old, __len); \ 154+ (char *)memcpy(__new, __old, __len); \
139+ }) 155+ })
140+#endif 156+#endif
157diff --git a/src/basic/mkdir.c b/src/basic/mkdir.c
158index c770e5ed32..1fd8816cd0 100644
141--- a/src/basic/mkdir.c 159--- a/src/basic/mkdir.c
142+++ b/src/basic/mkdir.c 160+++ b/src/basic/mkdir.c
143@@ -14,6 +14,7 @@ 161@@ -16,6 +16,7 @@
144 #include "stat-util.h" 162 #include "stat-util.h"
145 #include "stdio-util.h" 163 #include "stdio-util.h"
146 #include "user-util.h" 164 #include "user-util.h"
147+#include "missing_stdlib.h" 165+#include "missing_stdlib.h"
148 166
149 int mkdir_safe_internal( 167 int mkdirat_safe_internal(
150 const char *path, 168 int dir_fd,
169diff --git a/src/basic/mountpoint-util.c b/src/basic/mountpoint-util.c
170index bf67f7e01a..409f8d8a73 100644
171--- a/src/basic/mountpoint-util.c
172+++ b/src/basic/mountpoint-util.c
173@@ -18,6 +18,7 @@
174 #include "missing_stat.h"
175 #include "missing_syscall.h"
176 #include "mkdir.h"
177+#include "missing_stdlib.h"
178 #include "mountpoint-util.h"
179 #include "nulstr-util.h"
180 #include "parse-util.h"
181diff --git a/src/basic/parse-util.c b/src/basic/parse-util.c
182index 0430e33e40..f3728de026 100644
151--- a/src/basic/parse-util.c 183--- a/src/basic/parse-util.c
152+++ b/src/basic/parse-util.c 184+++ b/src/basic/parse-util.c
153@@ -22,6 +22,7 @@ 185@@ -18,6 +18,7 @@
154 #include "stat-util.h" 186 #include "stat-util.h"
155 #include "string-util.h" 187 #include "string-util.h"
156 #include "strv.h" 188 #include "strv.h"
@@ -158,9 +190,11 @@ Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
158 190
159 int parse_boolean(const char *v) { 191 int parse_boolean(const char *v) {
160 if (!v) 192 if (!v)
193diff --git a/src/basic/path-lookup.c b/src/basic/path-lookup.c
194index 4e3d59fc56..726e240df0 100644
161--- a/src/basic/path-lookup.c 195--- a/src/basic/path-lookup.c
162+++ b/src/basic/path-lookup.c 196+++ b/src/basic/path-lookup.c
163@@ -15,6 +15,7 @@ 197@@ -16,6 +16,7 @@
164 #include "strv.h" 198 #include "strv.h"
165 #include "tmpfile-util.h" 199 #include "tmpfile-util.h"
166 #include "user-util.h" 200 #include "user-util.h"
@@ -168,36 +202,44 @@ Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
168 202
169 int xdg_user_runtime_dir(char **ret, const char *suffix) { 203 int xdg_user_runtime_dir(char **ret, const char *suffix) {
170 const char *e; 204 const char *e;
205diff --git a/src/basic/percent-util.c b/src/basic/percent-util.c
206index cab9d0eaea..5f6ca258e9 100644
207--- a/src/basic/percent-util.c
208+++ b/src/basic/percent-util.c
209@@ -3,6 +3,7 @@
210 #include "percent-util.h"
211 #include "string-util.h"
212 #include "parse-util.h"
213+#include "missing_stdlib.h"
214
215 static int parse_parts_value_whole(const char *p, const char *symbol) {
216 const char *pc, *n;
217diff --git a/src/basic/proc-cmdline.c b/src/basic/proc-cmdline.c
218index 522d8de1f4..7c129dc0fc 100644
171--- a/src/basic/proc-cmdline.c 219--- a/src/basic/proc-cmdline.c
172+++ b/src/basic/proc-cmdline.c 220+++ b/src/basic/proc-cmdline.c
173@@ -15,6 +15,7 @@ 221@@ -16,6 +16,7 @@
174 #include "string-util.h" 222 #include "string-util.h"
175 #include "util.h" 223 #include "strv.h"
176 #include "virt.h" 224 #include "virt.h"
177+#include "missing_stdlib.h" 225+#include "missing_stdlib.h"
178 226
179 int proc_cmdline(char **ret) { 227 int proc_cmdline_filter_pid1_args(char **argv, char ***ret) {
180 const char *e; 228 enum {
229diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c
230index d7cfcd9105..6cb0ddf575 100644
181--- a/src/basic/procfs-util.c 231--- a/src/basic/procfs-util.c
182+++ b/src/basic/procfs-util.c 232+++ b/src/basic/procfs-util.c
183@@ -11,6 +11,7 @@ 233@@ -12,6 +12,7 @@
184 #include "procfs-util.h" 234 #include "procfs-util.h"
185 #include "stdio-util.h" 235 #include "stdio-util.h"
186 #include "string-util.h" 236 #include "string-util.h"
187+#include "missing_stdlib.h" 237+#include "missing_stdlib.h"
188 238
189 int procfs_tasks_get_limit(uint64_t *ret) { 239 int procfs_get_pid_max(uint64_t *ret) {
190 _cleanup_free_ char *value = NULL; 240 _cleanup_free_ char *value = NULL;
191--- a/src/basic/selinux-util.c 241diff --git a/src/basic/time-util.c b/src/basic/time-util.c
192+++ b/src/basic/selinux-util.c 242index f9014dc560..1d7840a5b5 100644
193@@ -27,6 +27,7 @@
194 #include "selinux-util.h"
195 #include "stdio-util.h"
196 #include "time-util.h"
197+#include "missing_stdlib.h"
198
199 #if HAVE_SELINUX
200 DEFINE_TRIVIAL_CLEANUP_FUNC(context_t, context_free);
201--- a/src/basic/time-util.c 243--- a/src/basic/time-util.c
202+++ b/src/basic/time-util.c 244+++ b/src/basic/time-util.c
203@@ -27,6 +27,7 @@ 245@@ -27,6 +27,7 @@
@@ -208,29 +250,35 @@ Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
208 250
209 static clockid_t map_clock_id(clockid_t c) { 251 static clockid_t map_clock_id(clockid_t c) {
210 252
253diff --git a/src/boot/bless-boot.c b/src/boot/bless-boot.c
254index 0c0b4f23c7..68fe5ca509 100644
211--- a/src/boot/bless-boot.c 255--- a/src/boot/bless-boot.c
212+++ b/src/boot/bless-boot.c 256+++ b/src/boot/bless-boot.c
213@@ -18,6 +18,7 @@ 257@@ -22,6 +22,7 @@
214 #include "util.h" 258 #include "terminal-util.h"
215 #include "verbs.h" 259 #include "verbs.h"
216 #include "virt.h" 260 #include "virt.h"
217+#include "missing_stdlib.h" 261+#include "missing_stdlib.h"
218 262
219 static char **arg_path = NULL; 263 static char **arg_path = NULL;
220 264
265diff --git a/src/core/dbus-cgroup.c b/src/core/dbus-cgroup.c
266index 4237e694c0..05f9d9d9a9 100644
221--- a/src/core/dbus-cgroup.c 267--- a/src/core/dbus-cgroup.c
222+++ b/src/core/dbus-cgroup.c 268+++ b/src/core/dbus-cgroup.c
223@@ -16,6 +16,7 @@ 269@@ -25,6 +25,7 @@
224 #include "fileio.h" 270 #include "parse-util.h"
225 #include "limits-util.h"
226 #include "path-util.h" 271 #include "path-util.h"
272 #include "percent-util.h"
227+#include "missing_stdlib.h" 273+#include "missing_stdlib.h"
274 #include "socket-util.h"
228 275
229 BUS_DEFINE_PROPERTY_GET(bus_property_get_tasks_max, "t", TasksMax, tasks_max_resolve); 276 BUS_DEFINE_PROPERTY_GET(bus_property_get_tasks_max, "t", CGroupTasksMax, cgroup_tasks_max_resolve);
230 277diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c
278index 4daa1cefd3..2c77901471 100644
231--- a/src/core/dbus-execute.c 279--- a/src/core/dbus-execute.c
232+++ b/src/core/dbus-execute.c 280+++ b/src/core/dbus-execute.c
233@@ -41,6 +41,7 @@ 281@@ -42,6 +42,7 @@
234 #include "unit-printf.h" 282 #include "unit-printf.h"
235 #include "user-util.h" 283 #include "user-util.h"
236 #include "utf8.h" 284 #include "utf8.h"
@@ -238,9 +286,11 @@ Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
238 286
239 BUS_DEFINE_PROPERTY_GET_ENUM(bus_property_get_exec_output, exec_output, ExecOutput); 287 BUS_DEFINE_PROPERTY_GET_ENUM(bus_property_get_exec_output, exec_output, ExecOutput);
240 static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_exec_input, exec_input, ExecInput); 288 static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_exec_input, exec_input, ExecInput);
289diff --git a/src/core/dbus-util.c b/src/core/dbus-util.c
290index d680a64268..e59f48103e 100644
241--- a/src/core/dbus-util.c 291--- a/src/core/dbus-util.c
242+++ b/src/core/dbus-util.c 292+++ b/src/core/dbus-util.c
243@@ -7,6 +7,7 @@ 293@@ -9,6 +9,7 @@
244 #include "unit-printf.h" 294 #include "unit-printf.h"
245 #include "user-util.h" 295 #include "user-util.h"
246 #include "unit.h" 296 #include "unit.h"
@@ -248,39 +298,47 @@ Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
248 298
249 int bus_property_get_triggered_unit( 299 int bus_property_get_triggered_unit(
250 sd_bus *bus, 300 sd_bus *bus,
301diff --git a/src/core/execute.c b/src/core/execute.c
302index ef0bf88687..bd3da0c401 100644
251--- a/src/core/execute.c 303--- a/src/core/execute.c
252+++ b/src/core/execute.c 304+++ b/src/core/execute.c
253@@ -96,6 +96,7 @@ 305@@ -72,6 +72,7 @@
254 #include "unit.h" 306 #include "unit-serialize.h"
255 #include "user-util.h" 307 #include "user-util.h"
256 #include "utmp-wtmp.h" 308 #include "utmp-wtmp.h"
257+#include "missing_stdlib.h" 309+#include "missing_stdlib.h"
258 310
259 #define IDLE_TIMEOUT_USEC (5*USEC_PER_SEC) 311 static bool is_terminal_input(ExecInput i) {
260 #define IDLE_TIMEOUT2_USEC (1*USEC_PER_SEC) 312 return IN_SET(i,
313diff --git a/src/core/kmod-setup.c b/src/core/kmod-setup.c
314index b8e3f7aadd..8ce8ca68d8 100644
261--- a/src/core/kmod-setup.c 315--- a/src/core/kmod-setup.c
262+++ b/src/core/kmod-setup.c 316+++ b/src/core/kmod-setup.c
263@@ -11,6 +11,7 @@ 317@@ -13,6 +13,7 @@
264 #include "macro.h"
265 #include "string-util.h" 318 #include "string-util.h"
266 #include "missing_type.h" 319 #include "strv.h"
320 #include "virt.h"
267+#include "missing_stdlib.h" 321+#include "missing_stdlib.h"
268 322
269 #if HAVE_KMOD 323 #if HAVE_KMOD
270 #include "module-util.h" 324 #include "module-util.h"
325diff --git a/src/core/service.c b/src/core/service.c
326index b9eb40c555..268fe7573b 100644
271--- a/src/core/service.c 327--- a/src/core/service.c
272+++ b/src/core/service.c 328+++ b/src/core/service.c
273@@ -41,6 +41,7 @@ 329@@ -45,6 +45,7 @@
330 #include "unit-name.h"
274 #include "unit.h" 331 #include "unit.h"
275 #include "utf8.h" 332 #include "utf8.h"
276 #include "util.h"
277+#include "missing_stdlib.h" 333+#include "missing_stdlib.h"
278 334
279 static const UnitActiveState state_translation_table[_SERVICE_STATE_MAX] = { 335 #define service_spawn(...) service_spawn_internal(__func__, __VA_ARGS__)
280 [SERVICE_DEAD] = UNIT_INACTIVE, 336
337diff --git a/src/coredump/coredump-vacuum.c b/src/coredump/coredump-vacuum.c
338index 7e0c98cb7d..978a7f5874 100644
281--- a/src/coredump/coredump-vacuum.c 339--- a/src/coredump/coredump-vacuum.c
282+++ b/src/coredump/coredump-vacuum.c 340+++ b/src/coredump/coredump-vacuum.c
283@@ -16,6 +16,7 @@ 341@@ -17,6 +17,7 @@
284 #include "string-util.h" 342 #include "string-util.h"
285 #include "time-util.h" 343 #include "time-util.h"
286 #include "user-util.h" 344 #include "user-util.h"
@@ -288,9 +346,23 @@ Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
288 346
289 #define DEFAULT_MAX_USE_LOWER (uint64_t) (1ULL*1024ULL*1024ULL) /* 1 MiB */ 347 #define DEFAULT_MAX_USE_LOWER (uint64_t) (1ULL*1024ULL*1024ULL) /* 1 MiB */
290 #define DEFAULT_MAX_USE_UPPER (uint64_t) (4ULL*1024ULL*1024ULL*1024ULL) /* 4 GiB */ 348 #define DEFAULT_MAX_USE_UPPER (uint64_t) (4ULL*1024ULL*1024ULL*1024ULL) /* 4 GiB */
349diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
350index 016f3baa7f..b1def81313 100644
351--- a/src/fstab-generator/fstab-generator.c
352+++ b/src/fstab-generator/fstab-generator.c
353@@ -37,6 +37,7 @@
354 #include "unit-name.h"
355 #include "virt.h"
356 #include "volatile-util.h"
357+#include "missing_stdlib.h"
358
359 typedef enum MountPointFlags {
360 MOUNT_NOAUTO = 1 << 0,
361diff --git a/src/journal-remote/journal-remote-main.c b/src/journal-remote/journal-remote-main.c
362index da0f20d3ce..f22ce41908 100644
291--- a/src/journal-remote/journal-remote-main.c 363--- a/src/journal-remote/journal-remote-main.c
292+++ b/src/journal-remote/journal-remote-main.c 364+++ b/src/journal-remote/journal-remote-main.c
293@@ -22,6 +22,7 @@ 365@@ -27,6 +27,7 @@
294 #include "stat-util.h" 366 #include "stat-util.h"
295 #include "string-table.h" 367 #include "string-table.h"
296 #include "strv.h" 368 #include "strv.h"
@@ -298,9 +370,11 @@ Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
298 370
299 #define PRIV_KEY_FILE CERTIFICATE_ROOT "/private/journal-remote.pem" 371 #define PRIV_KEY_FILE CERTIFICATE_ROOT "/private/journal-remote.pem"
300 #define CERT_FILE CERTIFICATE_ROOT "/certs/journal-remote.pem" 372 #define CERT_FILE CERTIFICATE_ROOT "/certs/journal-remote.pem"
373diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
374index 7f3dcd56a4..41b7cbaaf1 100644
301--- a/src/journal/journalctl.c 375--- a/src/journal/journalctl.c
302+++ b/src/journal/journalctl.c 376+++ b/src/journal/journalctl.c
303@@ -73,6 +73,7 @@ 377@@ -77,6 +77,7 @@
304 #include "unit-name.h" 378 #include "unit-name.h"
305 #include "user-util.h" 379 #include "user-util.h"
306 #include "varlink.h" 380 #include "varlink.h"
@@ -308,39 +382,35 @@ Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
308 382
309 #define DEFAULT_FSS_INTERVAL_USEC (15*USEC_PER_MINUTE) 383 #define DEFAULT_FSS_INTERVAL_USEC (15*USEC_PER_MINUTE)
310 #define PROCESS_INOTIFY_INTERVAL 1024 /* Every 1,024 messages processed */ 384 #define PROCESS_INOTIFY_INTERVAL 1024 /* Every 1,024 messages processed */
311--- a/src/journal/sd-journal.c 385diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c
312+++ b/src/journal/sd-journal.c 386index ff0228081f..9066fcb133 100644
313@@ -40,6 +40,7 @@
314 #include "string-util.h"
315 #include "strv.h"
316 #include "syslog-util.h"
317+#include "missing_stdlib.h"
318
319 #define JOURNAL_FILES_MAX 7168
320
321--- a/src/libsystemd/sd-bus/bus-message.c 387--- a/src/libsystemd/sd-bus/bus-message.c
322+++ b/src/libsystemd/sd-bus/bus-message.c 388+++ b/src/libsystemd/sd-bus/bus-message.c
323@@ -21,6 +21,7 @@ 389@@ -19,6 +19,7 @@
324 #include "strv.h" 390 #include "strv.h"
325 #include "time-util.h" 391 #include "time-util.h"
326 #include "utf8.h" 392 #include "utf8.h"
327+#include "missing_stdlib.h" 393+#include "missing_stdlib.h"
328 394
329 static int message_append_basic(sd_bus_message *m, char type, const void *p, const void **stored); 395 static int message_append_basic(sd_bus_message *m, char type, const void *p, const void **stored);
330 396 static int message_parse_fields(sd_bus_message *m);
397diff --git a/src/libsystemd/sd-bus/bus-objects.c b/src/libsystemd/sd-bus/bus-objects.c
398index c25c40ff37..57a5da704f 100644
331--- a/src/libsystemd/sd-bus/bus-objects.c 399--- a/src/libsystemd/sd-bus/bus-objects.c
332+++ b/src/libsystemd/sd-bus/bus-objects.c 400+++ b/src/libsystemd/sd-bus/bus-objects.c
333@@ -13,6 +13,7 @@ 401@@ -11,6 +11,7 @@
334 #include "set.h" 402 #include "missing_capability.h"
335 #include "string-util.h" 403 #include "string-util.h"
336 #include "strv.h" 404 #include "strv.h"
337+#include "missing_stdlib.h" 405+#include "missing_stdlib.h"
338 406
339 static int node_vtable_get_userdata( 407 static int node_vtable_get_userdata(
340 sd_bus *bus, 408 sd_bus *bus,
409diff --git a/src/libsystemd/sd-bus/bus-socket.c b/src/libsystemd/sd-bus/bus-socket.c
410index 3c59d0d615..746922d46f 100644
341--- a/src/libsystemd/sd-bus/bus-socket.c 411--- a/src/libsystemd/sd-bus/bus-socket.c
342+++ b/src/libsystemd/sd-bus/bus-socket.c 412+++ b/src/libsystemd/sd-bus/bus-socket.c
343@@ -28,6 +28,7 @@ 413@@ -29,6 +29,7 @@
344 #include "string-util.h" 414 #include "string-util.h"
345 #include "user-util.h" 415 #include "user-util.h"
346 #include "utf8.h" 416 #include "utf8.h"
@@ -348,49 +418,59 @@ Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
348 418
349 #define SNDBUF_SIZE (8*1024*1024) 419 #define SNDBUF_SIZE (8*1024*1024)
350 420
421diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
422index 4a0259f8bb..aaa90d2223 100644
351--- a/src/libsystemd/sd-bus/sd-bus.c 423--- a/src/libsystemd/sd-bus/sd-bus.c
352+++ b/src/libsystemd/sd-bus/sd-bus.c 424+++ b/src/libsystemd/sd-bus/sd-bus.c
353@@ -41,6 +41,7 @@ 425@@ -46,6 +46,7 @@
354 #include "process-util.h"
355 #include "string-util.h" 426 #include "string-util.h"
356 #include "strv.h" 427 #include "strv.h"
428 #include "user-util.h"
357+#include "missing_stdlib.h" 429+#include "missing_stdlib.h"
358 430
359 #define log_debug_bus_message(m) \ 431 #define log_debug_bus_message(m) \
360 do { \ 432 do { \
433diff --git a/src/libsystemd/sd-bus/test-bus-benchmark.c b/src/libsystemd/sd-bus/test-bus-benchmark.c
434index d988588de0..458df8df9a 100644
361--- a/src/libsystemd/sd-bus/test-bus-benchmark.c 435--- a/src/libsystemd/sd-bus/test-bus-benchmark.c
362+++ b/src/libsystemd/sd-bus/test-bus-benchmark.c 436+++ b/src/libsystemd/sd-bus/test-bus-benchmark.c
363@@ -14,6 +14,7 @@ 437@@ -14,6 +14,7 @@
364 #include "missing_resource.h" 438 #include "string-util.h"
439 #include "tests.h"
365 #include "time-util.h" 440 #include "time-util.h"
366 #include "util.h"
367+#include "missing_stdlib.h" 441+#include "missing_stdlib.h"
368 442
369 #define MAX_SIZE (2*1024*1024) 443 #define MAX_SIZE (2*1024*1024)
370 444
371--- a/src/locale/keymap-util.c 445diff --git a/src/libsystemd/sd-journal/sd-journal.c b/src/libsystemd/sd-journal/sd-journal.c
372+++ b/src/locale/keymap-util.c 446index 6b9ff0a4ed..4a5027ad0f 100644
373@@ -21,6 +21,7 @@ 447--- a/src/libsystemd/sd-journal/sd-journal.c
374 #include "string-util.h" 448+++ b/src/libsystemd/sd-journal/sd-journal.c
449@@ -44,6 +44,7 @@
375 #include "strv.h" 450 #include "strv.h"
376 #include "tmpfile-util.h" 451 #include "syslog-util.h"
452 #include "uid-alloc-range.h"
377+#include "missing_stdlib.h" 453+#include "missing_stdlib.h"
378 454
379 static bool startswith_comma(const char *s, const char *prefix) { 455 #define JOURNAL_FILES_RECHECK_USEC (2 * USEC_PER_SEC)
380 s = startswith(s, prefix); 456
457diff --git a/src/login/pam_systemd.c b/src/login/pam_systemd.c
458index b8da266e27..4bb8dd9496 100644
381--- a/src/login/pam_systemd.c 459--- a/src/login/pam_systemd.c
382+++ b/src/login/pam_systemd.c 460+++ b/src/login/pam_systemd.c
383@@ -31,6 +31,7 @@ 461@@ -35,6 +35,7 @@
384 #include "locale-util.h"
385 #include "login-util.h" 462 #include "login-util.h"
386 #include "macro.h" 463 #include "macro.h"
464 #include "missing_syscall.h"
387+#include "missing_stdlib.h" 465+#include "missing_stdlib.h"
388 #include "pam-util.h" 466 #include "pam-util.h"
389 #include "parse-util.h" 467 #include "parse-util.h"
390 #include "path-util.h" 468 #include "path-util.h"
469diff --git a/src/network/generator/network-generator.c b/src/network/generator/network-generator.c
470index 48527a2c73..9777fe0561 100644
391--- a/src/network/generator/network-generator.c 471--- a/src/network/generator/network-generator.c
392+++ b/src/network/generator/network-generator.c 472+++ b/src/network/generator/network-generator.c
393@@ -13,6 +13,7 @@ 473@@ -14,6 +14,7 @@
394 #include "string-table.h" 474 #include "string-table.h"
395 #include "string-util.h" 475 #include "string-util.h"
396 #include "strv.h" 476 #include "strv.h"
@@ -398,46 +478,56 @@ Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
398 478
399 /* 479 /*
400 # .network 480 # .network
481diff --git a/src/nspawn/nspawn-settings.c b/src/nspawn/nspawn-settings.c
482index 161b1c1c70..ba1c459f78 100644
401--- a/src/nspawn/nspawn-settings.c 483--- a/src/nspawn/nspawn-settings.c
402+++ b/src/nspawn/nspawn-settings.c 484+++ b/src/nspawn/nspawn-settings.c
403@@ -16,6 +16,7 @@ 485@@ -16,6 +16,7 @@
486 #include "string-util.h"
404 #include "strv.h" 487 #include "strv.h"
405 #include "user-util.h" 488 #include "user-util.h"
406 #include "util.h"
407+#include "missing_stdlib.h" 489+#include "missing_stdlib.h"
408 490
409 Settings *settings_new(void) { 491 Settings *settings_new(void) {
410 Settings *s; 492 Settings *s;
493diff --git a/src/nss-mymachines/nss-mymachines.c b/src/nss-mymachines/nss-mymachines.c
494index c64e79bdff..eda26b0b9a 100644
411--- a/src/nss-mymachines/nss-mymachines.c 495--- a/src/nss-mymachines/nss-mymachines.c
412+++ b/src/nss-mymachines/nss-mymachines.c 496+++ b/src/nss-mymachines/nss-mymachines.c
413@@ -19,6 +19,7 @@ 497@@ -21,6 +21,7 @@
414 #include "nss-util.h" 498 #include "nss-util.h"
415 #include "signal-util.h" 499 #include "signal-util.h"
416 #include "string-util.h" 500 #include "string-util.h"
417+#include "missing_stdlib.h" 501+#include "missing_stdlib.h"
418 502
419 NSS_GETHOSTBYNAME_PROTOTYPES(mymachines); 503 static void setup_logging_once(void) {
420 NSS_GETPW_PROTOTYPES(mymachines); 504 static pthread_once_t once = PTHREAD_ONCE_INIT;
505diff --git a/src/portable/portable.c b/src/portable/portable.c
506index d4b448a627..bb26623565 100644
421--- a/src/portable/portable.c 507--- a/src/portable/portable.c
422+++ b/src/portable/portable.c 508+++ b/src/portable/portable.c
423@@ -31,6 +31,7 @@ 509@@ -40,6 +40,7 @@
424 #include "strv.h" 510 #include "strv.h"
425 #include "tmpfile-util.h" 511 #include "tmpfile-util.h"
426 #include "user-util.h" 512 #include "user-util.h"
427+#include "missing_stdlib.h" 513+#include "missing_stdlib.h"
428 514
429 static const char profile_dirs[] = CONF_PATHS_NULSTR("systemd/portable/profile"); 515 /* Markers used in the first line of our 20-portable.conf unit file drop-in to determine, that a) the unit file was
430 516 * dropped there by the portable service logic and b) for which image it was dropped there. */
517diff --git a/src/resolve/resolvectl.c b/src/resolve/resolvectl.c
518index afa537f160..32ccee4ae5 100644
431--- a/src/resolve/resolvectl.c 519--- a/src/resolve/resolvectl.c
432+++ b/src/resolve/resolvectl.c 520+++ b/src/resolve/resolvectl.c
433@@ -37,6 +37,7 @@ 521@@ -48,6 +48,7 @@
434 #include "terminal-util.h" 522 #include "varlink.h"
435 #include "utf8.h" 523 #include "verb-log-control.h"
436 #include "verbs.h" 524 #include "verbs.h"
437+#include "missing_stdlib.h" 525+#include "missing_stdlib.h"
438 526
439 static int arg_family = AF_UNSPEC; 527 static int arg_family = AF_UNSPEC;
440 static int arg_ifindex = 0; 528 static int arg_ifindex = 0;
529diff --git a/src/shared/bus-get-properties.c b/src/shared/bus-get-properties.c
530index 53e5d6b99f..851ecd5644 100644
441--- a/src/shared/bus-get-properties.c 531--- a/src/shared/bus-get-properties.c
442+++ b/src/shared/bus-get-properties.c 532+++ b/src/shared/bus-get-properties.c
443@@ -4,6 +4,7 @@ 533@@ -4,6 +4,7 @@
@@ -448,9 +538,11 @@ Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
448 538
449 int bus_property_get_bool( 539 int bus_property_get_bool(
450 sd_bus *bus, 540 sd_bus *bus,
541diff --git a/src/shared/bus-unit-procs.c b/src/shared/bus-unit-procs.c
542index 8b462b5627..183ce1c18e 100644
451--- a/src/shared/bus-unit-procs.c 543--- a/src/shared/bus-unit-procs.c
452+++ b/src/shared/bus-unit-procs.c 544+++ b/src/shared/bus-unit-procs.c
453@@ -10,6 +10,7 @@ 545@@ -11,6 +11,7 @@
454 #include "sort-util.h" 546 #include "sort-util.h"
455 #include "string-util.h" 547 #include "string-util.h"
456 #include "terminal-util.h" 548 #include "terminal-util.h"
@@ -458,9 +550,11 @@ Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
458 550
459 struct CGroupInfo { 551 struct CGroupInfo {
460 char *cgroup_path; 552 char *cgroup_path;
553diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c
554index 4ee9706847..30c8084847 100644
461--- a/src/shared/bus-unit-util.c 555--- a/src/shared/bus-unit-util.c
462+++ b/src/shared/bus-unit-util.c 556+++ b/src/shared/bus-unit-util.c
463@@ -44,6 +44,7 @@ 557@@ -50,6 +50,7 @@
464 #include "unit-def.h" 558 #include "unit-def.h"
465 #include "user-util.h" 559 #include "user-util.h"
466 #include "utf8.h" 560 #include "utf8.h"
@@ -468,19 +562,23 @@ Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
468 562
469 int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u) { 563 int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u) {
470 assert(message); 564 assert(message);
565diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
566index 4123152d93..74f148c8b4 100644
471--- a/src/shared/bus-util.c 567--- a/src/shared/bus-util.c
472+++ b/src/shared/bus-util.c 568+++ b/src/shared/bus-util.c
473@@ -21,6 +21,7 @@ 569@@ -24,6 +24,7 @@
474 #include "path-util.h" 570 #include "path-util.h"
475 #include "socket-util.h" 571 #include "socket-util.h"
476 #include "stdio-util.h" 572 #include "stdio-util.h"
477+#include "missing_stdlib.h" 573+#include "missing_stdlib.h"
478 574
479 static int name_owner_change_callback(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) { 575 static int name_owner_change_callback(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) {
480 sd_event *e = userdata; 576 sd_event *e = ASSERT_PTR(userdata);
577diff --git a/src/shared/dns-domain.c b/src/shared/dns-domain.c
578index b41c9b06ca..e69050a507 100644
481--- a/src/shared/dns-domain.c 579--- a/src/shared/dns-domain.c
482+++ b/src/shared/dns-domain.c 580+++ b/src/shared/dns-domain.c
483@@ -17,6 +17,7 @@ 581@@ -18,6 +18,7 @@
484 #include "string-util.h" 582 #include "string-util.h"
485 #include "strv.h" 583 #include "strv.h"
486 #include "utf8.h" 584 #include "utf8.h"
@@ -488,103 +586,114 @@ Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
488 586
489 int dns_label_unescape(const char **name, char *dest, size_t sz, DNSLabelFlags flags) { 587 int dns_label_unescape(const char **name, char *dest, size_t sz, DNSLabelFlags flags) {
490 const char *n; 588 const char *n;
589diff --git a/src/shared/journal-importer.c b/src/shared/journal-importer.c
590index 83e9834bbf..74eaae6f5e 100644
491--- a/src/shared/journal-importer.c 591--- a/src/shared/journal-importer.c
492+++ b/src/shared/journal-importer.c 592+++ b/src/shared/journal-importer.c
493@@ -14,6 +14,7 @@ 593@@ -16,6 +16,7 @@
494 #include "parse-util.h"
495 #include "string-util.h" 594 #include "string-util.h"
595 #include "strv.h"
496 #include "unaligned.h" 596 #include "unaligned.h"
497+#include "missing_stdlib.h" 597+#include "missing_stdlib.h"
498 598
499 enum { 599 enum {
500 IMPORTER_STATE_LINE = 0, /* waiting to read, or reading line */ 600 IMPORTER_STATE_LINE = 0, /* waiting to read, or reading line */
601diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c
602index a5d04003bd..10392c132d 100644
501--- a/src/shared/logs-show.c 603--- a/src/shared/logs-show.c
502+++ b/src/shared/logs-show.c 604+++ b/src/shared/logs-show.c
503@@ -41,6 +41,7 @@ 605@@ -41,6 +41,7 @@
606 #include "time-util.h"
504 #include "utf8.h" 607 #include "utf8.h"
505 #include "util.h"
506 #include "web-util.h" 608 #include "web-util.h"
507+#include "missing_stdlib.h" 609+#include "missing_stdlib.h"
508 610
509 /* up to three lines (each up to 100 characters) or 300 characters, whichever is less */ 611 /* up to three lines (each up to 100 characters) or 300 characters, whichever is less */
510 #define PRINT_LINE_THRESHOLD 3 612 #define PRINT_LINE_THRESHOLD 3
613diff --git a/src/shared/pager.c b/src/shared/pager.c
614index 19deefab56..6b6d0af1a0 100644
511--- a/src/shared/pager.c 615--- a/src/shared/pager.c
512+++ b/src/shared/pager.c 616+++ b/src/shared/pager.c
513@@ -26,6 +26,7 @@ 617@@ -25,6 +25,7 @@
618 #include "string-util.h"
514 #include "strv.h" 619 #include "strv.h"
515 #include "terminal-util.h" 620 #include "terminal-util.h"
516 #include "util.h"
517+#include "missing_stdlib.h" 621+#include "missing_stdlib.h"
518 622
519 static pid_t pager_pid = 0; 623 static pid_t pager_pid = 0;
520 624
521--- a/src/shared/uid-range.c 625diff --git a/src/socket-proxy/socket-proxyd.c b/src/socket-proxy/socket-proxyd.c
522+++ b/src/shared/uid-range.c 626index 287fd6c181..8f8d5493da 100644
523@@ -9,6 +9,7 @@
524 #include "sort-util.h"
525 #include "uid-range.h"
526 #include "user-util.h"
527+#include "missing_stdlib.h"
528
529 static bool uid_range_intersect(UidRange *range, uid_t start, uid_t nr) {
530 assert(range);
531--- a/src/socket-proxy/socket-proxyd.c 627--- a/src/socket-proxy/socket-proxyd.c
532+++ b/src/socket-proxy/socket-proxyd.c 628+++ b/src/socket-proxy/socket-proxyd.c
533@@ -26,6 +26,7 @@ 629@@ -27,6 +27,7 @@
630 #include "set.h"
534 #include "socket-util.h" 631 #include "socket-util.h"
535 #include "string-util.h" 632 #include "string-util.h"
536 #include "util.h"
537+#include "missing_stdlib.h" 633+#include "missing_stdlib.h"
538 634
539 #define BUFFER_SIZE (256 * 1024) 635 #define BUFFER_SIZE (256 * 1024)
540 636
637diff --git a/src/test/test-hexdecoct.c b/src/test/test-hexdecoct.c
638index f884008660..987e180697 100644
541--- a/src/test/test-hexdecoct.c 639--- a/src/test/test-hexdecoct.c
542+++ b/src/test/test-hexdecoct.c 640+++ b/src/test/test-hexdecoct.c
543@@ -6,6 +6,7 @@ 641@@ -7,6 +7,7 @@
544 #include "hexdecoct.h"
545 #include "macro.h" 642 #include "macro.h"
643 #include "random-util.h"
546 #include "string-util.h" 644 #include "string-util.h"
547+#include "missing_stdlib.h" 645+#include "missing_stdlib.h"
646 #include "tests.h"
548 647
549 static void test_hexchar(void) { 648 TEST(hexchar) {
550 assert_se(hexchar(0xa) == 'a'); 649diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
650index 91b40088f4..f528a46b8e 100644
651--- a/src/udev/udev-builtin-net_id.c
652+++ b/src/udev/udev-builtin-net_id.c
653@@ -39,6 +39,7 @@
654 #include "strv.h"
655 #include "strxcpyx.h"
656 #include "udev-builtin.h"
657+#include "missing_stdlib.h"
658
659 #define ONBOARD_14BIT_INDEX_MAX ((1U << 14) - 1)
660 #define ONBOARD_16BIT_INDEX_MAX ((1U << 16) - 1)
661diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c
662index 467c9a6ad3..f74dae60af 100644
551--- a/src/udev/udev-builtin-path_id.c 663--- a/src/udev/udev-builtin-path_id.c
552+++ b/src/udev/udev-builtin-path_id.c 664+++ b/src/udev/udev-builtin-path_id.c
553@@ -22,6 +22,7 @@ 665@@ -24,6 +24,7 @@
554 #include "strv.h"
555 #include "sysexits.h" 666 #include "sysexits.h"
556 #include "udev-builtin.h" 667 #include "udev-builtin.h"
668 #include "udev-util.h"
557+#include "missing_stdlib.h" 669+#include "missing_stdlib.h"
558 670
559 _printf_(2,3) 671 _printf_(2,3)
560 static void path_prepend(char **path, const char *fmt, ...) { 672 static void path_prepend(char **path, const char *fmt, ...) {
673diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
674index ed22c8b679..19ebe20237 100644
561--- a/src/udev/udev-event.c 675--- a/src/udev/udev-event.c
562+++ b/src/udev/udev-event.c 676+++ b/src/udev/udev-event.c
563@@ -34,6 +34,7 @@ 677@@ -16,6 +16,7 @@
564 #include "udev-util.h" 678 #include "udev-util.h"
565 #include "udev-watch.h" 679 #include "udev-watch.h"
566 #include "user-util.h" 680 #include "user-util.h"
567+#include "missing_stdlib.h" 681+#include "missing_stdlib.h"
568 682
569 typedef struct Spawn { 683 UdevEvent *udev_event_new(sd_device *dev, usec_t exec_delay_usec, sd_netlink *rtnl, int log_level) {
570 sd_device *device; 684 UdevEvent *event;
685diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
686index 5f12002394..febe345b4c 100644
571--- a/src/udev/udev-rules.c 687--- a/src/udev/udev-rules.c
572+++ b/src/udev/udev-rules.c 688+++ b/src/udev/udev-rules.c
573@@ -30,6 +30,7 @@ 689@@ -41,6 +41,7 @@
574 #include "udev-rules.h" 690 #include "udev-util.h"
575 #include "user-util.h" 691 #include "user-util.h"
576 #include "virt.h" 692 #include "virt.h"
577+#include "missing_stdlib.h" 693+#include "missing_stdlib.h"
578 694
579 #define RULES_DIRS (const char* const*) CONF_PATHS_STRV("udev/rules.d") 695 #define RULES_DIRS ((const char* const*) CONF_PATHS_STRV("udev/rules.d"))
580 696
581--- a/src/basic/mountpoint-util.c 697--
582+++ b/src/basic/mountpoint-util.c 6982.34.1
583@@ -10,6 +10,7 @@ 699
584 #include "fs-util.h"
585 #include "missing_stat.h"
586 #include "missing_syscall.h"
587+#include "missing_stdlib.h"
588 #include "mountpoint-util.h"
589 #include "parse-util.h"
590 #include "path-util.h"
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 6865421586..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,7 @@
1From 87a14dde13c8fa68239a4ab62914a093062b3b29 Mon Sep 17 00:00:00 2001 1From 5325ab5813617f35f03806ec420829dde7104387 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com> 2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 14:56:21 +0800 3Date: Mon, 25 Feb 2019 14:56:21 +0800
4Subject: [PATCH 07/26] don't fail if GLOB_BRACE and GLOB_ALTDIRFUNC is not 4Subject: [PATCH 04/22] don't fail if GLOB_BRACE and GLOB_ALTDIRFUNC is not
5 defined 5 defined
6 6
7If the standard library doesn't provide brace 7If the standard library doesn't provide brace
@@ -24,7 +24,7 @@ Signed-off-by: Scott Murray <scott.murray@konsulko.com>
24 3 files changed, 38 insertions(+) 24 3 files changed, 38 insertions(+)
25 25
26diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c 26diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c
27index bc0278e57f..c973f82e54 100644 27index 802ca8c655..23818a67c6 100644
28--- a/src/basic/glob-util.c 28--- a/src/basic/glob-util.c
29+++ b/src/basic/glob-util.c 29+++ b/src/basic/glob-util.c
30@@ -12,6 +12,12 @@ 30@@ -12,6 +12,12 @@
@@ -64,12 +64,12 @@ index bc0278e57f..c973f82e54 100644
64 return -ENOENT; 64 return -ENOENT;
65 if (k == GLOB_NOSPACE) 65 if (k == GLOB_NOSPACE)
66diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c 66diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c
67index df6444c433..79a692046e 100644 67index 9b3e73cce0..3790ba3be5 100644
68--- a/src/test/test-glob-util.c 68--- a/src/test/test-glob-util.c
69+++ b/src/test/test-glob-util.c 69+++ b/src/test/test-glob-util.c
70@@ -12,6 +12,12 @@ 70@@ -34,6 +34,12 @@ TEST(glob_first) {
71 #include "rm-rf.h" 71 assert_se(first == NULL);
72 #include "tmpfile-util.h" 72 }
73 73
74+/* Don't fail if the standard library 74+/* Don't fail if the standard library
75+ * doesn't provide brace expansion */ 75+ * doesn't provide brace expansion */
@@ -77,10 +77,10 @@ index df6444c433..79a692046e 100644
77+#define GLOB_BRACE 0 77+#define GLOB_BRACE 0
78+#endif 78+#endif
79+ 79+
80 static void test_glob_exists(void) { 80 TEST(glob_exists) {
81 char name[] = "/tmp/test-glob_exists.XXXXXX"; 81 char name[] = "/tmp/test-glob_exists.XXXXXX";
82 int fd = -1; 82 int fd = -EBADF;
83@@ -39,11 +45,13 @@ static void test_glob_no_dot(void) { 83@@ -61,11 +67,13 @@ TEST(glob_no_dot) {
84 const char *fn; 84 const char *fn;
85 85
86 _cleanup_globfree_ glob_t g = { 86 _cleanup_globfree_ glob_t g = {
@@ -94,7 +94,7 @@ index df6444c433..79a692046e 100644
94 }; 94 };
95 95
96 int r; 96 int r;
97@@ -51,11 +59,19 @@ static void test_glob_no_dot(void) { 97@@ -73,11 +81,19 @@ TEST(glob_no_dot) {
98 assert_se(mkdtemp(template)); 98 assert_se(mkdtemp(template));
99 99
100 fn = strjoina(template, "/*"); 100 fn = strjoina(template, "/*");
@@ -115,12 +115,12 @@ index df6444c433..79a692046e 100644
115 115
116 (void) rm_rf(template, REMOVE_ROOT|REMOVE_PHYSICAL); 116 (void) rm_rf(template, REMOVE_ROOT|REMOVE_PHYSICAL);
117diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c 117diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
118index 9906c70eef..5eb63b1d57 100644 118index 230ec09b97..2cc5f391d7 100644
119--- a/src/tmpfiles/tmpfiles.c 119--- a/src/tmpfiles/tmpfiles.c
120+++ b/src/tmpfiles/tmpfiles.c 120+++ b/src/tmpfiles/tmpfiles.c
121@@ -63,6 +63,12 @@ 121@@ -73,6 +73,12 @@
122 #include "umask-util.h"
123 #include "user-util.h" 122 #include "user-util.h"
123 #include "virt.h"
124 124
125+/* Don't fail if the standard library 125+/* Don't fail if the standard library
126+ * doesn't provide brace expansion */ 126+ * doesn't provide brace expansion */
@@ -131,26 +131,26 @@ index 9906c70eef..5eb63b1d57 100644
131 /* This reads all files listed in /etc/tmpfiles.d/?*.conf and creates 131 /* This reads all files listed in /etc/tmpfiles.d/?*.conf and creates
132 * them in the file system. This is intended to be used to create 132 * them in the file system. This is intended to be used to create
133 * properly owned directories beneath /tmp, /var/tmp, /run, which are 133 * properly owned directories beneath /tmp, /var/tmp, /run, which are
134@@ -1936,7 +1942,9 @@ finish: 134@@ -2434,7 +2440,9 @@ finish:
135 135
136 static int glob_item(Item *i, action_t action) { 136 static int glob_item(Context *c, Item *i, action_t action) {
137 _cleanup_globfree_ glob_t g = { 137 _cleanup_globfree_ glob_t g = {
138+#ifdef GLOB_ALTDIRFUNC 138+#ifdef GLOB_ALTDIRFUNC
139 .gl_opendir = (void *(*)(const char *)) opendir_nomod, 139 .gl_opendir = (void *(*)(const char *)) opendir_nomod,
140+#endif 140+#endif
141 }; 141 };
142 int r = 0, k; 142 int r = 0, k;
143 char **fn;
144@@ -1956,7 +1964,9 @@ static int glob_item(Item *i, action_t action) {
145 143
146 static int glob_item_recursively(Item *i, fdaction_t action) { 144@@ -2461,7 +2469,9 @@ static int glob_item_recursively(
145 fdaction_t action) {
146
147 _cleanup_globfree_ glob_t g = { 147 _cleanup_globfree_ glob_t g = {
148+#ifdef GLOB_ALTDIRFUNC 148+#ifdef GLOB_ALTDIRFUNC
149 .gl_opendir = (void *(*)(const char *)) opendir_nomod, 149 .gl_opendir = (void *(*)(const char *)) opendir_nomod,
150+#endif 150+#endif
151 }; 151 };
152 int r = 0, k; 152 int r = 0, k;
153 char **fn; 153
154-- 154--
1552.27.0 1552.34.1
156 156
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 @@
1From dad7f897c0de654fa5592fda3e90f874639849f9 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 15:00:06 +0800
4Subject: [PATCH 05/22] add missing FTW_ macros for musl
5
6This is to avoid build failures like below for musl.
7
8 locale-util.c:296:24: error: 'FTW_STOP' undeclared
9
10Upstream-Status: Inappropriate [musl specific]
11
12Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
13---
14 src/basic/missing_type.h | 4 ++++
15 src/test/test-recurse-dir.c | 1 +
16 2 files changed, 5 insertions(+)
17
18diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
19index 6c0456349d..73a5b90e3c 100644
20--- a/src/basic/missing_type.h
21+++ b/src/basic/missing_type.h
22@@ -14,3 +14,7 @@
23 #ifndef __GLIBC__
24 typedef int (*comparison_fn_t)(const void *, const void *);
25 #endif
26+
27+#ifndef FTW_CONTINUE
28+#define FTW_CONTINUE 0
29+#endif
30diff --git a/src/test/test-recurse-dir.c b/src/test/test-recurse-dir.c
31index 8684d064ec..70fc2b5376 100644
32--- a/src/test/test-recurse-dir.c
33+++ b/src/test/test-recurse-dir.c
34@@ -8,6 +8,7 @@
35 #include "recurse-dir.h"
36 #include "strv.h"
37 #include "tests.h"
38+#include "missing_type.h"
39
40 static char **list_nftw = NULL;
41
42--
432.34.1
44
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 b689cf1297..0000000000
--- a/meta/recipes-core/systemd/systemd/0006-Include-netinet-if_ether.h.patch
+++ /dev/null
@@ -1,326 +0,0 @@
1From d3ed0da271738fd0fc3d3e4d82d6f5810334b05e Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 26 Oct 2017 22:10:42 -0700
4Subject: [PATCH 06/26] Include netinet/if_ether.h
5
6Fixes
7/path/to/systemd/recipe-sysroot/usr/include/netinet/if_ether.h:101:8: error: redefinition of 'struct ethhdr'
8 struct ethhdr {
9 ^~~~~~
10
11and related arphdr, arpreq, and arpreq_old errors
12/path/to/systemd/recipe-sysroot/usr/include/net/if_arp.h:22:8: error: redefinition of 'struct arphdr'
13 struct arphdr {
14 ^~~~~~
15
16The latter requires removing some includes of net/if_arp.h to avoid
17conflicting with netinet/if_ether.h.
18
19Upstream-Status: Inappropriate [musl specific]
20
21Signed-off-by: Khem Raj <raj.khem@gmail.com>
22Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
23[rebased for systemd 243]
24Signed-off-by: Scott Murray <scott.murray@konsulko.com>
25
26Upstream-Status: Inappropriate [musl specific]
27
28Signed-off-by: Khem Raj <raj.khem@gmail.com>
29Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
30[rebased for systemd 243]
31Signed-off-by: Scott Murray <scott.murray@konsulko.com>
32[rebased for systemd 247]
33Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
34---
35 src/libsystemd-network/sd-dhcp6-client.c | 1 -
36 src/libsystemd/sd-netlink/netlink-types.c | 1 +
37 src/machine/machine-dbus.c | 1 +
38 src/network/netdev/bond.c | 1 +
39 src/network/netdev/bridge.c | 1 +
40 src/network/netdev/macsec.c | 1 +
41 src/network/netdev/netdev-gperf.gperf | 1 +
42 src/network/netdev/netdev.c | 1 +
43 src/network/networkd-brvlan.c | 1 +
44 src/network/networkd-dhcp-common.c | 1 +
45 src/network/networkd-dhcp4.c | 2 +-
46 src/network/networkd-dhcp6.c | 2 +-
47 src/network/networkd-link.c | 2 +-
48 src/network/networkd-network.c | 1 +
49 src/network/test-network-tables.c | 1 +
50 src/shared/ethtool-util.c | 1 +
51 src/shared/ethtool-util.h | 1 +
52 src/udev/net/link-config.c | 1 +
53 src/udev/udev-builtin-net_setup_link.c | 1 +
54 19 files changed, 18 insertions(+), 4 deletions(-)
55
56diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
57index 30ac526fc9..126077e13c 100644
58--- a/src/libsystemd-network/sd-dhcp6-client.c
59+++ b/src/libsystemd-network/sd-dhcp6-client.c
60@@ -5,7 +5,6 @@
61
62 #include <errno.h>
63 #include <sys/ioctl.h>
64-#include <linux/if_arp.h>
65 #include <linux/if_infiniband.h>
66
67 #include "sd-dhcp6-client.h"
68diff --git a/src/libsystemd/sd-netlink/netlink-types.c b/src/libsystemd/sd-netlink/netlink-types.c
69index 6fb6c147d9..8eda02d202 100644
70--- a/src/libsystemd/sd-netlink/netlink-types.c
71+++ b/src/libsystemd/sd-netlink/netlink-types.c
72@@ -3,6 +3,7 @@
73 #include <netinet/in.h>
74 #include <stdint.h>
75 #include <sys/socket.h>
76+#include <netinet/if_ether.h>
77 #include <linux/can/vxcan.h>
78 #include <linux/netlink.h>
79 #include <linux/rtnetlink.h>
80diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c
81index bb67beb665..f5780f1aec 100644
82--- a/src/machine/machine-dbus.c
83+++ b/src/machine/machine-dbus.c
84@@ -3,6 +3,7 @@
85 #include <errno.h>
86 #include <sys/mount.h>
87 #include <sys/wait.h>
88+#include <netinet/if_ether.h>
89
90 /* When we include libgen.h because we need dirname() we immediately
91 * undefine basename() since libgen.h defines it as a macro to the POSIX
92diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
93index e27f36067b..8868f1da5d 100644
94--- a/src/network/netdev/bond.c
95+++ b/src/network/netdev/bond.c
96@@ -1,5 +1,6 @@
97 /* SPDX-License-Identifier: LGPL-2.1-or-later */
98
99+#include <netinet/if_ether.h>
100 #include "alloc-util.h"
101 #include "bond.h"
102 #include "bond-util.h"
103diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c
104index 1f59cd8b42..5fdbae7e99 100644
105--- a/src/network/netdev/bridge.c
106+++ b/src/network/netdev/bridge.c
107@@ -1,5 +1,6 @@
108 /* SPDX-License-Identifier: LGPL-2.1-or-later */
109
110+#include <netinet/if_ether.h>
111 #include <net/if.h>
112
113 #include "bridge.h"
114diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
115index 82e71c3920..fbae86e216 100644
116--- a/src/network/netdev/macsec.c
117+++ b/src/network/netdev/macsec.c
118@@ -1,5 +1,6 @@
119 /* SPDX-License-Identifier: LGPL-2.1-or-later */
120
121+#include <netinet/if_ether.h>
122 #include <netinet/in.h>
123 #include <linux/if_ether.h>
124 #include <linux/if_macsec.h>
125diff --git a/src/network/netdev/netdev-gperf.gperf b/src/network/netdev/netdev-gperf.gperf
126index 4e89761f2c..91251fa6ec 100644
127--- a/src/network/netdev/netdev-gperf.gperf
128+++ b/src/network/netdev/netdev-gperf.gperf
129@@ -2,6 +2,7 @@
130 #if __GNUC__ >= 7
131 _Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
132 #endif
133+#include <netinet/if_ether.h>
134 #include <stddef.h>
135 #include "bareudp.h"
136 #include "bond.h"
137diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
138index 9f390b5781..62aeafb1e4 100644
139--- a/src/network/netdev/netdev.c
140+++ b/src/network/netdev/netdev.c
141@@ -1,5 +1,6 @@
142 /* SPDX-License-Identifier: LGPL-2.1-or-later */
143
144+#include <netinet/if_ether.h>
145 #include <net/if.h>
146 #include <netinet/in.h>
147 #include <unistd.h>
148diff --git a/src/network/networkd-brvlan.c b/src/network/networkd-brvlan.c
149index e53c73c30c..9bf0771b84 100644
150--- a/src/network/networkd-brvlan.c
151+++ b/src/network/networkd-brvlan.c
152@@ -4,6 +4,7 @@
153 ***/
154
155 #include <netinet/in.h>
156+#include <netinet/if_ether.h>
157 #include <linux/if_bridge.h>
158 #include <stdbool.h>
159
160diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
161index c338c775a7..ab35d65c53 100644
162--- a/src/network/networkd-dhcp-common.c
163+++ b/src/network/networkd-dhcp-common.c
164@@ -1,7 +1,8 @@
165 /* SPDX-License-Identifier: LGPL-2.1-or-later */
166
167 #include <netinet/in.h>
168-#include <linux/if_arp.h>
169+#include <net/if_arp.h>
170+#include <net/if.h>
171
172 #include "dhcp-internal.h"
173 #include "dhcp6-internal.h"
174@@ -10,6 +10,7 @@
175 #include "networkd-dhcp-common.h"
176 #include "networkd-link.h"
177 #include "networkd-manager.h"
178+#include <netinet/if_ether.h>
179 #include "networkd-network.h"
180 #include "parse-util.h"
181 #include "socket-util.h"
182diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
183index cf279c640d..bae541029b 100644
184--- a/src/network/networkd-dhcp-server.c
185+++ b/src/network/networkd-dhcp-server.c
186@@ -1,8 +1,8 @@
187 /* SPDX-License-Identifier: LGPL-2.1-or-later */
188
189 #include <netinet/in.h>
190-#include <linux/if_arp.h>
191-#include <linux/if.h>
192+#include <net/if_arp.h>
193+#include <net/if.h>
194
195 #include "sd-dhcp-server.h"
196
197diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
198index 02d33841b6..a30d8dd82c 100644
199--- a/src/network/networkd-dhcp4.c
200+++ b/src/network/networkd-dhcp4.c
201@@ -1,9 +1,9 @@
202 /* SPDX-License-Identifier: LGPL-2.1-or-later */
203
204+#include <netinet/if_ether.h>
205 #include <netinet/in.h>
206 #include <netinet/ip.h>
207 #include <linux/if.h>
208-#include <linux/if_arp.h>
209
210 #include "escape.h"
211 #include "alloc-util.h"
212diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c
213index d4d4182ee5..635d08f7d5 100644
214--- a/src/network/networkd-dhcp6.c
215+++ b/src/network/networkd-dhcp6.c
216@@ -3,9 +3,9 @@
217 Copyright © 2014 Intel Corporation. All rights reserved.
218 ***/
219
220+#include <netinet/if_ether.h>
221 #include <netinet/in.h>
222 #include <linux/if.h>
223-#include <linux/if_arp.h>
224
225 #include "sd-dhcp6-client.h"
226
227diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
228index ced18de425..07b43770de 100644
229--- a/src/network/networkd-link.c
230+++ b/src/network/networkd-link.c
231@@ -1,8 +1,8 @@
232 /* SPDX-License-Identifier: LGPL-2.1-or-later */
233
234+#include <netinet/if_ether.h>
235 #include <netinet/in.h>
236 #include <linux/if.h>
237-#include <linux/if_arp.h>
238 #include <linux/if_link.h>
239 #include <unistd.h>
240
241diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
242index 3254641461..f0ada419fd 100644
243--- a/src/network/networkd-network.c
244+++ b/src/network/networkd-network.c
245@@ -1,5 +1,6 @@
246 /* SPDX-License-Identifier: LGPL-2.1-or-later */
247
248+#include <netinet/if_ether.h>
249 #include <net/if.h>
250 #include <netinet/in.h>
251 #include <linux/netdevice.h>
252diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
253index 10f30c1a7e..579885726c 100644
254--- a/src/network/networkd-route.c
255+++ b/src/network/networkd-route.c
256@@ -1,7 +1,10 @@
257 /* SPDX-License-Identifier: LGPL-2.1-or-later */
258
259 #include <linux/icmpv6.h>
260-#include <linux/ipv6_route.h>
261+/* linux/ipv6_route.h conflicts with netinet/in.h so define manually */
262+#ifndef IP6_RT_PRIO_USER
263+#define IP6_RT_PRIO_USER 1024
264+#endif
265
266 #include "alloc-util.h"
267 #include "netlink-util.h"
268diff --git a/src/network/test-network-tables.c b/src/network/test-network-tables.c
269index 475cac7527..9bae6eda16 100644
270--- a/src/network/test-network-tables.c
271+++ b/src/network/test-network-tables.c
272@@ -1,5 +1,6 @@
273 /* SPDX-License-Identifier: LGPL-2.1-or-later */
274
275+#include <netinet/if_ether.h>
276 #include "bond.h"
277 #include "dhcp6-internal.h"
278 #include "dhcp6-protocol.h"
279diff --git a/src/shared/ethtool-util.c b/src/shared/ethtool-util.c
280index e6fab262f2..41dd3d7df7 100644
281--- a/src/shared/ethtool-util.c
282+++ b/src/shared/ethtool-util.c
283@@ -1,5 +1,6 @@
284 /* SPDX-License-Identifier: LGPL-2.1-or-later */
285
286+#include <netinet/if_ether.h>
287 #include <net/if.h>
288 #include <sys/ioctl.h>
289 #include <linux/ethtool.h>
290diff --git a/src/shared/ethtool-util.h b/src/shared/ethtool-util.h
291index f94b3e15bf..08a7e4fa09 100644
292--- a/src/shared/ethtool-util.h
293+++ b/src/shared/ethtool-util.h
294@@ -3,6 +3,7 @@
295
296 #include <macro.h>
297 #include <net/ethernet.h>
298+#include <netinet/if_ether.h>
299 #include <linux/ethtool.h>
300
301 #include "conf-parser.h"
302diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c
303index d12fd0e299..636806dc23 100644
304--- a/src/udev/net/link-config.c
305+++ b/src/udev/net/link-config.c
306@@ -1,5 +1,6 @@
307 /* SPDX-License-Identifier: LGPL-2.1-or-later */
308
309+#include <netinet/if_ether.h>
310 #include <linux/netdevice.h>
311 #include <netinet/ether.h>
312 #include <unistd.h>
313diff --git a/src/udev/udev-builtin-net_setup_link.c b/src/udev/udev-builtin-net_setup_link.c
314index cb12b943fe..5a28c8b563 100644
315--- a/src/udev/udev-builtin-net_setup_link.c
316+++ b/src/udev/udev-builtin-net_setup_link.c
317@@ -1,5 +1,6 @@
318 /* SPDX-License-Identifier: LGPL-2.1-or-later */
319
320+#include <netinet/if_ether.h>
321 #include "device-util.h"
322 #include "alloc-util.h"
323 #include "link-config.h"
324--
3252.27.0
326
diff --git a/meta/recipes-core/systemd/systemd/0010-Use-uintmax_t-for-handling-rlim_t.patch b/meta/recipes-core/systemd/systemd/0006-Use-uintmax_t-for-handling-rlim_t.patch
index aeacd865ae..4be14b72ec 100644
--- a/meta/recipes-core/systemd/systemd/0010-Use-uintmax_t-for-handling-rlim_t.patch
+++ b/meta/recipes-core/systemd/systemd/0006-Use-uintmax_t-for-handling-rlim_t.patch
@@ -1,7 +1,7 @@
1From e45bb02174812e4935214f42a18725be320770d5 Mon Sep 17 00:00:00 2001 1From 96e975a2412a20e5f80bd3ab144057d275eb8597 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com> 2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 15:12:41 +0800 3Date: Mon, 25 Feb 2019 15:12:41 +0800
4Subject: [PATCH 10/26] Use uintmax_t for handling rlim_t 4Subject: [PATCH 06/22] Use uintmax_t for handling rlim_t
5 5
6PRIu{32,64} is not right format to represent rlim_t type 6PRIu{32,64} is not right format to represent rlim_t type
7therefore use %ju and typecast the rlim_t variables to 7therefore use %ju and typecast the rlim_t variables to
@@ -22,16 +22,16 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
22Signed-off-by: Chen Qi <Qi.Chen@windriver.com> 22Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
23--- 23---
24 src/basic/format-util.h | 8 +------- 24 src/basic/format-util.h | 8 +-------
25 src/basic/rlimit-util.c | 10 +++++----- 25 src/basic/rlimit-util.c | 12 ++++++------
26 src/core/execute.c | 4 ++-- 26 src/core/execute.c | 4 ++--
27 3 files changed, 8 insertions(+), 14 deletions(-) 27 3 files changed, 9 insertions(+), 15 deletions(-)
28 28
29diff --git a/src/basic/format-util.h b/src/basic/format-util.h 29diff --git a/src/basic/format-util.h b/src/basic/format-util.h
30index b7e18768e3..3195ab205d 100644 30index 8719df3e29..9becc96066 100644
31--- a/src/basic/format-util.h 31--- a/src/basic/format-util.h
32+++ b/src/basic/format-util.h 32+++ b/src/basic/format-util.h
33@@ -32,13 +32,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t)); 33@@ -34,13 +34,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32_t));
34 # define PRI_TIMEX "li" 34 # error Unknown timex member size
35 #endif 35 #endif
36 36
37-#if SIZEOF_RLIM_T == 8 37-#if SIZEOF_RLIM_T == 8
@@ -46,30 +46,39 @@ index b7e18768e3..3195ab205d 100644
46 #if SIZEOF_DEV_T == 8 46 #if SIZEOF_DEV_T == 8
47 # define DEV_FMT "%" PRIu64 47 # define DEV_FMT "%" PRIu64
48diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c 48diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c
49index 880976312c..9e1b61cd4a 100644 49index c1f0b2b974..61c5412582 100644
50--- a/src/basic/rlimit-util.c 50--- a/src/basic/rlimit-util.c
51+++ b/src/basic/rlimit-util.c 51+++ b/src/basic/rlimit-util.c
52@@ -306,13 +306,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) { 52@@ -44,7 +44,7 @@ int setrlimit_closest(int resource, const struct rlimit *rlim) {
53 fixed.rlim_max == highest.rlim_max)
54 return 0;
55
56- 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);
57+ 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);
58
59 return RET_NERRNO(setrlimit(resource, &fixed));
60 }
61@@ -307,13 +307,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) {
53 if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY) 62 if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
54 s = strdup("infinity"); 63 r = free_and_strdup(&s, "infinity");
55 else if (rl->rlim_cur >= RLIM_INFINITY) 64 else if (rl->rlim_cur >= RLIM_INFINITY)
56- (void) asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max); 65- r = asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max);
57+ (void) asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max); 66+ r = asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max);
58 else if (rl->rlim_max >= RLIM_INFINITY) 67 else if (rl->rlim_max >= RLIM_INFINITY)
59- (void) asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur); 68- r = asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur);
60+ (void) asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur); 69+ r = asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur);
61 else if (rl->rlim_cur == rl->rlim_max) 70 else if (rl->rlim_cur == rl->rlim_max)
62- (void) asprintf(&s, RLIM_FMT, rl->rlim_cur); 71- r = asprintf(&s, RLIM_FMT, rl->rlim_cur);
63+ (void) asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur); 72+ r = asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur);
64 else 73 else
65- (void) asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max); 74- r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max);
66+ (void) asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max); 75+ r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max);
67 76 if (r < 0)
68 if (!s)
69 return -ENOMEM; 77 return -ENOMEM;
70@@ -403,7 +403,7 @@ int rlimit_nofile_safe(void) {
71 78
72 rl.rlim_cur = FD_SETSIZE; 79@@ -422,7 +422,7 @@ int rlimit_nofile_safe(void) {
80 rl.rlim_max = MIN(rl.rlim_max, (rlim_t) read_nr_open());
81 rl.rlim_cur = MIN((rlim_t) FD_SETSIZE, rl.rlim_max);
73 if (setrlimit(RLIMIT_NOFILE, &rl) < 0) 82 if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
74- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur); 83- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur);
75+ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur); 84+ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur);
@@ -77,10 +86,10 @@ index 880976312c..9e1b61cd4a 100644
77 return 1; 86 return 1;
78 } 87 }
79diff --git a/src/core/execute.c b/src/core/execute.c 88diff --git a/src/core/execute.c b/src/core/execute.c
80index 89632e0582..335283776c 100644 89index bd3da0c401..df1870fd2f 100644
81--- a/src/core/execute.c 90--- a/src/core/execute.c
82+++ b/src/core/execute.c 91+++ b/src/core/execute.c
83@@ -5288,9 +5288,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) { 92@@ -1045,9 +1045,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
84 for (unsigned i = 0; i < RLIM_NLIMITS; i++) 93 for (unsigned i = 0; i < RLIM_NLIMITS; i++)
85 if (c->rlimit[i]) { 94 if (c->rlimit[i]) {
86 fprintf(f, "%sLimit%s: " RLIM_FMT "\n", 95 fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
@@ -93,5 +102,5 @@ index 89632e0582..335283776c 100644
93 102
94 if (c->ioprio_set) { 103 if (c->ioprio_set) {
95-- 104--
962.27.0 1052.34.1
97 106
diff --git a/meta/recipes-core/systemd/systemd/0012-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 c15b6e7d82..8d6084239e 100644
--- a/meta/recipes-core/systemd/systemd/0012-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 @@
1From 03e89da266edf70121a19ffc32a78cc3b97585ef Mon Sep 17 00:00:00 2001 1From 4842cff4f1329f0b5034b529d56f8ad1f234ac4c Mon Sep 17 00:00:00 2001
2From: Andre McCurdy <armccurdy@gmail.com> 2From: Andre McCurdy <armccurdy@gmail.com>
3Date: Tue, 10 Oct 2017 14:33:30 -0700 3Date: Tue, 10 Oct 2017 14:33:30 -0700
4Subject: [PATCH 12/26] don't pass AT_SYMLINK_NOFOLLOW flag to faccessat() 4Subject: [PATCH 07/22] don't pass AT_SYMLINK_NOFOLLOW flag to faccessat()
5 5
6Avoid using AT_SYMLINK_NOFOLLOW flag. It doesn't seem like the right 6Avoid using AT_SYMLINK_NOFOLLOW flag. It doesn't seem like the right
7thing to do and it's not portable (not supported by musl). See: 7thing to do and it's not portable (not supported by musl). See:
@@ -26,19 +26,18 @@ Upstream-Status: Inappropriate [musl specific]
26 26
27Signed-off-by: Andre McCurdy <armccurdy@gmail.com> 27Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
28--- 28---
29 src/basic/fs-util.h | 22 +++++++++++++++++++++- 29 src/basic/fs-util.h | 21 ++++++++++++++++++++-
30 src/shared/base-filesystem.c | 6 +++--- 30 src/shared/base-filesystem.c | 6 +++---
31 2 files changed, 24 insertions(+), 4 deletions(-) 31 2 files changed, 23 insertions(+), 4 deletions(-)
32 32
33diff --git a/src/basic/fs-util.h b/src/basic/fs-util.h 33diff --git a/src/basic/fs-util.h b/src/basic/fs-util.h
34index 5dc8853eac..0491b3dae2 100644 34index 1023ab73ca..c78ff6f27f 100644
35--- a/src/basic/fs-util.h 35--- a/src/basic/fs-util.h
36+++ b/src/basic/fs-util.h 36+++ b/src/basic/fs-util.h
37@@ -43,7 +43,27 @@ int futimens_opath(int fd, const struct timespec ts[2]); 37@@ -49,8 +49,27 @@ int futimens_opath(int fd, const struct timespec ts[2]);
38 int fd_warn_permissions(const char *path, int fd); 38 int fd_warn_permissions(const char *path, int fd);
39 int stat_warn_permissions(const char *path, const struct stat *st); 39 int stat_warn_permissions(const char *path, const struct stat *st);
40 40
41-#define laccess(path, mode) faccessat(AT_FDCWD, (path), (mode), AT_SYMLINK_NOFOLLOW)
42+/* 41+/*
43+ Avoid using AT_SYMLINK_NOFOLLOW flag. It doesn't seem like the right thing to 42+ Avoid using AT_SYMLINK_NOFOLLOW flag. It doesn't seem like the right thing to
44+ do and it's not portable (not supported by musl). See: 43+ do and it's not portable (not supported by musl). See:
@@ -58,25 +57,26 @@ index 5dc8853eac..0491b3dae2 100644
58+ or why it needs to return success for broken symlinks. Maybe just historical 57+ or why it needs to return success for broken symlinks. Maybe just historical
59+ and not actually necessary or desired behaviour? 58+ and not actually necessary or desired behaviour?
60+*/ 59+*/
61+ 60 #define laccess(path, mode) \
62+#define laccess(path, mode) faccessat(AT_FDCWD, (path), (mode), 0) 61- RET_NERRNO(faccessat(AT_FDCWD, (path), (mode), AT_SYMLINK_NOFOLLOW))
62+ RET_NERRNO(faccessat(AT_FDCWD, (path), (mode), 0))
63 63
64 int touch_file(const char *path, bool parents, usec_t stamp, uid_t uid, gid_t gid, mode_t mode); 64 int touch_file(const char *path, bool parents, usec_t stamp, uid_t uid, gid_t gid, mode_t mode);
65 int touch(const char *path); 65
66diff --git a/src/shared/base-filesystem.c b/src/shared/base-filesystem.c 66diff --git a/src/shared/base-filesystem.c b/src/shared/base-filesystem.c
67index 1d05409086..1ed06c31ab 100644 67index 569ef466c3..7ae921a113 100644
68--- a/src/shared/base-filesystem.c 68--- a/src/shared/base-filesystem.c
69+++ b/src/shared/base-filesystem.c 69+++ b/src/shared/base-filesystem.c
70@@ -54,7 +54,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) { 70@@ -145,7 +145,7 @@ int base_filesystem_create_fd(int fd, const char *root, uid_t uid, gid_t gid) {
71 return log_error_errno(errno, "Failed to open root file system: %m"); 71 /* The "root" parameter is decoration only – it's only used as part of log messages */
72 72
73 for (i = 0; i < ELEMENTSOF(table); i ++) { 73 for (size_t i = 0; i < ELEMENTSOF(table); i++) {
74- if (faccessat(fd, table[i].dir, F_OK, AT_SYMLINK_NOFOLLOW) >= 0) 74- if (faccessat(fd, table[i].dir, F_OK, AT_SYMLINK_NOFOLLOW) >= 0)
75+ if (faccessat(fd, table[i].dir, F_OK, 0) >= 0) 75+ if (faccessat(fd, table[i].dir, F_OK, 0) >= 0)
76 continue; 76 continue;
77 77
78 if (table[i].target) { 78 if (table[i].target) { /* Create as symlink? */
79@@ -62,7 +62,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) { 79@@ -153,7 +153,7 @@ int base_filesystem_create_fd(int fd, const char *root, uid_t uid, gid_t gid) {
80 80
81 /* check if one of the targets exists */ 81 /* check if one of the targets exists */
82 NULSTR_FOREACH(s, table[i].target) { 82 NULSTR_FOREACH(s, table[i].target) {
@@ -85,7 +85,7 @@ index 1d05409086..1ed06c31ab 100644
85 continue; 85 continue;
86 86
87 /* check if a specific file exists at the target path */ 87 /* check if a specific file exists at the target path */
88@@ -73,7 +73,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) { 88@@ -164,7 +164,7 @@ int base_filesystem_create_fd(int fd, const char *root, uid_t uid, gid_t gid) {
89 if (!p) 89 if (!p)
90 return log_oom(); 90 return log_oom();
91 91
@@ -95,5 +95,5 @@ index 1d05409086..1ed06c31ab 100644
95 } 95 }
96 96
97-- 97--
982.27.0 982.34.1
99 99
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 @@
1From bab07e779ff23d5593bb118efaaa31b60a6dce87 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 27 May 2018 08:36:44 -0700
4Subject: [PATCH 08/22] Define glibc compatible basename() for non-glibc
5 systems
6
7Fixes builds with musl, even though systemd is adamant about
8using non-posix basename implementation, we have a way out
9
10Upstream-Status: Inappropriate [musl specific]
11
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13---
14 src/basic/string-util.h | 4 ++++
15 1 file changed, 4 insertions(+)
16
17diff --git a/src/basic/string-util.h b/src/basic/string-util.h
18index b6d8be3083..0a29036c4c 100644
19--- a/src/basic/string-util.h
20+++ b/src/basic/string-util.h
21@@ -26,6 +26,10 @@
22 #define URI_UNRESERVED ALPHANUMERICAL "-._~" /* [RFC3986] */
23 #define URI_VALID URI_RESERVED URI_UNRESERVED /* [RFC3986] */
24
25+#if !defined(__GLIBC__)
26+#define basename(src) (strrchr(src,'/') ? strrchr(src,'/')+1 : src)
27+#endif
28+
29 static inline char* strstr_ptr(const char *haystack, const char *needle) {
30 if (!haystack || !needle)
31 return NULL;
32--
332.34.1
34
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 94cdc2efde..0000000000
--- a/meta/recipes-core/systemd/systemd/0008-add-missing-FTW_-macros-for-musl.patch
+++ /dev/null
@@ -1,47 +0,0 @@
1From 8caea3fe87d55fd16de7d1b8266239fa954cb498 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 15:00:06 +0800
4Subject: [PATCH 08/26] add missing FTW_ macros for musl
5
6This is to avoid build failures like below for musl.
7
8 locale-util.c:296:24: error: 'FTW_STOP' undeclared
9
10Upstream-Status: Inappropriate [musl specific]
11
12Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
13---
14 src/basic/missing_type.h | 20 ++++++++++++++++++++
15 1 file changed, 20 insertions(+)
16
17diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
18index aeaf6ad5ec..3df1084ef2 100644
19--- a/src/basic/missing_type.h
20+++ b/src/basic/missing_type.h
21@@ -19,3 +19,23 @@ typedef int (*comparison_fn_t)(const void *, const void *);
22 #define __COMPAR_FN_T
23 typedef int (*__compar_fn_t)(const void *, const void *);
24 #endif
25+
26+#ifndef FTW_ACTIONRETVAL
27+#define FTW_ACTIONRETVAL 16
28+#endif
29+
30+#ifndef FTW_CONTINUE
31+#define FTW_CONTINUE 0
32+#endif
33+
34+#ifndef FTW_STOP
35+#define FTW_STOP 1
36+#endif
37+
38+#ifndef FTW_SKIP_SUBTREE
39+#define FTW_SKIP_SUBTREE 2
40+#endif
41+
42+#ifndef FTW_SKIP_SIBLINGS
43+#define FTW_SKIP_SIBLINGS 3
44+#endif
45--
462.27.0
47
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 @@
1From f9078501a1495c9991431d1435d081cd2e830328 Mon Sep 17 00:00:00 2001 1From 5712d56f1cd654d2e5d2e9117ff77fe4c299f76b Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 5 Sep 2015 06:31:47 +0000 3Date: Sat, 5 Sep 2015 06:31:47 +0000
4Subject: [PATCH] implment systemd-sysv-install for OE 4Subject: [PATCH] implment systemd-sysv-install for OE
@@ -9,16 +9,15 @@ to check the status of the sysv service
9Upstream-Status: Inappropriate [OE-Specific] 9Upstream-Status: Inappropriate [OE-Specific]
10 10
11Signed-off-by: Khem Raj <raj.khem@gmail.com> 11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12
13--- 12---
14 src/systemctl/systemd-sysv-install.SKELETON | 6 +++--- 13 src/systemctl/systemd-sysv-install.SKELETON | 6 +++---
15 1 file changed, 3 insertions(+), 3 deletions(-) 14 1 file changed, 3 insertions(+), 3 deletions(-)
16 15
17diff --git a/src/systemctl/systemd-sysv-install.SKELETON b/src/systemctl/systemd-sysv-install.SKELETON 16diff --git a/src/systemctl/systemd-sysv-install.SKELETON b/src/systemctl/systemd-sysv-install.SKELETON
18index 8c16cf99913f..9f078a121469 100755 17index cb58d8243b..000bdf6165 100755
19--- a/src/systemctl/systemd-sysv-install.SKELETON 18--- a/src/systemctl/systemd-sysv-install.SKELETON
20+++ b/src/systemctl/systemd-sysv-install.SKELETON 19+++ b/src/systemctl/systemd-sysv-install.SKELETON
21@@ -32,17 +32,17 @@ case "$1" in 20@@ -34,17 +34,17 @@ case "$1" in
22 enable) 21 enable)
23 # call the command to enable SysV init script $NAME here 22 # call the command to enable SysV init script $NAME here
24 # (consider optional $ROOT) 23 # (consider optional $ROOT)
@@ -39,3 +38,6 @@ index 8c16cf99913f..9f078a121469 100755
39 ;; 38 ;;
40 *) 39 *)
41 usage ;; 40 usage ;;
41--
422.39.2
43
diff --git a/meta/recipes-core/systemd/systemd/0014-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 e95d2ae078..3ff0177ae3 100644
--- a/meta/recipes-core/systemd/systemd/0014-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 @@
1From 55af446156da863b5b36a1109845858956a4c274 Mon Sep 17 00:00:00 2001 1From 25093c5017725b8577c444dfea0f42ad85b43522 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com> 2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Wed, 4 Jul 2018 15:00:44 +0800 3Date: Wed, 4 Jul 2018 15:00:44 +0800
4Subject: [PATCH 14/26] Do not disable buffering when writing to oom_score_adj 4Subject: [PATCH 09/22] Do not disable buffering when writing to oom_score_adj
5 5
6On musl, disabling buffering when writing to oom_score_adj will 6On musl, disabling buffering when writing to oom_score_adj will
7cause the following error. 7cause the following error.
@@ -24,18 +24,18 @@ Signed-off-by: Scott Murray <scott.murray@konsulko.com>
24 1 file changed, 1 insertion(+), 1 deletion(-) 24 1 file changed, 1 insertion(+), 1 deletion(-)
25 25
26diff --git a/src/basic/process-util.c b/src/basic/process-util.c 26diff --git a/src/basic/process-util.c b/src/basic/process-util.c
27index 4417101569..556dab8ebf 100644 27index 201c5596ae..ea51595b6c 100644
28--- a/src/basic/process-util.c 28--- a/src/basic/process-util.c
29+++ b/src/basic/process-util.c 29+++ b/src/basic/process-util.c
30@@ -1536,7 +1536,7 @@ int set_oom_score_adjust(int value) { 30@@ -1716,7 +1716,7 @@ int set_oom_score_adjust(int value) {
31 sprintf(t, "%i", value); 31 xsprintf(t, "%i", value);
32 32
33 return write_string_file("/proc/self/oom_score_adj", t, 33 return write_string_file("/proc/self/oom_score_adj", t,
34- WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_DISABLE_BUFFER); 34- WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_DISABLE_BUFFER);
35+ WRITE_STRING_FILE_VERIFY_ON_FAILURE); 35+ WRITE_STRING_FILE_VERIFY_ON_FAILURE);
36 } 36 }
37 37
38 int pidfd_get_pid(int fd, pid_t *ret) { 38 int get_oom_score_adjust(int *ret) {
39-- 39--
402.27.0 402.34.1
41 41
diff --git a/meta/recipes-core/systemd/systemd/0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch b/meta/recipes-core/systemd/systemd/0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch
deleted file mode 100644
index 76cc75cf6a..0000000000
--- a/meta/recipes-core/systemd/systemd/0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch
+++ /dev/null
@@ -1,45 +0,0 @@
1From d8e4f0aa1760e4c7bb8476beecd35025c9cbb95a Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 15:03:47 +0800
4Subject: [PATCH 09/26] fix missing of __register_atfork for non-glibc builds
5
6Upstream-Status: Inappropriate [musl specific]
7
8Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
9---
10 src/basic/process-util.c | 7 +++++++
11 1 file changed, 7 insertions(+)
12
13diff --git a/src/basic/process-util.c b/src/basic/process-util.c
14index 0851613fc9..4417101569 100644
15--- a/src/basic/process-util.c
16+++ b/src/basic/process-util.c
17@@ -18,6 +18,9 @@
18 #if HAVE_VALGRIND_VALGRIND_H
19 #include <valgrind/valgrind.h>
20 #endif
21+#ifndef __GLIBC__
22+#include <pthread.h>
23+#endif
24
25 #include "alloc-util.h"
26 #include "architecture.h"
27@@ -1143,11 +1146,15 @@ void reset_cached_pid(void) {
28 cached_pid = CACHED_PID_UNSET;
29 }
30
31+#ifdef __GLIBC__
32 /* We use glibc __register_atfork() + __dso_handle directly here, as they are not included in the glibc
33 * headers. __register_atfork() is mostly equivalent to pthread_atfork(), but doesn't require us to link against
34 * libpthread, as it is part of glibc anyway. */
35 extern int __register_atfork(void (*prepare) (void), void (*parent) (void), void (*child) (void), void *dso_handle);
36 extern void* __dso_handle _weak_;
37+#else
38+#define __register_atfork(prepare,parent,child,dso) pthread_atfork(prepare,parent,child)
39+#endif
40
41 pid_t getpid_cached(void) {
42 static bool installed = false;
43--
442.27.0
45
diff --git a/meta/recipes-core/systemd/systemd/0015-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 5cdcf84dc1..cf59ac7d06 100644
--- a/meta/recipes-core/systemd/systemd/0015-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 @@
1From e382845aed90cfe4496a8351d57d4466dd2e9a9c Mon Sep 17 00:00:00 2001 1From 2adbe9773cd65c48eec9df96868d4a738927c8d9 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com> 2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Tue, 10 Jul 2018 15:40:17 +0800 3Date: Tue, 10 Jul 2018 15:40:17 +0800
4Subject: [PATCH 15/26] distinguish XSI-compliant strerror_r from GNU-specifi 4Subject: [PATCH 10/22] distinguish XSI-compliant strerror_r from GNU-specifi
5 strerror_r 5 strerror_r
6 6
7XSI-compliant strerror_r and GNU-specifi strerror_r are different. 7XSI-compliant strerror_r and GNU-specifi strerror_r are different.
@@ -19,32 +19,15 @@ Upstream-Status: Inappropriate [musl specific]
19 19
20Signed-off-by: Chen Qi <Qi.Chen@windriver.com> 20Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
21--- 21---
22 src/journal/journal-send.c | 5 +++++ 22 src/libsystemd/sd-bus/bus-error.c | 11 ++++++++++-
23 src/libsystemd/sd-bus/bus-error.c | 5 +++++ 23 src/libsystemd/sd-journal/journal-send.c | 5 +++++
24 2 files changed, 10 insertions(+) 24 2 files changed, 15 insertions(+), 1 deletion(-)
25 25
26diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c
27index e8e6ad555b..8ca5271d02 100644
28--- a/src/journal/journal-send.c
29+++ b/src/journal/journal-send.c
30@@ -348,7 +348,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
31 char* j;
32
33 errno = 0;
34+#ifndef __GLIBC__
35+ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
36+ j = buffer + 8 + k;
37+#else
38 j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
39+#endif
40 if (errno == 0) {
41 char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1];
42
43diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c 26diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
44index 8da2024a50..9605a9b869 100644 27index 77b2e1a0fd..fdba0e0142 100644
45--- a/src/libsystemd/sd-bus/bus-error.c 28--- a/src/libsystemd/sd-bus/bus-error.c
46+++ b/src/libsystemd/sd-bus/bus-error.c 29+++ b/src/libsystemd/sd-bus/bus-error.c
47@@ -392,7 +392,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) { 30@@ -408,7 +408,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) {
48 return; 31 return;
49 32
50 errno = 0; 33 errno = 0;
@@ -57,6 +40,37 @@ index 8da2024a50..9605a9b869 100644
57 if (errno == ERANGE || strlen(x) >= k - 1) { 40 if (errno == ERANGE || strlen(x) >= k - 1) {
58 free(m); 41 free(m);
59 k *= 2; 42 k *= 2;
43@@ -593,8 +598,12 @@ const char* _bus_error_message(const sd_bus_error *e, int error, char buf[static
44
45 if (e && e->message)
46 return e->message;
47-
48+#ifndef __GLIBC__
49+ strerror_r(abs(error), buf, ERRNO_BUF_LEN);
50+ return buf;
51+#else
52 return strerror_r(abs(error), buf, ERRNO_BUF_LEN);
53+#endif
54 }
55
56 static bool map_ok(const sd_bus_error_map *map) {
57diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
58index 69a2eb6404..1561859650 100644
59--- a/src/libsystemd/sd-journal/journal-send.c
60+++ b/src/libsystemd/sd-journal/journal-send.c
61@@ -361,7 +361,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
62 char* j;
63
64 errno = 0;
65+#ifndef __GLIBC__
66+ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
67+ j = buffer + 8 + k;
68+#else
69 j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
70+#endif
71 if (errno == 0) {
72 char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1];
73
60-- 74--
612.27.0 752.34.1
62 76
diff --git a/meta/recipes-core/systemd/systemd/0018-avoid-redefinition-of-prctl_mm_map-structure.patch b/meta/recipes-core/systemd/systemd/0011-avoid-redefinition-of-prctl_mm_map-structure.patch
index 56d361a213..e481b2e2e4 100644
--- a/meta/recipes-core/systemd/systemd/0018-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 @@
1From bfc3416edeb69082ac9b9c9e844f12d7b45bb006 Mon Sep 17 00:00:00 2001 1From 49c446cfb78cf74a909bed8c3798b77a5469866a Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com> 2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 15:44:54 +0800 3Date: Mon, 25 Feb 2019 15:44:54 +0800
4Subject: [PATCH 18/26] avoid redefinition of prctl_mm_map structure 4Subject: [PATCH 11/22] avoid redefinition of prctl_mm_map structure
5 5
6Fix the following compile failure: 6Fix the following compile failure:
7error: redefinition of 'struct prctl_mm_map' 7error: redefinition of 'struct prctl_mm_map'
@@ -14,7 +14,7 @@ Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
14 1 file changed, 2 insertions(+) 14 1 file changed, 2 insertions(+)
15 15
16diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h 16diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h
17index ab851306ba..5547cad875 100644 17index 7d9e395c92..88c2d7dfac 100644
18--- a/src/basic/missing_prctl.h 18--- a/src/basic/missing_prctl.h
19+++ b/src/basic/missing_prctl.h 19+++ b/src/basic/missing_prctl.h
20@@ -1,7 +1,9 @@ 20@@ -1,7 +1,9 @@
@@ -28,5 +28,5 @@ index ab851306ba..5547cad875 100644
28 /* 58319057b7847667f0c9585b9de0e8932b0fdb08 (4.3) */ 28 /* 58319057b7847667f0c9585b9de0e8932b0fdb08 (4.3) */
29 #ifndef PR_CAP_AMBIENT 29 #ifndef PR_CAP_AMBIENT
30-- 30--
312.27.0 312.34.1
32 32
diff --git a/meta/recipes-core/systemd/systemd/0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch b/meta/recipes-core/systemd/systemd/0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch
deleted file mode 100644
index 6d7fdbcb64..0000000000
--- a/meta/recipes-core/systemd/systemd/0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch
+++ /dev/null
@@ -1,42 +0,0 @@
1From d1db531ddd3bbf94d5e764b7917bcc8684ff6357 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Wed, 28 Feb 2018 21:25:22 -0800
4Subject: [PATCH 11/26] test-sizeof.c: Disable tests for missing typedefs in
5 musl
6
7Upstream-Status: Inappropriate [musl specific]
8
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
11---
12 src/test/test-sizeof.c | 4 ++++
13 1 file changed, 4 insertions(+)
14
15diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c
16index 3c9dc180fa..e1a59d408c 100644
17--- a/src/test/test-sizeof.c
18+++ b/src/test/test-sizeof.c
19@@ -55,8 +55,10 @@ int main(void) {
20 info(unsigned);
21 info(long unsigned);
22 info(long long unsigned);
23+#ifdef __GLIBC__
24 info(__syscall_ulong_t);
25 info(__syscall_slong_t);
26+#endif
27
28 info(float);
29 info(double);
30@@ -74,7 +76,9 @@ int main(void) {
31 info(ssize_t);
32 info(time_t);
33 info(usec_t);
34+#ifdef __GLIBC__
35 info(__time_t);
36+#endif
37 info(pid_t);
38 info(uid_t);
39 info(gid_t);
40--
412.27.0
42
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 @@
1From e4885a8e60f883d9217e26e1db3754c2906aca31 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Fri, 1 Mar 2019 15:22:15 +0800
4Subject: [PATCH 12/22] do not disable buffer in writing files
5
6Do not disable buffer in writing files, otherwise we get
7failure at boot for musl like below.
8
9 [!!!!!!] Failed to allocate manager object.
10
11And there will be other failures, critical or not critical.
12This is specific to musl.
13
14Upstream-Status: Inappropriate [musl]
15
16Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
17[Rebased for v242]
18Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
19[rebased for systemd 243]
20Signed-off-by: Scott Murray <scott.murray@konsulko.com>
21[rebased for systemd 254]
22Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
23[rebased for systemd 255.1]
24---
25 src/basic/cgroup-util.c | 12 ++++++------
26 src/basic/namespace-util.c | 4 ++--
27 src/basic/procfs-util.c | 4 ++--
28 src/basic/sysctl-util.c | 2 +-
29 src/binfmt/binfmt.c | 6 +++---
30 src/core/cgroup.c | 2 +-
31 src/core/main.c | 2 +-
32 src/core/smack-setup.c | 8 ++++----
33 src/home/homework.c | 2 +-
34 src/libsystemd/sd-device/sd-device.c | 2 +-
35 src/nspawn/nspawn-cgroup.c | 2 +-
36 src/nspawn/nspawn.c | 6 +++---
37 src/shared/binfmt-util.c | 2 +-
38 src/shared/cgroup-setup.c | 4 ++--
39 src/shared/coredump-util.c | 4 ++--
40 src/shared/hibernate-util.c | 4 ++--
41 src/shared/smack-util.c | 2 +-
42 src/shared/watchdog.c | 2 +-
43 src/sleep/sleep.c | 4 ++--
44 src/storagetm/storagetm.c | 24 ++++++++++++------------
45 src/udev/udev-rules.c | 1 -
46 src/vconsole/vconsole-setup.c | 2 +-
47 22 files changed, 50 insertions(+), 51 deletions(-)
48
49diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
50index d2be79622f..e65fecb68d 100644
51--- a/src/basic/cgroup-util.c
52+++ b/src/basic/cgroup-util.c
53@@ -417,7 +417,7 @@ int cg_kill_kernel_sigkill(const char *path) {
54 if (r < 0)
55 return r;
56
57- r = write_string_file(killfile, "1", WRITE_STRING_FILE_DISABLE_BUFFER);
58+ r = write_string_file(killfile, "1", 0);
59 if (r < 0)
60 return r;
61
62@@ -843,7 +843,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
63
64 sc = strstrip(contents);
65 if (isempty(sc)) {
66- r = write_string_file(fs, agent, WRITE_STRING_FILE_DISABLE_BUFFER);
67+ r = write_string_file(fs, agent, 0);
68 if (r < 0)
69 return r;
70 } else if (!path_equal(sc, agent))
71@@ -861,7 +861,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
72
73 sc = strstrip(contents);
74 if (streq(sc, "0")) {
75- r = write_string_file(fs, "1", WRITE_STRING_FILE_DISABLE_BUFFER);
76+ r = write_string_file(fs, "1", 0);
77 if (r < 0)
78 return r;
79
80@@ -888,7 +888,7 @@ int cg_uninstall_release_agent(const char *controller) {
81 if (r < 0)
82 return r;
83
84- r = write_string_file(fs, "0", WRITE_STRING_FILE_DISABLE_BUFFER);
85+ r = write_string_file(fs, "0", 0);
86 if (r < 0)
87 return r;
88
89@@ -898,7 +898,7 @@ int cg_uninstall_release_agent(const char *controller) {
90 if (r < 0)
91 return r;
92
93- r = write_string_file(fs, "", WRITE_STRING_FILE_DISABLE_BUFFER);
94+ r = write_string_file(fs, "", 0);
95 if (r < 0)
96 return r;
97
98@@ -1814,7 +1814,7 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri
99 if (r < 0)
100 return r;
101
102- return write_string_file(p, value, WRITE_STRING_FILE_DISABLE_BUFFER);
103+ return write_string_file(p, value, 0);
104 }
105
106 int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret) {
107diff --git a/src/basic/namespace-util.c b/src/basic/namespace-util.c
108index 2101f617ad..63817bae17 100644
109--- a/src/basic/namespace-util.c
110+++ b/src/basic/namespace-util.c
111@@ -227,12 +227,12 @@ int userns_acquire(const char *uid_map, const char *gid_map) {
112 freeze();
113
114 xsprintf(path, "/proc/" PID_FMT "/uid_map", pid);
115- r = write_string_file(path, uid_map, WRITE_STRING_FILE_DISABLE_BUFFER);
116+ r = write_string_file(path, uid_map, 0);
117 if (r < 0)
118 return log_error_errno(r, "Failed to write UID map: %m");
119
120 xsprintf(path, "/proc/" PID_FMT "/gid_map", pid);
121- r = write_string_file(path, gid_map, WRITE_STRING_FILE_DISABLE_BUFFER);
122+ r = write_string_file(path, gid_map, 0);
123 if (r < 0)
124 return log_error_errno(r, "Failed to write GID map: %m");
125
126diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c
127index 6cb0ddf575..247cf9e1d1 100644
128--- a/src/basic/procfs-util.c
129+++ b/src/basic/procfs-util.c
130@@ -64,13 +64,13 @@ int procfs_tasks_set_limit(uint64_t limit) {
131 * decrease it, as threads-max is the much more relevant sysctl. */
132 if (limit > pid_max-1) {
133 sprintf(buffer, "%" PRIu64, limit+1); /* Add one, since PID 0 is not a valid PID */
134- r = write_string_file("/proc/sys/kernel/pid_max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER);
135+ r = write_string_file("/proc/sys/kernel/pid_max", buffer, 0);
136 if (r < 0)
137 return r;
138 }
139
140 sprintf(buffer, "%" PRIu64, limit);
141- r = write_string_file("/proc/sys/kernel/threads-max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER);
142+ r = write_string_file("/proc/sys/kernel/threads-max", buffer, 0);
143 if (r < 0) {
144 uint64_t threads_max;
145
146diff --git a/src/basic/sysctl-util.c b/src/basic/sysctl-util.c
147index b66a6622ae..8d1c93008a 100644
148--- a/src/basic/sysctl-util.c
149+++ b/src/basic/sysctl-util.c
150@@ -58,7 +58,7 @@ int sysctl_write(const char *property, const char *value) {
151
152 log_debug("Setting '%s' to '%s'", p, value);
153
154- return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_SUPPRESS_REDUNDANT_VIRTUAL);
155+ return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_SUPPRESS_REDUNDANT_VIRTUAL);
156 }
157
158 int sysctl_writef(const char *property, const char *format, ...) {
159diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c
160index d21f3f79ff..258607cc7e 100644
161--- a/src/binfmt/binfmt.c
162+++ b/src/binfmt/binfmt.c
163@@ -30,7 +30,7 @@ static bool arg_unregister = false;
164
165 static int delete_rule(const char *rulename) {
166 const char *fn = strjoina("/proc/sys/fs/binfmt_misc/", rulename);
167- return write_string_file(fn, "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
168+ return write_string_file(fn, "-1", 0);
169 }
170
171 static int apply_rule(const char *filename, unsigned line, const char *rule) {
172@@ -58,7 +58,7 @@ static int apply_rule(const char *filename, unsigned line, const char *rule) {
173 if (r >= 0)
174 log_debug("%s:%u: Rule '%s' deleted.", filename, line, rulename);
175
176- r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, WRITE_STRING_FILE_DISABLE_BUFFER);
177+ r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, 0);
178 if (r < 0)
179 return log_error_errno(r, "%s:%u: Failed to add binary format '%s': %m",
180 filename, line, rulename);
181@@ -248,7 +248,7 @@ static int run(int argc, char *argv[]) {
182 return r;
183
184 /* Flush out all rules */
185- r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
186+ r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0);
187 if (r < 0)
188 log_warning_errno(r, "Failed to flush binfmt_misc rules, ignoring: %m");
189 else
190diff --git a/src/core/cgroup.c b/src/core/cgroup.c
191index 61ac4df1a6..ea18970196 100644
192--- a/src/core/cgroup.c
193+++ b/src/core/cgroup.c
194@@ -4578,7 +4578,7 @@ int unit_cgroup_freezer_action(Unit *u, FreezerAction action) {
195 u->freezer_state = FREEZER_THAWING;
196 }
197
198- r = write_string_file(path, one_zero(action == FREEZER_FREEZE), WRITE_STRING_FILE_DISABLE_BUFFER);
199+ r = write_string_file(path, one_zero(action == FREEZER_FREEZE), 0);
200 if (r < 0)
201 return r;
202
203diff --git a/src/core/main.c b/src/core/main.c
204index 3f71cc0947..0e5aec3e9e 100644
205--- a/src/core/main.c
206+++ b/src/core/main.c
207@@ -1678,7 +1678,7 @@ static void initialize_core_pattern(bool skip_setup) {
208 if (getpid_cached() != 1)
209 return;
210
211- r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, WRITE_STRING_FILE_DISABLE_BUFFER);
212+ r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, 0);
213 if (r < 0)
214 log_warning_errno(r, "Failed to write '%s' to /proc/sys/kernel/core_pattern, ignoring: %m",
215 arg_early_core_pattern);
216diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c
217index 7ea902b6f9..1aef2988d0 100644
218--- a/src/core/smack-setup.c
219+++ b/src/core/smack-setup.c
220@@ -321,17 +321,17 @@ int mac_smack_setup(bool *loaded_policy) {
221 }
222
223 #if HAVE_SMACK_RUN_LABEL
224- r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
225+ r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, 0);
226 if (r < 0)
227 log_warning_errno(r, "Failed to set SMACK label \"" SMACK_RUN_LABEL "\" on self: %m");
228- r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
229+ r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, 0);
230 if (r < 0)
231 log_warning_errno(r, "Failed to set SMACK ambient label \"" SMACK_RUN_LABEL "\": %m");
232 r = write_string_file("/sys/fs/smackfs/netlabel",
233- "0.0.0.0/0 " SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
234+ "0.0.0.0/0 " SMACK_RUN_LABEL, 0);
235 if (r < 0)
236 log_warning_errno(r, "Failed to set SMACK netlabel rule \"0.0.0.0/0 " SMACK_RUN_LABEL "\": %m");
237- r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", WRITE_STRING_FILE_DISABLE_BUFFER);
238+ r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", 0);
239 if (r < 0)
240 log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m");
241 #endif
242diff --git a/src/home/homework.c b/src/home/homework.c
243index 066483e342..5f92dd7064 100644
244--- a/src/home/homework.c
245+++ b/src/home/homework.c
246@@ -278,7 +278,7 @@ static void drop_caches_now(void) {
247 * for details. We write "2" into /proc/sys/vm/drop_caches to ensure dentries/inodes are flushed, but
248 * not more. */
249
250- r = write_string_file("/proc/sys/vm/drop_caches", "2\n", WRITE_STRING_FILE_DISABLE_BUFFER);
251+ r = write_string_file("/proc/sys/vm/drop_caches", "2\n", 0);
252 if (r < 0)
253 log_warning_errno(r, "Failed to drop caches, ignoring: %m");
254 else
255diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c
256index 2fbc619a34..09d9591e37 100644
257--- a/src/libsystemd/sd-device/sd-device.c
258+++ b/src/libsystemd/sd-device/sd-device.c
259@@ -2516,7 +2516,7 @@ _public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr,
260 if (!value)
261 return -ENOMEM;
262
263- r = write_string_file(path, value, WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_NOFOLLOW);
264+ r = write_string_file(path, value, 0 | WRITE_STRING_FILE_NOFOLLOW);
265 if (r < 0) {
266 /* On failure, clear cache entry, as we do not know how it fails. */
267 device_remove_cached_sysattr_value(device, sysattr);
268diff --git a/src/nspawn/nspawn-cgroup.c b/src/nspawn/nspawn-cgroup.c
269index a5002437c6..b12e6cd9c9 100644
270--- a/src/nspawn/nspawn-cgroup.c
271+++ b/src/nspawn/nspawn-cgroup.c
272@@ -124,7 +124,7 @@ int sync_cgroup(pid_t pid, CGroupUnified unified_requested, uid_t uid_shift) {
273 fn = strjoina(tree, cgroup, "/cgroup.procs");
274
275 sprintf(pid_string, PID_FMT, pid);
276- r = write_string_file(fn, pid_string, WRITE_STRING_FILE_DISABLE_BUFFER|WRITE_STRING_FILE_MKDIR_0755);
277+ r = write_string_file(fn, pid_string, WRITE_STRING_FILE_MKDIR_0755);
278 if (r < 0) {
279 log_error_errno(r, "Failed to move process: %m");
280 goto finish;
281diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
282index 6ab604d3dc..bbec6b686c 100644
283--- a/src/nspawn/nspawn.c
284+++ b/src/nspawn/nspawn.c
285@@ -2688,7 +2688,7 @@ static int reset_audit_loginuid(void) {
286 if (streq(p, "4294967295"))
287 return 0;
288
289- r = write_string_file("/proc/self/loginuid", "4294967295", WRITE_STRING_FILE_DISABLE_BUFFER);
290+ r = write_string_file("/proc/self/loginuid", "4294967295", 0);
291 if (r < 0) {
292 log_error_errno(r,
293 "Failed to reset audit login UID. This probably means that your kernel is too\n"
294@@ -4141,7 +4141,7 @@ static int setup_uid_map(
295 return log_oom();
296
297 xsprintf(uid_map, "/proc/" PID_FMT "/uid_map", pid);
298- r = write_string_file(uid_map, s, WRITE_STRING_FILE_DISABLE_BUFFER);
299+ r = write_string_file(uid_map, s, 0);
300 if (r < 0)
301 return log_error_errno(r, "Failed to write UID map: %m");
302
303@@ -4151,7 +4151,7 @@ static int setup_uid_map(
304 return log_oom();
305
306 xsprintf(uid_map, "/proc/" PID_FMT "/gid_map", pid);
307- r = write_string_file(uid_map, s, WRITE_STRING_FILE_DISABLE_BUFFER);
308+ r = write_string_file(uid_map, s, 0);
309 if (r < 0)
310 return log_error_errno(r, "Failed to write GID map: %m");
311
312diff --git a/src/shared/binfmt-util.c b/src/shared/binfmt-util.c
313index a26175474b..1413a9c72c 100644
314--- a/src/shared/binfmt-util.c
315+++ b/src/shared/binfmt-util.c
316@@ -46,7 +46,7 @@ int disable_binfmt(void) {
317 return 0;
318 }
319
320- r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
321+ r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0);
322 if (r < 0)
323 return log_warning_errno(r, "Failed to unregister binfmt_misc entries: %m");
324
325diff --git a/src/shared/cgroup-setup.c b/src/shared/cgroup-setup.c
326index 934a16eaf3..c921ced861 100644
327--- a/src/shared/cgroup-setup.c
328+++ b/src/shared/cgroup-setup.c
329@@ -351,7 +351,7 @@ int cg_attach(const char *controller, const char *path, pid_t pid) {
330
331 xsprintf(c, PID_FMT "\n", pid);
332
333- r = write_string_file(fs, c, WRITE_STRING_FILE_DISABLE_BUFFER);
334+ r = write_string_file(fs, c, 0);
335 if (r == -EOPNOTSUPP && cg_is_threaded(path) > 0)
336 /* When the threaded mode is used, we cannot read/write the file. Let's return recognizable error. */
337 return -EUCLEAN;
338@@ -966,7 +966,7 @@ int cg_enable_everywhere(
339 return log_debug_errno(errno, "Failed to open cgroup.subtree_control file of %s: %m", p);
340 }
341
342- r = write_string_stream(f, s, WRITE_STRING_FILE_DISABLE_BUFFER);
343+ r = write_string_stream(f, s, 0);
344 if (r < 0) {
345 log_debug_errno(r, "Failed to %s controller %s for %s (%s): %m",
346 FLAGS_SET(mask, bit) ? "enable" : "disable", n, p, fs);
347diff --git a/src/shared/coredump-util.c b/src/shared/coredump-util.c
348index 805503f366..01a7ccb291 100644
349--- a/src/shared/coredump-util.c
350+++ b/src/shared/coredump-util.c
351@@ -163,7 +163,7 @@ int set_coredump_filter(uint64_t value) {
352 xsprintf(t, "0x%"PRIx64, value);
353
354 return write_string_file("/proc/self/coredump_filter", t,
355- WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_DISABLE_BUFFER);
356+ 0);
357 }
358
359 /* Turn off core dumps but only if we're running outside of a container. */
360@@ -173,7 +173,7 @@ void disable_coredumps(void) {
361 if (detect_container() > 0)
362 return;
363
364- r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", WRITE_STRING_FILE_DISABLE_BUFFER);
365+ r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", 0);
366 if (r < 0)
367 log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m");
368 }
369diff --git a/src/shared/hibernate-util.c b/src/shared/hibernate-util.c
370index 3eb13d48f6..d09b901be1 100644
371--- a/src/shared/hibernate-util.c
372+++ b/src/shared/hibernate-util.c
373@@ -481,7 +481,7 @@ int write_resume_config(dev_t devno, uint64_t offset, const char *device) {
374
375 /* We write the offset first since it's safer. Note that this file is only available in 4.17+, so
376 * fail gracefully if it doesn't exist and we're only overwriting it with 0. */
377- r = write_string_file("/sys/power/resume_offset", offset_str, WRITE_STRING_FILE_DISABLE_BUFFER);
378+ r = write_string_file("/sys/power/resume_offset", offset_str, 0);
379 if (r == -ENOENT) {
380 if (offset != 0)
381 return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
382@@ -497,7 +497,7 @@ int write_resume_config(dev_t devno, uint64_t offset, const char *device) {
383 log_debug("Wrote resume_offset=%s for device '%s' to /sys/power/resume_offset.",
384 offset_str, device);
385
386- r = write_string_file("/sys/power/resume", devno_str, WRITE_STRING_FILE_DISABLE_BUFFER);
387+ r = write_string_file("/sys/power/resume", devno_str, 0);
388 if (r < 0)
389 return log_error_errno(r,
390 "Failed to write device '%s' (%s) to /sys/power/resume: %m",
391diff --git a/src/shared/smack-util.c b/src/shared/smack-util.c
392index 1f88e724d0..feb18b320a 100644
393--- a/src/shared/smack-util.c
394+++ b/src/shared/smack-util.c
395@@ -113,7 +113,7 @@ int mac_smack_apply_pid(pid_t pid, const char *label) {
396 return 0;
397
398 p = procfs_file_alloca(pid, "attr/current");
399- r = write_string_file(p, label, WRITE_STRING_FILE_DISABLE_BUFFER);
400+ r = write_string_file(p, label, 0);
401 if (r < 0)
402 return r;
403
404diff --git a/src/shared/watchdog.c b/src/shared/watchdog.c
405index 4c1a968718..6faf6806a5 100644
406--- a/src/shared/watchdog.c
407+++ b/src/shared/watchdog.c
408@@ -93,7 +93,7 @@ static int set_pretimeout_governor(const char *governor) {
409
410 r = write_string_file(sys_fn,
411 governor,
412- WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_VERIFY_IGNORE_NEWLINE);
413+ WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_VERIFY_IGNORE_NEWLINE);
414 if (r < 0)
415 return log_error_errno(r, "Failed to set pretimeout_governor to '%s': %m", governor);
416
417diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c
418index 21af3e9e52..6d4b84b5d5 100644
419--- a/src/sleep/sleep.c
420+++ b/src/sleep/sleep.c
421@@ -137,7 +137,7 @@ static int write_state(int fd, char * const *states) {
422 if (k < 0)
423 return RET_GATHER(r, k);
424
425- k = write_string_stream(f, *state, WRITE_STRING_FILE_DISABLE_BUFFER);
426+ k = write_string_stream(f, *state, 0);
427 if (k >= 0) {
428 log_debug("Using sleep state '%s'.", *state);
429 return 0;
430@@ -155,7 +155,7 @@ static int write_mode(char * const *modes) {
431 STRV_FOREACH(mode, modes) {
432 int k;
433
434- k = write_string_file("/sys/power/disk", *mode, WRITE_STRING_FILE_DISABLE_BUFFER);
435+ k = write_string_file("/sys/power/disk", *mode, 0);
436 if (k >= 0) {
437 log_debug("Using sleep disk mode '%s'.", *mode);
438 return 0;
439diff --git a/src/storagetm/storagetm.c b/src/storagetm/storagetm.c
440index ae63baaf79..82eeca479a 100644
441--- a/src/storagetm/storagetm.c
442+++ b/src/storagetm/storagetm.c
443@@ -186,7 +186,7 @@ static int nvme_subsystem_unlink(NvmeSubsystem *s) {
444 if (!enable_fn)
445 return log_oom();
446
447- r = write_string_file_at(namespaces_fd, enable_fn, "0", WRITE_STRING_FILE_DISABLE_BUFFER);
448+ r = write_string_file_at(namespaces_fd, enable_fn, "0", 0);
449 if (r < 0)
450 log_warning_errno(r, "Failed to disable namespace '%s' of NVME subsystem '%s', ignoring: %m", e->d_name, s->name);
451
452@@ -254,7 +254,7 @@ static int nvme_subsystem_write_metadata(int subsystem_fd, sd_device *device) {
453 _cleanup_free_ char *truncated = strndup(w, 40); /* kernel refuses more than 40 chars (as per nvme spec) */
454
455 /* The default string stored in 'attr_model' is "Linux" btw. */
456- r = write_string_file_at(subsystem_fd, "attr_model", truncated, WRITE_STRING_FILE_DISABLE_BUFFER);
457+ r = write_string_file_at(subsystem_fd, "attr_model", truncated, 0);
458 if (r < 0)
459 log_warning_errno(r, "Failed to set model of subsystem to '%s', ignoring: %m", w);
460 }
461@@ -268,7 +268,7 @@ static int nvme_subsystem_write_metadata(int subsystem_fd, sd_device *device) {
462 return log_oom();
463
464 /* The default string stored in 'attr_firmware' is `uname -r` btw, but truncated to 8 chars. */
465- r = write_string_file_at(subsystem_fd, "attr_firmware", truncated, WRITE_STRING_FILE_DISABLE_BUFFER);
466+ r = write_string_file_at(subsystem_fd, "attr_firmware", truncated, 0);
467 if (r < 0)
468 log_warning_errno(r, "Failed to set model of subsystem to '%s', ignoring: %m", truncated);
469 }
470@@ -295,7 +295,7 @@ static int nvme_subsystem_write_metadata(int subsystem_fd, sd_device *device) {
471 if (!truncated)
472 return log_oom();
473
474- r = write_string_file_at(subsystem_fd, "attr_serial", truncated, WRITE_STRING_FILE_DISABLE_BUFFER);
475+ r = write_string_file_at(subsystem_fd, "attr_serial", truncated, 0);
476 if (r < 0)
477 log_warning_errno(r, "Failed to set serial of subsystem to '%s', ignoring: %m", truncated);
478 }
479@@ -345,7 +345,7 @@ static int nvme_namespace_write_metadata(int namespace_fd, sd_device *device, co
480 id = id128_digest(j, l);
481 }
482
483- r = write_string_file_at(namespace_fd, "device_uuid", SD_ID128_TO_UUID_STRING(id), WRITE_STRING_FILE_DISABLE_BUFFER);
484+ r = write_string_file_at(namespace_fd, "device_uuid", SD_ID128_TO_UUID_STRING(id), 0);
485 if (r < 0)
486 log_warning_errno(r, "Failed to set uuid of namespace to '%s', ignoring: %m", SD_ID128_TO_UUID_STRING(id));
487
488@@ -408,7 +408,7 @@ static int nvme_subsystem_add(const char *node, int consumed_fd, sd_device *devi
489 if (subsystem_fd < 0)
490 return log_error_errno(subsystem_fd, "Failed to create NVME subsystem '%s': %m", j);
491
492- r = write_string_file_at(subsystem_fd, "attr_allow_any_host", "1", WRITE_STRING_FILE_DISABLE_BUFFER);
493+ r = write_string_file_at(subsystem_fd, "attr_allow_any_host", "1", 0);
494 if (r < 0)
495 return log_error_errno(r, "Failed to set 'attr_allow_any_host' flag: %m");
496
497@@ -423,11 +423,11 @@ static int nvme_subsystem_add(const char *node, int consumed_fd, sd_device *devi
498
499 /* We use /proc/$PID/fd/$FD rather than /proc/self/fd/$FD, because this string is visible to others
500 * via configfs, and by including the PID it's clear to who the stuff belongs. */
501- r = write_string_file_at(namespace_fd, "device_path", FORMAT_PROC_PID_FD_PATH(0, fd), WRITE_STRING_FILE_DISABLE_BUFFER);
502+ r = write_string_file_at(namespace_fd, "device_path", FORMAT_PROC_PID_FD_PATH(0, fd), 0);
503 if (r < 0)
504 return log_error_errno(r, "Failed to write 'device_path' attribute: %m");
505
506- r = write_string_file_at(namespace_fd, "enable", "1", WRITE_STRING_FILE_DISABLE_BUFFER);
507+ r = write_string_file_at(namespace_fd, "enable", "1", 0);
508 if (r < 0)
509 return log_error_errno(r, "Failed to write 'enable' attribute: %m");
510
511@@ -557,19 +557,19 @@ static int nvme_port_add_portnr(
512 return 0;
513 }
514
515- r = write_string_file_at(port_fd, "addr_adrfam", af_to_ipv4_ipv6(ip_family), WRITE_STRING_FILE_DISABLE_BUFFER);
516+ r = write_string_file_at(port_fd, "addr_adrfam", af_to_ipv4_ipv6(ip_family), 0);
517 if (r < 0)
518 return log_error_errno(r, "Failed to set address family on NVME port %" PRIu16 ": %m", portnr);
519
520- r = write_string_file_at(port_fd, "addr_trtype", "tcp", WRITE_STRING_FILE_DISABLE_BUFFER);
521+ r = write_string_file_at(port_fd, "addr_trtype", "tcp", 0);
522 if (r < 0)
523 return log_error_errno(r, "Failed to set transport type on NVME port %" PRIu16 ": %m", portnr);
524
525- r = write_string_file_at(port_fd, "addr_trsvcid", fname, WRITE_STRING_FILE_DISABLE_BUFFER);
526+ r = write_string_file_at(port_fd, "addr_trsvcid", fname, 0);
527 if (r < 0)
528 return log_error_errno(r, "Failed to set IP port on NVME port %" PRIu16 ": %m", portnr);
529
530- r = write_string_file_at(port_fd, "addr_traddr", ip_family == AF_INET6 ? "::" : "0.0.0.0", WRITE_STRING_FILE_DISABLE_BUFFER);
531+ r = write_string_file_at(port_fd, "addr_traddr", ip_family == AF_INET6 ? "::" : "0.0.0.0", 0);
532 if (r < 0)
533 return log_error_errno(r, "Failed to set IP address on NVME port %" PRIu16 ": %m", portnr);
534
535diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
536index febe345b4c..a90b610ba1 100644
537--- a/src/udev/udev-rules.c
538+++ b/src/udev/udev-rules.c
539@@ -2711,7 +2711,6 @@ static int udev_rule_apply_token_to_event(
540 log_event_debug(dev, token, "ATTR '%s' writing '%s'", buf, value);
541 r = write_string_file(buf, value,
542 WRITE_STRING_FILE_VERIFY_ON_FAILURE |
543- WRITE_STRING_FILE_DISABLE_BUFFER |
544 WRITE_STRING_FILE_AVOID_NEWLINE |
545 WRITE_STRING_FILE_VERIFY_IGNORE_NEWLINE);
546 if (r < 0)
547diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
548index 4d82c65f0a..3a3d861b83 100644
549--- a/src/vconsole/vconsole-setup.c
550+++ b/src/vconsole/vconsole-setup.c
551@@ -261,7 +261,7 @@ static int toggle_utf8_vc(const char *name, int fd, bool utf8) {
552 static int toggle_utf8_sysfs(bool utf8) {
553 int r;
554
555- r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), WRITE_STRING_FILE_DISABLE_BUFFER);
556+ r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), 0);
557 if (r < 0)
558 return log_warning_errno(r, "Failed to %s sysfs UTF-8 flag: %m", enable_disable(utf8));
559
560--
5612.34.1
562
diff --git a/meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch b/meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch
deleted file mode 100644
index 89736bcfde..0000000000
--- a/meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch
+++ /dev/null
@@ -1,35 +0,0 @@
1From dd134880e9a16595ab473934577e873c748e9c7a Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 27 May 2018 08:36:44 -0700
4Subject: [PATCH 13/26] Define glibc compatible basename() for non-glibc
5 systems
6
7Fixes builds with musl, even though systemd is adamant about
8using non-posix basename implementation, we have a way out
9
10Upstream-Status: Inappropriate [musl specific]
11
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13---
14 src/machine/machine-dbus.c | 5 +++++
15 1 file changed, 5 insertions(+)
16
17diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c
18index f5780f1aec..aec5825b3e 100644
19--- a/src/machine/machine-dbus.c
20+++ b/src/machine/machine-dbus.c
21@@ -11,6 +11,11 @@
22 #include <libgen.h>
23 #undef basename
24
25+#if !defined(__GLIBC__)
26+#include <string.h>
27+#define basename(src) (strrchr(src,'/') ? strrchr(src,'/')+1 : src)
28+#endif
29+
30 #include "alloc-util.h"
31 #include "bus-common-errors.h"
32 #include "bus-get-properties.h"
33--
342.27.0
35
diff --git a/meta/recipes-core/systemd/systemd/0025-Handle-__cpu_mask-usage.patch b/meta/recipes-core/systemd/systemd/0013-Handle-__cpu_mask-usage.patch
index 1cc3985d12..43f75373a6 100644
--- a/meta/recipes-core/systemd/systemd/0025-Handle-__cpu_mask-usage.patch
+++ b/meta/recipes-core/systemd/systemd/0013-Handle-__cpu_mask-usage.patch
@@ -1,7 +1,7 @@
1From bbda4a48a34662393117fc677c3a678d4ce4c2ec Mon Sep 17 00:00:00 2001 1From 2f90f8463423cfbb7e83fcef42f1071018c3b56e Mon Sep 17 00:00:00 2001
2From: Scott Murray <scott.murray@konsulko.com> 2From: Scott Murray <scott.murray@konsulko.com>
3Date: Fri, 13 Sep 2019 19:26:27 -0400 3Date: Fri, 13 Sep 2019 19:26:27 -0400
4Subject: [PATCH 25/26] Handle __cpu_mask usage 4Subject: [PATCH 13/22] Handle __cpu_mask usage
5 5
6Fixes errors: 6Fixes errors:
7 7
@@ -37,7 +37,7 @@ index 3c63a58826..4c2d4347fc 100644
37 typedef struct CPUSet { 37 typedef struct CPUSet {
38 cpu_set_t *set; 38 cpu_set_t *set;
39diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c 39diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c
40index e1a59d408c..c269ea6e8c 100644 40index ea0c58770e..b65c0bd370 100644
41--- a/src/test/test-sizeof.c 41--- a/src/test/test-sizeof.c
42+++ b/src/test/test-sizeof.c 42+++ b/src/test/test-sizeof.c
43@@ -1,6 +1,5 @@ 43@@ -1,6 +1,5 @@
@@ -46,8 +46,8 @@ index e1a59d408c..c269ea6e8c 100644
46-#include <sched.h> 46-#include <sched.h>
47 #include <stdio.h> 47 #include <stdio.h>
48 #include <string.h> 48 #include <string.h>
49 #include <sys/types.h> 49 #include <sys/resource.h>
50@@ -10,6 +9,7 @@ 50@@ -12,6 +11,7 @@
51 #include <float.h> 51 #include <float.h>
52 52
53 #include "time-util.h" 53 #include "time-util.h"
@@ -56,5 +56,5 @@ index e1a59d408c..c269ea6e8c 100644
56 /* Print information about various types. Useful when diagnosing 56 /* Print information about various types. Useful when diagnosing
57 * gcc diagnostics on an unfamiliar architecture. */ 57 * gcc diagnostics on an unfamiliar architecture. */
58-- 58--
592.27.0 592.34.1
60 60
diff --git a/meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch b/meta/recipes-core/systemd/systemd/0014-Handle-missing-gshadow.patch
index 4180afb08e..a751e1ba6f 100644
--- a/meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch
+++ b/meta/recipes-core/systemd/systemd/0014-Handle-missing-gshadow.patch
@@ -1,7 +1,7 @@
1From 47bf88f74717b417e4adbcc04256334b2335c873 Mon Sep 17 00:00:00 2001 1From b7c827bb44edbb6251c9fcdb80aa03982c0e7bf3 Mon Sep 17 00:00:00 2001
2From: Alex Kiernan <alex.kiernan@gmail.com> 2From: Alex Kiernan <alex.kiernan@gmail.com>
3Date: Tue, 10 Mar 2020 11:05:20 +0000 3Date: Tue, 10 Mar 2020 11:05:20 +0000
4Subject: [PATCH 26/26] Handle missing gshadow 4Subject: [PATCH 14/22] Handle missing gshadow
5 5
6gshadow usage is now present in the userdb code. Mask all uses of it to 6gshadow usage is now present in the userdb code. Mask all uses of it to
7allow compilation on musl 7allow compilation on musl
@@ -13,14 +13,14 @@ Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
13--- 13---
14 src/shared/user-record-nss.c | 20 ++++++++++++++++++++ 14 src/shared/user-record-nss.c | 20 ++++++++++++++++++++
15 src/shared/user-record-nss.h | 4 ++++ 15 src/shared/user-record-nss.h | 4 ++++
16 src/shared/userdb.c | 6 ++++++ 16 src/shared/userdb.c | 7 ++++++-
17 3 files changed, 30 insertions(+) 17 3 files changed, 30 insertions(+), 1 deletion(-)
18 18
19diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c 19diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c
20index 88b8fc2f8f..a819d41bac 100644 20index 414a49331b..1a4e1b628c 100644
21--- a/src/shared/user-record-nss.c 21--- a/src/shared/user-record-nss.c
22+++ b/src/shared/user-record-nss.c 22+++ b/src/shared/user-record-nss.c
23@@ -331,8 +331,10 @@ int nss_group_to_group_record( 23@@ -329,8 +329,10 @@ int nss_group_to_group_record(
24 if (isempty(grp->gr_name)) 24 if (isempty(grp->gr_name))
25 return -EINVAL; 25 return -EINVAL;
26 26
@@ -31,7 +31,7 @@ index 88b8fc2f8f..a819d41bac 100644
31 31
32 g = group_record_new(); 32 g = group_record_new();
33 if (!g) 33 if (!g)
34@@ -348,6 +350,7 @@ int nss_group_to_group_record( 34@@ -346,6 +348,7 @@ int nss_group_to_group_record(
35 35
36 g->gid = grp->gr_gid; 36 g->gid = grp->gr_gid;
37 37
@@ -39,7 +39,7 @@ index 88b8fc2f8f..a819d41bac 100644
39 if (sgrp) { 39 if (sgrp) {
40 if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) { 40 if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) {
41 g->hashed_password = strv_new(sgrp->sg_passwd); 41 g->hashed_password = strv_new(sgrp->sg_passwd);
42@@ -363,6 +366,7 @@ int nss_group_to_group_record( 42@@ -361,6 +364,7 @@ int nss_group_to_group_record(
43 if (r < 0) 43 if (r < 0)
44 return r; 44 return r;
45 } 45 }
@@ -47,7 +47,7 @@ index 88b8fc2f8f..a819d41bac 100644
47 47
48 r = json_build(&g->json, JSON_BUILD_OBJECT( 48 r = json_build(&g->json, JSON_BUILD_OBJECT(
49 JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)), 49 JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)),
50@@ -388,6 +392,7 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re 50@@ -387,6 +391,7 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
51 assert(ret_sgrp); 51 assert(ret_sgrp);
52 assert(ret_buffer); 52 assert(ret_buffer);
53 53
@@ -55,7 +55,7 @@ index 88b8fc2f8f..a819d41bac 100644
55 for (;;) { 55 for (;;) {
56 _cleanup_free_ char *buf = NULL; 56 _cleanup_free_ char *buf = NULL;
57 struct sgrp sgrp, *result; 57 struct sgrp sgrp, *result;
58@@ -416,6 +421,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re 58@@ -415,6 +420,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
59 buflen *= 2; 59 buflen *= 2;
60 buf = mfree(buf); 60 buf = mfree(buf);
61 } 61 }
@@ -65,7 +65,7 @@ index 88b8fc2f8f..a819d41bac 100644
65 } 65 }
66 66
67 int nss_group_record_by_name( 67 int nss_group_record_by_name(
68@@ -427,7 +435,9 @@ int nss_group_record_by_name( 68@@ -426,7 +434,9 @@ int nss_group_record_by_name(
69 struct group grp, *result; 69 struct group grp, *result;
70 bool incomplete = false; 70 bool incomplete = false;
71 size_t buflen = 4096; 71 size_t buflen = 4096;
@@ -75,7 +75,7 @@ index 88b8fc2f8f..a819d41bac 100644
75 int r; 75 int r;
76 76
77 assert(name); 77 assert(name);
78@@ -457,6 +467,7 @@ int nss_group_record_by_name( 78@@ -455,6 +465,7 @@ int nss_group_record_by_name(
79 buf = mfree(buf); 79 buf = mfree(buf);
80 } 80 }
81 81
@@ -83,7 +83,7 @@ index 88b8fc2f8f..a819d41bac 100644
83 if (with_shadow) { 83 if (with_shadow) {
84 r = nss_sgrp_for_group(result, &sgrp, &sbuf); 84 r = nss_sgrp_for_group(result, &sgrp, &sbuf);
85 if (r < 0) { 85 if (r < 0) {
86@@ -468,6 +479,9 @@ int nss_group_record_by_name( 86@@ -466,6 +477,9 @@ int nss_group_record_by_name(
87 incomplete = true; 87 incomplete = true;
88 88
89 r = nss_group_to_group_record(result, sresult, ret); 89 r = nss_group_to_group_record(result, sresult, ret);
@@ -93,7 +93,7 @@ index 88b8fc2f8f..a819d41bac 100644
93 if (r < 0) 93 if (r < 0)
94 return r; 94 return r;
95 95
96@@ -484,7 +498,9 @@ int nss_group_record_by_gid( 96@@ -483,7 +497,9 @@ int nss_group_record_by_gid(
97 struct group grp, *result; 97 struct group grp, *result;
98 bool incomplete = false; 98 bool incomplete = false;
99 size_t buflen = 4096; 99 size_t buflen = 4096;
@@ -102,8 +102,8 @@ index 88b8fc2f8f..a819d41bac 100644
102+#endif 102+#endif
103 int r; 103 int r;
104 104
105 assert(ret); 105 for (;;) {
106@@ -512,6 +528,7 @@ int nss_group_record_by_gid( 106@@ -509,6 +525,7 @@ int nss_group_record_by_gid(
107 buf = mfree(buf); 107 buf = mfree(buf);
108 } 108 }
109 109
@@ -111,7 +111,7 @@ index 88b8fc2f8f..a819d41bac 100644
111 if (with_shadow) { 111 if (with_shadow) {
112 r = nss_sgrp_for_group(result, &sgrp, &sbuf); 112 r = nss_sgrp_for_group(result, &sgrp, &sbuf);
113 if (r < 0) { 113 if (r < 0) {
114@@ -523,6 +540,9 @@ int nss_group_record_by_gid( 114@@ -520,6 +537,9 @@ int nss_group_record_by_gid(
115 incomplete = true; 115 incomplete = true;
116 116
117 r = nss_group_to_group_record(result, sresult, ret); 117 r = nss_group_to_group_record(result, sresult, ret);
@@ -138,27 +138,27 @@ index 22ab04d6ee..4e52e7a911 100644
138 #include <shadow.h> 138 #include <shadow.h>
139 139
140diff --git a/src/shared/userdb.c b/src/shared/userdb.c 140diff --git a/src/shared/userdb.c b/src/shared/userdb.c
141index 2d480283d1..0d19764f2e 100644 141index f60d48ace4..e878199a28 100644
142--- a/src/shared/userdb.c 142--- a/src/shared/userdb.c
143+++ b/src/shared/userdb.c 143+++ b/src/shared/userdb.c
144@@ -929,13 +929,16 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) { 144@@ -1038,13 +1038,15 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
145 if (gr) { 145 if (gr) {
146 _cleanup_free_ char *buffer = NULL; 146 _cleanup_free_ char *buffer = NULL;
147 bool incomplete = false; 147 bool incomplete = false;
148+#if ENABLE_GSHADOW 148+#if ENABLE_GSHADOW
149 struct sgrp sgrp; 149 struct sgrp sgrp;
150-
150+#endif 151+#endif
151
152 if (streq_ptr(gr->gr_name, "root")) 152 if (streq_ptr(gr->gr_name, "root"))
153 iterator->synthesize_root = false; 153 iterator->synthesize_root = false;
154 if (gr->gr_gid == GID_NOBODY) 154 if (gr->gr_gid == GID_NOBODY)
155 iterator->synthesize_nobody = false; 155 iterator->synthesize_nobody = false;
156 156
157+#if ENABLE_GSHADOW 157+#if ENABLE_GSHADOW
158 r = nss_sgrp_for_group(gr, &sgrp, &buffer); 158 if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) {
159 if (r < 0) { 159 r = nss_sgrp_for_group(gr, &sgrp, &buffer);
160 log_debug_errno(r, "Failed to acquire shadow entry for group %s, ignoring: %m", gr->gr_name); 160 if (r < 0) {
161@@ -943,6 +946,9 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) { 161@@ -1057,6 +1059,9 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
162 } 162 }
163 163
164 r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret); 164 r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
@@ -169,5 +169,5 @@ index 2d480283d1..0d19764f2e 100644
169 return r; 169 return r;
170 170
171-- 171--
1722.27.0 1722.34.1
173 173
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 @@
1From 3dc9d9d410bcce54fddfd94f43f7f77f3aa8e281 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 12 Apr 2021 23:44:53 -0700
4Subject: [PATCH 15/22] missing_syscall.h: Define MIPS ABI defines for musl
5
6musl does not define _MIPS_SIM_ABI32, _MIPS_SIM_NABI32, _MIPS_SIM_ABI64
7unlike glibc where these are provided by libc headers, therefore define
8them here in case they are undefined
9
10Upstream-Status: Pending
11
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13---
14 src/basic/missing_syscall.h | 6 ++++++
15 src/shared/base-filesystem.c | 1 +
16 2 files changed, 7 insertions(+)
17
18diff --git a/src/basic/missing_syscall.h b/src/basic/missing_syscall.h
19index d795efd8f2..d6729d3c1d 100644
20--- a/src/basic/missing_syscall.h
21+++ b/src/basic/missing_syscall.h
22@@ -20,6 +20,12 @@
23 #include <asm/sgidefs.h>
24 #endif
25
26+#ifndef _MIPS_SIM_ABI32
27+#define _MIPS_SIM_ABI32 1
28+#define _MIPS_SIM_NABI32 2
29+#define _MIPS_SIM_ABI64 3
30+#endif
31+
32 #include "macro.h"
33 #include "missing_keyctl.h"
34 #include "missing_stat.h"
35diff --git a/src/shared/base-filesystem.c b/src/shared/base-filesystem.c
36index 7ae921a113..0ef9d1fd39 100644
37--- a/src/shared/base-filesystem.c
38+++ b/src/shared/base-filesystem.c
39@@ -20,6 +20,7 @@
40 #include "string-util.h"
41 #include "umask-util.h"
42 #include "user-util.h"
43+#include "missing_syscall.h"
44
45 typedef struct BaseFilesystem {
46 const char *dir; /* directory or symlink to create */
47--
482.34.1
49
diff --git a/meta/recipes-core/systemd/systemd/0016-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch b/meta/recipes-core/systemd/systemd/0016-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch
deleted file mode 100644
index 9a125de638..0000000000
--- a/meta/recipes-core/systemd/systemd/0016-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch
+++ /dev/null
@@ -1,35 +0,0 @@
1From 0c7af5f288231a8c0545e169e01ba5ee173cafe7 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 15:18:00 +0800
4Subject: [PATCH 16/26] Hide __start_BUS_ERROR_MAP and __stop_BUS_ERROR_MAP
5
6for currently unknown reasons they get exported to the shared libries
7even without being listed in the sym file
8
9Upstream-Status: Pending
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12[Rebased for v241]
13Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
14---
15 src/libsystemd/sd-bus/bus-error.c | 4 ++--
16 1 file changed, 2 insertions(+), 2 deletions(-)
17
18diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
19index 9605a9b869..38b6cf90c3 100644
20--- a/src/libsystemd/sd-bus/bus-error.c
21+++ b/src/libsystemd/sd-bus/bus-error.c
22@@ -55,8 +55,8 @@ BUS_ERROR_MAP_ELF_REGISTER const sd_bus_error_map bus_standard_errors[] = {
23 };
24
25 /* GCC maps this magically to the beginning and end of the BUS_ERROR_MAP section */
26-extern const sd_bus_error_map __start_SYSTEMD_BUS_ERROR_MAP[];
27-extern const sd_bus_error_map __stop_SYSTEMD_BUS_ERROR_MAP[];
28+extern const sd_bus_error_map __start_SYSTEMD_BUS_ERROR_MAP[] _hidden_;
29+extern const sd_bus_error_map __stop_SYSTEMD_BUS_ERROR_MAP[] _hidden_;
30
31 /* Additional maps registered with sd_bus_error_add_map() are in this
32 * NULL terminated array */
33--
342.27.0
35
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 @@
1From 0994b59dba9f248ad31cb7087046dc00b72cb4ea Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 21 Jan 2022 15:15:11 -0800
4Subject: [PATCH 16/22] pass correct parameters to getdents64
5
6Fixes
7../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]
8 n = getdents64(dir_fd, (uint8_t*) de->buffer + de->buffer_size, bs - de->buffer_size);
9 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10
11../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]
12 n = getdents64(fd, &buffer, sizeof(buffer));
13 ^~~~~~~
14
15Upstream-Status: Inappropriate [musl specific]
16Signed-off-by: Khem Raj <raj.khem@gmail.com>
17Signed-off-by: Jiaqing Zhao <jiaqing.zhao@linux.intel.com>
18---
19 src/basic/recurse-dir.c | 2 +-
20 1 file changed, 1 insertion(+), 1 deletion(-)
21
22diff --git a/src/basic/recurse-dir.c b/src/basic/recurse-dir.c
23index 5e98b7a5d8..aef065047b 100644
24--- a/src/basic/recurse-dir.c
25+++ b/src/basic/recurse-dir.c
26@@ -55,7 +55,7 @@ int readdir_all(int dir_fd,
27 bs = MIN(MALLOC_SIZEOF_SAFE(de) - offsetof(DirectoryEntries, buffer), (size_t) SSIZE_MAX);
28 assert(bs > de->buffer_size);
29
30- n = getdents64(dir_fd, (uint8_t*) de->buffer + de->buffer_size, bs - de->buffer_size);
31+ n = getdents64(dir_fd, (struct dirent*)((uint8_t*) de->buffer + de->buffer_size), bs - de->buffer_size);
32 if (n < 0)
33 return -errno;
34 if (n == 0)
35--
362.34.1
37
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 @@
1From 3c094d443ca30f19114392fd8ef274af6eabc12d Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 21 Jan 2022 22:19:37 -0800
4Subject: [PATCH 17/22] Adjust for musl headers
5
6Upstream-Status: Inappropriate [musl specific]
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9
10[Rebased for v255.1]
11Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
12---
13 src/libsystemd-network/sd-dhcp6-client.c | 2 +-
14 src/network/netdev/bareudp.c | 2 +-
15 src/network/netdev/batadv.c | 2 +-
16 src/network/netdev/bond.c | 2 +-
17 src/network/netdev/bridge.c | 2 +-
18 src/network/netdev/dummy.c | 2 +-
19 src/network/netdev/geneve.c | 2 +-
20 src/network/netdev/ifb.c | 2 +-
21 src/network/netdev/ipoib.c | 2 +-
22 src/network/netdev/ipvlan.c | 2 +-
23 src/network/netdev/macsec.c | 2 +-
24 src/network/netdev/macvlan.c | 2 +-
25 src/network/netdev/netdev.c | 2 +-
26 src/network/netdev/netdevsim.c | 2 +-
27 src/network/netdev/nlmon.c | 2 +-
28 src/network/netdev/tunnel.c | 2 +-
29 src/network/netdev/vcan.c | 2 +-
30 src/network/netdev/veth.c | 2 +-
31 src/network/netdev/vlan.c | 2 +-
32 src/network/netdev/vrf.c | 2 +-
33 src/network/netdev/vxcan.c | 2 +-
34 src/network/netdev/vxlan.c | 2 +-
35 src/network/netdev/wireguard.c | 2 +-
36 src/network/netdev/xfrm.c | 2 +-
37 src/network/networkd-bridge-mdb.c | 4 ++--
38 src/network/networkd-dhcp-common.c | 3 ++-
39 src/network/networkd-dhcp-prefix-delegation.c | 3 ++-
40 src/network/networkd-dhcp-server.c | 2 +-
41 src/network/networkd-dhcp4.c | 2 +-
42 src/network/networkd-ipv6ll.c | 2 +-
43 src/network/networkd-link.c | 2 +-
44 src/network/networkd-ndisc.c | 2 +-
45 src/network/networkd-route.c | 8 ++++----
46 src/network/networkd-setlink.c | 2 +-
47 src/network/networkd-sysctl.c | 2 +-
48 src/shared/linux/ethtool.h | 3 ++-
49 src/shared/netif-util.c | 2 +-
50 src/udev/udev-builtin-net_id.c | 2 +-
51 38 files changed, 45 insertions(+), 42 deletions(-)
52
53diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
54index c20367dfc9..b8d4cd8c2a 100644
55--- a/src/libsystemd-network/sd-dhcp6-client.c
56+++ b/src/libsystemd-network/sd-dhcp6-client.c
57@@ -5,7 +5,7 @@
58
59 #include <errno.h>
60 #include <sys/ioctl.h>
61-#include <linux/if_arp.h>
62+//#include <linux/if_arp.h>
63 #include <linux/if_infiniband.h>
64
65 #include "sd-dhcp6-client.h"
66diff --git a/src/network/netdev/bareudp.c b/src/network/netdev/bareudp.c
67index 1df886573b..c8b6714726 100644
68--- a/src/network/netdev/bareudp.c
69+++ b/src/network/netdev/bareudp.c
70@@ -2,7 +2,7 @@
71 * Copyright © 2020 VMware, Inc. */
72
73 #include <netinet/in.h>
74-#include <linux/if_arp.h>
75+//#include <linux/if_arp.h>
76
77 #include "bareudp.h"
78 #include "netlink-util.h"
79diff --git a/src/network/netdev/batadv.c b/src/network/netdev/batadv.c
80index 26da0231d4..2e8002af8c 100644
81--- a/src/network/netdev/batadv.c
82+++ b/src/network/netdev/batadv.c
83@@ -3,7 +3,7 @@
84 #include <inttypes.h>
85 #include <netinet/in.h>
86 #include <linux/genetlink.h>
87-#include <linux/if_arp.h>
88+//#include <linux/if_arp.h>
89
90 #include "batadv.h"
91 #include "fileio.h"
92diff --git a/src/network/netdev/bond.c b/src/network/netdev/bond.c
93index 4d75a0d6bf..985b3197e0 100644
94--- a/src/network/netdev/bond.c
95+++ b/src/network/netdev/bond.c
96@@ -1,7 +1,7 @@
97 /* SPDX-License-Identifier: LGPL-2.1-or-later */
98
99 #include <netinet/in.h>
100-#include <linux/if_arp.h>
101+//#include <linux/if_arp.h>
102
103 #include "alloc-util.h"
104 #include "bond.h"
105diff --git a/src/network/netdev/bridge.c b/src/network/netdev/bridge.c
106index 3e394edadf..f12f667687 100644
107--- a/src/network/netdev/bridge.c
108+++ b/src/network/netdev/bridge.c
109@@ -2,7 +2,7 @@
110
111 #include <net/if.h>
112 #include <netinet/in.h>
113-#include <linux/if_arp.h>
114+//#include <linux/if_arp.h>
115 #include <linux/if_bridge.h>
116
117 #include "bridge.h"
118diff --git a/src/network/netdev/dummy.c b/src/network/netdev/dummy.c
119index 00df1d2787..77b506b422 100644
120--- a/src/network/netdev/dummy.c
121+++ b/src/network/netdev/dummy.c
122@@ -1,6 +1,6 @@
123 /* SPDX-License-Identifier: LGPL-2.1-or-later */
124
125-#include <linux/if_arp.h>
126+//#include <linux/if_arp.h>
127
128 #include "dummy.h"
129
130diff --git a/src/network/netdev/geneve.c b/src/network/netdev/geneve.c
131index bc655ec7ff..a77e8e17e4 100644
132--- a/src/network/netdev/geneve.c
133+++ b/src/network/netdev/geneve.c
134@@ -2,7 +2,7 @@
135
136 #include <net/if.h>
137 #include <netinet/in.h>
138-#include <linux/if_arp.h>
139+//#include <linux/if_arp.h>
140
141 #include "alloc-util.h"
142 #include "conf-parser.h"
143diff --git a/src/network/netdev/ifb.c b/src/network/netdev/ifb.c
144index d7ff44cb9e..e037629ae4 100644
145--- a/src/network/netdev/ifb.c
146+++ b/src/network/netdev/ifb.c
147@@ -1,7 +1,7 @@
148 /* SPDX-License-Identifier: LGPL-2.1-or-later
149 * Copyright © 2019 VMware, Inc. */
150
151-#include <linux/if_arp.h>
152+//#include <linux/if_arp.h>
153
154 #include "ifb.h"
155
156diff --git a/src/network/netdev/ipoib.c b/src/network/netdev/ipoib.c
157index d5fe299b7b..c9c8002eac 100644
158--- a/src/network/netdev/ipoib.c
159+++ b/src/network/netdev/ipoib.c
160@@ -1,6 +1,6 @@
161 /* SPDX-License-Identifier: LGPL-2.1-or-later */
162
163-#include <linux/if_arp.h>
164+//#include <linux/if_arp.h>
165 #include <linux/if_link.h>
166
167 #include "ipoib.h"
168diff --git a/src/network/netdev/ipvlan.c b/src/network/netdev/ipvlan.c
169index 05d5d010f6..d440f49537 100644
170--- a/src/network/netdev/ipvlan.c
171+++ b/src/network/netdev/ipvlan.c
172@@ -2,7 +2,7 @@
173
174 #include <net/if.h>
175 #include <netinet/in.h>
176-#include <linux/if_arp.h>
177+//#include <linux/if_arp.h>
178
179 #include "conf-parser.h"
180 #include "ipvlan.h"
181diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
182index 17d6acefb6..679d0984f9 100644
183--- a/src/network/netdev/macsec.c
184+++ b/src/network/netdev/macsec.c
185@@ -1,7 +1,7 @@
186 /* SPDX-License-Identifier: LGPL-2.1-or-later */
187
188 #include <netinet/in.h>
189-#include <linux/if_arp.h>
190+//#include <linux/if_arp.h>
191 #include <linux/if_ether.h>
192 #include <linux/if_macsec.h>
193 #include <linux/genetlink.h>
194diff --git a/src/network/netdev/macvlan.c b/src/network/netdev/macvlan.c
195index 203807e3a5..8ab09a387e 100644
196--- a/src/network/netdev/macvlan.c
197+++ b/src/network/netdev/macvlan.c
198@@ -2,7 +2,7 @@
199
200 #include <net/if.h>
201 #include <netinet/in.h>
202-#include <linux/if_arp.h>
203+//#include <linux/if_arp.h>
204
205 #include "conf-parser.h"
206 #include "macvlan.h"
207diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
208index 57127a861a..7f787d0b9f 100644
209--- a/src/network/netdev/netdev.c
210+++ b/src/network/netdev/netdev.c
211@@ -2,7 +2,7 @@
212
213 #include <net/if.h>
214 #include <netinet/in.h>
215-#include <linux/if_arp.h>
216+//#include <linux/if_arp.h>
217 #include <unistd.h>
218
219 #include "alloc-util.h"
220diff --git a/src/network/netdev/netdevsim.c b/src/network/netdev/netdevsim.c
221index 15d5c132f9..a3ffa48b15 100644
222--- a/src/network/netdev/netdevsim.c
223+++ b/src/network/netdev/netdevsim.c
224@@ -1,6 +1,6 @@
225 /* SPDX-License-Identifier: LGPL-2.1-or-later */
226
227-#include <linux/if_arp.h>
228+//#include <linux/if_arp.h>
229
230 #include "netdevsim.h"
231
232diff --git a/src/network/netdev/nlmon.c b/src/network/netdev/nlmon.c
233index ff372092e6..eef66811f4 100644
234--- a/src/network/netdev/nlmon.c
235+++ b/src/network/netdev/nlmon.c
236@@ -1,6 +1,6 @@
237 /* SPDX-License-Identifier: LGPL-2.1-or-later */
238
239-#include <linux/if_arp.h>
240+//#include <linux/if_arp.h>
241
242 #include "nlmon.h"
243
244diff --git a/src/network/netdev/tunnel.c b/src/network/netdev/tunnel.c
245index db84e7cf6e..93d5642962 100644
246--- a/src/network/netdev/tunnel.c
247+++ b/src/network/netdev/tunnel.c
248@@ -2,7 +2,7 @@
249
250 #include <netinet/in.h>
251 #include <linux/fou.h>
252-#include <linux/if_arp.h>
253+//#include <linux/if_arp.h>
254 #include <linux/if_tunnel.h>
255 #include <linux/ip.h>
256 #include <linux/ip6_tunnel.h>
257diff --git a/src/network/netdev/vcan.c b/src/network/netdev/vcan.c
258index 380547ee1e..137c1adf8a 100644
259--- a/src/network/netdev/vcan.c
260+++ b/src/network/netdev/vcan.c
261@@ -1,6 +1,6 @@
262 /* SPDX-License-Identifier: LGPL-2.1-or-later */
263
264-#include <linux/if_arp.h>
265+//#include <linux/if_arp.h>
266
267 #include "vcan.h"
268
269diff --git a/src/network/netdev/veth.c b/src/network/netdev/veth.c
270index e0f5b4ebb1..8a424ed03d 100644
271--- a/src/network/netdev/veth.c
272+++ b/src/network/netdev/veth.c
273@@ -3,7 +3,7 @@
274 #include <errno.h>
275 #include <net/if.h>
276 #include <netinet/in.h>
277-#include <linux/if_arp.h>
278+//#include <linux/if_arp.h>
279 #include <linux/veth.h>
280
281 #include "netlink-util.h"
282diff --git a/src/network/netdev/vlan.c b/src/network/netdev/vlan.c
283index 2390206993..efec630e30 100644
284--- a/src/network/netdev/vlan.c
285+++ b/src/network/netdev/vlan.c
286@@ -2,7 +2,7 @@
287
288 #include <errno.h>
289 #include <net/if.h>
290-#include <linux/if_arp.h>
291+//#include <linux/if_arp.h>
292 #include <linux/if_vlan.h>
293
294 #include "parse-util.h"
295diff --git a/src/network/netdev/vrf.c b/src/network/netdev/vrf.c
296index b75ec2bcc6..6aeeea640b 100644
297--- a/src/network/netdev/vrf.c
298+++ b/src/network/netdev/vrf.c
299@@ -2,7 +2,7 @@
300
301 #include <net/if.h>
302 #include <netinet/in.h>
303-#include <linux/if_arp.h>
304+//#include <linux/if_arp.h>
305
306 #include "vrf.h"
307
308diff --git a/src/network/netdev/vxcan.c b/src/network/netdev/vxcan.c
309index c0343f45b6..f9e718f40b 100644
310--- a/src/network/netdev/vxcan.c
311+++ b/src/network/netdev/vxcan.c
312@@ -1,7 +1,7 @@
313 /* SPDX-License-Identifier: LGPL-2.1-or-later */
314
315 #include <linux/can/vxcan.h>
316-#include <linux/if_arp.h>
317+//#include <linux/if_arp.h>
318
319 #include "vxcan.h"
320
321diff --git a/src/network/netdev/vxlan.c b/src/network/netdev/vxlan.c
322index b11fdbbd0d..a971a917f0 100644
323--- a/src/network/netdev/vxlan.c
324+++ b/src/network/netdev/vxlan.c
325@@ -2,7 +2,7 @@
326
327 #include <net/if.h>
328 #include <netinet/in.h>
329-#include <linux/if_arp.h>
330+//#include <linux/if_arp.h>
331
332 #include "conf-parser.h"
333 #include "alloc-util.h"
334diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c
335index 4c7d837c41..6df6dfb816 100644
336--- a/src/network/netdev/wireguard.c
337+++ b/src/network/netdev/wireguard.c
338@@ -6,7 +6,7 @@
339 #include <sys/ioctl.h>
340 #include <net/if.h>
341 #include <netinet/in.h>
342-#include <linux/if_arp.h>
343+//#include <linux/if_arp.h>
344 #include <linux/ipv6_route.h>
345
346 #include "sd-resolve.h"
347diff --git a/src/network/netdev/xfrm.c b/src/network/netdev/xfrm.c
348index 905bfc0bdf..39e34dbb3b 100644
349--- a/src/network/netdev/xfrm.c
350+++ b/src/network/netdev/xfrm.c
351@@ -1,6 +1,6 @@
352 /* SPDX-License-Identifier: LGPL-2.1-or-later */
353
354-#include <linux/if_arp.h>
355+//#include <linux/if_arp.h>
356
357 #include "missing_network.h"
358 #include "xfrm.h"
359diff --git a/src/network/networkd-bridge-mdb.c b/src/network/networkd-bridge-mdb.c
360index bd1a9745dc..949d3da029 100644
361--- a/src/network/networkd-bridge-mdb.c
362+++ b/src/network/networkd-bridge-mdb.c
363@@ -1,7 +1,5 @@
364 /* SPDX-License-Identifier: LGPL-2.1-or-later */
365
366-#include <net/if.h>
367-#include <linux/if_bridge.h>
368
369 #include "netlink-util.h"
370 #include "networkd-bridge-mdb.h"
371@@ -11,6 +9,8 @@
372 #include "networkd-queue.h"
373 #include "string-util.h"
374 #include "vlan-util.h"
375+#include <net/if.h>
376+#include <linux/if_bridge.h>
377
378 #define STATIC_BRIDGE_MDB_ENTRIES_PER_NETWORK_MAX 1024U
379
380diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
381index 080b15387c..efe8283957 100644
382--- a/src/network/networkd-dhcp-common.c
383+++ b/src/network/networkd-dhcp-common.c
384@@ -1,7 +1,8 @@
385 /* SPDX-License-Identifier: LGPL-2.1-or-later */
386
387 #include <netinet/in.h>
388-#include <linux/if_arp.h>
389+//#include <linux/if_arp.h>
390+#include <net/if.h>
391
392 #include "bus-error.h"
393 #include "bus-locator.h"
394diff --git a/src/network/networkd-dhcp-prefix-delegation.c b/src/network/networkd-dhcp-prefix-delegation.c
395index af2fe9efcd..511565700f 100644
396--- a/src/network/networkd-dhcp-prefix-delegation.c
397+++ b/src/network/networkd-dhcp-prefix-delegation.c
398@@ -1,6 +1,5 @@
399 /* SPDX-License-Identifier: LGPL-2.1-or-later */
400
401-#include <linux/ipv6_route.h>
402
403 #include "dhcp6-lease-internal.h"
404 #include "hashmap.h"
405@@ -20,6 +19,8 @@
406 #include "strv.h"
407 #include "tunnel.h"
408
409+#include <linux/ipv6_route.h>
410+
411 bool link_dhcp_pd_is_enabled(Link *link) {
412 assert(link);
413
414diff --git a/src/network/networkd-dhcp-server.c b/src/network/networkd-dhcp-server.c
415index 607fe0053c..9ce4005874 100644
416--- a/src/network/networkd-dhcp-server.c
417+++ b/src/network/networkd-dhcp-server.c
418@@ -1,7 +1,7 @@
419 /* SPDX-License-Identifier: LGPL-2.1-or-later */
420
421 #include <netinet/in.h>
422-#include <linux/if_arp.h>
423+//#include <linux/if_arp.h>
424 #include <linux/if.h>
425
426 #include "sd-dhcp-server.h"
427diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
428index efbae6d868..1ea2151d50 100644
429--- a/src/network/networkd-dhcp4.c
430+++ b/src/network/networkd-dhcp4.c
431@@ -3,7 +3,7 @@
432 #include <netinet/in.h>
433 #include <netinet/ip.h>
434 #include <linux/if.h>
435-#include <linux/if_arp.h>
436+//#include <linux/if_arp.h>
437
438 #include "alloc-util.h"
439 #include "dhcp-client-internal.h"
440diff --git a/src/network/networkd-ipv6ll.c b/src/network/networkd-ipv6ll.c
441index 32229a3fc7..662a345d6e 100644
442--- a/src/network/networkd-ipv6ll.c
443+++ b/src/network/networkd-ipv6ll.c
444@@ -1,7 +1,7 @@
445 /* SPDX-License-Identifier: LGPL-2.1-or-later */
446
447 #include <linux/if.h>
448-#include <linux/if_arp.h>
449+//#include <linux/if_arp.h>
450
451 #include "in-addr-util.h"
452 #include "networkd-address.h"
453diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
454index ee5f0f2c0a..ea5269a2de 100644
455--- a/src/network/networkd-link.c
456+++ b/src/network/networkd-link.c
457@@ -3,7 +3,7 @@
458 #include <net/if.h>
459 #include <netinet/in.h>
460 #include <linux/if.h>
461-#include <linux/if_arp.h>
462+//#include <linux/if_arp.h>
463 #include <linux/if_link.h>
464 #include <linux/netdevice.h>
465 #include <sys/socket.h>
466diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
467index ab9eeb13a5..dd96fe7483 100644
468--- a/src/network/networkd-ndisc.c
469+++ b/src/network/networkd-ndisc.c
470@@ -6,7 +6,7 @@
471 #include <arpa/inet.h>
472 #include <netinet/icmp6.h>
473 #include <linux/if.h>
474-#include <linux/if_arp.h>
475+//#include <linux/if_arp.h>
476
477 #include "sd-ndisc.h"
478
479diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
480index 7218d799fc..30d5574eae 100644
481--- a/src/network/networkd-route.c
482+++ b/src/network/networkd-route.c
483@@ -1,9 +1,5 @@
484 /* SPDX-License-Identifier: LGPL-2.1-or-later */
485
486-#include <linux/icmpv6.h>
487-#include <linux/ipv6_route.h>
488-#include <linux/nexthop.h>
489-
490 #include "alloc-util.h"
491 #include "event-util.h"
492 #include "netlink-util.h"
493@@ -21,6 +17,10 @@
494 #include "vrf.h"
495 #include "wireguard.h"
496
497+#include <linux/icmpv6.h>
498+#include <linux/ipv6_route.h>
499+#include <linux/nexthop.h>
500+
501 int route_new(Route **ret) {
502 _cleanup_(route_freep) Route *route = NULL;
503
504diff --git a/src/network/networkd-setlink.c b/src/network/networkd-setlink.c
505index 2298f9ea3a..7d5f87de53 100644
506--- a/src/network/networkd-setlink.c
507+++ b/src/network/networkd-setlink.c
508@@ -2,7 +2,7 @@
509
510 #include <netinet/in.h>
511 #include <linux/if.h>
512-#include <linux/if_arp.h>
513+//#include <linux/if_arp.h>
514 #include <linux/if_bridge.h>
515
516 #include "missing_network.h"
517diff --git a/src/network/networkd-sysctl.c b/src/network/networkd-sysctl.c
518index 2b226b2e2a..f12a474e2f 100644
519--- a/src/network/networkd-sysctl.c
520+++ b/src/network/networkd-sysctl.c
521@@ -2,7 +2,7 @@
522
523 #include <netinet/in.h>
524 #include <linux/if.h>
525-#include <linux/if_arp.h>
526+//#include <linux/if_arp.h>
527
528 #include "missing_network.h"
529 #include "networkd-link.h"
530diff --git a/src/shared/linux/ethtool.h b/src/shared/linux/ethtool.h
531index 3d1da515c0..3fca9a4faf 100644
532--- a/src/shared/linux/ethtool.h
533+++ b/src/shared/linux/ethtool.h
534@@ -16,7 +16,8 @@
535
536 #include <linux/const.h>
537 #include <linux/types.h>
538-#include <linux/if_ether.h>
539+#include <netinet/if_ether.h>
540+//#include <linux/if_ether.h>
541
542 #include <limits.h> /* for INT_MAX */
543
544diff --git a/src/shared/netif-util.c b/src/shared/netif-util.c
545index f56c5646c1..5af28ff119 100644
546--- a/src/shared/netif-util.c
547+++ b/src/shared/netif-util.c
548@@ -1,7 +1,7 @@
549 /* SPDX-License-Identifier: LGPL-2.1-or-later */
550
551 #include <linux/if.h>
552-#include <linux/if_arp.h>
553+//#include <linux/if_arp.h>
554
555 #include "arphrd-util.h"
556 #include "device-util.h"
557diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c
558index f528a46b8e..830318cda5 100644
559--- a/src/udev/udev-builtin-net_id.c
560+++ b/src/udev/udev-builtin-net_id.c
561@@ -18,7 +18,7 @@
562 #include <stdarg.h>
563 #include <unistd.h>
564 #include <linux/if.h>
565-#include <linux/if_arp.h>
566+//#include <linux/if_arp.h>
567 #include <linux/netdevice.h>
568 #include <linux/pci_regs.h>
569
570--
5712.34.1
572
diff --git a/meta/recipes-core/systemd/systemd/0017-missing_type.h-add-__compar_d_fn_t-definition.patch b/meta/recipes-core/systemd/systemd/0017-missing_type.h-add-__compar_d_fn_t-definition.patch
deleted file mode 100644
index 31747c6b40..0000000000
--- a/meta/recipes-core/systemd/systemd/0017-missing_type.h-add-__compar_d_fn_t-definition.patch
+++ /dev/null
@@ -1,30 +0,0 @@
1From 32dd7a47b87793cd836ab4bb776d1524f24c2d58 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 15:27:54 +0800
4Subject: [PATCH 17/26] missing_type.h: add __compar_d_fn_t definition
5
6Fix the following compile failure:
7src/basic/util.h:71:18: error: unknown type name '__compar_d_fn_t'; did you mean '__compar_fn_t'?
8
9Upstream-Status: Inappropriate [musl specific]
10
11Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
12---
13 src/basic/missing_type.h | 1 +
14 1 file changed, 1 insertion(+)
15
16diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
17index 3df1084ef2..697aa7f58a 100644
18--- a/src/basic/missing_type.h
19+++ b/src/basic/missing_type.h
20@@ -13,6 +13,7 @@
21
22 #ifndef __GLIBC__
23 typedef int (*comparison_fn_t)(const void *, const void *);
24+typedef int (*__compar_d_fn_t) (const void *, const void *, void *);
25 #endif
26
27 #ifndef __COMPAR_FN_T
28--
292.27.0
30
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 @@
1From be02bd0876a061728661535a709d313e39fe1ac3 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 8 Nov 2022 13:31:34 -0800
4Subject: [PATCH 18/22] test-bus-error: strerror() is assumed to be GNU
5 specific version mark it so
6
7Upstream-Status: Inappropriate [Upstream systemd only supports glibc]
8
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10---
11 src/libsystemd/sd-bus/test-bus-error.c | 2 ++
12 src/test/test-errno-util.c | 3 ++-
13 2 files changed, 4 insertions(+), 1 deletion(-)
14
15diff --git a/src/libsystemd/sd-bus/test-bus-error.c b/src/libsystemd/sd-bus/test-bus-error.c
16index a55f3f9856..4123bf3da0 100644
17--- a/src/libsystemd/sd-bus/test-bus-error.c
18+++ b/src/libsystemd/sd-bus/test-bus-error.c
19@@ -99,7 +99,9 @@ TEST(error) {
20 assert_se(!sd_bus_error_is_set(&error));
21 assert_se(sd_bus_error_set_errno(&error, EBUSY) == -EBUSY);
22 assert_se(streq(error.name, "System.Error.EBUSY"));
23+#ifdef __GLIBC__
24 assert_se(streq(error.message, STRERROR(EBUSY)));
25+#endif
26 assert_se(sd_bus_error_has_name(&error, "System.Error.EBUSY"));
27 assert_se(sd_bus_error_get_errno(&error) == EBUSY);
28 assert_se(sd_bus_error_is_set(&error));
29diff --git a/src/test/test-errno-util.c b/src/test/test-errno-util.c
30index 376d532281..967cfd4d67 100644
31--- a/src/test/test-errno-util.c
32+++ b/src/test/test-errno-util.c
33@@ -4,7 +4,7 @@
34 #include "stdio-util.h"
35 #include "string-util.h"
36 #include "tests.h"
37-
38+#ifdef __GLIBC__
39 TEST(strerror_not_threadsafe) {
40 /* Just check that strerror really is not thread-safe. */
41 log_info("strerror(%d) → %s", 200, strerror(200));
42@@ -46,6 +46,7 @@ TEST(STRERROR_OR_ELSE) {
43 log_info("STRERROR_OR_ELSE(EPERM, \"EOF\") → %s", STRERROR_OR_EOF(EPERM));
44 log_info("STRERROR_OR_ELSE(-EPERM, \"EOF\") → %s", STRERROR_OR_EOF(-EPERM));
45 }
46+#endif /* __GLIBC__ */
47
48 TEST(PROTECT_ERRNO) {
49 errno = 12;
50--
512.34.1
52
diff --git a/meta/recipes-core/systemd/systemd/0019-Handle-missing-LOCK_EX.patch b/meta/recipes-core/systemd/systemd/0019-Handle-missing-LOCK_EX.patch
deleted file mode 100644
index 6ca196489b..0000000000
--- a/meta/recipes-core/systemd/systemd/0019-Handle-missing-LOCK_EX.patch
+++ /dev/null
@@ -1,26 +0,0 @@
1From e427f03de2c56e868bb0f24aa231315b2dae1b71 Mon Sep 17 00:00:00 2001
2From: Alex Kiernan <alex.kiernan@gmail.com>
3Date: Fri, 7 Aug 2020 15:19:27 +0000
4Subject: [PATCH 19/26] Handle missing LOCK_EX
5
6Upstream-Status: Inappropriate [musl specific]
7Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
8---
9 src/partition/makefs.c | 1 +
10 1 file changed, 1 insertion(+)
11
12diff --git a/src/partition/makefs.c b/src/partition/makefs.c
13index fd924d2231..b97580fdcc 100644
14--- a/src/partition/makefs.c
15+++ b/src/partition/makefs.c
16@@ -6,6 +6,7 @@
17 #include <sys/stat.h>
18 #include <sys/types.h>
19 #include <unistd.h>
20+#include <sys/file.h>
21
22 #include "alloc-util.h"
23 #include "blockdev-util.h"
24--
252.27.0
26
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 @@
1From 46d80840bfe37e67d4f18c37a77751ea1fe63a07 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 23 Jan 2023 23:39:46 -0800
4Subject: [PATCH 19/22] errno-util: Make STRERROR portable for musl
5
6Sadly, systemd has decided to use yet another GNU extention in a macro
7lets make this such that we can use XSI compliant strerror_r() for
8non-glibc hosts
9
10Upstream-Status: Inappropriate [musl specific]
11
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13---
14 src/basic/errno-util.h | 12 ++++++++++--
15 1 file changed, 10 insertions(+), 2 deletions(-)
16
17diff --git a/src/basic/errno-util.h b/src/basic/errno-util.h
18index 27804e6382..274c1c6ef1 100644
19--- a/src/basic/errno-util.h
20+++ b/src/basic/errno-util.h
21@@ -15,8 +15,16 @@
22 * https://stackoverflow.com/questions/34880638/compound-literal-lifetime-and-if-blocks
23 *
24 * Note that we use the GNU variant of strerror_r() here. */
25-#define STRERROR(errnum) strerror_r(abs(errnum), (char[ERRNO_BUF_LEN]){}, ERRNO_BUF_LEN)
26-
27+static inline const char * STRERROR(int errnum);
28+
29+static inline const char * STRERROR(int errnum) {
30+#ifdef __GLIBC__
31+ return strerror_r(abs(errnum), (char[ERRNO_BUF_LEN]){}, ERRNO_BUF_LEN);
32+#else
33+ static __thread char buf[ERRNO_BUF_LEN];
34+ return strerror_r(abs(errnum), buf, ERRNO_BUF_LEN) ? "unknown error" : buf;
35+#endif
36+}
37 /* A helper to print an error message or message for functions that return 0 on EOF.
38 * Note that we can't use ({ … }) to define a temporary variable, so errnum is
39 * evaluated twice. */
40--
412.34.1
42
diff --git a/meta/recipes-core/systemd/systemd/0020-Fix-incompatible-pointer-type-struct-sockaddr_un.patch b/meta/recipes-core/systemd/systemd/0020-Fix-incompatible-pointer-type-struct-sockaddr_un.patch
deleted file mode 100644
index f74de43849..0000000000
--- a/meta/recipes-core/systemd/systemd/0020-Fix-incompatible-pointer-type-struct-sockaddr_un.patch
+++ /dev/null
@@ -1,40 +0,0 @@
1From 9abbc5e69e21aef0d4d4567e69302fa660b76c53 Mon Sep 17 00:00:00 2001
2From: Alex Kiernan <alex.kiernan@gmail.com>
3Date: Fri, 7 Aug 2020 15:20:17 +0000
4Subject: [PATCH 20/26] Fix incompatible pointer type struct sockaddr_un *
5
6| ../../../../../../workspace/sources/systemd/src/nspawn/nspawn.c: In function 'cant_be_in_netns':
7| ../../../../../../workspace/sources/systemd/src/nspawn/nspawn.c:4893:25: error: passing argument 2 of 'connect' from incompatible pointer type [-Werror=incompatible-pointer-types]
8| 4893 | if (connect(fd, &sa.un, SOCKADDR_UN_LEN(sa.un)) < 0) {
9| | ^~~~~~
10| | |
11| | struct sockaddr_un *
12| In file included from ../../../../../../workspace/sources/systemd/src/systemd/sd-daemon.h:22,
13| from ../../../../../../workspace/sources/systemd/src/nspawn/nspawn.c:21:
14| /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 *'
15| 384 | int connect (int, const struct sockaddr *, socklen_t);
16| | ^~~~~~~~~~~~~~~~~~~~~~~
17| cc1: some warnings being treated as errors
18
19Upstream-Status: Inappropriate [musl specific]
20Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
21---
22 src/nspawn/nspawn.c | 2 +-
23 1 file changed, 1 insertion(+), 1 deletion(-)
24
25diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
26index 0842731c18..3528b7ff14 100644
27--- a/src/nspawn/nspawn.c
28+++ b/src/nspawn/nspawn.c
29@@ -5084,7 +5084,7 @@ static int cant_be_in_netns(void) {
30 if (fd < 0)
31 return log_error_errno(errno, "Failed to allocate udev control socket: %m");
32
33- if (connect(fd, &sa.un, SOCKADDR_UN_LEN(sa.un)) < 0) {
34+ if (connect(fd, (struct sockaddr *)&sa.un, SOCKADDR_UN_LEN(sa.un)) < 0) {
35
36 if (errno == ENOENT || ERRNO_IS_DISCONNECT(errno))
37 return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
38--
392.27.0
40
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 @@
1From 9eb4867b4e2dbdb2484ae854022aff97e2f0feb3 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 2 Aug 2023 12:06:27 -0700
4Subject: [PATCH 20/22] sd-event: Make malloc_trim() conditional on glibc
5
6musl does not have this API
7
8Upstream-Status: Inappropriate [musl-specific]
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10---
11 src/libsystemd/sd-event/sd-event.c | 4 +++-
12 1 file changed, 3 insertions(+), 1 deletion(-)
13
14diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
15index 288798a0dc..6419a7f216 100644
16--- a/src/libsystemd/sd-event/sd-event.c
17+++ b/src/libsystemd/sd-event/sd-event.c
18@@ -1874,7 +1874,7 @@ _public_ int sd_event_add_exit(
19 }
20
21 _public_ int sd_event_trim_memory(void) {
22- int r;
23+ int r = 0;
24
25 /* A default implementation of a memory pressure callback. Simply releases our own allocation caches
26 * and glibc's. This is automatically used when people call sd_event_add_memory_pressure() with a
27@@ -1888,7 +1888,9 @@ _public_ int sd_event_trim_memory(void) {
28
29 usec_t before_timestamp = now(CLOCK_MONOTONIC);
30 hashmap_trim_pools();
31+#ifdef __GLIBC__
32 r = malloc_trim(0);
33+#endif
34 usec_t after_timestamp = now(CLOCK_MONOTONIC);
35
36 if (r > 0)
37--
382.34.1
39
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 @@
1From 502597b9ddd6b145541b23fadca0b1d3ca9f6367 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 2 Aug 2023 12:20:40 -0700
4Subject: [PATCH 21/22] shared: Do not use malloc_info on musl
5
6Upstream-Status: Inappropriate [musl-specific]
7Signed-off-by: Khem Raj <raj.khem@gmail.com>
8---
9 src/shared/bus-util.c | 5 +++--
10 src/shared/common-signal.c | 4 ++--
11 2 files changed, 5 insertions(+), 4 deletions(-)
12
13diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
14index 74f148c8b4..2d862a123d 100644
15--- a/src/shared/bus-util.c
16+++ b/src/shared/bus-util.c
17@@ -611,15 +611,16 @@ static int method_dump_memory_state_by_fd(sd_bus_message *message, void *userdat
18 _cleanup_close_ int fd = -EBADF;
19 size_t dump_size;
20 FILE *f;
21- int r;
22+ int r = 0;
23
24 assert(message);
25
26 f = memstream_init(&m);
27 if (!f)
28 return -ENOMEM;
29-
30+#ifdef __GLIBC__
31 r = RET_NERRNO(malloc_info(/* options= */ 0, f));
32+#endif
33 if (r < 0)
34 return r;
35
36diff --git a/src/shared/common-signal.c b/src/shared/common-signal.c
37index 8e70e365dd..9e782caec9 100644
38--- a/src/shared/common-signal.c
39+++ b/src/shared/common-signal.c
40@@ -65,12 +65,12 @@ int sigrtmin18_handler(sd_event_source *s, const struct signalfd_siginfo *si, vo
41 log_oom();
42 break;
43 }
44-
45+#ifdef __GLIBC__
46 if (malloc_info(0, f) < 0) {
47 log_error_errno(errno, "Failed to invoke malloc_info(): %m");
48 break;
49 }
50-
51+#endif
52 (void) memstream_dump(LOG_INFO, &m);
53 break;
54 }
55--
562.34.1
57
diff --git a/meta/recipes-core/systemd/systemd/0021-test-json.c-define-M_PIl.patch b/meta/recipes-core/systemd/systemd/0021-test-json.c-define-M_PIl.patch
deleted file mode 100644
index fa6652a5bf..0000000000
--- a/meta/recipes-core/systemd/systemd/0021-test-json.c-define-M_PIl.patch
+++ /dev/null
@@ -1,33 +0,0 @@
1From 1f5bc54bed0b365e7e448c26f6c792dbe8b3b198 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 25 Feb 2019 16:53:06 +0800
4Subject: [PATCH 21/26] test-json.c: define M_PIl
5
6Fix the following compile failure:
7src/test/test-json.c:305:50: error: 'M_PIl' undeclared (first use in this function); did you mean 'M_PI'?
8
9Upstream-Status: Inappropriate [musl specific]
10
11Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
12---
13 src/test/test-json.c | 4 ++++
14 1 file changed, 4 insertions(+)
15
16diff --git a/src/test/test-json.c b/src/test/test-json.c
17index 1d4b11945e..572c8cf9d0 100644
18--- a/src/test/test-json.c
19+++ b/src/test/test-json.c
20@@ -13,6 +13,10 @@
21 #include "tests.h"
22 #include "util.h"
23
24+#ifndef M_PIl
25+#define M_PIl 3.141592653589793238462643383279502884L
26+#endif
27+
28 static void test_tokenizer(const char *data, ...) {
29 unsigned line = 0, column = 0;
30 void *state = NULL;
31--
322.27.0
33
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 @@
1From fd52f1764647e03a35e8f0ed0ef952049073ccbd Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Tue, 2 Jan 2024 11:03:27 +0800
4Subject: [PATCH 22/22] avoid missing LOCK_EX declaration
5
6This only happens on MUSL. Include sys/file.h to avoid compilation
7error about missing LOCK_EX declaration.
8
9Upstream-Status: Inappropriate [musl specific]
10
11Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
12---
13 src/core/exec-invoke.c | 1 +
14 src/shared/dev-setup.h | 1 +
15 2 files changed, 2 insertions(+)
16
17diff --git a/src/core/exec-invoke.c b/src/core/exec-invoke.c
18index 70d963e269..7084811439 100644
19--- a/src/core/exec-invoke.c
20+++ b/src/core/exec-invoke.c
21@@ -4,6 +4,7 @@
22 #include <sys/ioctl.h>
23 #include <sys/mount.h>
24 #include <sys/prctl.h>
25+#include <sys/file.h>
26
27 #if HAVE_PAM
28 #include <security/pam_appl.h>
29diff --git a/src/shared/dev-setup.h b/src/shared/dev-setup.h
30index 5339bc4e5e..0697495f23 100644
31--- a/src/shared/dev-setup.h
32+++ b/src/shared/dev-setup.h
33@@ -2,6 +2,7 @@
34 #pragma once
35
36 #include <sys/types.h>
37+#include <sys/file.h>
38
39 int lock_dev_console(void);
40
41--
422.34.1
43
diff --git a/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch b/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch
deleted file mode 100644
index 675fd20f11..0000000000
--- a/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch
+++ /dev/null
@@ -1,413 +0,0 @@
1From 564dba5ad0cd884e3f69fa19ca64095413578ea5 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Fri, 1 Mar 2019 15:22:15 +0800
4Subject: [PATCH 22/26] do not disable buffer in writing files
5
6Do not disable buffer in writing files, otherwise we get
7failure at boot for musl like below.
8
9 [!!!!!!] Failed to allocate manager object.
10
11And there will be other failures, critical or not critical.
12This is specific to musl.
13
14Upstream-Status: Inappropriate [musl]
15
16Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
17[Rebased for v242]
18Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
19[rebased for systemd 243]
20Signed-off-by: Scott Murray <scott.murray@konsulko.com>
21---
22 src/basic/cgroup-util.c | 10 +++++-----
23 src/basic/procfs-util.c | 4 ++--
24 src/basic/smack-util.c | 2 +-
25 src/basic/util.c | 2 +-
26 src/binfmt/binfmt.c | 6 +++---
27 src/core/main.c | 4 ++--
28 src/core/smack-setup.c | 8 ++++----
29 src/hibernate-resume/hibernate-resume.c | 2 +-
30 src/libsystemd/sd-device/sd-device.c | 2 +-
31 src/login/logind-dbus.c | 2 +-
32 src/nspawn/nspawn-cgroup.c | 2 +-
33 src/nspawn/nspawn.c | 6 +++---
34 src/shared/cgroup-setup.c | 4 ++--
35 src/shared/sysctl-util.c | 2 +-
36 src/sleep/sleep.c | 8 ++++----
37 src/udev/udevadm-trigger.c | 2 +-
38 src/udev/udevd.c | 2 +-
39 src/vconsole/vconsole-setup.c | 2 +-
40 18 files changed, 35 insertions(+), 35 deletions(-)
41
42diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
43index bb960f183c..cb804c5f4b 100644
44--- a/src/basic/cgroup-util.c
45+++ b/src/basic/cgroup-util.c
46@@ -759,7 +759,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
47
48 sc = strstrip(contents);
49 if (isempty(sc)) {
50- r = write_string_file(fs, agent, WRITE_STRING_FILE_DISABLE_BUFFER);
51+ r = write_string_file(fs, agent, 0);
52 if (r < 0)
53 return r;
54 } else if (!path_equal(sc, agent))
55@@ -777,7 +777,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
56
57 sc = strstrip(contents);
58 if (streq(sc, "0")) {
59- r = write_string_file(fs, "1", WRITE_STRING_FILE_DISABLE_BUFFER);
60+ r = write_string_file(fs, "1", 0);
61 if (r < 0)
62 return r;
63
64@@ -804,7 +804,7 @@ int cg_uninstall_release_agent(const char *controller) {
65 if (r < 0)
66 return r;
67
68- r = write_string_file(fs, "0", WRITE_STRING_FILE_DISABLE_BUFFER);
69+ r = write_string_file(fs, "0", 0);
70 if (r < 0)
71 return r;
72
73@@ -814,7 +814,7 @@ int cg_uninstall_release_agent(const char *controller) {
74 if (r < 0)
75 return r;
76
77- r = write_string_file(fs, "", WRITE_STRING_FILE_DISABLE_BUFFER);
78+ r = write_string_file(fs, "", 0);
79 if (r < 0)
80 return r;
81
82@@ -1646,7 +1646,7 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri
83 if (r < 0)
84 return r;
85
86- return write_string_file(p, value, WRITE_STRING_FILE_DISABLE_BUFFER);
87+ return write_string_file(p, value, 0);
88 }
89
90 int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret) {
91diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c
92index 8f9eee8d36..480f8cc0b4 100644
93--- a/src/basic/procfs-util.c
94+++ b/src/basic/procfs-util.c
95@@ -86,13 +86,13 @@ int procfs_tasks_set_limit(uint64_t limit) {
96 * decrease it, as threads-max is the much more relevant sysctl. */
97 if (limit > pid_max-1) {
98 sprintf(buffer, "%" PRIu64, limit+1); /* Add one, since PID 0 is not a valid PID */
99- r = write_string_file("/proc/sys/kernel/pid_max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER);
100+ r = write_string_file("/proc/sys/kernel/pid_max", buffer, 0);
101 if (r < 0)
102 return r;
103 }
104
105 sprintf(buffer, "%" PRIu64, limit);
106- r = write_string_file("/proc/sys/kernel/threads-max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER);
107+ r = write_string_file("/proc/sys/kernel/threads-max", buffer, 0);
108 if (r < 0) {
109 uint64_t threads_max;
110
111diff --git a/src/basic/smack-util.c b/src/basic/smack-util.c
112index 3362ee3924..80c0f2a52e 100644
113--- a/src/basic/smack-util.c
114+++ b/src/basic/smack-util.c
115@@ -114,7 +114,7 @@ int mac_smack_apply_pid(pid_t pid, const char *label) {
116 return 0;
117
118 p = procfs_file_alloca(pid, "attr/current");
119- r = write_string_file(p, label, WRITE_STRING_FILE_DISABLE_BUFFER);
120+ r = write_string_file(p, label, 0);
121 if (r < 0)
122 return r;
123
124diff --git a/src/basic/util.c b/src/basic/util.c
125index f98ecf3858..13e0f7431f 100644
126--- a/src/basic/util.c
127+++ b/src/basic/util.c
128@@ -267,7 +267,7 @@ void disable_coredumps(void) {
129 if (detect_container() > 0)
130 return;
131
132- r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", WRITE_STRING_FILE_DISABLE_BUFFER);
133+ r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", 0);
134 if (r < 0)
135 log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m");
136 }
137diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c
138index 43ed2f385b..37a6f578f7 100644
139--- a/src/binfmt/binfmt.c
140+++ b/src/binfmt/binfmt.c
141@@ -48,7 +48,7 @@ static int delete_rule(const char *rule) {
142 if (!fn)
143 return log_oom();
144
145- return write_string_file(fn, "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
146+ return write_string_file(fn, "-1", 0);
147 }
148
149 static int apply_rule(const char *rule) {
150@@ -56,7 +56,7 @@ static int apply_rule(const char *rule) {
151
152 (void) delete_rule(rule);
153
154- r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, WRITE_STRING_FILE_DISABLE_BUFFER);
155+ r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, 0);
156 if (r < 0)
157 return log_error_errno(r, "Failed to add binary format: %m");
158
159@@ -223,7 +223,7 @@ static int run(int argc, char *argv[]) {
160 }
161
162 /* Flush out all rules */
163- (void) write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
164+ (void) write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0);
165
166 STRV_FOREACH(f, files) {
167 k = apply_file(*f, true);
168diff --git a/src/core/main.c b/src/core/main.c
169index a280b756ff..334532cd42 100644
170--- a/src/core/main.c
171+++ b/src/core/main.c
172@@ -1382,7 +1382,7 @@ static int bump_unix_max_dgram_qlen(void) {
173 if (v >= DEFAULT_UNIX_MAX_DGRAM_QLEN)
174 return 0;
175
176- r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", WRITE_STRING_FILE_DISABLE_BUFFER, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN);
177+ r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", 0, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN);
178 if (r < 0)
179 return log_full_errno(IN_SET(r, -EROFS, -EPERM, -EACCES) ? LOG_DEBUG : LOG_WARNING, r,
180 "Failed to bump AF_UNIX datagram queue length, ignoring: %m");
181@@ -1666,7 +1666,7 @@ static void initialize_core_pattern(bool skip_setup) {
182 if (getpid_cached() != 1)
183 return;
184
185- r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, WRITE_STRING_FILE_DISABLE_BUFFER);
186+ r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, 0);
187 if (r < 0)
188 log_warning_errno(r, "Failed to write '%s' to /proc/sys/kernel/core_pattern, ignoring: %m", arg_early_core_pattern);
189 }
190diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c
191index 1fe592af70..603942a000 100644
192--- a/src/core/smack-setup.c
193+++ b/src/core/smack-setup.c
194@@ -325,17 +325,17 @@ int mac_smack_setup(bool *loaded_policy) {
195 }
196
197 #ifdef SMACK_RUN_LABEL
198- r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
199+ r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, 0);
200 if (r < 0)
201 log_warning_errno(r, "Failed to set SMACK label \"" SMACK_RUN_LABEL "\" on self: %m");
202- r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
203+ r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, 0);
204 if (r < 0)
205 log_warning_errno(r, "Failed to set SMACK ambient label \"" SMACK_RUN_LABEL "\": %m");
206 r = write_string_file("/sys/fs/smackfs/netlabel",
207- "0.0.0.0/0 " SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
208+ "0.0.0.0/0 " SMACK_RUN_LABEL, 0);
209 if (r < 0)
210 log_warning_errno(r, "Failed to set SMACK netlabel rule \"0.0.0.0/0 " SMACK_RUN_LABEL "\": %m");
211- r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", WRITE_STRING_FILE_DISABLE_BUFFER);
212+ r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", 0);
213 if (r < 0)
214 log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m");
215 #endif
216diff --git a/src/hibernate-resume/hibernate-resume.c b/src/hibernate-resume/hibernate-resume.c
217index d8f91f4e66..a088e6e2d8 100644
218--- a/src/hibernate-resume/hibernate-resume.c
219+++ b/src/hibernate-resume/hibernate-resume.c
220@@ -45,7 +45,7 @@ int main(int argc, char *argv[]) {
221 return EXIT_FAILURE;
222 }
223
224- r = write_string_file("/sys/power/resume", major_minor, WRITE_STRING_FILE_DISABLE_BUFFER);
225+ r = write_string_file("/sys/power/resume", major_minor, 0);
226 if (r < 0) {
227 log_error_errno(r, "Failed to write '%s' to /sys/power/resume: %m", major_minor);
228 return EXIT_FAILURE;
229diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c
230index d06f90ce1d..43d0a58750 100644
231--- a/src/libsystemd/sd-device/sd-device.c
232+++ b/src/libsystemd/sd-device/sd-device.c
233@@ -1976,7 +1976,7 @@ _public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr,
234 if (!value)
235 return -ENOMEM;
236
237- r = write_string_file(path, value, WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_NOFOLLOW);
238+ r = write_string_file(path, value, 0 | WRITE_STRING_FILE_NOFOLLOW);
239 if (r < 0) {
240 if (r == -ELOOP)
241 return -EINVAL;
242diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
243index 7d757aa286..a5d9da5b7e 100644
244--- a/src/login/logind-dbus.c
245+++ b/src/login/logind-dbus.c
246@@ -1330,7 +1330,7 @@ static int trigger_device(Manager *m, sd_device *d) {
247 if (!t)
248 return -ENOMEM;
249
250- (void) write_string_file(t, "change", WRITE_STRING_FILE_DISABLE_BUFFER);
251+ (void) write_string_file(t, "change", 0);
252 }
253
254 return 0;
255diff --git a/src/nspawn/nspawn-cgroup.c b/src/nspawn/nspawn-cgroup.c
256index cb01b25bc6..e92051268b 100644
257--- a/src/nspawn/nspawn-cgroup.c
258+++ b/src/nspawn/nspawn-cgroup.c
259@@ -124,7 +124,7 @@ int sync_cgroup(pid_t pid, CGroupUnified unified_requested, uid_t uid_shift) {
260 fn = strjoina(tree, cgroup, "/cgroup.procs");
261
262 sprintf(pid_string, PID_FMT, pid);
263- r = write_string_file(fn, pid_string, WRITE_STRING_FILE_DISABLE_BUFFER|WRITE_STRING_FILE_MKDIR_0755);
264+ r = write_string_file(fn, pid_string, WRITE_STRING_FILE_MKDIR_0755);
265 if (r < 0) {
266 log_error_errno(r, "Failed to move process: %m");
267 goto finish;
268diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
269index 3528b7ff14..11b0c20f95 100644
270--- a/src/nspawn/nspawn.c
271+++ b/src/nspawn/nspawn.c
272@@ -2667,7 +2667,7 @@ static int reset_audit_loginuid(void) {
273 if (streq(p, "4294967295"))
274 return 0;
275
276- r = write_string_file("/proc/self/loginuid", "4294967295", WRITE_STRING_FILE_DISABLE_BUFFER);
277+ r = write_string_file("/proc/self/loginuid", "4294967295", 0);
278 if (r < 0) {
279 log_error_errno(r,
280 "Failed to reset audit login UID. This probably means that your kernel is too\n"
281@@ -3920,13 +3920,13 @@ static int setup_uid_map(pid_t pid) {
282
283 xsprintf(uid_map, "/proc/" PID_FMT "/uid_map", pid);
284 xsprintf(line, UID_FMT " " UID_FMT " " UID_FMT "\n", 0, arg_uid_shift, arg_uid_range);
285- r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER);
286+ r = write_string_file(uid_map, line, 0);
287 if (r < 0)
288 return log_error_errno(r, "Failed to write UID map: %m");
289
290 /* We always assign the same UID and GID ranges */
291 xsprintf(uid_map, "/proc/" PID_FMT "/gid_map", pid);
292- r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER);
293+ r = write_string_file(uid_map, line, 0);
294 if (r < 0)
295 return log_error_errno(r, "Failed to write GID map: %m");
296
297diff --git a/src/shared/cgroup-setup.c b/src/shared/cgroup-setup.c
298index f197f715c7..077f893177 100644
299--- a/src/shared/cgroup-setup.c
300+++ b/src/shared/cgroup-setup.c
301@@ -267,7 +267,7 @@ int cg_attach(const char *controller, const char *path, pid_t pid) {
302
303 xsprintf(c, PID_FMT "\n", pid);
304
305- r = write_string_file(fs, c, WRITE_STRING_FILE_DISABLE_BUFFER);
306+ r = write_string_file(fs, c, 0);
307 if (r < 0)
308 return r;
309
310@@ -799,7 +799,7 @@ int cg_enable_everywhere(
311 return log_debug_errno(errno, "Failed to open cgroup.subtree_control file of %s: %m", p);
312 }
313
314- r = write_string_stream(f, s, WRITE_STRING_FILE_DISABLE_BUFFER);
315+ r = write_string_stream(f, s, 0);
316 if (r < 0) {
317 log_debug_errno(r, "Failed to %s controller %s for %s (%s): %m",
318 FLAGS_SET(mask, bit) ? "enable" : "disable", n, p, fs);
319diff --git a/src/shared/sysctl-util.c b/src/shared/sysctl-util.c
320index 670c33108b..7c7c3dcfb6 100644
321--- a/src/shared/sysctl-util.c
322+++ b/src/shared/sysctl-util.c
323@@ -93,7 +93,7 @@ int sysctl_write_ip_property(int af, const char *ifname, const char *property, c
324
325 log_debug("Setting '%s' to '%s'", p, value);
326
327- return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER);
328+ return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | 0);
329 }
330
331 int sysctl_read(const char *property, char **content) {
332diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c
333index 39ab554290..d0e566645d 100644
334--- a/src/sleep/sleep.c
335+++ b/src/sleep/sleep.c
336@@ -48,7 +48,7 @@ static int write_hibernate_location_info(const HibernateLocation *hibernate_loca
337 assert(hibernate_location->swap);
338
339 xsprintf(resume_str, "%u:%u", major(hibernate_location->devno), minor(hibernate_location->devno));
340- r = write_string_file("/sys/power/resume", resume_str, WRITE_STRING_FILE_DISABLE_BUFFER);
341+ r = write_string_file("/sys/power/resume", resume_str, 0);
342 if (r < 0)
343 return log_debug_errno(r, "Failed to write partition device to /sys/power/resume for '%s': '%s': %m",
344 hibernate_location->swap->device, resume_str);
345@@ -75,7 +75,7 @@ static int write_hibernate_location_info(const HibernateLocation *hibernate_loca
346 }
347
348 xsprintf(offset_str, "%" PRIu64, hibernate_location->offset);
349- r = write_string_file("/sys/power/resume_offset", offset_str, WRITE_STRING_FILE_DISABLE_BUFFER);
350+ r = write_string_file("/sys/power/resume_offset", offset_str, 0);
351 if (r < 0)
352 return log_debug_errno(r, "Failed to write swap file offset to /sys/power/resume_offset for '%s': '%s': %m",
353 hibernate_location->swap->device, offset_str);
354@@ -92,7 +92,7 @@ static int write_mode(char **modes) {
355 STRV_FOREACH(mode, modes) {
356 int k;
357
358- k = write_string_file("/sys/power/disk", *mode, WRITE_STRING_FILE_DISABLE_BUFFER);
359+ k = write_string_file("/sys/power/disk", *mode, 0);
360 if (k >= 0)
361 return 0;
362
363@@ -114,7 +114,7 @@ static int write_state(FILE **f, char **states) {
364 STRV_FOREACH(state, states) {
365 int k;
366
367- k = write_string_stream(*f, *state, WRITE_STRING_FILE_DISABLE_BUFFER);
368+ k = write_string_stream(*f, *state, 0);
369 if (k >= 0)
370 return 0;
371 log_debug_errno(k, "Failed to write '%s' to /sys/power/state: %m", *state);
372diff --git a/src/udev/udevadm-trigger.c b/src/udev/udevadm-trigger.c
373index 5c74184c33..65f528314e 100644
374--- a/src/udev/udevadm-trigger.c
375+++ b/src/udev/udevadm-trigger.c
376@@ -43,7 +43,7 @@ static int exec_list(sd_device_enumerator *e, const char *action, Set **settle_s
377 if (!filename)
378 return log_oom();
379
380- r = write_string_file(filename, action, WRITE_STRING_FILE_DISABLE_BUFFER);
381+ r = write_string_file(filename, action, 0);
382 if (r < 0) {
383 bool ignore = IN_SET(r, -ENOENT, -ENODEV);
384
385diff --git a/src/udev/udevd.c b/src/udev/udevd.c
386index d24b8d4398..d123a43904 100644
387--- a/src/udev/udevd.c
388+++ b/src/udev/udevd.c
389@@ -1192,7 +1192,7 @@ static int synthesize_change_one(sd_device *dev, const char *syspath) {
390
391 filename = strjoina(syspath, "/uevent");
392 log_device_debug(dev, "device is closed, synthesising 'change' on %s", syspath);
393- r = write_string_file(filename, "change", WRITE_STRING_FILE_DISABLE_BUFFER);
394+ r = write_string_file(filename, "change", 0);
395 if (r < 0)
396 return log_device_debug_errno(dev, r, "Failed to write 'change' to %s: %m", filename);
397 return 0;
398diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
399index b28e2853e1..115b7233a0 100644
400--- a/src/vconsole/vconsole-setup.c
401+++ b/src/vconsole/vconsole-setup.c
402@@ -116,7 +116,7 @@ static int toggle_utf8_vc(const char *name, int fd, bool utf8) {
403 static int toggle_utf8_sysfs(bool utf8) {
404 int r;
405
406- r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), WRITE_STRING_FILE_DISABLE_BUFFER);
407+ r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), 0);
408 if (r < 0)
409 return log_warning_errno(r, "Failed to %s sysfs UTF-8 flag: %m", enable_disable(utf8));
410
411--
4122.27.0
413
diff --git a/meta/recipes-core/systemd/systemd/0027-proc-dont-trigger-mount-error-with-invalid-options-o.patch b/meta/recipes-core/systemd/systemd/0027-proc-dont-trigger-mount-error-with-invalid-options-o.patch
deleted file mode 100644
index 94a4c307b5..0000000000
--- a/meta/recipes-core/systemd/systemd/0027-proc-dont-trigger-mount-error-with-invalid-options-o.patch
+++ /dev/null
@@ -1,97 +0,0 @@
1From 297aba739cd689e4dc9f43bb1422ec88d481099a Mon Sep 17 00:00:00 2001
2From: Paul Gortmaker <paul.gortmaker@windriver.com>
3Date: Wed, 13 Jan 2021 21:09:33 +0000
4Subject: [PATCH] proc: dont trigger mount error with invalid options on old
5 kernels
6
7As of commit 4e39995371738b04d98d27b0d34ea8fe09ec9fab ("core: introduce
8ProtectProc= and ProcSubset= to expose hidepid= and subset= procfs
9mount options") kernels older than v5.8 generate multple warnings at
10boot, as seen in this Yocto build from today:
11
12 qemux86-64 login: root
13 [ 65.829009] proc: Bad value for 'hidepid'
14 root@qemux86-64:~# dmesg|grep proc:
15 [ 16.990706] proc: Bad value for 'hidepid'
16 [ 28.060178] proc: Bad value for 'hidepid'
17 [ 28.874229] proc: Bad value for 'hidepid'
18 [ 32.685107] proc: Bad value for 'hidepid'
19 [ 65.829009] proc: Bad value for 'hidepid'
20 root@qemux86-64:~#
21
22The systemd maintainer has dismissed this as something people should
23simply ignore[1] and has no interest in trying to avoid it by
24proactively checking the kernel version, so people can safely assume
25that they will never see this version check commit upstream.
26
27However, as can be seen above, telling people to just ignore it is not
28an option, as we'll end up answering the same question and dealing with
29the same bug over and over again.
30
31The commit that triggers this is systemd v247-rc1~378^2~3 -- so any
32systemd 247 and above plus kernel v5.7 or older will need this.
33
34[1] https://github.com/systemd/systemd/issues/16896
35
36Upstream-Status: Denied [https://github.com/systemd/systemd/issues/16896]
37Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
38
39Index: git/src/core/namespace.c
40===================================================================
41--- git.orig/src/core/namespace.c
42+++ git/src/core/namespace.c
43@@ -4,7 +4,9 @@
44 #include <linux/loop.h>
45 #include <sched.h>
46 #include <stdio.h>
47+#include <stdlib.h>
48 #include <sys/mount.h>
49+#include <sys/utsname.h>
50 #include <unistd.h>
51 #include <linux/fs.h>
52
53@@ -860,13 +862,32 @@ static int mount_sysfs(const MountEntry
54
55 static int mount_procfs(const MountEntry *m, const NamespaceInfo *ns_info) {
56 const char *entry_path;
57- int r;
58+ int r, major, minor;
59+ struct utsname uts;
60+ bool old = false;
61
62 assert(m);
63 assert(ns_info);
64
65 entry_path = mount_entry_path(m);
66
67+ /* If uname says that the system is older than v5.8, then the textual hidepid= stuff is not
68+ * supported by the kernel, and thus the per-instance hidepid= neither, which means we
69+ * really don't want to use it, since it would affect our host's /proc * mount. Hence let's
70+ * gracefully fallback to a classic, unrestricted version. */
71+
72+ r = uname(&uts);
73+ if (r < 0)
74+ return errno;
75+
76+ major = atoi(uts.release);
77+ minor = atoi(strchr(uts.release, '.') + 1);
78+
79+ if (major < 5 || (major == 5 && minor < 8)) {
80+ log_debug("Pre v5.8 kernel detected [v%d.%d] - skipping hidepid=", major, minor);
81+ old = true;
82+ }
83+
84 /* Mount a new instance, so that we get the one that matches our user namespace, if we are running in
85 * one. i.e we don't reuse existing mounts here under any condition, we want a new instance owned by
86 * our user namespace and with our hidepid= settings applied. Hence, let's get rid of everything
87@@ -875,8 +896,8 @@ static int mount_procfs(const MountEntry
88 (void) mkdir_p_label(entry_path, 0755);
89 (void) umount_recursive(entry_path, 0);
90
91- if (ns_info->protect_proc != PROTECT_PROC_DEFAULT ||
92- ns_info->proc_subset != PROC_SUBSET_ALL) {
93+ if (!old && (ns_info->protect_proc != PROTECT_PROC_DEFAULT ||
94+ ns_info->proc_subset != PROC_SUBSET_ALL)) {
95 _cleanup_free_ char *opts = NULL;
96
97 /* Starting with kernel 5.8 procfs' hidepid= logic is truly per-instance (previously it
diff --git a/meta/recipes-core/systemd/systemd_247.3.bb b/meta/recipes-core/systemd/systemd_255.4.bb
index c0073ad7b0..f58a1bc2b6 100644
--- a/meta/recipes-core/systemd/systemd_247.3.bb
+++ b/meta/recipes-core/systemd/systemd_255.4.bb
@@ -4,71 +4,75 @@ PROVIDES = "udev"
4 4
5PE = "1" 5PE = "1"
6 6
7DEPENDS = "intltool-native gperf-native libcap util-linux" 7DEPENDS = "intltool-native gperf-native libcap util-linux python3-jinja2-native"
8 8
9SECTION = "base/shell" 9SECTION = "base/shell"
10 10
11inherit useradd pkgconfig meson perlnative update-rc.d update-alternatives qemu systemd gettext bash-completion manpages features_check 11inherit useradd pkgconfig meson perlnative update-rc.d update-alternatives qemu systemd gettext bash-completion manpages features_check
12 12
13# unmerged-usr support is deprecated upstream, taints the system and will be
14# removed in the near future. Fail the build if it is not enabled.
15REQUIRED_DISTRO_FEATURES += "usrmerge"
16
13# As this recipe builds udev, respect systemd being in DISTRO_FEATURES so 17# As this recipe builds udev, respect systemd being in DISTRO_FEATURES so
14# that we don't build both udev and systemd in world builds. 18# that we don't build both udev and systemd in world builds.
15REQUIRED_DISTRO_FEATURES = "systemd" 19REQUIRED_DISTRO_FEATURES += "systemd"
16 20
17SRC_URI += "file://touchscreen.rules \ 21SRC_URI += " \
22 file://touchscreen.rules \
18 file://00-create-volatile.conf \ 23 file://00-create-volatile.conf \
19 ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://org.freedesktop.hostname1_no_polkit.conf', '', d)} \ 24 ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://org.freedesktop.hostname1_no_polkit.conf', '', d)} \
20 ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://00-hostnamed-network-user.conf', '', d)} \ 25 ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://00-hostnamed-network-user.conf', '', d)} \
21 file://init \ 26 file://init \
22 file://99-default.preset \ 27 file://99-default.preset \
23 file://systemd-pager.sh \ 28 file://systemd-pager.sh \
24 file://0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch \ 29 file://0002-binfmt-Don-t-install-dependency-links-at-install-tim.patch \
25 file://0003-implment-systemd-sysv-install-for-OE.patch \ 30 file://0008-implment-systemd-sysv-install-for-OE.patch \
26 file://0001-systemd.pc.in-use-ROOTPREFIX-without-suffixed-slash.patch \
27 file://0001-logind-Restore-chvt-as-non-root-user-without-polkit.patch \
28 file://0027-proc-dont-trigger-mount-error-with-invalid-options-o.patch \
29 file://0001-analyze-resolve-executable-path-if-it-is-relative.patch \
30 " 31 "
31 32
32# patches needed by musl 33# patches needed by musl
33SRC_URI_append_libc-musl = " ${SRC_URI_MUSL}" 34SRC_URI:append:libc-musl = " ${SRC_URI_MUSL}"
34SRC_URI_MUSL = "\ 35SRC_URI_MUSL = "\
35 file://0002-don-t-use-glibc-specific-qsort_r.patch \ 36 file://0001-missing_type.h-add-comparison_fn_t.patch \
36 file://0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch \ 37 file://0002-add-fallback-parse_printf_format-implementation.patch \
37 file://0004-add-fallback-parse_printf_format-implementation.patch \ 38 file://0003-src-basic-missing.h-check-for-missing-strndupa.patch \
38 file://0005-src-basic-missing.h-check-for-missing-strndupa.patch \ 39 file://0004-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch \
39 file://0006-Include-netinet-if_ether.h.patch \ 40 file://0005-add-missing-FTW_-macros-for-musl.patch \
40 file://0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch \ 41 file://0006-Use-uintmax_t-for-handling-rlim_t.patch \
41 file://0008-add-missing-FTW_-macros-for-musl.patch \ 42 file://0007-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch \
42 file://0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch \ 43 file://0008-Define-glibc-compatible-basename-for-non-glibc-syste.patch \
43 file://0010-Use-uintmax_t-for-handling-rlim_t.patch \ 44 file://0009-Do-not-disable-buffering-when-writing-to-oom_score_a.patch \
44 file://0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch \ 45 file://0010-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch \
45 file://0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch \ 46 file://0011-avoid-redefinition-of-prctl_mm_map-structure.patch \
46 file://0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch \ 47 file://0012-do-not-disable-buffer-in-writing-files.patch \
47 file://0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch \ 48 file://0013-Handle-__cpu_mask-usage.patch \
48 file://0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch \ 49 file://0014-Handle-missing-gshadow.patch \
49 file://0016-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch \ 50 file://0015-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch \
50 file://0017-missing_type.h-add-__compar_d_fn_t-definition.patch \ 51 file://0016-pass-correct-parameters-to-getdents64.patch \
51 file://0018-avoid-redefinition-of-prctl_mm_map-structure.patch \ 52 file://0017-Adjust-for-musl-headers.patch \
52 file://0019-Handle-missing-LOCK_EX.patch \ 53 file://0018-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch \
53 file://0020-Fix-incompatible-pointer-type-struct-sockaddr_un.patch \ 54 file://0019-errno-util-Make-STRERROR-portable-for-musl.patch \
54 file://0021-test-json.c-define-M_PIl.patch \ 55 file://0020-sd-event-Make-malloc_trim-conditional-on-glibc.patch \
55 file://0022-do-not-disable-buffer-in-writing-files.patch \ 56 file://0021-shared-Do-not-use-malloc_info-on-musl.patch \
56 file://0025-Handle-__cpu_mask-usage.patch \ 57 file://0022-avoid-missing-LOCK_EX-declaration.patch \
57 file://0026-Handle-missing-gshadow.patch \
58 " 58 "
59 59
60PAM_PLUGINS = " \ 60PAM_PLUGINS = " \
61 pam-plugin-unix \ 61 pam-plugin-unix \
62 pam-plugin-loginuid \ 62 pam-plugin-loginuid \
63 pam-plugin-keyinit \ 63 pam-plugin-keyinit \
64 pam-plugin-namespace \
64" 65"
65 66
66PACKAGECONFIG ??= " \ 67PACKAGECONFIG ??= " \
67 ${@bb.utils.filter('DISTRO_FEATURES', 'acl audit efi ldconfig pam selinux smack usrmerge polkit', d)} \ 68 ${@bb.utils.filter('DISTRO_FEATURES', 'acl audit efi ldconfig pam pni-names selinux smack usrmerge polkit seccomp', d)} \
69 ${@bb.utils.contains('DISTRO_FEATURES', 'minidebuginfo', 'coredump elfutils', '', d)} \
68 ${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'rfkill', '', d)} \ 70 ${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'rfkill', '', d)} \
69 ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '', d)} \ 71 ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '', d)} \
72 ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '', 'link-udev-shared', d)} \
70 backlight \ 73 backlight \
71 binfmt \ 74 binfmt \
75 cgroupv2 \
72 gshadow \ 76 gshadow \
73 hibernate \ 77 hibernate \
74 hostnamed \ 78 hostnamed \
@@ -94,10 +98,11 @@ PACKAGECONFIG ??= " \
94 userdb \ 98 userdb \
95 utmp \ 99 utmp \
96 vconsole \ 100 vconsole \
97 xz \ 101 wheel-group \
102 zstd \
98" 103"
99 104
100PACKAGECONFIG_remove_libc-musl = " \ 105PACKAGECONFIG:remove:libc-musl = " \
101 gshadow \ 106 gshadow \
102 idn \ 107 idn \
103 localed \ 108 localed \
@@ -110,7 +115,10 @@ PACKAGECONFIG_remove_libc-musl = " \
110 utmp \ 115 utmp \
111" 116"
112 117
113CFLAGS_append_libc-musl = " -D__UAPI_DEF_ETHHDR=0 " 118# https://github.com/seccomp/libseccomp/issues/347
119PACKAGECONFIG:remove:mipsarch = "seccomp"
120
121TARGET_CC_ARCH:append:libc-musl = " -D__UAPI_DEF_ETHHDR=0 -D_LARGEFILE64_SOURCE"
114 122
115# Some of the dependencies are weak-style recommends - if not available at runtime, 123# Some of the dependencies are weak-style recommends - if not available at runtime,
116# systemd won't fail but the library-related feature will be skipped with a warning. 124# systemd won't fail but the library-related feature will be skipped with a warning.
@@ -128,11 +136,20 @@ PACKAGECONFIG[bzip2] = "-Dbzip2=true,-Dbzip2=false,bzip2"
128PACKAGECONFIG[cgroupv2] = "-Ddefault-hierarchy=unified,-Ddefault-hierarchy=hybrid" 136PACKAGECONFIG[cgroupv2] = "-Ddefault-hierarchy=unified,-Ddefault-hierarchy=hybrid"
129PACKAGECONFIG[coredump] = "-Dcoredump=true,-Dcoredump=false" 137PACKAGECONFIG[coredump] = "-Dcoredump=true,-Dcoredump=false"
130PACKAGECONFIG[cryptsetup] = "-Dlibcryptsetup=true,-Dlibcryptsetup=false,cryptsetup,,cryptsetup" 138PACKAGECONFIG[cryptsetup] = "-Dlibcryptsetup=true,-Dlibcryptsetup=false,cryptsetup,,cryptsetup"
139PACKAGECONFIG[cryptsetup-plugins] = "-Dlibcryptsetup-plugins=true,-Dlibcryptsetup-plugins=false,cryptsetup,,cryptsetup"
140PACKAGECONFIG[tpm2] = "-Dtpm2=true,-Dtpm2=false,tpm2-tss,tpm2-tss libtss2 libtss2-tcti-device"
141# If multiple compression libraries are enabled, the format to use for compression is chosen implicitly,
142# so if you want to compress with e.g. lz4 you cannot enable zstd, so you cannot read zstd-compressed journal files.
143# This option allows to enable all compression formats for reading, but choosing a specific one for writing.
144PACKAGECONFIG[default-compression-lz4] = "-Dlz4=true -Ddefault-compression=lz4,,lz4"
145PACKAGECONFIG[default-compression-xz] = "-Dxz=true -Ddefault-compression=xz,,xz"
146PACKAGECONFIG[default-compression-zstd] = "-Dzstd=true -Ddefault-compression=zstd,,zstd"
131PACKAGECONFIG[dbus] = "-Ddbus=true,-Ddbus=false,dbus" 147PACKAGECONFIG[dbus] = "-Ddbus=true,-Ddbus=false,dbus"
132PACKAGECONFIG[efi] = "-Defi=true,-Defi=false" 148PACKAGECONFIG[efi] = "-Defi=true -Dbootloader=true,-Defi=false -Dbootloader=false,python3-pyelftools-native"
133PACKAGECONFIG[gnu-efi] = "-Dgnu-efi=true -Defi-libdir=${STAGING_LIBDIR} -Defi-includedir=${STAGING_INCDIR}/efi,-Dgnu-efi=false,gnu-efi" 149PACKAGECONFIG[elfutils] = "-Delfutils=true,-Delfutils=false,elfutils,,libelf libdw"
134PACKAGECONFIG[elfutils] = "-Delfutils=true,-Delfutils=false,elfutils"
135PACKAGECONFIG[firstboot] = "-Dfirstboot=true,-Dfirstboot=false" 150PACKAGECONFIG[firstboot] = "-Dfirstboot=true,-Dfirstboot=false"
151PACKAGECONFIG[repart] = "-Drepart=true,-Drepart=false"
152PACKAGECONFIG[homed] = "-Dhomed=true,-Dhomed=false"
136# Sign the journal for anti-tampering 153# Sign the journal for anti-tampering
137PACKAGECONFIG[gcrypt] = "-Dgcrypt=true,-Dgcrypt=false,libgcrypt" 154PACKAGECONFIG[gcrypt] = "-Dgcrypt=true,-Dgcrypt=false,libgcrypt"
138PACKAGECONFIG[gnutls] = "-Dgnutls=true,-Dgnutls=false,gnutls" 155PACKAGECONFIG[gnutls] = "-Dgnutls=true,-Dgnutls=false,gnutls"
@@ -142,14 +159,18 @@ PACKAGECONFIG[hostnamed] = "-Dhostnamed=true,-Dhostnamed=false"
142PACKAGECONFIG[idn] = "-Didn=true,-Didn=false" 159PACKAGECONFIG[idn] = "-Didn=true,-Didn=false"
143PACKAGECONFIG[ima] = "-Dima=true,-Dima=false" 160PACKAGECONFIG[ima] = "-Dima=true,-Dima=false"
144# importd requires journal-upload/xz/zlib/bzip2/gcrypt 161# importd requires journal-upload/xz/zlib/bzip2/gcrypt
145PACKAGECONFIG[importd] = "-Dimportd=true,-Dimportd=false" 162PACKAGECONFIG[importd] = "-Dimportd=true,-Dimportd=false,glib-2.0"
146# Update NAT firewall rules 163# Update NAT firewall rules
147PACKAGECONFIG[iptc] = "-Dlibiptc=true,-Dlibiptc=false,iptables" 164PACKAGECONFIG[iptc] = "-Dlibiptc=true,-Dlibiptc=false,iptables"
165PACKAGECONFIG[journal-color] = ",,,less"
148PACKAGECONFIG[journal-upload] = "-Dlibcurl=true,-Dlibcurl=false,curl" 166PACKAGECONFIG[journal-upload] = "-Dlibcurl=true,-Dlibcurl=false,curl"
149PACKAGECONFIG[kmod] = "-Dkmod=true,-Dkmod=false,kmod" 167PACKAGECONFIG[kmod] = "-Dkmod=true,-Dkmod=false,kmod"
150PACKAGECONFIG[ldconfig] = "-Dldconfig=true,-Dldconfig=false,,ldconfig" 168PACKAGECONFIG[ldconfig] = "-Dldconfig=true,-Dldconfig=false,,ldconfig"
151PACKAGECONFIG[libidn] = "-Dlibidn=true,-Dlibidn=false,libidn,,libidn" 169PACKAGECONFIG[libidn] = "-Dlibidn=true,-Dlibidn=false,libidn,,libidn"
152PACKAGECONFIG[libidn2] = "-Dlibidn2=true,-Dlibidn2=false,libidn2,,libidn2" 170PACKAGECONFIG[libidn2] = "-Dlibidn2=true,-Dlibidn2=false,libidn2,,libidn2"
171# Link udev shared with systemd helper library.
172# If enabled the udev package depends on the systemd package (which has the needed shared library).
173PACKAGECONFIG[link-udev-shared] = "-Dlink-udev-shared=true,-Dlink-udev-shared=false"
153PACKAGECONFIG[localed] = "-Dlocaled=true,-Dlocaled=false" 174PACKAGECONFIG[localed] = "-Dlocaled=true,-Dlocaled=false"
154PACKAGECONFIG[logind] = "-Dlogind=true,-Dlogind=false" 175PACKAGECONFIG[logind] = "-Dlogind=true,-Dlogind=false"
155PACKAGECONFIG[lz4] = "-Dlz4=true,-Dlz4=false,lz4" 176PACKAGECONFIG[lz4] = "-Dlz4=true,-Dlz4=false,lz4"
@@ -158,11 +179,14 @@ PACKAGECONFIG[manpages] = "-Dman=true,-Dman=false,libxslt-native xmlto-native do
158PACKAGECONFIG[microhttpd] = "-Dmicrohttpd=true,-Dmicrohttpd=false,libmicrohttpd" 179PACKAGECONFIG[microhttpd] = "-Dmicrohttpd=true,-Dmicrohttpd=false,libmicrohttpd"
159PACKAGECONFIG[myhostname] = "-Dnss-myhostname=true,-Dnss-myhostname=false,,libnss-myhostname" 180PACKAGECONFIG[myhostname] = "-Dnss-myhostname=true,-Dnss-myhostname=false,,libnss-myhostname"
160PACKAGECONFIG[networkd] = "-Dnetworkd=true,-Dnetworkd=false" 181PACKAGECONFIG[networkd] = "-Dnetworkd=true,-Dnetworkd=false"
161PACKAGECONFIG[nss] = "-Dnss-systemd=true,-Dnss-systemd=false" 182PACKAGECONFIG[no-dns-fallback] = "-Ddns-servers="
183PACKAGECONFIG[no-ntp-fallback] = "-Dntp-servers="
184PACKAGECONFIG[nss] = "-Dnss-systemd=true,-Dnss-systemd=false,,libnss-systemd"
162PACKAGECONFIG[nss-mymachines] = "-Dnss-mymachines=true,-Dnss-mymachines=false" 185PACKAGECONFIG[nss-mymachines] = "-Dnss-mymachines=true,-Dnss-mymachines=false"
163PACKAGECONFIG[nss-resolve] = "-Dnss-resolve=true,-Dnss-resolve=false" 186PACKAGECONFIG[nss-resolve] = "-Dnss-resolve=true,-Dnss-resolve=false"
164PACKAGECONFIG[oomd] = "-Doomd=true,-Doomd=false" 187PACKAGECONFIG[oomd] = "-Doomd=true,-Doomd=false"
165PACKAGECONFIG[openssl] = "-Dopenssl=true,-Dopenssl=false,openssl" 188PACKAGECONFIG[openssl] = "-Dopenssl=true,-Dopenssl=false,openssl"
189PACKAGECONFIG[p11kit] = "-Dp11kit=true,-Dp11kit=false,p11-kit"
166PACKAGECONFIG[pam] = "-Dpam=true,-Dpam=false,libpam,${PAM_PLUGINS}" 190PACKAGECONFIG[pam] = "-Dpam=true,-Dpam=false,libpam,${PAM_PLUGINS}"
167PACKAGECONFIG[pcre2] = "-Dpcre2=true,-Dpcre2=false,libpcre2" 191PACKAGECONFIG[pcre2] = "-Dpcre2=true,-Dpcre2=false,libpcre2"
168PACKAGECONFIG[polkit] = "-Dpolkit=true,-Dpolkit=false" 192PACKAGECONFIG[polkit] = "-Dpolkit=true,-Dpolkit=false"
@@ -171,18 +195,20 @@ PACKAGECONFIG[polkit] = "-Dpolkit=true,-Dpolkit=false"
171# hostname without acquiring additional privileges 195# hostname without acquiring additional privileges
172PACKAGECONFIG[polkit_hostnamed_fallback] = ",,,,dbus-broker,polkit" 196PACKAGECONFIG[polkit_hostnamed_fallback] = ",,,,dbus-broker,polkit"
173PACKAGECONFIG[portabled] = "-Dportabled=true,-Dportabled=false" 197PACKAGECONFIG[portabled] = "-Dportabled=true,-Dportabled=false"
198PACKAGECONFIG[pstore] = "-Dpstore=true,-Dpstore=false"
199PACKAGECONFIG[pni-names] = ",,,"
174PACKAGECONFIG[qrencode] = "-Dqrencode=true,-Dqrencode=false,qrencode,,qrencode" 200PACKAGECONFIG[qrencode] = "-Dqrencode=true,-Dqrencode=false,qrencode,,qrencode"
175PACKAGECONFIG[quotacheck] = "-Dquotacheck=true,-Dquotacheck=false" 201PACKAGECONFIG[quotacheck] = "-Dquotacheck=true,-Dquotacheck=false"
176PACKAGECONFIG[randomseed] = "-Drandomseed=true,-Drandomseed=false" 202PACKAGECONFIG[randomseed] = "-Drandomseed=true,-Drandomseed=false"
177PACKAGECONFIG[resolved] = "-Dresolve=true,-Dresolve=false" 203PACKAGECONFIG[resolved] = "-Dresolve=true,-Dresolve=false"
178PACKAGECONFIG[rfkill] = "-Drfkill=true,-Drfkill=false" 204PACKAGECONFIG[rfkill] = "-Drfkill=true,-Drfkill=false"
179# libseccomp is found in meta-security
180PACKAGECONFIG[seccomp] = "-Dseccomp=true,-Dseccomp=false,libseccomp" 205PACKAGECONFIG[seccomp] = "-Dseccomp=true,-Dseccomp=false,libseccomp"
181PACKAGECONFIG[selinux] = "-Dselinux=true,-Dselinux=false,libselinux,initscripts-sushell" 206PACKAGECONFIG[selinux] = "-Dselinux=true,-Dselinux=false,libselinux,initscripts-sushell"
182PACKAGECONFIG[smack] = "-Dsmack=true,-Dsmack=false" 207PACKAGECONFIG[smack] = "-Dsmack=true,-Dsmack=false"
208PACKAGECONFIG[sysext] = "-Dsysext=true, -Dsysext=false"
183PACKAGECONFIG[sysusers] = "-Dsysusers=true,-Dsysusers=false" 209PACKAGECONFIG[sysusers] = "-Dsysusers=true,-Dsysusers=false"
184PACKAGECONFIG[sysvinit] = "-Dsysvinit-path=${sysconfdir}/init.d -Dsysvrcnd-path=${sysconfdir},-Dsysvinit-path= -Dsysvrcnd-path=,,systemd-compat-units update-rc.d" 210PACKAGECONFIG[sysvinit] = "-Dsysvinit-path=${sysconfdir}/init.d -Dsysvrcnd-path=${sysconfdir},-Dsysvinit-path= -Dsysvrcnd-path=,,systemd-compat-units update-rc.d"
185# When enabled use reproducble build timestamp if set as time epoch, 211# When enabled use reproducible build timestamp if set as time epoch,
186# or build time if not. When disabled, time epoch is unset. 212# or build time if not. When disabled, time epoch is unset.
187def build_epoch(d): 213def build_epoch(d):
188 epoch = d.getVar('SOURCE_DATE_EPOCH') or "-1" 214 epoch = d.getVar('SOURCE_DATE_EPOCH') or "-1"
@@ -196,11 +222,15 @@ PACKAGECONFIG[userdb] = "-Duserdb=true,-Duserdb=false"
196PACKAGECONFIG[utmp] = "-Dutmp=true,-Dutmp=false" 222PACKAGECONFIG[utmp] = "-Dutmp=true,-Dutmp=false"
197PACKAGECONFIG[valgrind] = "-DVALGRIND=1,,valgrind" 223PACKAGECONFIG[valgrind] = "-DVALGRIND=1,,valgrind"
198PACKAGECONFIG[vconsole] = "-Dvconsole=true,-Dvconsole=false,,${PN}-vconsole-setup" 224PACKAGECONFIG[vconsole] = "-Dvconsole=true,-Dvconsole=false,,${PN}-vconsole-setup"
225PACKAGECONFIG[wheel-group] = "-Dwheel-group=true, -Dwheel-group=false"
199PACKAGECONFIG[xdg-autostart] = "-Dxdg-autostart=true,-Dxdg-autostart=false" 226PACKAGECONFIG[xdg-autostart] = "-Dxdg-autostart=true,-Dxdg-autostart=false"
200# Verify keymaps on locale change 227# Verify keymaps on locale change
201PACKAGECONFIG[xkbcommon] = "-Dxkbcommon=true,-Dxkbcommon=false,libxkbcommon" 228PACKAGECONFIG[xkbcommon] = "-Dxkbcommon=true,-Dxkbcommon=false,libxkbcommon"
202PACKAGECONFIG[xz] = "-Dxz=true,-Dxz=false,xz" 229PACKAGECONFIG[xz] = "-Dxz=true,-Dxz=false,xz"
203PACKAGECONFIG[zlib] = "-Dzlib=true,-Dzlib=false,zlib" 230PACKAGECONFIG[zlib] = "-Dzlib=true,-Dzlib=false,zlib"
231PACKAGECONFIG[zstd] = "-Dzstd=true,-Dzstd=false,zstd"
232
233RESOLV_CONF ??= ""
204 234
205# Helper variables to clarify locations. This mirrors the logic in systemd's 235# Helper variables to clarify locations. This mirrors the logic in systemd's
206# build system. 236# build system.
@@ -208,13 +238,8 @@ rootprefix ?= "${root_prefix}"
208rootlibdir ?= "${base_libdir}" 238rootlibdir ?= "${base_libdir}"
209rootlibexecdir = "${rootprefix}/lib" 239rootlibexecdir = "${rootprefix}/lib"
210 240
211# This links udev statically with systemd helper library.
212# Otherwise udev package would depend on systemd package (which has the needed shared library),
213# and always pull it into images.
214EXTRA_OEMESON += "-Dlink-udev-shared=false"
215
216EXTRA_OEMESON += "-Dnobody-user=nobody \ 241EXTRA_OEMESON += "-Dnobody-user=nobody \
217 -Dnobody-group=nobody \ 242 -Dnobody-group=nogroup \
218 -Drootlibdir=${rootlibdir} \ 243 -Drootlibdir=${rootlibdir} \
219 -Drootprefix=${rootprefix} \ 244 -Drootprefix=${rootprefix} \
220 -Ddefault-locale=C \ 245 -Ddefault-locale=C \
@@ -223,9 +248,13 @@ EXTRA_OEMESON += "-Dnobody-user=nobody \
223 -Dsystem-uid-max=999 \ 248 -Dsystem-uid-max=999 \
224 -Dsystem-alloc-gid-min=101 \ 249 -Dsystem-alloc-gid-min=101 \
225 -Dsystem-gid-max=999 \ 250 -Dsystem-gid-max=999 \
251 -Dcreate-log-dirs=false \
252 ${@bb.utils.contains('DISTRO_FEATURES', 'zeroconf', '-Ddefault-mdns=no -Ddefault-llmnr=no', '', d)} \
226 " 253 "
227 254
228# Hardcode target binary paths to avoid using paths from sysroot 255# Hardcode target binary paths to avoid using paths from sysroot or worse
256# it pokes for these binaries on build host and encodes that distro assumption
257# into target
229EXTRA_OEMESON += "-Dkexec-path=${sbindir}/kexec \ 258EXTRA_OEMESON += "-Dkexec-path=${sbindir}/kexec \
230 -Dkmod-path=${base_bindir}/kmod \ 259 -Dkmod-path=${base_bindir}/kmod \
231 -Dmount-path=${base_bindir}/mount \ 260 -Dmount-path=${base_bindir}/mount \
@@ -233,14 +262,29 @@ EXTRA_OEMESON += "-Dkexec-path=${sbindir}/kexec \
233 -Dquotaon-path=${sbindir}/quotaon \ 262 -Dquotaon-path=${sbindir}/quotaon \
234 -Dsulogin-path=${base_sbindir}/sulogin \ 263 -Dsulogin-path=${base_sbindir}/sulogin \
235 -Dnologin-path=${base_sbindir}/nologin \ 264 -Dnologin-path=${base_sbindir}/nologin \
236 -Dumount-path=${base_bindir}/umount" 265 -Dumount-path=${base_bindir}/umount \
266 -Dloadkeys-path=${bindir}/loadkeys \
267 -Dsetfont-path=${bindir}/setfont"
268
269# The 60 seconds is watchdog's default vaule.
270WATCHDOG_TIMEOUT ??= "60"
237 271
238do_install() { 272do_install() {
239 meson_do_install 273 meson_do_install
274 if ${@bb.utils.contains('PACKAGECONFIG', 'sysusers', 'true', 'false', d)}; then
275 # Change the root user's home directory in /lib/sysusers.d/basic.conf.
276 # This is done merely for backward compatibility with previous systemd recipes.
277 # systemd hardcodes root user's HOME to be "/root". Changing to use other values
278 # may have unexpected runtime behaviors.
279 if [ "${ROOT_HOME}" != "/root" ]; then
280 bbwarn "Using ${ROOT_HOME} as root user's home directory is not fully supported by systemd"
281 sed -i -e 's#/root#${ROOT_HOME}#g' ${D}${exec_prefix}/lib/sysusers.d/basic.conf
282 fi
283 fi
240 install -d ${D}/${base_sbindir} 284 install -d ${D}/${base_sbindir}
241 if ${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', 'false', 'true', d)}; then 285 if ${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', 'false', 'true', d)}; then
242 # Provided by a separate recipe 286 # Provided by a separate recipe
243 rm ${D}${systemd_unitdir}/system/serial-getty* -f 287 rm ${D}${systemd_system_unitdir}/serial-getty* -f
244 fi 288 fi
245 289
246 # Provide support for initramfs 290 # Provide support for initramfs
@@ -248,12 +292,12 @@ do_install() {
248 [ ! -e ${D}/${base_sbindir}/udevd ] && ln -s ${rootlibexecdir}/systemd/systemd-udevd ${D}/${base_sbindir}/udevd 292 [ ! -e ${D}/${base_sbindir}/udevd ] && ln -s ${rootlibexecdir}/systemd/systemd-udevd ${D}/${base_sbindir}/udevd
249 293
250 install -d ${D}${sysconfdir}/udev/rules.d/ 294 install -d ${D}${sysconfdir}/udev/rules.d/
251 install -d ${D}${sysconfdir}/tmpfiles.d 295 install -d ${D}${nonarch_libdir}/tmpfiles.d
252 for rule in $(find ${WORKDIR} -maxdepth 1 -type f -name "*.rules"); do 296 for rule in $(find ${WORKDIR} -maxdepth 1 -type f -name "*.rules"); do
253 install -m 0644 $rule ${D}${sysconfdir}/udev/rules.d/ 297 install -m 0644 $rule ${D}${sysconfdir}/udev/rules.d/
254 done 298 done
255 299
256 install -m 0644 ${WORKDIR}/00-create-volatile.conf ${D}${sysconfdir}/tmpfiles.d/ 300 install -m 0644 ${WORKDIR}/00-create-volatile.conf ${D}${nonarch_libdir}/tmpfiles.d/
257 301
258 if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then 302 if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
259 install -d ${D}${sysconfdir}/init.d 303 install -d ${D}${sysconfdir}/init.d
@@ -262,33 +306,44 @@ do_install() {
262 install -Dm 0755 ${S}/src/systemctl/systemd-sysv-install.SKELETON ${D}${systemd_unitdir}/systemd-sysv-install 306 install -Dm 0755 ${S}/src/systemctl/systemd-sysv-install.SKELETON ${D}${systemd_unitdir}/systemd-sysv-install
263 fi 307 fi
264 308
265 chown root:systemd-journal ${D}/${localstatedir}/log/journal 309 if "${@'true' if oe.types.boolean(d.getVar('VOLATILE_LOG_DIR')) else 'false'}"; then
310 # /var/log is typically a symbolic link to inside /var/volatile,
311 # which is expected to be empty.
312 rm -rf ${D}${localstatedir}/log
313 elif [ -e ${D}${localstatedir}/log/journal ]; then
314 chown root:systemd-journal ${D}${localstatedir}/log/journal
266 315
267 # Delete journal README, as log can be symlinked inside volatile. 316 # journal-remote creates this at start
268 rm -f ${D}/${localstatedir}/log/README 317 rm -rf ${D}${localstatedir}/log/journal/remote
318 fi
269 319
270 # journal-remote creates this at start 320 # if the user requests /tmp be on persistent storage (i.e. not volatile)
271 rm -rf ${D}/${localstatedir}/log/journal/remote 321 # then don't use a tmpfs for /tmp
322 if [ "${VOLATILE_TMP_DIR}" != "yes" ]; then
323 rm -f ${D}${rootlibdir}/systemd/system/tmp.mount
324 rm -f ${D}${rootlibdir}/systemd/system/local-fs.target.wants/tmp.mount
325 fi
272 326
273 install -d ${D}${systemd_unitdir}/system/graphical.target.wants 327 install -d ${D}${systemd_system_unitdir}/graphical.target.wants
274 install -d ${D}${systemd_unitdir}/system/multi-user.target.wants 328 install -d ${D}${systemd_system_unitdir}/multi-user.target.wants
275 install -d ${D}${systemd_unitdir}/system/poweroff.target.wants 329 install -d ${D}${systemd_system_unitdir}/poweroff.target.wants
276 install -d ${D}${systemd_unitdir}/system/reboot.target.wants 330 install -d ${D}${systemd_system_unitdir}/reboot.target.wants
277 install -d ${D}${systemd_unitdir}/system/rescue.target.wants 331 install -d ${D}${systemd_system_unitdir}/rescue.target.wants
278 332
279 # Create symlinks for systemd-update-utmp-runlevel.service 333 # Create symlinks for systemd-update-utmp-runlevel.service
280 if ${@bb.utils.contains('PACKAGECONFIG', 'utmp', 'true', 'false', d)}; then 334 if ${@bb.utils.contains('PACKAGECONFIG', 'utmp', 'true', 'false', d)}; then
281 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/graphical.target.wants/systemd-update-utmp-runlevel.service 335 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/graphical.target.wants/systemd-update-utmp-runlevel.service
282 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/multi-user.target.wants/systemd-update-utmp-runlevel.service 336 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/multi-user.target.wants/systemd-update-utmp-runlevel.service
283 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/poweroff.target.wants/systemd-update-utmp-runlevel.service 337 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/poweroff.target.wants/systemd-update-utmp-runlevel.service
284 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/reboot.target.wants/systemd-update-utmp-runlevel.service 338 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/reboot.target.wants/systemd-update-utmp-runlevel.service
285 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_unitdir}/system/rescue.target.wants/systemd-update-utmp-runlevel.service 339 ln -sf ../systemd-update-utmp-runlevel.service ${D}${systemd_system_unitdir}/rescue.target.wants/systemd-update-utmp-runlevel.service
286 fi 340 fi
287 341
288 # this file is needed to exist if networkd is disabled but timesyncd is still in use since timesyncd checks it 342 # this file is needed to exist if networkd is disabled but timesyncd is still in use since timesyncd checks it
289 # for existence else it fails 343 # for existence else it fails
290 if [ -s ${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf ]; then 344 if [ -s ${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf ] &&
291 ${@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)} 345 ! ${@bb.utils.contains('PACKAGECONFIG', 'networkd', 'true', 'false', d)}; then
346 echo 'd /run/systemd/netif/links 0755 root root -' >>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf
292 fi 347 fi
293 if ! ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'true', 'false', d)}; then 348 if ! ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'true', 'false', d)}; then
294 echo 'L! ${sysconfdir}/resolv.conf - - - - ../run/systemd/resolve/resolv.conf' >>${D}${exec_prefix}/lib/tmpfiles.d/etc.conf 349 echo 'L! ${sysconfdir}/resolv.conf - - - - ../run/systemd/resolve/resolv.conf' >>${D}${exec_prefix}/lib/tmpfiles.d/etc.conf
@@ -296,8 +351,9 @@ do_install() {
296 echo 'f /run/systemd/resolve/resolv.conf 0644 root root' >>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf 351 echo 'f /run/systemd/resolve/resolv.conf 0644 root root' >>${D}${exec_prefix}/lib/tmpfiles.d/systemd.conf
297 ln -s ../run/systemd/resolve/resolv.conf ${D}${sysconfdir}/resolv-conf.systemd 352 ln -s ../run/systemd/resolve/resolv.conf ${D}${sysconfdir}/resolv-conf.systemd
298 else 353 else
299 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 354 resolv_conf="${@bb.utils.contains('RESOLV_CONF', 'stub-resolv', 'run/systemd/resolve/stub-resolv.conf', 'run/systemd/resolve/resolv.conf', d)}"
300 ln -s ../run/systemd/resolve/resolv.conf ${D}${sysconfdir}/resolv-conf.systemd 355 sed -i -e "s%^L! /etc/resolv.conf.*$%L! /etc/resolv.conf - - - - ../${resolv_conf}%g" ${D}${exec_prefix}/lib/tmpfiles.d/etc.conf
356 ln -s ../${resolv_conf} ${D}${sysconfdir}/resolv-conf.systemd
301 fi 357 fi
302 if ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'false', 'true', d)}; then 358 if ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'false', 'true', d)}; then
303 rm ${D}${exec_prefix}/lib/tmpfiles.d/x11.conf 359 rm ${D}${exec_prefix}/lib/tmpfiles.d/x11.conf
@@ -315,8 +371,8 @@ do_install() {
315 # If polkit is not available and a fallback was requested, install a drop-in that allows networkd to 371 # If polkit is not available and a fallback was requested, install a drop-in that allows networkd to
316 # request hostname changes via DBUS without elevating its privileges 372 # request hostname changes via DBUS without elevating its privileges
317 if ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'true', 'false', d)}; then 373 if ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'true', 'false', d)}; then
318 install -d ${D}${systemd_unitdir}/system/systemd-hostnamed.service.d/ 374 install -d ${D}${systemd_system_unitdir}/systemd-hostnamed.service.d/
319 install -m 0644 ${WORKDIR}/00-hostnamed-network-user.conf ${D}${systemd_unitdir}/system/systemd-hostnamed.service.d/ 375 install -m 0644 ${WORKDIR}/00-hostnamed-network-user.conf ${D}${systemd_system_unitdir}/systemd-hostnamed.service.d/
320 install -d ${D}${datadir}/dbus-1/system.d/ 376 install -d ${D}${datadir}/dbus-1/system.d/
321 install -m 0644 ${WORKDIR}/org.freedesktop.hostname1_no_polkit.conf ${D}${datadir}/dbus-1/system.d/ 377 install -m 0644 ${WORKDIR}/org.freedesktop.hostname1_no_polkit.conf ${D}${datadir}/dbus-1/system.d/
322 fi 378 fi
@@ -324,133 +380,155 @@ do_install() {
324 # create link for existing udev rules 380 # create link for existing udev rules
325 ln -s ${base_bindir}/udevadm ${D}${base_sbindir}/udevadm 381 ln -s ${base_bindir}/udevadm ${D}${base_sbindir}/udevadm
326 382
327 # duplicate udevadm for postinst script
328 install -d ${D}${libexecdir}
329 ln ${D}${base_bindir}/udevadm ${D}${libexecdir}/${MLPREFIX}udevadm
330
331 # install default policy for presets 383 # install default policy for presets
332 # https://www.freedesktop.org/wiki/Software/systemd/Preset/#howto 384 # https://www.freedesktop.org/wiki/Software/systemd/Preset/#howto
333 install -Dm 0644 ${WORKDIR}/99-default.preset ${D}${systemd_unitdir}/system-preset/99-default.preset 385 install -Dm 0644 ${WORKDIR}/99-default.preset ${D}${systemd_unitdir}/system-preset/99-default.preset
334 386
335 # add a profile fragment to disable systemd pager with busybox less 387 # add a profile fragment to disable systemd pager with busybox less
336 install -Dm 0644 ${WORKDIR}/systemd-pager.sh ${D}${sysconfdir}/profile.d/systemd-pager.sh 388 install -Dm 0644 ${WORKDIR}/systemd-pager.sh ${D}${sysconfdir}/profile.d/systemd-pager.sh
389
390 if [ -n "${WATCHDOG_TIMEOUT}" ]; then
391 sed -i -e 's/#RebootWatchdogSec=10min/RebootWatchdogSec=${WATCHDOG_TIMEOUT}/' \
392 ${D}/${sysconfdir}/systemd/system.conf
393 fi
394
395 if ${@bb.utils.contains('PACKAGECONFIG', 'pni-names', 'true', 'false', d)}; then
396 if ! grep -q '^NamePolicy=.*mac' ${D}${rootlibexecdir}/systemd/network/99-default.link; then
397 sed -i '/^NamePolicy=/s/$/ mac/' ${D}${rootlibexecdir}/systemd/network/99-default.link
398 fi
399 if ! grep -q 'AlternativeNamesPolicy=.*mac' ${D}${rootlibexecdir}/systemd/network/99-default.link; then
400 sed -i '/AlternativeNamesPolicy=/s/$/ mac/' ${D}${rootlibexecdir}/systemd/network/99-default.link
401 fi
402 fi
337} 403}
338 404
339python populate_packages_prepend (){ 405python populate_packages:prepend (){
340 systemdlibdir = d.getVar("rootlibdir") 406 systemdlibdir = d.getVar("rootlibdir")
341 do_split_packages(d, systemdlibdir, '^lib(.*)\.so\.*', 'lib%s', 'Systemd %s library', extra_depends='', allow_links=True) 407 do_split_packages(d, systemdlibdir, r'^lib(.*)\.so\.*', 'lib%s', 'Systemd %s library', extra_depends='', allow_links=True)
342} 408}
343PACKAGES_DYNAMIC += "^lib(udev|systemd|nss).*" 409PACKAGES_DYNAMIC += "^lib(udev|systemd|nss).*"
344 410
345PACKAGE_BEFORE_PN = "\ 411PACKAGE_BEFORE_PN = "\
346 ${PN}-gui \
347 ${PN}-vconsole-setup \
348 ${PN}-initramfs \
349 ${PN}-analyze \ 412 ${PN}-analyze \
350 ${PN}-kernel-install \
351 ${PN}-rpm-macros \
352 ${PN}-binfmt \ 413 ${PN}-binfmt \
353 ${PN}-zsh-completion \
354 ${PN}-container \ 414 ${PN}-container \
415 ${PN}-crypt \
416 ${PN}-extra-utils \
417 ${PN}-gui \
418 ${PN}-initramfs \
355 ${PN}-journal-gatewayd \ 419 ${PN}-journal-gatewayd \
356 ${PN}-journal-upload \ 420 ${PN}-journal-upload \
357 ${PN}-journal-remote \ 421 ${PN}-journal-remote \
358 ${PN}-extra-utils \ 422 ${PN}-kernel-install \
423 ${PN}-rpm-macros \
359 ${PN}-udev-rules \ 424 ${PN}-udev-rules \
425 ${PN}-vconsole-setup \
426 ${PN}-zsh-completion \
427 libsystemd-shared \
360 udev \ 428 udev \
429 udev-bash-completion \
361 udev-hwdb \ 430 udev-hwdb \
362" 431"
363 432
364SUMMARY_${PN}-container = "Tools for containers and VMs" 433SUMMARY:${PN}-container = "Tools for containers and VMs"
365DESCRIPTION_${PN}-container = "Systemd tools to spawn and manage containers and virtual machines." 434DESCRIPTION:${PN}-container = "Systemd tools to spawn and manage containers and virtual machines."
366 435
367SUMMARY_${PN}-journal-gatewayd = "HTTP server for journal events" 436SUMMARY:${PN}-journal-gatewayd = "HTTP server for journal events"
368DESCRIPTION_${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." 437DESCRIPTION:${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."
369 438
370SUMMARY_${PN}-journal-upload = "Send journal messages over the network" 439SUMMARY:${PN}-journal-upload = "Send journal messages over the network"
371DESCRIPTION_${PN}-journal-upload = "systemd-journal-upload uploads journal entries to a specified URL." 440DESCRIPTION:${PN}-journal-upload = "systemd-journal-upload uploads journal entries to a specified URL."
372 441
373SUMMARY_${PN}-journal-remote = "Receive journal messages over the network" 442SUMMARY:${PN}-journal-remote = "Receive journal messages over the network"
374DESCRIPTION_${PN}-journal-remote = "systemd-journal-remote is a command to receive serialized journal events and store them to journal files." 443DESCRIPTION:${PN}-journal-remote = "systemd-journal-remote is a command to receive serialized journal events and store them to journal files."
444
445SUMMARY:libsystemd-shared = "Systemd shared library"
375 446
376SYSTEMD_PACKAGES = "${@bb.utils.contains('PACKAGECONFIG', 'binfmt', '${PN}-binfmt', '', d)} \ 447SYSTEMD_PACKAGES = "${@bb.utils.contains('PACKAGECONFIG', 'binfmt', '${PN}-binfmt', '', d)} \
377 ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-gatewayd', '', d)} \ 448 ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-gatewayd', '', d)} \
378 ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-remote', '', d)} \ 449 ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-remote', '', d)} \
379 ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \ 450 ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \
380" 451"
381SYSTEMD_SERVICE_${PN}-binfmt = "systemd-binfmt.service" 452SYSTEMD_SERVICE:${PN}-binfmt = "systemd-binfmt.service"
382 453
383USERADD_PACKAGES = "${PN} ${PN}-extra-utils \ 454USERADD_PACKAGES = "${PN} \
384 ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-gateway', '', d)} \ 455 udev \
456 ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-gatewayd', '', d)} \
385 ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-remote', '', d)} \ 457 ${@bb.utils.contains('PACKAGECONFIG', 'microhttpd', '${PN}-journal-remote', '', d)} \
386 ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \ 458 ${@bb.utils.contains('PACKAGECONFIG', 'journal-upload', '${PN}-journal-upload', '', d)} \
387" 459"
388GROUPADD_PARAM_${PN} = "-r systemd-journal;" 460GROUPADD_PARAM:${PN} = "-r systemd-journal;"
389GROUPADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', '-r systemd-hostname;', '', d)}" 461GROUPADD_PARAM:udev = "-r render"
390USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'coredump', '--system -d / -M --shell /sbin/nologin systemd-coredump;', '', d)}" 462GROUPADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', '-r systemd-hostname;', '', d)}"
391USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'networkd', '--system -d / -M --shell /sbin/nologin systemd-network;', '', d)}" 463USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'coredump', '--system -d / -M --shell /sbin/nologin systemd-coredump;', '', d)}"
392USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'polkit', '--system --no-create-home --user-group --home-dir ${sysconfdir}/polkit-1 polkitd;', '', d)}" 464USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'networkd', '--system -d / -M --shell /sbin/nologin systemd-network;', '', d)}"
393USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'resolved', '--system -d / -M --shell /sbin/nologin systemd-resolve;', '', d)}" 465USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'polkit', '--system --no-create-home --user-group --home-dir ${sysconfdir}/polkit-1 polkitd;', '', d)}"
394USERADD_PARAM_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'timesyncd', '--system -d / -M --shell /sbin/nologin systemd-timesync;', '', d)}" 466USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'resolved', '--system -d / -M --shell /sbin/nologin systemd-resolve;', '', d)}"
395USERADD_PARAM_${PN}-extra-utils = "--system -d / -M --shell /sbin/nologin systemd-bus-proxy" 467USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'timesyncd', '--system -d / -M --shell /sbin/nologin systemd-timesync;', '', d)}"
396USERADD_PARAM_${PN}-journal-gateway = "--system -d / -M --shell /sbin/nologin systemd-journal-gateway" 468USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'oomd', '--system -d / -M --shell /sbin/nologin systemd-oom;', '', d)}"
397USERADD_PARAM_${PN}-journal-remote = "--system -d / -M --shell /sbin/nologin systemd-journal-remote" 469USERADD_PARAM:${PN}-journal-gatewayd = "--system -d / -M --shell /sbin/nologin systemd-journal-gateway"
398USERADD_PARAM_${PN}-journal-upload = "--system -d / -M --shell /sbin/nologin systemd-journal-upload" 470USERADD_PARAM:${PN}-journal-remote = "--system -d / -M --shell /sbin/nologin systemd-journal-remote"
399 471USERADD_PARAM:${PN}-journal-upload = "--system -d / -M --shell /sbin/nologin systemd-journal-upload"
400FILES_${PN}-analyze = "${bindir}/systemd-analyze" 472
401 473FILES:${PN}-analyze = "${bindir}/systemd-analyze"
402FILES_${PN}-initramfs = "/init" 474
403RDEPENDS_${PN}-initramfs = "${PN}" 475FILES:${PN}-crypt = "${bindir}/systemd-cryptenroll \
404 476 ${libdir}/cryptsetup \
405FILES_${PN}-gui = "${bindir}/systemadm" 477 "
406 478RRECOMMENDS:${PN} += "${PN}-crypt"
407FILES_${PN}-vconsole-setup = "${rootlibexecdir}/systemd/systemd-vconsole-setup \ 479
408 ${systemd_unitdir}/system/systemd-vconsole-setup.service \ 480FILES:${PN}-initramfs = "/init"
409 ${systemd_unitdir}/system/sysinit.target.wants/systemd-vconsole-setup.service" 481RDEPENDS:${PN}-initramfs = "${PN}"
410 482
411RDEPENDS_${PN}-kernel-install += "bash" 483FILES:${PN}-gui = "${bindir}/systemadm"
412FILES_${PN}-kernel-install = "${bindir}/kernel-install \ 484
485FILES:${PN}-vconsole-setup = "${rootlibexecdir}/systemd/systemd-vconsole-setup \
486 ${systemd_system_unitdir}/systemd-vconsole-setup.service \
487 ${systemd_system_unitdir}/sysinit.target.wants/systemd-vconsole-setup.service"
488
489RDEPENDS:${PN}-kernel-install += "bash"
490FILES:${PN}-kernel-install = "${bindir}/kernel-install \
413 ${sysconfdir}/kernel/ \ 491 ${sysconfdir}/kernel/ \
414 ${exec_prefix}/lib/kernel \ 492 ${exec_prefix}/lib/kernel \
415 " 493 "
416FILES_${PN}-rpm-macros = "${exec_prefix}/lib/rpm \ 494FILES:${PN}-rpm-macros = "${exec_prefix}/lib/rpm \
417 " 495 "
418 496
419FILES_${PN}-zsh-completion = "${datadir}/zsh/site-functions" 497FILES:${PN}-zsh-completion = "${datadir}/zsh/site-functions"
420 498
421FILES_${PN}-binfmt = "${sysconfdir}/binfmt.d/ \ 499FILES:${PN}-binfmt = "${sysconfdir}/binfmt.d/ \
422 ${exec_prefix}/lib/binfmt.d \ 500 ${exec_prefix}/lib/binfmt.d \
423 ${rootlibexecdir}/systemd/systemd-binfmt \ 501 ${rootlibexecdir}/systemd/systemd-binfmt \
424 ${systemd_unitdir}/system/proc-sys-fs-binfmt_misc.* \ 502 ${systemd_system_unitdir}/proc-sys-fs-binfmt_misc.* \
425 ${systemd_unitdir}/system/systemd-binfmt.service" 503 ${systemd_system_unitdir}/systemd-binfmt.service"
426RRECOMMENDS_${PN}-binfmt = "kernel-module-binfmt-misc" 504RRECOMMENDS:${PN}-binfmt = "${@bb.utils.contains('PACKAGECONFIG', 'binfmt', 'kernel-module-binfmt-misc', '', d)}"
427 505
428RRECOMMENDS_${PN}-vconsole-setup = "kbd kbd-consolefonts kbd-keymaps" 506RDEPENDS:${PN}-vconsole-setup = "${@bb.utils.contains('PACKAGECONFIG', 'vconsole', 'kbd kbd-consolefonts kbd-keymaps', '', d)}"
429 507
430 508
431FILES_${PN}-journal-gatewayd = "${rootlibexecdir}/systemd/systemd-journal-gatewayd \ 509FILES:${PN}-journal-gatewayd = "${rootlibexecdir}/systemd/systemd-journal-gatewayd \
432 ${systemd_system_unitdir}/systemd-journal-gatewayd.service \ 510 ${systemd_system_unitdir}/systemd-journal-gatewayd.service \
433 ${systemd_system_unitdir}/systemd-journal-gatewayd.socket \ 511 ${systemd_system_unitdir}/systemd-journal-gatewayd.socket \
434 ${systemd_system_unitdir}/sockets.target.wants/systemd-journal-gatewayd.socket \ 512 ${systemd_system_unitdir}/sockets.target.wants/systemd-journal-gatewayd.socket \
435 ${datadir}/systemd/gatewayd/browse.html \ 513 ${datadir}/systemd/gatewayd/browse.html \
436 " 514 "
437SYSTEMD_SERVICE_${PN}-journal-gatewayd = "systemd-journal-gatewayd.socket" 515SYSTEMD_SERVICE:${PN}-journal-gatewayd = "systemd-journal-gatewayd.socket"
438 516
439FILES_${PN}-journal-upload = "${rootlibexecdir}/systemd/systemd-journal-upload \ 517FILES:${PN}-journal-upload = "${rootlibexecdir}/systemd/systemd-journal-upload \
440 ${systemd_system_unitdir}/systemd-journal-upload.service \ 518 ${systemd_system_unitdir}/systemd-journal-upload.service \
441 ${sysconfdir}/systemd/journal-upload.conf \ 519 ${sysconfdir}/systemd/journal-upload.conf \
442 " 520 "
443SYSTEMD_SERVICE_${PN}-journal-upload = "systemd-journal-upload.service" 521SYSTEMD_SERVICE:${PN}-journal-upload = "systemd-journal-upload.service"
444 522
445FILES_${PN}-journal-remote = "${rootlibexecdir}/systemd/systemd-journal-remote \ 523FILES:${PN}-journal-remote = "${rootlibexecdir}/systemd/systemd-journal-remote \
446 ${sysconfdir}/systemd/journal-remote.conf \ 524 ${sysconfdir}/systemd/journal-remote.conf \
447 ${systemd_system_unitdir}/systemd-journal-remote.service \ 525 ${systemd_system_unitdir}/systemd-journal-remote.service \
448 ${systemd_system_unitdir}/systemd-journal-remote.socket \ 526 ${systemd_system_unitdir}/systemd-journal-remote.socket \
449 " 527 "
450SYSTEMD_SERVICE_${PN}-journal-remote = "systemd-journal-remote.socket" 528SYSTEMD_SERVICE:${PN}-journal-remote = "systemd-journal-remote.socket"
451 529
452 530
453FILES_${PN}-container = "${sysconfdir}/dbus-1/system.d/org.freedesktop.import1.conf \ 531FILES:${PN}-container = "${sysconfdir}/dbus-1/system.d/org.freedesktop.import1.conf \
454 ${sysconfdir}/dbus-1/system.d/org.freedesktop.machine1.conf \ 532 ${sysconfdir}/dbus-1/system.d/org.freedesktop.machine1.conf \
455 ${sysconfdir}/systemd/system/multi-user.target.wants/machines.target \ 533 ${sysconfdir}/systemd/system/multi-user.target.wants/machines.target \
456 ${base_bindir}/machinectl \ 534 ${base_bindir}/machinectl \
@@ -474,8 +552,8 @@ FILES_${PN}-container = "${sysconfdir}/dbus-1/system.d/org.freedesktop.import1.c
474 ${rootlibexecdir}/systemd/systemd-machined \ 552 ${rootlibexecdir}/systemd/systemd-machined \
475 ${rootlibexecdir}/systemd/systemd-pull \ 553 ${rootlibexecdir}/systemd/systemd-pull \
476 ${exec_prefix}/lib/tmpfiles.d/systemd-nspawn.conf \ 554 ${exec_prefix}/lib/tmpfiles.d/systemd-nspawn.conf \
555 ${exec_prefix}/lib/tmpfiles.d/README \
477 ${systemd_system_unitdir}/systemd-nspawn@.service \ 556 ${systemd_system_unitdir}/systemd-nspawn@.service \
478 ${libdir}/libnss_mymachines.so.2 \
479 ${datadir}/dbus-1/system-services/org.freedesktop.import1.service \ 557 ${datadir}/dbus-1/system-services/org.freedesktop.import1.service \
480 ${datadir}/dbus-1/system-services/org.freedesktop.machine1.service \ 558 ${datadir}/dbus-1/system-services/org.freedesktop.machine1.service \
481 ${datadir}/dbus-1/system.d/org.freedesktop.import1.conf \ 559 ${datadir}/dbus-1/system.d/org.freedesktop.import1.conf \
@@ -484,13 +562,20 @@ FILES_${PN}-container = "${sysconfdir}/dbus-1/system.d/org.freedesktop.import1.c
484 ${datadir}/polkit-1/actions/org.freedesktop.machine1.policy \ 562 ${datadir}/polkit-1/actions/org.freedesktop.machine1.policy \
485 " 563 "
486 564
487RRECOMMENDS_${PN}-container += "\ 565RDEPENDS:${PN}-container = "${@bb.utils.contains('PACKAGECONFIG', 'nss-mymachines', 'libnss-mymachines', '', d)}"
488 ${PN}-journal-upload \ 566
489 ${PN}-journal-remote \ 567# "machinectl import-tar" uses "tar --numeric-owner", not supported by busybox.
568RRECOMMENDS:${PN}-container += "\
490 ${PN}-journal-gatewayd \ 569 ${PN}-journal-gatewayd \
570 ${PN}-journal-remote \
571 ${PN}-journal-upload \
572 kernel-module-dm-mod \
573 kernel-module-loop \
574 kernel-module-tun \
575 tar \
491 " 576 "
492 577
493FILES_${PN}-extra-utils = "\ 578FILES:${PN}-extra-utils = "\
494 ${base_bindir}/systemd-escape \ 579 ${base_bindir}/systemd-escape \
495 ${base_bindir}/systemd-inhibit \ 580 ${base_bindir}/systemd-inhibit \
496 ${bindir}/systemd-detect-virt \ 581 ${bindir}/systemd-detect-virt \
@@ -498,49 +583,56 @@ FILES_${PN}-extra-utils = "\
498 ${bindir}/systemd-path \ 583 ${bindir}/systemd-path \
499 ${bindir}/systemd-run \ 584 ${bindir}/systemd-run \
500 ${bindir}/systemd-cat \ 585 ${bindir}/systemd-cat \
586 ${bindir}/systemd-creds \
501 ${bindir}/systemd-delta \ 587 ${bindir}/systemd-delta \
502 ${bindir}/systemd-cgls \ 588 ${bindir}/systemd-cgls \
503 ${bindir}/systemd-cgtop \ 589 ${bindir}/systemd-cgtop \
504 ${bindir}/systemd-stdio-bridge \ 590 ${bindir}/systemd-stdio-bridge \
505 ${base_bindir}/systemd-ask-password \ 591 ${base_bindir}/systemd-ask-password \
506 ${base_bindir}/systemd-tty-ask-password-agent \ 592 ${base_bindir}/systemd-tty-ask-password-agent \
507 ${systemd_unitdir}/system/systemd-ask-password-console.path \ 593 ${base_sbindir}/mount.ddi \
508 ${systemd_unitdir}/system/systemd-ask-password-console.service \ 594 ${systemd_system_unitdir}/initrd.target.wants/systemd-pcrphase-initrd.path \
509 ${systemd_unitdir}/system/systemd-ask-password-wall.path \ 595 ${systemd_system_unitdir}/systemd-ask-password-console.path \
510 ${systemd_unitdir}/system/systemd-ask-password-wall.service \ 596 ${systemd_system_unitdir}/systemd-ask-password-console.service \
511 ${systemd_unitdir}/system/sysinit.target.wants/systemd-ask-password-console.path \ 597 ${systemd_system_unitdir}/systemd-ask-password-wall.path \
512 ${systemd_unitdir}/system/sysinit.target.wants/systemd-ask-password-wall.path \ 598 ${systemd_system_unitdir}/systemd-ask-password-wall.service \
513 ${systemd_unitdir}/system/multi-user.target.wants/systemd-ask-password-wall.path \ 599 ${systemd_system_unitdir}/sysinit.target.wants/systemd-ask-password-console.path \
600 ${systemd_system_unitdir}/sysinit.target.wants/systemd-ask-password-wall.path \
601 ${systemd_system_unitdir}/sysinit.target.wants/systemd-pcrphase.path \
602 ${systemd_system_unitdir}/sysinit.target.wants/systemd-pcrphase-sysinit.path \
603 ${systemd_system_unitdir}/multi-user.target.wants/systemd-ask-password-wall.path \
514 ${rootlibexecdir}/systemd/systemd-resolve-host \ 604 ${rootlibexecdir}/systemd/systemd-resolve-host \
515 ${rootlibexecdir}/systemd/systemd-ac-power \ 605 ${rootlibexecdir}/systemd/systemd-ac-power \
516 ${rootlibexecdir}/systemd/systemd-activate \ 606 ${rootlibexecdir}/systemd/systemd-activate \
517 ${rootlibexecdir}/systemd/systemd-bus-proxyd \ 607 ${rootlibexecdir}/systemd/systemd-measure \
518 ${systemd_unitdir}/system/systemd-bus-proxyd.service \ 608 ${rootlibexecdir}/systemd/systemd-pcrphase \
519 ${systemd_unitdir}/system/systemd-bus-proxyd.socket \
520 ${rootlibexecdir}/systemd/systemd-socket-proxyd \ 609 ${rootlibexecdir}/systemd/systemd-socket-proxyd \
521 ${rootlibexecdir}/systemd/systemd-reply-password \ 610 ${rootlibexecdir}/systemd/systemd-reply-password \
522 ${rootlibexecdir}/systemd/systemd-sleep \ 611 ${rootlibexecdir}/systemd/systemd-sleep \
523 ${rootlibexecdir}/systemd/system-sleep \ 612 ${rootlibexecdir}/systemd/system-sleep \
524 ${systemd_unitdir}/system/systemd-hibernate.service \ 613 ${systemd_system_unitdir}/systemd-hibernate.service \
525 ${systemd_unitdir}/system/systemd-hybrid-sleep.service \ 614 ${systemd_system_unitdir}/systemd-hybrid-sleep.service \
526 ${systemd_unitdir}/system/systemd-suspend.service \ 615 ${systemd_system_unitdir}/systemd-pcrphase-initrd.service \
527 ${systemd_unitdir}/system/sleep.target \ 616 ${systemd_system_unitdir}/systemd-pcrphase.service \
617 ${systemd_system_unitdir}/systemd-pcrphase-sysinit.service \
618 ${systemd_system_unitdir}/systemd-suspend.service \
619 ${systemd_system_unitdir}/sleep.target \
528 ${rootlibexecdir}/systemd/systemd-initctl \ 620 ${rootlibexecdir}/systemd/systemd-initctl \
529 ${systemd_unitdir}/system/systemd-initctl.service \ 621 ${systemd_system_unitdir}/systemd-initctl.service \
530 ${systemd_unitdir}/system/systemd-initctl.socket \ 622 ${systemd_system_unitdir}/systemd-initctl.socket \
531 ${systemd_unitdir}/system/sockets.target.wants/systemd-initctl.socket \ 623 ${systemd_system_unitdir}/sockets.target.wants/systemd-initctl.socket \
532 ${rootlibexecdir}/systemd/system-generators/systemd-gpt-auto-generator \ 624 ${rootlibexecdir}/systemd/system-generators/systemd-gpt-auto-generator \
533 ${rootlibexecdir}/systemd/systemd-cgroups-agent \ 625 ${rootlibexecdir}/systemd/systemd-cgroups-agent \
534" 626"
535 627
536FILES_${PN}-udev-rules = "\ 628FILES:${PN}-udev-rules = "\
537 ${rootlibexecdir}/udev/rules.d/70-uaccess.rules \ 629 ${rootlibexecdir}/udev/rules.d/70-uaccess.rules \
538 ${rootlibexecdir}/udev/rules.d/71-seat.rules \ 630 ${rootlibexecdir}/udev/rules.d/71-seat.rules \
539 ${rootlibexecdir}/udev/rules.d/73-seat-late.rules \ 631 ${rootlibexecdir}/udev/rules.d/73-seat-late.rules \
540 ${rootlibexecdir}/udev/rules.d/99-systemd.rules \ 632 ${rootlibexecdir}/udev/rules.d/99-systemd.rules \
541" 633"
542 634
543CONFFILES_${PN} = "${sysconfdir}/systemd/coredump.conf \ 635CONFFILES:${PN} = "${sysconfdir}/systemd/coredump.conf \
544 ${sysconfdir}/systemd/journald.conf \ 636 ${sysconfdir}/systemd/journald.conf \
545 ${sysconfdir}/systemd/logind.conf \ 637 ${sysconfdir}/systemd/logind.conf \
546 ${sysconfdir}/systemd/networkd.conf \ 638 ${sysconfdir}/systemd/networkd.conf \
@@ -552,7 +644,7 @@ CONFFILES_${PN} = "${sysconfdir}/systemd/coredump.conf \
552 ${sysconfdir}/systemd/user.conf \ 644 ${sysconfdir}/systemd/user.conf \
553" 645"
554 646
555FILES_${PN} = " ${base_bindir}/* \ 647FILES:${PN} = " ${base_bindir}/* \
556 ${base_sbindir}/shutdown \ 648 ${base_sbindir}/shutdown \
557 ${base_sbindir}/halt \ 649 ${base_sbindir}/halt \
558 ${base_sbindir}/poweroff \ 650 ${base_sbindir}/poweroff \
@@ -566,6 +658,8 @@ FILES_${PN} = " ${base_bindir}/* \
566 ${datadir}/polkit-1 \ 658 ${datadir}/polkit-1 \
567 ${datadir}/${BPN} \ 659 ${datadir}/${BPN} \
568 ${datadir}/factory \ 660 ${datadir}/factory \
661 ${sysconfdir}/credstore/ \
662 ${sysconfdir}/credstore.encrypted/ \
569 ${sysconfdir}/dbus-1/ \ 663 ${sysconfdir}/dbus-1/ \
570 ${sysconfdir}/modules-load.d/ \ 664 ${sysconfdir}/modules-load.d/ \
571 ${sysconfdir}/pam.d/ \ 665 ${sysconfdir}/pam.d/ \
@@ -578,6 +672,7 @@ FILES_${PN} = " ${base_bindir}/* \
578 ${sysconfdir}/resolv-conf.systemd \ 672 ${sysconfdir}/resolv-conf.systemd \
579 ${sysconfdir}/X11/xinit/xinitrc.d/* \ 673 ${sysconfdir}/X11/xinit/xinitrc.d/* \
580 ${rootlibexecdir}/systemd/* \ 674 ${rootlibexecdir}/systemd/* \
675 ${rootlibdir}/systemd/libsystemd-core* \
581 ${libdir}/pam.d \ 676 ${libdir}/pam.d \
582 ${nonarch_libdir}/pam.d \ 677 ${nonarch_libdir}/pam.d \
583 ${systemd_unitdir}/* \ 678 ${systemd_unitdir}/* \
@@ -592,14 +687,18 @@ FILES_${PN} = " ${base_bindir}/* \
592 ${bindir}/timedatectl \ 687 ${bindir}/timedatectl \
593 ${bindir}/bootctl \ 688 ${bindir}/bootctl \
594 ${bindir}/oomctl \ 689 ${bindir}/oomctl \
690 ${bindir}/userdbctl \
691 ${exec_prefix}/lib/credstore \
595 ${exec_prefix}/lib/tmpfiles.d/*.conf \ 692 ${exec_prefix}/lib/tmpfiles.d/*.conf \
596 ${exec_prefix}/lib/systemd \ 693 ${exec_prefix}/lib/systemd \
597 ${exec_prefix}/lib/modules-load.d \ 694 ${exec_prefix}/lib/modules-load.d \
598 ${exec_prefix}/lib/sysctl.d \ 695 ${exec_prefix}/lib/sysctl.d \
599 ${exec_prefix}/lib/sysusers.d \ 696 ${exec_prefix}/lib/sysusers.d \
600 ${exec_prefix}/lib/environment.d \ 697 ${exec_prefix}/lib/environment.d \
698 ${exec_prefix}/lib/pcrlock.d \
601 ${localstatedir} \ 699 ${localstatedir} \
602 ${rootlibexecdir}/modprobe.d/systemd.conf \ 700 ${rootlibexecdir}/modprobe.d/systemd.conf \
701 ${rootlibexecdir}/modprobe.d/README \
603 ${datadir}/dbus-1/system.d/org.freedesktop.timedate1.conf \ 702 ${datadir}/dbus-1/system.d/org.freedesktop.timedate1.conf \
604 ${datadir}/dbus-1/system.d/org.freedesktop.locale1.conf \ 703 ${datadir}/dbus-1/system.d/org.freedesktop.locale1.conf \
605 ${datadir}/dbus-1/system.d/org.freedesktop.network1.conf \ 704 ${datadir}/dbus-1/system.d/org.freedesktop.network1.conf \
@@ -611,39 +710,47 @@ FILES_${PN} = " ${base_bindir}/* \
611 ${datadir}/dbus-1/system.d/org.freedesktop.timesync1.conf \ 710 ${datadir}/dbus-1/system.d/org.freedesktop.timesync1.conf \
612 ${datadir}/dbus-1/system.d/org.freedesktop.portable1.conf \ 711 ${datadir}/dbus-1/system.d/org.freedesktop.portable1.conf \
613 ${datadir}/dbus-1/system.d/org.freedesktop.oom1.conf \ 712 ${datadir}/dbus-1/system.d/org.freedesktop.oom1.conf \
713 ${datadir}/dbus-1/system.d/org.freedesktop.home1.conf \
614 " 714 "
615 715
616FILES_${PN}-dev += "${base_libdir}/security/*.la ${datadir}/dbus-1/interfaces/ ${sysconfdir}/rpm/macros.systemd" 716FILES:${PN}-dev += "${base_libdir}/security/*.la ${datadir}/dbus-1/interfaces/ ${sysconfdir}/rpm/macros.systemd"
617 717
618RDEPENDS_${PN} += "kmod dbus util-linux-mount util-linux-umount udev (= ${EXTENDPKGV}) systemd-udev-rules util-linux-agetty util-linux-fsck" 718RDEPENDS:${PN} += "kmod dbus util-linux-mount util-linux-umount udev (= ${EXTENDPKGV}) systemd-udev-rules util-linux-agetty util-linux-fsck util-linux-swaponoff"
619RDEPENDS_${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', '', 'systemd-serialgetty', d)}" 719RDEPENDS:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'serial-getty-generator', '', 'systemd-serialgetty', d)}"
620RDEPENDS_${PN} += "volatile-binds" 720RDEPENDS:${PN} += "volatile-binds"
621 721
622RRECOMMENDS_${PN} += "systemd-extra-utils \ 722RRECOMMENDS:${PN} += "systemd-extra-utils \
623 udev-hwdb \ 723 udev-hwdb \
624 e2fsprogs-e2fsck \ 724 e2fsprogs-e2fsck \
625 kernel-module-autofs4 kernel-module-unix kernel-module-ipv6 kernel-module-sch-fq-codel \ 725 kernel-module-autofs4 kernel-module-unix kernel-module-ipv6 kernel-module-sch-fq-codel \
626 os-release \ 726 os-release \
627 systemd-conf \ 727 systemd-conf \
728 ${@bb.utils.contains('PACKAGECONFIG', 'logind', 'pam-plugin-umask', '', d)} \
628" 729"
629 730
630INSANE_SKIP_${PN} += "dev-so libdir" 731INSANE_SKIP:${PN} += "dev-so libdir"
631INSANE_SKIP_${PN}-dbg += "libdir" 732INSANE_SKIP:${PN}-dbg += "libdir"
632INSANE_SKIP_${PN}-doc += " libdir" 733INSANE_SKIP:${PN}-doc += " libdir"
734INSANE_SKIP:libsystemd-shared += "libdir"
735
736FILES:libsystemd-shared = "${rootlibdir}/systemd/libsystemd-shared*.so"
633 737
634RPROVIDES_udev = "hotplug" 738RPROVIDES:udev = "hotplug"
635 739
636RDEPENDS_udev-hwdb += "udev" 740RDEPENDS:udev-bash-completion += "bash-completion"
741RDEPENDS:udev-hwdb += "udev"
637 742
638FILES_udev += "${base_sbindir}/udevd \ 743FILES:udev += "${base_sbindir}/udevd \
639 ${rootlibexecdir}/systemd/network/99-default.link \ 744 ${rootlibexecdir}/systemd/network/99-default.link \
640 ${rootlibexecdir}/systemd/systemd-udevd \ 745 ${rootlibexecdir}/systemd/systemd-udevd \
641 ${rootlibexecdir}/udev/accelerometer \ 746 ${rootlibexecdir}/udev/accelerometer \
642 ${rootlibexecdir}/udev/ata_id \ 747 ${rootlibexecdir}/udev/ata_id \
643 ${rootlibexecdir}/udev/cdrom_id \ 748 ${rootlibexecdir}/udev/cdrom_id \
644 ${rootlibexecdir}/udev/collect \ 749 ${rootlibexecdir}/udev/collect \
750 ${rootlibexecdir}/udev/dmi_memory_id \
645 ${rootlibexecdir}/udev/fido_id \ 751 ${rootlibexecdir}/udev/fido_id \
646 ${rootlibexecdir}/udev/findkeyboards \ 752 ${rootlibexecdir}/udev/findkeyboards \
753 ${rootlibexecdir}/udev/iocost \
647 ${rootlibexecdir}/udev/keyboard-force-release.sh \ 754 ${rootlibexecdir}/udev/keyboard-force-release.sh \
648 ${rootlibexecdir}/udev/keymap \ 755 ${rootlibexecdir}/udev/keymap \
649 ${rootlibexecdir}/udev/mtd_probe \ 756 ${rootlibexecdir}/udev/mtd_probe \
@@ -655,20 +762,25 @@ FILES_udev += "${base_sbindir}/udevd \
655 ${rootlibexecdir}/udev/rules.d/60-autosuspend-chromiumos.rules \ 762 ${rootlibexecdir}/udev/rules.d/60-autosuspend-chromiumos.rules \
656 ${rootlibexecdir}/udev/rules.d/60-block.rules \ 763 ${rootlibexecdir}/udev/rules.d/60-block.rules \
657 ${rootlibexecdir}/udev/rules.d/60-cdrom_id.rules \ 764 ${rootlibexecdir}/udev/rules.d/60-cdrom_id.rules \
765 ${rootlibexecdir}/udev/rules.d/60-dmi-id.rules \
658 ${rootlibexecdir}/udev/rules.d/60-drm.rules \ 766 ${rootlibexecdir}/udev/rules.d/60-drm.rules \
659 ${rootlibexecdir}/udev/rules.d/60-evdev.rules \ 767 ${rootlibexecdir}/udev/rules.d/60-evdev.rules \
660 ${rootlibexecdir}/udev/rules.d/60-fido-id.rules \ 768 ${rootlibexecdir}/udev/rules.d/60-fido-id.rules \
769 ${rootlibexecdir}/udev/rules.d/60-infiniband.rules \
661 ${rootlibexecdir}/udev/rules.d/60-input-id.rules \ 770 ${rootlibexecdir}/udev/rules.d/60-input-id.rules \
662 ${rootlibexecdir}/udev/rules.d/60-persistent-alsa.rules \ 771 ${rootlibexecdir}/udev/rules.d/60-persistent-alsa.rules \
663 ${rootlibexecdir}/udev/rules.d/60-persistent-input.rules \ 772 ${rootlibexecdir}/udev/rules.d/60-persistent-input.rules \
664 ${rootlibexecdir}/udev/rules.d/60-persistent-storage.rules \ 773 ${rootlibexecdir}/udev/rules.d/60-persistent-storage.rules \
774 ${rootlibexecdir}/udev/rules.d/60-persistent-storage-mtd.rules \
665 ${rootlibexecdir}/udev/rules.d/60-persistent-storage-tape.rules \ 775 ${rootlibexecdir}/udev/rules.d/60-persistent-storage-tape.rules \
666 ${rootlibexecdir}/udev/rules.d/60-persistent-v4l.rules \ 776 ${rootlibexecdir}/udev/rules.d/60-persistent-v4l.rules \
667 ${rootlibexecdir}/udev/rules.d/60-sensor.rules \ 777 ${rootlibexecdir}/udev/rules.d/60-sensor.rules \
668 ${rootlibexecdir}/udev/rules.d/60-serial.rules \ 778 ${rootlibexecdir}/udev/rules.d/60-serial.rules \
669 ${rootlibexecdir}/udev/rules.d/61-autosuspend-manual.rules \ 779 ${rootlibexecdir}/udev/rules.d/61-autosuspend-manual.rules \
670 ${rootlibexecdir}/udev/rules.d/64-btrfs.rules \ 780 ${rootlibexecdir}/udev/rules.d/64-btrfs.rules \
781 ${rootlibexecdir}/udev/rules.d/70-camera.rules \
671 ${rootlibexecdir}/udev/rules.d/70-joystick.rules \ 782 ${rootlibexecdir}/udev/rules.d/70-joystick.rules \
783 ${rootlibexecdir}/udev/rules.d/70-memory.rules \
672 ${rootlibexecdir}/udev/rules.d/70-mouse.rules \ 784 ${rootlibexecdir}/udev/rules.d/70-mouse.rules \
673 ${rootlibexecdir}/udev/rules.d/70-power-switch.rules \ 785 ${rootlibexecdir}/udev/rules.d/70-power-switch.rules \
674 ${rootlibexecdir}/udev/rules.d/70-touchpad.rules \ 786 ${rootlibexecdir}/udev/rules.d/70-touchpad.rules \
@@ -677,31 +789,42 @@ FILES_udev += "${base_sbindir}/udevd \
677 ${rootlibexecdir}/udev/rules.d/78-sound-card.rules \ 789 ${rootlibexecdir}/udev/rules.d/78-sound-card.rules \
678 ${rootlibexecdir}/udev/rules.d/80-drivers.rules \ 790 ${rootlibexecdir}/udev/rules.d/80-drivers.rules \
679 ${rootlibexecdir}/udev/rules.d/80-net-setup-link.rules \ 791 ${rootlibexecdir}/udev/rules.d/80-net-setup-link.rules \
792 ${rootlibexecdir}/udev/rules.d/81-net-dhcp.rules \
680 ${rootlibexecdir}/udev/rules.d/90-vconsole.rules \ 793 ${rootlibexecdir}/udev/rules.d/90-vconsole.rules \
794 ${rootlibexecdir}/udev/rules.d/90-iocost.rules \
795 ${rootlibexecdir}/udev/rules.d/README \
681 ${sysconfdir}/udev \ 796 ${sysconfdir}/udev \
682 ${sysconfdir}/init.d/systemd-udevd \ 797 ${sysconfdir}/init.d/systemd-udevd \
683 ${systemd_unitdir}/system/*udev* \ 798 ${systemd_system_unitdir}/*udev* \
684 ${systemd_unitdir}/system/*.wants/*udev* \ 799 ${systemd_system_unitdir}/*.wants/*udev* \
685 ${base_bindir}/systemd-hwdb \ 800 ${base_bindir}/systemd-hwdb \
686 ${base_bindir}/udevadm \ 801 ${base_bindir}/udevadm \
687 ${base_sbindir}/udevadm \ 802 ${base_sbindir}/udevadm \
688 ${libexecdir}/${MLPREFIX}udevadm \ 803 ${systemd_system_unitdir}/systemd-hwdb-update.service \
689 ${datadir}/bash-completion/completions/udevadm \
690 ${systemd_unitdir}/system/systemd-hwdb-update.service \
691 " 804 "
692 805
693FILES_udev-hwdb = "${rootlibexecdir}/udev/hwdb.d \ 806FILES:udev-bash-completion = "${datadir}/bash-completion/completions/udevadm"
807FILES:udev-hwdb = "${rootlibexecdir}/udev/hwdb.d \
694 " 808 "
695 809
696RCONFLICTS_${PN} = "tiny-init ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'resolvconf', '', d)}" 810RCONFLICTS:${PN} = "tiny-init ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'resolvconf', '', d)}"
697 811
698INITSCRIPT_PACKAGES = "udev" 812INITSCRIPT_PACKAGES = "udev"
699INITSCRIPT_NAME_udev = "systemd-udevd" 813INITSCRIPT_NAME:udev = "systemd-udevd"
700INITSCRIPT_PARAMS_udev = "start 03 S ." 814INITSCRIPT_PARAMS:udev = "start 03 S ."
701 815
702python __anonymous() { 816python __anonymous() {
703 if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d): 817 if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
704 d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1") 818 d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
819
820 if bb.utils.contains('DISTRO_FEATURES', 'systemd-resolved', True, False, d) and not bb.utils.contains('PACKAGECONFIG', 'nss-resolve resolved', True, False, d):
821 bb.error("DISTRO_FEATURES[systemd-resolved] requires PACKAGECONFIG[nss-resolve, resolved]")
822
823 if bb.utils.contains('PACKAGECONFIG', 'repart', True, False, d) and not bb.utils.contains('PACKAGECONFIG', 'openssl', True, False, d):
824 bb.error("PACKAGECONFIG[repart] requires PACKAGECONFIG[openssl]")
825
826 if bb.utils.contains('PACKAGECONFIG', 'homed', True, False, d) and not bb.utils.contains('PACKAGECONFIG', 'userdb openssl cryptsetup', True, False, d):
827 bb.error("PACKAGECONFIG[homed] requires PACKAGECONFIG[userdb], PACKAGECONFIG[openssl] and PACKAGECONFIG[cryptsetup]")
705} 828}
706 829
707python do_warn_musl() { 830python do_warn_musl() {
@@ -710,7 +833,7 @@ python do_warn_musl() {
710} 833}
711addtask warn_musl before do_configure 834addtask warn_musl before do_configure
712 835
713ALTERNATIVE_${PN} = "halt reboot shutdown poweroff runlevel ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'resolv-conf', '', d)}" 836ALTERNATIVE:${PN} = "halt reboot shutdown poweroff runlevel ${@bb.utils.contains('PACKAGECONFIG', 'resolved', 'resolv-conf', '', d)}"
714 837
715ALTERNATIVE_TARGET[resolv-conf] = "${sysconfdir}/resolv-conf.systemd" 838ALTERNATIVE_TARGET[resolv-conf] = "${sysconfdir}/resolv-conf.systemd"
716ALTERNATIVE_LINK_NAME[resolv-conf] = "${sysconfdir}/resolv.conf" 839ALTERNATIVE_LINK_NAME[resolv-conf] = "${sysconfdir}/resolv.conf"
@@ -736,27 +859,43 @@ ALTERNATIVE_TARGET[runlevel] = "${base_bindir}/systemctl"
736ALTERNATIVE_LINK_NAME[runlevel] = "${base_sbindir}/runlevel" 859ALTERNATIVE_LINK_NAME[runlevel] = "${base_sbindir}/runlevel"
737ALTERNATIVE_PRIORITY[runlevel] ?= "300" 860ALTERNATIVE_PRIORITY[runlevel] ?= "300"
738 861
739pkg_postinst_${PN}_libc-glibc () { 862pkg_postinst:${PN}:libc-glibc () {
740 sed -e '/^hosts:/s/\s*\<myhostname\>//' \ 863 if ${@bb.utils.contains('PACKAGECONFIG', 'myhostname', 'true', 'false', d)}; then
741 -e 's/\(^hosts:.*\)\(\<files\>\)\(.*\)\(\<dns\>\)\(.*\)/\1\2 myhostname \3\4\5/' \ 864 sed -e '/^hosts:/s/\s*\<myhostname\>//' \
742 -i $D${sysconfdir}/nsswitch.conf 865 -e 's/\(^hosts:.*\)\(\<files\>\)\(.*\)\(\<dns\>\)\(.*\)/\1\2 myhostname \3\4\5/' \
866 -i $D${sysconfdir}/nsswitch.conf
867 fi
868 if ${@bb.utils.contains('PACKAGECONFIG', 'nss', 'true', 'false', d)}; then
869 sed -e 's#\(^passwd:.*\)#\1 systemd#' \
870 -e 's#\(^group:.*\)#\1 systemd#' \
871 -e 's#\(^shadow:.*\)#\1 systemd#' \
872 -i $D${sysconfdir}/nsswitch.conf
873 fi
743} 874}
744 875
745pkg_prerm_${PN}_libc-glibc () { 876pkg_prerm:${PN}:libc-glibc () {
746 sed -e '/^hosts:/s/\s*\<myhostname\>//' \ 877 if ${@bb.utils.contains('PACKAGECONFIG', 'myhostname', 'true', 'false', d)}; then
747 -e '/^hosts:/s/\s*myhostname//' \ 878 sed -e '/^hosts:/s/\s*\<myhostname\>//' \
748 -i $D${sysconfdir}/nsswitch.conf 879 -e '/^hosts:/s/\s*myhostname//' \
880 -i $D${sysconfdir}/nsswitch.conf
881 fi
882 if ${@bb.utils.contains('PACKAGECONFIG', 'nss', 'true', 'false', d)}; then
883 sed -e '/^passwd:/s#\s*systemd##' \
884 -e '/^group:/s#\s*systemd##' \
885 -e '/^shadow:/s#\s*systemd##' \
886 -i $D${sysconfdir}/nsswitch.conf
887 fi
749} 888}
750 889
751PACKAGE_WRITE_DEPS += "qemu-native" 890PACKAGE_WRITE_DEPS += "qemu-native"
752pkg_postinst_udev-hwdb () { 891pkg_postinst:udev-hwdb () {
753 if test -n "$D"; then 892 if test -n "$D"; then
754 $INTERCEPT_DIR/postinst_intercept update_udev_hwdb ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} rootlibexecdir="${rootlibexecdir}" PREFERRED_PROVIDER_udev="${PREFERRED_PROVIDER_udev}" 893 $INTERCEPT_DIR/postinst_intercept update_udev_hwdb ${PKG} mlprefix=${MLPREFIX} binprefix=${MLPREFIX} rootlibexecdir="${rootlibexecdir}" PREFERRED_PROVIDER_udev="${PREFERRED_PROVIDER_udev}" base_bindir="${base_bindir}"
755 else 894 else
756 udevadm hwdb --update 895 udevadm hwdb --update
757 fi 896 fi
758} 897}
759 898
760pkg_prerm_udev-hwdb () { 899pkg_prerm:udev-hwdb () {
761 rm -f $D${sysconfdir}/udev/hwdb.bin 900 rm -f $D${sysconfdir}/udev/hwdb.bin
762} 901}