diff options
Diffstat (limited to 'meta/recipes-core/systemd/systemd')
56 files changed, 3083 insertions, 1466 deletions
diff --git a/meta/recipes-core/systemd/systemd/0001-Fix-to-run-efi_cc-and-efi_ld-correctly-when-cross-co.patch b/meta/recipes-core/systemd/systemd/0001-Fix-to-run-efi_cc-and-efi_ld-correctly-when-cross-co.patch new file mode 100644 index 0000000000..e2e19ba068 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0001-Fix-to-run-efi_cc-and-efi_ld-correctly-when-cross-co.patch @@ -0,0 +1,62 @@ +From 527413ec243564a89ffaad6368d446de44415970 Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Tue, 27 Feb 2018 21:42:23 -0800 +Subject: [PATCH] Fix to run efi_cc and efi_ld correctly when cross-compiling + +When cross-compiling, efi_cc and efi_ld may take the form of +'xxx-gcc --sysroot=xxx', and this would cause run_command and +the alike fail. + +Fix to split them to make commands run correctly. + +Upstream-Status: Pending + +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +--- + src/boot/efi/meson.build | 16 +++++++++++++--- + 1 file changed, 13 insertions(+), 3 deletions(-) + +diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build +index 992a3ba4c..9f9ec4911 100644 +--- a/src/boot/efi/meson.build ++++ b/src/boot/efi/meson.build +@@ -157,7 +157,7 @@ if have_gnu_efi + o_file = custom_target(file + '.o', + input : file, + output : file + '.o', +- command : [efi_cc, '-c', '@INPUT@', '-o', '@OUTPUT@'] ++ command : efi_cc.split() + ['-c', '@INPUT@', '-o', '@OUTPUT@'] + + compile_args, + depend_files : efi_headers) + if (common_sources + systemd_boot_sources).contains(file) +@@ -168,7 +168,17 @@ if have_gnu_efi + endif + endforeach + +- libgcc_file_name = run_command(efi_cc, '-print-libgcc-file-name').stdout().strip() ++ find_libgcc_cmd_all = efi_cc + ' -print-libgcc-file-name' ++ find_libgcc_cmd = find_libgcc_cmd_all.split()[0] ++ find_libgcc_args = [] ++ cmd_args_all = find_libgcc_cmd_all.split() ++ foreach arg : cmd_args_all ++ if arg != find_libgcc_cmd ++ find_libgcc_args += arg ++ endif ++ endforeach ++ ++ libgcc_file_name = run_command(find_libgcc_cmd, find_libgcc_args).stdout().strip() + systemd_boot_efi_name = 'systemd-boot@0@.efi'.format(EFI_MACHINE_TYPE_NAME) + stub_efi_name = 'linux@0@.efi.stub'.format(EFI_MACHINE_TYPE_NAME) + no_undefined_symbols = find_program('no-undefined-symbols.sh') +@@ -179,7 +189,7 @@ if have_gnu_efi + tuple[0], + input : tuple[2], + output : tuple[0], +- command : [efi_ld, '-o', '@OUTPUT@'] + ++ command : efi_ld.split() + ['-o', '@OUTPUT@'] + + efi_ldflags + tuple[2] + + ['-lefi', '-lgnuefi', libgcc_file_name]) + +-- +2.13.0 + diff --git a/meta/recipes-core/systemd/systemd/0001-Revert-meson-print-EFI-CC-configuration-nicely.patch b/meta/recipes-core/systemd/systemd/0001-Revert-meson-print-EFI-CC-configuration-nicely.patch new file mode 100644 index 0000000000..ed14e25bce --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0001-Revert-meson-print-EFI-CC-configuration-nicely.patch @@ -0,0 +1,33 @@ +From 0bf530aac152630500939db31f98d933158fdabd Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Tue, 26 Feb 2019 14:27:49 +0800 +Subject: [PATCH] Revert "meson: print EFI CC configuration nicely" + +This reverts commit c512dfb9ac948ddb1ced0dab07b9dac88b198293. + +This patch is here because we haven't figured out how to pass +parameter to efi-cc if it's an array in systemd-boot recipe. + +Upstream-Status: Inappropriate [OE specific] + +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +--- + meson.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/meson.build b/meson.build +index 70fb218..30df834 100644 +--- a/meson.build ++++ b/meson.build +@@ -3138,7 +3138,7 @@ if conf.get('ENABLE_EFI') == 1 + if have_gnu_efi + status += [ + 'EFI machine type: @0@'.format(EFI_MACHINE_TYPE_NAME), +- 'EFI CC @0@'.format(' '.join(efi_cc)), ++ 'EFI CC @0@'.format(efi_cc), + 'EFI lib directory: @0@'.format(efi_libdir), + 'EFI lds directory: @0@'.format(efi_ldsdir), + 'EFI include directory: @0@'.format(efi_incdir)] +-- +2.7.4 + diff --git a/meta/recipes-core/systemd/systemd/0001-Revert-meson-use-an-array-option-for-efi-cc.patch b/meta/recipes-core/systemd/systemd/0001-Revert-meson-use-an-array-option-for-efi-cc.patch new file mode 100644 index 0000000000..0d2ebf62bd --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0001-Revert-meson-use-an-array-option-for-efi-cc.patch @@ -0,0 +1,77 @@ +From 0030dcbac1a9177ef7a28af209ac67149b899f5f Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Tue, 26 Feb 2019 14:17:25 +0800 +Subject: [PATCH] Revert "meson: use an array option for efi-cc" + +This reverts commit 595343fb4c99c2679d347ef7c19debfbfed6342e. + +This patch is here because we haven't figured out how to pass +parameter to efi-cc if it's an array in systemd-boot recipe. + +Upstream-Status: Inappropriate [OE specific] + +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +--- + meson_options.txt | 2 +- + src/boot/efi/meson.build | 11 ++++++----- + 2 files changed, 7 insertions(+), 6 deletions(-) + +diff --git a/meson_options.txt b/meson_options.txt +index 044bb79..3d28bfd 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -292,7 +292,7 @@ option('dbus', type : 'combo', choices : ['auto', 'true', 'false'], + + option('gnu-efi', type : 'combo', choices : ['auto', 'true', 'false'], + description : 'gnu-efi support for sd-boot') +-option('efi-cc', type : 'array', ++option('efi-cc', type : 'string', + description : 'the compiler to use for EFI modules') + option('efi-ld', type : 'string', + description : 'the linker to use for EFI modules') +diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build +index 2140151..d8db3a1 100644 +--- a/src/boot/efi/meson.build ++++ b/src/boot/efi/meson.build +@@ -34,8 +34,8 @@ stub_sources = ''' + + if conf.get('ENABLE_EFI') == 1 and get_option('gnu-efi') != 'false' + efi_cc = get_option('efi-cc') +- if efi_cc.length() == 0 +- efi_cc = cc.cmd_array() ++ if efi_cc == '' ++ efi_cc = ' '.join(cc.cmd_array()) + endif + efi_ld = get_option('efi-ld') + if efi_ld == '' +@@ -57,7 +57,8 @@ if conf.get('ENABLE_EFI') == 1 and get_option('gnu-efi') != 'false' + + efi_libdir = get_option('efi-libdir') + if efi_libdir == '' +- ret = run_command(efi_cc + ['-print-multi-os-directory']) ++ cmd = 'cd /usr/lib/$(@0@ -print-multi-os-directory) && pwd'.format(efi_cc) ++ ret = run_command('sh', '-c', cmd) + if ret.returncode() == 0 + path = join_paths('/usr/lib', ret.stdout().strip()) + ret = run_command('realpath', '-e', path) +@@ -152,7 +153,7 @@ if have_gnu_efi + o_file = custom_target(file + '.o', + input : file, + output : file + '.o', +- command : efi_cc + ['-c', '@INPUT@', '-o', '@OUTPUT@'] ++ command : [efi_cc, '-c', '@INPUT@', '-o', '@OUTPUT@'] + + compile_args, + depend_files : efi_headers) + if (common_sources + systemd_boot_sources).contains(file) +@@ -163,7 +164,7 @@ if have_gnu_efi + endif + endforeach + +- libgcc_file_name = run_command(efi_cc + ['-print-libgcc-file-name']).stdout().strip() ++ libgcc_file_name = run_command(efi_cc, '-print-libgcc-file-name').stdout().strip() + systemd_boot_efi_name = 'systemd-boot@0@.efi'.format(EFI_MACHINE_TYPE_NAME) + stub_efi_name = 'linux@0@.efi.stub'.format(EFI_MACHINE_TYPE_NAME) + no_undefined_symbols = find_program('no-undefined-symbols.sh') +-- +2.7.4 + diff --git a/meta/recipes-core/systemd/systemd/0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch b/meta/recipes-core/systemd/systemd/0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch new file mode 100644 index 0000000000..73e65ff798 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch @@ -0,0 +1,80 @@ +From 98254e4798e79d52ac6b562616cd244120f6e239 Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Thu, 21 Feb 2019 16:23:24 +0800 +Subject: [PATCH 1/5] binfmt: Don't install dependency links at install time + for the binfmt services + +use [Install] blocks so that they get created when the service is enabled +like a traditional service. + +The [Install] blocks were rejected upstream as they don't have a way to +"enable" it on install without static symlinks which can't be disabled, +only masked. We however can do that in a postinst. + +Upstream-Status: Denied + +Signed-off-by: Ross Burton <ross.burton@intel.com> +Signed-off-by: Khem Raj <raj.khem@gmail.com> +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +[rebased for systemd 243] +Signed-off-by: Scott Murray <scott.murray@konsulko.com> +--- + units/meson.build | 6 ++---- + units/proc-sys-fs-binfmt_misc.automount | 3 +++ + units/systemd-binfmt.service.in | 4 ++++ + 3 files changed, 9 insertions(+), 4 deletions(-) + +diff --git a/units/meson.build b/units/meson.build +index e1ee9f86c3..6bb7771b36 100644 +--- a/units/meson.build ++++ b/units/meson.build +@@ -46,8 +46,7 @@ units = [ + ['poweroff.target', '', + 'runlevel0.target'], + ['printer.target', ''], +- ['proc-sys-fs-binfmt_misc.automount', 'ENABLE_BINFMT', +- 'sysinit.target.wants/'], ++ ['proc-sys-fs-binfmt_misc.automount', 'ENABLE_BINFMT'], + ['proc-sys-fs-binfmt_misc.mount', 'ENABLE_BINFMT'], + ['reboot.target', '', + 'runlevel6.target ctrl-alt-del.target'], +@@ -130,8 +129,7 @@ in_units = [ + ['systemd-ask-password-console.service', ''], + ['systemd-ask-password-wall.service', ''], + ['systemd-backlight@.service', 'ENABLE_BACKLIGHT'], +- ['systemd-binfmt.service', 'ENABLE_BINFMT', +- 'sysinit.target.wants/'], ++ ['systemd-binfmt.service', 'ENABLE_BINFMT'], + ['systemd-bless-boot.service', 'ENABLE_EFI HAVE_BLKID'], + ['systemd-boot-check-no-failures.service', ''], + ['systemd-boot-system-token.service', 'ENABLE_EFI', +diff --git a/units/proc-sys-fs-binfmt_misc.automount b/units/proc-sys-fs-binfmt_misc.automount +index 30a6bc9918..4231f3b70f 100644 +--- a/units/proc-sys-fs-binfmt_misc.automount ++++ b/units/proc-sys-fs-binfmt_misc.automount +@@ -18,3 +18,6 @@ ConditionPathIsReadWrite=/proc/sys/ + + [Automount] + Where=/proc/sys/fs/binfmt_misc ++ ++[Install] ++WantedBy=sysinit.target +diff --git a/units/systemd-binfmt.service.in b/units/systemd-binfmt.service.in +index e940c7c9ad..6be7f5cc9b 100644 +--- a/units/systemd-binfmt.service.in ++++ b/units/systemd-binfmt.service.in +@@ -14,6 +14,7 @@ Documentation=https://www.kernel.org/doc/html/latest/admin-guide/binfmt-misc.htm + Documentation=https://www.freedesktop.org/wiki/Software/systemd/APIFileSystems + DefaultDependencies=no + Conflicts=shutdown.target ++Wants=proc-sys-fs-binfmt_misc.automount + After=proc-sys-fs-binfmt_misc.automount + Before=sysinit.target shutdown.target + ConditionPathIsReadWrite=/proc/sys/ +@@ -28,3 +29,6 @@ Type=oneshot + RemainAfterExit=yes + ExecStart=@rootlibexecdir@/systemd-binfmt + TimeoutSec=90s ++ ++[Install] ++WantedBy=sysinit.target diff --git a/meta/recipes-core/systemd/systemd/0001-core-device.c-Change-the-default-device-timeout-to-2.patch b/meta/recipes-core/systemd/systemd/0001-core-device.c-Change-the-default-device-timeout-to-2.patch deleted file mode 100644 index f7ef7a3219..0000000000 --- a/meta/recipes-core/systemd/systemd/0001-core-device.c-Change-the-default-device-timeout-to-2.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 3bc4552117879f57522b5972b724729ca993f1ea Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Mon, 14 Dec 2015 04:09:19 +0000 -Subject: [PATCH 01/36] core/device.c: Change the default device timeout to 240 - sec. -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Upstream-Status: Inappropriate [Specific case QEMU/AB] - -Signed-off-by: AnÃbal Limón <anibal.limon@linux.intel.com> -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- - src/core/device.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/core/device.c b/src/core/device.c -index d201dc5..340d62a 100644 ---- a/src/core/device.c -+++ b/src/core/device.c -@@ -112,7 +112,7 @@ static void device_init(Unit *u) { - * indefinitely for plugged in devices, something which cannot - * happen for the other units since their operations time out - * anyway. */ -- u->job_timeout = u->manager->default_timeout_start_usec; -+ u->job_timeout = (240 * USEC_PER_SEC); - - u->ignore_on_isolate = true; - } --- -1.8.3.1 - diff --git a/meta/recipes-core/systemd/systemd/0001-do-not-disable-buffer-in-writing-files.patch b/meta/recipes-core/systemd/systemd/0001-do-not-disable-buffer-in-writing-files.patch new file mode 100644 index 0000000000..2f4daf8665 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0001-do-not-disable-buffer-in-writing-files.patch @@ -0,0 +1,413 @@ +From 85e3c3046562ec24fc2f09ebfd08bf9f168091d5 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 | 14 +++++++------- + src/basic/procfs-util.c | 4 ++-- + src/basic/smack-util.c | 2 +- + src/basic/util.c | 2 +- + src/binfmt/binfmt.c | 6 +++--- + src/core/main.c | 4 ++-- + src/core/smack-setup.c | 8 ++++---- + src/hibernate-resume/hibernate-resume.c | 2 +- + src/libsystemd/sd-device/sd-device.c | 2 +- + src/login/logind-dbus.c | 2 +- + src/nspawn/nspawn-cgroup.c | 2 +- + src/nspawn/nspawn.c | 6 +++--- + src/shared/sysctl-util.c | 2 +- + src/sleep/sleep.c | 10 +++++----- + src/udev/udevadm-trigger.c | 2 +- + src/udev/udevd.c | 2 +- + src/vconsole/vconsole-setup.c | 2 +- + 17 files changed, 36 insertions(+), 36 deletions(-) + +diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c +index 7b5839ccd6..18f6e8ffc8 100644 +--- a/src/basic/cgroup-util.c ++++ b/src/basic/cgroup-util.c +@@ -860,7 +860,7 @@ int cg_attach(const char *controller, const char *path, pid_t pid) { + + xsprintf(c, PID_FMT "\n", pid); + +- r = write_string_file(fs, c, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(fs, c, 0); + if (r < 0) + return r; + +@@ -1142,7 +1142,7 @@ int cg_install_release_agent(const char *controller, const char *agent) { + + sc = strstrip(contents); + if (isempty(sc)) { +- r = write_string_file(fs, agent, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(fs, agent, 0); + if (r < 0) + return r; + } else if (!path_equal(sc, agent)) +@@ -1160,7 +1160,7 @@ int cg_install_release_agent(const char *controller, const char *agent) { + + sc = strstrip(contents); + if (streq(sc, "0")) { +- r = write_string_file(fs, "1", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(fs, "1", 0); + if (r < 0) + return r; + +@@ -1187,7 +1187,7 @@ int cg_uninstall_release_agent(const char *controller) { + if (r < 0) + return r; + +- r = write_string_file(fs, "0", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(fs, "0", 0); + if (r < 0) + return r; + +@@ -1197,7 +1197,7 @@ int cg_uninstall_release_agent(const char *controller) { + if (r < 0) + return r; + +- r = write_string_file(fs, "", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(fs, "", 0); + if (r < 0) + return r; + +@@ -2053,7 +2053,7 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri + if (r < 0) + return r; + +- return write_string_file(p, value, WRITE_STRING_FILE_DISABLE_BUFFER); ++ return write_string_file(p, value, 0); + } + + int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret) { +@@ -2697,7 +2697,7 @@ int cg_enable_everywhere( + return log_debug_errno(errno, "Failed to open cgroup.subtree_control file of %s: %m", p); + } + +- r = write_string_stream(f, s, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_stream(f, s, 0); + if (r < 0) { + log_debug_errno(r, "Failed to %s controller %s for %s (%s): %m", + FLAGS_SET(mask, bit) ? "enable" : "disable", n, p, fs); +diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c +index 42ce53d5aa..57512532a6 100644 +--- a/src/basic/procfs-util.c ++++ b/src/basic/procfs-util.c +@@ -86,13 +86,13 @@ int procfs_tasks_set_limit(uint64_t limit) { + * decrease it, as threads-max is the much more relevant sysctl. */ + if (limit > pid_max-1) { + sprintf(buffer, "%" PRIu64, limit+1); /* Add one, since PID 0 is not a valid PID */ +- r = write_string_file("/proc/sys/kernel/pid_max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/sys/kernel/pid_max", buffer, 0); + if (r < 0) + return r; + } + + sprintf(buffer, "%" PRIu64, limit); +- r = write_string_file("/proc/sys/kernel/threads-max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/sys/kernel/threads-max", buffer, 0); + if (r < 0) { + uint64_t threads_max; + +diff --git a/src/basic/smack-util.c b/src/basic/smack-util.c +index 123d00e13e..e7ea78f349 100644 +--- a/src/basic/smack-util.c ++++ b/src/basic/smack-util.c +@@ -115,7 +115,7 @@ int mac_smack_apply_pid(pid_t pid, const char *label) { + return 0; + + p = procfs_file_alloca(pid, "attr/current"); +- r = write_string_file(p, label, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(p, label, 0); + if (r < 0) + return r; + +diff --git a/src/basic/util.c b/src/basic/util.c +index 93d610bc98..97dca64f73 100644 +--- a/src/basic/util.c ++++ b/src/basic/util.c +@@ -294,7 +294,7 @@ void disable_coredumps(void) { + if (detect_container() > 0) + return; + +- r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", 0); + if (r < 0) + log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m"); + } +diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c +index aa9d811f2e..8c7f2dae7a 100644 +--- a/src/binfmt/binfmt.c ++++ b/src/binfmt/binfmt.c +@@ -48,7 +48,7 @@ static int delete_rule(const char *rule) { + if (!fn) + return log_oom(); + +- return write_string_file(fn, "-1", WRITE_STRING_FILE_DISABLE_BUFFER); ++ return write_string_file(fn, "-1", 0); + } + + static int apply_rule(const char *rule) { +@@ -56,7 +56,7 @@ static int apply_rule(const char *rule) { + + (void) delete_rule(rule); + +- r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, 0); + if (r < 0) + return log_error_errno(r, "Failed to add binary format: %m"); + +@@ -213,7 +213,7 @@ static int run(int argc, char *argv[]) { + } + + /* Flush out all rules */ +- (void) write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER); ++ (void) write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0); + + STRV_FOREACH(f, files) { + k = apply_file(*f, true); +diff --git a/src/core/main.c b/src/core/main.c +index bcce7178a8..4199cedab9 100644 +--- a/src/core/main.c ++++ b/src/core/main.c +@@ -1285,7 +1285,7 @@ static int bump_unix_max_dgram_qlen(void) { + if (v >= DEFAULT_UNIX_MAX_DGRAM_QLEN) + return 0; + +- r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", WRITE_STRING_FILE_DISABLE_BUFFER, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN); ++ r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", 0, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN); + if (r < 0) + return log_full_errno(IN_SET(r, -EROFS, -EPERM, -EACCES) ? LOG_DEBUG : LOG_WARNING, r, + "Failed to bump AF_UNIX datagram queue length, ignoring: %m"); +@@ -1509,7 +1509,7 @@ static void initialize_core_pattern(bool skip_setup) { + if (getpid_cached() != 1) + return; + +- r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, 0); + if (r < 0) + log_warning_errno(r, "Failed to write '%s' to /proc/sys/kernel/core_pattern, ignoring: %m", arg_early_core_pattern); + } +diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c +index b95e6239d4..fdbdaaaccb 100644 +--- a/src/core/smack-setup.c ++++ b/src/core/smack-setup.c +@@ -325,17 +325,17 @@ int mac_smack_setup(bool *loaded_policy) { + } + + #ifdef SMACK_RUN_LABEL +- r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, 0); + if (r < 0) + log_warning_errno(r, "Failed to set SMACK label \"" SMACK_RUN_LABEL "\" on self: %m"); +- r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, 0); + if (r < 0) + log_warning_errno(r, "Failed to set SMACK ambient label \"" SMACK_RUN_LABEL "\": %m"); + r = write_string_file("/sys/fs/smackfs/netlabel", +- "0.0.0.0/0 " SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); ++ "0.0.0.0/0 " SMACK_RUN_LABEL, 0); + if (r < 0) + log_warning_errno(r, "Failed to set SMACK netlabel rule \"0.0.0.0/0 " SMACK_RUN_LABEL "\": %m"); +- r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", 0); + if (r < 0) + log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m"); + #endif +diff --git a/src/hibernate-resume/hibernate-resume.c b/src/hibernate-resume/hibernate-resume.c +index 17e7cd1a00..87a7667716 100644 +--- 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; +diff --git a/src/libsystemd/sd-device/sd-device.c b/src/libsystemd/sd-device/sd-device.c +index c4a7f2f3d3..bcac758284 100644 +--- a/src/libsystemd/sd-device/sd-device.c ++++ b/src/libsystemd/sd-device/sd-device.c +@@ -1849,7 +1849,7 @@ _public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr, + if (!value) + return -ENOMEM; + +- r = write_string_file(path, value, WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_NOFOLLOW); ++ r = write_string_file(path, value, 0 | WRITE_STRING_FILE_NOFOLLOW); + if (r < 0) { + if (r == -ELOOP) + return -EINVAL; +diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c +index 30b9a66334..cc1d577933 100644 +--- a/src/login/logind-dbus.c ++++ b/src/login/logind-dbus.c +@@ -1325,7 +1325,7 @@ static int trigger_device(Manager *m, sd_device *d) { + if (!t) + return -ENOMEM; + +- (void) write_string_file(t, "change", WRITE_STRING_FILE_DISABLE_BUFFER); ++ (void) write_string_file(t, "change", 0); + } + + return 0; +diff --git a/src/nspawn/nspawn-cgroup.c b/src/nspawn/nspawn-cgroup.c +index 0462b46413..7c53d41483 100644 +--- a/src/nspawn/nspawn-cgroup.c ++++ b/src/nspawn/nspawn-cgroup.c +@@ -123,7 +123,7 @@ int sync_cgroup(pid_t pid, CGroupUnified unified_requested, uid_t uid_shift) { + fn = strjoina(tree, cgroup, "/cgroup.procs"); + + sprintf(pid_string, PID_FMT, pid); +- r = write_string_file(fn, pid_string, WRITE_STRING_FILE_DISABLE_BUFFER|WRITE_STRING_FILE_MKDIR_0755); ++ r = write_string_file(fn, pid_string, WRITE_STRING_FILE_MKDIR_0755); + if (r < 0) { + log_error_errno(r, "Failed to move process: %m"); + goto finish; +diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c +index 2aec8041f0..841542f2f3 100644 +--- a/src/nspawn/nspawn.c ++++ b/src/nspawn/nspawn.c +@@ -2357,7 +2357,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" +@@ -3566,13 +3566,13 @@ static int setup_uid_map(pid_t pid) { + + xsprintf(uid_map, "/proc/" PID_FMT "/uid_map", pid); + xsprintf(line, UID_FMT " " UID_FMT " " UID_FMT "\n", 0, arg_uid_shift, arg_uid_range); +- r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(uid_map, line, 0); + if (r < 0) + return log_error_errno(r, "Failed to write UID map: %m"); + + /* We always assign the same UID and GID ranges */ + xsprintf(uid_map, "/proc/" PID_FMT "/gid_map", pid); +- r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(uid_map, line, 0); + if (r < 0) + return log_error_errno(r, "Failed to write GID map: %m"); + +diff --git a/src/shared/sysctl-util.c b/src/shared/sysctl-util.c +index 93bdcf11bf..68cddb7a9f 100644 +--- a/src/shared/sysctl-util.c ++++ b/src/shared/sysctl-util.c +@@ -88,7 +88,7 @@ int sysctl_write_ip_property(int af, const char *ifname, 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); ++ return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | 0); + } + + int sysctl_read(const char *property, char **content) { +diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c +index b9fe96635d..f168d7f890 100644 +--- a/src/sleep/sleep.c ++++ b/src/sleep/sleep.c +@@ -54,7 +54,7 @@ static int write_hibernate_location_info(void) { + + /* if it's a swap partition, we just write the disk to /sys/power/resume */ + if (streq(type, "partition")) { +- r = write_string_file("/sys/power/resume", device, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/sys/power/resume", device, 0); + if (r < 0) + return log_debug_errno(r, "Failed to write partition device to /sys/power/resume: %m"); + +@@ -98,14 +98,14 @@ static int write_hibernate_location_info(void) { + + offset = fiemap->fm_extents[0].fe_physical / page_size(); + xsprintf(offset_str, "%" PRIu64, 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 offset '%s': %m", offset_str); + + log_debug("Wrote calculated resume_offset value to /sys/power/resume_offset: %s", offset_str); + + xsprintf(device_str, "%lx", (unsigned long)stb.st_dev); +- r = write_string_file("/sys/power/resume", device_str, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/sys/power/resume", device_str, 0); + if (r < 0) + return log_debug_errno(r, "Failed to write device '%s': %m", device_str); + +@@ -121,7 +121,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; + +@@ -140,7 +140,7 @@ static int write_state(FILE **f, char **states) { + 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); +diff --git a/src/udev/udevadm-trigger.c b/src/udev/udevadm-trigger.c +index 77d95e513f..25ce4abfb1 100644 +--- a/src/udev/udevadm-trigger.c ++++ b/src/udev/udevadm-trigger.c +@@ -43,7 +43,7 @@ static int exec_list(sd_device_enumerator *e, const char *action, Set *settle_se + if (!filename) + return log_oom(); + +- r = write_string_file(filename, action, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(filename, action, 0); + if (r < 0) { + log_full_errno(r == -ENOENT ? LOG_DEBUG : LOG_ERR, r, + "Failed to write '%s' to '%s': %m", action, filename); +diff --git a/src/udev/udevd.c b/src/udev/udevd.c +index cb5123042a..ea309a9e7f 100644 +--- a/src/udev/udevd.c ++++ b/src/udev/udevd.c +@@ -1113,7 +1113,7 @@ static int synthesize_change_one(sd_device *dev, const char *syspath) { + + filename = strjoina(syspath, "/uevent"); + log_device_debug(dev, "device is closed, synthesising 'change' on %s", syspath); +- r = write_string_file(filename, "change", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(filename, "change", 0); + if (r < 0) + return log_device_debug_errno(dev, r, "Failed to write 'change' to %s: %m", filename); + return 0; +diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c +index 75d052ae70..5a15c939d8 100644 +--- a/src/vconsole/vconsole-setup.c ++++ b/src/vconsole/vconsole-setup.c +@@ -117,7 +117,7 @@ static int toggle_utf8_vc(const char *name, int fd, bool utf8) { + static int toggle_utf8_sysfs(bool utf8) { + int r; + +- r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), 0); + if (r < 0) + return log_warning_errno(r, "Failed to %s sysfs UTF-8 flag: %m", enable_disable(utf8)); + diff --git a/meta/recipes-core/systemd/systemd/0001-meson-Add-Defi-objcopy-option-to-specify-objcopy.patch b/meta/recipes-core/systemd/systemd/0001-meson-Add-Defi-objcopy-option-to-specify-objcopy.patch new file mode 100644 index 0000000000..7d764b4115 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0001-meson-Add-Defi-objcopy-option-to-specify-objcopy.patch @@ -0,0 +1,48 @@ +From 3f37ad5e083dcad51c21c1050b2829b70d240b52 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Tue, 6 Aug 2019 03:10:20 +0000 +Subject: [PATCH] meson: Add -Defi-objcopy option to specify objcopy + +This helps in cross compiling for x86 target on a aarch64 host e.g. +Fixes +TOPDIR/build/tmp/hosttools/objcopy:src/boot/efi/systemd_boot.so: Invalid bfd target + +Upstream-Status: Pending +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + meson_options.txt | 2 ++ + src/boot/efi/meson.build | 5 ++++- + 2 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/meson_options.txt b/meson_options.txt +index d4ec37dda2..dc1c96e112 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -296,6 +296,8 @@ option('efi-cc', type : 'array', + description : 'the compiler to use for EFI modules') + option('efi-ld', type : 'string', + description : 'the linker to use for EFI modules') ++option('efi-objcopy', type : 'string', ++ description : 'the objcopy to use for EFI') + option('efi-libdir', type : 'string', + description : 'path to the EFI lib directory') + option('efi-ldsdir', type : 'string', +diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build +index 0ae3191635..5a7137bc84 100644 +--- a/src/boot/efi/meson.build ++++ b/src/boot/efi/meson.build +@@ -88,7 +88,10 @@ if have_gnu_efi + output : 'efi_config.h', + configuration : efi_conf) + +- objcopy = find_program('objcopy') ++ objcopy = get_option('efi-objcopy') ++ if objcopy == '' ++ objcopy = find_program('objcopy', required: true) ++ endif + + efi_ldsdir = get_option('efi-ldsdir') + arch_lds = 'elf_@0@_efi.lds'.format(gnu_efi_path_arch) +-- +2.17.1 + diff --git a/meta/recipes-core/systemd/systemd/0001-unit-file.c-consider-symlink-on-filesystems-like-NFS.patch b/meta/recipes-core/systemd/systemd/0001-unit-file.c-consider-symlink-on-filesystems-like-NFS.patch new file mode 100644 index 0000000000..ba20a0bb46 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0001-unit-file.c-consider-symlink-on-filesystems-like-NFS.patch @@ -0,0 +1,42 @@ +From d0122c077d2d8fd0fd29b463c501e7ddf9177ff3 Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Tue, 24 Sep 2019 17:04:50 +0800 +Subject: [PATCH] unit-file.c: consider symlink on filesystems like NFS + +Some filesystems do not fully support readdir, according to the manual, +so we should also consider DT_UNKNOWN to correctly handle symlinks. + +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> + +Upstream-Status: Submitted [https://github.com/systemd/systemd/pull/13637] +--- + src/shared/unit-file.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/shared/unit-file.c b/src/shared/unit-file.c +index 4a5f23e6c1..8373103000 100644 +--- a/src/shared/unit-file.c ++++ b/src/shared/unit-file.c +@@ -247,6 +247,7 @@ int unit_file_build_name_map( + _cleanup_free_ char *_filename_free = NULL, *simplified = NULL; + const char *suffix, *dst = NULL; + bool valid_unit_name; ++ struct stat sb; + + valid_unit_name = unit_name_is_valid(de->d_name, UNIT_NAME_ANY); + +@@ -279,7 +280,10 @@ int unit_file_build_name_map( + if (hashmap_contains(ids, de->d_name)) + continue; + +- if (de->d_type == DT_LNK) { ++ if (de->d_type == DT_LNK || ++ (de->d_type == DT_UNKNOWN && ++ lstat(filename, &sb) == 0 && ++ (sb.st_mode & S_IFMT) == S_IFLNK)) { + /* We don't explicitly check for alias loops here. unit_ids_map_get() which + * limits the number of hops should be used to access the map. */ + +-- +2.17.1 + diff --git a/meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch b/meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch new file mode 100644 index 0000000000..c6213ab88e --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch @@ -0,0 +1,163 @@ +From 1eb84534dea05d41afed1d898cba212ad7d310dd Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Mon, 25 Feb 2019 13:41:41 +0800 +Subject: [PATCH 02/24] don't use glibc-specific qsort_r + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +[Rebased for v241] +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +[Rebased for v242] +Signed-off-by: Andrej Valek <andrej.valek@siemens.com> +--- + src/basic/sort-util.h | 14 -------------- + src/libsystemd/sd-hwdb/hwdb-util.c | 19 ++++++++++++++----- + src/shared/format-table.c | 36 ++++++++++++++++++++++++------------ + 3 files changed, 38 insertions(+), 31 deletions(-) + +diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h +index e029f8646e..27d68b341c 100644 +--- a/src/basic/sort-util.h ++++ b/src/basic/sort-util.h +@@ -54,17 +54,3 @@ static inline void qsort_safe(void *base, size_t nmemb, size_t size, __compar_fn + int (*_func_)(const typeof(p[0])*, const typeof(p[0])*) = func; \ + qsort_safe((p), (n), sizeof((p)[0]), (__compar_fn_t) _func_); \ + }) +- +-static inline void qsort_r_safe(void *base, size_t nmemb, size_t size, __compar_d_fn_t compar, void *userdata) { +- if (nmemb <= 1) +- return; +- +- assert(base); +- qsort_r(base, nmemb, size, compar, userdata); +-} +- +-#define typesafe_qsort_r(p, n, func, userdata) \ +- ({ \ +- int (*_func_)(const typeof(p[0])*, const typeof(p[0])*, typeof(userdata)) = func; \ +- qsort_r_safe((p), (n), sizeof((p)[0]), (__compar_d_fn_t) _func_, userdata); \ +- }) +diff --git a/src/libsystemd/sd-hwdb/hwdb-util.c b/src/libsystemd/sd-hwdb/hwdb-util.c +index c83575c7c8..72f8f3a050 100644 +--- a/src/libsystemd/sd-hwdb/hwdb-util.c ++++ b/src/libsystemd/sd-hwdb/hwdb-util.c +@@ -128,9 +128,13 @@ static void trie_free(struct trie *trie) { + + DEFINE_TRIVIAL_CLEANUP_FUNC(struct trie*, trie_free); + +-static int trie_values_cmp(const struct trie_value_entry *a, const struct trie_value_entry *b, struct trie *trie) { +- return strcmp(trie->strings->buf + a->key_off, +- trie->strings->buf + b->key_off); ++static struct trie *trie_node_add_value_trie; ++static int trie_values_cmp(const void *v1, const void *v2) { ++ const struct trie_value_entry *a = v1; ++ const struct trie_value_entry *b = v2; ++ ++ return strcmp(trie_node_add_value_trie->strings->buf + a->key_off, ++ trie_node_add_value_trie->strings->buf + b->key_off); + } + + static int trie_node_add_value(struct trie *trie, struct trie_node *node, +@@ -158,7 +162,10 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node, + .value_off = v, + }; + +- val = typesafe_bsearch_r(&search, node->values, node->values_count, trie_values_cmp, trie); ++ trie_node_add_value_trie = trie; ++ val = bsearch(&search, node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp); ++ trie_node_add_value_trie = NULL; ++ + if (val) { + /* At this point we have 2 identical properties on the same match-string. + * Since we process files in order, we just replace the previous value. */ +@@ -184,7 +191,9 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node, + .line_number = line_number, + }; + node->values_count++; +- typesafe_qsort_r(node->values, node->values_count, trie_values_cmp, trie); ++ trie_node_add_value_trie = trie; ++ qsort(node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp); ++ trie_node_add_value_trie = NULL; + return 0; + } + +diff --git a/src/shared/format-table.c b/src/shared/format-table.c +index a5c0a99b08..d595cbe372 100644 +--- a/src/shared/format-table.c ++++ b/src/shared/format-table.c +@@ -850,31 +850,33 @@ static int cell_data_compare(TableData *a, size_t index_a, TableData *b, size_t + return CMP(index_a, index_b); + } + +-static int table_data_compare(const size_t *a, const size_t *b, Table *t) { ++static Table *user_table; ++static int table_data_compare(const void *x, const void *y) { ++ const size_t *a = x, *b=y; + size_t i; + int r; + +- assert(t); +- assert(t->sort_map); ++ assert(user_table); ++ assert(user_table->sort_map); + + /* Make sure the header stays at the beginning */ +- if (*a < t->n_columns && *b < t->n_columns) ++ if (*a < user_table->n_columns && *b < user_table->n_columns) + return 0; +- if (*a < t->n_columns) ++ if (*a < user_table->n_columns) + return -1; +- if (*b < t->n_columns) ++ if (*b < user_table->n_columns) + return 1; + + /* Order other lines by the sorting map */ +- for (i = 0; i < t->n_sort_map; i++) { ++ for (i = 0; i < user_table->n_sort_map; i++) { + TableData *d, *dd; + +- d = t->data[*a + t->sort_map[i]]; +- dd = t->data[*b + t->sort_map[i]]; ++ d = user_table->data[*a + user_table->sort_map[i]]; ++ dd = user_table->data[*b + user_table->sort_map[i]]; + + r = cell_data_compare(d, *a, dd, *b); + if (r != 0) +- return t->reverse_map && t->reverse_map[t->sort_map[i]] ? -r : r; ++ return user_table->reverse_map && user_table->reverse_map[user_table->sort_map[i]] ? -r : r; + } + + /* Order identical lines by the order there were originally added in */ +@@ -1107,7 +1109,12 @@ int table_print(Table *t, FILE *f) { + for (i = 0; i < n_rows; i++) + sorted[i] = i * t->n_columns; + +- typesafe_qsort_r(sorted, n_rows, table_data_compare, t); ++ if (n_rows <= 1) ++ return 0; ++ assert(sorted); ++ user_table = t; ++ qsort(sorted, n_rows, sizeof(size_t), table_data_compare); ++ user_table = NULL; + } + + if (t->display_map) +@@ -1534,7 +1541,12 @@ int table_to_json(Table *t, JsonVariant **ret) { + for (i = 0; i < n_rows; i++) + sorted[i] = i * t->n_columns; + +- typesafe_qsort_r(sorted, n_rows, table_data_compare, t); ++ if (n_rows <= 1) ++ return 0; ++ assert(sorted); ++ user_table = t; ++ qsort(sorted, n_rows, sizeof(size_t), table_data_compare); ++ user_table = NULL; + } + + if (t->display_map) +-- +2.11.0 + diff --git a/meta/recipes-core/systemd/systemd/0002-src-login-brightness.c-include-sys-wait.h.patch b/meta/recipes-core/systemd/systemd/0002-src-login-brightness.c-include-sys-wait.h.patch new file mode 100644 index 0000000000..dcae668dcb --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0002-src-login-brightness.c-include-sys-wait.h.patch @@ -0,0 +1,25 @@ +Include sys/wait.h + +Fixes: +src/login/logind-brightness.c:158:85: error: 'WEXITED' undeclared (first use in this function); did you mean 'WIFEXITED'? + 158 | r = sd_event_add_child(w->manager->event, &w->child_event_source, w->child, WEXITED, on_brightness_writer_exit, w); + | ^~~~~~~ + +Upstream-Status: Pending + +Signed-off-by: Scott Murray <scott.murray@konsulko.com> +--- + src/login/logind-brightness.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/login/logind-brightness.c b/src/login/logind-brightness.c +index 8dfa97d7ae..bddd4a2727 100644 +--- a/src/login/logind-brightness.c ++++ b/src/login/logind-brightness.c +@@ -1,5 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1+ */ + ++#include <sys/wait.h> + #include "bus-util.h" + #include "device-util.h" + #include "hash-funcs.h" diff --git a/meta/recipes-core/systemd/systemd/0002-units-Prefer-getty-to-agetty-in-console-setup-system.patch b/meta/recipes-core/systemd/systemd/0002-units-Prefer-getty-to-agetty-in-console-setup-system.patch deleted file mode 100644 index 28939eb021..0000000000 --- a/meta/recipes-core/systemd/systemd/0002-units-Prefer-getty-to-agetty-in-console-setup-system.patch +++ /dev/null @@ -1,44 +0,0 @@ -From e5f405aba347d216e7f2b73d7dd681b13be442e3 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Fri, 20 Feb 2015 05:29:15 +0000 -Subject: [PATCH 02/36] units: Prefer getty to agetty in console setup systemd - units - -Upstream-Status: Inappropriate [configuration specific] - -Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- - units/getty@.service.m4 | 2 +- - units/serial-getty@.service.m4 | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/units/getty@.service.m4 b/units/getty@.service.m4 -index 46164ab..bdf6ec8 100644 ---- a/units/getty@.service.m4 -+++ b/units/getty@.service.m4 -@@ -27,7 +27,7 @@ ConditionPathExists=/dev/tty0 - - [Service] - # the VT is cleared by TTYVTDisallocate --ExecStart=-/sbin/agetty --noclear %I $TERM -+ExecStart=-/sbin/getty -L %I $TERM - Type=idle - Restart=always - RestartSec=0 -diff --git a/units/serial-getty@.service.m4 b/units/serial-getty@.service.m4 -index 4522d0d..e6d499d 100644 ---- a/units/serial-getty@.service.m4 -+++ b/units/serial-getty@.service.m4 -@@ -22,7 +22,7 @@ Before=getty.target - IgnoreOnIsolate=yes - - [Service] --ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 %I $TERM -+ExecStart=-/sbin/getty -L 115200 %I $TERM - Type=idle - Restart=always - UtmpIdentifier=%I --- -1.8.3.1 - diff --git a/meta/recipes-core/systemd/systemd/0002-use-lnr-wrapper-instead-of-looking-for-relative-opti.patch b/meta/recipes-core/systemd/systemd/0002-use-lnr-wrapper-instead-of-looking-for-relative-opti.patch new file mode 100644 index 0000000000..49a334d090 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0002-use-lnr-wrapper-instead-of-looking-for-relative-opti.patch @@ -0,0 +1,63 @@ +From bdbafe18c3bf99b3b691cd52b9ccff60f313892d Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Wed, 27 Jun 2018 16:09:24 +0800 +Subject: [PATCH 2/5] use lnr wrapper instead of looking for --relative option + for ln + +Remove file manually to avoid the 'File Exists' error when creating +symlink. This is because the original 'ln' command uses '-f' option. + +Upstream-Status: Inappropriate [OE-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> +--- + meson.build | 4 ---- + tools/meson-make-symlink.sh | 3 ++- + units/meson-add-wants.sh | 7 ++++++- + 3 files changed, 8 insertions(+), 6 deletions(-) + +diff --git a/meson.build b/meson.build +index e5ceb1e169..79b762faeb 100644 +--- a/meson.build ++++ b/meson.build +@@ -579,10 +579,6 @@ endforeach + + conf.set_quoted('TELINIT', get_option('telinit-path')) + +-if run_command('ln', '--relative', '--help').returncode() != 0 +- error('ln does not support --relative (added in coreutils 8.16)') +-endif +- + ############################################################ + + gperf = find_program('gperf') +diff --git a/tools/meson-make-symlink.sh b/tools/meson-make-symlink.sh +index da0d13a341..90bc0a93c2 100755 +--- a/tools/meson-make-symlink.sh ++++ b/tools/meson-make-symlink.sh +@@ -8,5 +8,6 @@ mkdir -vp "$(dirname "${DESTDIR:-}$2")" + if [ "$(dirname $1)" = . ]; then + ln -vfs -T "$1" "${DESTDIR:-}$2" + else +- ln -vfs -T --relative "${DESTDIR:-}$1" "${DESTDIR:-}$2" ++ rm -f "${DESTDIR:-}$2" ++ lnr "${DESTDIR:-}$1" "${DESTDIR:-}$2" + fi +diff --git a/units/meson-add-wants.sh b/units/meson-add-wants.sh +index a483d75b86..3c01c523f1 100755 +--- a/units/meson-add-wants.sh ++++ b/units/meson-add-wants.sh +@@ -25,4 +25,9 @@ case "$target" in + ;; + esac + +-ln -vfs --relative "$unitpath" "$dir" ++if [ -d "$dir" ]; then ++ rm -f "$dir/$unit" ++ lnr "$unitpath" "$dir/$unit" ++else ++ lnr "$unitpath" "$dir" ++fi diff --git a/meta/recipes-core/systemd/systemd/0003-define-exp10-if-missing.patch b/meta/recipes-core/systemd/systemd/0003-define-exp10-if-missing.patch deleted file mode 100644 index e62d580f18..0000000000 --- a/meta/recipes-core/systemd/systemd/0003-define-exp10-if-missing.patch +++ /dev/null @@ -1,32 +0,0 @@ -Subject: [PATCH 03/36] define exp10 if missing - -Inspired by: http://peter.korsgaard.com/patches/alsa-utils/alsamixer-fix-build-on-uClibc-exp10.patch - -exp10 extension is not part of uClibc, so compute it. - -Upstream-Status: Pending - -Signed-off-by: Samuel Martin <s.martin49@gmail.com> -Signed-off-by: Khem Raj <raj.khem@gmail.com> - ---- - src/basic/missing.h | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/src/basic/missing.h b/src/basic/missing.h -index 651e414..fafa233 100644 ---- a/src/basic/missing.h -+++ b/src/basic/missing.h -@@ -1013,4 +1013,9 @@ typedef int32_t key_serial_t; - - #endif - -+#ifdef __UCLIBC__ -+/* 10^x = 10^(log e^x) = (e^x)^log10 = e^(x * log 10) */ -+#define exp10(x) (exp((x) * log(10))) -+#endif /* __UCLIBC__ */ -+ - #include "missing_syscall.h" --- -2.8.3 - diff --git a/meta/recipes-core/systemd/systemd/0010-implment-systemd-sysv-install-for-OE.patch b/meta/recipes-core/systemd/systemd/0003-implment-systemd-sysv-install-for-OE.patch index 75fa3a54eb..6695d56804 100644 --- a/meta/recipes-core/systemd/systemd/0010-implment-systemd-sysv-install-for-OE.patch +++ b/meta/recipes-core/systemd/systemd/0003-implment-systemd-sysv-install-for-OE.patch @@ -1,7 +1,7 @@ -From 5f94f5ad46c1ded54c3797979d384e4c1eb77bb0 Mon Sep 17 00:00:00 2001 +From 47864989388bcd04d647ecf618ad7e260399dbb6 Mon Sep 17 00:00:00 2001 From: Khem Raj <raj.khem@gmail.com> Date: Sat, 5 Sep 2015 06:31:47 +0000 -Subject: [PATCH 10/36] implment systemd-sysv-install for OE +Subject: [PATCH 3/5] implment systemd-sysv-install for OE Use update-rc.d for enabling/disabling and status command to check the status of the sysv service @@ -14,10 +14,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/systemctl/systemd-sysv-install.SKELETON b/src/systemctl/systemd-sysv-install.SKELETON -index a53a3e6..5d877b0 100755 +index 8c16cf9..9f078a1 100755 --- a/src/systemctl/systemd-sysv-install.SKELETON +++ b/src/systemctl/systemd-sysv-install.SKELETON -@@ -30,17 +30,17 @@ case "$1" in +@@ -32,17 +32,17 @@ case "$1" in enable) # call the command to enable SysV init script $NAME here # (consider optional $ROOT) @@ -39,5 +39,5 @@ index a53a3e6..5d877b0 100755 *) usage ;; -- -1.8.3.1 +2.7.4 diff --git a/meta/recipes-core/systemd/systemd/0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch b/meta/recipes-core/systemd/systemd/0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch new file mode 100644 index 0000000000..2e39f7a2e1 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch @@ -0,0 +1,63 @@ +From a9421d55102fc84f77f7c21a2479fcd00652b896 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 03/24] 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: 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/journal/catalog.c | 1 + + 3 files changed, 11 insertions(+) + +diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h +index bf8a6caa1b..2134fe5095 100644 +--- a/src/basic/missing_type.h ++++ b/src/basic/missing_type.h +@@ -10,3 +10,12 @@ + #if !HAVE_CHAR16_T + #define char16_t uint16_t + #endif ++ ++#ifndef __GLIBC__ ++typedef int (*comparison_fn_t)(const void *, const void *); ++#endif ++ ++#ifndef __COMPAR_FN_T ++#define __COMPAR_FN_T ++typedef int (*__compar_fn_t)(const void *, const void *); ++#endif +diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h +index e029f86..7247d40 100644 +--- a/src/basic/sort-util.h ++++ b/src/basic/sort-util.h +@@ -4,6 +4,7 @@ + #include <stdlib.h> + + #include "macro.h" ++#include "missing.h" + + void *xbsearch_r(const void *key, const void *base, size_t nmemb, size_t size, + __compar_d_fn_t compar, void *arg); +diff --git a/src/journal/catalog.c b/src/journal/catalog.c +index 7beffc1e1a..4818a2e5cc 100644 +--- a/src/journal/catalog.c ++++ b/src/journal/catalog.c +@@ -29,6 +29,7 @@ + #include "string-util.h" + #include "strv.h" + #include "tmpfile-util.h" ++#include "missing.h" + + const char * const catalog_file_dirs[] = { + "/usr/local/lib/systemd/catalog/", +-- +2.11.0 + diff --git a/meta/recipes-core/systemd/systemd/0003-src-basic-copy.c-include-signal.h.patch b/meta/recipes-core/systemd/systemd/0003-src-basic-copy.c-include-signal.h.patch new file mode 100644 index 0000000000..7ee0d48fa6 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0003-src-basic-copy.c-include-signal.h.patch @@ -0,0 +1,27 @@ +Include signal.h + +Fixes several signal set related errors: +src/basic/copy.c:92:19: error: implicit declaration of function 'sigemptyset' [-Werror=implicit-function-declaration] +src/basic/copy.c:93:19: error: implicit declaration of function 'sigaddset' [-Werror=implicit-function-declaration] +src/basic/copy.c:93:34: error: 'SIGINT' undeclared (first use in this function) +src/basic/copy.c:95:13: error: implicit declaration of function 'sigtimedwait' [-Werror=implicit-function-declaration] + +Upstream-Status: Pending + +Signed-off-by: Scott Murray <scott.murray@konsulko.com> +--- + src/basic/copy.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/basic/copy.c b/src/basic/copy.c +index ca311e021e..3cf7fc1697 100644 +--- a/src/basic/copy.c ++++ b/src/basic/copy.c +@@ -12,6 +12,7 @@ + #include <sys/xattr.h> + #include <time.h> + #include <unistd.h> ++#include <signal.h> + + #include "alloc-util.h" + #include "btrfs-util.h" diff --git a/meta/recipes-core/systemd/systemd/0004-Use-getenv-when-secure-versions-are-not-available.patch b/meta/recipes-core/systemd/systemd/0004-Use-getenv-when-secure-versions-are-not-available.patch deleted file mode 100644 index 989a1fa1df..0000000000 --- a/meta/recipes-core/systemd/systemd/0004-Use-getenv-when-secure-versions-are-not-available.patch +++ /dev/null @@ -1,35 +0,0 @@ -From bb8d8148b16572ae17d3c308552cf73915386b05 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Sat, 12 Sep 2015 19:10:04 +0000 -Subject: [PATCH 04/36] Use getenv when secure versions are not available - -musl doesnt implement secure version, so we default -to it if configure does not detect a secure imeplementation - -Signed-off-by: Khem Raj <raj.khem@gmail.com> -Upstream-Status: Denied ---- - src/basic/missing.h | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/src/basic/missing.h b/src/basic/missing.h -index ee7e7ea..3170429 100644 ---- a/src/basic/missing.h -+++ b/src/basic/missing.h -@@ -585,12 +585,11 @@ static inline int name_to_handle_at(int fd, const char *name, struct file_handle - return syscall(__NR_name_to_handle_at, fd, name, handle, mnt_id, flags); - } - #endif -- - #ifndef HAVE_SECURE_GETENV - # ifdef HAVE___SECURE_GETENV - # define secure_getenv __secure_getenv - # else --# error "neither secure_getenv nor __secure_getenv are available" -+# define secure_getenv getenv - # endif - #endif - --- -1.8.3.1 - diff --git a/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch b/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch new file mode 100644 index 0000000000..a2aad40ac2 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0004-add-fallback-parse_printf_format-implementation.patch @@ -0,0 +1,432 @@ +From 7bcf3b166694090497a0acd2c5299e4e04fcc9b6 Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Mon, 25 Feb 2019 14:04:21 +0800 +Subject: [PATCH 04/24] 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/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 + +diff --git a/meson.build b/meson.build +index 79b762faeb..7f8c679411 100644 +--- a/meson.build ++++ b/meson.build +@@ -613,6 +613,7 @@ endif + foreach header : ['crypt.h', + 'linux/memfd.h', + 'linux/vm_sockets.h', ++ 'printf.h', + 'sys/auxv.h', + 'valgrind/memcheck.h', + 'valgrind/valgrind.h', +diff --git a/src/basic/meson.build b/src/basic/meson.build +index d6caf28f14..32c1acf349 100644 +--- a/src/basic/meson.build ++++ b/src/basic/meson.build +@@ -312,6 +312,11 @@ foreach item : [['af', af_list_txt, 'af', ''], + endforeach + + basic_sources += generated_gperf_headers ++ ++if conf.get('HAVE_PRINTF_H') != 1 ++ basic_sources += [files('parse-printf-format.c')] ++endif ++ + basic_gcrypt_sources = files( + 'gcrypt-util.c', + 'gcrypt-util.h') +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 @@ ++/*-*- 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; ++} +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 @@ ++/*-*- 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 */ +diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h +index c3b9448d4f..2937aa13b1 100644 +--- a/src/basic/stdio-util.h ++++ b/src/basic/stdio-util.h +@@ -1,13 +1,13 @@ + /* SPDX-License-Identifier: LGPL-2.1+ */ + #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, ...) \ + ((size_t) snprintf(buf, len, fmt, __VA_ARGS__) < (len)) +diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c +index 5ef11fa1a4..6384ab620c 100644 +--- a/src/journal/journal-send.c ++++ b/src/journal/journal-send.c +@@ -2,7 +2,6 @@ + + #include <errno.h> + #include <fcntl.h> +-#include <printf.h> + #include <stddef.h> + #include <sys/socket.h> + #include <sys/un.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) + diff --git a/meta/recipes-core/systemd/systemd/0004-rules-whitelist-hd-devices.patch b/meta/recipes-core/systemd/systemd/0004-rules-whitelist-hd-devices.patch new file mode 100644 index 0000000000..f9c5996ffb --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0004-rules-whitelist-hd-devices.patch @@ -0,0 +1,34 @@ +From dc0a6a9fe4da9738efaba942233ad39da625a918 Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Thu, 21 Feb 2019 16:28:21 +0800 +Subject: [PATCH 4/5] rules: whitelist hd* devices + +qemu by default emulates IDE and the linux-yocto kernel(s) use +CONFIG_IDE instead of the more modern libsata, so disks appear as +/dev/hd*. Patch rejected upstream because CONFIG_IDE is deprecated. + +Upstream-Status: Denied [https://github.com/systemd/systemd/pull/1276] + +Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> +Signed-off-by: Khem Raj <raj.khem@gmail.com> +[rebased for systemd 241] +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +[rebased for systemd 243] +Signed-off-by: Scott Murray <scott.murray@konsulko.com> +--- + rules/60-persistent-storage.rules | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/rules/60-persistent-storage.rules b/rules/60-persistent-storage.rules +index 7802b1c94f..c0534ae26a 100644 +--- a/rules/60-persistent-storage.rules ++++ b/rules/60-persistent-storage.rules +@@ -7,7 +7,7 @@ ACTION=="remove", GOTO="persistent_storage_end" + ENV{UDEV_DISABLE_PERSISTENT_STORAGE_RULES_FLAG}=="1", GOTO="persistent_storage_end" + + SUBSYSTEM!="block", GOTO="persistent_storage_end" +-KERNEL!="loop*|mmcblk*[0-9]|msblk*[0-9]|mspblk*[0-9]|nvme*|sd*|sr*|vd*|xvd*|bcache*|cciss*|dasd*|ubd*|ubi*|scm*|pmem*|nbd*|zd*", GOTO="persistent_storage_end" ++KERNEL!="loop*|mmcblk*[0-9]|msblk*[0-9]|mspblk*[0-9]|nvme*|sd*|sr*|vd*|xvd*|bcache*|cciss*|dasd*|ubd*|ubi*|scm*|pmem*|nbd*|zd*|hd*", GOTO="persistent_storage_end" + + # ignore partitions that span the entire disk + TEST=="whole_disk", GOTO="persistent_storage_end" diff --git a/meta/recipes-core/systemd/systemd/0004-src-shared-cpu-set-util.h-add-__cpu_mask-definition.patch b/meta/recipes-core/systemd/systemd/0004-src-shared-cpu-set-util.h-add-__cpu_mask-definition.patch new file mode 100644 index 0000000000..0f75e8c12d --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0004-src-shared-cpu-set-util.h-add-__cpu_mask-definition.patch @@ -0,0 +1,54 @@ +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 27812dfd59..f698f9df83 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 a710db5370..d1601ad929 100644 +--- a/src/test/test-sizeof.c ++++ b/src/test/test-sizeof.c +@@ -1,6 +1,5 @@ + /* SPDX-License-Identifier: LGPL-2.1+ */ + +-#include <sched.h> + #include <stdio.h> + #include <string.h> + +@@ -8,6 +7,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. */ diff --git a/meta/recipes-core/systemd/systemd/0005-binfmt-Don-t-install-dependency-links-at-install-tim.patch b/meta/recipes-core/systemd/systemd/0005-binfmt-Don-t-install-dependency-links-at-install-tim.patch deleted file mode 100644 index f69e26ec5c..0000000000 --- a/meta/recipes-core/systemd/systemd/0005-binfmt-Don-t-install-dependency-links-at-install-tim.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 3436b12d40bf4f4ab7e3e16600e5f6c35a470da4 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Fri, 20 Feb 2015 05:03:44 +0000 -Subject: [PATCH 05/36] binfmt: Don't install dependency links at install time - for the binfmt services - -use [Install] blocks so that they get created when the service is enabled -like a traditional service. - -The [Install] blocks were rejected upstream as they don't have a way to -"enable" -it on install without static symlinks which can't be disabled, only -masked. We -however can do that in a postinst. - -Upstream-Status: Denied - -Signed-off-by: Ross Burton <ross.burton@intel.com> -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- - Makefile.am | 4 ---- - units/proc-sys-fs-binfmt_misc.automount | 3 +++ - units/systemd-binfmt.service.in | 5 +++++ - 3 files changed, 8 insertions(+), 4 deletions(-) - -diff --git a/Makefile.am b/Makefile.am -index 03341fc..629740f 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -4387,10 +4387,6 @@ INSTALL_DIRS += \ - $(prefix)/lib/binfmt.d \ - $(sysconfdir)/binfmt.d - --SYSINIT_TARGET_WANTS += \ -- systemd-binfmt.service \ -- proc-sys-fs-binfmt_misc.automount -- - endif - - EXTRA_DIST += \ -diff --git a/units/proc-sys-fs-binfmt_misc.automount b/units/proc-sys-fs-binfmt_misc.automount -index 6be3893..709adef 100644 ---- a/units/proc-sys-fs-binfmt_misc.automount -+++ b/units/proc-sys-fs-binfmt_misc.automount -@@ -16,3 +16,6 @@ ConditionPathIsReadWrite=/proc/sys/ - - [Automount] - Where=/proc/sys/fs/binfmt_misc -+ -+[Install] -+WantedBy=sysinit.target -diff --git a/units/systemd-binfmt.service.in b/units/systemd-binfmt.service.in -index d53073e..8c57ee0 100644 ---- a/units/systemd-binfmt.service.in -+++ b/units/systemd-binfmt.service.in -@@ -11,6 +11,8 @@ Documentation=man:systemd-binfmt.service(8) man:binfmt.d(5) - Documentation=https://www.kernel.org/doc/Documentation/binfmt_misc.txt - DefaultDependencies=no - Conflicts=shutdown.target -+Wants=proc-sys-fs-binfmt_misc.automount -+ - After=proc-sys-fs-binfmt_misc.automount - Before=sysinit.target shutdown.target - ConditionPathIsReadWrite=/proc/sys/ -@@ -25,3 +27,6 @@ Type=oneshot - RemainAfterExit=yes - ExecStart=@rootlibexecdir@/systemd-binfmt - TimeoutSec=90s -+ -+[Install] -+WantedBy=sysinit.target --- -1.8.3.1 - diff --git a/meta/recipes-core/systemd/systemd/0005-rules-watch-metadata-changes-in-ide-devices.patch b/meta/recipes-core/systemd/systemd/0005-rules-watch-metadata-changes-in-ide-devices.patch new file mode 100644 index 0000000000..96175b5b5e --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0005-rules-watch-metadata-changes-in-ide-devices.patch @@ -0,0 +1,45 @@ +From d1bccc721dd8f43fee29c5df0e9b78345e69f4b6 Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Thu, 21 Feb 2019 16:38:38 +0800 +Subject: [PATCH 5/5] rules: watch metadata changes in ide devices + +Formatting IDE storage does not trigger "change" uevents. As a result +clients using udev API don't get any updates afterwards and get outdated +information about the device. +... +root@qemux86-64:~# mkfs.ext4 -F /dev/hda1 +Creating filesystem with 262144 4k blocks and 65536 inodes +Filesystem UUID: 98791eb2-2bf3-47ad-b4d8-4cf7e914eee2 + +root@qemux86-64:~# ls /dev/disk/by-uuid/98791eb2-2bf3-47ad-b4d8-4cf7e914eee2 +ls: cannot access '/dev/disk/by-uuid/98791eb2-2bf3-47ad-b4d8-4cf7e914eee2': No such file or directory +... +Include hd* in a match for watch option assignment. + +Upstream-Status: Denied + +qemu by default emulates IDE and the linux-yocto kernel(s) use +CONFIG_IDE instead of the more modern libsata, so disks appear as +/dev/hd*. A similar patch rejected by upstream because CONFIG_IDE +is deprecated. + +Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> +[rebased for systemd 241] +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +[rebased for systemd 243] +Signed-off-by: Scott Murray <scott.murray@konsulko.com> +--- + rules/60-block.rules | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/rules/60-block.rules b/rules/60-block.rules +index 3134ab995e..cd72a494a1 100644 +--- a/rules/60-block.rules ++++ b/rules/60-block.rules +@@ -9,5 +9,5 @@ ACTION=="change", SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST=="block", + + # watch metadata changes, caused by tools closing the device node which was opened for writing + ACTION!="remove", SUBSYSTEM=="block", \ +- KERNEL=="loop*|mmcblk*[0-9]|msblk*[0-9]|mspblk*[0-9]|nvme*|sd*|vd*|xvd*|bcache*|cciss*|dasd*|ubd*|ubi*|scm*|pmem*|nbd*|zd*", \ ++ KERNEL=="loop*|mmcblk*[0-9]|msblk*[0-9]|mspblk*[0-9]|nvme*|sd*|vd*|xvd*|bcache*|cciss*|dasd*|ubd*|ubi*|scm*|pmem*|nbd*|zd*|hd*", \ + OPTIONS+="watch" diff --git a/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch b/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch new file mode 100644 index 0000000000..adfc3b7861 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0005-src-basic-missing.h-check-for-missing-strndupa.patch @@ -0,0 +1,442 @@ +From 399fd3eda3045636a70da438a0fd1406cc332ed1 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 05/24] 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> +--- + meson.build | 1 + + src/backlight/backlight.c | 1 + + src/basic/env-util.c | 1 + + src/basic/missing_stdlib.h | 12 ++++++++++++ + src/basic/mkdir.c | 1 + + src/basic/parse-util.c | 1 + + src/basic/proc-cmdline.c | 1 + + src/basic/procfs-util.c | 1 + + src/basic/time-util.c | 1 + + src/core/dbus-cgroup.c | 1 + + src/core/dbus-util.c | 1 + + src/core/kmod-setup.c | 1 + + src/core/service.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/test-bus-benchmark.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/shared/dns-domain.c | 1 + + src/shared/journal-importer.c | 1 + + src/shared/logs-show.c | 1 + + src/shared/pager.c | 1 + + src/shared/path-lookup.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 + + 32 files changed, 43 insertions(+) + +diff --git a/meson.build b/meson.build +index 7f8c679411..81c061b768 100644 +--- a/meson.build ++++ b/meson.build +@@ -506,6 +506,7 @@ foreach ident : [ + #include <unistd.h>'''], + ['get_mempolicy', '''#include <stdlib.h> + #include <unistd.h>'''], ++ ['strndupa' , '''#include <string.h>'''], + ] + + have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE') +diff --git a/src/backlight/backlight.c b/src/backlight/backlight.c +index dfd6805398..c2b2ace6ec 100644 +--- a/src/backlight/backlight.c ++++ b/src/backlight/backlight.c +@@ -17,6 +17,7 @@ + #include "string-util.h" + #include "strv.h" + #include "util.h" ++#include "missing.h" + + static int find_pci_or_platform_parent(sd_device *device, sd_device **ret) { + const char *subsystem, *sysname, *value; +diff --git a/src/basic/env-util.c b/src/basic/env-util.c +index a6503cf2b6..ceef9a62c8 100644 +--- a/src/basic/env-util.c ++++ b/src/basic/env-util.c +@@ -16,6 +16,7 @@ + #include "string-util.h" + #include "strv.h" + #include "utf8.h" ++#include "missing.h" + + #define VALID_CHARS_ENV_NAME \ + DIGITS LETTERS \ +diff --git a/src/basic/missing_stdlib.h b/src/basic/missing_stdlib.h +index 188a8d4406..1e16ec287a 100644 +--- 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 +diff --git a/src/basic/mkdir.c b/src/basic/mkdir.c +index 6b82eab640..51c6b78615 100644 +--- a/src/basic/mkdir.c ++++ b/src/basic/mkdir.c +@@ -14,6 +14,7 @@ + #include "stat-util.h" + #include "stdio-util.h" + #include "user-util.h" ++#include "missing.h" + + int mkdir_safe_internal(const char *path, mode_t mode, uid_t uid, gid_t gid, MkdirFlags flags, mkdir_func_t _mkdir) { + struct stat st; +diff --git a/src/basic/parse-util.c b/src/basic/parse-util.c +index 115a1494a2..07a34bfd53 100644 +--- a/src/basic/parse-util.c ++++ b/src/basic/parse-util.c +@@ -20,6 +20,7 @@ + #include "process-util.h" + #include "stat-util.h" + #include "string-util.h" ++#include "missing.h" + + int parse_boolean(const char *v) { + if (!v) +diff --git a/src/basic/proc-cmdline.c b/src/basic/proc-cmdline.c +index 09169cf963..f411ba897f 100644 +--- 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.h" + + int proc_cmdline(char **ret) { + const char *e; +diff --git a/src/basic/procfs-util.c b/src/basic/procfs-util.c +index 7aaf95bfce..42ce53d5aa 100644 +--- a/src/basic/procfs-util.c ++++ b/src/basic/procfs-util.c +@@ -11,6 +11,7 @@ + #include "procfs-util.h" + #include "stdio-util.h" + #include "string-util.h" ++#include "missing.h" + + int procfs_tasks_get_limit(uint64_t *ret) { + _cleanup_free_ char *value = NULL; +diff --git a/src/basic/time-util.c b/src/basic/time-util.c +index 3018e81acb..4e2b3b66c1 100644 +--- a/src/basic/time-util.c ++++ b/src/basic/time-util.c +@@ -28,6 +28,7 @@ + #include "string-util.h" + #include "strv.h" + #include "time-util.h" ++#include "missing.h" + + static clockid_t map_clock_id(clockid_t c) { + +diff --git a/src/core/dbus-cgroup.c b/src/core/dbus-cgroup.c +index 2f2313c599..c9937f9d62 100644 +--- a/src/core/dbus-cgroup.c ++++ b/src/core/dbus-cgroup.c +@@ -15,6 +15,7 @@ + #include "fileio.h" + #include "limits-util.h" + #include "path-util.h" ++#include "missing.h" + + static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_cgroup_device_policy, cgroup_device_policy, CGroupDevicePolicy); + +diff --git a/src/core/dbus-util.c b/src/core/dbus-util.c +index 7862beaacb..19f6968cfe 100644 +--- a/src/core/dbus-util.c ++++ b/src/core/dbus-util.c +@@ -7,6 +7,7 @@ + #include "unit-printf.h" + #include "user-util.h" + #include "unit.h" ++#include "missing.h" + + int bus_property_get_triggered_unit( + sd_bus *bus, +diff --git a/src/core/kmod-setup.c b/src/core/kmod-setup.c +index a91cfebc67..a45961013f 100644 +--- a/src/core/kmod-setup.c ++++ b/src/core/kmod-setup.c +@@ -11,6 +11,7 @@ + #include "kmod-setup.h" + #include "macro.h" + #include "string-util.h" ++#include "missing.h" + + #if HAVE_KMOD + #include <libkmod.h> +diff --git a/src/core/service.c b/src/core/service.c +index 73b3c9c316..ef74f00a08 100644 +--- a/src/core/service.c ++++ b/src/core/service.c +@@ -43,6 +43,7 @@ + #include "unit.h" + #include "utf8.h" + #include "util.h" ++#include "missing.h" + + static const UnitActiveState state_translation_table[_SERVICE_STATE_MAX] = { + [SERVICE_DEAD] = UNIT_INACTIVE, +diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c +index 6d6bb1cf63..6666349a35 100644 +--- a/src/journal/journalctl.c ++++ b/src/journal/journalctl.c +@@ -70,6 +70,7 @@ + #include "unit-name.h" + #include "user-util.h" + #include "varlink.h" ++#include "missing.h" + + #define DEFAULT_FSS_INTERVAL_USEC (15*USEC_PER_MINUTE) + +diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c +index eb029e4453..f31fe9d5a8 100644 +--- a/src/libsystemd/sd-bus/bus-message.c ++++ b/src/libsystemd/sd-bus/bus-message.c +@@ -21,6 +21,7 @@ + #include "strv.h" + #include "time-util.h" + #include "utf8.h" ++#include "missing.h" + + static int message_append_basic(sd_bus_message *m, char type, const void *p, const void **stored); + +diff --git a/src/libsystemd/sd-bus/bus-objects.c b/src/libsystemd/sd-bus/bus-objects.c +index ae643cacc7..1b752271a5 100644 +--- a/src/libsystemd/sd-bus/bus-objects.c ++++ b/src/libsystemd/sd-bus/bus-objects.c +@@ -13,6 +13,7 @@ + #include "set.h" + #include "string-util.h" + #include "strv.h" ++#include "missing.h" + + static int node_vtable_get_userdata( + sd_bus *bus, +diff --git a/src/libsystemd/sd-bus/test-bus-benchmark.c b/src/libsystemd/sd-bus/test-bus-benchmark.c +index 8de0a859ee..4fd0a2e692 100644 +--- a/src/libsystemd/sd-bus/test-bus-benchmark.c ++++ b/src/libsystemd/sd-bus/test-bus-benchmark.c +@@ -14,6 +14,7 @@ + #include "missing_resource.h" + #include "time-util.h" + #include "util.h" ++#include "missing.h" + + #define MAX_SIZE (2*1024*1024) + +diff --git a/src/locale/keymap-util.c b/src/locale/keymap-util.c +index f8c36c94f5..41f5606aea 100644 +--- a/src/locale/keymap-util.c ++++ b/src/locale/keymap-util.c +@@ -22,6 +22,7 @@ + #include "string-util.h" + #include "strv.h" + #include "tmpfile-util.h" ++#include "missing.h" + + static bool startswith_comma(const char *s, const char *prefix) { + s = startswith(s, prefix); +diff --git a/src/login/pam_systemd.c b/src/login/pam_systemd.c +index 3f762cbbc3..005cfea658 100644 +--- a/src/login/pam_systemd.c ++++ b/src/login/pam_systemd.c +@@ -28,6 +28,7 @@ + #include "hostname-util.h" + #include "login-util.h" + #include "macro.h" ++#include "missing.h" + #include "parse-util.h" + #include "path-util.h" + #include "process-util.h" +diff --git a/src/network/generator/network-generator.c b/src/network/generator/network-generator.c +index 0b5af33566..9c808cd014 100644 +--- 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.h" + + /* + # .network +diff --git a/src/nspawn/nspawn-settings.c b/src/nspawn/nspawn-settings.c +index 3a99736813..279fea4d88 100644 +--- a/src/nspawn/nspawn-settings.c ++++ b/src/nspawn/nspawn-settings.c +@@ -16,6 +16,7 @@ + #include "strv.h" + #include "user-util.h" + #include "util.h" ++#include "missing.h" + + Settings *settings_new(void) { + Settings *s; +diff --git a/src/shared/dns-domain.c b/src/shared/dns-domain.c +index f62ad0a0f5..f1a27e158d 100644 +--- a/src/shared/dns-domain.c ++++ b/src/shared/dns-domain.c +@@ -24,6 +24,7 @@ + #include "string-util.h" + #include "strv.h" + #include "utf8.h" ++#include "missing.h" + + int dns_label_unescape(const char **name, char *dest, size_t sz, DNSLabelFlags flags) { + const char *n; +diff --git a/src/shared/journal-importer.c b/src/shared/journal-importer.c +index 7c4fc7021d..a6ff2214df 100644 +--- a/src/shared/journal-importer.c ++++ b/src/shared/journal-importer.c +@@ -14,6 +14,7 @@ + #include "parse-util.h" + #include "string-util.h" + #include "unaligned.h" ++#include "missing.h" + + enum { + IMPORTER_STATE_LINE = 0, /* waiting to read, or reading line */ +diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c +index b615c70dff..75b26e9c21 100644 +--- a/src/shared/logs-show.c ++++ b/src/shared/logs-show.c +@@ -39,6 +39,7 @@ + #include "time-util.h" + #include "utf8.h" + #include "util.h" ++#include "missing.h" + + /* up to three lines (each up to 100 characters) or 300 characters, whichever is less */ + #define PRINT_LINE_THRESHOLD 3 +diff --git a/src/shared/pager.c b/src/shared/pager.c +index 7c20b100b4..e4209d3a95 100644 +--- a/src/shared/pager.c ++++ b/src/shared/pager.c +@@ -25,6 +25,7 @@ + #include "strv.h" + #include "terminal-util.h" + #include "util.h" ++#include "missing.h" + + static pid_t pager_pid = 0; + +diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c +index 6bf0ff0316..f6c8009cd2 100644 +--- a/src/shared/path-lookup.c ++++ b/src/shared/path-lookup.c +@@ -20,6 +20,7 @@ + #include "tmpfile-util.h" + #include "user-util.h" + #include "util.h" ++#include "missing.h" + + int xdg_user_runtime_dir(char **ret, const char *suffix) { + const char *e; +diff --git a/src/shared/uid-range.c b/src/shared/uid-range.c +index 7cb7d8a477..8b12b91084 100644 +--- a/src/shared/uid-range.c ++++ b/src/shared/uid-range.c +@@ -9,6 +9,7 @@ + #include "sort-util.h" + #include "uid-range.h" + #include "user-util.h" ++#include "missing.h" + + static bool uid_range_intersect(UidRange *range, uid_t start, uid_t nr) { + assert(range); +diff --git a/src/socket-proxy/socket-proxyd.c b/src/socket-proxy/socket-proxyd.c +index abbbc9f2d6..6179b5851e 100644 +--- a/src/socket-proxy/socket-proxyd.c ++++ b/src/socket-proxy/socket-proxyd.c +@@ -28,6 +28,7 @@ + #include "socket-util.h" + #include "string-util.h" + #include "util.h" ++#include "missing.h" + + #define BUFFER_SIZE (256 * 1024) + +diff --git a/src/test/test-hexdecoct.c b/src/test/test-hexdecoct.c +index 52217429b1..a05e7782f6 100644 +--- a/src/test/test-hexdecoct.c ++++ b/src/test/test-hexdecoct.c +@@ -6,6 +6,7 @@ + #include "hexdecoct.h" + #include "macro.h" + #include "string-util.h" ++#include "missing.h" + + static void test_hexchar(void) { + assert_se(hexchar(0xa) == 'a'); +diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c +index e8f1ce1354..8693cb02a4 100644 +--- a/src/udev/udev-builtin-path_id.c ++++ b/src/udev/udev-builtin-path_id.c +@@ -23,6 +23,7 @@ + #include "strv.h" + #include "sysexits.h" + #include "udev-builtin.h" ++#include "missing.h" + + _printf_(2,3) + static void path_prepend(char **path, const char *fmt, ...) { +diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c +index 8cfa2cdf23..b0670c77ec 100644 +--- 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.h" + + typedef struct Spawn { + sd_device *device; +diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c +index 1642f10535..fe2aa75478 100644 +--- a/src/udev/udev-rules.c ++++ b/src/udev/udev-rules.c +@@ -28,6 +28,7 @@ + #include "udev-event.h" + #include "udev-rules.h" + #include "user-util.h" ++#include "missing.h" + + #define RULES_DIRS (const char* const*) CONF_PATHS_STRV("udev/rules.d") + diff --git a/meta/recipes-core/systemd/systemd/0006-Include-netinet-if_ether.h.patch b/meta/recipes-core/systemd/systemd/0006-Include-netinet-if_ether.h.patch new file mode 100644 index 0000000000..6d73d715ce --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0006-Include-netinet-if_ether.h.patch @@ -0,0 +1,227 @@ +Include netinet/if_ether.h + +Fixes +/path/to/systemd/recipe-sysroot/usr/include/netinet/if_ether.h:101:8: error: redefinition of 'struct ethhdr' + struct ethhdr { + ^~~~~~ + +and related arphdr, arpreq, and arpreq_old errors +/path/to/systemd/recipe-sysroot/usr/include/net/if_arp.h:22:8: error: redefinition of 'struct arphdr' + struct arphdr { + ^~~~~~ + +The latter requires removing some includes of net/if_arp.h to avoid +conflicting with netinet/if_ether.h. + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +[rebased for systemd 243] +Signed-off-by: Scott Murray <scott.murray@konsulko.com> + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +[rebased for systemd 243] +Signed-off-by: Scott Murray <scott.murray@konsulko.com> +--- + src/libsystemd-network/sd-dhcp6-client.c | 1 - + src/libsystemd/sd-netlink/netlink-types.c | 1 + + src/machine/machine-dbus.c | 1 + + src/network/netdev/macsec.c | 1 + + src/network/netdev/netdev.c | 1 + + src/network/networkd-brvlan.c | 1 + + src/network/networkd-dhcp-common.c | 1 + + src/network/networkd-dhcp4.c | 2 +- + src/network/networkd-dhcp6.c | 2 +- + src/network/networkd-link.c | 2 +- + src/network/networkd-network.c | 1 + + src/shared/ethtool-util.c | 1 + + src/shared/ethtool-util.h | 1 + + src/udev/net/link-config.c | 1 + + src/udev/udev-builtin-net_setup_link.c | 1 + + 15 files changed, 14 insertions(+), 4 deletions(-) + +diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c +index d7a5349c70..68b41dfb6c 100644 +--- a/src/libsystemd-network/sd-dhcp6-client.c ++++ b/src/libsystemd-network/sd-dhcp6-client.c +@@ -6,7 +6,6 @@ + #include <errno.h> + #include <string.h> + #include <sys/ioctl.h> +-#include <linux/if_arp.h> + #include <linux/if_infiniband.h> + + #include "sd-dhcp6-client.h" +diff --git a/src/libsystemd/sd-netlink/netlink-types.c b/src/libsystemd/sd-netlink/netlink-types.c +index de9b8b21ab..f64f6500f7 100644 +--- a/src/libsystemd/sd-netlink/netlink-types.c ++++ b/src/libsystemd/sd-netlink/netlink-types.c +@@ -3,6 +3,7 @@ + #include <netinet/in.h> + #include <stdint.h> + #include <sys/socket.h> ++#include <netinet/if_ether.h> + #include <linux/can/vxcan.h> + #include <linux/netlink.h> + #include <linux/rtnetlink.h> +diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c +index 0d58b5eb8b..01093c1f62 100644 +--- a/src/machine/machine-dbus.c ++++ b/src/machine/machine-dbus.c +@@ -4,6 +4,7 @@ + #include <string.h> + #include <sys/mount.h> + #include <sys/wait.h> ++#include <netinet/if_ether.h> + + /* When we include libgen.h because we need dirname() we immediately + * undefine basename() since libgen.h defines it as a macro to the POSIX +diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c +index cf281e75a6..269dc618ff 100644 +--- a/src/network/netdev/macsec.c ++++ b/src/network/netdev/macsec.c +@@ -1,5 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1+ */ + ++#include <netinet/if_ether.h> + #include <netinet/in.h> + #include <linux/if_ether.h> + #include <linux/if_macsec.h> +diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c +index 7735b455b7..ed4eda4a44 100644 +--- a/src/network/netdev/netdev.c ++++ b/src/network/netdev/netdev.c +@@ -1,5 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1+ */ + ++#include <netinet/if_ether.h> + #include <net/if.h> + #include <netinet/in.h> + +diff --git a/src/network/networkd-brvlan.c b/src/network/networkd-brvlan.c +index c3c5d535ac..ebea408c89 100644 +--- a/src/network/networkd-brvlan.c ++++ b/src/network/networkd-brvlan.c +@@ -4,6 +4,7 @@ + ***/ + + #include <netinet/in.h> ++#include <netinet/if_ether.h> + #include <linux/if_bridge.h> + #include <stdbool.h> + +diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c +index 626b975839..42fe92f320 100644 +--- a/src/network/networkd-dhcp-common.c ++++ b/src/network/networkd-dhcp-common.c +@@ -1,6 +1,7 @@ + /* SPDX-License-Identifier: LGPL-2.1+ */ + + #include "networkd-dhcp-common.h" ++#include <netinet/if_ether.h> + #include "networkd-network.h" + #include "parse-util.h" + #include "string-table.h" +diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c +index 662770b50e..c6ab62a94d 100644 +--- a/src/network/networkd-dhcp4.c ++++ b/src/network/networkd-dhcp4.c +@@ -1,8 +1,8 @@ + /* SPDX-License-Identifier: LGPL-2.1+ */ + ++#include <netinet/if_ether.h> + #include <netinet/in.h> + #include <linux/if.h> +-#include <linux/if_arp.h> + + #include "alloc-util.h" + #include "hostname-util.h" +diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c +index 8ad736a82b..f41b4d834e 100644 +--- a/src/network/networkd-dhcp6.c ++++ b/src/network/networkd-dhcp6.c +@@ -3,9 +3,9 @@ + Copyright © 2014 Intel Corporation. All rights reserved. + ***/ + ++#include <netinet/if_ether.h> + #include <netinet/in.h> + #include <linux/if.h> +-#include <linux/if_arp.h> + #include "sd-radv.h" + + #include "sd-dhcp6-client.h" +diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c +index f5bb78890a..f13a36b791 100644 +--- a/src/network/networkd-link.c ++++ b/src/network/networkd-link.c +@@ -1,8 +1,8 @@ + /* SPDX-License-Identifier: LGPL-2.1+ */ + ++#include <netinet/if_ether.h> + #include <netinet/in.h> + #include <linux/if.h> +-#include <linux/if_arp.h> + #include <unistd.h> + + #include "alloc-util.h" +diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c +index 2b8d0eb2fb..2f79ef25cd 100644 +--- a/src/network/networkd-network.c ++++ b/src/network/networkd-network.c +@@ -1,5 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1+ */ + ++#include <netinet/if_ether.h> + #include <net/if.h> + #include <netinet/in.h> + #include <linux/netdevice.h> +diff --git a/src/shared/ethtool-util.c b/src/shared/ethtool-util.c +index b0961df72e..53fcbbd84b 100644 +--- a/src/shared/ethtool-util.c ++++ b/src/shared/ethtool-util.c +@@ -1,5 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1+ */ + ++#include <netinet/if_ether.h> + #include <net/if.h> + #include <sys/ioctl.h> + #include <linux/ethtool.h> +diff --git a/src/shared/ethtool-util.h b/src/shared/ethtool-util.h +index 8b32b243f3..262b819976 100644 +--- a/src/shared/ethtool-util.h ++++ b/src/shared/ethtool-util.h +@@ -2,6 +2,7 @@ + #pragma once + + #include <macro.h> ++#include <netinet/if_ether.h> + #include <linux/ethtool.h> + + #include "conf-parser.h" +diff --git a/src/udev/net/link-config.c b/src/udev/net/link-config.c +index d44af64d5e..fd052f1591 100644 +--- a/src/udev/net/link-config.c ++++ b/src/udev/net/link-config.c +@@ -1,5 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1+ */ + ++#include <netinet/if_ether.h> + #include <linux/netdevice.h> + #include <netinet/ether.h> + +diff --git a/src/udev/udev-builtin-net_setup_link.c b/src/udev/udev-builtin-net_setup_link.c +index ee3ca9fa38..9aa4e82874 100644 +--- a/src/udev/udev-builtin-net_setup_link.c ++++ b/src/udev/udev-builtin-net_setup_link.c +@@ -1,5 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1+ */ + ++#include <netinet/if_ether.h> + #include "device-util.h" + #include "alloc-util.h" + #include "link-config.h" diff --git a/meta/recipes-core/systemd/systemd/0006-configure-Check-for-additional-features-that-uclibc-.patch b/meta/recipes-core/systemd/systemd/0006-configure-Check-for-additional-features-that-uclibc-.patch deleted file mode 100644 index 0d63755731..0000000000 --- a/meta/recipes-core/systemd/systemd/0006-configure-Check-for-additional-features-that-uclibc-.patch +++ /dev/null @@ -1,48 +0,0 @@ -From bb6f1d8a000b337280541afde7cccdcfe03cdeb1 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Fri, 20 Feb 2015 05:05:45 +0000 -Subject: [PATCH 06/36] configure: Check for additional features that uclibc - doesnt support - -This helps in supporting uclibc which does not have all features that -glibc might have - -Upstream-Status: Denied [no desire for uclibc support] - -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- - configure.ac | 18 ++++++++++++++++++ - 1 file changed, 18 insertions(+) - -diff --git a/configure.ac b/configure.ac -index f51533c..0239fd0 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -112,6 +112,24 @@ AC_PATH_PROG([UMOUNT_PATH], [umount], [/usr/bin/umount], [$PATH:/usr/sbin:/sbin] - - AS_IF([! ln --relative --help > /dev/null 2>&1], [AC_MSG_ERROR([*** ln doesn't support --relative ***])]) - -+# check for few functions not implemented in uClibc -+ -+AC_CHECK_FUNCS_ONCE(mkostemp execvpe posix_fallocate) -+ -+# check for %ms format support - assume always no if cross compiling -+ -+AC_MSG_CHECKING([whether %ms format is supported by *scanf]) -+ -+AC_LINK_IFELSE( -+ [AC_LANG_PROGRAM([ -+ #include <stdio.h> -+ ],[ -+ char *buf1, *buf2, *buf3, str="1 2.3 abcde" ; -+ int rc = sscanf(str, "%ms %ms %ms", &buf1, &buf2, &buf3) ; -+ return (rc==3)?0:1;])], -+ [AC_DEFINE([HAVE_MSFORMAT], [1], [Define if %ms format is supported by *scanf.])], -+ [AC_MSG_RESULT([no])]) -+ - M4_DEFINES= - - AC_CHECK_TOOL(OBJCOPY, objcopy) --- -1.8.3.1 - diff --git a/meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not.patch b/meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not.patch new file mode 100644 index 0000000000..34f7f5fb74 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not.patch @@ -0,0 +1,153 @@ +From f8a239b182158ca0a537ba053cb0e6bad9c3a2fb 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 07/24] 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(+) + +diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c +index b335af8d97..2cdfc11f16 100644 +--- a/src/basic/glob-util.c ++++ b/src/basic/glob-util.c +@@ -14,6 +14,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); + } +@@ -21,6 +27,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)); + +@@ -34,9 +41,14 @@ int safe_glob(const char *path, int flags, glob_t *pglob) { + 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) +diff --git a/src/test/test-glob-util.c b/src/test/test-glob-util.c +index b4f41445fe..f0d474ed14 100644 +--- a/src/test/test-glob-util.c ++++ b/src/test/test-glob-util.c +@@ -13,6 +13,12 @@ + #include "rm-rf.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 ++ + static void test_glob_exists(void) { + char name[] = "/tmp/test-glob_exists.XXXXXX"; + int fd = -1; +@@ -40,11 +46,13 @@ static void test_glob_no_dot(void) { + 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 @@ static void test_glob_no_dot(void) { + 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); +diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c +index 3c30612af1..14bc428085 100644 +--- a/src/tmpfiles/tmpfiles.c ++++ b/src/tmpfiles/tmpfiles.c +@@ -63,6 +63,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 +@@ -1853,7 +1859,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; +@@ -1873,7 +1881,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 = { ++#ifdef GLOB_ALTDIRFUNC + .gl_opendir = (void *(*)(const char *)) opendir_nomod, ++#endif + }; + int r = 0, k; + char **fn; diff --git a/meta/recipes-core/systemd/systemd/0007-use-lnr-wrapper-instead-of-looking-for-relative-opti.patch b/meta/recipes-core/systemd/systemd/0007-use-lnr-wrapper-instead-of-looking-for-relative-opti.patch deleted file mode 100644 index 12f6ace93d..0000000000 --- a/meta/recipes-core/systemd/systemd/0007-use-lnr-wrapper-instead-of-looking-for-relative-opti.patch +++ /dev/null @@ -1,61 +0,0 @@ -From fa5e137fbd2fb081ae897575377d718ee8cb6349 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Sun, 20 Dec 2015 04:20:28 +0000 -Subject: [PATCH 07/36] use lnr wrapper instead of looking for --relative - option for ln - -Upstream-Status: Inappropriate [OE-Specific] - -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- - Makefile.am | 6 +++--- - configure.ac | 2 -- - 2 files changed, 3 insertions(+), 5 deletions(-) - -diff --git a/Makefile.am b/Makefile.am -index 629740f..82b6553 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -243,7 +243,7 @@ define move-to-rootlibdir - $(MKDIR_P) $(DESTDIR)$(rootlibdir) && \ - so_img_name=$$(readlink $(DESTDIR)$(libdir)/$$libname) && \ - rm -f $(DESTDIR)$(libdir)/$$libname && \ -- $(LN_S) --relative -f $(DESTDIR)$(rootlibdir)/$$so_img_name $(DESTDIR)$(libdir)/$$libname && \ -+ lnr $(DESTDIR)$(rootlibdir)/$$so_img_name $(DESTDIR)$(libdir)/$$libname && \ - mv $(DESTDIR)$(libdir)/$$libname.* $(DESTDIR)$(rootlibdir); \ - fi - endef -@@ -317,7 +317,7 @@ define install-relative-aliases - while [ -n "$$1" ]; do \ - $(MKDIR_P) `dirname $(DESTDIR)$$dir/$$2` && \ - rm -f $(DESTDIR)$$dir/$$2 && \ -- $(LN_S) --relative $(DESTDIR)$$1 $(DESTDIR)$$dir/$$2 && \ -+ lnr $(DESTDIR)$$1 $(DESTDIR)$$dir/$$2 && \ - shift 2 || exit $$?; \ - done - endef -@@ -2781,7 +2781,7 @@ systemd_dbus1_generator_LDADD = \ - dbus1-generator-install-hook: - $(AM_V_at)$(MKDIR_P) $(DESTDIR)$(usergeneratordir) - $(AM_V_RM)rm -f $(DESTDIR)$(usergeneratordir)/systemd-dbus1-generator -- $(AM_V_LN)$(LN_S) --relative -f $(DESTDIR)$(systemgeneratordir)/systemd-dbus1-generator $(DESTDIR)$(usergeneratordir)/systemd-dbus1-generator -+ $(AM_V_LN)lnr $(DESTDIR)$(systemgeneratordir)/systemd-dbus1-generator $(DESTDIR)$(usergeneratordir)/systemd-dbus1-generator - - dbus1-generator-uninstall-hook: - rm -f $(DESTDIR)$(usergeneratordir)/systemd-dbus1-generator -diff --git a/configure.ac b/configure.ac -index 0239fd0..c5ab9d0 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -110,8 +110,6 @@ AC_PATH_PROG([SULOGIN], [sulogin], [/usr/sbin/sulogin], [$PATH:/usr/sbin:/sbin]) - AC_PATH_PROG([MOUNT_PATH], [mount], [/usr/bin/mount], [$PATH:/usr/sbin:/sbin]) - AC_PATH_PROG([UMOUNT_PATH], [umount], [/usr/bin/umount], [$PATH:/usr/sbin:/sbin]) - --AS_IF([! ln --relative --help > /dev/null 2>&1], [AC_MSG_ERROR([*** ln doesn't support --relative ***])]) -- - # check for few functions not implemented in uClibc - - AC_CHECK_FUNCS_ONCE(mkostemp execvpe posix_fallocate) --- -1.8.3.1 - diff --git a/meta/recipes-core/systemd/systemd/0008-add-missing-FTW_-macros-for-musl.patch b/meta/recipes-core/systemd/systemd/0008-add-missing-FTW_-macros-for-musl.patch new file mode 100644 index 0000000000..d5f2349f2b --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0008-add-missing-FTW_-macros-for-musl.patch @@ -0,0 +1,47 @@ +From 6cd17c753d2c0a90fc791f69bbc694cbc8556a4f 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 08/24] add missing FTW_ macros for musl + +This is to avoid build failures like below for musl. + + locale-util.c:296:24: error: 'FTW_STOP' undeclared + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +--- + src/basic/missing_type.h | 20 ++++++++++++++++++++ + 1 file changed, 20 insertions(+) + +diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h +index c487e65..23602eb 100644 +--- a/src/basic/missing_type.h ++++ b/src/basic/missing_type.h +@@ -19,3 +19,23 @@ typedef int (*comparison_fn_t)(const void *, const void *); + #define __COMPAR_FN_T + typedef int (*__compar_fn_t)(const void *, const void *); + #endif ++ ++#ifndef FTW_ACTIONRETVAL ++#define FTW_ACTIONRETVAL 16 ++#endif ++ ++#ifndef FTW_CONTINUE ++#define FTW_CONTINUE 0 ++#endif ++ ++#ifndef FTW_STOP ++#define FTW_STOP 1 ++#endif ++ ++#ifndef FTW_SKIP_SUBTREE ++#define FTW_SKIP_SUBTREE 2 ++#endif ++ ++#ifndef FTW_SKIP_SIBLINGS ++#define FTW_SKIP_SIBLINGS 3 ++#endif +-- +2.7.4 + diff --git a/meta/recipes-core/systemd/systemd/0008-nspawn-Use-execvpe-only-when-libc-supports-it.patch b/meta/recipes-core/systemd/systemd/0008-nspawn-Use-execvpe-only-when-libc-supports-it.patch deleted file mode 100644 index 6e6f199ef1..0000000000 --- a/meta/recipes-core/systemd/systemd/0008-nspawn-Use-execvpe-only-when-libc-supports-it.patch +++ /dev/null @@ -1,41 +0,0 @@ -From ae999ff50efb9cc82537adef7696c6f732afcfc8 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Fri, 20 Feb 2015 05:10:37 +0000 -Subject: [PATCH 08/36] nspawn: Use execvpe only when libc supports it - -Upstream-Status: Denied [no desire for uclibc support] - -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- - src/nspawn/nspawn.c | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c -index 5a68fec..65e65ec 100644 ---- a/src/nspawn/nspawn.c -+++ b/src/nspawn/nspawn.c -@@ -111,6 +111,8 @@ typedef enum LinkJournal { - LINK_GUEST - } LinkJournal; - -+#include "config.h" -+ - static char *arg_directory = NULL; - static char *arg_template = NULL; - static char *arg_chdir = NULL; -@@ -2637,7 +2639,12 @@ static int inner_child( - a[0] = (char*) "/sbin/init"; - execve(a[0], a, env_use); - } else if (!strv_isempty(arg_parameters)) -+#ifdef HAVE_EXECVPE - execvpe(arg_parameters[0], arg_parameters, env_use); -+#else -+ environ = env_use; -+ execvp(arg_parameters[0], arg_parameters); -+#endif /* HAVE_EXECVPE */ - else { - if (!arg_chdir) - chdir(home ?: "/root"); --- -1.8.3.1 - diff --git a/meta/recipes-core/systemd/systemd/0009-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch b/meta/recipes-core/systemd/systemd/0009-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch deleted file mode 100644 index 116f3d4de6..0000000000 --- a/meta/recipes-core/systemd/systemd/0009-util-bypass-unimplemented-_SC_PHYS_PAGES-system-conf.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 3498f488b27f90398d7c8d1d06aac5ab684370e8 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Mon, 14 Dec 2015 00:47:53 +0000 -Subject: [PATCH 09/36] util: bypass unimplemented _SC_PHYS_PAGES system - configuration API on uclibc - -Upstream-Status: Inappropriate [uclibc-specific] - -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- - src/basic/util.c | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - -diff --git a/src/basic/util.c b/src/basic/util.c -index ea1bed7..fdaf340 100644 ---- a/src/basic/util.c -+++ b/src/basic/util.c -@@ -767,10 +767,25 @@ uint64_t physical_memory(void) { - /* We return this as uint64_t in case we are running as 32bit - * process on a 64bit kernel with huge amounts of memory */ - -+#ifdef __UCLIBC__ -+ char line[128]; -+ FILE *f = fopen("/proc/meminfo", "r"); -+ if (f == NULL) -+ return 0; -+ while (!feof(f) && fgets(line, sizeof(line)-1, f)) { -+ if (sscanf(line, "MemTotal: %li kB", &mem) == 1) { -+ mem *= 1024; -+ break; -+ } -+ } -+ fclose(f); -+ return (uint64_t) mem; -+#else - mem = sysconf(_SC_PHYS_PAGES); - assert(mem > 0); - - return (uint64_t) mem * (uint64_t) page_size(); -+#endif - } - - int update_reboot_param_file(const char *param) { --- -1.8.3.1 - diff --git a/meta/recipes-core/systemd/systemd/0010-fix-missing-of-__register_atfork-for-non-glibc-build.patch b/meta/recipes-core/systemd/systemd/0010-fix-missing-of-__register_atfork-for-non-glibc-build.patch new file mode 100644 index 0000000000..8bacd0289d --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0010-fix-missing-of-__register_atfork-for-non-glibc-build.patch @@ -0,0 +1,45 @@ +From f1f4b4f9684fed185bfa8b9ed409cdf241657e99 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 10/24] 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 78ce43b..aec2daf 100644 +--- a/src/basic/process-util.c ++++ b/src/basic/process-util.c +@@ -22,6 +22,9 @@ + #if HAVE_VALGRIND_VALGRIND_H + #include <valgrind/valgrind.h> + #endif ++#ifndef __GLIBC__ ++#include <pthread.h> ++#endif + + #include "alloc-util.h" + #include "architecture.h" +@@ -1160,11 +1163,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; +-- +2.7.4 + diff --git a/meta/recipes-core/systemd/systemd/0011-Use-uintmax_t-for-handling-rlim_t.patch b/meta/recipes-core/systemd/systemd/0011-Use-uintmax_t-for-handling-rlim_t.patch new file mode 100644 index 0000000000..d6eda9c038 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0011-Use-uintmax_t-for-handling-rlim_t.patch @@ -0,0 +1,97 @@ +From e3f847bd0338d27aff3335b42661d8a4b66b965e 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 11/24] Use uintmax_t for handling rlim_t + +PRIu{32,64} is not right format to represent rlim_t type +therefore use %ju and typecast the rlim_t variables to +uintmax_t. + +Fixes portablility errors like + +execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=] +| fprintf(f, "%s%s: " RLIM_FMT "\n", +| ^~~~~~~~ +| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max); +| ~~~~~~~~~~~~~~~~~~~~~~ + +Upstream-Status: Denied [https://github.com/systemd/systemd/pull/7199] + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +[Rebased for v241] +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +--- + src/basic/format-util.h | 8 +------- + src/basic/rlimit-util.c | 10 +++++----- + src/core/execute.c | 4 ++-- + 3 files changed, 8 insertions(+), 14 deletions(-) + +diff --git a/src/basic/format-util.h b/src/basic/format-util.h +index dece5d3..dbb87bc 100644 +--- a/src/basic/format-util.h ++++ b/src/basic/format-util.h +@@ -42,13 +42,7 @@ + # define PRI_TIMEX "li" + #endif + +-#if SIZEOF_RLIM_T == 8 +-# define RLIM_FMT "%" PRIu64 +-#elif SIZEOF_RLIM_T == 4 +-# define RLIM_FMT "%" PRIu32 +-#else +-# error Unknown rlim_t size +-#endif ++#define RLIM_FMT "%ju" + + #if SIZEOF_DEV_T == 8 + # define DEV_FMT "%" PRIu64 +diff --git a/src/basic/rlimit-util.c b/src/basic/rlimit-util.c +index 74b3a02..b02c03c 100644 +--- a/src/basic/rlimit-util.c ++++ b/src/basic/rlimit-util.c +@@ -307,13 +307,13 @@ int rlimit_format(const struct rlimit *rl, char **ret) { + if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY) + s = strdup("infinity"); + else if (rl->rlim_cur >= RLIM_INFINITY) +- (void) asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max); ++ (void) asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max); + else if (rl->rlim_max >= RLIM_INFINITY) +- (void) asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur); ++ (void) asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur); + else if (rl->rlim_cur == rl->rlim_max) +- (void) asprintf(&s, RLIM_FMT, rl->rlim_cur); ++ (void) asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur); + else +- (void) asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max); ++ (void) asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max); + + if (!s) + return -ENOMEM; +@@ -404,7 +404,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; + } +diff --git a/src/core/execute.c b/src/core/execute.c +index a708231..e2b8748 100644 +--- a/src/core/execute.c ++++ b/src/core/execute.c +@@ -4220,9 +4220,9 @@ void exec_context_dump(const ExecContext *c, FILE* f, const char *prefix) { + for (i = 0; i < RLIM_NLIMITS; i++) + if (c->rlimit[i]) { + fprintf(f, "%sLimit%s: " RLIM_FMT "\n", +- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max); ++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max); + fprintf(f, "%sLimit%sSoft: " RLIM_FMT "\n", +- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur); ++ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur); + } + + if (c->ioprio_set) { +-- +2.7.4 + diff --git a/meta/recipes-core/systemd/systemd/0011-nss-mymachines-Build-conditionally-when-HAVE_MYHOSTN.patch b/meta/recipes-core/systemd/systemd/0011-nss-mymachines-Build-conditionally-when-HAVE_MYHOSTN.patch deleted file mode 100644 index 34ae64535d..0000000000 --- a/meta/recipes-core/systemd/systemd/0011-nss-mymachines-Build-conditionally-when-HAVE_MYHOSTN.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 2b2450f6b7197bff4637c0283e8784500471d083 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Mon, 14 Dec 2015 00:50:01 +0000 -Subject: [PATCH 11/36] nss-mymachines: Build conditionally when - HAVE_MYHOSTNAME is set - -Fixes build failures when building with --disable-myhostname - -Upstream-Status: Pending - -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- - Makefile.am | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/Makefile.am b/Makefile.am -index 82b6553..b3f3343 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -4876,6 +4876,7 @@ SYSTEM_UNIT_ALIASES += \ - BUSNAMES_TARGET_WANTS += \ - org.freedesktop.machine1.busname - -+if HAVE_MYHOSTNAME - libnss_mymachines_la_SOURCES = \ - src/nss-mymachines/nss-mymachines.sym \ - src/nss-mymachines/nss-mymachines.c -@@ -4896,6 +4897,7 @@ lib_LTLIBRARIES += \ - libnss_mymachines.la - - endif -+endif - - polkitpolicy_in_files += \ - src/machine/org.freedesktop.machine1.policy.in --- -1.8.3.1 - diff --git a/meta/recipes-core/systemd/systemd/0012-rules-whitelist-hd-devices.patch b/meta/recipes-core/systemd/systemd/0012-rules-whitelist-hd-devices.patch deleted file mode 100644 index 6143088e8c..0000000000 --- a/meta/recipes-core/systemd/systemd/0012-rules-whitelist-hd-devices.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 5ebc0d87565a73710dea602c00b1586d5a1364e5 Mon Sep 17 00:00:00 2001 -From: Patrick Ohly <patrick.ohly@intel.com> -Date: Wed, 16 Sep 2015 13:55:58 +0200 -Subject: [PATCH 12/36] rules: whitelist hd* devices - -qemu by default emulates IDE and the linux-yocto kernel(s) use -CONFIG_IDE instead of the more modern libsata, so disks appear as -/dev/hd*. Patch rejected upstream because CONFIG_IDE is deprecated. - -Upstream-Status: Denied [https://github.com/systemd/systemd/pull/1276] - -Signed-off-by: Patrick Ohly <patrick.ohly@intel.com> ---- - rules/60-persistent-storage.rules | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/rules/60-persistent-storage.rules b/rules/60-persistent-storage.rules -index 0b14bb4..1c4d97a 100644 ---- a/rules/60-persistent-storage.rules -+++ b/rules/60-persistent-storage.rules -@@ -6,7 +6,7 @@ - ACTION=="remove", GOTO="persistent_storage_end" - - SUBSYSTEM!="block", GOTO="persistent_storage_end" --KERNEL!="loop*|mmcblk*[0-9]|msblk*[0-9]|mspblk*[0-9]|nvme*|sd*|sr*|vd*|xvd*|bcache*|cciss*|dasd*|ubd*", GOTO="persistent_storage_end" -+KERNEL!="loop*|mmcblk*[0-9]|msblk*[0-9]|mspblk*[0-9]|nvme*|hd*|sd*|sr*|vd*|xvd*|bcache*|cciss*|dasd*|ubd*", GOTO="persistent_storage_end" - - # ignore partitions that span the entire disk - TEST=="whole_disk", GOTO="persistent_storage_end" --- -1.8.3.1 - diff --git a/meta/recipes-core/systemd/systemd/0013-sysv-generator-add-support-for-executing-scripts-und.patch b/meta/recipes-core/systemd/systemd/0013-sysv-generator-add-support-for-executing-scripts-und.patch deleted file mode 100644 index ac67f65685..0000000000 --- a/meta/recipes-core/systemd/systemd/0013-sysv-generator-add-support-for-executing-scripts-und.patch +++ /dev/null @@ -1,133 +0,0 @@ -From 6736de4a3caf9a0b3c888c6cc05103ab1b86907d Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Mon, 14 Dec 2015 05:09:53 +0000 -Subject: [PATCH 13/36] sysv-generator: add support for executing scripts under - /etc/rcS.d/ - -To be compatible, all services translated from scripts under /etc/rcS.d would -run before services translated from scripts under /etc/rcN.d. - -Upstream-Status: Inappropriate [OE specific] - -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- - src/sysv-generator/sysv-generator.c | 47 ++++++++++++++++++++++++++++--------- - 1 file changed, 36 insertions(+), 11 deletions(-) - -diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c -index b5925a4..ea06d6a 100644 ---- a/src/sysv-generator/sysv-generator.c -+++ b/src/sysv-generator/sysv-generator.c -@@ -44,7 +44,8 @@ - - typedef enum RunlevelType { - RUNLEVEL_UP, -- RUNLEVEL_DOWN -+ RUNLEVEL_DOWN, -+ RUNLEVEL_SYSINIT - } RunlevelType; - - static const struct { -@@ -59,6 +60,9 @@ static const struct { - { "rc4.d", SPECIAL_MULTI_USER_TARGET, RUNLEVEL_UP }, - { "rc5.d", SPECIAL_GRAPHICAL_TARGET, RUNLEVEL_UP }, - -+ /* Debian style rcS.d, also adopted by OE */ -+ { "rcS.d", SPECIAL_SYSINIT_TARGET, RUNLEVEL_SYSINIT}, -+ - /* Standard SysV runlevels for shutdown */ - { "rc0.d", SPECIAL_POWEROFF_TARGET, RUNLEVEL_DOWN }, - { "rc6.d", SPECIAL_REBOOT_TARGET, RUNLEVEL_DOWN } -@@ -67,7 +71,7 @@ static const struct { - directories in this order, and we want to make sure that - sysv_start_priority is known when we first load the - unit. And that value we only know from S links. Hence -- UP must be read before DOWN */ -+ UP/SYSINIT must be read before DOWN */ - }; - - static const char *arg_dest = "/tmp"; -@@ -86,6 +90,8 @@ typedef struct SysvStub { - bool has_lsb; - bool reload; - bool loaded; -+ bool default_dependencies; -+ bool from_rcsd; - } SysvStub; - - static void free_sysvstub(SysvStub *s) { -@@ -711,17 +717,31 @@ static int fix_order(SysvStub *s, Hashmap *all_services) { - if (s->has_lsb && other->has_lsb) - continue; - -- if (other->sysv_start_priority < s->sysv_start_priority) { -- r = strv_extend(&s->after, other->name); -+ /* All scripts under /etc/rcS.d should execute before scripts under -+ * /etc/rcN.d */ -+ if (!other->from_rcsd && s->from_rcsd) { -+ r = strv_extend(&s->before, other->name); - if (r < 0) - return log_oom(); - -- } else if (other->sysv_start_priority > s->sysv_start_priority) { -- r = strv_extend(&s->before, other->name); -+ } else if (other->from_rcsd && !s->from_rcsd) { -+ r = strv_extend(&s->after, other->name); - if (r < 0) - return log_oom(); -- } else -- continue; -+ } else { -+ if (other->sysv_start_priority < s->sysv_start_priority) { -+ r = strv_extend(&s->after, other->name); -+ if (r < 0) -+ return log_oom(); -+ } -+ else if (other->sysv_start_priority > s->sysv_start_priority) { -+ r = strv_extend(&s->before, other->name); -+ if (r < 0) -+ return log_oom(); -+ } -+ else -+ continue; -+ } - - /* FIXME: Maybe we should compare the name here lexicographically? */ - } -@@ -788,6 +808,8 @@ static int enumerate_sysv(const LookupPaths *lp, Hashmap *all_services) { - return log_oom(); - - service->sysv_start_priority = -1; -+ service->default_dependencies = true; -+ service->from_rcsd = false; - service->name = name; - service->path = fpath; - name = fpath = NULL; -@@ -871,9 +893,11 @@ static int set_dependencies_from_rcnd(const LookupPaths *lp, Hashmap *all_servic - - if (de->d_name[0] == 'S') { - -- if (rcnd_table[i].type == RUNLEVEL_UP) -+ if (rcnd_table[i].type == RUNLEVEL_UP || rcnd_table[i].type == RUNLEVEL_SYSINIT) { - service->sysv_start_priority = MAX(a*10 + b, service->sysv_start_priority); -- -+ service->default_dependencies = (rcnd_table[i].type == RUNLEVEL_SYSINIT)?false:true; -+ service->from_rcsd = (rcnd_table[i].type == RUNLEVEL_SYSINIT)?true:false; -+ } - r = set_ensure_allocated(&runlevel_services[i], NULL); - if (r < 0) { - log_oom(); -@@ -887,7 +911,8 @@ static int set_dependencies_from_rcnd(const LookupPaths *lp, Hashmap *all_servic - } - - } else if (de->d_name[0] == 'K' && -- (rcnd_table[i].type == RUNLEVEL_DOWN)) { -+ (rcnd_table[i].type == RUNLEVEL_DOWN || -+ rcnd_table[i].type == RUNLEVEL_SYSINIT)) { - - r = set_ensure_allocated(&shutdown_services, NULL); - if (r < 0) { --- -1.8.3.1 - diff --git a/meta/recipes-core/systemd/systemd/0014-Make-root-s-home-directory-configurable.patch b/meta/recipes-core/systemd/systemd/0014-Make-root-s-home-directory-configurable.patch deleted file mode 100644 index 2eea0ff9a6..0000000000 --- a/meta/recipes-core/systemd/systemd/0014-Make-root-s-home-directory-configurable.patch +++ /dev/null @@ -1,182 +0,0 @@ -Subject: [PATCH 14/36] Make root's home directory configurable - -OpenEmbedded has a configurable home directory for root. Allow -systemd to be built using its idea of what root's home directory -should be. - -Upstream-Status: Denied -Upstream wants to have a unified hierarchy where everyone is -using the same root folder. -https://github.com/systemd/systemd/issues/541 - -Signed-off-by: Dan McGregor <dan.mcgregor@usask.ca> -Signed-off-by: Khem Raj <raj.khem@gmail.com> - ---- - Makefile.am | 2 ++ - configure.ac | 7 +++++++ - src/basic/user-util.c | 4 ++-- - src/core/namespace.c | 2 +- - src/nspawn/nspawn.c | 4 ++-- - units/console-shell.service.m4.in | 4 ++-- - units/emergency.service.in | 4 ++-- - units/rescue.service.in | 4 ++-- - 8 files changed, 20 insertions(+), 11 deletions(-) - -diff --git a/Makefile.am b/Makefile.am -index 305099a..88c1250 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -206,6 +206,7 @@ AM_CPPFLAGS = \ - -DLIBDIR=\"$(libdir)\" \ - -DROOTLIBDIR=\"$(rootlibdir)\" \ - -DROOTLIBEXECDIR=\"$(rootlibexecdir)\" \ -+ -DROOTHOMEDIR=\"$(roothomedir)\" \ - -DTEST_DIR=\"$(abs_top_srcdir)/test\" \ - -I $(top_srcdir)/src \ - -I $(top_builddir)/src/basic \ -@@ -5863,6 +5864,7 @@ EXTRA_DIST += \ - substitutions = \ - '|rootlibexecdir=$(rootlibexecdir)|' \ - '|rootbindir=$(rootbindir)|' \ -+ '|roothomedir=$(roothomedir)|' \ - '|bindir=$(bindir)|' \ - '|SYSTEMCTL=$(rootbindir)/systemctl|' \ - '|SYSTEMD_NOTIFY=$(rootbindir)/systemd-notify|' \ -diff --git a/configure.ac b/configure.ac -index 329861a..01764f5 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1478,6 +1478,11 @@ AC_ARG_WITH([rootlibdir], - [with_rootlibdir=${libdir}]) - AX_NORMALIZE_PATH([with_rootlibdir]) - -+AC_ARG_WITH([roothomedir], -+ AS_HELP_STRING([--with-roothomedir=DIR], [Home directory for the root user]), -+ [], -+ [with_roothomedir=/root]) -+ - AC_ARG_WITH([pamlibdir], - AS_HELP_STRING([--with-pamlibdir=DIR], [Directory for PAM modules]), - [], -@@ -1562,6 +1567,7 @@ AC_SUBST([pamlibdir], [$with_pamlibdir]) - AC_SUBST([pamconfdir], [$with_pamconfdir]) - AC_SUBST([rootprefix], [$with_rootprefix]) - AC_SUBST([rootlibdir], [$with_rootlibdir]) -+AC_SUBST([roothomedir], [$with_roothomedir]) - - AC_CONFIG_FILES([ - Makefile -@@ -1653,6 +1659,7 @@ AC_MSG_RESULT([ - includedir: ${includedir} - lib dir: ${libdir} - rootlib dir: ${with_rootlibdir} -+ root home dir: ${with_roothomedir} - SysV init scripts: ${SYSTEM_SYSVINIT_PATH} - SysV rc?.d directories: ${SYSTEM_SYSVRCND_PATH} - Build Python: ${PYTHON} -diff --git a/src/basic/user-util.c b/src/basic/user-util.c -index f65ca3e..da1101a 100644 ---- a/src/basic/user-util.c -+++ b/src/basic/user-util.c -@@ -123,7 +123,7 @@ int get_user_creds( - *gid = 0; - - if (home) -- *home = "/root"; -+ *home = ROOTHOMEDIR; - - if (shell) - *shell = "/bin/sh"; -@@ -354,7 +354,7 @@ int get_home_dir(char **_h) { - /* Hardcode home directory for root to avoid NSS */ - u = getuid(); - if (u == 0) { -- h = strdup("/root"); -+ h = strdup(ROOTHOMEDIR); - if (!h) - return -ENOMEM; - -diff --git a/src/core/namespace.c b/src/core/namespace.c -index 203d122..45c0d11 100644 ---- a/src/core/namespace.c -+++ b/src/core/namespace.c -@@ -415,7 +415,7 @@ int setup_namespace( - home_dir = strjoina("-", home_dir); - run_user_dir = prefix_roota(root_directory, "/run/user"); - run_user_dir = strjoina("-", run_user_dir); -- root_dir = prefix_roota(root_directory, "/root"); -+ root_dir = prefix_roota(root_directory, ROOTHOMEDIR); - root_dir = strjoina("-", root_dir); - - r = append_mounts(&m, STRV_MAKE(home_dir, run_user_dir, root_dir), -diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c -index 8ec0584..51df00b 100644 ---- a/src/nspawn/nspawn.c -+++ b/src/nspawn/nspawn.c -@@ -2739,7 +2739,7 @@ static int inner_child( - if (envp[n_env]) - n_env++; - -- if ((asprintf((char**)(envp + n_env++), "HOME=%s", home ? home: "/root") < 0) || -+ if ((asprintf((char**)(envp + n_env++), "HOME=%s", home ? home: ROOTHOMEDIR) < 0) || - (asprintf((char**)(envp + n_env++), "USER=%s", arg_user ? arg_user : "root") < 0) || - (asprintf((char**)(envp + n_env++), "LOGNAME=%s", arg_user ? arg_user : "root") < 0)) - return log_oom(); -@@ -2816,7 +2816,7 @@ static int inner_child( - else { - if (!arg_chdir) - /* If we cannot change the directory, we'll end up in /, that is expected. */ -- (void) chdir(home ?: "/root"); -+ (void) chdir(home ?: ROOTHOMEDIR); - - execle("/bin/bash", "-bash", NULL, env_use); - execle("/bin/sh", "-sh", NULL, env_use); -diff --git a/units/console-shell.service.m4.in b/units/console-shell.service.m4.in -index a345ec2..3caae7d 100644 ---- a/units/console-shell.service.m4.in -+++ b/units/console-shell.service.m4.in -@@ -15,8 +15,8 @@ After=rc-local.service - Before=getty.target - - [Service] --Environment=HOME=/root --WorkingDirectory=-/root -+Environment=HOME=@roothomedir@ -+WorkingDirectory=-@roothomedir@ - ExecStart=-@SULOGIN@ - ExecStopPost=-@SYSTEMCTL@ poweroff - Type=idle -diff --git a/units/emergency.service.in b/units/emergency.service.in -index 0de16f2..4826062 100644 ---- a/units/emergency.service.in -+++ b/units/emergency.service.in -@@ -15,8 +15,8 @@ Conflicts=syslog.socket - Before=shutdown.target - - [Service] --Environment=HOME=/root --WorkingDirectory=-/root -+Environment=HOME=@roothomedir@ -+WorkingDirectory=-@roothomedir@ - ExecStartPre=-/bin/plymouth --wait quit - ExecStartPre=-/bin/echo -e 'Welcome to emergency mode! After logging in, type "journalctl -xb" to view\\nsystem logs, "systemctl reboot" to reboot, "systemctl default" or ^D to\\ntry again to boot into default mode.' - ExecStart=-/bin/sh -c "@SULOGIN@; @SYSTEMCTL@ --job-mode=fail --no-block default" -diff --git a/units/rescue.service.in b/units/rescue.service.in -index 92553f6..590ae17 100644 ---- a/units/rescue.service.in -+++ b/units/rescue.service.in -@@ -14,8 +14,8 @@ After=sysinit.target plymouth-start.service - Before=shutdown.target - - [Service] --Environment=HOME=/root --WorkingDirectory=-/root -+Environment=HOME=@roothomedir@ -+WorkingDirectory=-@roothomedir@ - ExecStartPre=-/bin/plymouth quit - ExecStartPre=-/bin/echo -e 'Welcome to rescue mode! After logging in, type "journalctl -xb" to view\\nsystem logs, "systemctl reboot" to reboot, "systemctl default" or ^D to\\nboot into default mode.' - ExecStart=-/bin/sh -c "@SULOGIN@; @SYSTEMCTL@ --job-mode=fail --no-block default" --- -2.8.3 - diff --git a/meta/recipes-core/systemd/systemd/0014-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch b/meta/recipes-core/systemd/systemd/0014-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch new file mode 100644 index 0000000000..914589dbd3 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0014-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch @@ -0,0 +1,42 @@ +From d3d65d4036670cbd5129fe55c09ca391286ef4b3 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 14/24] test-sizeof.c: Disable tests for missing typedefs in + musl + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +--- + src/test/test-sizeof.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c +index 35b0876..e78e7ca 100644 +--- a/src/test/test-sizeof.c ++++ b/src/test/test-sizeof.c +@@ -41,8 +41,10 @@ int main(void) { + info(unsigned); + info(long unsigned); + info(long long unsigned); ++#ifdef __GLIBC__ + info(__syscall_ulong_t); + info(__syscall_slong_t); ++#endif + + info(float); + info(double); +@@ -60,7 +62,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); +-- +2.7.4 + diff --git a/meta/recipes-core/systemd/systemd/0015-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch b/meta/recipes-core/systemd/systemd/0015-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch new file mode 100644 index 0000000000..fd407f604d --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0015-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch @@ -0,0 +1,99 @@ +From 48c628f532f6025c2d1646b6819cd81eb789d7fb Mon Sep 17 00:00:00 2001 +From: Andre McCurdy <armccurdy@gmail.com> +Date: Tue, 10 Oct 2017 14:33:30 -0700 +Subject: [PATCH 15/24] don't pass AT_SYMLINK_NOFOLLOW flag to faccessat() + +Avoid using AT_SYMLINK_NOFOLLOW flag. It doesn't seem like the right +thing to do and it's not portable (not supported by musl). See: + + http://lists.landley.net/pipermail/toybox-landley.net/2014-September/003610.html + http://www.openwall.com/lists/musl/2015/02/05/2 + +Note that laccess() is never passing AT_EACCESS so a lot of the +discussion in the links above doesn't apply. Note also that +(currently) all systemd callers of laccess() pass mode as F_OK, so +only check for existence of a file, not access permissions. +Therefore, in this case, the only distiction between faccessat() +with (flag == 0) and (flag == AT_SYMLINK_NOFOLLOW) is the behaviour +for broken symlinks; laccess() on a broken symlink will succeed with +(flag == AT_SYMLINK_NOFOLLOW) and fail (flag == 0). + +The laccess() macros was added to systemd some time ago and it's not +clear if or why it needs to return success for broken symlinks. Maybe +just historical and not actually necessary or desired behaviour? + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Andre McCurdy <armccurdy@gmail.com> +--- + src/basic/fs-util.h | 22 +++++++++++++++++++++- + src/shared/base-filesystem.c | 6 +++--- + 2 files changed, 24 insertions(+), 4 deletions(-) + +diff --git a/src/basic/fs-util.h b/src/basic/fs-util.h +index 7ad030b..d4cb1e9 100644 +--- a/src/basic/fs-util.h ++++ b/src/basic/fs-util.h +@@ -32,7 +32,27 @@ int fchmod_opath(int fd, mode_t m); + + int fd_warn_permissions(const char *path, int fd); + +-#define laccess(path, mode) faccessat(AT_FDCWD, (path), (mode), AT_SYMLINK_NOFOLLOW) ++/* ++ Avoid using AT_SYMLINK_NOFOLLOW flag. It doesn't seem like the right thing to ++ do and it's not portable (not supported by musl). See: ++ ++ http://lists.landley.net/pipermail/toybox-landley.net/2014-September/003610.html ++ http://www.openwall.com/lists/musl/2015/02/05/2 ++ ++ Note that laccess() is never passing AT_EACCESS so a lot of the discussion in ++ the links above doesn't apply. Note also that (currently) all systemd callers ++ of laccess() pass mode as F_OK, so only check for existence of a file, not ++ access permissions. Therefore, in this case, the only distiction between ++ faccessat() with (flag == 0) and (flag == AT_SYMLINK_NOFOLLOW) is the ++ behaviour for broken symlinks; laccess() on a broken symlink will succeed ++ with (flag == AT_SYMLINK_NOFOLLOW) and fail (flag == 0). ++ ++ The laccess() macros was added to systemd some time ago and it's not clear if ++ or why it needs to return success for broken symlinks. Maybe just historical ++ and not actually necessary or desired behaviour? ++*/ ++ ++#define laccess(path, mode) faccessat(AT_FDCWD, (path), (mode), 0) + + int touch_file(const char *path, bool parents, usec_t stamp, uid_t uid, gid_t gid, mode_t mode); + int touch(const char *path); +diff --git a/src/shared/base-filesystem.c b/src/shared/base-filesystem.c +index 89d7a7d..34b4ad5 100644 +--- a/src/shared/base-filesystem.c ++++ b/src/shared/base-filesystem.c +@@ -53,7 +53,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) { + return log_error_errno(errno, "Failed to open root file system: %m"); + + for (i = 0; i < ELEMENTSOF(table); i ++) { +- if (faccessat(fd, table[i].dir, F_OK, AT_SYMLINK_NOFOLLOW) >= 0) ++ if (faccessat(fd, table[i].dir, F_OK, 0) >= 0) + continue; + + if (table[i].target) { +@@ -61,7 +61,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) { + + /* check if one of the targets exists */ + NULSTR_FOREACH(s, table[i].target) { +- if (faccessat(fd, s, F_OK, AT_SYMLINK_NOFOLLOW) < 0) ++ if (faccessat(fd, s, F_OK, 0) < 0) + continue; + + /* check if a specific file exists at the target path */ +@@ -72,7 +72,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) { + if (!p) + return log_oom(); + +- if (faccessat(fd, p, F_OK, AT_SYMLINK_NOFOLLOW) < 0) ++ if (faccessat(fd, p, F_OK, 0) < 0) + continue; + } + +-- +2.7.4 + diff --git a/meta/recipes-core/systemd/systemd/0015-systemd-user-avoid-using-system-auth.patch b/meta/recipes-core/systemd/systemd/0015-systemd-user-avoid-using-system-auth.patch deleted file mode 100644 index 6e6f344890..0000000000 --- a/meta/recipes-core/systemd/systemd/0015-systemd-user-avoid-using-system-auth.patch +++ /dev/null @@ -1,35 +0,0 @@ -Subject: [PATCH 15/36] systemd-user: avoid using system-auth - -In OE, we don't provide system-auth, instead, we use common-* files. -So modify systemd-user file to use common-* files. - -Upstream-Status: Inappropriate [oe specific] - -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> -Signed-off-by: Khem Raj <raj.khem@gmail.com> - ---- - src/login/systemd-user.m4 | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/login/systemd-user.m4 b/src/login/systemd-user.m4 -index f188a8e..862d8d7 100644 ---- a/src/login/systemd-user.m4 -+++ b/src/login/systemd-user.m4 -@@ -2,11 +2,11 @@ - # - # Used by systemd --user instances. - --account include system-auth -+account include common-account - - m4_ifdef(`HAVE_SELINUX', - session required pam_selinux.so close - session required pam_selinux.so nottys open - )m4_dnl - session required pam_loginuid.so --session include system-auth -+session include common-session --- -2.8.3 - diff --git a/meta/recipes-core/systemd/systemd/0016-Define-glibc-compatible-basename-for-non-glibc-syste.patch b/meta/recipes-core/systemd/systemd/0016-Define-glibc-compatible-basename-for-non-glibc-syste.patch new file mode 100644 index 0000000000..d5565698aa --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0016-Define-glibc-compatible-basename-for-non-glibc-syste.patch @@ -0,0 +1,34 @@ +From af76c973e41929360a6e021f2ff9a7fc1d7994e9 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Sun, 27 May 2018 08:36:44 -0700 +Subject: [PATCH 16/24] Define glibc compatible basename() for non-glibc + systems + +Fixes builds with musl, even though systemd is adamant about +using non-posix basename implementation, we have a way out + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + src/machine/machine-dbus.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c +index 7a558df..eca7d4b 100644 +--- a/src/machine/machine-dbus.c ++++ b/src/machine/machine-dbus.c +@@ -11,6 +11,10 @@ + #include <libgen.h> + #undef basename + ++#if !defined(__GLIBC__) ++#define basename(src) (strrchr(src,'/') ? strrchr(src,'/')+1 : src) ++#endif ++ + #include "alloc-util.h" + #include "bus-common-errors.h" + #include "bus-internal.h" +-- +2.7.4 + diff --git a/meta/recipes-core/systemd/systemd/0016-Revert-rules-remove-firmware-loading-rules.patch b/meta/recipes-core/systemd/systemd/0016-Revert-rules-remove-firmware-loading-rules.patch deleted file mode 100644 index 66905b5c57..0000000000 --- a/meta/recipes-core/systemd/systemd/0016-Revert-rules-remove-firmware-loading-rules.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 7311ecc745c17d6ed9fd9cf43039648483a87605 Mon Sep 17 00:00:00 2001 -From: Jonathan Liu <net147@gmail.com> -Date: Thu, 19 Mar 2015 15:01:29 +1100 -Subject: [PATCH 16/36] Revert "rules: remove firmware loading rules" - -This reverts commit 70e7d754ddb356fb1a2942b262f8cee9650e2a19. -Userspace firmware loading support is needed for Linux < 3.7. - -Upstream-Status: Inappropriate [OE specific] - -Signed-off-by: Jonathan Liu <net147@gmail.com> ---- - rules/50-firmware.rules | 3 +++ - 1 file changed, 3 insertions(+) - create mode 100644 rules/50-firmware.rules - -diff --git a/rules/50-firmware.rules b/rules/50-firmware.rules -new file mode 100644 -index 0000000..f0ae684 ---- /dev/null -+++ b/rules/50-firmware.rules -@@ -0,0 +1,3 @@ -+# do not edit this file, it will be overwritten on update -+ -+SUBSYSTEM=="firmware", ACTION=="add", RUN{builtin}="firmware" --- -1.8.3.1 - diff --git a/meta/recipes-core/systemd/systemd/0017-Do-not-disable-buffering-when-writing-to-oom_score_a.patch b/meta/recipes-core/systemd/systemd/0017-Do-not-disable-buffering-when-writing-to-oom_score_a.patch new file mode 100644 index 0000000000..24e24e8e5a --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0017-Do-not-disable-buffering-when-writing-to-oom_score_a.patch @@ -0,0 +1,38 @@ +From c7a4efb8bccb52e1714c151929c23e12bde59b82 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 17/24] 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(-) + +diff --git a/src/basic/process-util.c b/src/basic/process-util.c +index b1c08fcade..0a7a1f7d89 100644 +--- a/src/basic/process-util.c ++++ b/src/basic/process-util.c +@@ -1474,7 +1474,7 @@ int set_oom_score_adjust(int value) { + sprintf(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); + } + + static const char *const ioprio_class_table[] = { diff --git a/meta/recipes-core/systemd/systemd/0017-Revert-udev-remove-userspace-firmware-loading-suppor.patch b/meta/recipes-core/systemd/systemd/0017-Revert-udev-remove-userspace-firmware-loading-suppor.patch deleted file mode 100644 index 642625f32f..0000000000 --- a/meta/recipes-core/systemd/systemd/0017-Revert-udev-remove-userspace-firmware-loading-suppor.patch +++ /dev/null @@ -1,351 +0,0 @@ -Subject: [PATCH 17/36] Revert "udev: remove userspace firmware loading - support" - -This reverts commit be2ea723b1d023b3d385d3b791ee4607cbfb20ca. -Userspace firmware loading support is needed for Linux < 3.7. - -Upstream-Status: Inappropriate [OE specific] - -Signed-off-by: Jonathan Liu <net147@gmail.com> -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- - Makefile.am | 12 +++ - README | 4 +- - TODO | 1 + - configure.ac | 22 ++++++ - src/udev/udev-builtin-firmware.c | 154 +++++++++++++++++++++++++++++++++++++++ - src/udev/udev-builtin.c | 3 + - src/udev/udev.h | 6 ++ - src/udev/udevd.c | 13 ++++ - 8 files changed, 213 insertions(+), 2 deletions(-) - create mode 100644 src/udev/udev-builtin-firmware.c - -diff --git a/Makefile.am b/Makefile.am -index 305099a..e774976 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -3706,6 +3706,18 @@ libudev_core_la_LIBADD = \ - $(BLKID_LIBS) \ - $(KMOD_LIBS) - -+libudev_core_la_CPPFLAGS = \ -+ $(AM_CPPFLAGS) \ -+ -DFIRMWARE_PATH="$(FIRMWARE_PATH)" -+ -+if ENABLE_FIRMWARE -+libudev_core_la_SOURCES += \ -+ src/udev/udev-builtin-firmware.c -+ -+dist_udevrules_DATA += \ -+ rules/50-firmware.rules -+endif -+ - if HAVE_KMOD - libudev_core_la_SOURCES += \ - src/udev/udev-builtin-kmod.c -diff --git a/README b/README -index ca8993c..87f3297 100644 ---- a/README -+++ b/README -@@ -56,8 +56,8 @@ REQUIREMENTS: - Legacy hotplug slows down the system and confuses udev: - CONFIG_UEVENT_HELPER_PATH="" - -- Userspace firmware loading is not supported and should -- be disabled in the kernel: -+ Userspace firmware loading is deprecated, will go away, and -+ sometimes causes problems: - CONFIG_FW_LOADER_USER_HELPER=n - - Some udev rules and virtualization detection relies on it: -diff --git a/TODO b/TODO -index fac9ccf..2645582 100644 ---- a/TODO -+++ b/TODO -@@ -642,6 +642,7 @@ Features: - * initialize the hostname from the fs label of /, if /etc/hostname does not exist? - - * udev: -+ - remove src/udev/udev-builtin-firmware.c (CONFIG_FW_LOADER_USER_HELPER=n) - - move to LGPL - - kill scsi_id - - add trigger --subsystem-match=usb/usb_device device -diff --git a/configure.ac b/configure.ac -index 329861a..af85405 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1361,6 +1361,25 @@ AC_ARG_ENABLE(hwdb, [AC_HELP_STRING([--disable-hwdb], [disable hardware database - AM_CONDITIONAL(ENABLE_HWDB, [test x$enable_hwdb = xyes]) - - # ------------------------------------------------------------------------------ -+AC_ARG_WITH(firmware-path, -+ AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]], -+ [Firmware search path (default="")]), -+ [], [with_firmware_path=""]) -+OLD_IFS=$IFS -+IFS=: -+for i in $with_firmware_path; do -+ if test "x${FIRMWARE_PATH}" = "x"; then -+ FIRMWARE_PATH="\\\"${i}/\\\"" -+ else -+ FIRMWARE_PATH="${FIRMWARE_PATH}, \\\"${i}/\\\"" -+ fi -+done -+IFS=$OLD_IFS -+AC_SUBST(FIRMWARE_PATH) -+AS_IF([test "x${FIRMWARE_PATH}" != "x"], [ AC_DEFINE(HAVE_FIRMWARE, 1, [Define if FIRMWARE is availabe]) ]) -+AM_CONDITIONAL(ENABLE_FIRMWARE, [test "x${FIRMWARE_PATH}" != "x"]) -+ -+# ------------------------------------------------------------------------------ - have_manpages=no - AC_ARG_ENABLE(manpages, AS_HELP_STRING([--disable-manpages], [disable manpages])) - AC_PATH_PROG([XSLTPROC], [xsltproc]) -@@ -1656,6 +1675,9 @@ AC_MSG_RESULT([ - SysV init scripts: ${SYSTEM_SYSVINIT_PATH} - SysV rc?.d directories: ${SYSTEM_SYSVRCND_PATH} - Build Python: ${PYTHON} -+ Installation Python: ${PYTHON_BINARY} -+ sphinx binary: ${SPHINX_BUILD} -+ firmware path: ${FIRMWARE_PATH} - PAM modules dir: ${with_pamlibdir} - PAM configuration dir: ${with_pamconfdir} - D-Bus policy dir: ${with_dbuspolicydir} -diff --git a/src/udev/udev-builtin-firmware.c b/src/udev/udev-builtin-firmware.c -new file mode 100644 -index 0000000..bd8c2fb ---- /dev/null -+++ b/src/udev/udev-builtin-firmware.c -@@ -0,0 +1,154 @@ -+/* -+ * firmware - Kernel firmware loader -+ * -+ * Copyright (C) 2009 Piter Punk <piterpunk@slackware.com> -+ * Copyright (C) 2009-2011 Kay Sievers <kay@vrfy.org> -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation; either version 2 of the -+ * License, or (at your option) any later version. -+ * -+ * This program 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 -+ * General Public License for more details:* -+ */ -+ -+#include <unistd.h> -+#include <stdlib.h> -+#include <string.h> -+#include <stdio.h> -+#include <getopt.h> -+#include <errno.h> -+#include <stdbool.h> -+#include <sys/utsname.h> -+#include <sys/stat.h> -+ -+#include "udev.h" -+ -+static bool set_loading(struct udev *udev, char *loadpath, const char *state) { -+ FILE *ldfile; -+ -+ ldfile = fopen(loadpath, "we"); -+ if (ldfile == NULL) { -+ log_error("error: can not open '%s'", loadpath); -+ return false; -+ }; -+ fprintf(ldfile, "%s\n", state); -+ fclose(ldfile); -+ return true; -+} -+ -+static bool copy_firmware(struct udev *udev, const char *source, const char *target, size_t size) { -+ char *buf; -+ FILE *fsource = NULL, *ftarget = NULL; -+ bool ret = false; -+ -+ buf = malloc(size); -+ if (buf == NULL) { -+ log_error("No memory available to load firmware file"); -+ return false; -+ } -+ -+ log_debug("writing '%s' (%zi) to '%s'", source, size, target); -+ -+ fsource = fopen(source, "re"); -+ if (fsource == NULL) -+ goto exit; -+ ftarget = fopen(target, "we"); -+ if (ftarget == NULL) -+ goto exit; -+ if (fread(buf, size, 1, fsource) != 1) -+ goto exit; -+ if (fwrite(buf, size, 1, ftarget) == 1) -+ ret = true; -+exit: -+ if (ftarget != NULL) -+ fclose(ftarget); -+ if (fsource != NULL) -+ fclose(fsource); -+ free(buf); -+ return ret; -+} -+ -+static int builtin_firmware(struct udev_device *dev, int argc, char *argv[], bool test) { -+ struct udev *udev = udev_device_get_udev(dev); -+ static const char *searchpath[] = { FIRMWARE_PATH }; -+ char loadpath[UTIL_PATH_SIZE]; -+ char datapath[UTIL_PATH_SIZE]; -+ char fwpath[UTIL_PATH_SIZE]; -+ const char *firmware; -+ FILE *fwfile = NULL; -+ struct utsname kernel; -+ struct stat statbuf; -+ unsigned int i; -+ int rc = EXIT_SUCCESS; -+ -+ firmware = udev_device_get_property_value(dev, "FIRMWARE"); -+ if (firmware == NULL) { -+ log_error("firmware parameter missing"); -+ rc = EXIT_FAILURE; -+ goto exit; -+ } -+ -+ /* lookup firmware file */ -+ uname(&kernel); -+ for (i = 0; i < ELEMENTSOF(searchpath); i++) { -+ strscpyl(fwpath, sizeof(fwpath), searchpath[i], kernel.release, "/", firmware, NULL); -+ fwfile = fopen(fwpath, "re"); -+ if (fwfile != NULL) -+ break; -+ -+ strscpyl(fwpath, sizeof(fwpath), searchpath[i], firmware, NULL); -+ fwfile = fopen(fwpath, "re"); -+ if (fwfile != NULL) -+ break; -+ } -+ -+ strscpyl(loadpath, sizeof(loadpath), udev_device_get_syspath(dev), "/loading", NULL); -+ -+ if (fwfile == NULL) { -+ log_debug("did not find firmware file '%s'", firmware); -+ rc = EXIT_FAILURE; -+ /* -+ * Do not cancel the request in the initrd, the real root might have -+ * the firmware file and the 'coldplug' run in the real root will find -+ * this pending request and fulfill or cancel it. -+ * */ -+ if (!in_initrd()) -+ set_loading(udev, loadpath, "-1"); -+ goto exit; -+ } -+ -+ if (stat(fwpath, &statbuf) < 0 || statbuf.st_size == 0) { -+ if (!in_initrd()) -+ set_loading(udev, loadpath, "-1"); -+ rc = EXIT_FAILURE; -+ goto exit; -+ } -+ -+ if (!set_loading(udev, loadpath, "1")) -+ goto exit; -+ -+ strscpyl(datapath, sizeof(datapath), udev_device_get_syspath(dev), "/data", NULL); -+ if (!copy_firmware(udev, fwpath, datapath, statbuf.st_size)) { -+ log_error("error sending firmware '%s' to device", firmware); -+ set_loading(udev, loadpath, "-1"); -+ rc = EXIT_FAILURE; -+ goto exit; -+ }; -+ -+ set_loading(udev, loadpath, "0"); -+exit: -+ if (fwfile) -+ fclose(fwfile); -+ return rc; -+} -+ -+const struct udev_builtin udev_builtin_firmware = { -+ .name = "firmware", -+ .cmd = builtin_firmware, -+ .help = "kernel firmware loader", -+ .run_once = true, -+}; -diff --git a/src/udev/udev-builtin.c b/src/udev/udev-builtin.c -index e6b36f1..cd9947e 100644 ---- a/src/udev/udev-builtin.c -+++ b/src/udev/udev-builtin.c -@@ -31,6 +31,9 @@ static const struct udev_builtin *builtins[] = { - [UDEV_BUILTIN_BLKID] = &udev_builtin_blkid, - #endif - [UDEV_BUILTIN_BTRFS] = &udev_builtin_btrfs, -+#ifdef HAVE_FIRMWARE -+ [UDEV_BUILTIN_FIRMWARE] = &udev_builtin_firmware, -+#endif - [UDEV_BUILTIN_HWDB] = &udev_builtin_hwdb, - [UDEV_BUILTIN_INPUT_ID] = &udev_builtin_input_id, - [UDEV_BUILTIN_KEYBOARD] = &udev_builtin_keyboard, -diff --git a/src/udev/udev.h b/src/udev/udev.h -index 8433e8d..d32366d 100644 ---- a/src/udev/udev.h -+++ b/src/udev/udev.h -@@ -148,6 +148,9 @@ enum udev_builtin_cmd { - UDEV_BUILTIN_BLKID, - #endif - UDEV_BUILTIN_BTRFS, -+#ifdef HAVE_FIRMWARE -+ UDEV_BUILTIN_FIRMWARE, -+#endif - UDEV_BUILTIN_HWDB, - UDEV_BUILTIN_INPUT_ID, - UDEV_BUILTIN_KEYBOARD, -@@ -176,6 +179,9 @@ struct udev_builtin { - extern const struct udev_builtin udev_builtin_blkid; - #endif - extern const struct udev_builtin udev_builtin_btrfs; -+#ifdef HAVE_FIRMWARE -+extern const struct udev_builtin udev_builtin_firmware; -+#endif - extern const struct udev_builtin udev_builtin_hwdb; - extern const struct udev_builtin udev_builtin_input_id; - extern const struct udev_builtin udev_builtin_keyboard; -diff --git a/src/udev/udevd.c b/src/udev/udevd.c -index e9dd2f4..0abc28e 100644 ---- a/src/udev/udevd.c -+++ b/src/udev/udevd.c -@@ -125,6 +125,9 @@ struct event { - bool is_block; - sd_event_source *timeout_warning; - sd_event_source *timeout; -+#ifdef HAVE_FIRMWARE -+ bool nodelay; -+#endif - }; - - static inline struct event *node_to_event(struct udev_list_node *node) { -@@ -614,6 +617,10 @@ static int event_queue_insert(Manager *manager, struct udev_device *dev) { - event->devnum = udev_device_get_devnum(dev); - event->is_block = streq("block", udev_device_get_subsystem(dev)); - event->ifindex = udev_device_get_ifindex(dev); -+#ifdef HAVE_FIRMWARE -+ if (streq(udev_device_get_subsystem(dev), "firmware")) -+ event->nodelay = true; -+#endif - - log_debug("seq %llu queued, '%s' '%s'", udev_device_get_seqnum(dev), - udev_device_get_action(dev), udev_device_get_subsystem(dev)); -@@ -699,6 +706,12 @@ static bool is_devpath_busy(Manager *manager, struct event *event) { - return true; - } - -+#ifdef HAVE_FIRMWARE -+ /* allow to bypass the dependency tracking */ -+ if (event->nodelay) -+ continue; -+#endif -+ - /* parent device event found */ - if (event->devpath[common] == '/') { - event->delaying_seqnum = loop_event->seqnum; --- -2.8.3 - diff --git a/meta/recipes-core/systemd/systemd/0018-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch b/meta/recipes-core/systemd/systemd/0018-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch new file mode 100644 index 0000000000..5901772998 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0018-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch @@ -0,0 +1,62 @@ +From fffb2810611b4a26f5c6c0958093b5b3b7d4cd99 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 18/24] 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/journal/journal-send.c | 5 +++++ + src/libsystemd/sd-bus/bus-error.c | 5 +++++ + 2 files changed, 10 insertions(+) + +diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c +index 3fea912..4f1e592 100644 +--- a/src/journal/journal-send.c ++++ b/src/journal/journal-send.c +@@ -337,7 +337,12 @@ static int fill_iovec_perror_and_send(const char *message, int skip, struct iove + char* j; + + errno = 0; ++#ifndef __GLIBC__ ++ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k); ++ j = buffer + 8 + k; ++#else + j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k); ++#endif + if (errno == 0) { + char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1]; + +diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c +index dc95237..bdda30f 100644 +--- a/src/libsystemd/sd-bus/bus-error.c ++++ b/src/libsystemd/sd-bus/bus-error.c +@@ -379,7 +379,12 @@ static void bus_error_strerror(sd_bus_error *e, int error) { + 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; +-- +2.7.4 + diff --git a/meta/recipes-core/systemd/systemd/0018-make-test-dir-configurable.patch b/meta/recipes-core/systemd/systemd/0018-make-test-dir-configurable.patch deleted file mode 100644 index 5d13e4af94..0000000000 --- a/meta/recipes-core/systemd/systemd/0018-make-test-dir-configurable.patch +++ /dev/null @@ -1,62 +0,0 @@ -Subject: [PATCH 18/36] make test dir configurable - -Upstream-Status: Pending - -test maybe be run on target in cross-compile environment, and test dir -is not the compilation dir, so make it configurable - -Signed-off-by: Roy Li <rongqing.li@windriver.com> - ---- - Makefile.am | 2 +- - configure.ac | 7 +++++++ - 2 files changed, 8 insertions(+), 1 deletion(-) - -diff --git a/Makefile.am b/Makefile.am -index a94636a..dbd3386 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -207,7 +207,7 @@ AM_CPPFLAGS = \ - -DROOTLIBDIR=\"$(rootlibdir)\" \ - -DROOTLIBEXECDIR=\"$(rootlibexecdir)\" \ - -DROOTHOMEDIR=\"$(roothomedir)\" \ -- -DTEST_DIR=\"$(abs_top_srcdir)/test\" \ -+ -DTEST_DIR=\"$(testdir)/test\" \ - -I $(top_srcdir)/src \ - -I $(top_builddir)/src/basic \ - -I $(top_srcdir)/src/basic \ -diff --git a/configure.ac b/configure.ac -index 45aae8a..c53fae2 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1518,6 +1518,11 @@ AC_ARG_WITH([roothomedir], - [], - [with_roothomedir=/root]) - -+AC_ARG_WITH([testdir], -+ AS_HELP_STRING([--with-testdir=DIR], [test file directory]), -+ [], -+ [with_testdir=${abs_top_srcdir}]) -+ - AC_ARG_WITH([pamlibdir], - AS_HELP_STRING([--with-pamlibdir=DIR], [Directory for PAM modules]), - [], -@@ -1603,6 +1608,7 @@ AC_SUBST([pamconfdir], [$with_pamconfdir]) - AC_SUBST([rootprefix], [$with_rootprefix]) - AC_SUBST([rootlibdir], [$with_rootlibdir]) - AC_SUBST([roothomedir], [$with_roothomedir]) -+AC_SUBST([testdir], [$with_testdir]) - - AC_CONFIG_FILES([ - Makefile -@@ -1695,6 +1701,7 @@ AC_MSG_RESULT([ - lib dir: ${libdir} - rootlib dir: ${with_rootlibdir} - root home dir: ${with_roothomedir} -+ test dir: ${with_testdir} - SysV init scripts: ${SYSTEM_SYSVINIT_PATH} - SysV rc?.d directories: ${SYSTEM_SYSVRCND_PATH} - Build Python: ${PYTHON} --- -2.8.3 - diff --git a/meta/recipes-core/systemd/systemd/0019-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch b/meta/recipes-core/systemd/systemd/0019-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch new file mode 100644 index 0000000000..35cc66ff66 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0019-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch @@ -0,0 +1,35 @@ +From 969ab9e68249fd383f4b513b1c9306bdac4ae9b2 Mon Sep 17 00:00:00 2001 +From: Chen Qi <Qi.Chen@windriver.com> +Date: Mon, 25 Feb 2019 15:18:00 +0800 +Subject: [PATCH 19/24] Hide __start_BUS_ERROR_MAP and __stop_BUS_ERROR_MAP + +for currently unknown reasons they get exported to the shared libries +even without being listed in the sym file + +Upstream-Status: Pending + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +[Rebased for v241] +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +--- + src/libsystemd/sd-bus/bus-error.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c +index bdda30f..e21853c 100644 +--- a/src/libsystemd/sd-bus/bus-error.c ++++ b/src/libsystemd/sd-bus/bus-error.c +@@ -54,8 +54,8 @@ BUS_ERROR_MAP_ELF_REGISTER const sd_bus_error_map bus_standard_errors[] = { + }; + + /* GCC maps this magically to the beginning and end of the BUS_ERROR_MAP section */ +-extern const sd_bus_error_map __start_SYSTEMD_BUS_ERROR_MAP[]; +-extern const sd_bus_error_map __stop_SYSTEMD_BUS_ERROR_MAP[]; ++extern const sd_bus_error_map __start_SYSTEMD_BUS_ERROR_MAP[] _hidden_; ++extern const sd_bus_error_map __stop_SYSTEMD_BUS_ERROR_MAP[] _hidden_; + + /* Additional maps registered with sd_bus_error_add_map() are in this + * NULL terminated array */ +-- +2.7.4 + diff --git a/meta/recipes-core/systemd/systemd/0019-remove-duplicate-include-uchar.h.patch b/meta/recipes-core/systemd/systemd/0019-remove-duplicate-include-uchar.h.patch deleted file mode 100644 index 17592f8aa6..0000000000 --- a/meta/recipes-core/systemd/systemd/0019-remove-duplicate-include-uchar.h.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 3ca534935460647fed66e31aaa90b364e29eab5c Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Mon, 22 Feb 2016 05:59:01 +0000 -Subject: [PATCH 1/2] remove duplicate include uchar.h - -missing.h already includes it - -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- -Upstream-Status: Pending - - src/basic/escape.h | 1 - - src/basic/utf8.h | 1 - - 2 files changed, 2 deletions(-) - -diff --git a/src/basic/escape.h b/src/basic/escape.h -index deaa4de..36d437c 100644 ---- a/src/basic/escape.h -+++ b/src/basic/escape.h -@@ -23,7 +23,6 @@ - #include <stddef.h> - #include <stdint.h> - #include <sys/types.h> --#include <uchar.h> - - #include "string-util.h" - #include "missing.h" -diff --git a/src/basic/utf8.h b/src/basic/utf8.h -index 12c272d..bea93a6 100644 ---- a/src/basic/utf8.h -+++ b/src/basic/utf8.h -@@ -22,7 +22,6 @@ - #include <stdbool.h> - #include <stddef.h> - #include <stdint.h> --#include <uchar.h> - - #include "macro.h" - #include "missing.h" --- -1.8.3.1 - diff --git a/meta/recipes-core/systemd/systemd/0020-check-for-uchar.h-in-configure.patch b/meta/recipes-core/systemd/systemd/0020-check-for-uchar.h-in-configure.patch deleted file mode 100644 index a027fad1d9..0000000000 --- a/meta/recipes-core/systemd/systemd/0020-check-for-uchar.h-in-configure.patch +++ /dev/null @@ -1,44 +0,0 @@ -From e06eec89a22719c38e257fe07afff18e359114cb Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Mon, 22 Feb 2016 06:02:38 +0000 -Subject: [PATCH 2/2] check for uchar.h in configure - -Use ifdef to include uchar.h - -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- -Upstream-Status: Pending - - configure.ac | 1 + - src/basic/missing.h | 2 ++ - 2 files changed, 3 insertions(+) - -diff --git a/configure.ac b/configure.ac -index ecc3e6b..62f934e 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -297,6 +297,7 @@ AM_CONDITIONAL([HAVE_PYTHON], [test "x$have_python" = "xyes"]) - - # ------------------------------------------------------------------------------ - -+AC_CHECK_HEADERS([uchar.h], [], []) - AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([*** POSIX caps headers not found])]) - AC_CHECK_HEADERS([linux/btrfs.h], [], []) - AC_CHECK_HEADERS([linux/memfd.h], [], []) -diff --git a/src/basic/missing.h b/src/basic/missing.h -index f704422..a1baa95 100644 ---- a/src/basic/missing.h -+++ b/src/basic/missing.h -@@ -34,7 +34,9 @@ - #include <stdlib.h> - #include <sys/resource.h> - #include <sys/syscall.h> -+#ifdef HAVE_UCHAR_H - #include <uchar.h> -+#endif - #include <unistd.h> - - #ifdef HAVE_AUDIT --- -1.8.3.1 - diff --git a/meta/recipes-core/systemd/systemd/0020-missing_type.h-add-__compar_d_fn_t-definition.patch b/meta/recipes-core/systemd/systemd/0020-missing_type.h-add-__compar_d_fn_t-definition.patch new file mode 100644 index 0000000000..753d5116ac --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0020-missing_type.h-add-__compar_d_fn_t-definition.patch @@ -0,0 +1,30 @@ +From 75c06e3e2a4760b36fffd95cdf5535b8ad73c481 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 20/24] 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 7d7c1e4..85902ab 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 +-- +2.7.4 + diff --git a/meta/recipes-core/systemd/systemd/0021-avoid-redefinition-of-prctl_mm_map-structure.patch b/meta/recipes-core/systemd/systemd/0021-avoid-redefinition-of-prctl_mm_map-structure.patch new file mode 100644 index 0000000000..cdddf83890 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0021-avoid-redefinition-of-prctl_mm_map-structure.patch @@ -0,0 +1,32 @@ +From 3fbf61d54b82fc9bf21d8039bfd89dc9efc5bbcd 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 21/24] 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 f80cd17..47e4893 100644 +--- a/src/basic/missing_prctl.h ++++ b/src/basic/missing_prctl.h +@@ -1,7 +1,9 @@ + /* SPDX-License-Identifier: LGPL-2.1+ */ + #pragma once + ++#ifdef __GLIBC__ + #include <linux/prctl.h> ++#endif + + /* 58319057b7847667f0c9585b9de0e8932b0fdb08 (4.3) */ + #ifndef PR_CAP_AMBIENT +-- +2.11.0 + diff --git a/meta/recipes-core/systemd/systemd/0021-include-missing.h-for-getting-secure_getenv-definiti.patch b/meta/recipes-core/systemd/systemd/0021-include-missing.h-for-getting-secure_getenv-definiti.patch deleted file mode 100644 index 5797a29e60..0000000000 --- a/meta/recipes-core/systemd/systemd/0021-include-missing.h-for-getting-secure_getenv-definiti.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 6cedbaee7964f6a6c61b9f2c8f0b87cef9370424 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -Date: Tue, 15 Dec 2015 22:51:55 +0000 -Subject: [PATCH 26/38] include missing.h for getting secure_getenv definition - -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- -Upstream-Status: Pending - - 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 55672b3..22c4a23 100644 ---- a/src/basic/user-util.c -+++ b/src/basic/user-util.c -@@ -38,6 +38,7 @@ - #include "path-util.h" - #include "string-util.h" - #include "user-util.h" -+#include "missing.h" - - bool uid_is_valid(uid_t uid) { - --- -1.8.3.1 - diff --git a/meta/recipes-core/systemd/systemd/0022-socket-util-don-t-fail-if-libc-doesn-t-support-IDN.patch b/meta/recipes-core/systemd/systemd/0022-socket-util-don-t-fail-if-libc-doesn-t-support-IDN.patch deleted file mode 100644 index 96fc3d8448..0000000000 --- a/meta/recipes-core/systemd/systemd/0022-socket-util-don-t-fail-if-libc-doesn-t-support-IDN.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 71e710a6c8a3879af7d50c4cb995e0615deba5c3 Mon Sep 17 00:00:00 2001 -From: Emil Renner Berthing <systemd@esmil.dk> -Date: Sat, 12 Sep 2015 19:56:52 +0000 -Subject: [PATCH 29/38] socket-util: don't fail if libc doesn't support IDN - -Signed-off-by: Emil Renner Berthing <systemd@esmil.dk> -Signed-off-by: Khem Raj <raj.khem@gmail.com> ---- -Upstream-Status: Pending - - src/basic/socket-util.c | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/src/basic/socket-util.c b/src/basic/socket-util.c -index 5851268..aefaca5 100644 ---- a/src/basic/socket-util.c -+++ b/src/basic/socket-util.c -@@ -44,6 +44,15 @@ - #include "string-util.h" - #include "user-util.h" - #include "util.h" -+/* Don't fail if the standard library -+ * doesn't support IDN */ -+#ifndef NI_IDN -+#define NI_IDN 0 -+#endif -+ -+#ifndef NI_IDN_USE_STD3_ASCII_RULES -+#define NI_IDN_USE_STD3_ASCII_RULES 0 -+#endif - - int socket_address_parse(SocketAddress *a, const char *s) { - char *e, *n; --- -1.8.3.1 - diff --git a/meta/recipes-core/systemd/systemd/0024-test-json.c-define-M_PIl.patch b/meta/recipes-core/systemd/systemd/0024-test-json.c-define-M_PIl.patch new file mode 100644 index 0000000000..0e5629d37b --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0024-test-json.c-define-M_PIl.patch @@ -0,0 +1,33 @@ +From 902412c271e0c5d9cb93b10ec0fb5b119b393474 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 24/24] test-json.c: define M_PIl + +Fix the following compile failure: +src/test/test-json.c:305:50: error: 'M_PIl' undeclared (first use in this function); did you mean 'M_PI'? + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +--- + src/test/test-json.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/test/test-json.c b/src/test/test-json.c +index 9b8a2a9..efc746c 100644 +--- a/src/test/test-json.c ++++ b/src/test/test-json.c +@@ -11,6 +11,10 @@ + #include "tests.h" + #include "util.h" + ++#ifndef M_PIl ++#define M_PIl 3.141592653589793238462643383279502884L ++#endif ++ + static void test_tokenizer(const char *data, ...) { + unsigned line = 0, column = 0; + void *state = NULL; +-- +2.11.0 + diff --git a/meta/recipes-core/systemd/systemd/99-default.preset b/meta/recipes-core/systemd/systemd/99-default.preset new file mode 100644 index 0000000000..1f29b50597 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/99-default.preset @@ -0,0 +1 @@ +disable * diff --git a/meta/recipes-core/systemd/systemd/run-ptest b/meta/recipes-core/systemd/systemd/run-ptest deleted file mode 100644 index 2ae76ffaf1..0000000000 --- a/meta/recipes-core/systemd/systemd/run-ptest +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -cd tests -tar -C test -xJf test/sys.tar.xz -make check-TESTS -cd .. diff --git a/meta/recipes-core/systemd/systemd/udev-re-enable-mount-propagation-for-udevd.patch b/meta/recipes-core/systemd/systemd/udev-re-enable-mount-propagation-for-udevd.patch deleted file mode 100644 index 23e22d40e6..0000000000 --- a/meta/recipes-core/systemd/systemd/udev-re-enable-mount-propagation-for-udevd.patch +++ /dev/null @@ -1,31 +0,0 @@ -From: Michael Biebl <biebl@debian.org> -Date: Sat, 27 Sep 2014 04:19:24 +0200 -Subject: udev: re-enable mount propagation for udevd - -Upstream-Status: Backport [http://http.debian.net/debian/pool/main/s/systemd/systemd_215-17+deb8u4.debian.tar.xz] - -laptop-mode-tools remounts file systems from within a udev rule to apply -certain mount options. With MountFlags=slave, those mounts then become private -to the systemd-udevd namespace and are no longer accessible from outside the -namespace. -While the root cause is the broken behaviour of laptop-mode-tools, with mount -propagation turned off, this can result in a read-only root file system. -Therefore revert the relevant parts from commit -c2c13f2df42e0691aecabe3979ea81cd7faa35c7 to re-enable mount propagation for -udevd. - -Once affected packages have been fixed, this patch should be dropped -again. - -Closes: #762018 -diff --git a/units/systemd-udevd.service.in b/units/systemd-udevd.service.in -index e7216d6..1e9a600 100644 ---- a/units/systemd-udevd.service.in -+++ b/units/systemd-udevd.service.in -@@ -21,6 +21,5 @@ Sockets=systemd-udevd-control.socket systemd-udevd-kernel.socket - Restart=always - RestartSec=0 - ExecStart=@rootlibexecdir@/systemd-udevd --MountFlags=slave - KillMode=mixed - WatchdogSec=1min |