~xdavidwu/systemd-apkbuilds

bf13bbb47bf129c0d8bea7eee512af59bad2395c — xdavidwu 9 months ago 64111b8
systemd: 254
M systemd/0003-errno-util-Make-STRERROR-portable-for-musl.patch => systemd/0003-errno-util-Make-STRERROR-portable-for-musl.patch +3 -4
@@ 11,8 11,8 @@ Upstream-Status: Inappropriate [musl specific]

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 src/basic/errno-util.h | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
 src/basic/errno-util.h | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/basic/errno-util.h b/src/basic/errno-util.h
index 091f99c590..eb5c1f9961 100644


@@ 23,9 23,8 @@ index 091f99c590..eb5c1f9961 100644
  *
  * Note that we use the GNU variant of strerror_r() here. */
-#define STRERROR(errnum) strerror_r(abs(errnum), (char[ERRNO_BUF_LEN]){}, ERRNO_BUF_LEN)
-
+static inline const char * STRERROR(int errnum);
+
 
+static inline const char * STRERROR(int errnum) {
+#ifdef __GLIBC__
+        return strerror_r(abs(errnum), (char[ERRNO_BUF_LEN]){}, ERRNO_BUF_LEN);

M systemd/0010-add-fallback-parse_printf_format-implementation.patch => systemd/0010-add-fallback-parse_printf_format-implementation.patch +4 -21
@@ 21,23 21,19 @@ Signed-off-by: Scott Murray <scott.murray@konsulko.com>
 create mode 100644 src/basic/parse-printf-format.c
 create mode 100644 src/basic/parse-printf-format.h

diff --git a/meson.build b/meson.build
index bfc86857d6..fb96143c37 100644
--- a/meson.build
+++ b/meson.build
@@ -755,6 +755,7 @@ endif
@@ -781,6 +781,7 @@ endif
 foreach header : ['crypt.h',
                   'linux/memfd.h',
                   'linux/vm_sockets.h',
+                  'printf.h',
                   'sys/auxv.h',
                   'threads.h',
                   'valgrind/memcheck.h',
                   'valgrind/valgrind.h',
diff --git a/src/basic/meson.build b/src/basic/meson.build
index 7aae031d81..1aa9f5006d 100644
--- a/src/basic/meson.build
+++ b/src/basic/meson.build
@@ -173,6 +173,11 @@ endforeach
@@ -179,6 +179,11 @@ endforeach
 
 basic_sources += generated_gperf_headers
 


@@ 49,9 45,6 @@ index 7aae031d81..1aa9f5006d 100644
 ############################################################
 
 arch_list = [
diff --git a/src/basic/parse-printf-format.c b/src/basic/parse-printf-format.c
new file mode 100644
index 0000000000..49437e5445
--- /dev/null
+++ b/src/basic/parse-printf-format.c
@@ -0,0 +1,273 @@


@@ 328,9 321,6 @@ index 0000000000..49437e5445
+
+        return last;
+}
diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h
new file mode 100644
index 0000000000..47be7522d7
--- /dev/null
+++ b/src/basic/parse-printf-format.h
@@ -0,0 +1,57 @@


@@ 391,8 381,6 @@ index 0000000000..47be7522d7
+size_t parse_printf_format(const char *fmt, size_t n, int *types);
+
+#endif /* HAVE_PRINTF_H */
diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h
index 4e93ac90c9..f9deb6f662 100644
--- a/src/basic/stdio-util.h
+++ b/src/basic/stdio-util.h
@@ -1,12 +1,12 @@


@@ 409,8 397,6 @@ index 4e93ac90c9..f9deb6f662 100644
 
 _printf_(3, 4)
 static inline char *snprintf_ok(char *buf, size_t len, const char *format, ...) {
diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journal/journal-send.c
index 3b74d2246e..136ebcb153 100644
--- a/src/libsystemd/sd-journal/journal-send.c
+++ b/src/libsystemd/sd-journal/journal-send.c
@@ -2,7 +2,6 @@


@@ 421,7 407,7 @@ index 3b74d2246e..136ebcb153 100644
 #include <stddef.h>
 #include <sys/un.h>
 #include <unistd.h>
@@ -25,6 +24,7 @@
@@ -27,6 +26,7 @@
 #include "stdio-util.h"
 #include "string-util.h"
 #include "tmpfile-util.h"


@@ 429,6 415,3 @@ index 3b74d2246e..136ebcb153 100644
 
 #define SNDBUF_SIZE (8*1024*1024)
 
-- 
2.39.2


M systemd/0011-src-basic-missing.h-check-for-missing-strndupa.patch => systemd/0011-src-basic-missing.h-check-for-missing-strndupa.patch +35 -34
@@ 17,6 17,7 @@ Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
[rebased for systemd 244]
[Rebased for v247]
Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
[Rebased for v254]
---
 meson.build                                |  1 +
 src/backlight/backlight.c                  |  1 +


@@ 74,7 75,7 @@ diff --git a/meson.build b/meson.build
index fb96143c37..739b2f7f72 100644
--- a/meson.build
+++ b/meson.build
@@ -574,6 +574,7 @@ foreach ident : ['secure_getenv', '__secure_getenv']
@@ -595,6 +595,7 @@ foreach ident : ['secure_getenv', '__secure_getenv']
 endforeach
 
 foreach ident : [


@@ 98,7 99,7 @@ diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
index feda596939..11b4375ed5 100644
--- a/src/basic/cgroup-util.c
+++ b/src/basic/cgroup-util.c
@@ -37,6 +37,7 @@
@@ -38,6 +38,7 @@
 #include "unit-name.h"
 #include "user-util.h"
 #include "xattr-util.h"


@@ 122,14 123,14 @@ diff --git a/src/basic/log.c b/src/basic/log.c
index fc5793139e..515218fca8 100644
--- a/src/basic/log.c
+++ b/src/basic/log.c
@@ -39,6 +39,7 @@
@@ -40,6 +40,7 @@
 #include "terminal-util.h"
 #include "time-util.h"
 #include "utf8.h"
+#include "missing_stdlib.h"
 
 #define SNDBUF_SIZE (8*1024*1024)
 #define IOVEC_MAX 128U
 #define IOVEC_MAX 256U
diff --git a/src/basic/missing_stdlib.h b/src/basic/missing_stdlib.h
index 8c76f93eb2..9068bfb4f0 100644
--- a/src/basic/missing_stdlib.h


@@ 166,7 167,7 @@ diff --git a/src/basic/mountpoint-util.c b/src/basic/mountpoint-util.c
index bc74fbef8f..cdb609bb84 100644
--- a/src/basic/mountpoint-util.c
+++ b/src/basic/mountpoint-util.c
@@ -13,6 +13,7 @@
@@ -18,6 +18,7 @@
 #include "missing_stat.h"
 #include "missing_syscall.h"
 #include "mkdir.h"


@@ 214,14 215,14 @@ diff --git a/src/basic/proc-cmdline.c b/src/basic/proc-cmdline.c
index eea70d8606..ae3abd8402 100644
--- a/src/basic/proc-cmdline.c
+++ b/src/basic/proc-cmdline.c
@@ -15,6 +15,7 @@
 #include "special.h"
@@ -16,6 +16,7 @@
 #include "string-util.h"
 #include "strv.h"
 #include "virt.h"
+#include "missing_stdlib.h"
 
 int proc_cmdline(char **ret) {
         const char *e;
 int proc_cmdline_filter_pid1_args(char **argv, char ***ret) {
         enum {
diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c
index bcba5a5208..64a95dd866 100644
--- a/src/basic/procfs-util.c


@@ 238,7 239,7 @@ diff --git a/src/basic/time-util.c b/src/basic/time-util.c
index b700f364ef..48a26bcec9 100644
--- a/src/basic/time-util.c
+++ b/src/basic/time-util.c
@@ -26,6 +26,7 @@
@@ -27,6 +27,7 @@
 #include "string-util.h"
 #include "strv.h"
 #include "time-util.h"


@@ 262,7 263,7 @@ diff --git a/src/core/dbus-cgroup.c b/src/core/dbus-cgroup.c
index b5484eda78..54ed62c790 100644
--- a/src/core/dbus-cgroup.c
+++ b/src/core/dbus-cgroup.c
@@ -21,6 +21,7 @@
@@ -23,6 +23,7 @@
 #include "parse-util.h"
 #include "path-util.h"
 #include "percent-util.h"


@@ 274,7 275,7 @@ diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c
index f514b8fd12..4febd0d496 100644
--- a/src/core/dbus-execute.c
+++ b/src/core/dbus-execute.c
@@ -45,6 +45,7 @@
@@ -48,6 +48,7 @@
 #include "unit-printf.h"
 #include "user-util.h"
 #include "utf8.h"


@@ 298,7 299,7 @@ diff --git a/src/core/execute.c b/src/core/execute.c
index 853e87450f..8ef76de9ab 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -105,6 +105,7 @@
@@ -113,6 +113,7 @@
 #include "unit-serialize.h"
 #include "user-util.h"
 #include "utmp-wtmp.h"


@@ 310,9 311,9 @@ diff --git a/src/core/kmod-setup.c b/src/core/kmod-setup.c
index e843743777..e149807492 100644
--- a/src/core/kmod-setup.c
+++ b/src/core/kmod-setup.c
@@ -12,6 +12,7 @@
 #include "recurse-dir.h"
@@ -13,6 +13,7 @@
 #include "string-util.h"
 #include "strv.h"
 #include "virt.h"
+#include "missing_stdlib.h"
 


@@ 322,7 323,7 @@ diff --git a/src/core/service.c b/src/core/service.c
index 9ad3c3d995..b112d64919 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -42,6 +42,7 @@
@@ -45,6 +45,7 @@
 #include "unit-name.h"
 #include "unit.h"
 #include "utf8.h"


@@ 346,7 347,7 @@ diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-g
index efc553b698..acea922311 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -33,6 +33,7 @@
@@ -37,6 +37,7 @@
 #include "unit-name.h"
 #include "virt.h"
 #include "volatile-util.h"


@@ 358,7 359,7 @@ diff --git a/src/journal-remote/journal-remote-main.c b/src/journal-remote/journ
index 7df264fb53..9463a0e9fb 100644
--- a/src/journal-remote/journal-remote-main.c
+++ b/src/journal-remote/journal-remote-main.c
@@ -25,6 +25,7 @@
@@ -26,6 +26,7 @@
 #include "stat-util.h"
 #include "string-table.h"
 #include "strv.h"


@@ 370,7 371,7 @@ diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index da0fac548e..c1c043e0e0 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -72,6 +72,7 @@
@@ -77,6 +77,7 @@
 #include "unit-name.h"
 #include "user-util.h"
 #include "varlink.h"


@@ 406,7 407,7 @@ diff --git a/src/libsystemd/sd-bus/bus-socket.c b/src/libsystemd/sd-bus/bus-sock
index 64037e4fe0..9b9ce0aaa9 100644
--- a/src/libsystemd/sd-bus/bus-socket.c
+++ b/src/libsystemd/sd-bus/bus-socket.c
@@ -27,6 +27,7 @@
@@ -28,6 +28,7 @@
 #include "string-util.h"
 #include "user-util.h"
 #include "utf8.h"


@@ 418,7 419,7 @@ diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c
index f6a5e4aa06..b36faa79a3 100644
--- a/src/libsystemd/sd-bus/sd-bus.c
+++ b/src/libsystemd/sd-bus/sd-bus.c
@@ -44,6 +44,7 @@
@@ -46,6 +46,7 @@
 #include "string-util.h"
 #include "strv.h"
 #include "user-util.h"


@@ 442,10 443,10 @@ diff --git a/src/libsystemd/sd-journal/sd-journal.c b/src/libsystemd/sd-journal/
index 9947947ef2..8dc6f93159 100644
--- a/src/libsystemd/sd-journal/sd-journal.c
+++ b/src/libsystemd/sd-journal/sd-journal.c
@@ -41,6 +41,7 @@
 #include "string-util.h"
@@ -44,6 +44,7 @@
 #include "strv.h"
 #include "syslog-util.h"
 #include "uid-alloc-range.h"
+#include "missing_stdlib.h"
 
 #define JOURNAL_FILES_RECHECK_USEC (2 * USEC_PER_SEC)


@@ 454,7 455,7 @@ diff --git a/src/login/pam_systemd.c b/src/login/pam_systemd.c
index ba2fca32c6..e1f9caa13b 100644
--- a/src/login/pam_systemd.c
+++ b/src/login/pam_systemd.c
@@ -32,6 +32,7 @@
@@ -34,6 +34,7 @@
 #include "locale-util.h"
 #include "login-util.h"
 #include "macro.h"


@@ 466,7 467,7 @@ diff --git a/src/network/generator/network-generator.c b/src/network/generator/n
index 1090934bfc..69a77f66e2 100644
--- a/src/network/generator/network-generator.c
+++ b/src/network/generator/network-generator.c
@@ -13,6 +13,7 @@
@@ -14,6 +14,7 @@
 #include "string-table.h"
 #include "string-util.h"
 #include "strv.h"


@@ 502,7 503,7 @@ diff --git a/src/portable/portable.c b/src/portable/portable.c
index 7811833fac..c6414da91c 100644
--- a/src/portable/portable.c
+++ b/src/portable/portable.c
@@ -39,6 +39,7 @@
@@ -40,6 +40,7 @@
 #include "strv.h"
 #include "tmpfile-util.h"
 #include "user-util.h"


@@ 550,7 551,7 @@ diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c
index 1e95e36678..640ee031d5 100644
--- a/src/shared/bus-unit-util.c
+++ b/src/shared/bus-unit-util.c
@@ -50,6 +50,7 @@
@@ -51,6 +51,7 @@
 #include "unit-def.h"
 #include "user-util.h"
 #include "utf8.h"


@@ 562,7 563,7 @@ diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c
index d09ec5148d..f38a8f7cc1 100644
--- a/src/shared/bus-util.c
+++ b/src/shared/bus-util.c
@@ -21,6 +21,7 @@
@@ -24,6 +24,7 @@
 #include "path-util.h"
 #include "socket-util.h"
 #include "stdio-util.h"


@@ 586,9 587,9 @@ diff --git a/src/shared/journal-importer.c b/src/shared/journal-importer.c
index d9eabec886..534c6cf7e3 100644
--- a/src/shared/journal-importer.c
+++ b/src/shared/journal-importer.c
@@ -15,6 +15,7 @@
 #include "parse-util.h"
@@ -16,6 +16,7 @@
 #include "string-util.h"
 #include "strv.h"
 #include "unaligned.h"
+#include "missing_stdlib.h"
 


@@ 622,7 623,7 @@ diff --git a/src/socket-proxy/socket-proxyd.c b/src/socket-proxy/socket-proxyd.c
index 821049e667..08a5bdae3d 100644
--- a/src/socket-proxy/socket-proxyd.c
+++ b/src/socket-proxy/socket-proxyd.c
@@ -26,6 +26,7 @@
@@ -27,6 +27,7 @@
 #include "set.h"
 #include "socket-util.h"
 #include "string-util.h"


@@ 646,7 647,7 @@ diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c
index 8e4d57ee72..6b4555b4d5 100644
--- a/src/udev/udev-builtin-path_id.c
+++ b/src/udev/udev-builtin-path_id.c
@@ -22,6 +22,7 @@
@@ -24,6 +24,7 @@
 #include "sysexits.h"
 #include "udev-builtin.h"
 #include "udev-util.h"


@@ 670,13 671,13 @@ diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index 5bd09a64d1..0ce79f815c 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -34,6 +34,7 @@
@@ -35,6 +35,7 @@
 #include "udev-util.h"
 #include "user-util.h"
 #include "virt.h"
+#include "missing_stdlib.h"
 
 #define RULES_DIRS (const char* const*) CONF_PATHS_STRV("udev/rules.d")
 #define RULES_DIRS ((const char* const*) CONF_PATHS_STRV("udev/rules.d"))
 
-- 
2.39.2

M systemd/0012-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch => systemd/0012-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch +2 -2
@@ 130,7 130,7 @@ index 458aed7054..2cf24b38c0 100644
 /* 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
@@ -2194,7 +2200,9 @@ finish:
@@ -2355,7 +2361,9 @@ finish:
 
 static int glob_item(Item *i, action_t action) {
         _cleanup_globfree_ glob_t g = {


@@ 140,7 140,7 @@ index 458aed7054..2cf24b38c0 100644
         };
         int r = 0, k;
 
@@ -2214,7 +2222,9 @@ static int glob_item(Item *i, action_t action) {
@@ -2375,7 +2383,9 @@ static int glob_item(Item *i, action_t action) {
 
 static int glob_item_recursively(Item *i, fdaction_t action) {
         _cleanup_globfree_ glob_t g = {

M systemd/0014-Use-uintmax_t-for-handling-rlim_t.patch => systemd/0014-Use-uintmax_t-for-handling-rlim_t.patch +1 -1
@@ 89,7 89,7 @@ diff --git a/src/core/execute.c b/src/core/execute.c
index 8ef76de9ab..ea1c203e43 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -6034,9 +6034,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
@@ -6667,9 +6667,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) {
         for (unsigned i = 0; i < RLIM_NLIMITS; i++)
                 if (c->rlimit[i]) {
                         fprintf(f, "%sLimit%s: " RLIM_FMT "\n",

M systemd/0018-Do-not-disable-buffering-when-writing-to-oom_score_a.patch => systemd/0018-Do-not-disable-buffering-when-writing-to-oom_score_a.patch +1 -1
@@ 27,7 27,7 @@ diff --git a/src/basic/process-util.c b/src/basic/process-util.c
index 0747c14c1c..8d0c5aae92 100644
--- a/src/basic/process-util.c
+++ b/src/basic/process-util.c
@@ -1405,7 +1405,7 @@ int set_oom_score_adjust(int value) {
@@ -1516,7 +1516,7 @@ int set_oom_score_adjust(int value) {
         xsprintf(t, "%i", value);
 
         return write_string_file("/proc/self/oom_score_adj", t,

M systemd/0019-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch => systemd/0019-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch +1 -1
@@ 58,7 58,7 @@ diff --git a/src/libsystemd/sd-journal/journal-send.c b/src/libsystemd/sd-journa
index 136ebcb153..8a75ba4ecd 100644
--- a/src/libsystemd/sd-journal/journal-send.c
+++ b/src/libsystemd/sd-journal/journal-send.c
@@ -381,7 +381,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
@@ -360,7 +360,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove
                 char* j;
 
                 errno = 0;

M systemd/0021-do-not-disable-buffer-in-writing-files.patch => systemd/0021-do-not-disable-buffer-in-writing-files.patch +67 -75
@@ 18,34 18,35 @@ Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
[rebased for systemd 243]
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
[rebased for systemd 254]
---
 src/basic/cgroup-util.c                 | 12 ++++++------
 src/basic/namespace-util.c              |  4 ++--
 src/basic/procfs-util.c                 |  4 ++--
 src/basic/sysctl-util.c                 |  2 +-
 src/binfmt/binfmt.c                     |  6 +++---
 src/core/cgroup.c                       |  2 +-
 src/core/main.c                         |  2 +-
 src/core/smack-setup.c                  |  8 ++++----
 src/hibernate-resume/hibernate-resume.c |  2 +-
 src/home/homework.c                     |  2 +-
 src/libsystemd/sd-device/sd-device.c    |  2 +-
 src/nspawn/nspawn-cgroup.c              |  2 +-
 src/nspawn/nspawn.c                     |  6 +++---
 src/shared/binfmt-util.c                |  2 +-
 src/shared/cgroup-setup.c               |  4 ++--
 src/shared/coredump-util.c              |  2 +-
 src/shared/smack-util.c                 |  2 +-
 src/sleep/sleep.c                       |  8 ++++----
 src/udev/udev-rules.c                   |  1 -
 src/vconsole/vconsole-setup.c           |  2 +-
 20 files changed, 37 insertions(+), 38 deletions(-)
 src/basic/cgroup-util.c              | 12 ++++++------
 src/basic/namespace-util.c           |  4 ++--
 src/basic/procfs-util.c              |  4 ++--
 src/basic/sysctl-util.c              |  2 +-
 src/binfmt/binfmt.c                  |  6 +++---
 src/core/cgroup.c                    |  2 +-
 src/core/main.c                      |  2 +-
 src/core/smack-setup.c               |  8 ++++----
 src/home/homework.c                  |  2 +-
 src/libsystemd/sd-device/sd-device.c |  2 +-
 src/nspawn/nspawn-cgroup.c           |  2 +-
 src/nspawn/nspawn.c                  |  6 +++---
 src/shared/binfmt-util.c             |  2 +-
 src/shared/cgroup-setup.c            |  4 ++--
 src/shared/coredump-util.c           |  2 +-
 src/shared/sleep-util.c              |  4 ++--
 src/shared/smack-util.c              |  2 +-
 src/sleep/sleep.c                    |  4 ++--
 src/udev/udev-rules.c                |  1 -
 src/vconsole/vconsole-setup.c        |  2 +-
 20 files changed, 36 insertions(+), 37 deletions(-)

diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c
index 11b4375ed5..7d81a6007f 100644
--- a/src/basic/cgroup-util.c
+++ b/src/basic/cgroup-util.c
@@ -399,7 +399,7 @@ int cg_kill_kernel_sigkill(const char *controller, const char *path) {
@@ -400,7 +400,7 @@ int cg_kill_kernel_sigkill(const char *controller, const char *path) {
         if (r < 0)
                 return r;
 


@@ 54,7 55,7 @@ index 11b4375ed5..7d81a6007f 100644
         if (r < 0)
                 return r;
 
@@ -805,7 +805,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
@@ -806,7 +806,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
 
         sc = strstrip(contents);
         if (isempty(sc)) {


@@ 63,7 64,7 @@ index 11b4375ed5..7d81a6007f 100644
                 if (r < 0)
                         return r;
         } else if (!path_equal(sc, agent))
@@ -823,7 +823,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
@@ -824,7 +824,7 @@ int cg_install_release_agent(const char *controller, const char *agent) {
 
         sc = strstrip(contents);
         if (streq(sc, "0")) {


@@ 72,7 73,7 @@ index 11b4375ed5..7d81a6007f 100644
                 if (r < 0)
                         return r;
 
@@ -850,7 +850,7 @@ int cg_uninstall_release_agent(const char *controller) {
@@ -851,7 +851,7 @@ int cg_uninstall_release_agent(const char *controller) {
         if (r < 0)
                 return r;
 


@@ 81,7 82,7 @@ index 11b4375ed5..7d81a6007f 100644
         if (r < 0)
                 return r;
 
@@ -860,7 +860,7 @@ int cg_uninstall_release_agent(const char *controller) {
@@ -861,7 +861,7 @@ int cg_uninstall_release_agent(const char *controller) {
         if (r < 0)
                 return r;
 


@@ 90,7 91,7 @@ index 11b4375ed5..7d81a6007f 100644
         if (r < 0)
                 return r;
 
@@ -1752,7 +1752,7 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri
@@ -1764,7 +1764,7 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri
         if (r < 0)
                 return r;
 


@@ 103,7 104,7 @@ diff --git a/src/basic/namespace-util.c b/src/basic/namespace-util.c
index f5c0e04cec..272b920022 100644
--- a/src/basic/namespace-util.c
+++ b/src/basic/namespace-util.c
@@ -220,12 +220,12 @@ int userns_acquire(const char *uid_map, const char *gid_map) {
@@ -227,12 +227,12 @@ int userns_acquire(const char *uid_map, const char *gid_map) {
                 freeze();
 
         xsprintf(path, "/proc/" PID_FMT "/uid_map", pid);


@@ 186,7 187,7 @@ diff --git a/src/core/cgroup.c b/src/core/cgroup.c
index 4cac3f6a89..bebe2cd120 100644
--- a/src/core/cgroup.c
+++ b/src/core/cgroup.c
@@ -4267,7 +4267,7 @@ int unit_cgroup_freezer_action(Unit *u, FreezerAction action) {
@@ -4349,7 +4349,7 @@ int unit_cgroup_freezer_action(Unit *u, FreezerAction action) {
                         u->freezer_state = FREEZER_THAWING;
         }
 


@@ 199,7 200,7 @@ diff --git a/src/core/main.c b/src/core/main.c
index c0b8126d96..fe676320ba 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1716,7 +1716,7 @@ static void initialize_core_pattern(bool skip_setup) {
@@ -1737,7 +1737,7 @@ static void initialize_core_pattern(bool skip_setup) {
         if (getpid_cached() != 1)
                 return;
 


@@ 234,19 235,6 @@ index bcaa237c8d..4032bde19e 100644
         if (r < 0)
                 log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m");
 #endif
diff --git a/src/hibernate-resume/hibernate-resume.c b/src/hibernate-resume/hibernate-resume.c
index 9a9df5d22f..75ddec881a 100644
--- a/src/hibernate-resume/hibernate-resume.c
+++ b/src/hibernate-resume/hibernate-resume.c
@@ -40,7 +40,7 @@ int main(int argc, char *argv[]) {
                 return EXIT_FAILURE;
         }
 
-        r = write_string_file("/sys/power/resume", FORMAT_DEVNUM(st.st_rdev), WRITE_STRING_FILE_DISABLE_BUFFER);
+        r = write_string_file("/sys/power/resume", FORMAT_DEVNUM(st.st_rdev), 0);
         if (r < 0) {
                 log_error_errno(r, "Failed to write '" DEVNUM_FORMAT_STR "' to /sys/power/resume: %m", DEVNUM_FORMAT_VAL(st.st_rdev));
                 return EXIT_FAILURE;
diff --git a/src/home/homework.c b/src/home/homework.c
index 28907386a4..f9e45349a7 100644
--- a/src/home/homework.c


@@ 264,7 252,7 @@ diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-
index 8c65ee3469..153edab081 100644
--- a/src/libsystemd/sd-device/sd-device.c
+++ b/src/libsystemd/sd-device/sd-device.c
@@ -2481,7 +2481,7 @@ _public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr,
@@ -2515,7 +2515,7 @@ _public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr,
         if (!value)
                 return -ENOMEM;
 


@@ 290,7 278,7 @@ diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 36d336dfc8..8c5c69596b 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -2771,7 +2771,7 @@ static int reset_audit_loginuid(void) {
@@ -2774,7 +2774,7 @@ static int reset_audit_loginuid(void) {
         if (streq(p, "4294967295"))
                 return 0;
 


@@ 299,7 287,7 @@ index 36d336dfc8..8c5c69596b 100644
         if (r < 0) {
                 log_error_errno(r,
                                 "Failed to reset audit login UID. This probably means that your kernel is too\n"
@@ -4211,7 +4211,7 @@ static int setup_uid_map(
@@ -4214,7 +4214,7 @@ static int setup_uid_map(
                 return log_oom();
 
         xsprintf(uid_map, "/proc/" PID_FMT "/uid_map", pid);


@@ 308,7 296,7 @@ index 36d336dfc8..8c5c69596b 100644
         if (r < 0)
                 return log_error_errno(r, "Failed to write UID map: %m");
 
@@ -4221,7 +4221,7 @@ static int setup_uid_map(
@@ -4224,7 +4224,7 @@ static int setup_uid_map(
                 return log_oom();
 
         xsprintf(uid_map, "/proc/" PID_FMT "/gid_map", pid);


@@ 334,7 322,7 @@ diff --git a/src/shared/cgroup-setup.c b/src/shared/cgroup-setup.c
index 2ea83f05d3..8626bb184c 100644
--- a/src/shared/cgroup-setup.c
+++ b/src/shared/cgroup-setup.c
@@ -350,7 +350,7 @@ int cg_attach(const char *controller, const char *path, pid_t pid) {
@@ -351,7 +351,7 @@ int cg_attach(const char *controller, const char *path, pid_t pid) {
 
         xsprintf(c, PID_FMT "\n", pid);
 


@@ 343,7 331,7 @@ index 2ea83f05d3..8626bb184c 100644
         if (r == -EOPNOTSUPP && cg_is_threaded(controller, path) > 0)
                 /* When the threaded mode is used, we cannot read/write the file. Let's return recognizable error. */
                 return -EUCLEAN;
@@ -887,7 +887,7 @@ int cg_enable_everywhere(
@@ -964,7 +964,7 @@ int cg_enable_everywhere(
                                         return log_debug_errno(errno, "Failed to open cgroup.subtree_control file of %s: %m", p);
                         }
 


@@ 356,8 344,8 @@ diff --git a/src/shared/coredump-util.c b/src/shared/coredump-util.c
index 3d2f179049..c1b6c170ac 100644
--- a/src/shared/coredump-util.c
+++ b/src/shared/coredump-util.c
@@ -71,7 +71,7 @@ int set_coredump_filter(uint64_t value) {
         sprintf(t, "0x%"PRIx64, value);
@@ -163,7 +163,7 @@ int set_coredump_filter(uint64_t value) {
         xsprintf(t, "0x%"PRIx64, value);
 
         return write_string_file("/proc/self/coredump_filter", t,
-                                 WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_DISABLE_BUFFER);


@@ 365,11 353,33 @@ index 3d2f179049..c1b6c170ac 100644
 }
 
 /* Turn off core dumps but only if we're running outside of a container. */
diff --git a/src/shared/sleep-util.c b/src/shared/sleep-util.c
index d7277399fb..d06d636fcc 100644
--- a/src/shared/sleep-util.c
+++ b/src/shared/sleep-util.c
@@ -1044,7 +1044,7 @@ int write_resume_config(dev_t devno, uint64_t offset, const char *device) {
 
         /* We write the offset first since it's safer. Note that this file is only available in 4.17+, so
          * fail gracefully if it doesn't exist and we're only overwriting it with 0. */
-        r = write_string_file("/sys/power/resume_offset", offset_str, WRITE_STRING_FILE_DISABLE_BUFFER);
+        r = write_string_file("/sys/power/resume_offset", offset_str, 0);
         if (r == -ENOENT) {
                 if (offset != 0)
                         return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
@@ -1060,7 +1060,7 @@ int write_resume_config(dev_t devno, uint64_t offset, const char *device) {
                 log_debug("Wrote resume_offset=%s for device '%s' to /sys/power/resume_offset.",
                           offset_str, device);
 
-        r = write_string_file("/sys/power/resume", devno_str, WRITE_STRING_FILE_DISABLE_BUFFER);
+        r = write_string_file("/sys/power/resume", devno_str, 0);
         if (r < 0)
                 return log_error_errno(r,
                                        "Failed to write device '%s' (%s) to /sys/power/resume: %m",
diff --git a/src/shared/smack-util.c b/src/shared/smack-util.c
index b3b5c905ad..bbfa1973fd 100644
--- a/src/shared/smack-util.c
+++ b/src/shared/smack-util.c
@@ -115,7 +115,7 @@ int mac_smack_apply_pid(pid_t pid, const char *label) {
@@ -113,7 +113,7 @@ int mac_smack_apply_pid(pid_t pid, const char *label) {
                 return 0;
 
         p = procfs_file_alloca(pid, "attr/current");


@@ 382,25 392,7 @@ diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c
index 765dd4974f..cd6afb001b 100644
--- a/src/sleep/sleep.c
+++ b/src/sleep/sleep.c
@@ -50,7 +50,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, 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);
@@ -77,7 +77,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, 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);
@@ -93,7 +93,7 @@ static int write_mode(char **modes) {
@@ -139,7 +139,7 @@ static int write_mode(char **modes) {
         STRV_FOREACH(mode, modes) {
                 int k;
 


@@ 409,7 401,7 @@ index 765dd4974f..cd6afb001b 100644
                 if (k >= 0)
                         return 0;
 
@@ -114,7 +114,7 @@ static int write_state(FILE **f, char **states) {
@@ -160,7 +160,7 @@ static int write_state(FILE **f, char **states) {
         STRV_FOREACH(state, states) {
                 int k;
 


@@ 422,8 414,8 @@ diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index 0ce79f815c..28aab475d0 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -2357,7 +2357,6 @@ static int udev_rule_apply_token_to_event(
                 log_rule_debug(dev, rules, "ATTR '%s' writing '%s'", buf, value);
@@ -2634,7 +2634,6 @@ static int udev_rule_apply_token_to_event(
                 log_event_debug(dev, token, "ATTR '%s' writing '%s'", buf, value);
                 r = write_string_file(buf, value,
                                       WRITE_STRING_FILE_VERIFY_ON_FAILURE |
-                                      WRITE_STRING_FILE_DISABLE_BUFFER |


@@ 434,7 426,7 @@ diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
index 7d3e9db73f..2d4a0c4c9d 100644
--- a/src/vconsole/vconsole-setup.c
+++ b/src/vconsole/vconsole-setup.c
@@ -108,7 +108,7 @@ static int toggle_utf8_vc(const char *name, int fd, bool utf8) {
@@ -259,7 +259,7 @@ static int toggle_utf8_vc(const char *name, int fd, bool utf8) {
 static int toggle_utf8_sysfs(bool utf8) {
         int r;
 

M systemd/0022-Handle-__cpu_mask-usage.patch => systemd/0022-Handle-__cpu_mask-usage.patch +2 -2
@@ 46,8 46,8 @@ index 6cf92bffde..937d26ca55 100644
-#include <sched.h>
 #include <stdio.h>
 #include <string.h>
 #include <sys/types.h>
@@ -10,6 +9,7 @@
 #include <sys/resource.h>
@@ -11,6 +10,7 @@
 #include <float.h>
 
 #include "time-util.h"

M systemd/0023-Handle-missing-gshadow.patch => systemd/0023-Handle-missing-gshadow.patch +14 -14
@@ 20,7 20,7 @@ diff --git a/src/shared/user-record-nss.c b/src/shared/user-record-nss.c
index 88b8fc2f8f..a819d41bac 100644
--- a/src/shared/user-record-nss.c
+++ b/src/shared/user-record-nss.c
@@ -331,8 +331,10 @@ int nss_group_to_group_record(
@@ -329,8 +329,10 @@ int nss_group_to_group_record(
         if (isempty(grp->gr_name))
                 return -EINVAL;
 


@@ 31,7 31,7 @@ index 88b8fc2f8f..a819d41bac 100644
 
         g = group_record_new();
         if (!g)
@@ -348,6 +350,7 @@ int nss_group_to_group_record(
@@ -346,6 +348,7 @@ int nss_group_to_group_record(
 
         g->gid = grp->gr_gid;
 


@@ 39,7 39,7 @@ index 88b8fc2f8f..a819d41bac 100644
         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(
@@ -361,6 +364,7 @@ int nss_group_to_group_record(
                 if (r < 0)
                         return r;
         }


@@ 47,7 47,7 @@ index 88b8fc2f8f..a819d41bac 100644
 
         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 group *grp, struct sgrp *ret_sgrp, char **re
@@ -387,6 +391,7 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
         assert(ret_sgrp);
         assert(ret_buffer);
 


@@ 55,7 55,7 @@ index 88b8fc2f8f..a819d41bac 100644
         for (;;) {
                 _cleanup_free_ char *buf = NULL;
                 struct sgrp sgrp, *result;
@@ -416,6 +421,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
@@ -415,6 +420,9 @@ int nss_sgrp_for_group(const struct group *grp, struct sgrp *ret_sgrp, char **re
                 buflen *= 2;
                 buf = mfree(buf);
         }


@@ 65,7 65,7 @@ index 88b8fc2f8f..a819d41bac 100644
 }
 
 int nss_group_record_by_name(
@@ -427,7 +435,9 @@ int nss_group_record_by_name(
@@ -426,7 +434,9 @@ int nss_group_record_by_name(
         struct group grp, *result;
         bool incomplete = false;
         size_t buflen = 4096;


@@ 75,7 75,7 @@ index 88b8fc2f8f..a819d41bac 100644
         int r;
 
         assert(name);
@@ -457,6 +467,7 @@ int nss_group_record_by_name(
@@ -455,6 +465,7 @@ int nss_group_record_by_name(
                 buf = mfree(buf);
         }
 


@@ 83,7 83,7 @@ index 88b8fc2f8f..a819d41bac 100644
         if (with_shadow) {
                 r = nss_sgrp_for_group(result, &sgrp, &sbuf);
                 if (r < 0) {
@@ -468,6 +479,9 @@ int nss_group_record_by_name(
@@ -466,6 +477,9 @@ int nss_group_record_by_name(
                 incomplete = true;
 
         r = nss_group_to_group_record(result, sresult, ret);


@@ 93,7 93,7 @@ index 88b8fc2f8f..a819d41bac 100644
         if (r < 0)
                 return r;
 
@@ -484,7 +498,9 @@ int nss_group_record_by_gid(
@@ -483,7 +497,9 @@ int nss_group_record_by_gid(
         struct group grp, *result;
         bool incomplete = false;
         size_t buflen = 4096;


@@ 102,8 102,8 @@ index 88b8fc2f8f..a819d41bac 100644
+#endif
         int r;
 
         assert(ret);
@@ -512,6 +528,7 @@ int nss_group_record_by_gid(
         for (;;) {
@@ -509,6 +525,7 @@ int nss_group_record_by_gid(
                 buf = mfree(buf);
         }
 


@@ 111,7 111,7 @@ index 88b8fc2f8f..a819d41bac 100644
         if (with_shadow) {
                 r = nss_sgrp_for_group(result, &sgrp, &sbuf);
                 if (r < 0) {
@@ -523,6 +540,9 @@ int nss_group_record_by_gid(
@@ -520,6 +537,9 @@ int nss_group_record_by_gid(
                 incomplete = true;
 
         r = nss_group_to_group_record(result, sresult, ret);


@@ 141,7 141,7 @@ diff --git a/src/shared/userdb.c b/src/shared/userdb.c
index a77eff4407..955e361d3a 100644
--- a/src/shared/userdb.c
+++ b/src/shared/userdb.c
@@ -1044,13 +1044,15 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
@@ -1038,13 +1038,15 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
                 if (gr) {
                         _cleanup_free_ char *buffer = NULL;
                         bool incomplete = false;


@@ 158,7 158,7 @@ index a77eff4407..955e361d3a 100644
                         if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) {
                                 r = nss_sgrp_for_group(gr, &sgrp, &buffer);
                                 if (r < 0) {
@@ -1063,6 +1065,9 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
@@ -1057,6 +1059,9 @@ int groupdb_iterator_get(UserDBIterator *iterator, GroupRecord **ret) {
                         }
 
                         r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret);

A systemd/0025-include-sys-file.h-for-LOCK_EX.patch => systemd/0025-include-sys-file.h-for-LOCK_EX.patch +29 -0
@@ 0,0 1,29 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 2 Aug 2023 10:33:48 -0700
Subject: [PATCH] include sys/file.h for LOCK_EX

Fixes
| ../git/src/basic/user-util.c:708:30: error: use of undeclared identifier 'LOCK_EX'; did you mean 'LOCK_BSD'?
|   708 |         r = unposix_lock(fd, LOCK_EX);
|       |                              ^~~~~~~
|       |                              LOCK_BSD

Upstream-Status: Backport [https://github.com/systemd/systemd/pull/28647]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 src/basic/user-util.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/basic/user-util.c b/src/basic/user-util.c
index fe61a09005..5c39847733 100644
--- a/src/basic/user-util.c
+++ b/src/basic/user-util.c
@@ -6,6 +6,7 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <sys/file.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include <utmp.h>

D systemd/0026-src-boot-efi-efi-string.c-define-wchar_t-from-__WCHA.patch => systemd/0026-src-boot-efi-efi-string.c-define-wchar_t-from-__WCHA.patch +0 -44
@@ 1,44 0,0 @@
From 34072f456b4fe880fbb2f18760b64a1a6c1eebb8 Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex@linutronix.de>
Date: Mon, 6 Mar 2023 15:24:49 +0100
Subject: [PATCH] src/boot/efi/efi-string.c: define wchar_t from __WCHAR_TYPE__

systemd-boot relies on wchar_t being 16 bit, and breaks at build time otherwise.

To set wchar_t to 16 bit it is passing -fshort-wchar to gcc; this has the
desired effect on glibc (which sets wchar_t from __WCHAR_TYPE__) but not on
musl (which hardcodes it to 32 bit).

This patch ensures wchar_t is set from the compiler flags on all systems; note
that systemd-boot is not actually using functions from musl or other libc, just their headers.

Meanwhile upstream has refactored the code to not rely on libc headers at all;
however this will not be backported to v253 and we need a different fix.

Upstream-Status: Inappropriate [fixed differently in trunk according to https://github.com/systemd/systemd/pull/26689]
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 src/boot/efi/efi-string.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/boot/efi/efi-string.c b/src/boot/efi/efi-string.c
index 22923d60f6..5d09d4281f 100644
--- a/src/boot/efi/efi-string.c
+++ b/src/boot/efi/efi-string.c
@@ -2,7 +2,13 @@
 
 #include <stdbool.h>
 #include <stdint.h>
+
+#if SD_BOOT
+typedef __WCHAR_TYPE__ wchar_t;
+#define __DEFINED_wchar_t
+#else
 #include <wchar.h>
+#endif
 
 #include "efi-string.h"
 
-- 
2.39.2


A systemd/0026-test-test-sizeof-Include-sys-timex.h-for-struct-time.patch => systemd/0026-test-test-sizeof-Include-sys-timex.h-for-struct-time.patch +28 -0
@@ 0,0 1,28 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 2 Aug 2023 12:14:56 -0700
Subject: [PATCH] test/test-sizeof: Include sys/timex.h for struct timex

Fixes

../git/src/test/test-sizeof.c:64:41: error: incomplete definition of type 'struct timex'
   64 |         check(typeof(((struct timex *)0)->freq), SIZEOF_TIMEX_MEMBER);
      |                      ~~~~~~~~~~~~~~~~~~~^

Upstream-Status: Backport [https://github.com/systemd/systemd/pull/28651]
---
 src/test/test-sizeof.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c
index 9d969cf8f1..b65c0bd370 100644
--- a/src/test/test-sizeof.c
+++ b/src/test/test-sizeof.c
@@ -4,6 +4,7 @@
 #include <string.h>
 #include <sys/resource.h>
 #include <sys/socket.h>
+#include <sys/timex.h>
 #include <sys/types.h>
 
 #define __STDC_WANT_IEC_60559_TYPES_EXT__

A systemd/0027-include-missing-sys-file.h-for-LOCK_EX.patch => systemd/0027-include-missing-sys-file.h-for-LOCK_EX.patch +98 -0
@@ 0,0 1,98 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 2 Aug 2023 12:18:24 -0700
Subject: [PATCH] include missing sys/file.h for LOCK_EX

Upstream-Status: Backport [https://github.com/systemd/systemd/pull/28651]
---
 src/core/execute.c            | 1 +
 src/shared/btrfs-util.c       | 1 +
 src/shared/copy.c             | 1 +
 src/test/test-btrfs.c         | 1 +
 src/test/test-fs-util.c       | 1 +
 src/test/test-lock-util.c     | 1 +
 src/vconsole/vconsole-setup.c | 1 +
 7 files changed, 7 insertions(+)

diff --git a/src/core/execute.c b/src/core/execute.c
index 5b2ae861ff..2ebf19ffaa 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -4,6 +4,7 @@
 #include <fcntl.h>
 #include <poll.h>
 #include <sys/eventfd.h>
+#include <sys/file.h>
 #include <sys/ioctl.h>
 #include <sys/mman.h>
 #include <sys/mount.h>
diff --git a/src/shared/btrfs-util.c b/src/shared/btrfs-util.c
index 5128b308ab..3ded95ea82 100644
--- a/src/shared/btrfs-util.c
+++ b/src/shared/btrfs-util.c
@@ -10,6 +10,7 @@
 #include <stddef.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <sys/file.h>
 #include <sys/ioctl.h>
 #include <sys/sysmacros.h>
 #include <unistd.h>
diff --git a/src/shared/copy.c b/src/shared/copy.c
index 241a2d112b..7e47dc002c 100644
--- a/src/shared/copy.c
+++ b/src/shared/copy.c
@@ -6,6 +6,7 @@
 #include <stddef.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <sys/file.h>
 #include <sys/ioctl.h>
 #include <sys/sendfile.h>
 #include <sys/xattr.h>
diff --git a/src/test/test-btrfs.c b/src/test/test-btrfs.c
index 95b7ef25d8..ba09563058 100644
--- a/src/test/test-btrfs.c
+++ b/src/test/test-btrfs.c
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include <fcntl.h>
+#include <sys/file.h>
 
 #include "btrfs-util.h"
 #include "fd-util.h"
diff --git a/src/test/test-fs-util.c b/src/test/test-fs-util.c
index 1beba916a4..5de1eea0d4 100644
--- a/src/test/test-fs-util.c
+++ b/src/test/test-fs-util.c
@@ -1,5 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include <sys/file.h>
 #include <unistd.h>
 
 #include "alloc-util.h"
diff --git a/src/test/test-lock-util.c b/src/test/test-lock-util.c
index a9a1b438ff..28fc54a5d6 100644
--- a/src/test/test-lock-util.c
+++ b/src/test/test-lock-util.c
@@ -1,5 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
+#include <sys/file.h>
 #include <unistd.h>
 
 #include "fd-util.h"
diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
index d57d8b4001..86348d08c1 100644
--- a/src/vconsole/vconsole-setup.c
+++ b/src/vconsole/vconsole-setup.c
@@ -11,6 +11,7 @@
 #include <linux/vt.h>
 #include <stdbool.h>
 #include <stdlib.h>
+#include <sys/file.h>
 #include <sys/ioctl.h>
 #include <sysexits.h>
 #include <termios.h>

A systemd/0028-sd-event-Make-malloc_trim-conditional-on-glibc.patch => systemd/0028-sd-event-Make-malloc_trim-conditional-on-glibc.patch +39 -0
@@ 0,0 1,39 @@
From 148645ba8b62f04c7c5ff5907378663f97880f22 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 2 Aug 2023 12:06:27 -0700
Subject: [PATCH 1/4] sd-event: Make malloc_trim() conditional on glibc

musl does not have this API

Upstream-Status: Inappropriate [musl-specific]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 src/libsystemd/sd-event/sd-event.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
index aba458185b..48c94a7672 100644
--- a/src/libsystemd/sd-event/sd-event.c
+++ b/src/libsystemd/sd-event/sd-event.c
@@ -1874,7 +1874,7 @@ _public_ int sd_event_add_exit(
 }

 _public_ int sd_event_trim_memory(void) {
-        int r;
+        int r = 0;

         /* A default implementation of a memory pressure callback. Simply releases our own allocation caches
          * and glibc's. This is automatically used when people call sd_event_add_memory_pressure() with a
@@ -1888,7 +1888,9 @@ _public_ int sd_event_trim_memory(void) {

         usec_t before_timestamp = now(CLOCK_MONOTONIC);
         hashmap_trim_pools();
+#ifdef __GLIBC__
         r = malloc_trim(0);
+#endif
         usec_t after_timestamp = now(CLOCK_MONOTONIC);

         if (r > 0)
--
2.41.0


A systemd/0029-shared-Do-not-use-malloc_info-on-musl.patch => systemd/0029-shared-Do-not-use-malloc_info-on-musl.patch +50 -0
@@ 0,0 1,50 @@
From 9430646e72ea5d260ade300038a6d976fecf7da5 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 2 Aug 2023 12:20:40 -0700
Subject: [PATCH 4/4] shared: Do not use malloc_info on musl

Upstream-Status: Inappropriate [musl-specific]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 src/shared/bus-util.c      | 5 +++--
 src/shared/common-signal.c | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

--- a/src/shared/bus-util.c
+++ b/src/shared/bus-util.c
@@ -617,15 +617,16 @@ static int method_dump_memory_state_by_f
         _cleanup_close_ int fd = -EBADF;
         size_t dump_size;
         FILE *f;
-        int r;
+        int r = 0;
 
         assert(message);
 
         f = memstream_init(&m);
         if (!f)
                 return -ENOMEM;
-
+#ifdef __GLIBC__
         r = RET_NERRNO(malloc_info(/* options= */ 0, f));
+#endif
         if (r < 0)
                 return r;
 
--- a/src/shared/common-signal.c
+++ b/src/shared/common-signal.c
@@ -65,12 +65,12 @@ int sigrtmin18_handler(sd_event_source *
                         log_oom();
                         break;
                 }
-
+#ifdef __GLIBC__
                 if (malloc_info(0, f) < 0) {
                         log_error_errno(errno, "Failed to invoke malloc_info(): %m");
                         break;
                 }
-
+#endif
                 (void) memstream_dump(LOG_INFO, &m);
                 break;
         }

M systemd/0100-Do-not-buffer-on-systemd-sleep.patch => systemd/0100-Do-not-buffer-on-systemd-sleep.patch +0 -18
@@ 1,23 1,5 @@
--- 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;

M systemd/0101-efi-do-not-set-wide-exec-charset.patch => systemd/0101-efi-do-not-set-wide-exec-charset.patch +11 -11
@@ 1,6 1,6 @@
From 8c56b54098d790c061cb85bbe9633d3bf5413e08 Mon Sep 17 00:00:00 2001
From 32665a6195c1e30ece599a21dd8562e38d7d5b35 Mon Sep 17 00:00:00 2001
From: xdavidwu <xdavidwuph@gmail.com>
Date: Thu, 27 Jan 2022 15:44:39 +0800
Date: Sat, 5 Aug 2023 23:21:57 +0800
Subject: [PATCH] efi: do not set wide-exec-charset

setting to UCS2 produces unbootable binary on musl (iconv difference?)


@@ 9,17 9,17 @@ setting to UCS2 produces unbootable binary on musl (iconv difference?)
 1 file changed, 1 deletion(-)

diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build
index e10e51cf4e..4c7a50bddb 100644
index 1c52629..59140cb 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',
         ]
 )
@@ -137,7 +137,6 @@ efi_c_args = [
 ]
 
 efi_c_args += cc.get_supported_arguments(
-        '-fwide-exec-charset=UCS2',
         # gcc docs says this is required for ms_abi to work correctly.
         '-maccumulate-outgoing-args',
         '-mstack-protector-guard=global',
-- 
2.34.1
2.41.0


M systemd/APKBUILD => systemd/APKBUILD +25 -18
@@ 1,8 1,8 @@
# Contributor: xdavidwu <xdavidwuph@gmail.com>
# Maintainer: xdavidwu <xdavidwuph@gmail.com>
pkgname=systemd
pkgver=253.7
pkgrel=1
pkgver=254
pkgrel=0
pkgdesc="System and Service Manager"
url="https://www.github.com/systemd/systemd"
arch="all"


@@ 33,7 33,11 @@ source="$pkgname-$pkgver.tar.gz::https://github.com/systemd/systemd-stable/archi
	0021-do-not-disable-buffer-in-writing-files.patch
	0022-Handle-__cpu_mask-usage.patch
	0023-Handle-missing-gshadow.patch
	0026-src-boot-efi-efi-string.c-define-wchar_t-from-__WCHA.patch
	0025-include-sys-file.h-for-LOCK_EX.patch
	0026-test-test-sizeof-Include-sys-timex.h-for-struct-time.patch
	0027-include-missing-sys-file.h-for-LOCK_EX.patch
	0028-sd-event-Make-malloc_trim-conditional-on-glibc.patch
	0029-shared-Do-not-use-malloc_info-on-musl.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"


@@ 49,7 53,6 @@ build() {
		--localstatedir=/var \
		--buildtype=plain \
		-Defi=true \
		-Dgnu-efi=true \
		-Duserdb=false \
		-Dman=true \
		-Dpolkit=false \


@@ 148,25 151,29 @@ dev() {
}

sha512sums="
6935508f511930d6e980a7f0a3319295acbbc482cbce4f8f407af399259fe04b095dabd470f8825d84328a7d0f39efe6d5926022c1bdf18ec7fffe43b2586aa1  systemd-253.7.tar.gz
2e9567473d6913483074be5b79090c75dfc965a7afa1b617e18780f3a41787b08ffde0d5cfd115b0b01a84a04a8623db004c7ec29e1c0442c94f7817a4616ad4  systemd-254.tar.gz
365360cc6b7591152fd8043eb1173c239b9b0290e4f7f5c52e60213e75997034e1e62d3e03187420e1b5e003881f2d748a5dda18b9e7d13e7c97a2caf942ed8c  0001-Adjust-for-musl-headers.patch
13cf635d49fb0c91c7d2fc672095a836cdad22dff828b49518dcbbb6669d1fdf1f228c525f7d85daa40e8e75a80d64161449ffbf6149fda89f38189a2b7160df  0003-errno-util-Make-STRERROR-portable-for-musl.patch
e27af86219786437f66d9ecfea4996f95608e6d64baf7dcfb3421d40de863abdb2dedc114939b6f05feaec3cb3790c8214f92d5df95ea022d6037fe6d3ff6663  0003-errno-util-Make-STRERROR-portable-for-musl.patch
c7c92dd6e98c0960fb6744b78ef60df1cd33e6ac71cce02146b656c795fc181d8e20609381d0bae07d95716e3eb8bed9aa1185494cfe074cfa2b67fcdf4f4940  0005-pass-correct-parameters-to-getdents64.patch
d6cd00693af5c905ab17764e45825eb5a8c23f727b9296efa0603207f48debe6f4a376681517d7558c7ec8c75ea6dd7b436637106e0d06d103dc289d6ddbdd33  0006-test-bus-error-strerror-is-assumed-to-be-GNU-specifi.patch
6772fcf6daab52ae0d236dba5b01ef56b248b5788d8164e74976db87ad4d1ba4d45d82163038b4a0e0e2b753f1c33d3b897309948e3d899ff21d6603a1921e3b  0007-Add-sys-stat.h-for-S_IFDIR.patch
548b77c617eafa0b9b64173b814e6d2304049ab31dc8ee64e3c5a0526ecf2c5e860b774d62de3c09afd6a59ebf99ea8ca279a767f4f2cd9cf4c6f83c0da312ef  0009-missing_type.h-add-comparison_fn_t.patch
4a7cffce1d15a60c92d7413afba874277a02424e4c55e193cfc2a602881e6df8f9f75ef74351202f13e681b3d8a93068d0b7f1cb742fe98bc9d7e5404121ef99  0010-add-fallback-parse_printf_format-implementation.patch
18d7e55eb61b1ee3a1815016abb6efaa964ad71ca97c6787b3dd2c5871fdd1f4195b4759122963779d71b23ef3923158c9b5d995cc45a74023eefcb006d5e876  0011-src-basic-missing.h-check-for-missing-strndupa.patch
cd762512c9b780b6c92407202f375027586f925dae608ac820727f0ef837d9b15fd236f714635fb6b4eca9a6ccac4f5fc0357769179dddcd6d3f86bf580968bc  0012-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch
855c7ba93262cd7ec416a990f360cab9d23cfe84618f2fcab426d4d69c90cf5174baabf0670818ef4ef3d9c4dcc10ad772f0f701e1bbab160552dd21eae826c2  0010-add-fallback-parse_printf_format-implementation.patch
2786d086c270781a7584c0239a15e00a2b05f2f3ecbac199881dca7086264dd292afb232b75775a38f5fde0db4841f68ce8d4eab26de796369fd4301e6b65eb0  0011-src-basic-missing.h-check-for-missing-strndupa.patch
4edce319024d49237ccfc34156a3bc1015b4926c52e2117fb13aa1ab8428adde22b60e9016dbd4e59072ff51ace0e29e9db322541735975c26b386c37a2ac8a5  0012-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch
2cec9f3e7fe5046862a769281e271b341a5e8a856f3aed982222c63ee20e1640b70a27a1b0d669d5e2fe7a5b8ec72d5b1a8fc77bd124690fa58cf5264cae7f57  0013-add-missing-FTW_-macros-for-musl.patch
cfbad07007889860fa3e11580ca4265cb7b2898b83367eba103c4ec1df62148a0fbcfc2a8cf48428b26db9fd51f051bb82c1f212593e1aee230410ed62aa4fd3  0014-Use-uintmax_t-for-handling-rlim_t.patch
d8c54ea44440ba7723e26569e29ab2a36c5d2b57f21971a01d31d1cd76d27bd0968abdd1665d2427d59c6a1c130f74f53a15a5ba2b31383414b88d526d397fdf  0018-Do-not-disable-buffering-when-writing-to-oom_score_a.patch
e035b7b578431c7bbf4ab818066b7f950ffb2de706213150cb74a337d607a745f94dd229047e1f4c10a46f943dd198e4358e60c6df03131d46af3a9f2f477551  0019-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch
51a87daf5e379cdcf9d9c49b445b280883db67d2b5060f165bb245829088d4555e07ce932a4a0a2b398ed665dd1ff455e48a759c84f1fd248d9a3bac8813b142  0014-Use-uintmax_t-for-handling-rlim_t.patch
29bcb246489c4cabca3dab91fa8720227e8489363868ebb777f864b278a83fab1c66564b51bfc7417096e347f5e85920500649fa3a212f58af2529318230b28f  0018-Do-not-disable-buffering-when-writing-to-oom_score_a.patch
088b2fecf8dc9ab7e1806a6f9bbcaca729b2edd9d095fe8ee1390359c856167519229ce7fa9aae9376bff7cc09a612d015ef42499bbcd60bc13ed950d3158907  0019-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch
6d6bb36c5d600653284ebdd1e0417e3e4e6b00e4e8b9d79fa58ceb6cf980e5d3def49a6a2d6493470220cf01708f7fa60c7cdc07b768aca312cbd401e9ff54fb  0020-avoid-redefinition-of-prctl_mm_map-structure.patch
512d402e72c27105901d3e4fbb1fa6ef766814392d85e066c04a4bc8d877a41f883dda2a43165bc121d67c34fd1818ead533207043150383a29bdee44f4efa67  0021-do-not-disable-buffer-in-writing-files.patch
580b691581454dd93f46871512dfb9c26616ef07b290465b52a782b4f2df7211706f8833e64a7efc1274088a8b030eb70ddadd53ccab7e1bb4848955907d0cbf  0022-Handle-__cpu_mask-usage.patch
ec85ce18d9eda9152aa50189aff9e967a9763124558bc7fa4dbb11ab8845cb6802d7a8fe39b438ee983e1a172759ea7dffb38a81521b550f889d08dec2d8cead  0023-Handle-missing-gshadow.patch
57cbca6d78c0d301e62ac91c7792e50a22d8af5ce213505322bded7d09a6210d2d0e804f04113d886820f472be82e91d99e62c086addd869fd0b200e39801419  0026-src-boot-efi-efi-string.c-define-wchar_t-from-__WCHA.patch
aeca4851d4cef2439eca2519dd031a842d7699782edee06239ca66f157711faf16c2943b310963faaf06d3b8c02bb0390b900ea8900c88e5ecbfc000f7929ab6  0100-Do-not-buffer-on-systemd-sleep.patch
daf52c1f16fc29688e45d9bdbc67dff93bb606da3ef95963e3bcbf79690527e6704b8dffc50886342dc213154a62650ee70533dd70e58d6fd6238c17d8aa6e43  0101-efi-do-not-set-wide-exec-charset.patch
b9f2e50da7c6328bbaa547e2ab4bc4bbcc210bd8157b3c828fd252abbbf5b44fd5cd173b6ec3f5cc17371c532fa67809e16d677dbc895e22609765efb5c5ec3a  0021-do-not-disable-buffer-in-writing-files.patch
b25970c4bbe715b44cacc684c3d1efa9f50cf23df6ef7a365b072e1de62b69c23f5db341bee193b0367eda86cd3b288bdec55d9f4ff748d54c39992be4d567df  0022-Handle-__cpu_mask-usage.patch
987318b986efa081627fce402262484fac6e792d55ede8dade88336a0e91c0aa3fcbae9951614407879f8dc5015e71c706a78242889ffeea70081c14d0395bb8  0023-Handle-missing-gshadow.patch
4a011879e78cba8962cb238df064eb03f8007a1c97345fb24e1b01a149a715ce0c7c16c27752d412ae737b7054e99033bf7bad099391f5366fbd4d1f04d2fa74  0025-include-sys-file.h-for-LOCK_EX.patch
462febd7b76f8959fe93518860d7ed90a49f0eb279de1cb3d8b6cc98598f0e8c962ecdb9447753fb8a0476775fb2ed460e462f9b3c0e93738b357c03c48259f2  0026-test-test-sizeof-Include-sys-timex.h-for-struct-time.patch
00eef49f259c4c1a78c6177707ba4464229690c749d580aa96972e2c71a9bc67ea416eadf0c77ec7b8c1e92cdbe04fceadbd3fe9fa5be7d886403d3a1a6cfefe  0027-include-missing-sys-file.h-for-LOCK_EX.patch
d4a5c506dc2378033a4fc15eba510e8cf8bc5642000758dd1b05526ccac8a4ce47c23297e301ec99bdf4a19ce9f84a008b4714cc9e655a596d1aa58de47f683b  0028-sd-event-Make-malloc_trim-conditional-on-glibc.patch
fcee3a9384cb27083b82792a246045b1d1d974ee200fd772661766e9445ea36d8c0c9003527783f2a7958107261ec7fa1b0e0a30200b3e2d0f2ea51657bba166  0029-shared-Do-not-use-malloc_info-on-musl.patch
9737f2d261fca96f0038489e0d3b166de015a76aa8738413afa8a44da6ebb6c9cf55f4642b9b2ddd9000f76880dc9b2b077ac655597b11cdb79ccfb0196190bd  0100-Do-not-buffer-on-systemd-sleep.patch
4ea51f1b47140ee79d738fa983c42402ed0bb4c5ae79880fd30555c7571b5e0a4e7e86457be987bfdf0da928a1111a54709ed54a6676305e5036920347adb5cd  0101-efi-do-not-set-wide-exec-charset.patch
"