A => .gitignore +1 -0
A => dbus/0001-_dbus_generate_random_bytes-use-getrandom-2.patch +127 -0
@@ 1,127 @@
+From 7faabbeb1d735069a2fd1e24e20b2543306a0e28 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Tue, 24 Mar 2020 11:31:41 +0100
+Subject: [PATCH] _dbus_generate_random_bytes: use getrandom(2)
+
+Use getrandom(2) and fall back to /dev/urandom if it is missing or if it
+fails some any reason.
+
+This solves problem where dbus-uuidgen is called from a chroot which
+lacks /dev/urandom.
+
+Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
+---
+ cmake/ConfigureChecks.cmake | 2 ++
+ cmake/config.h.cmake | 2 ++
+ configure.ac | 3 ++-
+ dbus/dbus-sysdeps-unix.c | 23 ++++++++++++++++++++---
+ 4 files changed, 26 insertions(+), 4 deletions(-)
+
+diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake
+index a9a5fc90..f920c75f 100644
+--- a/cmake/ConfigureChecks.cmake
++++ b/cmake/ConfigureChecks.cmake
+@@ -26,6 +26,7 @@ check_include_file(strings.h HAVE_STRINGS_H)
+ check_include_file(syslog.h HAVE_SYSLOG_H)
+ check_include_files("stdint.h;sys/types.h;sys/event.h" HAVE_SYS_EVENT_H)
+ check_include_file(sys/inotify.h HAVE_SYS_INOTIFY_H)
++check_include_file(sys/random.h HAVE_SYS_RANDOM_H)
+ check_include_file(sys/resource.h HAVE_SYS_RESOURCE_H)
+ check_include_file(sys/stat.h HAVE_SYS_STAT_H)
+ check_include_file(sys/types.h HAVE_SYS_TYPES_H)
+@@ -62,6 +63,7 @@ check_symbol_exists(inotify_init1 "sys/inotify.h" HAVE_INOTIFY_INIT1)
+ check_symbol_exists(SCM_RIGHTS "sys/types.h;sys/socket.h;sys/un.h" HAVE_UNIX_FD_PASSING)
+ check_symbol_exists(prctl "sys/prctl.h" HAVE_PRCTL)
+ check_symbol_exists(raise "signal.h" HAVE_RAISE)
++check_symbol_exists(getrandom "sys/random.h" HAVE_GETRANDOM)
+ check_symbol_exists(getrlimit "sys/resource.h;sys/time.h" HAVE_GETRLIMIT)
+ check_symbol_exists(prlimit "sys/resource.h;sys/time.h" HAVE_PRLIMIT)
+ check_symbol_exists(setrlimit "sys/resource.h;sys/time.h" HAVE_SETRLIMIT)
+diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake
+index 11191821..10388fce 100644
+--- a/cmake/config.h.cmake
++++ b/cmake/config.h.cmake
+@@ -128,6 +128,7 @@
+ #cmakedefine HAVE_SYS_EVENTS_H
+ #cmakedefine HAVE_SYS_INOTIFY_H
+ #cmakedefine HAVE_SYS_PRCTL_H
++#cmakedefine HAVE_SYS_RANDOM_H 1
+ #cmakedefine HAVE_SYS_RESOURCE_H
+ #cmakedefine HAVE_SYS_STAT_H
+
+@@ -205,6 +206,7 @@
+ #cmakedefine HAVE_ACCEPT4 1
+ #cmakedefine HAVE_DIRFD 1
+ #cmakedefine HAVE_INOTIFY_INIT1 1
++#cmakedefine HAVE_GETRANDOM 1
+ #cmakedefine HAVE_GETRLIMIT 1
+ #cmakedefine HAVE_PRLIMIT 1
+ #cmakedefine HAVE_SETRLIMIT 1
+diff --git a/configure.ac b/configure.ac
+index a1ba877a..c9f50b0f 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -619,7 +619,7 @@ AC_DEFINE_UNQUOTED([DBUS_USE_SYNC], [$have_sync], [Use the gcc __sync extension]
+ AC_SEARCH_LIBS(socket,[socket network])
+ AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname)])
+
+-AC_CHECK_FUNCS([vsnprintf vasprintf nanosleep usleep setenv clearenv unsetenv socketpair getgrouplist fpathconf setrlimit poll setlocale localeconv strtoll strtoull issetugid getresuid setresuid getrlimit prlimit])
++AC_CHECK_FUNCS([vsnprintf vasprintf nanosleep usleep setenv clearenv unsetenv socketpair getgrouplist fpathconf setrlimit poll setlocale localeconv strtoll strtoull issetugid getresuid setresuid getrlimit getrandom prlimit])
+
+ AC_CHECK_HEADERS([syslog.h])
+ if test "x$ac_cv_header_syslog_h" = "xyes"; then
+@@ -667,6 +667,7 @@ fi
+
+ AC_CHECK_HEADERS(sys/resource.h)
+ AC_CHECK_HEADERS([sys/time.h])
++AC_CHECK_HEADERS([sys/random.h])
+
+ AC_CHECK_HEADERS(dirent.h)
+
+diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c
+index e8cd5b33..44f7711e 100644
+--- a/dbus/dbus-sysdeps-unix.c
++++ b/dbus/dbus-sysdeps-unix.c
+@@ -80,6 +80,9 @@
+ #ifdef HAVE_ALLOCA_H
+ #include <alloca.h>
+ #endif
++#ifdef HAVE_SYS_RANDOM_H
++#include <sys/random.h>
++#endif
+
+ #ifdef HAVE_ADT
+ #include <bsm/adt.h>
+@@ -3158,12 +3161,26 @@ _dbus_generate_random_bytes (DBusString *str,
+ int n_bytes,
+ DBusError *error)
+ {
+- int old_len;
++ int old_len = _dbus_string_get_length (str);
+ int fd;
+ int result;
++#ifdef HAVE_GETRANDOM
++ char *buffer;
++
++ if (!_dbus_string_lengthen (str, n_bytes))
++ {
++ _DBUS_SET_OOM (error);
++ return FALSE;
++ }
++
++ buffer = _dbus_string_get_data_len (str, old_len, n_bytes);
++ result = getrandom (buffer, n_bytes, GRND_NONBLOCK);
+
+- old_len = _dbus_string_get_length (str);
+- fd = -1;
++ if (result == n_bytes)
++ return TRUE;
++
++ _dbus_string_set_length (str, old_len);
++#endif
+
+ /* note, urandom on linux will fall back to pseudorandom */
+ fd = open ("/dev/urandom", O_RDONLY);
+--
+2.26.0
+
A => dbus/APKBUILD +94 -0
@@ 1,94 @@
+# Contributor: Natanael Copa <ncopa@alpinelinux.org>
+# Maintainer: xdavidwu <xdavidwuph@gmail.com>
+pkgname=dbus
+pkgver=1.12.22
+pkgrel=0
+pkgdesc="Freedesktop.org message bus system"
+url="https://www.freedesktop.org/Software/dbus"
+arch="all"
+license="AFL-2.1 OR GPL-2.0-or-later"
+depends_dev="util-linux-dev"
+makedepends="$depends_dev
+ autoconf
+ autoconf-archive
+ automake
+ expat-dev
+ glib-dev
+ libsm-dev
+ libtool
+ libx11-dev
+ xmlto
+ systemd-dev
+ "
+checkdepends="xvfb-run"
+pkggroups="messagebus"
+install="$pkgname.pre-install $pkgname.post-install"
+triggers="$pkgname.trigger=/usr/share/dbus-1/system.d"
+subpackages="$pkgname-dev $pkgname-doc $pkgname-libs $pkgname-x11"
+source="https://dbus.freedesktop.org/releases/dbus/dbus-$pkgver.tar.gz
+ 0001-_dbus_generate_random_bytes-use-getrandom-2.patch
+ "
+options="!check" # Introduces circular dependency with xorg-server (xvfb-run -> xvfb)
+
+# secfixes:
+# 1.12.18-r0:
+# - CVE-2020-12049
+# 1.12.16-r0:
+# - CVE-2019-12749
+
+prepare() {
+ default_prepare
+ autoreconf -vif
+}
+
+build() {
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --with-xml=expat \
+ --with-dbus-user=messagebus \
+ --with-system-pid-file=/run/dbus/dbus.pid \
+ --disable-verbose-mode \
+ --disable-static \
+ --enable-inotify \
+ --disable-dnotify \
+ --enable-modular-tests=yes \
+ --disable-asserts \
+ --enable-user-session \
+ --enable-xml-docs \
+ --with-session-socket-dir=/tmp \
+ --with-x \
+ --enable-systemd
+ make
+}
+
+check() {
+ xvfb-run make check
+}
+
+package() {
+ make -j1 DESTDIR="$pkgdir" install
+}
+
+libs() {
+ pkgdesc="D-BUS access libraries"
+ replaces="dbus"
+
+ amove usr/lib/lib*.so.*
+}
+
+x11() {
+ pkgdesc="X11 add-ons for D-BUS"
+ depends="dbus=$pkgver-r$pkgrel"
+
+ amove usr/bin/dbus-launch
+}
+
+
+sha512sums="
+0a716022f9d693fcaf871b6dfb5f242b49a8dd05d3316ec3e530f5129f1d81a2fa9caec795fa62cfdcba6ed21549fdd2f896f9bf1cc9a96e2a7d04f2c7ec7be6 dbus-1.12.22.tar.gz
+3db35499361e84d8e2469b88b033f49813b179188ac25f1841a989988c352af398a56dfd94383813626c6dfd032194f7a9fcdba001ccc3e005e7cd22dae7a7ed 0001-_dbus_generate_random_bytes-use-getrandom-2.patch
+"
A => dbus/dbus.post-install +3 -0
@@ 1,3 @@
+#!/bin/sh
+
+exec dbus-uuidgen --ensure=/etc/machine-id
A => dbus/dbus.pre-install +6 -0
@@ 1,6 @@
+#!/bin/sh
+
+addgroup -S messagebus 2>/dev/null
+adduser -S -D -H -h /dev/null -s /sbin/nologin -G messagebus -g messagebus messagebus 2>/dev/null
+
+exit 0
A => dbus/dbus.trigger +4 -0
@@ 1,4 @@
+#!/bin/sh
+
+dbus-send --system --type=method_call --dest=org.freedesktop.DBus / \
+ org.freedesktop.DBUS.ReloadConfig >/dev/null 2>&1 || :
A => elogind/APKBUILD +98 -0
@@ 1,98 @@
+# Contributor: Leo <thinkabit.ukim@gmail.com>
+# Maintainer: xdavidwu <xdavidwuph@gmail.com>
+pkgname=elogind
+pkgver=246.10
+pkgrel=5
+pkgdesc="Standalone fork of systemd's elogind"
+url="https://github.com/elogind/elogind"
+arch="all"
+license="GPL-2.0-or-later LGPL-2.1-or-later"
+depends="dbus shadow"
+options="!check" # Tests fail on builders
+makedepends="
+ meson
+ coreutils
+ docbook-xsl
+ gettext-dev
+ git
+ gperf
+ intltool
+ libxslt-dev
+ glib-dev
+ acl-dev
+ eudev-dev
+ libcap-dev
+ libseccomp-dev
+ linux-pam-dev
+ m4
+ dbus-dev
+ pcre2-dev
+ "
+subpackages="
+ $pkgname-dev
+ $pkgname-doc
+ $pkgname-lang
+ lib$pkgname:libs
+ $pkgname-zsh-completion:zshcomp:noarch
+ $pkgname-bash-completion:bashcomp:noarch
+ "
+source="https://github.com/elogind/elogind/archive/v$pkgver/elogind-v$pkgver.tar.gz
+ fix-mips-detection.patch
+ fix-version.patch
+ remove-polkit-gobject-1-check.patch
+ "
+
+build() {
+ case "$CARCH" in
+ # polkit is not available on these arches
+ s390x|mips|mips64|riscv64) _polkit=false; export CFLAGS="$CFLAGS -D__IGNORE_pkey_mprotect -DSO_PEERSEC=31" ;;
+ *) _polkit=true ;;
+ esac
+ export LDFLAGS="$LDFLAGS -lintl"
+ abuild-meson \
+ -Dcgroup-controller=elogind \
+ -Dhalt-path=/sbin/halt \
+ -Drootlibexecdir=/usr/libexec/elogind \
+ -Dreboot-path=/sbin/reboot \
+ -Ddefault-hierarchy=hybrid \
+ -Ddefault-kill-user-processes=false \
+ -Dpolkit=$_polkit \
+ -Dman=true \
+ build
+ meson compile ${JOBS:+-j ${JOBS}} -C build
+}
+
+check() {
+ meson test --no-rebuild -v -C build
+}
+
+package() {
+ DESTDIR="$pkgdir" meson install --no-rebuild -C build
+
+ # Install headers from elogind
+ install -Dm644 src/systemd/sd-id128.h usr/include/sd-id128.h
+ install -Dm644 src/systemd/_sd-common.h usr/include/_sd-common.h
+}
+
+zshcomp() {
+ pkgdesc="Zsh completion for $pkgname"
+ install_if="$pkgname=$pkgver-r$pkgrel zsh"
+
+ mkdir -p "$subpkgdir"/usr/share
+ mv "$pkgdir"/usr/share/zsh "$subpkgdir"/usr/share/
+}
+
+bashcomp() {
+ pkgdesc="Bash completion for $pkgname"
+ install_if="$pkgname=$pkgver-r$pkgrel bash-completion"
+
+ mkdir -p "$subpkgdir"/usr/share
+ mv "$pkgdir"/usr/share/bash-completion "$subpkgdir"/usr/share
+}
+
+sha512sums="
+9db0f068ed94ec07bab4d764ccb38840af3d05a4b7c9c539721906f5381b509cb9a3cbfb0453a978210d306136368de6162578c600d522416ef2a7ac1b9f348b elogind-v246.10.tar.gz
+0fda4318afc6db9c9d00121ed4f8267286e692cca04acf4c1006fab99267cdd6228e1d176293f99db043384ae6fa192fc8109a365bf221dda7f2c4177d104820 fix-mips-detection.patch
+178c33608f0d69fde8558c521aea9981e0a0bd4a6666d2e1b4f0714dbb7038955ceb86cf323ea741ee67f89218a2e7d332aa05507c2a06eb01fd0785dd81716b fix-version.patch
+5cf63f50e8623a4a6e403924860ba76b5dcd19220514c382175afb6f07dbbccc97a27f858ae0c7bc6869f7558255fffc3174e3ac468e5d47333d9cf1db9a5ac1 remove-polkit-gobject-1-check.patch
+"
A => elogind/fix-mips-detection.patch +13 -0
@@ 1,13 @@
+diff --git a/src/basic/missing_syscall.h b/src/basic/missing_syscall.h
+index ccfa657..20ddb08 100644
+--- a/src/basic/missing_syscall.h
++++ b/src/basic/missing_syscall.h
+@@ -11,7 +11,7 @@
+ #include <sys/wait.h>
+ #include <unistd.h>
+
+-#ifdef ARCH_MIPS
++#ifdef _MIPS_SIM
+ #include <asm/sgidefs.h>
+ #endif
+
A => elogind/fix-version.patch +13 -0
@@ 1,13 @@
+diff --git a/meson.build b/meson.build
+index a795b99..212f70b 100644
+--- a/meson.build
++++ b/meson.build
+@@ -1,7 +1,7 @@
+ # SPDX-License-Identifier: LGPL-2.1+
+
+ project('elogind', 'c',
+- version : '246.10',
++ version : '246',
+ license : 'LGPLv2+',
+ default_options: [
+ 'c_std=gnu99',
A => elogind/remove-polkit-gobject-1-check.patch +54 -0
@@ 1,54 @@
+From: Jakub Jirutka <jakub@jirutka.cz>
+Date: Wed, 20 Oct 2021 00:18:47 +0200
+Subject: [PATCH] Remove build-time check for polkit-gobject-1
+
+polkit-gobject-1 is actually not needed for building elogind with PolKit
+support; elogind binaries are not dynamically linked against polkit
+libraries, there's only runtime dependency.
+
+I've verified that building without polkit-dev installed won't change the
+resulting binaries.
+
+We need to remove polkit-dev dependency from elogind to avoid circular
+dependency between polkit and elogind.
+
+See: https://gitlab.alpinelinux.org/alpine/aports/-/issues/13095
+
+--- a/meson.build
++++ b/meson.build
+@@ -1148,21 +1148,21 @@
+ install_polkit_pkla = false
+ if want_polkit != 'false' and not skip_deps
+ install_polkit = true
+-
+- libpolkit = dependency('polkit-gobject-1',
+- required : false)
+- if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
+- message('Old polkit detected, will install pkla files')
+- install_polkit_pkla = true
+- endif
++# XXX-Patched: libpolkit is actually not needed for building with polkit support
++# libpolkit = dependency('polkit-gobject-1',
++# required : false)
++# if libpolkit.found() and libpolkit.version().version_compare('< 0.106')
++# message('Old polkit detected, will install pkla files')
++# install_polkit_pkla = true
++# endif
+ #if 1 /// Disable polkit completely if libpolkit is not there. See elogind issue #167
+- if not libpolkit.found()
+- if want_polkit != 'auto'
+- error('Polkit requested but libpolkit was not found.')
+- endif
+- install_polkit = false
+- want_polkit = false
+- endif
++# if not libpolkit.found()
++# if want_polkit != 'auto'
++# error('Polkit requested but libpolkit was not found.')
++# endif
++# install_polkit = false
++# want_polkit = false
++# endif
+ #endif // 1
+ endif
+ conf.set10('ENABLE_POLKIT', install_polkit)
A => iwd/APKBUILD +49 -0
@@ 1,49 @@
+# Contributor: Milan P. Stanić <mps@arvanta.net>
+# Contributor: Jakub Jirutka <jakub@jirutka.cz>
+# Maintainer: xdavidwu <xdavidwuph@gmail.com>
+pkgname=iwd-systemd
+pkgver=1.26
+pkgrel=0
+pkgdesc="Internet Wireless Daemon (systemd units)"
+url="https://iwd.wiki.kernel.org/"
+arch="noarch"
+license="LGPL-2.1-or-later"
+makedepends="dbus-dev readline-dev linux-headers systemd-dev"
+options="!check" # some builders fail on some test
+checkdepends="coreutils"
+install_if="iwd systemd"
+source="https://mirrors.edge.kernel.org/pub/linux/network/wireless/iwd-$pkgver.tar.gz"
+builddir="$srcdir/iwd-$pkgver"
+
+build() {
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --localstatedir=/var \
+ --enable-systemd-service \
+ --enable-sim-hardcoded \
+ --enable-wired \
+ --enable-tools
+ make
+}
+
+check() {
+ make check
+}
+
+package() {
+ make DESTDIR="$pkgdir" install
+
+ rm -rf "$pkgdir"/etc
+ rm -rf "$pkgdir"/usr/bin
+ rm -rf "$pkgdir"/usr/libexec
+ rm -rf "$pkgdir"/usr/share/dbus-1/system.d
+ rm -rf "$pkgdir"/usr/share/man
+}
+
+sha512sums="
+e67026d512936bbccb5f5e717031a26d8edb5046edb82923dd6a61d5645401a9718f46376f325cfc72c34d1ca0ab2ca07f3b25c2fc349196c73998b53824ed0e iwd-1.26.tar.gz
+"
A => openforivpn/APKBUILD +44 -0
@@ 1,44 @@
+# Contributor: Taner Tas <taner76@gmail.com>
+# Maintainer: xdavidwu <xdavidwu@gmail.com>
+pkgname=openfortivpn
+pkgver=1.17.2
+pkgrel=0
+pkgdesc="Openfortivpn is a client for PPP+SSL VPN tunnel services"
+url="https://github.com/adrienverge/openfortivpn"
+arch="all"
+license="GPL-3.0-only"
+depends="ppp"
+makedepends="
+ autoconf
+ automake
+ openssl-dev
+ systemd
+ "
+subpackages="$pkgname-doc"
+source="
+ $pkgname-$pkgver.tar.gz::https://github.com/adrienverge/openfortivpn/archive/v$pkgver.tar.gz
+ "
+options="!check" # No test suite
+
+prepare() {
+ default_prepare
+ autoreconf -fi
+}
+
+build() {
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --enable-resolvconf
+ make
+}
+
+package() {
+ make DESTDIR="$pkgdir" install
+}
+
+sha512sums="
+6e614d709cc1c4d866996f20c600a071120aca5a83fbe7066173e3928292846fb6566b9b51a2d57e7905523b1ea4d3fabf6765935e12bf87986ec0a95e05e7a3 openfortivpn-1.17.2.tar.gz
+"
A => openssh-server-pam-systemd/APKBUILD +32 -0
@@ 1,32 @@
+# Maintainer: xdavidwu <xdavidwuph@gmail.com>
+pkgname=openssh-server-pam-systemd
+pkgver=3
+pkgrel=0
+pkgdesc="systemd services for openssh-server-pam"
+url="https://gitlab.xdavidwu.link/alpine-systemd/openssh-server-pam-systemd"
+arch="noarch"
+license="MIT"
+install_if="openssh-server-pam systemd"
+source="sshd-pam.service
+ sshdgenkeys.service"
+builddir="$srcdir/"
+
+build() {
+ # Replace with proper build command(s)
+ :
+}
+
+check() {
+ # Replace with proper check command(s)
+ :
+}
+
+package() {
+ install -Dm644 sshdgenkeys.service "${pkgdir}"/lib/systemd/system/sshdgenkeys.service
+ install -Dm644 sshd-pam.service "${pkgdir}"/lib/systemd/system/sshd-pam.service
+}
+
+sha512sums="
+fa445c4a53214524baed4e9c52a5463592a074f88a5a286eacb60d0907c0545f725afde23abd68cf611067add80c2ccb289a381fc5ff6a5f654ea49c81f02fe8 sshd-pam.service
+e8cda24aebd0c865915a3d2067815fce3795c9954acce273aca541886a9c1c208c442650a032d909510644b38416648e9250b05939fc0c156014a3e393dd5c74 sshdgenkeys.service
+"
A => openssh-server-pam-systemd/sshd-pam.service +14 -0
@@ 1,14 @@
+[Unit]
+Description=OpenSSH Daemon
+Wants=sshdgenkeys.service
+After=sshdgenkeys.service
+After=network.target
+
+[Service]
+ExecStart=/usr/sbin/sshd.pam -D
+ExecReload=/bin/kill -HUP $MAINPID
+KillMode=process
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
A => openssh-server-pam-systemd/sshdgenkeys.service +15 -0
@@ 1,15 @@
+[Unit]
+Description=SSH Key Generation
+ConditionPathExists=|!/etc/ssh/ssh_host_dsa_key
+ConditionPathExists=|!/etc/ssh/ssh_host_dsa_key.pub
+ConditionPathExists=|!/etc/ssh/ssh_host_ecdsa_key
+ConditionPathExists=|!/etc/ssh/ssh_host_ecdsa_key.pub
+ConditionPathExists=|!/etc/ssh/ssh_host_ed25519_key
+ConditionPathExists=|!/etc/ssh/ssh_host_ed25519_key.pub
+ConditionPathExists=|!/etc/ssh/ssh_host_rsa_key
+ConditionPathExists=|!/etc/ssh/ssh_host_rsa_key.pub
+
+[Service]
+ExecStart=/usr/bin/ssh-keygen -A
+Type=oneshot
+RemainAfterExit=yes
A => systemd-cron/APKBUILD +50 -0
@@ 1,50 @@
+# Contributor: xdavidwu <xdavidwuph@gmail.com>
+# Maintainer: xdavidwu <xdavidwuph@gmail.com>
+pkgname=systemd-cron
+pkgver=1.15.18
+pkgrel=1
+pkgdesc="systemd units to run cron scripts"
+url="https://github.com/systemd-cron/systemd-cron"
+arch="all"
+license="MIT"
+depends="python3 systemd>=229"
+checkdepends="py3-pyflakes man-db"
+install="$pkgname.pre-install"
+subpackages="$pkgname-doc"
+source="https://github.com/systemd-cron/systemd-cron/archive/refs/tags/v$pkgver/systemd-cron-$pkgver.tar.gz"
+builddir="$srcdir/systemd-cron-$pkgver"
+options="suid" # crontab_setgid helper
+
+prepare() {
+ default_prepare
+ sed -i 's/pyflakes3/pyflakes-3/' Makefile.in
+ sed -i 's|/usr/bin/touch|/bin/touch|' src/units/cron-update.service.in src/units/cron-boot.service.in
+}
+
+build() {
+ # libdir for systemd units
+ ./configure \
+ --prefix=/usr \
+ --mandir=/usr/share/man \
+ --libdir=/lib \
+ --enable-minutely \
+ --enable-quarterly \
+ --enable-semi_annually \
+ --enable-yearly \
+ --enable-setgid
+ make
+}
+
+check() {
+ make test
+}
+
+package() {
+ make DESTDIR="$pkgdir" install
+
+ rm -rf "$pkgdir"/lib/sysusers.d/
+}
+
+sha512sums="
+7de6a5d05ee1d73c5348ecedf6029b498b26e8cdeecce87b58f206a1719c4a90fba853eb99b860734174469c99c75a4a6fa33c13b4aac45fdc71de7f3231b9e3 systemd-cron-1.15.18.tar.gz
+"
A => systemd-cron/systemd-cron.pre-install +5 -0
@@ 1,5 @@
+#!/bin/sh
+
+adduser -S -D -H -s /bin/false _cron-failure systemd-journal 2>/dev/null
+
+exit 0
A => +453 -0
@@ 1,453 @@
From 4c2e932664ec67662f4a0306cca4a7cd82853bda Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Fri, 21 Jan 2022 22:19:37 -0800
Subject: [PATCH] Adjust for musl headers
Upstream-Status: Inappropriate [musl specific]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
src/libsystemd-network/sd-dhcp6-client.c | 2 +-
src/network/netdev/bareudp.c | 2 +-
src/network/netdev/batadv.c | 2 +-
src/network/netdev/bond.c | 2 +-
src/network/netdev/bridge.c | 2 +-
src/network/netdev/dummy.c | 2 +-
src/network/netdev/geneve.c | 2 +-
src/network/netdev/ifb.c | 2 +-
src/network/netdev/ipoib.c | 2 +-
src/network/netdev/ipvlan.c | 2 +-
src/network/netdev/macsec.c | 2 +-
src/network/netdev/macvlan.c | 2 +-
src/network/netdev/netdev.c | 2 +-
src/network/netdev/netdevsim.c | 2 +-
src/network/netdev/nlmon.c | 2 +-
src/network/netdev/tunnel.c | 2 +-
src/network/netdev/vcan.c | 2 +-
src/network/netdev/veth.c | 2 +-
src/network/netdev/vlan.c | 2 +-
src/network/netdev/vrf.c | 2 +-
src/network/netdev/vxcan.c | 2 +-
src/network/netdev/vxlan.c | 2 +-
src/network/netdev/xfrm.c | 2 +-
src/network/networkd-bridge-mdb.c | 4 ++--
src/network/networkd-dhcp-common.c | 3 ++-
src/network/networkd-dhcp-prefix-delegation.c | 4 ++--
src/network/networkd-dhcp-server.c | 2 +-
src/network/networkd-dhcp4.c | 2 +-
src/network/networkd-link.c | 2 +-
src/network/networkd-route.c | 8 ++++----
src/network/networkd-setlink.c | 2 +-
src/shared/linux/ethtool.h | 3 ++-
src/shared/netif-util.c | 2 +-
src/udev/udev-builtin-net_id.c | 2 +-
34 files changed, 41 insertions(+), 39 deletions(-)
--- a/src/libsystemd-network/sd-dhcp6-client.c
+++ b/src/libsystemd-network/sd-dhcp6-client.c
@@ -5,7 +5,7 @@
#include <errno.h>
#include <sys/ioctl.h>
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
#include <linux/if_infiniband.h>
#include "sd-dhcp6-client.h"
--- a/src/network/netdev/bareudp.c
+++ b/src/network/netdev/bareudp.c
@@ -2,7 +2,7 @@
* Copyright © 2020 VMware, Inc. */
#include <netinet/in.h>
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
#include "bareudp.h"
#include "netlink-util.h"
--- a/src/network/netdev/batadv.c
+++ b/src/network/netdev/batadv.c
@@ -3,7 +3,7 @@
#include <inttypes.h>
#include <netinet/in.h>
#include <linux/genetlink.h>
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
#include "batadv.h"
#include "fileio.h"
--- a/src/network/netdev/bond.c
+++ b/src/network/netdev/bond.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <netinet/in.h>
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
#include "alloc-util.h"
#include "bond.h"
--- a/src/network/netdev/bridge.c
+++ b/src/network/netdev/bridge.c
@@ -2,7 +2,7 @@
#include <net/if.h>
#include <netinet/in.h>
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
#include <linux/if_bridge.h>
#include "bridge.h"
--- a/src/network/netdev/dummy.c
+++ b/src/network/netdev/dummy.c
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
#include "dummy.h"
--- a/src/network/netdev/geneve.c
+++ b/src/network/netdev/geneve.c
@@ -2,7 +2,7 @@
#include <net/if.h>
#include <netinet/in.h>
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
#include "alloc-util.h"
#include "conf-parser.h"
--- a/src/network/netdev/ifb.c
+++ b/src/network/netdev/ifb.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later
* Copyright © 2019 VMware, Inc. */
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
#include "ifb.h"
--- a/src/network/netdev/ipoib.c
+++ b/src/network/netdev/ipoib.c
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
#include <linux/if_link.h>
#include "ipoib.h"
--- a/src/network/netdev/ipvlan.c
+++ b/src/network/netdev/ipvlan.c
@@ -2,7 +2,7 @@
#include <net/if.h>
#include <netinet/in.h>
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
#include "conf-parser.h"
#include "ipvlan.h"
--- a/src/network/netdev/macsec.c
+++ b/src/network/netdev/macsec.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <netinet/in.h>
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
#include <linux/if_ether.h>
#include <linux/if_macsec.h>
#include <linux/genetlink.h>
--- a/src/network/netdev/macvlan.c
+++ b/src/network/netdev/macvlan.c
@@ -2,7 +2,7 @@
#include <net/if.h>
#include <netinet/in.h>
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
#include "conf-parser.h"
#include "macvlan.h"
--- a/src/network/netdev/netdev.c
+++ b/src/network/netdev/netdev.c
@@ -2,7 +2,7 @@
#include <net/if.h>
#include <netinet/in.h>
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
#include <unistd.h>
#include "alloc-util.h"
--- a/src/network/netdev/netdevsim.c
+++ b/src/network/netdev/netdevsim.c
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
#include "netdevsim.h"
--- a/src/network/netdev/nlmon.c
+++ b/src/network/netdev/nlmon.c
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
#include "nlmon.h"
--- a/src/network/netdev/tunnel.c
+++ b/src/network/netdev/tunnel.c
@@ -2,7 +2,7 @@
#include <netinet/in.h>
#include <linux/fou.h>
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
#include <linux/if_tunnel.h>
#include <linux/ip.h>
#include <linux/ip6_tunnel.h>
--- a/src/network/netdev/vcan.c
+++ b/src/network/netdev/vcan.c
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
#include "vcan.h"
--- a/src/network/netdev/veth.c
+++ b/src/network/netdev/veth.c
@@ -3,7 +3,7 @@
#include <errno.h>
#include <net/if.h>
#include <netinet/in.h>
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
#include <linux/veth.h>
#include "netlink-util.h"
--- a/src/network/netdev/vlan.c
+++ b/src/network/netdev/vlan.c
@@ -2,7 +2,7 @@
#include <errno.h>
#include <net/if.h>
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
#include <linux/if_vlan.h>
#include "parse-util.h"
--- a/src/network/netdev/vrf.c
+++ b/src/network/netdev/vrf.c
@@ -2,7 +2,7 @@
#include <net/if.h>
#include <netinet/in.h>
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
#include "vrf.h"
--- a/src/network/netdev/vxcan.c
+++ b/src/network/netdev/vxcan.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <linux/can/vxcan.h>
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
#include "vxcan.h"
--- a/src/network/netdev/vxlan.c
+++ b/src/network/netdev/vxlan.c
@@ -2,7 +2,7 @@
#include <net/if.h>
#include <netinet/in.h>
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
#include "conf-parser.h"
#include "alloc-util.h"
--- a/src/network/netdev/xfrm.c
+++ b/src/network/netdev/xfrm.c
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
#include "missing_network.h"
#include "xfrm.h"
--- a/src/network/networkd-bridge-mdb.c
+++ b/src/network/networkd-bridge-mdb.c
@@ -1,7 +1,5 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <net/if.h>
-#include <linux/if_bridge.h>
#include "netlink-util.h"
#include "networkd-bridge-mdb.h"
@@ -11,6 +9,8 @@
#include "networkd-queue.h"
#include "string-util.h"
#include "vlan-util.h"
+#include <net/if.h>
+#include <linux/if_bridge.h>
#define STATIC_BRIDGE_MDB_ENTRIES_PER_NETWORK_MAX 1024U
--- a/src/network/networkd-dhcp-common.c
+++ b/src/network/networkd-dhcp-common.c
@@ -1,7 +1,8 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <netinet/in.h>
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
+#include <net/if.h>
#include "bus-error.h"
#include "dhcp-identifier.h"
--- a/src/network/networkd-dhcp-prefix-delegation.c
+++ b/src/network/networkd-dhcp-prefix-delegation.c
@@ -1,7 +1,5 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <linux/ipv6_route.h>
-
#include "sd-dhcp6-client.h"
#include "hashmap.h"
@@ -21,6 +19,8 @@
#include "strv.h"
#include "tunnel.h"
+#include <linux/ipv6_route.h>
+
bool link_dhcp_pd_is_enabled(Link *link) {
assert(link);
--- a/src/network/networkd-dhcp-server.c
+++ b/src/network/networkd-dhcp-server.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <netinet/in.h>
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
#include <linux/if.h>
#include "sd-dhcp-server.h"
--- a/src/network/networkd-dhcp4.c
+++ b/src/network/networkd-dhcp4.c
@@ -3,7 +3,7 @@
#include <netinet/in.h>
#include <netinet/ip.h>
#include <linux/if.h>
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
#include "alloc-util.h"
#include "dhcp-client-internal.h"
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -3,7 +3,7 @@
#include <net/if.h>
#include <netinet/in.h>
#include <linux/if.h>
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
#include <linux/if_link.h>
#include <linux/netdevice.h>
#include <sys/socket.h>
--- a/src/network/networkd-route.c
+++ b/src/network/networkd-route.c
@@ -1,9 +1,5 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <linux/icmpv6.h>
-#include <linux/ipv6_route.h>
-#include <linux/nexthop.h>
-
#include "alloc-util.h"
#include "event-util.h"
#include "netlink-util.h"
@@ -21,6 +17,10 @@
#include "vrf.h"
#include "wireguard.h"
+#include <linux/icmpv6.h>
+#include <linux/ipv6_route.h>
+#include <linux/nexthop.h>
+
int route_new(Route **ret) {
_cleanup_(route_freep) Route *route = NULL;
--- a/src/network/networkd-setlink.c
+++ b/src/network/networkd-setlink.c
@@ -2,7 +2,7 @@
#include <netinet/in.h>
#include <linux/if.h>
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
#include <linux/if_bridge.h>
#include "missing_network.h"
--- a/src/shared/linux/ethtool.h
+++ b/src/shared/linux/ethtool.h
@@ -16,7 +16,8 @@
#include <linux/kernel.h>
#include <linux/types.h>
-#include <linux/if_ether.h>
+#include <netinet/if_ether.h>
+//#include <linux/if_ether.h>
#ifndef __KERNEL__
#include <limits.h> /* for INT_MAX */
--- a/src/shared/netif-util.c
+++ b/src/shared/netif-util.c
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
#include "arphrd-util.h"
#include "device-util.h"
--- a/src/udev/udev-builtin-net_id.c
+++ b/src/udev/udev-builtin-net_id.c
@@ -18,7 +18,7 @@
#include <stdarg.h>
#include <unistd.h>
#include <linux/if.h>
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
#include <linux/netdevice.h>
#include <linux/pci_regs.h>
--- a/src/network/netdev/wireguard.c
+++ b/src/network/netdev/wireguard.c
@@ -6,7 +6,7 @@
#include <sys/ioctl.h>
#include <net/if.h>
#include <netinet/in.h>
-#include <linux/if_arp.h>
+//#include <linux/if_arp.h>
#include <linux/ipv6_route.h>
#include "sd-resolve.h"
A => systemd/0001-pass-correct-parameters-to-getdents64.patch +50 -0
@@ 1,50 @@
+From fbc10748c7c59d82024a4d35146b8dfef8d52927 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 21 Jan 2022 15:15:11 -0800
+Subject: [PATCH 1/2] pass correct parameters to getdents64
+
+Fixes
+../git/src/basic/recurse-dir.c:57:40: error: incompatible pointer types passing 'uint8_t *' (aka 'unsigned char *') to parameter of type 'struct dirent *' [-Werror,-Wincompatible-pointer-types]
+ n = getdents64(dir_fd, (uint8_t*) de->buffer + de->buffer_size, bs - de->buffer_size);
+ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+../git/src/basic/stat-util.c:102:28: error: incompatible pointer types passing 'union (unnamed union at ../git/src/basic/stat-util.c:78:9) *' to parameter of type 'struct dirent *' [-Werror,-Wincompatible-pointer-types]
+ n = getdents64(fd, &buffer, sizeof(buffer));
+ ^~~~~~~
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/basic/recurse-dir.c | 2 +-
+ src/basic/stat-util.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/basic/recurse-dir.c b/src/basic/recurse-dir.c
+index efa1797b7b..797285e3be 100644
+--- a/src/basic/recurse-dir.c
++++ b/src/basic/recurse-dir.c
+@@ -54,7 +54,7 @@ int readdir_all(int dir_fd,
+ bs = MIN(MALLOC_SIZEOF_SAFE(de) - offsetof(DirectoryEntries, buffer), (size_t) SSIZE_MAX);
+ assert(bs > de->buffer_size);
+
+- n = getdents64(dir_fd, (uint8_t*) de->buffer + de->buffer_size, bs - de->buffer_size);
++ n = getdents64(dir_fd, de->buffer + de->buffer_size, bs - de->buffer_size);
+ if (n < 0)
+ return -errno;
+ if (n == 0)
+diff --git a/src/basic/stat-util.c b/src/basic/stat-util.c
+index efac7b002e..9e1fe7f5a0 100644
+--- a/src/basic/stat-util.c
++++ b/src/basic/stat-util.c
+@@ -99,7 +99,7 @@ int dir_is_empty_at(int dir_fd, const char *path) {
+ return fd;
+ }
+
+- n = getdents64(fd, &buffer, sizeof(buffer));
++ n = getdents64(fd, (struct dirent *)&buffer, sizeof(buffer));
+ if (n < 0)
+ return -errno;
+
+--
+2.34.1
+
A => systemd/0002-Add-sys-stat.h-for-S_IFDIR.patch +29 -0
@@ 1,29 @@
+From d16f7b37c917b91e951b9313e2c8264c72ed93e5 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 21 Jan 2022 15:17:37 -0800
+Subject: [PATCH 2/2] Add sys/stat.h for S_IFDIR
+
+../git/src/shared/mkdir-label.c:13:61: error: use of undeclared identifier 'S_IFDIR'
+ r = mac_selinux_create_file_prepare_at(dirfd, path, S_IFDIR);
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/shared/mkdir-label.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/shared/mkdir-label.c b/src/shared/mkdir-label.c
+index d36a6466d7..63b764cd83 100644
+--- a/src/shared/mkdir-label.c
++++ b/src/shared/mkdir-label.c
+@@ -4,6 +4,7 @@
+ #include "selinux-util.h"
+ #include "smack-util.h"
+ #include "user-util.h"
++#include <sys/stat.h>
+
+ int mkdirat_label(int dirfd, const char *path, mode_t mode) {
+ int r;
+--
+2.34.1
+
A => systemd/0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch +68 -0
@@ 1,68 @@
+From 3b42a888685aee1776a12cff84a5fe0063378483 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 13:55:12 +0800
+Subject: [PATCH] missing_type.h: add __compare_fn_t and comparison_fn_t
+
+Make it work with musl where comparison_fn_t and __compare_fn_t
+is not provided.
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
+[Rebased for v244]
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[Rebased for v242]
+Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
+
+---
+ src/basic/missing_type.h | 9 +++++++++
+ src/basic/sort-util.h | 1 +
+ src/core/kmod-setup.c | 1 +
+ src/libsystemd/sd-journal/catalog.c | 1 +
+ 4 files changed, 12 insertions(+)
+
+--- a/src/basic/missing_type.h
++++ b/src/basic/missing_type.h
+@@ -10,3 +10,12 @@
+ #if !HAVE_CHAR16_T
+ #define char16_t uint16_t
+ #endif
++
++#ifndef __GLIBC__
++typedef int (*comparison_fn_t)(const void *, const void *);
++#endif
++
++#ifndef __COMPAR_FN_T
++#define __COMPAR_FN_T
++typedef int (*__compar_fn_t)(const void *, const void *);
++#endif
+--- a/src/basic/sort-util.h
++++ b/src/basic/sort-util.h
+@@ -4,6 +4,7 @@
+ #include <stdlib.h>
+
+ #include "macro.h"
++#include "missing_type.h"
+
+ /* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the
+ * external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that
+--- a/src/core/kmod-setup.c
++++ b/src/core/kmod-setup.c
+@@ -10,6 +10,7 @@
+ #include "macro.h"
+ #include "recurse-dir.h"
+ #include "string-util.h"
++#include "missing_type.h"
+
+ #if HAVE_KMOD
+ #include "module-util.h"
+--- a/src/libsystemd/sd-journal/catalog.c
++++ b/src/libsystemd/sd-journal/catalog.c
+@@ -28,6 +28,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "tmpfile-util.h"
++#include "missing_type.h"
+
+ const char * const catalog_file_dirs[] = {
+ "/usr/local/lib/systemd/catalog/",
A => systemd/0004-add-fallback-parse_printf_format-implementation.patch +419 -0
@@ 1,419 @@
+From 3e0df2c22bfd37bc62bf09a01ec498e40d3599de Mon Sep 17 00:00:00 2001
+From: Alexander Kanavin <alex.kanavin@gmail.com>
+Date: Sat, 22 May 2021 20:26:24 +0200
+Subject: [PATCH] add fallback parse_printf_format implementation
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Emil Renner Berthing <systemd@esmil.dk>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+
+---
+ meson.build | 1 +
+ src/basic/meson.build | 5 +
+ src/basic/parse-printf-format.c | 273 +++++++++++++++++++++++
+ src/basic/parse-printf-format.h | 57 +++++
+ src/basic/stdio-util.h | 2 +-
+ src/libsystemd/sd-journal/journal-send.c | 2 +-
+ 6 files changed, 338 insertions(+), 2 deletions(-)
+ create mode 100644 src/basic/parse-printf-format.c
+ create mode 100644 src/basic/parse-printf-format.h
+
+--- a/meson.build
++++ b/meson.build
+@@ -686,6 +686,7 @@ endif
+ foreach header : ['crypt.h',
+ 'linux/memfd.h',
+ 'linux/vm_sockets.h',
++ 'printf.h',
+ 'sys/auxv.h',
+ 'valgrind/memcheck.h',
+ 'valgrind/valgrind.h',
+--- a/src/basic/meson.build
++++ b/src/basic/meson.build
+@@ -335,6 +335,11 @@ endforeach
+
+ basic_sources += generated_gperf_headers
+
++if conf.get('HAVE_PRINTF_H') != 1
++ basic_sources += [files('parse-printf-format.c')]
++endif
++
++
+ ############################################################
+
+ arch_list = [
+--- /dev/null
++++ b/src/basic/parse-printf-format.c
+@@ -0,0 +1,273 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the musl C library
++ Copyright 2005-2014 Rich Felker, et al.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#include <stddef.h>
++#include <string.h>
++
++#include "parse-printf-format.h"
++
++static const char *consume_nonarg(const char *fmt)
++{
++ do {
++ if (*fmt == '\0')
++ return fmt;
++ } while (*fmt++ != '%');
++ return fmt;
++}
++
++static const char *consume_num(const char *fmt)
++{
++ for (;*fmt >= '0' && *fmt <= '9'; fmt++)
++ /* do nothing */;
++ return fmt;
++}
++
++static const char *consume_argn(const char *fmt, size_t *arg)
++{
++ const char *p = fmt;
++ size_t val = 0;
++
++ if (*p < '1' || *p > '9')
++ return fmt;
++ do {
++ val = 10*val + (*p++ - '0');
++ } while (*p >= '0' && *p <= '9');
++
++ if (*p != '$')
++ return fmt;
++ *arg = val;
++ return p+1;
++}
++
++static const char *consume_flags(const char *fmt)
++{
++ while (1) {
++ switch (*fmt) {
++ case '#':
++ case '0':
++ case '-':
++ case ' ':
++ case '+':
++ case '\'':
++ case 'I':
++ fmt++;
++ continue;
++ }
++ return fmt;
++ }
++}
++
++enum state {
++ BARE,
++ LPRE,
++ LLPRE,
++ HPRE,
++ HHPRE,
++ BIGLPRE,
++ ZTPRE,
++ JPRE,
++ STOP
++};
++
++enum type {
++ NONE,
++ PTR,
++ INT,
++ UINT,
++ ULLONG,
++ LONG,
++ ULONG,
++ SHORT,
++ USHORT,
++ CHAR,
++ UCHAR,
++ LLONG,
++ SIZET,
++ IMAX,
++ UMAX,
++ PDIFF,
++ UIPTR,
++ DBL,
++ LDBL,
++ MAXTYPE
++};
++
++static const short pa_types[MAXTYPE] = {
++ [NONE] = PA_INT,
++ [PTR] = PA_POINTER,
++ [INT] = PA_INT,
++ [UINT] = PA_INT,
++ [ULLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [LONG] = PA_INT | PA_FLAG_LONG,
++ [ULONG] = PA_INT | PA_FLAG_LONG,
++ [SHORT] = PA_INT | PA_FLAG_SHORT,
++ [USHORT] = PA_INT | PA_FLAG_SHORT,
++ [CHAR] = PA_CHAR,
++ [UCHAR] = PA_CHAR,
++ [LLONG] = PA_INT | PA_FLAG_LONG_LONG,
++ [SIZET] = PA_INT | PA_FLAG_LONG,
++ [IMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [UMAX] = PA_INT | PA_FLAG_LONG_LONG,
++ [PDIFF] = PA_INT | PA_FLAG_LONG_LONG,
++ [UIPTR] = PA_INT | PA_FLAG_LONG,
++ [DBL] = PA_DOUBLE,
++ [LDBL] = PA_DOUBLE | PA_FLAG_LONG_DOUBLE
++};
++
++#define S(x) [(x)-'A']
++#define E(x) (STOP + (x))
++
++static const unsigned char states[]['z'-'A'+1] = {
++ { /* 0: bare types */
++ S('d') = E(INT), S('i') = E(INT),
++ S('o') = E(UINT),S('u') = E(UINT),S('x') = E(UINT), S('X') = E(UINT),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(CHAR),S('C') = E(INT),
++ S('s') = E(PTR), S('S') = E(PTR), S('p') = E(UIPTR),S('n') = E(PTR),
++ S('m') = E(NONE),
++ S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE,
++ S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE
++ }, { /* 1: l-prefixed */
++ S('d') = E(LONG), S('i') = E(LONG),
++ S('o') = E(ULONG),S('u') = E(ULONG),S('x') = E(ULONG),S('X') = E(ULONG),
++ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
++ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
++ S('c') = E(INT), S('s') = E(PTR), S('n') = E(PTR),
++ S('l') = LLPRE
++ }, { /* 2: ll-prefixed */
++ S('d') = E(LLONG), S('i') = E(LLONG),
++ S('o') = E(ULLONG),S('u') = E(ULLONG),
++ S('x') = E(ULLONG),S('X') = E(ULLONG),
++ S('n') = E(PTR)
++ }, { /* 3: h-prefixed */
++ S('d') = E(SHORT), S('i') = E(SHORT),
++ S('o') = E(USHORT),S('u') = E(USHORT),
++ S('x') = E(USHORT),S('X') = E(USHORT),
++ S('n') = E(PTR),
++ S('h') = HHPRE
++ }, { /* 4: hh-prefixed */
++ S('d') = E(CHAR), S('i') = E(CHAR),
++ S('o') = E(UCHAR),S('u') = E(UCHAR),
++ S('x') = E(UCHAR),S('X') = E(UCHAR),
++ S('n') = E(PTR)
++ }, { /* 5: L-prefixed */
++ S('e') = E(LDBL),S('f') = E(LDBL),S('g') = E(LDBL), S('a') = E(LDBL),
++ S('E') = E(LDBL),S('F') = E(LDBL),S('G') = E(LDBL), S('A') = E(LDBL),
++ S('n') = E(PTR)
++ }, { /* 6: z- or t-prefixed (assumed to be same size) */
++ S('d') = E(PDIFF),S('i') = E(PDIFF),
++ S('o') = E(SIZET),S('u') = E(SIZET),
++ S('x') = E(SIZET),S('X') = E(SIZET),
++ S('n') = E(PTR)
++ }, { /* 7: j-prefixed */
++ S('d') = E(IMAX), S('i') = E(IMAX),
++ S('o') = E(UMAX), S('u') = E(UMAX),
++ S('x') = E(UMAX), S('X') = E(UMAX),
++ S('n') = E(PTR)
++ }
++};
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types)
++{
++ size_t i = 0;
++ size_t last = 0;
++
++ memset(types, 0, n);
++
++ while (1) {
++ size_t arg;
++ unsigned int state;
++
++ fmt = consume_nonarg(fmt);
++ if (*fmt == '\0')
++ break;
++ if (*fmt == '%') {
++ fmt++;
++ continue;
++ }
++ arg = 0;
++ fmt = consume_argn(fmt, &arg);
++ /* flags */
++ fmt = consume_flags(fmt);
++ /* width */
++ if (*fmt == '*') {
++ size_t warg = 0;
++ fmt = consume_argn(fmt+1, &warg);
++ if (warg == 0)
++ warg = ++i;
++ if (warg > last)
++ last = warg;
++ if (warg <= n && types[warg-1] == NONE)
++ types[warg-1] = INT;
++ } else
++ fmt = consume_num(fmt);
++ /* precision */
++ if (*fmt == '.') {
++ fmt++;
++ if (*fmt == '*') {
++ size_t parg = 0;
++ fmt = consume_argn(fmt+1, &parg);
++ if (parg == 0)
++ parg = ++i;
++ if (parg > last)
++ last = parg;
++ if (parg <= n && types[parg-1] == NONE)
++ types[parg-1] = INT;
++ } else {
++ if (*fmt == '-')
++ fmt++;
++ fmt = consume_num(fmt);
++ }
++ }
++ /* length modifier and conversion specifier */
++ state = BARE;
++ do {
++ unsigned char c = *fmt++;
++
++ if (c < 'A' || c > 'z')
++ continue;
++ state = states[state]S(c);
++ if (state == 0)
++ continue;
++ } while (state < STOP);
++
++ if (state == E(NONE))
++ continue;
++
++ if (arg == 0)
++ arg = ++i;
++ if (arg > last)
++ last = arg;
++ if (arg <= n)
++ types[arg-1] = state - STOP;
++ }
++
++ if (last > n)
++ last = n;
++ for (i = 0; i < last; i++)
++ types[i] = pa_types[types[i]];
++
++ return last;
++}
+--- /dev/null
++++ b/src/basic/parse-printf-format.h
+@@ -0,0 +1,57 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
++
++ With parts from the GNU C Library
++ Copyright 1991-2014 Free Software Foundation, Inc.
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd is distributed in the hope that it will be useful, but
++ WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#pragma once
++
++#include "config.h"
++
++#if HAVE_PRINTF_H
++#include <printf.h>
++#else
++
++#include <stddef.h>
++
++enum { /* C type: */
++ PA_INT, /* int */
++ PA_CHAR, /* int, cast to char */
++ PA_WCHAR, /* wide char */
++ PA_STRING, /* const char *, a '\0'-terminated string */
++ PA_WSTRING, /* const wchar_t *, wide character string */
++ PA_POINTER, /* void * */
++ PA_FLOAT, /* float */
++ PA_DOUBLE, /* double */
++ PA_LAST
++};
++
++/* Flag bits that can be set in a type returned by `parse_printf_format'. */
++#define PA_FLAG_MASK 0xff00
++#define PA_FLAG_LONG_LONG (1 << 8)
++#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG
++#define PA_FLAG_LONG (1 << 9)
++#define PA_FLAG_SHORT (1 << 10)
++#define PA_FLAG_PTR (1 << 11)
++
++size_t parse_printf_format(const char *fmt, size_t n, int *types);
++
++#endif /* HAVE_PRINTF_H */
+--- a/src/basic/stdio-util.h
++++ b/src/basic/stdio-util.h
+@@ -1,13 +1,13 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
+-#include <printf.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <sys/types.h>
+
+ #include "macro.h"
+ #include "memory-util.h"
++#include "parse-printf-format.h"
+
+ #define snprintf_ok(buf, len, fmt, ...) \
+ ({ \
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -2,7 +2,6 @@
+
+ #include <errno.h>
+ #include <fcntl.h>
+-#include <printf.h>
+ #include <stddef.h>
+ #include <sys/un.h>
+ #include <unistd.h>
+@@ -21,6 +20,7 @@
+ #include "stdio-util.h"
+ #include "string-util.h"
+ #include "tmpfile-util.h"
++#include "parse-printf-format.h"
+
+ #define SNDBUF_SIZE (8*1024*1024)
+
A => systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch +602 -0
@@ 1,602 @@
+From cef23a651ea200e30e1e6ed2a2564505e3a42d46 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 14:18:21 +0800
+Subject: [PATCH] src/basic/missing.h: check for missing strndupa
+
+include missing.h for definition of strndupa
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[Rebased for v242]
+Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
+[rebased for systemd 244]
+[Rebased for v247]
+Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
+
+---
+ meson.build | 1 +
+ src/backlight/backlight.c | 1 +
+ src/basic/cgroup-util.c | 1 +
+ src/basic/env-util.c | 1 +
+ src/basic/log.c | 1 +
+ src/basic/missing_stdlib.h | 12 ++++++++++++
+ src/basic/mkdir.c | 1 +
+ src/basic/mountpoint-util.c | 1 +
+ src/basic/parse-util.c | 1 +
+ src/basic/path-lookup.c | 1 +
+ src/basic/percent-util.c | 1 +
+ src/basic/proc-cmdline.c | 1 +
+ src/basic/procfs-util.c | 1 +
+ src/basic/time-util.c | 1 +
+ src/boot/bless-boot.c | 1 +
+ src/core/dbus-cgroup.c | 1 +
+ src/core/dbus-execute.c | 1 +
+ src/core/dbus-util.c | 1 +
+ src/core/execute.c | 1 +
+ src/core/kmod-setup.c | 1 +
+ src/core/service.c | 1 +
+ src/coredump/coredump-vacuum.c | 1 +
+ src/journal-remote/journal-remote-main.c | 1 +
+ src/journal/journalctl.c | 1 +
+ src/libsystemd/sd-bus/bus-message.c | 1 +
+ src/libsystemd/sd-bus/bus-objects.c | 1 +
+ src/libsystemd/sd-bus/bus-socket.c | 1 +
+ src/libsystemd/sd-bus/sd-bus.c | 1 +
+ src/libsystemd/sd-bus/test-bus-benchmark.c | 1 +
+ src/libsystemd/sd-journal/sd-journal.c | 1 +
+ src/locale/keymap-util.c | 1 +
+ src/login/pam_systemd.c | 1 +
+ src/network/generator/network-generator.c | 1 +
+ src/nspawn/nspawn-settings.c | 1 +
+ src/nss-mymachines/nss-mymachines.c | 1 +
+ src/portable/portable.c | 1 +
+ src/resolve/resolvectl.c | 1 +
+ src/shared/bus-get-properties.c | 1 +
+ src/shared/bus-unit-procs.c | 1 +
+ src/shared/bus-unit-util.c | 1 +
+ src/shared/bus-util.c | 1 +
+ src/shared/dns-domain.c | 1 +
+ src/shared/journal-importer.c | 1 +
+ src/shared/logs-show.c | 1 +
+ src/shared/pager.c | 1 +
+ src/shared/uid-range.c | 1 +
+ src/socket-proxy/socket-proxyd.c | 1 +
+ src/test/test-hexdecoct.c | 1 +
+ src/udev/udev-builtin-path_id.c | 1 +
+ src/udev/udev-event.c | 1 +
+ src/udev/udev-rules.c | 1 +
+ 51 files changed, 62 insertions(+)
+
+--- a/meson.build
++++ b/meson.build
+@@ -507,6 +507,7 @@ foreach ident : ['secure_getenv', '__sec
+ endforeach
+
+ foreach ident : [
++ ['strndupa' , '''#include <string.h>'''],
+ ['memfd_create', '''#include <sys/mman.h>'''],
+ ['gettid', '''#include <sys/types.h>
+ #include <unistd.h>'''],
+--- a/src/backlight/backlight.c
++++ b/src/backlight/backlight.c
+@@ -19,6 +19,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "util.h"
++#include "missing_stdlib.h"
+
+ static int help(void) {
+ _cleanup_free_ char *link = NULL;
+--- a/src/basic/cgroup-util.c
++++ b/src/basic/cgroup-util.c
+@@ -37,6 +37,7 @@
+ #include "unit-name.h"
+ #include "user-util.h"
+ #include "xattr-util.h"
++#include "missing_stdlib.h"
+
+ static int cg_enumerate_items(const char *controller, const char *path, FILE **_f, const char *item) {
+ _cleanup_free_ char *fs = NULL;
+--- a/src/basic/env-util.c
++++ b/src/basic/env-util.c
+@@ -19,6 +19,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "utf8.h"
++#include "missing_stdlib.h"
+
+ /* We follow bash for the character set. Different shells have different rules. */
+ #define VALID_BASH_ENV_NAME_CHARS \
+--- a/src/basic/log.c
++++ b/src/basic/log.c
+@@ -36,6 +36,7 @@
+ #include "terminal-util.h"
+ #include "time-util.h"
+ #include "utf8.h"
++#include "missing_stdlib.h"
+
+ #define SNDBUF_SIZE (8*1024*1024)
+
+--- a/src/basic/missing_stdlib.h
++++ b/src/basic/missing_stdlib.h
+@@ -11,3 +11,15 @@
+ # error "neither secure_getenv nor __secure_getenv are available"
+ # endif
+ #endif
++
++/* string.h */
++#if ! HAVE_STRNDUPA
++#define strndupa(s, n) \
++ ({ \
++ const char *__old = (s); \
++ size_t __len = strnlen(__old, (n)); \
++ char *__new = (char *)alloca(__len + 1); \
++ __new[__len] = '\0'; \
++ (char *)memcpy(__new, __old, __len); \
++ })
++#endif
+--- a/src/basic/mkdir.c
++++ b/src/basic/mkdir.c
+@@ -15,6 +15,7 @@
+ #include "stat-util.h"
+ #include "stdio-util.h"
+ #include "user-util.h"
++#include "missing_stdlib.h"
+
+ int mkdir_safe_internal(
+ const char *path,
+--- a/src/basic/mountpoint-util.c
++++ b/src/basic/mountpoint-util.c
+@@ -13,6 +13,7 @@
+ #include "missing_stat.h"
+ #include "missing_syscall.h"
+ #include "mkdir.h"
++#include "missing_stdlib.h"
+ #include "mountpoint-util.h"
+ #include "nulstr-util.h"
+ #include "parse-util.h"
+--- a/src/basic/parse-util.c
++++ b/src/basic/parse-util.c
+@@ -18,6 +18,7 @@
+ #include "stat-util.h"
+ #include "string-util.h"
+ #include "strv.h"
++#include "missing_stdlib.h"
+
+ int parse_boolean(const char *v) {
+ if (!v)
+--- a/src/basic/path-lookup.c
++++ b/src/basic/path-lookup.c
+@@ -16,6 +16,7 @@
+ #include "strv.h"
+ #include "tmpfile-util.h"
+ #include "user-util.h"
++#include "missing_stdlib.h"
+
+ int xdg_user_runtime_dir(char **ret, const char *suffix) {
+ const char *e;
+--- a/src/basic/percent-util.c
++++ b/src/basic/percent-util.c
+@@ -3,6 +3,7 @@
+ #include "percent-util.h"
+ #include "string-util.h"
+ #include "parse-util.h"
++#include "missing_stdlib.h"
+
+ static int parse_parts_value_whole(const char *p, const char *symbol) {
+ const char *pc, *n;
+--- a/src/basic/proc-cmdline.c
++++ b/src/basic/proc-cmdline.c
+@@ -15,6 +15,7 @@
+ #include "string-util.h"
+ #include "util.h"
+ #include "virt.h"
++#include "missing_stdlib.h"
+
+ int proc_cmdline(char **ret) {
+ const char *e;
+--- a/src/basic/procfs-util.c
++++ b/src/basic/procfs-util.c
+@@ -12,6 +12,7 @@
+ #include "procfs-util.h"
+ #include "stdio-util.h"
+ #include "string-util.h"
++#include "missing_stdlib.h"
+
+ int procfs_get_pid_max(uint64_t *ret) {
+ _cleanup_free_ char *value = NULL;
+--- a/src/basic/time-util.c
++++ b/src/basic/time-util.c
+@@ -26,6 +26,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "time-util.h"
++#include "missing_stdlib.h"
+
+ static clockid_t map_clock_id(clockid_t c) {
+
+--- a/src/boot/bless-boot.c
++++ b/src/boot/bless-boot.c
+@@ -19,6 +19,7 @@
+ #include "util.h"
+ #include "verbs.h"
+ #include "virt.h"
++#include "missing_stdlib.h"
+
+ static char **arg_path = NULL;
+
+--- a/src/core/dbus-execute.c
++++ b/src/core/dbus-execute.c
+@@ -44,6 +44,7 @@
+ #include "unit-printf.h"
+ #include "user-util.h"
+ #include "utf8.h"
++#include "missing_stdlib.h"
+
+ BUS_DEFINE_PROPERTY_GET_ENUM(bus_property_get_exec_output, exec_output, ExecOutput);
+ static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_exec_input, exec_input, ExecInput);
+--- a/src/core/dbus-util.c
++++ b/src/core/dbus-util.c
+@@ -9,6 +9,7 @@
+ #include "unit-printf.h"
+ #include "user-util.h"
+ #include "unit.h"
++#include "missing_stdlib.h"
+
+ int bus_property_get_triggered_unit(
+ sd_bus *bus,
+--- a/src/core/execute.c
++++ b/src/core/execute.c
+@@ -102,6 +102,7 @@
+ #include "unit-serialize.h"
+ #include "user-util.h"
+ #include "utmp-wtmp.h"
++#include "missing_stdlib.h"
+
+ #define IDLE_TIMEOUT_USEC (5*USEC_PER_SEC)
+ #define IDLE_TIMEOUT2_USEC (1*USEC_PER_SEC)
+--- a/src/core/kmod-setup.c
++++ b/src/core/kmod-setup.c
+@@ -11,6 +11,7 @@
+ #include "recurse-dir.h"
+ #include "string-util.h"
+ #include "missing_type.h"
++#include "missing_stdlib.h"
+
+ #if HAVE_KMOD
+ #include "module-util.h"
+--- a/src/core/service.c
++++ b/src/core/service.c
+@@ -42,6 +42,7 @@
+ #include "unit.h"
+ #include "utf8.h"
+ #include "util.h"
++#include "missing_stdlib.h"
+
+ static const UnitActiveState state_translation_table[_SERVICE_STATE_MAX] = {
+ [SERVICE_DEAD] = UNIT_INACTIVE,
+--- a/src/coredump/coredump-vacuum.c
++++ b/src/coredump/coredump-vacuum.c
+@@ -16,6 +16,7 @@
+ #include "string-util.h"
+ #include "time-util.h"
+ #include "user-util.h"
++#include "missing_stdlib.h"
+
+ #define DEFAULT_MAX_USE_LOWER (uint64_t) (1ULL*1024ULL*1024ULL) /* 1 MiB */
+ #define DEFAULT_MAX_USE_UPPER (uint64_t) (4ULL*1024ULL*1024ULL*1024ULL) /* 4 GiB */
+--- a/src/journal-remote/journal-remote-main.c
++++ b/src/journal-remote/journal-remote-main.c
+@@ -24,6 +24,7 @@
+ #include "stat-util.h"
+ #include "string-table.h"
+ #include "strv.h"
++#include "missing_stdlib.h"
+
+ #define PRIV_KEY_FILE CERTIFICATE_ROOT "/private/journal-remote.pem"
+ #define CERT_FILE CERTIFICATE_ROOT "/certs/journal-remote.pem"
+--- a/src/journal/journalctl.c
++++ b/src/journal/journalctl.c
+@@ -73,6 +73,7 @@
+ #include "unit-name.h"
+ #include "user-util.h"
+ #include "varlink.h"
++#include "missing_stdlib.h"
+
+ #define DEFAULT_FSS_INTERVAL_USEC (15*USEC_PER_MINUTE)
+ #define PROCESS_INOTIFY_INTERVAL 1024 /* Every 1,024 messages processed */
+--- a/src/libsystemd/sd-bus/bus-message.c
++++ b/src/libsystemd/sd-bus/bus-message.c
+@@ -20,6 +20,7 @@
+ #include "strv.h"
+ #include "time-util.h"
+ #include "utf8.h"
++#include "missing_stdlib.h"
+
+ static int message_append_basic(sd_bus_message *m, char type, const void *p, const void **stored);
+
+--- a/src/libsystemd/sd-bus/bus-objects.c
++++ b/src/libsystemd/sd-bus/bus-objects.c
+@@ -12,6 +12,7 @@
+ #include "set.h"
+ #include "string-util.h"
+ #include "strv.h"
++#include "missing_stdlib.h"
+
+ static int node_vtable_get_userdata(
+ sd_bus *bus,
+--- a/src/libsystemd/sd-bus/bus-socket.c
++++ b/src/libsystemd/sd-bus/bus-socket.c
+@@ -28,6 +28,7 @@
+ #include "string-util.h"
+ #include "user-util.h"
+ #include "utf8.h"
++#include "missing_stdlib.h"
+
+ #define SNDBUF_SIZE (8*1024*1024)
+
+--- a/src/libsystemd/sd-bus/sd-bus.c
++++ b/src/libsystemd/sd-bus/sd-bus.c
+@@ -43,6 +43,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "user-util.h"
++#include "missing_stdlib.h"
+
+ #define log_debug_bus_message(m) \
+ do { \
+--- a/src/libsystemd/sd-bus/test-bus-benchmark.c
++++ b/src/libsystemd/sd-bus/test-bus-benchmark.c
+@@ -14,6 +14,7 @@
+ #include "string-util.h"
+ #include "time-util.h"
+ #include "util.h"
++#include "missing_stdlib.h"
+
+ #define MAX_SIZE (2*1024*1024)
+
+--- a/src/libsystemd/sd-journal/sd-journal.c
++++ b/src/libsystemd/sd-journal/sd-journal.c
+@@ -41,6 +41,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "syslog-util.h"
++#include "missing_stdlib.h"
+
+ #define JOURNAL_FILES_MAX 7168
+
+--- a/src/locale/keymap-util.c
++++ b/src/locale/keymap-util.c
+@@ -24,6 +24,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "tmpfile-util.h"
++#include "missing_stdlib.h"
+
+ static bool startswith_comma(const char *s, const char *prefix) {
+ s = startswith(s, prefix);
+--- a/src/login/pam_systemd.c
++++ b/src/login/pam_systemd.c
+@@ -31,6 +31,7 @@
+ #include "locale-util.h"
+ #include "login-util.h"
+ #include "macro.h"
++#include "missing_stdlib.h"
+ #include "pam-util.h"
+ #include "parse-util.h"
+ #include "path-util.h"
+--- a/src/network/generator/network-generator.c
++++ b/src/network/generator/network-generator.c
+@@ -13,6 +13,7 @@
+ #include "string-table.h"
+ #include "string-util.h"
+ #include "strv.h"
++#include "missing_stdlib.h"
+
+ /*
+ # .network
+--- a/src/nspawn/nspawn-settings.c
++++ b/src/nspawn/nspawn-settings.c
+@@ -17,6 +17,7 @@
+ #include "strv.h"
+ #include "user-util.h"
+ #include "util.h"
++#include "missing_stdlib.h"
+
+ Settings *settings_new(void) {
+ Settings *s;
+--- a/src/nss-mymachines/nss-mymachines.c
++++ b/src/nss-mymachines/nss-mymachines.c
+@@ -21,6 +21,7 @@
+ #include "nss-util.h"
+ #include "signal-util.h"
+ #include "string-util.h"
++#include "missing_stdlib.h"
+
+ static void setup_logging_once(void) {
+ static pthread_once_t once = PTHREAD_ONCE_INIT;
+--- a/src/portable/portable.c
++++ b/src/portable/portable.c
+@@ -39,6 +39,7 @@
+ #include "strv.h"
+ #include "tmpfile-util.h"
+ #include "user-util.h"
++#include "missing_stdlib.h"
+
+ /* Markers used in the first line of our 20-portable.conf unit file drop-in to determine, that a) the unit file was
+ * dropped there by the portable service logic and b) for which image it was dropped there. */
+--- a/src/resolve/resolvectl.c
++++ b/src/resolve/resolvectl.c
+@@ -43,6 +43,7 @@
+ #include "utf8.h"
+ #include "verb-log-control.h"
+ #include "verbs.h"
++#include "missing_stdlib.h"
+
+ static int arg_family = AF_UNSPEC;
+ static int arg_ifindex = 0;
+--- a/src/shared/bus-get-properties.c
++++ b/src/shared/bus-get-properties.c
+@@ -4,6 +4,7 @@
+ #include "rlimit-util.h"
+ #include "stdio-util.h"
+ #include "string-util.h"
++#include "missing_stdlib.h"
+
+ int bus_property_get_bool(
+ sd_bus *bus,
+--- a/src/shared/bus-unit-procs.c
++++ b/src/shared/bus-unit-procs.c
+@@ -10,6 +10,7 @@
+ #include "sort-util.h"
+ #include "string-util.h"
+ #include "terminal-util.h"
++#include "missing_stdlib.h"
+
+ struct CGroupInfo {
+ char *cgroup_path;
+--- a/src/shared/bus-unit-util.c
++++ b/src/shared/bus-unit-util.c
+@@ -49,6 +49,7 @@
+ #include "unit-def.h"
+ #include "user-util.h"
+ #include "utf8.h"
++#include "missing_stdlib.h"
+
+ int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u) {
+ assert(message);
+--- a/src/shared/bus-util.c
++++ b/src/shared/bus-util.c
+@@ -21,6 +21,7 @@
+ #include "path-util.h"
+ #include "socket-util.h"
+ #include "stdio-util.h"
++#include "missing_stdlib.h"
+
+ static int name_owner_change_callback(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) {
+ sd_event *e = userdata;
+--- a/src/shared/dns-domain.c
++++ b/src/shared/dns-domain.c
+@@ -17,6 +17,7 @@
+ #include "string-util.h"
+ #include "strv.h"
+ #include "utf8.h"
++#include "missing_stdlib.h"
+
+ int dns_label_unescape(const char **name, char *dest, size_t sz, DNSLabelFlags flags) {
+ const char *n;
+--- a/src/shared/journal-importer.c
++++ b/src/shared/journal-importer.c
+@@ -15,6 +15,7 @@
+ #include "parse-util.h"
+ #include "string-util.h"
+ #include "unaligned.h"
++#include "missing_stdlib.h"
+
+ enum {
+ IMPORTER_STATE_LINE = 0, /* waiting to read, or reading line */
+--- a/src/shared/logs-show.c
++++ b/src/shared/logs-show.c
+@@ -42,6 +42,7 @@
+ #include "utf8.h"
+ #include "util.h"
+ #include "web-util.h"
++#include "missing_stdlib.h"
+
+ /* up to three lines (each up to 100 characters) or 300 characters, whichever is less */
+ #define PRINT_LINE_THRESHOLD 3
+--- a/src/shared/pager.c
++++ b/src/shared/pager.c
+@@ -26,6 +26,7 @@
+ #include "strv.h"
+ #include "terminal-util.h"
+ #include "util.h"
++#include "missing_stdlib.h"
+
+ static pid_t pager_pid = 0;
+
+--- a/src/shared/uid-range.c
++++ b/src/shared/uid-range.c
+@@ -9,6 +9,7 @@
+ #include "sort-util.h"
+ #include "uid-range.h"
+ #include "user-util.h"
++#include "missing_stdlib.h"
+
+ static bool uid_range_intersect(UidRange *range, uid_t start, uid_t nr) {
+ assert(range);
+--- a/src/socket-proxy/socket-proxyd.c
++++ b/src/socket-proxy/socket-proxyd.c
+@@ -26,6 +26,7 @@
+ #include "socket-util.h"
+ #include "string-util.h"
+ #include "util.h"
++#include "missing_stdlib.h"
+
+ #define BUFFER_SIZE (256 * 1024)
+
+--- a/src/test/test-hexdecoct.c
++++ b/src/test/test-hexdecoct.c
+@@ -7,6 +7,7 @@
+ #include "macro.h"
+ #include "random-util.h"
+ #include "string-util.h"
++#include "missing_stdlib.h"
+ #include "tests.h"
+
+ TEST(hexchar) {
+--- a/src/udev/udev-builtin-path_id.c
++++ b/src/udev/udev-builtin-path_id.c
+@@ -22,6 +22,7 @@
+ #include "sysexits.h"
+ #include "udev-builtin.h"
+ #include "udev-util.h"
++#include "missing_stdlib.h"
+
+ _printf_(2,3)
+ static void path_prepend(char **path, const char *fmt, ...) {
+--- a/src/udev/udev-event.c
++++ b/src/udev/udev-event.c
+@@ -35,6 +35,7 @@
+ #include "udev-util.h"
+ #include "udev-watch.h"
+ #include "user-util.h"
++#include "missing_stdlib.h"
+
+ typedef struct Spawn {
+ sd_device *device;
+--- a/src/udev/udev-rules.c
++++ b/src/udev/udev-rules.c
+@@ -34,6 +34,7 @@
+ #include "udev-util.h"
+ #include "user-util.h"
+ #include "virt.h"
++#include "missing_stdlib.h"
+
+ #define RULES_DIRS (const char* const*) CONF_PATHS_STRV("udev/rules.d")
+
+--- a/src/core/dbus-cgroup.c
++++ b/src/core/dbus-cgroup.c
+@@ -21,6 +21,7 @@
+ #include "parse-util.h"
+ #include "path-util.h"
+ #include "percent-util.h"
++#include "missing_stdlib.h"
+ #include "socket-util.h"
+
+ BUS_DEFINE_PROPERTY_GET(bus_property_get_tasks_max, "t", TasksMax, tasks_max_resolve);
+--- a/src/fstab-generator/fstab-generator.c
++++ b/src/fstab-generator/fstab-generator.c
+@@ -29,6 +29,7 @@
+ #include "util.h"
+ #include "virt.h"
+ #include "volatile-util.h"
++#include "missing_stdlib.h"
+
+ typedef enum MountPointFlags {
+ MOUNT_NOAUTO = 1 << 0,
A => systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch +147 -0
@@ 1,147 @@
+From fb068403b25002156435350165ea418a6338a313 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 14:56:21 +0800
+Subject: [PATCH] don't fail if GLOB_BRACE and GLOB_ALTDIRFUNC is not defined
+
+If the standard library doesn't provide brace
+expansion users just won't get it.
+
+Dont use GNU GLOB extentions on non-glibc systems
+
+Conditionalize use of GLOB_ALTDIRFUNC
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+
+---
+ src/basic/glob-util.c | 12 ++++++++++++
+ src/test/test-glob-util.c | 16 ++++++++++++++++
+ src/tmpfiles/tmpfiles.c | 10 ++++++++++
+ 3 files changed, 38 insertions(+)
+
+--- a/src/basic/glob-util.c
++++ b/src/basic/glob-util.c
+@@ -12,6 +12,12 @@
+ #include "path-util.h"
+ #include "strv.h"
+
++/* Don't fail if the standard library
++ * doesn't provide brace expansion */
++#ifndef GLOB_BRACE
++#define GLOB_BRACE 0
++#endif
++
+ static void closedir_wrapper(void* v) {
+ (void) closedir(v);
+ }
+@@ -19,6 +25,7 @@ static void closedir_wrapper(void* v) {
+ int safe_glob(const char *path, int flags, glob_t *pglob) {
+ int k;
+
++#ifdef GLOB_ALTDIRFUNC
+ /* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */
+ assert(!(flags & GLOB_ALTDIRFUNC));
+
+@@ -32,9 +39,14 @@ int safe_glob(const char *path, int flag
+ pglob->gl_lstat = lstat;
+ if (!pglob->gl_stat)
+ pglob->gl_stat = stat;
++#endif
+
+ errno = 0;
++#ifdef GLOB_ALTDIRFUNC
+ k = glob(path, flags | GLOB_ALTDIRFUNC, NULL, pglob);
++#else
++ k = glob(path, flags, NULL, pglob);
++#endif
+ if (k == GLOB_NOMATCH)
+ return -ENOENT;
+ if (k == GLOB_NOSPACE)
+--- a/src/test/test-glob-util.c
++++ b/src/test/test-glob-util.c
+@@ -13,6 +13,12 @@
+ #include "tests.h"
+ #include "tmpfile-util.h"
+
++/* Don't fail if the standard library
++ * doesn't provide brace expansion */
++#ifndef GLOB_BRACE
++#define GLOB_BRACE 0
++#endif
++
+ TEST(glob_exists) {
+ char name[] = "/tmp/test-glob_exists.XXXXXX";
+ int fd = -1;
+@@ -40,11 +46,13 @@ TEST(glob_no_dot) {
+ const char *fn;
+
+ _cleanup_globfree_ glob_t g = {
++#ifdef GLOB_ALTDIRFUNC
+ .gl_closedir = closedir_wrapper,
+ .gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot,
+ .gl_opendir = (void *(*)(const char *)) opendir,
+ .gl_lstat = lstat,
+ .gl_stat = stat,
++#endif
+ };
+
+ int r;
+@@ -52,11 +60,19 @@ TEST(glob_no_dot) {
+ assert_se(mkdtemp(template));
+
+ fn = strjoina(template, "/*");
++#ifdef GLOB_ALTDIRFUNC
+ r = glob(fn, GLOB_NOSORT|GLOB_BRACE|GLOB_ALTDIRFUNC, NULL, &g);
++#else
++ r = glob(fn, GLOB_NOSORT|GLOB_BRACE, NULL, &g);
++#endif
+ assert_se(r == GLOB_NOMATCH);
+
+ fn = strjoina(template, "/.*");
++#ifdef GLOB_ALTDIRFUNC
+ r = glob(fn, GLOB_NOSORT|GLOB_BRACE|GLOB_ALTDIRFUNC, NULL, &g);
++#else
++ r = glob(fn, GLOB_NOSORT|GLOB_BRACE, NULL, &g);
++#endif
+ assert_se(r == GLOB_NOMATCH);
+
+ (void) rm_rf(template, REMOVE_ROOT|REMOVE_PHYSICAL);
+--- a/src/tmpfiles/tmpfiles.c
++++ b/src/tmpfiles/tmpfiles.c
+@@ -67,6 +67,12 @@
+ #include "umask-util.h"
+ #include "user-util.h"
+
++/* Don't fail if the standard library
++ * doesn't provide brace expansion */
++#ifndef GLOB_BRACE
++#define GLOB_BRACE 0
++#endif
++
+ /* This reads all files listed in /etc/tmpfiles.d/?*.conf and creates
+ * them in the file system. This is intended to be used to create
+ * properly owned directories beneath /tmp, /var/tmp, /run, which are
+@@ -1961,7 +1967,9 @@ finish:
+
+ static int glob_item(Item *i, action_t action) {
+ _cleanup_globfree_ glob_t g = {
++#ifdef GLOB_ALTDIRFUNC
+ .gl_opendir = (void *(*)(const char *)) opendir_nomod,
++#endif
+ };
+ int r = 0, k;
+ char **fn;
+@@ -1981,7 +1989,9 @@ static int glob_item(Item *i, action_t a
+
+ static int glob_item_recursively(Item *i, fdaction_t action) {
+ _cleanup_globfree_ glob_t g = {
++#ifdef GLOB_ALTDIRFUNC
+ .gl_opendir = (void *(*)(const char *)) opendir_nomod,
++#endif
+ };
+ int r = 0, k;
+ char **fn;
A => systemd/0008-add-missing-FTW_-macros-for-musl.patch +64 -0
@@ 1,64 @@
+From 7ca9887f84adba065dc2e59b3de55ace2fc72ec0 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:00:06 +0800
+Subject: [PATCH] add missing FTW_ macros for musl
+
+This is to avoid build failures like below for musl.
+
+ locale-util.c:296:24: error: 'FTW_STOP' undeclared
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+
+---
+ src/basic/missing_type.h | 20 ++++++++++++++++++++
+ src/shared/mount-setup.c | 1 +
+ 2 files changed, 21 insertions(+)
+
+--- a/src/basic/missing_type.h
++++ b/src/basic/missing_type.h
+@@ -19,3 +19,23 @@ typedef int (*comparison_fn_t)(const voi
+ #define __COMPAR_FN_T
+ typedef int (*__compar_fn_t)(const void *, const void *);
+ #endif
++
++#ifndef FTW_ACTIONRETVAL
++#define FTW_ACTIONRETVAL 16
++#endif
++
++#ifndef FTW_CONTINUE
++#define FTW_CONTINUE 0
++#endif
++
++#ifndef FTW_STOP
++#define FTW_STOP 1
++#endif
++
++#ifndef FTW_SKIP_SUBTREE
++#define FTW_SKIP_SUBTREE 2
++#endif
++
++#ifndef FTW_SKIP_SIBLINGS
++#define FTW_SKIP_SIBLINGS 3
++#endif
+--- a/src/shared/mount-setup.c
++++ b/src/shared/mount-setup.c
+@@ -32,6 +32,7 @@
+ #include "strv.h"
+ #include "user-util.h"
+ #include "virt.h"
++#include "missing_type.h"
+
+ typedef enum MountMode {
+ MNT_NONE = 0,
+--- a/src/test/test-recurse-dir.c
++++ b/src/test/test-recurse-dir.c
+@@ -6,6 +6,7 @@
+ #include "recurse-dir.h"
+ #include "strv.h"
+ #include "tests.h"
++#include "missing_type.h"
+
+ static char **list_nftw = NULL;
+
A => systemd/0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch +43 -0
@@ 1,43 @@
+From 943b4258b870c65caaa56fe4dad0d9c7281fdb1d Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:03:47 +0800
+Subject: [PATCH] fix missing of __register_atfork for non-glibc builds
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+
+---
+ src/basic/process-util.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/src/basic/process-util.c b/src/basic/process-util.c
+index 14259ea8df..18681838ef 100644
+--- a/src/basic/process-util.c
++++ b/src/basic/process-util.c
+@@ -18,6 +18,9 @@
+ #if HAVE_VALGRIND_VALGRIND_H
+ #include <valgrind/valgrind.h>
+ #endif
++#ifndef __GLIBC__
++#include <pthread.h>
++#endif
+
+ #include "alloc-util.h"
+ #include "architecture.h"
+@@ -1202,11 +1205,15 @@ void reset_cached_pid(void) {
+ cached_pid = CACHED_PID_UNSET;
+ }
+
++#ifdef __GLIBC__
+ /* We use glibc __register_atfork() + __dso_handle directly here, as they are not included in the glibc
+ * headers. __register_atfork() is mostly equivalent to pthread_atfork(), but doesn't require us to link against
+ * libpthread, as it is part of glibc anyway. */
+ extern int __register_atfork(void (*prepare) (void), void (*parent) (void), void (*child) (void), void *dso_handle);
+ extern void* __dso_handle _weak_;
++#else
++#define __register_atfork(prepare,parent,child,dso) pthread_atfork(prepare,parent,child)
++#endif
+
+ pid_t getpid_cached(void) {
+ static bool installed = false;
A => systemd/0010-Use-uintmax_t-for-handling-rlim_t.patch +98 -0
@@ 1,98 @@
+From 856010e268a6aca8e5f02502457afe289bd877f1 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:12:41 +0800
+Subject: [PATCH] Use uintmax_t for handling rlim_t
+
+PRIu{32,64} is not right format to represent rlim_t type
+therefore use %ju and typecast the rlim_t variables to
+uintmax_t.
+
+Fixes portablility errors like
+
+execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=]
+| fprintf(f, "%s%s: " RLIM_FMT "\n",
+| ^~~~~~~~
+| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
+| ~~~~~~~~~~~~~~~~~~~~~~
+
+Upstream-Status: Denied [https://github.com/systemd/systemd/pull/7199]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+[Rebased for v241]
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+
+---
+ src/basic/format-util.h | 8 +-------
+ src/basic/rlimit-util.c | 12 ++++++------
+ src/core/execute.c | 4 ++--
+ 3 files changed, 9 insertions(+), 15 deletions(-)
+
+--- a/src/basic/format-util.h
++++ b/src/basic/format-util.h
+@@ -34,13 +34,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32
+ # error Unknown timex member size
+ #endif
+
+-#if SIZEOF_RLIM_T == 8
+-# define RLIM_FMT "%" PRIu64
+-#elif SIZEOF_RLIM_T == 4
+-# define RLIM_FMT "%" PRIu32
+-#else
+-# error Unknown rlim_t size
+-#endif
++#define RLIM_FMT "%ju"
+
+ #if SIZEOF_DEV_T == 8
+ # define DEV_FMT "%" PRIu64
+--- a/src/basic/rlimit-util.c
++++ b/src/basic/rlimit-util.c
+@@ -44,7 +44,7 @@ int setrlimit_closest(int resource, cons
+ fixed.rlim_max == highest.rlim_max)
+ return 0;
+
+- log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", rlim->rlim_max, rlimit_to_string(resource), fixed.rlim_max);
++ log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", (uintmax_t)rlim->rlim_max, rlimit_to_string(resource), (uintmax_t)fixed.rlim_max);
+
+ return RET_NERRNO(setrlimit(resource, &fixed));
+ }
+@@ -307,13 +307,13 @@ int rlimit_format(const struct rlimit *r
+ if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
+ r = free_and_strdup(&s, "infinity");
+ else if (rl->rlim_cur >= RLIM_INFINITY)
+- r = asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max);
++ r = asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max);
+ else if (rl->rlim_max >= RLIM_INFINITY)
+- r = asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur);
+ else if (rl->rlim_cur == rl->rlim_max)
+- r = asprintf(&s, RLIM_FMT, rl->rlim_cur);
++ r = asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur);
+ else
+- r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max);
++ r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max);
+ if (r < 0)
+ return -ENOMEM;
+
+@@ -403,7 +403,7 @@ int rlimit_nofile_safe(void) {
+
+ rl.rlim_cur = FD_SETSIZE;
+ if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
+- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur);
++ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur);
+
+ return 1;
+ }
+--- a/src/core/execute.c
++++ b/src/core/execute.c
+@@ -5639,9 +5639,9 @@ void exec_context_dump(const ExecContext
+ for (unsigned i = 0; i < RLIM_NLIMITS; i++)
+ if (c->rlimit[i]) {
+ fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max);
+ fprintf(f, "%sLimit%sSoft: " RLIM_FMT "\n",
+- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur);
++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur);
+ }
+
+ if (c->ioprio_set) {
A => systemd/0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch +37 -0
@@ 1,37 @@
+From ad395dda5db9b1ae156be121cfc8a38960de6c55 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Wed, 28 Feb 2018 21:25:22 -0800
+Subject: [PATCH] test-sizeof.c: Disable tests for missing typedefs in musl
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+
+---
+ src/test/test-sizeof.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/src/test/test-sizeof.c
++++ b/src/test/test-sizeof.c
+@@ -55,8 +55,10 @@ int main(void) {
+ info(unsigned);
+ info(long unsigned);
+ info(long long unsigned);
++#ifdef __GLIBC__
+ info(__syscall_ulong_t);
+ info(__syscall_slong_t);
++#endif
+ info(intmax_t);
+ info(uintmax_t);
+
+@@ -76,7 +78,9 @@ int main(void) {
+ info(ssize_t);
+ info(time_t);
+ info(usec_t);
++#ifdef __GLIBC__
+ info(__time_t);
++#endif
+ info(pid_t);
+ info(uid_t);
+ info(gid_t);
A => systemd/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch +37 -0
@@ 1,37 @@
+From 30b08f76ea7f5c324afedf97f0867b76dac9f128 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Wed, 4 Jul 2018 15:00:44 +0800
+Subject: [PATCH] Do not disable buffering when writing to oom_score_adj
+
+On musl, disabling buffering when writing to oom_score_adj will
+cause the following error.
+
+ Failed to adjust OOM setting: Invalid argument
+
+This error appears for systemd-udevd.service and dbus.service.
+This is because kernel receives '-' instead of the whole '-900'
+if buffering is disabled.
+
+This is libc implementation specific, as glibc does not have this issue.
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+
+---
+ src/basic/process-util.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/src/basic/process-util.c
++++ b/src/basic/process-util.c
+@@ -1489,7 +1489,7 @@ int set_oom_score_adjust(int value) {
+ xsprintf(t, "%i", value);
+
+ return write_string_file("/proc/self/oom_score_adj", t,
+- WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_DISABLE_BUFFER);
++ WRITE_STRING_FILE_VERIFY_ON_FAILURE);
+ }
+
+ int get_oom_score_adjust(int *ret) {
A => systemd/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch +56 -0
@@ 1,56 @@
+From 873202f63f9f117c6e5a98e444cc709057042979 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Tue, 10 Jul 2018 15:40:17 +0800
+Subject: [PATCH] distinguish XSI-compliant strerror_r from GNU-specifi
+ strerror_r
+
+XSI-compliant strerror_r and GNU-specifi strerror_r are different.
+
+ int strerror_r(int errnum, char *buf, size_t buflen);
+ /* XSI-compliant */
+
+ char *strerror_r(int errnum, char *buf, size_t buflen);
+ /* GNU-specific */
+
+We need to distinguish between them. Otherwise, we'll get an int value
+assigned to (char *) variable, resulting in segment fault.
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+
+---
+ src/libsystemd/sd-bus/bus-error.c | 5 +++++
+ src/libsystemd/sd-journal/journal-send.c | 5 +++++
+ 2 files changed, 10 insertions(+)
+
+--- a/src/libsystemd/sd-bus/bus-error.c
++++ b/src/libsystemd/sd-bus/bus-error.c
+@@ -409,7 +409,12 @@ static void bus_error_strerror(sd_bus_er
+ return;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(error, m, k);
++ x = m;
++#else
+ x = strerror_r(error, m, k);
++#endif
+ if (errno == ERANGE || strlen(x) >= k - 1) {
+ free(m);
+ k *= 2;
+--- a/src/libsystemd/sd-journal/journal-send.c
++++ b/src/libsystemd/sd-journal/journal-send.c
+@@ -348,7 +348,12 @@ static int fill_iovec_perror_and_send(co
+ char* j;
+
+ errno = 0;
++#ifndef __GLIBC__
++ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++ j = buffer + 8 + k;
++#else
+ j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
++#endif
+ if (errno == 0) {
+ char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1];
+
A => systemd/0017-missing_type.h-add-__compar_d_fn_t-definition.patch +28 -0
@@ 1,28 @@
+From e27ecb188503159a3f11bb1179ba1892cd080843 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:27:54 +0800
+Subject: [PATCH] missing_type.h: add __compar_d_fn_t definition
+
+Fix the following compile failure:
+src/basic/util.h:71:18: error: unknown type name '__compar_d_fn_t'; did you mean '__compar_fn_t'?
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+
+---
+ src/basic/missing_type.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
+index 3df1084ef2..697aa7f58a 100644
+--- a/src/basic/missing_type.h
++++ b/src/basic/missing_type.h
+@@ -13,6 +13,7 @@
+
+ #ifndef __GLIBC__
+ typedef int (*comparison_fn_t)(const void *, const void *);
++typedef int (*__compar_d_fn_t) (const void *, const void *, void *);
+ #endif
+
+ #ifndef __COMPAR_FN_T
A => systemd/0018-avoid-redefinition-of-prctl_mm_map-structure.patch +30 -0
@@ 1,30 @@
+From 748c4cf040856857f24f4aeef6d996bd58573bd3 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 15:44:54 +0800
+Subject: [PATCH] avoid redefinition of prctl_mm_map structure
+
+Fix the following compile failure:
+error: redefinition of 'struct prctl_mm_map'
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+
+---
+ src/basic/missing_prctl.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h
+index ab851306ba..5547cad875 100644
+--- a/src/basic/missing_prctl.h
++++ b/src/basic/missing_prctl.h
+@@ -1,7 +1,9 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+ #pragma once
+
++#ifdef __GLIBC__
+ #include <linux/prctl.h>
++#endif
+
+ /* 58319057b7847667f0c9585b9de0e8932b0fdb08 (4.3) */
+ #ifndef PR_CAP_AMBIENT
A => systemd/0021-test-json.c-define-M_PIl.patch +29 -0
@@ 1,29 @@
+From 47472da6e8900773c26da8fd26699367447d97a6 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Mon, 25 Feb 2019 16:53:06 +0800
+Subject: [PATCH] test-json.c: define M_PIl
+
+Fix the following compile failure:
+src/test/test-json.c:305:50: error: 'M_PIl' undeclared (first use in this function); did you mean 'M_PI'?
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+
+---
+ src/test/test-json.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/src/test/test-json.c
++++ b/src/test/test-json.c
+@@ -14,6 +14,10 @@
+ #include "tests.h"
+ #include "util.h"
+
++#ifndef M_PIl
++#define M_PIl 3.141592653589793238462643383279502884L
++#endif
++
+ static void test_tokenizer_one(const char *data, ...) {
+ unsigned line = 0, column = 0;
+ void *state = NULL;
A => systemd/0022-do-not-disable-buffer-in-writing-files.patch +420 -0
@@ 1,420 @@
+From 0f9422780a569c79a4b28e44c79c70b4a354bd92 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Fri, 1 Mar 2019 15:22:15 +0800
+Subject: [PATCH] do not disable buffer in writing files
+
+Do not disable buffer in writing files, otherwise we get
+failure at boot for musl like below.
+
+ [!!!!!!] Failed to allocate manager object.
+
+And there will be other failures, critical or not critical.
+This is specific to musl.
+
+Upstream-Status: Inappropriate [musl]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+[Rebased for v242]
+Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
+[rebased for systemd 243]
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+
+---
+ src/basic/cgroup-util.c | 10 +++++-----
+ src/basic/procfs-util.c | 4 ++--
+ src/basic/sysctl-util.c | 2 +-
+ src/basic/util.c | 2 +-
+ src/binfmt/binfmt.c | 6 +++---
+ src/core/main.c | 4 ++--
+ src/core/smack-setup.c | 8 ++++----
+ src/hibernate-resume/hibernate-resume.c | 2 +-
+ src/libsystemd/sd-device/sd-device.c | 2 +-
+ src/nspawn/nspawn-cgroup.c | 2 +-
+ src/nspawn/nspawn.c | 6 +++---
+ src/shared/cgroup-setup.c | 4 ++--
+ src/shared/mount-util.c | 4 ++--
+ src/shared/smack-util.c | 2 +-
+ src/sleep/sleep.c | 8 ++++----
+ src/vconsole/vconsole-setup.c | 2 +-
+ 16 files changed, 34 insertions(+), 34 deletions(-)
+
+--- a/src/basic/cgroup-util.c
++++ b/src/basic/cgroup-util.c
+@@ -390,7 +390,7 @@ int cg_kill_kernel_sigkill(const char *c
+ if (r < 0)
+ return r;
+
+- r = write_string_file(killfile, "1", WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file(killfile, "1", 0);
+ if (r < 0)
+ return r;
+
+@@ -803,7 +803,7 @@ int cg_install_release_agent(const char
+
+ sc = strstrip(contents);
+ if (isempty(sc)) {
+- r = write_string_file(fs, agent, WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file(fs, agent, 0);
+ if (r < 0)
+ return r;
+ } else if (!path_equal(sc, agent))
+@@ -821,7 +821,7 @@ int cg_install_release_agent(const char
+
+ sc = strstrip(contents);
+ if (streq(sc, "0")) {
+- r = write_string_file(fs, "1", WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file(fs, "1", 0);
+ if (r < 0)
+ return r;
+
+@@ -848,7 +848,7 @@ int cg_uninstall_release_agent(const cha
+ if (r < 0)
+ return r;
+
+- r = write_string_file(fs, "0", WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file(fs, "0", 0);
+ if (r < 0)
+ return r;
+
+@@ -858,7 +858,7 @@ int cg_uninstall_release_agent(const cha
+ if (r < 0)
+ return r;
+
+- r = write_string_file(fs, "", WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file(fs, "", 0);
+ if (r < 0)
+ return r;
+
+@@ -1704,7 +1704,7 @@ int cg_set_attribute(const char *control
+ if (r < 0)
+ return r;
+
+- return write_string_file(p, value, WRITE_STRING_FILE_DISABLE_BUFFER);
++ return write_string_file(p, value, 0);
+ }
+
+ int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret) {
+--- a/src/basic/procfs-util.c
++++ b/src/basic/procfs-util.c
+@@ -64,13 +64,13 @@ int procfs_tasks_set_limit(uint64_t limi
+ * decrease it, as threads-max is the much more relevant sysctl. */
+ if (limit > pid_max-1) {
+ sprintf(buffer, "%" PRIu64, limit+1); /* Add one, since PID 0 is not a valid PID */
+- r = write_string_file("/proc/sys/kernel/pid_max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file("/proc/sys/kernel/pid_max", buffer, 0);
+ if (r < 0)
+ return r;
+ }
+
+ sprintf(buffer, "%" PRIu64, limit);
+- r = write_string_file("/proc/sys/kernel/threads-max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file("/proc/sys/kernel/threads-max", buffer, 0);
+ if (r < 0) {
+ uint64_t threads_max;
+
+--- a/src/basic/sysctl-util.c
++++ b/src/basic/sysctl-util.c
+@@ -58,7 +58,7 @@ int sysctl_write(const char *property, c
+
+ log_debug("Setting '%s' to '%s'", p, value);
+
+- return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_SUPPRESS_REDUNDANT_VIRTUAL);
++ return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_SUPPRESS_REDUNDANT_VIRTUAL);
+ }
+
+ int sysctl_writef(const char *property, const char *format, ...) {
+--- a/src/basic/util.c
++++ b/src/basic/util.c
+@@ -168,7 +168,7 @@ void disable_coredumps(void) {
+ if (detect_container() > 0)
+ return;
+
+- r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", 0);
+ if (r < 0)
+ log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m");
+ }
+--- a/src/binfmt/binfmt.c
++++ b/src/binfmt/binfmt.c
+@@ -29,7 +29,7 @@ static bool arg_unregister = false;
+
+ static int delete_rule(const char *rulename) {
+ const char *fn = strjoina("/proc/sys/fs/binfmt_misc/", rulename);
+- return write_string_file(fn, "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
++ return write_string_file(fn, "-1", 0);
+ }
+
+ static int apply_rule(const char *filename, unsigned line, const char *rule) {
+@@ -59,7 +59,7 @@ static int apply_rule(const char *filena
+ if (r >= 0)
+ log_debug("%s:%u: Rule '%s' deleted.", filename, line, rulename);
+
+- r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, 0);
+ if (r < 0)
+ return log_error_errno(r, "%s:%u: Failed to add binary format '%s': %m",
+ filename, line, rulename);
+@@ -226,7 +226,7 @@ static int run(int argc, char *argv[]) {
+ }
+
+ /* Flush out all rules */
+- r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0);
+ if (r < 0)
+ log_warning_errno(r, "Failed to flush binfmt_misc rules, ignoring: %m");
+ else
+--- a/src/core/main.c
++++ b/src/core/main.c
+@@ -1466,7 +1466,7 @@ static int bump_unix_max_dgram_qlen(void
+ if (v >= DEFAULT_UNIX_MAX_DGRAM_QLEN)
+ return 0;
+
+- r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", WRITE_STRING_FILE_DISABLE_BUFFER,
++ r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", 0,
+ "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN);
+ if (r < 0)
+ return log_full_errno(IN_SET(r, -EROFS, -EPERM, -EACCES) ? LOG_DEBUG : LOG_WARNING, r,
+@@ -1737,7 +1737,7 @@ static void initialize_core_pattern(bool
+ if (getpid_cached() != 1)
+ return;
+
+- r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, 0);
+ if (r < 0)
+ log_warning_errno(r, "Failed to write '%s' to /proc/sys/kernel/core_pattern, ignoring: %m",
+ arg_early_core_pattern);
+--- a/src/core/smack-setup.c
++++ b/src/core/smack-setup.c
+@@ -320,17 +320,17 @@ int mac_smack_setup(bool *loaded_policy)
+ }
+
+ #if HAVE_SMACK_RUN_LABEL
+- r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, 0);
+ if (r < 0)
+ log_warning_errno(r, "Failed to set SMACK label \"" SMACK_RUN_LABEL "\" on self: %m");
+- r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, 0);
+ if (r < 0)
+ log_warning_errno(r, "Failed to set SMACK ambient label \"" SMACK_RUN_LABEL "\": %m");
+ r = write_string_file("/sys/fs/smackfs/netlabel",
+- "0.0.0.0/0 " SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
++ "0.0.0.0/0 " SMACK_RUN_LABEL, 0);
+ if (r < 0)
+ log_warning_errno(r, "Failed to set SMACK netlabel rule \"0.0.0.0/0 " SMACK_RUN_LABEL "\": %m");
+- r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", 0);
+ if (r < 0)
+ log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m");
+ #endif
+--- a/src/hibernate-resume/hibernate-resume.c
++++ b/src/hibernate-resume/hibernate-resume.c
+@@ -45,7 +45,7 @@ int main(int argc, char *argv[]) {
+ return EXIT_FAILURE;
+ }
+
+- r = write_string_file("/sys/power/resume", major_minor, WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file("/sys/power/resume", major_minor, 0);
+ if (r < 0) {
+ log_error_errno(r, "Failed to write '%s' to /sys/power/resume: %m", major_minor);
+ return EXIT_FAILURE;
+--- a/src/libsystemd/sd-device/sd-device.c
++++ b/src/libsystemd/sd-device/sd-device.c
+@@ -2108,7 +2108,7 @@ _public_ int sd_device_set_sysattr_value
+ if (!value)
+ return -ENOMEM;
+
+- r = write_string_file(path, value, WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_NOFOLLOW);
++ r = write_string_file(path, value, 0 | WRITE_STRING_FILE_NOFOLLOW);
+ if (r < 0) {
+ /* On failure, clear cache entry, as we do not know how it fails. */
+ device_remove_cached_sysattr_value(device, sysattr);
+--- a/src/nspawn/nspawn-cgroup.c
++++ b/src/nspawn/nspawn-cgroup.c
+@@ -124,7 +124,7 @@ int sync_cgroup(pid_t pid, CGroupUnified
+ fn = strjoina(tree, cgroup, "/cgroup.procs");
+
+ sprintf(pid_string, PID_FMT, pid);
+- r = write_string_file(fn, pid_string, WRITE_STRING_FILE_DISABLE_BUFFER|WRITE_STRING_FILE_MKDIR_0755);
++ r = write_string_file(fn, pid_string, WRITE_STRING_FILE_MKDIR_0755);
+ if (r < 0) {
+ log_error_errno(r, "Failed to move process: %m");
+ goto finish;
+--- a/src/nspawn/nspawn.c
++++ b/src/nspawn/nspawn.c
+@@ -2757,7 +2757,7 @@ static int reset_audit_loginuid(void) {
+ if (streq(p, "4294967295"))
+ return 0;
+
+- r = write_string_file("/proc/self/loginuid", "4294967295", WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file("/proc/self/loginuid", "4294967295", 0);
+ if (r < 0) {
+ log_error_errno(r,
+ "Failed to reset audit login UID. This probably means that your kernel is too\n"
+@@ -4163,7 +4163,7 @@ static int setup_uid_map(
+ return log_oom();
+
+ xsprintf(uid_map, "/proc/" PID_FMT "/uid_map", pid);
+- r = write_string_file(uid_map, s, WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file(uid_map, s, 0);
+ if (r < 0)
+ return log_error_errno(r, "Failed to write UID map: %m");
+
+@@ -4173,7 +4173,7 @@ static int setup_uid_map(
+ return log_oom();
+
+ xsprintf(uid_map, "/proc/" PID_FMT "/gid_map", pid);
+- r = write_string_file(uid_map, s, WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file(uid_map, s, 0);
+ if (r < 0)
+ return log_error_errno(r, "Failed to write GID map: %m");
+
+--- a/src/shared/cgroup-setup.c
++++ b/src/shared/cgroup-setup.c
+@@ -345,7 +345,7 @@ int cg_attach(const char *controller, co
+
+ xsprintf(c, PID_FMT "\n", pid);
+
+- r = write_string_file(fs, c, WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file(fs, c, 0);
+ if (r < 0)
+ return r;
+
+@@ -877,7 +877,7 @@ int cg_enable_everywhere(
+ return log_debug_errno(errno, "Failed to open cgroup.subtree_control file of %s: %m", p);
+ }
+
+- r = write_string_stream(f, s, WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_stream(f, s, 0);
+ if (r < 0) {
+ log_debug_errno(r, "Failed to %s controller %s for %s (%s): %m",
+ FLAGS_SET(mask, bit) ? "enable" : "disable", n, p, fs);
+--- a/src/shared/smack-util.c
++++ b/src/shared/smack-util.c
+@@ -114,7 +114,7 @@ int mac_smack_apply_pid(pid_t pid, const
+ return 0;
+
+ p = procfs_file_alloca(pid, "attr/current");
+- r = write_string_file(p, label, WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file(p, label, 0);
+ if (r < 0)
+ return r;
+
+--- a/src/sleep/sleep.c
++++ b/src/sleep/sleep.c
+@@ -46,7 +46,7 @@ static int write_hibernate_location_info
+ assert(hibernate_location->swap);
+
+ xsprintf(resume_str, "%u:%u", major(hibernate_location->devno), minor(hibernate_location->devno));
+- r = write_string_file("/sys/power/resume", resume_str, WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file("/sys/power/resume", resume_str, 0);
+ if (r < 0)
+ return log_debug_errno(r, "Failed to write partition device to /sys/power/resume for '%s': '%s': %m",
+ hibernate_location->swap->device, resume_str);
+@@ -73,7 +73,7 @@ static int write_hibernate_location_info
+ }
+
+ xsprintf(offset_str, "%" PRIu64, hibernate_location->offset);
+- r = write_string_file("/sys/power/resume_offset", offset_str, WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file("/sys/power/resume_offset", offset_str, 0);
+ if (r < 0)
+ return log_debug_errno(r, "Failed to write swap file offset to /sys/power/resume_offset for '%s': '%s': %m",
+ hibernate_location->swap->device, offset_str);
+@@ -90,7 +90,7 @@ static int write_mode(char **modes) {
+ STRV_FOREACH(mode, modes) {
+ int k;
+
+- k = write_string_file("/sys/power/disk", *mode, WRITE_STRING_FILE_DISABLE_BUFFER);
++ k = write_string_file("/sys/power/disk", *mode, 0);
+ if (k >= 0)
+ return 0;
+
+@@ -112,7 +112,7 @@ static int write_state(FILE **f, char **
+ STRV_FOREACH(state, states) {
+ int k;
+
+- k = write_string_stream(*f, *state, WRITE_STRING_FILE_DISABLE_BUFFER);
++ k = write_string_stream(*f, *state, 0);
+ if (k >= 0)
+ return 0;
+ log_debug_errno(k, "Failed to write '%s' to /sys/power/state: %m", *state);
+--- a/src/vconsole/vconsole-setup.c
++++ b/src/vconsole/vconsole-setup.c
+@@ -108,7 +108,7 @@ static int toggle_utf8_vc(const char *na
+ static int toggle_utf8_sysfs(bool utf8) {
+ int r;
+
+- r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), 0);
+ if (r < 0)
+ return log_warning_errno(r, "Failed to %s sysfs UTF-8 flag: %m", enable_disable(utf8));
+
+--- a/src/basic/namespace-util.c
++++ b/src/basic/namespace-util.c
+@@ -202,12 +202,12 @@ int userns_acquire(const char *uid_map,
+ freeze();
+
+ xsprintf(path, "/proc/" PID_FMT "/uid_map", pid);
+- r = write_string_file(path, uid_map, WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file(path, uid_map, 0);
+ if (r < 0)
+ return log_error_errno(r, "Failed to write UID map: %m");
+
+ xsprintf(path, "/proc/" PID_FMT "/gid_map", pid);
+- r = write_string_file(path, gid_map, WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file(path, gid_map, 0);
+ if (r < 0)
+ return log_error_errno(r, "Failed to write GID map: %m");
+
+--- a/src/core/cgroup.c
++++ b/src/core/cgroup.c
+@@ -4140,7 +4140,7 @@ int unit_cgroup_freezer_action(Unit *u,
+ else
+ u->freezer_state = FREEZER_THAWING;
+
+- r = write_string_file(path, one_zero(action == FREEZER_FREEZE), WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file(path, one_zero(action == FREEZER_FREEZE), 0);
+ if (r < 0)
+ return r;
+
+--- a/src/home/homework.c
++++ b/src/home/homework.c
+@@ -284,7 +284,7 @@ static void drop_caches_now(void) {
+ * details. We write "2" into /proc/sys/vm/drop_caches to ensure dentries/inodes are flushed, but not
+ * more. */
+
+- r = write_string_file("/proc/sys/vm/drop_caches", "2\n", WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file("/proc/sys/vm/drop_caches", "2\n", 0);
+ if (r < 0)
+ log_warning_errno(r, "Failed to drop caches, ignoring: %m");
+ else
+--- a/src/shared/binfmt-util.c
++++ b/src/shared/binfmt-util.c
+@@ -26,7 +26,7 @@ int disable_binfmt(void) {
+ if (r < 0)
+ return log_warning_errno(r, "Failed to determine whether binfmt_misc is mounted: %m");
+
+- r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
++ r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0);
+ if (r < 0)
+ return log_warning_errno(r, "Failed to unregister binfmt_misc entries: %m");
+
+--- a/src/shared/coredump-util.c
++++ b/src/shared/coredump-util.c
+@@ -70,5 +70,5 @@ int set_coredump_filter(uint64_t value)
+ sprintf(t, "0x%"PRIx64, value);
+
+ return write_string_file("/proc/self/coredump_filter", t,
+- WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_DISABLE_BUFFER);
++ WRITE_STRING_FILE_VERIFY_ON_FAILURE);
+ }
+--- a/src/udev/udev-rules.c
++++ b/src/udev/udev-rules.c
+@@ -2181,7 +2181,6 @@ static int udev_rule_apply_token_to_even
+ log_rule_debug(dev, rules, "ATTR '%s' writing '%s'", buf, value);
+ r = write_string_file(buf, value,
+ WRITE_STRING_FILE_VERIFY_ON_FAILURE |
+- WRITE_STRING_FILE_DISABLE_BUFFER |
+ WRITE_STRING_FILE_AVOID_NEWLINE |
+ WRITE_STRING_FILE_VERIFY_IGNORE_NEWLINE);
+ if (r < 0)
A => systemd/0025-Handle-__cpu_mask-usage.patch +58 -0
@@ 1,58 @@
+From 5fa412dcebe89fd9f6f6003163f17e0dc719df34 Mon Sep 17 00:00:00 2001
+From: Scott Murray <scott.murray@konsulko.com>
+Date: Fri, 13 Sep 2019 19:26:27 -0400
+Subject: [PATCH] Handle __cpu_mask usage
+
+Fixes errors:
+
+src/test/test-cpu-set-util.c:18:54: error: '__cpu_mask' undeclared (first use in this function)
+src/test/test-sizeof.c:73:14: error: '__cpu_mask' undeclared (first use in this function)
+
+__cpu_mask is an internal type of glibc's cpu_set implementation, not
+part of the POSIX definition, which is problematic when building with
+musl, which does not define a matching type. From inspection of musl's
+sched.h, however, it is clear that the corresponding type would be
+unsigned long, which does match glibc's actual __CPU_MASK_TYPE. So,
+add a typedef to cpu-set-util.h defining __cpu_mask appropriately.
+
+Upstream-Status: Inappropriate [musl specific]
+
+Signed-off-by: Scott Murray <scott.murray@konsulko.com>
+
+---
+ src/shared/cpu-set-util.h | 2 ++
+ src/test/test-sizeof.c | 2 +-
+ 2 files changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/shared/cpu-set-util.h b/src/shared/cpu-set-util.h
+index 3c63a58826..4c2d4347fc 100644
+--- a/src/shared/cpu-set-util.h
++++ b/src/shared/cpu-set-util.h
+@@ -6,6 +6,8 @@
+ #include "macro.h"
+ #include "missing_syscall.h"
+
++typedef unsigned long __cpu_mask;
++
+ /* This wraps the libc interface with a variable to keep the allocated size. */
+ typedef struct CPUSet {
+ cpu_set_t *set;
+diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c
+index 4403c0aa52..e7e4ae112d 100644
+--- a/src/test/test-sizeof.c
++++ b/src/test/test-sizeof.c
+@@ -1,6 +1,5 @@
+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+-#include <sched.h>
+ #include <stdio.h>
+ #include <string.h>
+ #include <sys/types.h>
+@@ -10,6 +9,7 @@
+ #include <float.h>
+
+ #include "time-util.h"
++#include "cpu-set-util.h"
+
+ /* Print information about various types. Useful when diagnosing
+ * gcc diagnostics on an unfamiliar architecture. */
A => systemd/0026-Handle-missing-gshadow.patch +165 -0
@@ 1,165 @@
+From 66a926cf906260c2fb5ea851e55efe03edd444dc Mon Sep 17 00:00:00 2001
+From: Alex Kiernan <alex.kiernan@gmail.com>
+Date: Tue, 10 Mar 2020 11:05:20 +0000
+Subject: [PATCH] Handle missing gshadow
+
+gshadow usage is now present in the userdb code. Mask all uses of it to
+allow compilation on musl
+
+Upstream-Status: Inappropriate [musl specific]
+Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
+[Rebased for v247]
+Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
+
+---
+ src/shared/user-record-nss.c | 20 ++++++++++++++++++++
+ src/shared/user-record-nss.h | 4 ++++
+ src/shared/userdb.c | 7 ++++++-
+ 3 files changed, 30 insertions(+), 1 deletion(-)
+
+--- a/src/shared/user-record-nss.c
++++ b/src/shared/user-record-nss.c
+@@ -331,8 +331,10 @@ int nss_group_to_group_record(
+ if (isempty(grp->gr_name))
+ return -EINVAL;
+
++#if ENABLE_GSHADOW
+ if (sgrp && !streq_ptr(sgrp->sg_namp, grp->gr_name))
+ return -EINVAL;
++#endif
+
+ g = group_record_new();
+ if (!g)
+@@ -348,6 +350,7 @@ int nss_group_to_group_record(
+
+ g->gid = grp->gr_gid;
+
++#if ENABLE_GSHADOW
+ if (sgrp) {
+ if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) {
+ g->hashed_password = strv_new(sgrp->sg_passwd);
+@@ -363,6 +366,7 @@ int nss_group_to_group_record(
+ if (r < 0)
+ return r;
+ }
++#endif
+
+ r = json_build(&g->json, JSON_BUILD_OBJECT(
+ JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)),
+@@ -388,6 +392,7 @@ int nss_sgrp_for_group(const struct grou
+ assert(ret_sgrp);
+ assert(ret_buffer);
+
++#if ENABLE_GSHADOW
+ for (;;) {
+ _cleanup_free_ char *buf = NULL;
+ struct sgrp sgrp, *result;
+@@ -416,6 +421,9 @@ int nss_sgrp_for_group(const struct grou
+ buflen *= 2;
+ buf = mfree(buf);
+ }
++#else
++ return -ESRCH;
++#endif
+ }
+
+ int nss_group_record_by_name(
+@@ -427,7 +435,9 @@ int nss_group_record_by_name(
+ struct group grp, *result;
+ bool incomplete = false;
+ size_t buflen = 4096;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp, *sresult = NULL;
++#endif
+ int r;
+
+ assert(name);
+@@ -457,6 +467,7 @@ int nss_group_record_by_name(
+ buf = mfree(buf);
+ }
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -468,6 +479,9 @@ int nss_group_record_by_name(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+@@ -484,7 +498,9 @@ int nss_group_record_by_gid(
+ struct group grp, *result;
+ bool incomplete = false;
+ size_t buflen = 4096;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp, *sresult = NULL;
++#endif
+ int r;
+
+ assert(ret);
+@@ -512,6 +528,7 @@ int nss_group_record_by_gid(
+ buf = mfree(buf);
+ }
+
++#if ENABLE_GSHADOW
+ if (with_shadow) {
+ r = nss_sgrp_for_group(result, &sgrp, &sbuf);
+ if (r < 0) {
+@@ -523,6 +540,9 @@ int nss_group_record_by_gid(
+ incomplete = true;
+
+ r = nss_group_to_group_record(result, sresult, ret);
++#else
++ r = nss_group_to_group_record(result, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
+--- a/src/shared/user-record-nss.h
++++ b/src/shared/user-record-nss.h
+@@ -2,7 +2,11 @@
+ #pragma once
+
+ #include <grp.h>
++#if ENABLE_GSHADOW
+ #include <gshadow.h>
++#else
++struct sgrp;
++#endif
+ #include <pwd.h>
+ #include <shadow.h>
+
+--- a/src/shared/userdb.c
++++ b/src/shared/userdb.c
+@@ -1046,13 +1046,15 @@ int groupdb_iterator_get(UserDBIterator
+ if (gr) {
+ _cleanup_free_ char *buffer = NULL;
+ bool incomplete = false;
++#if ENABLE_GSHADOW
+ struct sgrp sgrp;
+-
++#endif
+ if (streq_ptr(gr->gr_name, "root"))
+ iterator->synthesize_root = false;
+ if (gr->gr_gid == GID_NOBODY)
+ iterator->synthesize_nobody = false;
+
++#if ENABLE_GSHADOW
+ if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) {
+ r = nss_sgrp_for_group(gr, &sgrp, &buffer);
+ if (r < 0) {
+@@ -1065,6 +1067,9 @@ int groupdb_iterator_get(UserDBIterator
+ }
+
+ r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);
++#else
++ r = nss_group_to_group_record(gr, NULL, ret);
++#endif
+ if (r < 0)
+ return r;
+
A => systemd/0100-Do-not-buffer-on-systemd-sleep.patch +38 -0
@@ 1,38 @@
+--- a/src/sleep/sleep.c
++++ b/src/sleep/sleep.c
+@@ -46,7 +46,7 @@ static int write_hibernate_location_info(const HibernateLocation *hibernate_loca
+ assert(hibernate_location->swap);
+
+ xsprintf(resume_str, "%u:%u", major(hibernate_location->devno), minor(hibernate_location->devno));
+- r = write_string_file("/sys/power/resume", resume_str, 0);
++ r = write_string_file("/sys/power/resume", resume_str, WRITE_STRING_FILE_DISABLE_BUFFER);
+ if (r < 0)
+ return log_debug_errno(r, "Failed to write partition device to /sys/power/resume for '%s': '%s': %m",
+ hibernate_location->swap->device, resume_str);
+@@ -73,7 +73,7 @@ static int write_hibernate_location_info(const HibernateLocation *hibernate_loca
+ }
+
+ xsprintf(offset_str, "%" PRIu64, hibernate_location->offset);
+- r = write_string_file("/sys/power/resume_offset", offset_str, 0);
++ r = write_string_file("/sys/power/resume_offset", offset_str, WRITE_STRING_FILE_DISABLE_BUFFER);
+ if (r < 0)
+ return log_debug_errno(r, "Failed to write swap file offset to /sys/power/resume_offset for '%s': '%s': %m",
+ hibernate_location->swap->device, offset_str);
+@@ -90,7 +90,7 @@ static int write_mode(char **modes) {
+ STRV_FOREACH(mode, modes) {
+ int k;
+
+- k = write_string_file("/sys/power/disk", *mode, 0);
++ k = write_string_file("/sys/power/disk", *mode, WRITE_STRING_FILE_DISABLE_BUFFER);
+ if (k >= 0)
+ return 0;
+
+@@ -112,7 +112,7 @@ static int write_state(FILE **f, char **states) {
+ STRV_FOREACH(state, states) {
+ int k;
+
+- k = write_string_stream(*f, *state, 0);
++ k = write_string_stream(*f, *state, WRITE_STRING_FILE_DISABLE_BUFFER);
+ if (k >= 0)
+ return 0;
+ log_debug_errno(k, "Failed to write '%s' to /sys/power/state: %m", *state);
A => systemd/0101-efi-do-not-set-wide-exec-charset.patch +25 -0
@@ 1,25 @@
+From 8c56b54098d790c061cb85bbe9633d3bf5413e08 Mon Sep 17 00:00:00 2001
+From: xdavidwu <xdavidwuph@gmail.com>
+Date: Thu, 27 Jan 2022 15:44:39 +0800
+Subject: [PATCH] efi: do not set wide-exec-charset
+
+setting to UCS2 produces unbootable binary on musl (iconv difference?)
+---
+ src/boot/efi/meson.build | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build
+index e10e51cf4e..4c7a50bddb 100644
+--- a/src/boot/efi/meson.build
++++ b/src/boot/efi/meson.build
+@@ -215,7 +215,6 @@ efi_cflags = cc.get_supported_arguments(
+ '-fno-stack-protector',
+ '-fno-strict-aliasing',
+ '-fpic',
+- '-fwide-exec-charset=UCS2',
+ '-Wall',
+ '-Wextra',
+ '-Wsign-compare',
+--
+2.34.1
+
A => systemd/APKBUILD +167 -0
@@ 1,167 @@
+# Contributor: xdavidwu <xdavidwuph@gmail.com>
+# Maintainer: xdavidwu <xdavidwuph@gmail.com>
+pkgname=systemd
+pkgver=250.4
+pkgrel=0
+pkgdesc="System and Service Manager"
+url="https://www.github.com/systemd/systemd"
+arch="all"
+license="LGPL2.1-or-later"
+# login: pam support (for systemd-logind)
+# fsck: -l used in systemd-fsck
+depends="cmd:agetty cmd:login cmd:fsck"
+makedepends="coreutils py3-jinja2 gperf libcap-dev util-linux-dev gettext-dev kmod-dev bash libxslt docbook-xsl meson linux-pam-dev zstd-dev libseccomp-dev gnu-efi-dev"
+checkdepends=""
+install="$pkgname.pre-install"
+subpackages="$pkgname-dev $pkgname-doc $pkgname-bash-completion $pkgname-zsh-completion"
+source="$pkgname-$pkgver.tar.gz::https://github.com/systemd/systemd-stable/archive/refs/tags/v$pkgver.tar.gz
+ 0001-Adjust-for-musl-headers.patch
+ 0001-pass-correct-parameters-to-getdents64.patch
+ 0002-Add-sys-stat.h-for-S_IFDIR.patch
+ 0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch
+ 0004-add-fallback-parse_printf_format-implementation.patch
+ 0005-src-basic-missing.h-check-for-missing-strndupa.patch
+ 0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch
+ 0008-add-missing-FTW_-macros-for-musl.patch
+ 0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch
+ 0010-Use-uintmax_t-for-handling-rlim_t.patch
+ 0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch
+ 0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch
+ 0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch
+ 0017-missing_type.h-add-__compar_d_fn_t-definition.patch
+ 0018-avoid-redefinition-of-prctl_mm_map-structure.patch
+ 0021-test-json.c-define-M_PIl.patch
+ 0022-do-not-disable-buffer-in-writing-files.patch
+ 0025-Handle-__cpu_mask-usage.patch
+ 0026-Handle-missing-gshadow.patch
+ 0100-Do-not-buffer-on-systemd-sleep.patch
+ 0101-efi-do-not-set-wide-exec-charset.patch"
+pkgusers="systemd-network systemd-resolve systemd-coredump"
+pkggroups="systemd-journal"
+provides="hwids-udev=99999999 eudev=99 eudev-libs=99"
+builddir="$srcdir/systemd-stable-$pkgver"
+
+build() {
+ env LDFLAGS=" -lintl " CFLAGS=" -D__UAPI_DEF_ETHHDR=0 " meson \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --mandir=/usr/share/man \
+ --localstatedir=/var \
+ --buildtype=plain \
+ -Defi=true \
+ -Dgnu-efi=true \
+ -Duserdb=false \
+ -Dman=true \
+ -Dpolkit=false \
+ -Dkmod=true \
+ -Dpam=true \
+ -Drepart=false \
+ -Dhomed=false \
+ -Dremote=false \
+ -Dnss-mymachines=false \
+ -Dnss-resolve=false \
+ -Dimportd=false \
+ -Dhtml=false \
+ -Ddns-over-tls=false \
+ -Dseccomp=true \
+ -Dselinux=false \
+ -Dapparmor=false \
+ -Dacl=false \
+ -Daudit=false \
+ -Dblkid=true \
+ -Dfdisk=false \
+ -Dpwquality=false \
+ -Dmicrohttpd=false \
+ -Dlibcryptsetup=false \
+ -Dlibcryptsetup-plugins=false \
+ -Dlibcurl=false \
+ -Dlibidn2=false \
+ -Dlibidn=false \
+ -Dlibiptc=false \
+ -Dqrencode=false \
+ -Dgcrypt=false \
+ -Dgnutls=false \
+ -Dopenssl=false \
+ -Dp11kit=false \
+ -Dlibfido2=false \
+ -Dtpm2=false \
+ -Delfutils=false \
+ -Dzlib=false \
+ -Dbzip2=false \
+ -Dxz=false \
+ -Dlz4=false \
+ -Dzstd=true \
+ -Dxkbcommon=false \
+ -Dpcre2=false \
+ -Dglib=false \
+ -Ddbus=false \
+ -Dbpf-framework=false \
+ -Dinitrd=false \
+ -Dnscd=false \
+ -Dutmp=false \
+ -Dhibernate=false \
+ -Dldconfig=false \
+ -Denvironment-d=false \
+ -Dbinfmt=false \
+ -Dpstore=false \
+ -Doomd=false \
+ -Dhostnamed=false \
+ -Dlocaled=false \
+ -Dmachined=false \
+ -Dportabled=false \
+ -Dsysext=false \
+ -Dtimedated=false \
+ -Dtimesyncd=false \
+ -Dnss-myhostname=false \
+ -Dnss-systemd=false \
+ -Dfirstboot=false \
+ -Drandomseed=false \
+ -Dquotacheck=false \
+ -Dsysusers=false \
+ -Dtmpfiles=false \
+ -Dtranslations=false \
+ -Dgshadow=false \
+ -Dsmack=false \
+ -Dima=false \
+ -Didn=false \
+ -Dkernel-install=false \
+ -Dmode=release \
+ -Dsysvinit-path='' \
+ -Dsysvrcnd-path='' \
+ . output
+ meson compile ${JOBS:+-j ${JOBS}} -C output
+}
+
+check() {
+ # Replace with proper check command(s)
+ :
+}
+
+package() {
+ env DESTDIR="$pkgdir" meson install --no-rebuild -C output
+}
+
+sha512sums="
+307ed0920da660b6c45d909fea66864fb98db8b2f6905d629fb2012fc4bf64dd25fd61168c22bf4098200be541be9b0e815fbde98806a99c85cb33d49d8b63d0 systemd-250.4.tar.gz
+adfdf309b414d86fc754733cd7eef7d3f4830d7092b5db09376243669962b672a3b5d79d8c4ef0c992d3baab2b1fb425125f4abf264d3cfd3b533ddd26f85999 0001-Adjust-for-musl-headers.patch
+b411e5dcb6bfa9608c0c22f2397eee80c711c41afece91a1132864ff83041d0889fc91ed200d3525d2a8247865dc06c71accaa861035ef50d1b772b5990042f7 0001-pass-correct-parameters-to-getdents64.patch
+e494fb8fc915a4d6eb50dd4a5aca205b151a547eb7ef0f42dc61f685dd7732482e462ebc28f1ec625b2b7356451eac3aba037ff72b7f30ac277c0f371d8bd403 0002-Add-sys-stat.h-for-S_IFDIR.patch
+0a9492023c8dc3a9c59959d2de3eb0cd214bdf3adad86454c3e1bc238909587af8c8d132236a38d95dec7267e5e6943719e04d4385214529e3316b2a5cc05d5f 0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch
+daf40f1047105e796a3840a8b02027f8f1e22d6f36b1776e24c62cbd32941641f33a7d4ce95d884acd01d959ad1c8e92e8a463ac68537e5e9428d238c9e00efe 0004-add-fallback-parse_printf_format-implementation.patch
+b8ade4487130e131e1c8feda08f394d583085e63070955087592b8f5de036771cc1078a816ad81fc5e4266e778b842f9c8647d6c2e7544352b033b49b52ced15 0005-src-basic-missing.h-check-for-missing-strndupa.patch
+2fb8f3d17bcdecc0ecc7fdbce7ce7c77d02dd34df34530b1cf1a24431aff382fb683782d6eb960ea4a88ca96fdf006ea42dfe03dd659d8efcfbb757996413786 0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch
+9566e079d6f19062210bffbb11246e44e1c3cb6696d1507a99c5aa3abbdaf556bf0cc5ee47172b76c218278fbbe3780b1d93333aa232a8082ba11faf32019d08 0008-add-missing-FTW_-macros-for-musl.patch
+da4439142a9b7489baffcf9dfdf1632e056437e2575974944cac7795f63086b55221e65183dc41ad3d0745d12345178a99ae8cad2646de24a7d157921add2b01 0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch
+b9060f1221ae3486b5a70ab76c9e34b428daa493ff956327cb7a1ba3123a19c0c8e55a45f19f7eca2595dca1e71567a2792289f45728ccca8f4c93cb436746e6 0010-Use-uintmax_t-for-handling-rlim_t.patch
+73a526913021b775dbb86df307c3cc1218155fc3fbd84826d32f3836575bb5b7f2ffed0b662fe0e113d7e3b5820a200045228a18c7433ad5e0f0ea969a2974c6 0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch
+46214b7edc2a8c20066279877689f41fa707ca22f20583727a12fbc9749ff3235244199afdc2ed41705d8fc8b53e5400a83bf28938c296ed42098843783b1a84 0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch
+605502db16e775bfa7d029b0694f25b8f4f3cbfd0d1c7f1ef8247299d5a63ee337270d1d38a1378ecdbb57c7f153e40a3dede820aef505a9471857b9caedf556 0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch
+5467911e78ae20dfa7a722fa84b9aedb0950e531d6cfd8a024e78615518096e02701835003f2cd4b9fb7774a0163b5f323781a2b37ee1ee9e0dd64ff63ec16fb 0017-missing_type.h-add-__compar_d_fn_t-definition.patch
+5388555fa8b84834bd051b8adae6c0a73eb8607dc2c88e5f697e6592a7d1c92b8feade49e14cd00040a16cf487481d58b8972bd4eb0a7ae419cccc5c75cd3034 0018-avoid-redefinition-of-prctl_mm_map-structure.patch
+c3a5a880f94630696cd0d6343c3acd7f2870707f284c2649d6b94ed96dc9ae951cfbb83d3b552dba39707ffc48a0d6b0170c3b47970b5486a21887cec1afdc5b 0021-test-json.c-define-M_PIl.patch
+9836c441c897a7f5fee1cb8cc74d68dd66feb2b2d0fb1d1afadd4ddd229f6504932b36d467031f28065970958afb5a1cb2c3dc658cbaf7d103fd1dfe61197702 0022-do-not-disable-buffer-in-writing-files.patch
+8aa96a16ced368c25e88e074a0a5477f10f10d0383018636c3f5f65e2b4e4758d16fb2135d75487f162b47ea63ff2b95258f010a960a9c7665a08bd4973bc155 0025-Handle-__cpu_mask-usage.patch
+ee54ebe4a0e23bfa1738d38467f22ff022399dfb6a2fcb2e61e7c2c66a6839bb7a9bf8fd7dc2d1a187495b8983c887543cb77bec142d8abed79e7f25820d537b 0026-Handle-missing-gshadow.patch
+aeca4851d4cef2439eca2519dd031a842d7699782edee06239ca66f157711faf16c2943b310963faaf06d3b8c02bb0390b900ea8900c88e5ecbfc000f7929ab6 0100-Do-not-buffer-on-systemd-sleep.patch
+7e2d8dd17dff530218ab6301d718d47264688ec7c4de0f57004b2a7b512f26a4ff1ab962b74f8914e410b9cc03ccf304822c5cf67b5b64fe584dc884e68fcb9e 0101-efi-do-not-set-wide-exec-charset.patch
+"
A => systemd/systemd.pre-install +8 -0
@@ 1,8 @@
+#!/bin/sh
+
+addgroup -S systemd-journal 2>/dev/null
+adduser -S -D -H -s /bin/false systemd-network 2>/dev/null
+adduser -S -D -H -s /bin/false systemd-resolve 2>/dev/null
+adduser -S -D -H -s /bin/false systemd-coredump 2>/dev/null
+
+exit 0