diff options
Diffstat (limited to 'meta/recipes-core/systemd/systemd')
46 files changed, 2043 insertions, 1258 deletions
diff --git a/meta/recipes-core/systemd/systemd/00-hostnamed-network-user.conf b/meta/recipes-core/systemd/systemd/00-hostnamed-network-user.conf new file mode 100644 index 0000000000..6b224ba9b9 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/00-hostnamed-network-user.conf @@ -0,0 +1,6 @@ +[Service] +# By running with these options instead of root, networkd is allowed to request +# a hostname change via DBUS when policykit is not present +User=systemd-network +Group=systemd-hostname +AmbientCapabilities=CAP_SYS_ADMIN diff --git a/meta/recipes-core/systemd/systemd/0001-Adjust-for-musl-headers.patch b/meta/recipes-core/systemd/systemd/0001-Adjust-for-musl-headers.patch new file mode 100644 index 0000000000..2363679c98 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0001-Adjust-for-musl-headers.patch @@ -0,0 +1,453 @@ +From 4c2e932664ec67662f4a0306cca4a7cd82853bda Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 21 Jan 2022 22:19:37 -0800 +Subject: [PATCH] Adjust for musl headers + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + src/libsystemd-network/sd-dhcp6-client.c | 2 +- + src/network/netdev/bareudp.c | 2 +- + src/network/netdev/batadv.c | 2 +- + src/network/netdev/bond.c | 2 +- + src/network/netdev/bridge.c | 2 +- + src/network/netdev/dummy.c | 2 +- + src/network/netdev/geneve.c | 2 +- + src/network/netdev/ifb.c | 2 +- + src/network/netdev/ipoib.c | 2 +- + src/network/netdev/ipvlan.c | 2 +- + src/network/netdev/macsec.c | 2 +- + src/network/netdev/macvlan.c | 2 +- + src/network/netdev/netdev.c | 2 +- + src/network/netdev/netdevsim.c | 2 +- + src/network/netdev/nlmon.c | 2 +- + src/network/netdev/tunnel.c | 2 +- + src/network/netdev/vcan.c | 2 +- + src/network/netdev/veth.c | 2 +- + src/network/netdev/vlan.c | 2 +- + src/network/netdev/vrf.c | 2 +- + src/network/netdev/vxcan.c | 2 +- + src/network/netdev/vxlan.c | 2 +- + src/network/netdev/xfrm.c | 2 +- + src/network/networkd-bridge-mdb.c | 4 ++-- + src/network/networkd-dhcp-common.c | 3 ++- + src/network/networkd-dhcp-prefix-delegation.c | 4 ++-- + src/network/networkd-dhcp-server.c | 2 +- + src/network/networkd-dhcp4.c | 2 +- + src/network/networkd-link.c | 2 +- + src/network/networkd-route.c | 8 ++++---- + src/network/networkd-setlink.c | 2 +- + src/shared/linux/ethtool.h | 3 ++- + src/shared/netif-util.c | 2 +- + src/udev/udev-builtin-net_id.c | 2 +- + 34 files changed, 41 insertions(+), 39 deletions(-) + +--- a/src/libsystemd-network/sd-dhcp6-client.c ++++ b/src/libsystemd-network/sd-dhcp6-client.c +@@ -5,7 +5,7 @@ + + #include <errno.h> + #include <sys/ioctl.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/if_infiniband.h> + + #include "sd-dhcp6-client.h" +--- a/src/network/netdev/bareudp.c ++++ b/src/network/netdev/bareudp.c +@@ -2,7 +2,7 @@ + * Copyright © 2020 VMware, Inc. */ + + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "bareudp.h" + #include "netlink-util.h" +--- a/src/network/netdev/batadv.c ++++ b/src/network/netdev/batadv.c +@@ -3,7 +3,7 @@ + #include <inttypes.h> + #include <netinet/in.h> + #include <linux/genetlink.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "batadv.h" + #include "fileio.h" +--- a/src/network/netdev/bond.c ++++ b/src/network/netdev/bond.c +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "alloc-util.h" + #include "bond.h" +--- a/src/network/netdev/bridge.c ++++ b/src/network/netdev/bridge.c +@@ -2,7 +2,7 @@ + + #include <net/if.h> + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/if_bridge.h> + + #include "bridge.h" +--- a/src/network/netdev/dummy.c ++++ b/src/network/netdev/dummy.c +@@ -1,6 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "dummy.h" + +--- a/src/network/netdev/geneve.c ++++ b/src/network/netdev/geneve.c +@@ -2,7 +2,7 @@ + + #include <net/if.h> + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "alloc-util.h" + #include "conf-parser.h" +--- a/src/network/netdev/ifb.c ++++ b/src/network/netdev/ifb.c +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later + * Copyright © 2019 VMware, Inc. */ + +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "ifb.h" + +--- a/src/network/netdev/ipoib.c ++++ b/src/network/netdev/ipoib.c +@@ -1,6 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/if_link.h> + + #include "ipoib.h" +--- a/src/network/netdev/ipvlan.c ++++ b/src/network/netdev/ipvlan.c +@@ -2,7 +2,7 @@ + + #include <net/if.h> + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "conf-parser.h" + #include "ipvlan.h" +--- a/src/network/netdev/macsec.c ++++ b/src/network/netdev/macsec.c +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/if_ether.h> + #include <linux/if_macsec.h> + #include <linux/genetlink.h> +--- a/src/network/netdev/macvlan.c ++++ b/src/network/netdev/macvlan.c +@@ -2,7 +2,7 @@ + + #include <net/if.h> + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "conf-parser.h" + #include "macvlan.h" +--- a/src/network/netdev/netdev.c ++++ b/src/network/netdev/netdev.c +@@ -2,7 +2,7 @@ + + #include <net/if.h> + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <unistd.h> + + #include "alloc-util.h" +--- a/src/network/netdev/netdevsim.c ++++ b/src/network/netdev/netdevsim.c +@@ -1,6 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "netdevsim.h" + +--- a/src/network/netdev/nlmon.c ++++ b/src/network/netdev/nlmon.c +@@ -1,6 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "nlmon.h" + +--- a/src/network/netdev/tunnel.c ++++ b/src/network/netdev/tunnel.c +@@ -2,7 +2,7 @@ + + #include <netinet/in.h> + #include <linux/fou.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/if_tunnel.h> + #include <linux/ip.h> + #include <linux/ip6_tunnel.h> +--- a/src/network/netdev/vcan.c ++++ b/src/network/netdev/vcan.c +@@ -1,6 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "vcan.h" + +--- a/src/network/netdev/veth.c ++++ b/src/network/netdev/veth.c +@@ -3,7 +3,7 @@ + #include <errno.h> + #include <net/if.h> + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/veth.h> + + #include "netlink-util.h" +--- a/src/network/netdev/vlan.c ++++ b/src/network/netdev/vlan.c +@@ -2,7 +2,7 @@ + + #include <errno.h> + #include <net/if.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/if_vlan.h> + + #include "parse-util.h" +--- a/src/network/netdev/vrf.c ++++ b/src/network/netdev/vrf.c +@@ -2,7 +2,7 @@ + + #include <net/if.h> + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "vrf.h" + +--- a/src/network/netdev/vxcan.c ++++ b/src/network/netdev/vxcan.c +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + + #include <linux/can/vxcan.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "vxcan.h" + +--- a/src/network/netdev/vxlan.c ++++ b/src/network/netdev/vxlan.c +@@ -2,7 +2,7 @@ + + #include <net/if.h> + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "conf-parser.h" + #include "alloc-util.h" +--- a/src/network/netdev/xfrm.c ++++ b/src/network/netdev/xfrm.c +@@ -1,6 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "missing_network.h" + #include "xfrm.h" +--- a/src/network/networkd-bridge-mdb.c ++++ b/src/network/networkd-bridge-mdb.c +@@ -1,7 +1,5 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <net/if.h> +-#include <linux/if_bridge.h> + + #include "netlink-util.h" + #include "networkd-bridge-mdb.h" +@@ -11,6 +9,8 @@ + #include "networkd-queue.h" + #include "string-util.h" + #include "vlan-util.h" ++#include <net/if.h> ++#include <linux/if_bridge.h> + + #define STATIC_BRIDGE_MDB_ENTRIES_PER_NETWORK_MAX 1024U + +--- a/src/network/networkd-dhcp-common.c ++++ b/src/network/networkd-dhcp-common.c +@@ -1,7 +1,8 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> ++#include <net/if.h> + + #include "bus-error.h" + #include "dhcp-identifier.h" +--- a/src/network/networkd-dhcp-prefix-delegation.c ++++ b/src/network/networkd-dhcp-prefix-delegation.c +@@ -1,7 +1,5 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <linux/ipv6_route.h> +- + #include "sd-dhcp6-client.h" + + #include "hashmap.h" +@@ -21,6 +19,8 @@ + #include "strv.h" + #include "tunnel.h" + ++#include <linux/ipv6_route.h> ++ + bool link_dhcp_pd_is_enabled(Link *link) { + assert(link); + +--- a/src/network/networkd-dhcp-server.c ++++ b/src/network/networkd-dhcp-server.c +@@ -1,7 +1,7 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/if.h> + + #include "sd-dhcp-server.h" +--- a/src/network/networkd-dhcp4.c ++++ b/src/network/networkd-dhcp4.c +@@ -3,7 +3,7 @@ + #include <netinet/in.h> + #include <netinet/ip.h> + #include <linux/if.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "alloc-util.h" + #include "dhcp-client-internal.h" +--- a/src/network/networkd-link.c ++++ b/src/network/networkd-link.c +@@ -3,7 +3,7 @@ + #include <net/if.h> + #include <netinet/in.h> + #include <linux/if.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/if_link.h> + #include <linux/netdevice.h> + #include <sys/socket.h> +--- a/src/network/networkd-route.c ++++ b/src/network/networkd-route.c +@@ -1,9 +1,5 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <linux/icmpv6.h> +-#include <linux/ipv6_route.h> +-#include <linux/nexthop.h> +- + #include "alloc-util.h" + #include "event-util.h" + #include "netlink-util.h" +@@ -21,6 +17,10 @@ + #include "vrf.h" + #include "wireguard.h" + ++#include <linux/icmpv6.h> ++#include <linux/ipv6_route.h> ++#include <linux/nexthop.h> ++ + int route_new(Route **ret) { + _cleanup_(route_freep) Route *route = NULL; + +--- a/src/network/networkd-setlink.c ++++ b/src/network/networkd-setlink.c +@@ -2,7 +2,7 @@ + + #include <netinet/in.h> + #include <linux/if.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/if_bridge.h> + + #include "missing_network.h" +--- a/src/shared/linux/ethtool.h ++++ b/src/shared/linux/ethtool.h +@@ -16,7 +16,8 @@ + + #include <linux/kernel.h> + #include <linux/types.h> +-#include <linux/if_ether.h> ++#include <netinet/if_ether.h> ++//#include <linux/if_ether.h> + + #ifndef __KERNEL__ + #include <limits.h> /* for INT_MAX */ +--- a/src/shared/netif-util.c ++++ b/src/shared/netif-util.c +@@ -1,6 +1,6 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + + #include "arphrd-util.h" + #include "device-util.h" +--- a/src/udev/udev-builtin-net_id.c ++++ b/src/udev/udev-builtin-net_id.c +@@ -18,7 +18,7 @@ + #include <stdarg.h> + #include <unistd.h> + #include <linux/if.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/netdevice.h> + #include <linux/pci_regs.h> + +--- a/src/network/netdev/wireguard.c ++++ b/src/network/netdev/wireguard.c +@@ -6,7 +6,7 @@ + #include <sys/ioctl.h> + #include <net/if.h> + #include <netinet/in.h> +-#include <linux/if_arp.h> ++//#include <linux/if_arp.h> + #include <linux/ipv6_route.h> + + #include "sd-resolve.h" 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 deleted file mode 100644 index e2e19ba068..0000000000 --- a/meta/recipes-core/systemd/systemd/0001-Fix-to-run-efi_cc-and-efi_ld-correctly-when-cross-co.patch +++ /dev/null @@ -1,62 +0,0 @@ -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-Replace-the-legacy-ULONG_LONG_MAX-with-the-C99-ULLON.patch b/meta/recipes-core/systemd/systemd/0001-Replace-the-legacy-ULONG_LONG_MAX-with-the-C99-ULLON.patch deleted file mode 100644 index 6f192a2ad2..0000000000 --- a/meta/recipes-core/systemd/systemd/0001-Replace-the-legacy-ULONG_LONG_MAX-with-the-C99-ULLON.patch +++ /dev/null @@ -1,50 +0,0 @@ -From f491dfdc88ddbba36a24a75b2063aff027461b83 Mon Sep 17 00:00:00 2001 -From: Adrian Bunk <bunk@stusta.de> -Date: Thu, 16 May 2019 22:20:07 +0300 -Subject: Replace the legacy ULONG_LONG_MAX with the C99 ULLONG_MAX - -Upstream-Status: Backport -Signed-off-by: Adrian Bunk <bunk@stusta.de> ---- - src/journal-remote/journal-remote-main.c | 4 ++-- - src/shutdown/shutdown.c | 2 +- - 2 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/src/journal-remote/journal-remote-main.c b/src/journal-remote/journal-remote-main.c -index 2321a91e7b..d32c51c3ce 100644 ---- a/src/journal-remote/journal-remote-main.c -+++ b/src/journal-remote/journal-remote-main.c -@@ -528,7 +528,7 @@ static int dispatch_http_event(sd_event_source *event, - void *userdata) { - MHDDaemonWrapper *d = userdata; - int r; -- MHD_UNSIGNED_LONG_LONG timeout = ULONG_LONG_MAX; -+ MHD_UNSIGNED_LONG_LONG timeout = ULLONG_MAX; - - assert(d); - -@@ -538,7 +538,7 @@ static int dispatch_http_event(sd_event_source *event, - return log_error_errno(SYNTHETIC_ERRNO(EINVAL), - "MHD_run failed!"); - if (MHD_get_timeout(d->daemon, &timeout) == MHD_NO) -- timeout = ULONG_LONG_MAX; -+ timeout = ULLONG_MAX; - - r = sd_event_source_set_time(d->timer_event, timeout); - if (r < 0) { -diff --git a/src/shutdown/shutdown.c b/src/shutdown/shutdown.c -index 35b2c2aa46..9623fe9ea2 100644 ---- a/src/shutdown/shutdown.c -+++ b/src/shutdown/shutdown.c -@@ -212,7 +212,7 @@ static int sync_making_progress(unsigned long long *prev_dirty) { - } - - static void sync_with_progress(void) { -- unsigned long long dirty = ULONG_LONG_MAX; -+ unsigned long long dirty = ULLONG_MAX; - unsigned checks; - pid_t pid; - int r; --- -2.20.1 - 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 deleted file mode 100644 index ed14e25bce..0000000000 --- a/meta/recipes-core/systemd/systemd/0001-Revert-meson-print-EFI-CC-configuration-nicely.patch +++ /dev/null @@ -1,33 +0,0 @@ -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 deleted file mode 100644 index 0d2ebf62bd..0000000000 --- a/meta/recipes-core/systemd/systemd/0001-Revert-meson-use-an-array-option-for-efi-cc.patch +++ /dev/null @@ -1,77 +0,0 @@ -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 index 00670ca2b1..330ad492ba 100644 --- 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 @@ -1,8 +1,8 @@ -From 98254e4798e79d52ac6b562616cd244120f6e239 Mon Sep 17 00:00:00 2001 +From f9974d7dc289551bfbf823b716fd32b43c54e465 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 +Subject: [PATCH] binfmt: Don't install dependency links at install time for + the binfmt services use [Install] blocks so that they get created when the service is enabled like a traditional service. @@ -16,6 +16,9 @@ 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 +++ @@ -23,34 +26,34 @@ Signed-off-by: Chen Qi <Qi.Chen@windriver.com> 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/units/meson.build b/units/meson.build -index d695084..7b1f14a 100644 +index a9bf28f6d9..11d3644168 100644 --- a/units/meson.build +++ b/units/meson.build -@@ -47,8 +47,7 @@ units = [ +@@ -63,8 +63,7 @@ units = [ ['poweroff.target', '', - 'runlevel0.target'], + (with_runlevels ? 'runlevel0.target' : '')], ['printer.target', ''], - ['proc-sys-fs-binfmt_misc.automount', 'ENABLE_BINFMT', - 'sysinit.target.wants/'], + ['proc-sys-fs-binfmt_misc.automount', 'ENABLE_BINFMT'], ['proc-sys-fs-binfmt_misc.mount', 'ENABLE_BINFMT'], ['reboot.target', '', - 'runlevel6.target ctrl-alt-del.target'], -@@ -134,8 +133,7 @@ in_units = [ - ['systemd-ask-password-console.service', ''], - ['systemd-ask-password-wall.service', ''], + 'ctrl-alt-del.target' + (with_runlevels ? ' runlevel6.target' : '')], +@@ -184,8 +183,7 @@ in_units = [ + ['rescue.service', ''], + ['serial-getty@.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-bless-boot.service', 'HAVE_GNU_EFI HAVE_BLKID'], ['systemd-boot-check-no-failures.service', ''], ['systemd-coredump@.service', 'ENABLE_COREDUMP'], diff --git a/units/proc-sys-fs-binfmt_misc.automount b/units/proc-sys-fs-binfmt_misc.automount -index 30a6bc9..4231f3b 100644 +index 172c8757ab..f65d8930c6 100644 --- a/units/proc-sys-fs-binfmt_misc.automount +++ b/units/proc-sys-fs-binfmt_misc.automount -@@ -18,3 +18,6 @@ ConditionPathIsReadWrite=/proc/sys/ +@@ -19,3 +19,6 @@ ConditionPathIsReadWrite=/proc/sys/ [Automount] Where=/proc/sys/fs/binfmt_misc @@ -58,7 +61,7 @@ index 30a6bc9..4231f3b 100644 +[Install] +WantedBy=sysinit.target diff --git a/units/systemd-binfmt.service.in b/units/systemd-binfmt.service.in -index e940c7c..6be7f5c 100644 +index 96f595ad72..7c010bb224 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 @@ -67,15 +70,12 @@ index e940c7c..6be7f5c 100644 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 + After=proc-sys-fs-binfmt_misc.mount + After=local-fs.target +@@ -31,3 +32,6 @@ RemainAfterExit=yes + ExecStart={{ROOTLIBEXECDIR}}/systemd-binfmt + ExecStop={{ROOTLIBEXECDIR}}/systemd-binfmt --unregister TimeoutSec=90s + +[Install] +WantedBy=sysinit.target --- -2.7.4 - 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 deleted file mode 100644 index 7d764b4115..0000000000 --- a/meta/recipes-core/systemd/systemd/0001-meson-Add-Defi-objcopy-option-to-specify-objcopy.patch +++ /dev/null @@ -1,48 +0,0 @@ -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-pass-correct-parameters-to-getdents64.patch b/meta/recipes-core/systemd/systemd/0001-pass-correct-parameters-to-getdents64.patch new file mode 100644 index 0000000000..03a29b5327 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0001-pass-correct-parameters-to-getdents64.patch @@ -0,0 +1,50 @@ +From fbc10748c7c59d82024a4d35146b8dfef8d52927 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 21 Jan 2022 15:15:11 -0800 +Subject: [PATCH 1/2] pass correct parameters to getdents64 + +Fixes +../git/src/basic/recurse-dir.c:57:40: error: incompatible pointer types passing 'uint8_t *' (aka 'unsigned char *') to parameter of type 'struct dirent *' [-Werror,-Wincompatible-pointer-types] + n = getdents64(dir_fd, (uint8_t*) de->buffer + de->buffer_size, bs - de->buffer_size); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +../git/src/basic/stat-util.c:102:28: error: incompatible pointer types passing 'union (unnamed union at ../git/src/basic/stat-util.c:78:9) *' to parameter of type 'struct dirent *' [-Werror,-Wincompatible-pointer-types] + n = getdents64(fd, &buffer, sizeof(buffer)); + ^~~~~~~ + +Upstream-Status: Pending +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + src/basic/recurse-dir.c | 2 +- + src/basic/stat-util.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/basic/recurse-dir.c b/src/basic/recurse-dir.c +index efa1797b7b..797285e3be 100644 +--- a/src/basic/recurse-dir.c ++++ b/src/basic/recurse-dir.c +@@ -54,7 +54,7 @@ int readdir_all(int dir_fd, + bs = MIN(MALLOC_SIZEOF_SAFE(de) - offsetof(DirectoryEntries, buffer), (size_t) SSIZE_MAX); + assert(bs > de->buffer_size); + +- n = getdents64(dir_fd, (uint8_t*) de->buffer + de->buffer_size, bs - de->buffer_size); ++ n = getdents64(dir_fd, de->buffer + de->buffer_size, bs - de->buffer_size); + if (n < 0) + return -errno; + if (n == 0) +diff --git a/src/basic/stat-util.c b/src/basic/stat-util.c +index efac7b002e..9e1fe7f5a0 100644 +--- a/src/basic/stat-util.c ++++ b/src/basic/stat-util.c +@@ -99,7 +99,7 @@ int dir_is_empty_at(int dir_fd, const char *path) { + return fd; + } + +- n = getdents64(fd, &buffer, sizeof(buffer)); ++ n = getdents64(fd, (struct dirent *)&buffer, sizeof(buffer)); + if (n < 0) + return -errno; + +-- +2.34.1 + diff --git a/meta/recipes-core/systemd/systemd/0001-src-udev-udev-event.c-must-include-sys-wait.h.patch b/meta/recipes-core/systemd/systemd/0001-src-udev-udev-event.c-must-include-sys-wait.h.patch deleted file mode 100644 index 565deba1d0..0000000000 --- a/meta/recipes-core/systemd/systemd/0001-src-udev-udev-event.c-must-include-sys-wait.h.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 010f917cf222d2c7205584056fe0e4c581a2e1b1 Mon Sep 17 00:00:00 2001 -From: Adrian Bunk <bunk@stusta.de> -Date: Thu, 16 May 2019 22:09:46 +0300 -Subject: src/udev/udev-event.c must #include <sys/wait.h> - -Fixes the following build failure with musl: -../git/src/udev/udev-event.c: In function 'spawn_wait': -../git/src/udev/udev-event.c:600:53: error: 'WEXITED' undeclared (first use in this function); did you mean 'WIFEXITED'? - r = sd_event_add_child(e, NULL, spawn->pid, WEXITED, on_spawn_sigchld, spawn); - ^~~~~~~ - -This looks like a bug in udev-event.c that could also have broken -the compilation after some future glibc header reshuffle. - -Upstream-Status: Backport -Signed-off-by: Adrian Bunk <bunk@stusta.de> ---- - src/udev/udev-event.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c -index cab1b5ac0c..a0a7ac0f9e 100644 ---- a/src/udev/udev-event.c -+++ b/src/udev/udev-event.c -@@ -7,6 +7,7 @@ - #include <stddef.h> - #include <stdio.h> - #include <stdlib.h> -+#include <sys/wait.h> - #include <unistd.h> - - #include "sd-event.h" --- -2.20.1 - diff --git a/meta/recipes-core/systemd/systemd/0001-systemd.pc.in-use-ROOTPREFIX-without-suffixed-slash.patch b/meta/recipes-core/systemd/systemd/0001-systemd.pc.in-use-ROOTPREFIX-without-suffixed-slash.patch new file mode 100644 index 0000000000..752824688f --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0001-systemd.pc.in-use-ROOTPREFIX-without-suffixed-slash.patch @@ -0,0 +1,42 @@ +From 58860e0f248576a80ff2af256ba42713c186ae93 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Tue, 29 Sep 2020 18:01:41 -0700 +Subject: [PATCH] systemd.pc.in: use ROOTPREFIX without suffixed slash + +This complements the commit +https://github.com/poettering/systemd/commit/b612c26ceb9f56af0271fc9f07c1724d2d260a8a + +Upstream-Status: Pending +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + src/core/systemd.pc.in | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/core/systemd.pc.in b/src/core/systemd.pc.in +index b5cc8f9..21dbf30 100644 +--- a/src/core/systemd.pc.in ++++ b/src/core/systemd.pc.in +@@ -65,16 +65,16 @@ systemdshutdowndir=${systemd_shutdown_dir} + tmpfiles_dir=${prefix}/lib/tmpfiles.d + tmpfilesdir=${tmpfiles_dir} + +-sysusers_dir=${rootprefix}/lib/sysusers.d ++sysusers_dir=${prefix}/lib/sysusers.d + sysusersdir=${sysusers_dir} + +-sysctl_dir=${rootprefix}/lib/sysctl.d ++sysctl_dir=${prefix}/lib/sysctl.d + sysctldir=${sysctl_dir} + +-binfmt_dir=${rootprefix}/lib/binfmt.d ++binfmt_dir=${prefix}/lib/binfmt.d + binfmtdir=${binfmt_dir} + +-modules_load_dir=${rootprefix}/lib/modules-load.d ++modules_load_dir=${prefix}/lib/modules-load.d + modulesloaddir=${modules_load_dir} + + catalog_dir=${prefix}/lib/systemd/catalog +-- +2.25.1 + diff --git a/meta/recipes-core/systemd/systemd/0001-test-parse-argument-Include-signal.h.patch b/meta/recipes-core/systemd/systemd/0001-test-parse-argument-Include-signal.h.patch new file mode 100644 index 0000000000..898e8af904 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0001-test-parse-argument-Include-signal.h.patch @@ -0,0 +1,27 @@ +From 93c7e482d39cf7765974b3c729d29c1b120a60e3 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Mon, 24 May 2021 18:26:27 -0700 +Subject: [PATCH] test-parse-argument: Include signal.h + +Fixes +src/test/test-parse-argument.c:49:29: error: use of undeclared identifier 'SIGABRT' + +Upstream-Status: Submitted [https://github.com/systemd/systemd/pull/19718] +Signed-off-by: Khem Raj <raj.khem@gmail.com> + +--- + src/test/test-parse-argument.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/test/test-parse-argument.c b/src/test/test-parse-argument.c +index cf3d54288a..15104e5282 100644 +--- a/src/test/test-parse-argument.c ++++ b/src/test/test-parse-argument.c +@@ -5,6 +5,7 @@ + #include "parse-argument.h" + #include "stdio-util.h" + #include "tests.h" ++#include <signal.h> + + TEST(parse_json_argument) { + JsonFormatFlags flags = JSON_FORMAT_PRETTY; diff --git a/meta/recipes-core/systemd/systemd/0002-Add-sys-stat.h-for-S_IFDIR.patch b/meta/recipes-core/systemd/systemd/0002-Add-sys-stat.h-for-S_IFDIR.patch new file mode 100644 index 0000000000..7dfa1a0df2 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0002-Add-sys-stat.h-for-S_IFDIR.patch @@ -0,0 +1,29 @@ +From d16f7b37c917b91e951b9313e2c8264c72ed93e5 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Fri, 21 Jan 2022 15:17:37 -0800 +Subject: [PATCH 2/2] Add sys/stat.h for S_IFDIR + +../git/src/shared/mkdir-label.c:13:61: error: use of undeclared identifier 'S_IFDIR' + r = mac_selinux_create_file_prepare_at(dirfd, path, S_IFDIR); + +Upstream-Status: Pending +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + src/shared/mkdir-label.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/shared/mkdir-label.c b/src/shared/mkdir-label.c +index d36a6466d7..63b764cd83 100644 +--- a/src/shared/mkdir-label.c ++++ b/src/shared/mkdir-label.c +@@ -4,6 +4,7 @@ + #include "selinux-util.h" + #include "smack-util.h" + #include "user-util.h" ++#include <sys/stat.h> + + int mkdirat_label(int dirfd, const char *path, mode_t mode) { + int r; +-- +2.34.1 + 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 index c6213ab88e..5027682df2 100644 --- 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 @@ -1,7 +1,7 @@ -From 1eb84534dea05d41afed1d898cba212ad7d310dd Mon Sep 17 00:00:00 2001 +From 5d730902f47498a2866b46875352f6810a01d67c 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 +Subject: [PATCH] don't use glibc-specific qsort_r Upstream-Status: Inappropriate [musl specific] @@ -10,22 +10,22 @@ 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 v247] +Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com> + --- - src/basic/sort-util.h | 14 -------------- - src/libsystemd/sd-hwdb/hwdb-util.c | 19 ++++++++++++++----- - src/shared/format-table.c | 36 ++++++++++++++++++++++++------------ + src/basic/sort-util.h | 14 -------------- + src/shared/format-table.c | 36 ++++++++++++++++++++++++------------ + src/shared/hwdb-util.c | 19 ++++++++++++++----- 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_); \ +@@ -61,18 +61,4 @@ static inline void _qsort_safe(void *bas + _qsort_safe((p), (n), sizeof((p)[0]), (comparison_fn_t) _func_); \ }) -- --static inline void qsort_r_safe(void *base, size_t nmemb, size_t size, __compar_d_fn_t compar, void *userdata) { + +-static inline void qsort_r_safe(void *base, size_t nmemb, size_t size, comparison_userdata_fn_t compar, void *userdata) { - if (nmemb <= 1) - return; - @@ -36,57 +36,13 @@ index e029f8646e..27d68b341c 100644 -#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); \ +- qsort_r_safe((p), (n), sizeof((p)[0]), (comparison_userdata_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 +- + int cmp_int(const int *a, const int *b); --- 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 +@@ -1324,30 +1324,32 @@ static int cell_data_compare(TableData * return CMP(index_a, index_b); } @@ -94,7 +50,6 @@ index a5c0a99b08..d595cbe372 100644 +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); @@ -114,8 +69,8 @@ index a5c0a99b08..d595cbe372 100644 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++) { +- for (size_t i = 0; i < t->n_sort_map; i++) { ++ for (size_t i = 0; i < user_table->n_sort_map; i++) { TableData *d, *dd; - d = t->data[*a + t->sort_map[i]]; @@ -130,8 +85,8 @@ index a5c0a99b08..d595cbe372 100644 } /* 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++) +@@ -2009,7 +2011,12 @@ int table_print(Table *t, FILE *f) { + for (size_t i = 0; i < n_rows; i++) sorted[i] = i * t->n_columns; - typesafe_qsort_r(sorted, n_rows, table_data_compare, t); @@ -144,8 +99,8 @@ index a5c0a99b08..d595cbe372 100644 } if (t->display_map) -@@ -1534,7 +1541,12 @@ int table_to_json(Table *t, JsonVariant **ret) { - for (i = 0; i < n_rows; i++) +@@ -2647,7 +2654,12 @@ int table_to_json(Table *t, JsonVariant + for (size_t i = 0; i < n_rows; i++) sorted[i] = i * t->n_columns; - typesafe_qsort_r(sorted, n_rows, table_data_compare, t); @@ -158,6 +113,45 @@ index a5c0a99b08..d595cbe372 100644 } if (t->display_map) --- -2.11.0 - +--- a/src/shared/hwdb-util.c ++++ b/src/shared/hwdb-util.c +@@ -127,9 +127,13 @@ static struct trie* trie_free(struct tri + + 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, +@@ -157,7 +161,10 @@ static int trie_node_add_value(struct tr + .value_off = v, + }; + +- val = typesafe_bsearch_r(&search, node->values, node->values_count, trie_values_cmp, trie); ++ trie_node_add_value_trie = trie; ++ val = bsearch(&search, node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp); ++ trie_node_add_value_trie = NULL; ++ + if (val) { + /* At this point we have 2 identical properties on the same match-string. + * Since we process files in order, we just replace the previous value. */ +@@ -183,7 +190,9 @@ static int trie_node_add_value(struct tr + .line_number = line_number, + }; + node->values_count++; +- typesafe_qsort_r(node->values, node->values_count, trie_values_cmp, trie); ++ trie_node_add_value_trie = trie; ++ qsort(node->values, node->values_count, sizeof(struct trie_value_entry), trie_values_cmp); ++ trie_node_add_value_trie = NULL; + return 0; + } + 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 deleted file mode 100644 index df5506cc2b..0000000000 --- a/meta/recipes-core/systemd/systemd/0002-use-lnr-wrapper-instead-of-looking-for-relative-opti.patch +++ /dev/null @@ -1,64 +0,0 @@ -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> ---- - 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 56c98b9..3386546 100644 ---- a/meson.build -+++ b/meson.build -@@ -630,10 +630,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 501cd43..f4e4ac9 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 e2b2603..210d604 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 --- -2.7.4 - diff --git a/meta/recipes-core/systemd/systemd/0003-implment-systemd-sysv-install-for-OE.patch b/meta/recipes-core/systemd/systemd/0003-implment-systemd-sysv-install-for-OE.patch index 6695d56804..c6204786b3 100644 --- a/meta/recipes-core/systemd/systemd/0003-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 47864989388bcd04d647ecf618ad7e260399dbb6 Mon Sep 17 00:00:00 2001 +From f9078501a1495c9991431d1435d081cd2e830328 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 3/5] implment systemd-sysv-install for OE +Subject: [PATCH] implment systemd-sysv-install for OE Use update-rc.d for enabling/disabling and status command to check the status of the sysv service @@ -9,12 +9,13 @@ to check the status of the sysv service Upstream-Status: Inappropriate [OE-Specific] Signed-off-by: Khem Raj <raj.khem@gmail.com> + --- src/systemctl/systemd-sysv-install.SKELETON | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/systemctl/systemd-sysv-install.SKELETON b/src/systemctl/systemd-sysv-install.SKELETON -index 8c16cf9..9f078a1 100755 +index 8c16cf99913f..9f078a121469 100755 --- a/src/systemctl/systemd-sysv-install.SKELETON +++ b/src/systemctl/systemd-sysv-install.SKELETON @@ -32,17 +32,17 @@ case "$1" in @@ -38,6 +39,3 @@ index 8c16cf9..9f078a1 100755 ;; *) usage ;; --- -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 index 2e39f7a2e1..f3edc7d82b 100644 --- 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 @@ -1,24 +1,26 @@ -From a9421d55102fc84f77f7c21a2479fcd00652b896 Mon Sep 17 00:00:00 2001 +From 3b42a888685aee1776a12cff84a5fe0063378483 Mon Sep 17 00:00:00 2001 From: Chen Qi <Qi.Chen@windriver.com> Date: Mon, 25 Feb 2019 13:55:12 +0800 -Subject: [PATCH 03/24] missing_type.h: add __compare_fn_t and comparison_fn_t +Subject: [PATCH] missing_type.h: add __compare_fn_t and comparison_fn_t Make it work with musl where comparison_fn_t and __compare_fn_t is not provided. Upstream-Status: Inappropriate [musl specific] +Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> +[Rebased for v244] Signed-off-by: Chen Qi <Qi.Chen@windriver.com> [Rebased for v242] Signed-off-by: Andrej Valek <andrej.valek@siemens.com> + --- - src/basic/missing_type.h | 9 +++++++++ - src/basic/sort-util.h | 1 + - src/journal/catalog.c | 1 + - 3 files changed, 11 insertions(+) + src/basic/missing_type.h | 9 +++++++++ + src/basic/sort-util.h | 1 + + src/core/kmod-setup.c | 1 + + src/libsystemd/sd-journal/catalog.c | 1 + + 4 files changed, 12 insertions(+) -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 @@ @@ -34,30 +36,33 @@ index bf8a6caa1b..2134fe5095 100644 +#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" ++#include "missing_type.h" - void *xbsearch_r(const void *key, const void *base, size_t nmemb, size_t size, - __compar_d_fn_t compar, void *arg); -diff --git a/src/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 @@ + /* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the + * external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that +--- a/src/core/kmod-setup.c ++++ b/src/core/kmod-setup.c +@@ -10,6 +10,7 @@ + #include "macro.h" + #include "recurse-dir.h" + #include "string-util.h" ++#include "missing_type.h" + + #if HAVE_KMOD + #include "module-util.h" +--- a/src/libsystemd/sd-journal/catalog.c ++++ b/src/libsystemd/sd-journal/catalog.c +@@ -28,6 +28,7 @@ #include "string-util.h" #include "strv.h" #include "tmpfile-util.h" -+#include "missing.h" ++#include "missing_type.h" const char * const catalog_file_dirs[] = { "/usr/local/lib/systemd/catalog/", --- -2.11.0 - 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 index fa8217e3da..d93f630752 100644 --- 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 @@ -1,55 +1,51 @@ -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 +From 3e0df2c22bfd37bc62bf09a01ec498e40d3599de Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin <alex.kanavin@gmail.com> +Date: Sat, 22 May 2021 20:26:24 +0200 +Subject: [PATCH] add fallback parse_printf_format implementation Upstream-Status: Inappropriate [musl specific] Signed-off-by: Emil Renner Berthing <systemd@esmil.dk> Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Chen Qi <Qi.Chen@windriver.com> +[rebased for systemd 243] +Signed-off-by: Scott Murray <scott.murray@konsulko.com> + --- - meson.build | 1 + - src/basic/meson.build | 5 + - src/basic/parse-printf-format.c | 273 ++++++++++++++++++++++++++++++++++++++++ - src/basic/parse-printf-format.h | 57 +++++++++ - src/basic/stdio-util.h | 2 +- - src/journal/journal-send.c | 2 +- + meson.build | 1 + + src/basic/meson.build | 5 + + src/basic/parse-printf-format.c | 273 +++++++++++++++++++++++ + src/basic/parse-printf-format.h | 57 +++++ + src/basic/stdio-util.h | 2 +- + src/libsystemd/sd-journal/journal-send.c | 2 +- 6 files changed, 338 insertions(+), 2 deletions(-) create mode 100644 src/basic/parse-printf-format.c create mode 100644 src/basic/parse-printf-format.h -diff --git a/meson.build b/meson.build -index 79195c9748..0bffbf29c5 100644 --- a/meson.build +++ b/meson.build -@@ -685,6 +685,7 @@ foreach header : ['crypt.h', +@@ -686,6 +686,7 @@ endif + foreach header : ['crypt.h', 'linux/memfd.h', 'linux/vm_sockets.h', - 'linux/can/vxcan.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 91e0df3d2f..a732b554da 100644 --- a/src/basic/meson.build +++ b/src/basic/meson.build -@@ -298,6 +298,11 @@ foreach item : [['af', af_list_txt, 'af', ''], - endforeach +@@ -335,6 +335,11 @@ endforeach basic_sources += generated_gperf_headers -+ + +if conf.get('HAVE_PRINTF_H') != 1 + basic_sources += [files('parse-printf-format.c')] +endif + - 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 ++ + ############################################################ + + arch_list = [ --- /dev/null +++ b/src/basic/parse-printf-format.c @@ -0,0 +1,273 @@ @@ -326,9 +322,6 @@ index 0000000000..49437e5445 + + return last; +} -diff --git a/src/basic/parse-printf-format.h b/src/basic/parse-printf-format.h -new file mode 100644 -index 0000000000..47be7522d7 --- /dev/null +++ b/src/basic/parse-printf-format.h @@ -0,0 +1,57 @@ @@ -389,12 +382,10 @@ index 0000000000..47be7522d7 +size_t parse_printf_format(const char *fmt, size_t n, int *types); + +#endif /* HAVE_PRINTF_H */ -diff --git a/src/basic/stdio-util.h b/src/basic/stdio-util.h -index 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+ */ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once -#include <printf.h> @@ -406,20 +397,18 @@ index c3b9448d4f..2937aa13b1 100644 #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 + #define snprintf_ok(buf, len, fmt, ...) \ + ({ \ +--- a/src/libsystemd/sd-journal/journal-send.c ++++ b/src/libsystemd/sd-journal/journal-send.c @@ -2,7 +2,6 @@ #include <errno.h> #include <fcntl.h> -#include <printf.h> #include <stddef.h> - #include <sys/socket.h> #include <sys/un.h> + #include <unistd.h> @@ -21,6 +20,7 @@ #include "stdio-util.h" #include "string-util.h" @@ -428,6 +417,3 @@ index 5ef11fa1a4..6384ab620c 100644 #define SNDBUF_SIZE (8*1024*1024) --- -2.11.0 - 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 deleted file mode 100644 index 738f8eb7b6..0000000000 --- a/meta/recipes-core/systemd/systemd/0004-rules-whitelist-hd-devices.patch +++ /dev/null @@ -1,35 +0,0 @@ -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> ---- - 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 1d8880e..e53c8ea 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*|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*|scm*|pmem*|nbd*|zd*|hd*", GOTO="persistent_storage_end" - - # ignore partitions that span the entire disk - TEST=="whole_disk", GOTO="persistent_storage_end" --- -2.7.4 - 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 deleted file mode 100644 index 5312083fdd..0000000000 --- a/meta/recipes-core/systemd/systemd/0005-rules-watch-metadata-changes-in-ide-devices.patch +++ /dev/null @@ -1,45 +0,0 @@ -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> ---- - 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 a1458e9..3ba4b6b4 100644 ---- a/rules/60-block.rules -+++ b/rules/60-block.rules -@@ -8,4 +8,4 @@ ACTION=="add", SUBSYSTEM=="module", KERNEL=="block", ATTR{parameters/events_dfl_ - ACTION=="change", SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST=="block", ATTR{block/*/uevent}="change" - - # watch metadata changes, caused by tools closing the device node which was opened for writing --ACTION!="remove", SUBSYSTEM=="block", KERNEL=="loop*|nvme*|sd*|vd*|xvd*|pmem*|mmcblk*|dasd*|nbd*", OPTIONS+="watch" -+ACTION!="remove", SUBSYSTEM=="block", KERNEL=="loop*|nvme*|sd*|vd*|xvd*|pmem*|mmcblk*|dasd*|nbd*|hd*", OPTIONS+="watch" --- -2.7.4 - 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 index 47ee2795a7..36545c2f60 100644 --- 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 @@ -1,7 +1,7 @@ -From 399fd3eda3045636a70da438a0fd1406cc332ed1 Mon Sep 17 00:00:00 2001 +From cef23a651ea200e30e1e6ed2a2564505e3a42d46 Mon Sep 17 00:00:00 2001 From: Chen Qi <Qi.Chen@windriver.com> Date: Mon, 25 Feb 2019 14:18:21 +0800 -Subject: [PATCH 05/24] src/basic/missing.h: check for missing strndupa +Subject: [PATCH] src/basic/missing.h: check for missing strndupa include missing.h for definition of strndupa @@ -11,68 +11,117 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Chen Qi <Qi.Chen@windriver.com> [Rebased for v242] Signed-off-by: Andrej Valek <andrej.valek@siemens.com> +[rebased for systemd 243] +Signed-off-by: Scott Murray <scott.murray@konsulko.com> +Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> +[rebased for systemd 244] +[Rebased for v247] +Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com> + --- meson.build | 1 + src/backlight/backlight.c | 1 + + src/basic/cgroup-util.c | 1 + src/basic/env-util.c | 1 + + src/basic/log.c | 1 + src/basic/missing_stdlib.h | 12 ++++++++++++ src/basic/mkdir.c | 1 + + src/basic/mountpoint-util.c | 1 + src/basic/parse-util.c | 1 + + src/basic/path-lookup.c | 1 + + src/basic/percent-util.c | 1 + src/basic/proc-cmdline.c | 1 + src/basic/procfs-util.c | 1 + src/basic/time-util.c | 1 + + src/boot/bless-boot.c | 1 + src/core/dbus-cgroup.c | 1 + + src/core/dbus-execute.c | 1 + src/core/dbus-util.c | 1 + + src/core/execute.c | 1 + src/core/kmod-setup.c | 1 + src/core/service.c | 1 + + src/coredump/coredump-vacuum.c | 1 + + src/journal-remote/journal-remote-main.c | 1 + src/journal/journalctl.c | 1 + src/libsystemd/sd-bus/bus-message.c | 1 + src/libsystemd/sd-bus/bus-objects.c | 1 + + src/libsystemd/sd-bus/bus-socket.c | 1 + + src/libsystemd/sd-bus/sd-bus.c | 1 + src/libsystemd/sd-bus/test-bus-benchmark.c | 1 + + src/libsystemd/sd-journal/sd-journal.c | 1 + src/locale/keymap-util.c | 1 + + src/login/pam_systemd.c | 1 + + src/network/generator/network-generator.c | 1 + src/nspawn/nspawn-settings.c | 1 + + src/nss-mymachines/nss-mymachines.c | 1 + + src/portable/portable.c | 1 + + src/resolve/resolvectl.c | 1 + + src/shared/bus-get-properties.c | 1 + + src/shared/bus-unit-procs.c | 1 + + src/shared/bus-unit-util.c | 1 + + src/shared/bus-util.c | 1 + src/shared/dns-domain.c | 1 + src/shared/journal-importer.c | 1 + src/shared/logs-show.c | 1 + src/shared/pager.c | 1 + - src/shared/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 + - 29 files changed, 40 insertions(+) + 51 files changed, 62 insertions(+) --- a/meson.build +++ b/meson.build -@@ -572,6 +572,7 @@ foreach ident : [ - #include <unistd.h>'''], - ['explicit_bzero' , '''#include <string.h>'''], - ['reallocarray', '''#include <malloc.h>'''], -+ ['strndupa' , '''#include <string.h>'''], - ] +@@ -507,6 +507,7 @@ foreach ident : ['secure_getenv', '__sec + endforeach - have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE') + foreach ident : [ ++ ['strndupa' , '''#include <string.h>'''], + ['memfd_create', '''#include <sys/mman.h>'''], + ['gettid', '''#include <sys/types.h> + #include <unistd.h>'''], --- a/src/backlight/backlight.c +++ b/src/backlight/backlight.c -@@ -17,6 +17,7 @@ +@@ -19,6 +19,7 @@ #include "string-util.h" #include "strv.h" #include "util.h" -+#include "missing.h" ++#include "missing_stdlib.h" + + static int help(void) { + _cleanup_free_ char *link = NULL; +--- a/src/basic/cgroup-util.c ++++ b/src/basic/cgroup-util.c +@@ -37,6 +37,7 @@ + #include "unit-name.h" + #include "user-util.h" + #include "xattr-util.h" ++#include "missing_stdlib.h" - static int find_pci_or_platform_parent(sd_device *device, sd_device **ret) { - const char *subsystem, *sysname, *value; + static int cg_enumerate_items(const char *controller, const char *path, FILE **_f, const char *item) { + _cleanup_free_ char *fs = NULL; --- a/src/basic/env-util.c +++ b/src/basic/env-util.c -@@ -16,6 +16,7 @@ +@@ -19,6 +19,7 @@ #include "string-util.h" #include "strv.h" #include "utf8.h" -+#include "missing.h" ++#include "missing_stdlib.h" + + /* We follow bash for the character set. Different shells have different rules. */ + #define VALID_BASH_ENV_NAME_CHARS \ +--- a/src/basic/log.c ++++ b/src/basic/log.c +@@ -36,6 +36,7 @@ + #include "terminal-util.h" + #include "time-util.h" + #include "utf8.h" ++#include "missing_stdlib.h" + + #define SNDBUF_SIZE (8*1024*1024) - #define VALID_CHARS_ENV_NAME \ - DIGITS LETTERS \ --- a/src/basic/missing_stdlib.h +++ b/src/basic/missing_stdlib.h @@ -11,3 +11,15 @@ @@ -93,261 +142,461 @@ Signed-off-by: Andrej Valek <andrej.valek@siemens.com> +#endif --- a/src/basic/mkdir.c +++ b/src/basic/mkdir.c -@@ -14,6 +14,7 @@ +@@ -15,6 +15,7 @@ #include "stat-util.h" #include "stdio-util.h" #include "user-util.h" -+#include "missing.h" ++#include "missing_stdlib.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; + int mkdir_safe_internal( + const char *path, +--- a/src/basic/mountpoint-util.c ++++ b/src/basic/mountpoint-util.c +@@ -13,6 +13,7 @@ + #include "missing_stat.h" + #include "missing_syscall.h" + #include "mkdir.h" ++#include "missing_stdlib.h" + #include "mountpoint-util.h" + #include "nulstr-util.h" + #include "parse-util.h" --- a/src/basic/parse-util.c +++ b/src/basic/parse-util.c -@@ -19,6 +19,7 @@ - #include "process-util.h" +@@ -18,6 +18,7 @@ #include "stat-util.h" #include "string-util.h" -+#include "missing.h" + #include "strv.h" ++#include "missing_stdlib.h" int parse_boolean(const char *v) { if (!v) +--- a/src/basic/path-lookup.c ++++ b/src/basic/path-lookup.c +@@ -16,6 +16,7 @@ + #include "strv.h" + #include "tmpfile-util.h" + #include "user-util.h" ++#include "missing_stdlib.h" + + int xdg_user_runtime_dir(char **ret, const char *suffix) { + const char *e; +--- a/src/basic/percent-util.c ++++ b/src/basic/percent-util.c +@@ -3,6 +3,7 @@ + #include "percent-util.h" + #include "string-util.h" + #include "parse-util.h" ++#include "missing_stdlib.h" + + static int parse_parts_value_whole(const char *p, const char *symbol) { + const char *pc, *n; --- a/src/basic/proc-cmdline.c +++ b/src/basic/proc-cmdline.c @@ -15,6 +15,7 @@ #include "string-util.h" #include "util.h" #include "virt.h" -+#include "missing.h" ++#include "missing_stdlib.h" int proc_cmdline(char **ret) { const char *e; --- a/src/basic/procfs-util.c +++ b/src/basic/procfs-util.c -@@ -11,6 +11,7 @@ +@@ -12,6 +12,7 @@ #include "procfs-util.h" #include "stdio-util.h" #include "string-util.h" -+#include "missing.h" ++#include "missing_stdlib.h" - int procfs_tasks_get_limit(uint64_t *ret) { + int procfs_get_pid_max(uint64_t *ret) { _cleanup_free_ char *value = NULL; --- a/src/basic/time-util.c +++ b/src/basic/time-util.c -@@ -28,6 +28,7 @@ +@@ -26,6 +26,7 @@ #include "string-util.h" #include "strv.h" #include "time-util.h" -+#include "missing.h" ++#include "missing_stdlib.h" static clockid_t map_clock_id(clockid_t c) { ---- 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" +--- a/src/boot/bless-boot.c ++++ b/src/boot/bless-boot.c +@@ -19,6 +19,7 @@ + #include "util.h" + #include "verbs.h" + #include "virt.h" ++#include "missing_stdlib.h" + + static char **arg_path = NULL; - static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_cgroup_device_policy, cgroup_device_policy, CGroupDevicePolicy); +--- a/src/core/dbus-execute.c ++++ b/src/core/dbus-execute.c +@@ -44,6 +44,7 @@ + #include "unit-printf.h" + #include "user-util.h" + #include "utf8.h" ++#include "missing_stdlib.h" + BUS_DEFINE_PROPERTY_GET_ENUM(bus_property_get_exec_output, exec_output, ExecOutput); + static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_exec_input, exec_input, ExecInput); --- a/src/core/dbus-util.c +++ b/src/core/dbus-util.c -@@ -7,6 +7,7 @@ +@@ -9,6 +9,7 @@ #include "unit-printf.h" #include "user-util.h" #include "unit.h" -+#include "missing.h" ++#include "missing_stdlib.h" int bus_property_get_triggered_unit( sd_bus *bus, +--- a/src/core/execute.c ++++ b/src/core/execute.c +@@ -102,6 +102,7 @@ + #include "unit-serialize.h" + #include "user-util.h" + #include "utmp-wtmp.h" ++#include "missing_stdlib.h" + + #define IDLE_TIMEOUT_USEC (5*USEC_PER_SEC) + #define IDLE_TIMEOUT2_USEC (1*USEC_PER_SEC) --- a/src/core/kmod-setup.c +++ b/src/core/kmod-setup.c @@ -11,6 +11,7 @@ - #include "kmod-setup.h" - #include "macro.h" + #include "recurse-dir.h" #include "string-util.h" -+#include "missing.h" + #include "missing_type.h" ++#include "missing_stdlib.h" #if HAVE_KMOD - #include <libkmod.h> + #include "module-util.h" --- a/src/core/service.c +++ b/src/core/service.c @@ -42,6 +42,7 @@ #include "unit.h" #include "utf8.h" #include "util.h" -+#include "missing.h" ++#include "missing_stdlib.h" static const UnitActiveState state_translation_table[_SERVICE_STATE_MAX] = { [SERVICE_DEAD] = UNIT_INACTIVE, +--- a/src/coredump/coredump-vacuum.c ++++ b/src/coredump/coredump-vacuum.c +@@ -16,6 +16,7 @@ + #include "string-util.h" + #include "time-util.h" + #include "user-util.h" ++#include "missing_stdlib.h" + + #define DEFAULT_MAX_USE_LOWER (uint64_t) (1ULL*1024ULL*1024ULL) /* 1 MiB */ + #define DEFAULT_MAX_USE_UPPER (uint64_t) (4ULL*1024ULL*1024ULL*1024ULL) /* 4 GiB */ +--- a/src/journal-remote/journal-remote-main.c ++++ b/src/journal-remote/journal-remote-main.c +@@ -24,6 +24,7 @@ + #include "stat-util.h" + #include "string-table.h" + #include "strv.h" ++#include "missing_stdlib.h" + + #define PRIV_KEY_FILE CERTIFICATE_ROOT "/private/journal-remote.pem" + #define CERT_FILE CERTIFICATE_ROOT "/certs/journal-remote.pem" --- a/src/journal/journalctl.c +++ b/src/journal/journalctl.c -@@ -67,6 +67,7 @@ - #include "tmpfile-util.h" +@@ -73,6 +73,7 @@ #include "unit-name.h" #include "user-util.h" -+#include "missing.h" + #include "varlink.h" ++#include "missing_stdlib.h" #define DEFAULT_FSS_INTERVAL_USEC (15*USEC_PER_MINUTE) - + #define PROCESS_INOTIFY_INTERVAL 1024 /* Every 1,024 messages processed */ --- a/src/libsystemd/sd-bus/bus-message.c +++ b/src/libsystemd/sd-bus/bus-message.c -@@ -21,6 +21,7 @@ +@@ -20,6 +20,7 @@ #include "strv.h" #include "time-util.h" #include "utf8.h" -+#include "missing.h" ++#include "missing_stdlib.h" static int message_append_basic(sd_bus_message *m, char type, const void *p, const void **stored); --- a/src/libsystemd/sd-bus/bus-objects.c +++ b/src/libsystemd/sd-bus/bus-objects.c -@@ -13,6 +13,7 @@ +@@ -12,6 +12,7 @@ #include "set.h" #include "string-util.h" #include "strv.h" -+#include "missing.h" ++#include "missing_stdlib.h" static int node_vtable_get_userdata( sd_bus *bus, +--- a/src/libsystemd/sd-bus/bus-socket.c ++++ b/src/libsystemd/sd-bus/bus-socket.c +@@ -28,6 +28,7 @@ + #include "string-util.h" + #include "user-util.h" + #include "utf8.h" ++#include "missing_stdlib.h" + + #define SNDBUF_SIZE (8*1024*1024) + +--- a/src/libsystemd/sd-bus/sd-bus.c ++++ b/src/libsystemd/sd-bus/sd-bus.c +@@ -43,6 +43,7 @@ + #include "string-util.h" + #include "strv.h" + #include "user-util.h" ++#include "missing_stdlib.h" + + #define log_debug_bus_message(m) \ + do { \ --- a/src/libsystemd/sd-bus/test-bus-benchmark.c +++ b/src/libsystemd/sd-bus/test-bus-benchmark.c @@ -14,6 +14,7 @@ - #include "missing_resource.h" + #include "string-util.h" #include "time-util.h" #include "util.h" -+#include "missing.h" ++#include "missing_stdlib.h" #define MAX_SIZE (2*1024*1024) +--- a/src/libsystemd/sd-journal/sd-journal.c ++++ b/src/libsystemd/sd-journal/sd-journal.c +@@ -41,6 +41,7 @@ + #include "string-util.h" + #include "strv.h" + #include "syslog-util.h" ++#include "missing_stdlib.h" + + #define JOURNAL_FILES_MAX 7168 + --- a/src/locale/keymap-util.c +++ b/src/locale/keymap-util.c -@@ -23,6 +23,7 @@ +@@ -24,6 +24,7 @@ #include "string-util.h" #include "strv.h" #include "tmpfile-util.h" -+#include "missing.h" ++#include "missing_stdlib.h" static bool startswith_comma(const char *s, const char *prefix) { s = startswith(s, prefix); +--- a/src/login/pam_systemd.c ++++ b/src/login/pam_systemd.c +@@ -31,6 +31,7 @@ + #include "locale-util.h" + #include "login-util.h" + #include "macro.h" ++#include "missing_stdlib.h" + #include "pam-util.h" + #include "parse-util.h" + #include "path-util.h" +--- a/src/network/generator/network-generator.c ++++ b/src/network/generator/network-generator.c +@@ -13,6 +13,7 @@ + #include "string-table.h" + #include "string-util.h" + #include "strv.h" ++#include "missing_stdlib.h" + + /* + # .network --- a/src/nspawn/nspawn-settings.c +++ b/src/nspawn/nspawn-settings.c -@@ -16,6 +16,7 @@ +@@ -17,6 +17,7 @@ #include "strv.h" #include "user-util.h" #include "util.h" -+#include "missing.h" ++#include "missing_stdlib.h" Settings *settings_new(void) { Settings *s; +--- a/src/nss-mymachines/nss-mymachines.c ++++ b/src/nss-mymachines/nss-mymachines.c +@@ -21,6 +21,7 @@ + #include "nss-util.h" + #include "signal-util.h" + #include "string-util.h" ++#include "missing_stdlib.h" + + static void setup_logging_once(void) { + static pthread_once_t once = PTHREAD_ONCE_INIT; +--- a/src/portable/portable.c ++++ b/src/portable/portable.c +@@ -39,6 +39,7 @@ + #include "strv.h" + #include "tmpfile-util.h" + #include "user-util.h" ++#include "missing_stdlib.h" + + /* Markers used in the first line of our 20-portable.conf unit file drop-in to determine, that a) the unit file was + * dropped there by the portable service logic and b) for which image it was dropped there. */ +--- a/src/resolve/resolvectl.c ++++ b/src/resolve/resolvectl.c +@@ -43,6 +43,7 @@ + #include "utf8.h" + #include "verb-log-control.h" + #include "verbs.h" ++#include "missing_stdlib.h" + + static int arg_family = AF_UNSPEC; + static int arg_ifindex = 0; +--- a/src/shared/bus-get-properties.c ++++ b/src/shared/bus-get-properties.c +@@ -4,6 +4,7 @@ + #include "rlimit-util.h" + #include "stdio-util.h" + #include "string-util.h" ++#include "missing_stdlib.h" + + int bus_property_get_bool( + sd_bus *bus, +--- a/src/shared/bus-unit-procs.c ++++ b/src/shared/bus-unit-procs.c +@@ -10,6 +10,7 @@ + #include "sort-util.h" + #include "string-util.h" + #include "terminal-util.h" ++#include "missing_stdlib.h" + + struct CGroupInfo { + char *cgroup_path; +--- a/src/shared/bus-unit-util.c ++++ b/src/shared/bus-unit-util.c +@@ -49,6 +49,7 @@ + #include "unit-def.h" + #include "user-util.h" + #include "utf8.h" ++#include "missing_stdlib.h" + + int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u) { + assert(message); +--- a/src/shared/bus-util.c ++++ b/src/shared/bus-util.c +@@ -21,6 +21,7 @@ + #include "path-util.h" + #include "socket-util.h" + #include "stdio-util.h" ++#include "missing_stdlib.h" + + static int name_owner_change_callback(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) { + sd_event *e = userdata; --- a/src/shared/dns-domain.c +++ b/src/shared/dns-domain.c -@@ -24,6 +24,7 @@ +@@ -17,6 +17,7 @@ #include "string-util.h" #include "strv.h" #include "utf8.h" -+#include "missing.h" ++#include "missing_stdlib.h" int dns_label_unescape(const char **name, char *dest, size_t sz, DNSLabelFlags flags) { const char *n; --- a/src/shared/journal-importer.c +++ b/src/shared/journal-importer.c -@@ -13,6 +13,7 @@ +@@ -15,6 +15,7 @@ #include "parse-util.h" #include "string-util.h" #include "unaligned.h" -+#include "missing.h" ++#include "missing_stdlib.h" enum { IMPORTER_STATE_LINE = 0, /* waiting to read, or reading line */ --- a/src/shared/logs-show.c +++ b/src/shared/logs-show.c -@@ -38,6 +38,7 @@ - #include "time-util.h" +@@ -42,6 +42,7 @@ #include "utf8.h" #include "util.h" -+#include "missing.h" + #include "web-util.h" ++#include "missing_stdlib.h" /* up to three lines (each up to 100 characters) or 300 characters, whichever is less */ #define PRINT_LINE_THRESHOLD 3 --- a/src/shared/pager.c +++ b/src/shared/pager.c -@@ -25,6 +25,7 @@ +@@ -26,6 +26,7 @@ #include "strv.h" #include "terminal-util.h" #include "util.h" -+#include "missing.h" ++#include "missing_stdlib.h" static pid_t pager_pid = 0; ---- 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; --- 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" ++#include "missing_stdlib.h" static bool uid_range_intersect(UidRange *range, uid_t start, uid_t nr) { assert(range); --- a/src/socket-proxy/socket-proxyd.c +++ b/src/socket-proxy/socket-proxyd.c -@@ -28,6 +28,7 @@ +@@ -26,6 +26,7 @@ #include "socket-util.h" #include "string-util.h" #include "util.h" -+#include "missing.h" ++#include "missing_stdlib.h" #define BUFFER_SIZE (256 * 1024) --- a/src/test/test-hexdecoct.c +++ b/src/test/test-hexdecoct.c -@@ -6,6 +6,7 @@ - #include "hexdecoct.h" +@@ -7,6 +7,7 @@ #include "macro.h" + #include "random-util.h" #include "string-util.h" -+#include "missing.h" ++#include "missing_stdlib.h" + #include "tests.h" - static void test_hexchar(void) { - assert_se(hexchar(0xa) == 'a'); + TEST(hexchar) { --- a/src/udev/udev-builtin-path_id.c +++ b/src/udev/udev-builtin-path_id.c -@@ -23,6 +23,7 @@ - #include "strv.h" +@@ -22,6 +22,7 @@ #include "sysexits.h" #include "udev-builtin.h" -+#include "missing.h" + #include "udev-util.h" ++#include "missing_stdlib.h" _printf_(2,3) static void path_prepend(char **path, const char *fmt, ...) { +--- a/src/udev/udev-event.c ++++ b/src/udev/udev-event.c +@@ -35,6 +35,7 @@ + #include "udev-util.h" + #include "udev-watch.h" + #include "user-util.h" ++#include "missing_stdlib.h" + + typedef struct Spawn { + sd_device *device; --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c -@@ -40,6 +40,7 @@ - #include "udev.h" +@@ -34,6 +34,7 @@ + #include "udev-util.h" #include "user-util.h" - #include "util.h" -+#include "missing.h" + #include "virt.h" ++#include "missing_stdlib.h" - #define PREALLOC_TOKEN 2048 #define RULES_DIRS (const char* const*) CONF_PATHS_STRV("udev/rules.d") ---- a/src/login/pam_systemd.c -+++ b/src/login/pam_systemd.c -@@ -27,6 +27,7 @@ - #include "hostname-util.h" - #include "login-util.h" - #include "macro.h" -+#include "missing.h" + +--- a/src/core/dbus-cgroup.c ++++ b/src/core/dbus-cgroup.c +@@ -21,6 +21,7 @@ #include "parse-util.h" #include "path-util.h" - #include "process-util.h" + #include "percent-util.h" ++#include "missing_stdlib.h" + #include "socket-util.h" + + BUS_DEFINE_PROPERTY_GET(bus_property_get_tasks_max, "t", TasksMax, tasks_max_resolve); +--- a/src/fstab-generator/fstab-generator.c ++++ b/src/fstab-generator/fstab-generator.c +@@ -29,6 +29,7 @@ + #include "util.h" + #include "virt.h" + #include "volatile-util.h" ++#include "missing_stdlib.h" + + typedef enum MountPointFlags { + MOUNT_NOAUTO = 1 << 0, diff --git a/meta/recipes-core/systemd/systemd/0006-Include-netinet-if_ether.h.patch b/meta/recipes-core/systemd/systemd/0006-Include-netinet-if_ether.h.patch deleted file mode 100644 index b41f6c7bee..0000000000 --- a/meta/recipes-core/systemd/systemd/0006-Include-netinet-if_ether.h.patch +++ /dev/null @@ -1,96 +0,0 @@ -From 67a988ae82c776d11be76de7180d50ea027ac442 Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Mon, 25 Feb 2019 14:24:20 +0800 -Subject: [PATCH 06/24] 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 { - ^~~~~~ - -Upstream-Status: Inappropriate [musl specific] - -Signed-off-by: Khem Raj <raj.khem@gmail.com> -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> ---- - src/libsystemd/sd-netlink/netlink-types.c | 1 + - src/network/netdev/tuntap.c | 1 + - src/network/networkd-brvlan.c | 1 + - src/udev/net/ethtool-util.c | 1 + - src/udev/net/ethtool-util.h | 1 + - src/udev/udev-builtin-net_setup_link.c | 1 + - 6 files changed, 6 insertions(+) - -diff --git a/src/libsystemd/sd-netlink/netlink-types.c b/src/libsystemd/sd-netlink/netlink-types.c -index 9dcd3f2..e23ff4c 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/netlink.h> - #include <linux/rtnetlink.h> - #include <linux/genetlink.h> -diff --git a/src/network/netdev/tuntap.c b/src/network/netdev/tuntap.c -index 951138d..1ad499d 100644 ---- a/src/network/netdev/tuntap.c -+++ b/src/network/netdev/tuntap.c -@@ -2,6 +2,7 @@ - - #include <errno.h> - #include <fcntl.h> -+#include <netinet/if_ether.h> - #include <linux/if_tun.h> - #include <net/if.h> - #include <netinet/if_ether.h> -diff --git a/src/network/networkd-brvlan.c b/src/network/networkd-brvlan.c -index 8377623..132af60 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/udev/net/ethtool-util.c b/src/udev/net/ethtool-util.c -index 0dcec03..3695b10 100644 ---- a/src/udev/net/ethtool-util.c -+++ b/src/udev/net/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/udev/net/ethtool-util.h b/src/udev/net/ethtool-util.h -index 618b26b..ebfe82a 100644 ---- a/src/udev/net/ethtool-util.h -+++ b/src/udev/net/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/udev-builtin-net_setup_link.c b/src/udev/udev-builtin-net_setup_link.c -index a845dfa..177289a 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" --- -2.7.4 - 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 index aa2b4cbcf1..846c01bd4f 100644 --- a/meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not.patch +++ b/meta/recipes-core/systemd/systemd/0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch @@ -1,8 +1,7 @@ -From f8a239b182158ca0a537ba053cb0e6bad9c3a2fb Mon Sep 17 00:00:00 2001 +From fb068403b25002156435350165ea418a6338a313 Mon Sep 17 00:00:00 2001 From: Chen Qi <Qi.Chen@windriver.com> Date: Mon, 25 Feb 2019 14:56:21 +0800 -Subject: [PATCH 07/24] don't fail if GLOB_BRACE and GLOB_ALTDIRFUNC is not - defined +Subject: [PATCH] don't fail if GLOB_BRACE and GLOB_ALTDIRFUNC is not defined If the standard library doesn't provide brace expansion users just won't get it. @@ -15,17 +14,18 @@ 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 | 13 ++++++++++++- + src/basic/glob-util.c | 12 ++++++++++++ src/test/test-glob-util.c | 16 ++++++++++++++++ src/tmpfiles/tmpfiles.c | 10 ++++++++++ - 3 files changed, 38 insertions(+), 1 deletion(-) + 3 files changed, 38 insertions(+) -diff --git a/src/basic/glob-util.c b/src/basic/glob-util.c -index 32c53f8..ae358d9 100644 --- a/src/basic/glob-util.c +++ b/src/basic/glob-util.c -@@ -13,6 +13,12 @@ +@@ -12,6 +12,12 @@ #include "path-util.h" #include "strv.h" @@ -38,7 +38,7 @@ index 32c53f8..ae358d9 100644 static void closedir_wrapper(void* v) { (void) closedir(v); } -@@ -20,6 +26,7 @@ static void closedir_wrapper(void* v) { +@@ -19,6 +25,7 @@ static void closedir_wrapper(void* v) { int safe_glob(const char *path, int flags, glob_t *pglob) { int k; @@ -46,7 +46,7 @@ index 32c53f8..ae358d9 100644 /* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */ assert(!(flags & GLOB_ALTDIRFUNC)); -@@ -33,10 +40,14 @@ int safe_glob(const char *path, int flags, glob_t *pglob) { +@@ -32,9 +39,14 @@ int safe_glob(const char *path, int flag pglob->gl_lstat = lstat; if (!pglob->gl_stat) pglob->gl_stat = stat; @@ -55,19 +55,16 @@ index 32c53f8..ae358d9 100644 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 b4f4144..f0d474e 100644 --- a/src/test/test-glob-util.c +++ b/src/test/test-glob-util.c @@ -13,6 +13,12 @@ - #include "rm-rf.h" + #include "tests.h" #include "tmpfile-util.h" +/* Don't fail if the standard library @@ -76,10 +73,10 @@ index b4f4144..f0d474e 100644 +#define GLOB_BRACE 0 +#endif + - static void test_glob_exists(void) { + TEST(glob_exists) { char name[] = "/tmp/test-glob_exists.XXXXXX"; int fd = -1; -@@ -40,11 +46,13 @@ static void test_glob_no_dot(void) { +@@ -40,11 +46,13 @@ TEST(glob_no_dot) { const char *fn; _cleanup_globfree_ glob_t g = { @@ -93,7 +90,7 @@ index b4f4144..f0d474e 100644 }; int r; -@@ -52,11 +60,19 @@ static void test_glob_no_dot(void) { +@@ -52,11 +60,19 @@ TEST(glob_no_dot) { assert_se(mkdtemp(template)); fn = strjoina(template, "/*"); @@ -113,11 +110,9 @@ index b4f4144..f0d474e 100644 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 d9d1cc1..477d1e3 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c -@@ -63,6 +63,12 @@ +@@ -67,6 +67,12 @@ #include "umask-util.h" #include "user-util.h" @@ -130,7 +125,7 @@ index d9d1cc1..477d1e3 100644 /* This reads all files listed in /etc/tmpfiles.d/?*.conf and creates * them in the file system. This is intended to be used to create * properly owned directories beneath /tmp, /var/tmp, /run, which are -@@ -1839,7 +1845,9 @@ finish: +@@ -1961,7 +1967,9 @@ finish: static int glob_item(Item *i, action_t action) { _cleanup_globfree_ glob_t g = { @@ -140,7 +135,7 @@ index d9d1cc1..477d1e3 100644 }; int r = 0, k; char **fn; -@@ -1859,7 +1867,9 @@ static int glob_item(Item *i, action_t action) { +@@ -1981,7 +1989,9 @@ static int glob_item(Item *i, action_t a static int glob_item_recursively(Item *i, fdaction_t action) { _cleanup_globfree_ glob_t g = { @@ -150,6 +145,3 @@ index d9d1cc1..477d1e3 100644 }; int r = 0, k; char **fn; --- -2.11.0 - 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 index d5f2349f2b..57e18a5808 100644 --- 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 @@ -1,7 +1,7 @@ -From 6cd17c753d2c0a90fc791f69bbc694cbc8556a4f Mon Sep 17 00:00:00 2001 +From 7ca9887f84adba065dc2e59b3de55ace2fc72ec0 Mon Sep 17 00:00:00 2001 From: Chen Qi <Qi.Chen@windriver.com> Date: Mon, 25 Feb 2019 15:00:06 +0800 -Subject: [PATCH 08/24] add missing FTW_ macros for musl +Subject: [PATCH] add missing FTW_ macros for musl This is to avoid build failures like below for musl. @@ -10,15 +10,15 @@ This is to avoid build failures like below for musl. 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(+) + src/shared/mount-setup.c | 1 + + 2 files changed, 21 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 *); +@@ -19,3 +19,23 @@ typedef int (*comparison_fn_t)(const voi #define __COMPAR_FN_T typedef int (*__compar_fn_t)(const void *, const void *); #endif @@ -42,6 +42,23 @@ index c487e65..23602eb 100644 +#ifndef FTW_SKIP_SIBLINGS +#define FTW_SKIP_SIBLINGS 3 +#endif --- -2.7.4 - +--- a/src/shared/mount-setup.c ++++ b/src/shared/mount-setup.c +@@ -32,6 +32,7 @@ + #include "strv.h" + #include "user-util.h" + #include "virt.h" ++#include "missing_type.h" + + typedef enum MountMode { + MNT_NONE = 0, +--- a/src/test/test-recurse-dir.c ++++ b/src/test/test-recurse-dir.c +@@ -6,6 +6,7 @@ + #include "recurse-dir.h" + #include "strv.h" + #include "tests.h" ++#include "missing_type.h" + + static char **list_nftw = NULL; + 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/0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch index 8bacd0289d..0fc320420e 100644 --- a/meta/recipes-core/systemd/systemd/0010-fix-missing-of-__register_atfork-for-non-glibc-build.patch +++ b/meta/recipes-core/systemd/systemd/0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch @@ -1,20 +1,21 @@ -From f1f4b4f9684fed185bfa8b9ed409cdf241657e99 Mon Sep 17 00:00:00 2001 +From c7453b716ae308b89cf4b2b231a36ddd38a49752 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 +Subject: [PATCH] fix missing of __register_atfork for non-glibc builds Upstream-Status: Inappropriate [musl specific] Signed-off-by: Chen Qi <Qi.Chen@windriver.com> + --- src/basic/process-util.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/basic/process-util.c b/src/basic/process-util.c -index 78ce43b..aec2daf 100644 +index 461bbfe9a5..2d06f9f60a 100644 --- a/src/basic/process-util.c +++ b/src/basic/process-util.c -@@ -22,6 +22,9 @@ +@@ -18,6 +18,9 @@ #if HAVE_VALGRIND_VALGRIND_H #include <valgrind/valgrind.h> #endif @@ -24,7 +25,7 @@ index 78ce43b..aec2daf 100644 #include "alloc-util.h" #include "architecture.h" -@@ -1160,11 +1163,15 @@ void reset_cached_pid(void) { +@@ -1202,11 +1205,15 @@ void reset_cached_pid(void) { cached_pid = CACHED_PID_UNSET; } @@ -40,6 +41,3 @@ index 78ce43b..aec2daf 100644 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/0010-Use-uintmax_t-for-handling-rlim_t.patch index d6eda9c038..029f413aa8 100644 --- a/meta/recipes-core/systemd/systemd/0011-Use-uintmax_t-for-handling-rlim_t.patch +++ b/meta/recipes-core/systemd/systemd/0010-Use-uintmax_t-for-handling-rlim_t.patch @@ -1,7 +1,7 @@ -From e3f847bd0338d27aff3335b42661d8a4b66b965e Mon Sep 17 00:00:00 2001 +From 856010e268a6aca8e5f02502457afe289bd877f1 Mon Sep 17 00:00:00 2001 From: Chen Qi <Qi.Chen@windriver.com> Date: Mon, 25 Feb 2019 15:12:41 +0800 -Subject: [PATCH 11/24] Use uintmax_t for handling rlim_t +Subject: [PATCH] Use uintmax_t for handling rlim_t PRIu{32,64} is not right format to represent rlim_t type therefore use %ju and typecast the rlim_t variables to @@ -20,18 +20,17 @@ 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/basic/rlimit-util.c | 12 ++++++------ src/core/execute.c | 4 ++-- - 3 files changed, 8 insertions(+), 14 deletions(-) + 3 files changed, 9 insertions(+), 15 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" +@@ -34,13 +34,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32 + # error Unknown timex member size #endif -#if SIZEOF_RLIM_T == 8 @@ -45,29 +44,36 @@ index dece5d3..dbb87bc 100644 #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) { +@@ -44,7 +44,7 @@ int setrlimit_closest(int resource, cons + fixed.rlim_max == highest.rlim_max) + return 0; + +- log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", rlim->rlim_max, rlimit_to_string(resource), fixed.rlim_max); ++ log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", (uintmax_t)rlim->rlim_max, rlimit_to_string(resource), (uintmax_t)fixed.rlim_max); + + return RET_NERRNO(setrlimit(resource, &fixed)); + } +@@ -307,13 +307,13 @@ int rlimit_format(const struct rlimit *r if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY) - s = strdup("infinity"); + r = free_and_strdup(&s, "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); +- r = asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max); ++ r = asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max); else if (rl->rlim_max >= RLIM_INFINITY) -- (void) asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur); -+ (void) asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur); +- r = asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur); ++ r = asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur); else if (rl->rlim_cur == rl->rlim_max) -- (void) asprintf(&s, RLIM_FMT, rl->rlim_cur); -+ (void) asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur); +- r = asprintf(&s, RLIM_FMT, rl->rlim_cur); ++ r = 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) +- r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max); ++ r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max); + if (r < 0) return -ENOMEM; -@@ -404,7 +404,7 @@ int rlimit_nofile_safe(void) { + +@@ -403,7 +403,7 @@ int rlimit_nofile_safe(void) { rl.rlim_cur = FD_SETSIZE; if (setrlimit(RLIMIT_NOFILE, &rl) < 0) @@ -76,12 +82,10 @@ index 74b3a02..b02c03c 100644 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++) +@@ -5639,9 +5639,9 @@ void exec_context_dump(const ExecContext + for (unsigned i = 0; i < RLIM_NLIMITS; i++) if (c->rlimit[i]) { fprintf(f, "%sLimit%s: " RLIM_FMT "\n", - prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max); @@ -92,6 +96,3 @@ index a708231..e2b8748 100644 } if (c->ioprio_set) { --- -2.7.4 - 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/0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch index 914589dbd3..327084bae9 100644 --- a/meta/recipes-core/systemd/systemd/0014-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch +++ b/meta/recipes-core/systemd/systemd/0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch @@ -1,22 +1,20 @@ -From d3d65d4036670cbd5129fe55c09ca391286ef4b3 Mon Sep 17 00:00:00 2001 +From ad395dda5db9b1ae156be121cfc8a38960de6c55 Mon Sep 17 00:00:00 2001 From: Chen Qi <Qi.Chen@windriver.com> Date: Wed, 28 Feb 2018 21:25:22 -0800 -Subject: [PATCH 14/24] test-sizeof.c: Disable tests for missing typedefs in - musl +Subject: [PATCH] test-sizeof.c: Disable tests for missing typedefs in musl Upstream-Status: Inappropriate [musl specific] Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Chen Qi <Qi.Chen@windriver.com> + --- src/test/test-sizeof.c | 4 ++++ 1 file changed, 4 insertions(+) -diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c -index 35b0876..e78e7ca 100644 --- a/src/test/test-sizeof.c +++ b/src/test/test-sizeof.c -@@ -41,8 +41,10 @@ int main(void) { +@@ -55,8 +55,10 @@ int main(void) { info(unsigned); info(long unsigned); info(long long unsigned); @@ -24,10 +22,10 @@ index 35b0876..e78e7ca 100644 info(__syscall_ulong_t); info(__syscall_slong_t); +#endif + info(intmax_t); + info(uintmax_t); - info(float); - info(double); -@@ -60,7 +62,9 @@ int main(void) { +@@ -76,7 +78,9 @@ int main(void) { info(ssize_t); info(time_t); info(usec_t); @@ -37,6 +35,3 @@ index 35b0876..e78e7ca 100644 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/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch index fd407f604d..0026a7b72a 100644 --- a/meta/recipes-core/systemd/systemd/0015-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch +++ b/meta/recipes-core/systemd/systemd/0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch @@ -1,7 +1,7 @@ -From 48c628f532f6025c2d1646b6819cd81eb789d7fb Mon Sep 17 00:00:00 2001 +From 5d4c6b2f4b88b69b31f967371d2a6136c65dc3fd 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() +Subject: [PATCH] don't pass AT_SYMLINK_NOFOLLOW flag to faccessat() Avoid using AT_SYMLINK_NOFOLLOW flag. It doesn't seem like the right thing to do and it's not portable (not supported by musl). See: @@ -25,20 +25,18 @@ just historical and not actually necessary or desired behaviour? Upstream-Status: Inappropriate [musl specific] Signed-off-by: Andre McCurdy <armccurdy@gmail.com> + --- - src/basic/fs-util.h | 22 +++++++++++++++++++++- + src/basic/fs-util.h | 23 +++++++++++++++++++++-- src/shared/base-filesystem.c | 6 +++--- - 2 files changed, 24 insertions(+), 4 deletions(-) + 2 files changed, 24 insertions(+), 5 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); - +@@ -46,8 +46,27 @@ int futimens_opath(int fd, const struct int fd_warn_permissions(const char *path, int fd); + int stat_warn_permissions(const char *path, const struct stat *st); --#define laccess(path, mode) faccessat(AT_FDCWD, (path), (mode), AT_SYMLINK_NOFOLLOW) +/* + Avoid using AT_SYMLINK_NOFOLLOW flag. It doesn't seem like the right thing to + do and it's not portable (not supported by musl). See: @@ -58,25 +56,24 @@ index 7ad030b..d4cb1e9 100644 + or why it needs to return success for broken symlinks. Maybe just historical + and not actually necessary or desired behaviour? +*/ -+ -+#define laccess(path, mode) faccessat(AT_FDCWD, (path), (mode), 0) + #define laccess(path, mode) \ +- RET_NERRNO(faccessat(AT_FDCWD, (path), (mode), AT_SYMLINK_NOFOLLOW)) ++ RET_NERRNO(faccessat(AT_FDCWD, (path), (mode), 0)) int touch_file(const char *path, bool parents, usec_t stamp, uid_t uid, gid_t gid, mode_t mode); int touch(const char *path); -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) { +@@ -117,7 +117,7 @@ int base_filesystem_create(const char *r return log_error_errno(errno, "Failed to open root file system: %m"); - for (i = 0; i < ELEMENTSOF(table); i ++) { + for (size_t i = 0; i < ELEMENTSOF(table); i++) { - if (faccessat(fd, table[i].dir, F_OK, AT_SYMLINK_NOFOLLOW) >= 0) + if (faccessat(fd, table[i].dir, F_OK, 0) >= 0) continue; if (table[i].target) { -@@ -61,7 +61,7 @@ int base_filesystem_create(const char *root, uid_t uid, gid_t gid) { +@@ -125,7 +125,7 @@ int base_filesystem_create(const char *r /* check if one of the targets exists */ NULSTR_FOREACH(s, table[i].target) { @@ -85,7 +82,7 @@ index 89d7a7d..34b4ad5 100644 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) { +@@ -136,7 +136,7 @@ int base_filesystem_create(const char *r if (!p) return log_oom(); @@ -94,6 +91,3 @@ index 89d7a7d..34b4ad5 100644 continue; } --- -2.7.4 - diff --git a/meta/recipes-core/systemd/systemd/0016-Define-glibc-compatible-basename-for-non-glibc-syste.patch b/meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch index d5565698aa..612a535d3c 100644 --- a/meta/recipes-core/systemd/systemd/0016-Define-glibc-compatible-basename-for-non-glibc-syste.patch +++ b/meta/recipes-core/systemd/systemd/0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch @@ -1,8 +1,7 @@ -From af76c973e41929360a6e021f2ff9a7fc1d7994e9 Mon Sep 17 00:00:00 2001 +From 1803ea271b93370fdcf7ec497277344f1e775429 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 +Subject: [PATCH] Define glibc compatible basename() for non-glibc systems Fixes builds with musl, even though systemd is adamant about using non-posix basename implementation, we have a way out @@ -10,25 +9,22 @@ 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(+) + src/machine/machine-dbus.c | 5 +++++ + 1 file changed, 5 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 @@ +@@ -10,6 +10,11 @@ #include <libgen.h> #undef basename +#if !defined(__GLIBC__) ++#include <string.h> +#define basename(src) (strrchr(src,'/') ? strrchr(src,'/')+1 : src) +#endif + #include "alloc-util.h" #include "bus-common-errors.h" - #include "bus-internal.h" --- -2.7.4 - + #include "bus-get-properties.h" 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/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch index b54635e8a9..baf4903803 100644 --- a/meta/recipes-core/systemd/systemd/0017-Do-not-disable-buffering-when-writing-to-oom_score_a.patch +++ b/meta/recipes-core/systemd/systemd/0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch @@ -1,7 +1,7 @@ -From c7a4efb8bccb52e1714c151929c23e12bde59b82 Mon Sep 17 00:00:00 2001 +From 30b08f76ea7f5c324afedf97f0867b76dac9f128 Mon Sep 17 00:00:00 2001 From: Chen Qi <Qi.Chen@windriver.com> Date: Wed, 4 Jul 2018 15:00:44 +0800 -Subject: [PATCH 17/24] Do not disable buffering when writing to oom_score_adj +Subject: [PATCH] Do not disable buffering when writing to oom_score_adj On musl, disabling buffering when writing to oom_score_adj will cause the following error. @@ -17,24 +17,21 @@ 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 f773eea..79af915 100644 --- a/src/basic/process-util.c +++ b/src/basic/process-util.c -@@ -1546,7 +1546,7 @@ int set_oom_score_adjust(int value) { - sprintf(t, "%i", value); +@@ -1489,7 +1489,7 @@ int set_oom_score_adjust(int value) { + xsprintf(t, "%i", value); return write_string_file("/proc/self/oom_score_adj", t, - WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_DISABLE_BUFFER); + WRITE_STRING_FILE_VERIFY_ON_FAILURE); } - int cpus_in_affinity_mask(void) { --- -2.11.0 - - + int get_oom_score_adjust(int *ret) { diff --git a/meta/recipes-core/systemd/systemd/0018-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch b/meta/recipes-core/systemd/systemd/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch index 5901772998..878914b307 100644 --- a/meta/recipes-core/systemd/systemd/0018-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch +++ b/meta/recipes-core/systemd/systemd/0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch @@ -1,7 +1,7 @@ -From fffb2810611b4a26f5c6c0958093b5b3b7d4cd99 Mon Sep 17 00:00:00 2001 +From 873202f63f9f117c6e5a98e444cc709057042979 Mon Sep 17 00:00:00 2001 From: Chen Qi <Qi.Chen@windriver.com> Date: Tue, 10 Jul 2018 15:40:17 +0800 -Subject: [PATCH 18/24] distinguish XSI-compliant strerror_r from GNU-specifi +Subject: [PATCH] distinguish XSI-compliant strerror_r from GNU-specifi strerror_r XSI-compliant strerror_r and GNU-specifi strerror_r are different. @@ -18,33 +18,15 @@ 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 +++++ + src/libsystemd/sd-bus/bus-error.c | 5 +++++ + src/libsystemd/sd-journal/journal-send.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) { +@@ -409,7 +409,12 @@ static void bus_error_strerror(sd_bus_er return; errno = 0; @@ -57,6 +39,18 @@ index dc95237..bdda30f 100644 if (errno == ERANGE || strlen(x) >= k - 1) { free(m); k *= 2; --- -2.7.4 - +--- a/src/libsystemd/sd-journal/journal-send.c ++++ b/src/libsystemd/sd-journal/journal-send.c +@@ -348,7 +348,12 @@ static int fill_iovec_perror_and_send(co + char* j; + + errno = 0; ++#ifndef __GLIBC__ ++ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k); ++ j = buffer + 8 + k; ++#else + j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k); ++#endif + if (errno == 0) { + char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1]; + 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/0016-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch index 35cc66ff66..e6507c5f89 100644 --- a/meta/recipes-core/systemd/systemd/0019-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch +++ b/meta/recipes-core/systemd/systemd/0016-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch @@ -1,7 +1,7 @@ -From 969ab9e68249fd383f4b513b1c9306bdac4ae9b2 Mon Sep 17 00:00:00 2001 +From e7441559266074e7a33e3c11ff5cdaf5ba9c0e24 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 +Subject: [PATCH] Hide __start_BUS_ERROR_MAP and __stop_BUS_ERROR_MAP for currently unknown reasons they get exported to the shared libries even without being listed in the sym file @@ -11,15 +11,16 @@ 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 +index c49be29e46..90731bd7e7 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[] = { +@@ -55,8 +55,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 */ @@ -30,6 +31,3 @@ index bdda30f..e21853c 100644 /* 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/0020-missing_type.h-add-__compar_d_fn_t-definition.patch b/meta/recipes-core/systemd/systemd/0017-missing_type.h-add-__compar_d_fn_t-definition.patch index 753d5116ac..eeff693bc4 100644 --- a/meta/recipes-core/systemd/systemd/0020-missing_type.h-add-__compar_d_fn_t-definition.patch +++ b/meta/recipes-core/systemd/systemd/0017-missing_type.h-add-__compar_d_fn_t-definition.patch @@ -1,7 +1,7 @@ -From 75c06e3e2a4760b36fffd95cdf5535b8ad73c481 Mon Sep 17 00:00:00 2001 +From 64f4d2eb976b9f23ce85b3655a876f7299eafd58 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 +Subject: [PATCH] missing_type.h: add __compar_d_fn_t definition Fix the following compile failure: src/basic/util.h:71:18: error: unknown type name '__compar_d_fn_t'; did you mean '__compar_fn_t'? @@ -9,12 +9,13 @@ src/basic/util.h:71:18: error: unknown type name '__compar_d_fn_t'; did you mean 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 +index 3df1084ef2..697aa7f58a 100644 --- a/src/basic/missing_type.h +++ b/src/basic/missing_type.h @@ -13,6 +13,7 @@ @@ -25,6 +26,3 @@ index 7d7c1e4..85902ab 100644 #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/0018-avoid-redefinition-of-prctl_mm_map-structure.patch index cdddf83890..5ca5386289 100644 --- a/meta/recipes-core/systemd/systemd/0021-avoid-redefinition-of-prctl_mm_map-structure.patch +++ b/meta/recipes-core/systemd/systemd/0018-avoid-redefinition-of-prctl_mm_map-structure.patch @@ -1,7 +1,7 @@ -From 3fbf61d54b82fc9bf21d8039bfd89dc9efc5bbcd Mon Sep 17 00:00:00 2001 +From d95330f328c23c1cd6c51aeca43f081746cf2899 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 +Subject: [PATCH] avoid redefinition of prctl_mm_map structure Fix the following compile failure: error: redefinition of 'struct prctl_mm_map' @@ -9,16 +9,17 @@ 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 +index ab851306ba..5547cad875 100644 --- a/src/basic/missing_prctl.h +++ b/src/basic/missing_prctl.h @@ -1,7 +1,9 @@ - /* SPDX-License-Identifier: LGPL-2.1+ */ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once +#ifdef __GLIBC__ @@ -27,6 +28,3 @@ index f80cd17..47e4893 100644 /* 58319057b7847667f0c9585b9de0e8932b0fdb08 (4.3) */ #ifndef PR_CAP_AMBIENT --- -2.11.0 - diff --git a/meta/recipes-core/systemd/systemd/0019-Handle-missing-LOCK_EX.patch b/meta/recipes-core/systemd/systemd/0019-Handle-missing-LOCK_EX.patch new file mode 100644 index 0000000000..d51ac4265a --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0019-Handle-missing-LOCK_EX.patch @@ -0,0 +1,24 @@ +From 2284f2f44b1b30f10b9196e0f5c6d0a2e0c1871f Mon Sep 17 00:00:00 2001 +From: Alex Kiernan <alex.kiernan@gmail.com> +Date: Fri, 7 Aug 2020 15:19:27 +0000 +Subject: [PATCH] Handle missing LOCK_EX + +Upstream-Status: Inappropriate [musl specific] +Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> + +--- + src/partition/makefs.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/partition/makefs.c b/src/partition/makefs.c +index 7c94fbfedb..42f966722d 100644 +--- a/src/partition/makefs.c ++++ b/src/partition/makefs.c +@@ -6,6 +6,7 @@ + #include <sys/stat.h> + #include <sys/types.h> + #include <unistd.h> ++#include <sys/file.h> + + #include "alloc-util.h" + #include "blockdev-util.h" diff --git a/meta/recipes-core/systemd/systemd/0020-Fix-incompatible-pointer-type-struct-sockaddr_un.patch b/meta/recipes-core/systemd/systemd/0020-Fix-incompatible-pointer-type-struct-sockaddr_un.patch new file mode 100644 index 0000000000..1ba5c1292b --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0020-Fix-incompatible-pointer-type-struct-sockaddr_un.patch @@ -0,0 +1,36 @@ +From a6a25e1ecae91f48a4f87bf0cc17eaaf0a919ffe Mon Sep 17 00:00:00 2001 +From: Alex Kiernan <alex.kiernan@gmail.com> +Date: Fri, 7 Aug 2020 15:20:17 +0000 +Subject: [PATCH] Fix incompatible pointer type struct sockaddr_un * + +| ../../../../../../workspace/sources/systemd/src/nspawn/nspawn.c: In function 'cant_be_in_netns': +| ../../../../../../workspace/sources/systemd/src/nspawn/nspawn.c:4893:25: error: passing argument 2 of 'connect' from incompatible pointer type [-Werror=incompatible-pointer-types] +| 4893 | if (connect(fd, &sa.un, SOCKADDR_UN_LEN(sa.un)) < 0) { +| | ^~~~~~ +| | | +| | struct sockaddr_un * +| In file included from ../../../../../../workspace/sources/systemd/src/systemd/sd-daemon.h:22, +| from ../../../../../../workspace/sources/systemd/src/nspawn/nspawn.c:21: +| /home/ubuntu/poky/build/tmp/work/core2-64-poky-linux-musl/systemd/1_246-r0/recipe-sysroot/usr/include/sys/socket.h:384:19: note: expected 'const struct sockaddr *' but argument is of type 'struct sockaddr_un *' +| 384 | int connect (int, const struct sockaddr *, socklen_t); +| | ^~~~~~~~~~~~~~~~~~~~~~~ +| cc1: some warnings being treated as errors + +Upstream-Status: Inappropriate [musl specific] +Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> + +--- + src/nspawn/nspawn.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/src/nspawn/nspawn.c ++++ b/src/nspawn/nspawn.c +@@ -5389,7 +5389,7 @@ static int cant_be_in_netns(void) { + if (fd < 0) + return log_error_errno(errno, "Failed to allocate udev control socket: %m"); + +- if (connect(fd, &sa.sa, SOCKADDR_UN_LEN(sa.un)) < 0) { ++ if (connect(fd, (struct sockaddr *)&sa.sa, SOCKADDR_UN_LEN(sa.un)) < 0) { + + if (errno == ENOENT || ERRNO_IS_DISCONNECT(errno)) + return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), diff --git a/meta/recipes-core/systemd/systemd/0024-test-json.c-define-M_PIl.patch b/meta/recipes-core/systemd/systemd/0021-test-json.c-define-M_PIl.patch index 0e5629d37b..dfab8fbbdf 100644 --- a/meta/recipes-core/systemd/systemd/0024-test-json.c-define-M_PIl.patch +++ b/meta/recipes-core/systemd/systemd/0021-test-json.c-define-M_PIl.patch @@ -1,7 +1,7 @@ -From 902412c271e0c5d9cb93b10ec0fb5b119b393474 Mon Sep 17 00:00:00 2001 +From 47472da6e8900773c26da8fd26699367447d97a6 Mon Sep 17 00:00:00 2001 From: Chen Qi <Qi.Chen@windriver.com> Date: Mon, 25 Feb 2019 16:53:06 +0800 -Subject: [PATCH 24/24] test-json.c: define M_PIl +Subject: [PATCH] test-json.c: define M_PIl Fix the following compile failure: src/test/test-json.c:305:50: error: 'M_PIl' undeclared (first use in this function); did you mean 'M_PI'? @@ -9,15 +9,14 @@ src/test/test-json.c:305:50: error: 'M_PIl' undeclared (first use in this functi 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 @@ +@@ -14,6 +14,10 @@ #include "tests.h" #include "util.h" @@ -25,9 +24,6 @@ index 9b8a2a9..efc746c 100644 +#define M_PIl 3.141592653589793238462643383279502884L +#endif + - static void test_tokenizer(const char *data, ...) { + static void test_tokenizer_one(const char *data, ...) { unsigned line = 0, column = 0; void *state = NULL; --- -2.11.0 - diff --git a/meta/recipes-core/systemd/systemd/0001-do-not-disable-buffer-in-writing-files.patch b/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch index 68ca604d6d..d389e1d9f9 100644 --- a/meta/recipes-core/systemd/systemd/0001-do-not-disable-buffer-in-writing-files.patch +++ b/meta/recipes-core/systemd/systemd/0022-do-not-disable-buffer-in-writing-files.patch @@ -1,4 +1,4 @@ -From 85e3c3046562ec24fc2f09ebfd08bf9f168091d5 Mon Sep 17 00:00:00 2001 +From 0f9422780a569c79a4b28e44c79c70b4a354bd92 Mon Sep 17 00:00:00 2001 From: Chen Qi <Qi.Chen@windriver.com> Date: Fri, 1 Mar 2019 15:22:15 +0800 Subject: [PATCH] do not disable buffer in writing files @@ -16,40 +16,40 @@ 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/cgroup-util.c | 10 +++++----- src/basic/procfs-util.c | 4 ++-- - src/basic/smack-util.c | 2 +- + src/basic/sysctl-util.c | 2 +- src/basic/util.c | 2 +- src/binfmt/binfmt.c | 6 +++--- src/core/main.c | 4 ++-- src/core/smack-setup.c | 8 ++++---- src/hibernate-resume/hibernate-resume.c | 2 +- src/libsystemd/sd-device/sd-device.c | 2 +- - src/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 | 12 ++++++------ - src/udev/udevadm-trigger.c | 2 +- - src/udev/udevd.c | 6 +++--- + src/shared/cgroup-setup.c | 4 ++-- + src/shared/mount-util.c | 4 ++-- + src/shared/smack-util.c | 2 +- + src/sleep/sleep.c | 8 ++++---- src/vconsole/vconsole-setup.c | 2 +- - 17 files changed, 39 insertions(+), 39 deletions(-) + 16 files changed, 34 insertions(+), 34 deletions(-) -diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c -index fc28109..44fe985 100644 --- a/src/basic/cgroup-util.c +++ b/src/basic/cgroup-util.c -@@ -822,7 +822,7 @@ int cg_attach(const char *controller, const char *path, pid_t pid) { - - xsprintf(c, PID_FMT "\n", pid); +@@ -390,7 +390,7 @@ int cg_kill_kernel_sigkill(const char *c + if (r < 0) + return r; -- r = write_string_file(fs, c, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file(fs, c, 0); +- r = write_string_file(killfile, "1", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(killfile, "1", 0); if (r < 0) return r; -@@ -1104,7 +1104,7 @@ int cg_install_release_agent(const char *controller, const char *agent) { +@@ -803,7 +803,7 @@ int cg_install_release_agent(const char sc = strstrip(contents); if (isempty(sc)) { @@ -58,7 +58,7 @@ index fc28109..44fe985 100644 if (r < 0) return r; } else if (!path_equal(sc, agent)) -@@ -1122,7 +1122,7 @@ int cg_install_release_agent(const char *controller, const char *agent) { +@@ -821,7 +821,7 @@ int cg_install_release_agent(const char sc = strstrip(contents); if (streq(sc, "0")) { @@ -67,7 +67,7 @@ index fc28109..44fe985 100644 if (r < 0) return r; -@@ -1149,7 +1149,7 @@ int cg_uninstall_release_agent(const char *controller) { +@@ -848,7 +848,7 @@ int cg_uninstall_release_agent(const cha if (r < 0) return r; @@ -76,7 +76,7 @@ index fc28109..44fe985 100644 if (r < 0) return r; -@@ -1159,7 +1159,7 @@ int cg_uninstall_release_agent(const char *controller) { +@@ -858,7 +858,7 @@ int cg_uninstall_release_agent(const cha if (r < 0) return r; @@ -85,7 +85,7 @@ index fc28109..44fe985 100644 if (r < 0) return r; -@@ -2016,7 +2016,7 @@ int cg_set_attribute(const char *controller, const char *path, const char *attri +@@ -1704,7 +1704,7 @@ int cg_set_attribute(const char *control if (r < 0) return r; @@ -94,20 +94,9 @@ index fc28109..44fe985 100644 } int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret) { -@@ -2664,7 +2664,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 7aaf95b..25fc3de 100644 --- a/src/basic/procfs-util.c +++ b/src/basic/procfs-util.c -@@ -85,13 +85,13 @@ int procfs_tasks_set_limit(uint64_t limit) { +@@ -64,13 +64,13 @@ int procfs_tasks_set_limit(uint64_t limi * decrease it, as threads-max is the much more relevant sysctl. */ if (limit > pid_max-1) { sprintf(buffer, "%" PRIu64, limit+1); /* Add one, since PID 0 is not a valid PID */ @@ -123,24 +112,20 @@ index 7aaf95b..25fc3de 100644 if (r < 0) { uint64_t threads_max; -diff --git a/src/basic/smack-util.c b/src/basic/smack-util.c -index 123d00e..e7ea78f 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; +--- a/src/basic/sysctl-util.c ++++ b/src/basic/sysctl-util.c +@@ -58,7 +58,7 @@ int sysctl_write(const char *property, c - 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; + log_debug("Setting '%s' to '%s'", p, value); + +- return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_SUPPRESS_REDUNDANT_VIRTUAL); ++ return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_SUPPRESS_REDUNDANT_VIRTUAL); + } -diff --git a/src/basic/util.c b/src/basic/util.c -index 93d610b..97dca64 100644 + int sysctl_writef(const char *property, const char *format, ...) { --- a/src/basic/util.c +++ b/src/basic/util.c -@@ -294,7 +294,7 @@ void disable_coredumps(void) { +@@ -168,7 +168,7 @@ void disable_coredumps(void) { if (detect_container() > 0) return; @@ -149,67 +134,61 @@ index 93d610b..97dca64 100644 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 66e2f01..5daa43b 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(); +@@ -29,7 +29,7 @@ static bool arg_unregister = false; + static int delete_rule(const char *rulename) { + const char *fn = strjoina("/proc/sys/fs/binfmt_misc/", rulename); - return write_string_file(fn, "-1", WRITE_STRING_FILE_DISABLE_BUFFER); + return write_string_file(fn, "-1", 0); } - static int apply_rule(const char *rule) { -@@ -56,7 +56,7 @@ static int apply_rule(const char *rule) { - - (void) delete_rule(rule); + static int apply_rule(const char *filename, unsigned line, const char *rule) { +@@ -59,7 +59,7 @@ static int apply_rule(const char *filena + if (r >= 0) + log_debug("%s:%u: Rule '%s' deleted.", filename, line, rulename); - r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, WRITE_STRING_FILE_DISABLE_BUFFER); + r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, 0); if (r < 0) - return log_error_errno(r, "Failed to add binary format: %m"); - -@@ -213,7 +213,7 @@ static int run(int argc, char *argv[]) { + return log_error_errno(r, "%s:%u: Failed to add binary format '%s': %m", + filename, line, rulename); +@@ -226,7 +226,7 @@ static int run(int argc, char *argv[]) { } /* Flush out all rules */ -- write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER); -+ 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 46db471..726ccaf 100644 +- r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0); + if (r < 0) + log_warning_errno(r, "Failed to flush binfmt_misc rules, ignoring: %m"); + else --- a/src/core/main.c +++ b/src/core/main.c -@@ -1469,7 +1469,7 @@ static int bump_unix_max_dgram_qlen(void) { +@@ -1466,7 +1466,7 @@ static int bump_unix_max_dgram_qlen(void if (v >= DEFAULT_UNIX_MAX_DGRAM_QLEN) return 0; -- r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", WRITE_STRING_FILE_DISABLE_BUFFER, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN); -+ r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", 0, "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN); +- r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", WRITE_STRING_FILE_DISABLE_BUFFER, ++ r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", 0, + "%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN); if (r < 0) return log_full_errno(IN_SET(r, -EROFS, -EPERM, -EACCES) ? LOG_DEBUG : LOG_WARNING, r, - "Failed to bump AF_UNIX datagram queue length, ignoring: %m"); -@@ -1684,7 +1684,7 @@ static void initialize_core_pattern(bool skip_setup) { +@@ -1737,7 +1737,7 @@ static void initialize_core_pattern(bool if (getpid_cached() != 1) return; - r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, WRITE_STRING_FILE_DISABLE_BUFFER); + r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, 0); if (r < 0) - log_warning_errno(r, "Failed to write '%s' to /proc/sys/kernel/core_pattern, ignoring: %m", arg_early_core_pattern); - } -diff --git a/src/core/smack-setup.c b/src/core/smack-setup.c -index cd7fb01..077e861 100644 + log_warning_errno(r, "Failed to write '%s' to /proc/sys/kernel/core_pattern, ignoring: %m", + arg_early_core_pattern); --- a/src/core/smack-setup.c +++ b/src/core/smack-setup.c -@@ -351,17 +351,17 @@ int mac_smack_setup(bool *loaded_policy) { +@@ -320,17 +320,17 @@ int mac_smack_setup(bool *loaded_policy) } - #ifdef SMACK_RUN_LABEL + #if HAVE_SMACK_RUN_LABEL - r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER); + r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, 0); if (r < 0) @@ -228,8 +207,6 @@ index cd7fb01..077e861 100644 if (r < 0) log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m"); #endif -diff --git a/src/hibernate-resume/hibernate-resume.c b/src/hibernate-resume/hibernate-resume.c -index 17e7cd1..87a7667 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[]) { @@ -241,50 +218,31 @@ index 17e7cd1..87a7667 100644 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 c2315c0..00f81b4 100644 --- a/src/libsystemd/sd-device/sd-device.c +++ b/src/libsystemd/sd-device/sd-device.c -@@ -1852,7 +1852,7 @@ _public_ int sd_device_set_sysattr_value(sd_device *device, const char *sysattr, +@@ -2108,7 +2108,7 @@ _public_ int sd_device_set_sysattr_value if (!value) return -ENOMEM; - r = write_string_file(path, value, WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_NOFOLLOW); + r = write_string_file(path, value, 0 | WRITE_STRING_FILE_NOFOLLOW); if (r < 0) { - if (r == -ELOOP) - return -EINVAL; -diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c -index 2cebcce..7111fc1 100644 ---- a/src/login/logind-dbus.c -+++ b/src/login/logind-dbus.c -@@ -1285,7 +1285,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 168125d..dd0ab79 100644 + /* On failure, clear cache entry, as we do not know how it fails. */ + device_remove_cached_sysattr_value(device, sysattr); --- a/src/nspawn/nspawn-cgroup.c +++ b/src/nspawn/nspawn-cgroup.c -@@ -124,7 +124,7 @@ int sync_cgroup(pid_t pid, CGroupUnified unified_requested, uid_t uid_shift) { - (void) mkdir_parents(fn, 0755); +@@ -124,7 +124,7 @@ int sync_cgroup(pid_t pid, CGroupUnified + fn = strjoina(tree, cgroup, "/cgroup.procs"); sprintf(pid_string, PID_FMT, pid); -- r = write_string_file(fn, pid_string, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file(fn, pid_string, 0); +- 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 3b0ecb1..a1b5240 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c -@@ -2341,7 +2341,7 @@ static int reset_audit_loginuid(void) { +@@ -2757,7 +2757,7 @@ static int reset_audit_loginuid(void) { if (streq(p, "4294967295")) return 0; @@ -293,64 +251,76 @@ index 3b0ecb1..a1b5240 100644 if (r < 0) { log_error_errno(r, "Failed to reset audit login UID. This probably means that your kernel is too\n" -@@ -3531,13 +3531,13 @@ static int setup_uid_map(pid_t pid) { +@@ -4163,7 +4163,7 @@ static int setup_uid_map( + return log_oom(); 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); +- r = write_string_file(uid_map, s, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(uid_map, s, 0); if (r < 0) return log_error_errno(r, "Failed to write UID map: %m"); - /* We always assign the same UID and GID ranges */ +@@ -4173,7 +4173,7 @@ static int setup_uid_map( + return log_oom(); + xsprintf(uid_map, "/proc/" PID_FMT "/gid_map", pid); -- r = write_string_file(uid_map, line, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file(uid_map, line, 0); +- r = write_string_file(uid_map, s, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(uid_map, s, 0); if (r < 0) return log_error_errno(r, "Failed to write GID map: %m"); -diff --git a/src/shared/sysctl-util.c b/src/shared/sysctl-util.c -index 9be4055..f935cde 100644 ---- a/src/shared/sysctl-util.c -+++ b/src/shared/sysctl-util.c -@@ -73,7 +73,7 @@ int sysctl_write_ip_property(int af, const char *ifname, const char *property, c +--- a/src/shared/cgroup-setup.c ++++ b/src/shared/cgroup-setup.c +@@ -345,7 +345,7 @@ int cg_attach(const char *controller, co - log_debug("Setting '%s' to '%s'", p, value); + xsprintf(c, PID_FMT "\n", pid); -- 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); - } +- r = write_string_file(fs, c, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(fs, c, 0); + if (r < 0) + return r; + +@@ -877,7 +877,7 @@ int cg_enable_everywhere( + return log_debug_errno(errno, "Failed to open cgroup.subtree_control file of %s: %m", p); + } + +- r = write_string_stream(f, s, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_stream(f, s, 0); + if (r < 0) { + log_debug_errno(r, "Failed to %s controller %s for %s (%s): %m", + FLAGS_SET(mask, bit) ? "enable" : "disable", n, p, fs); +--- a/src/shared/smack-util.c ++++ b/src/shared/smack-util.c +@@ -114,7 +114,7 @@ int mac_smack_apply_pid(pid_t pid, const + return 0; + + p = procfs_file_alloca(pid, "attr/current"); +- r = write_string_file(p, label, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(p, label, 0); + if (r < 0) + return r; - int sysctl_read(const char *property, char **content) { -diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c -index 11aabaf..6aa5d37 100644 --- a/src/sleep/sleep.c +++ b/src/sleep/sleep.c -@@ -48,7 +48,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, "Faileed to write partitoin device to /sys/power/resume: %m"); +@@ -46,7 +46,7 @@ static int write_hibernate_location_info + assert(hibernate_location->swap); -@@ -84,12 +84,12 @@ static int write_hibernate_location_info(void) { + xsprintf(resume_str, "%u:%u", major(hibernate_location->devno), minor(hibernate_location->devno)); +- r = write_string_file("/sys/power/resume", resume_str, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/sys/power/resume", resume_str, 0); + if (r < 0) + return log_debug_errno(r, "Failed to write partition device to /sys/power/resume for '%s': '%s': %m", + hibernate_location->swap->device, resume_str); +@@ -73,7 +73,7 @@ static int write_hibernate_location_info + } - offset = fiemap->fm_extents[0].fe_physical / page_size(); - xsprintf(offset_str, "%" PRIu64, offset); + xsprintf(offset_str, "%" PRIu64, hibernate_location->offset); - r = write_string_file("/sys/power/resume_offset", offset_str, WRITE_STRING_FILE_DISABLE_BUFFER); + r = write_string_file("/sys/power/resume_offset", offset_str, 0); if (r < 0) - return log_debug_errno(r, "Failed to write offset '%s': %m", 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); - -@@ -103,7 +103,7 @@ static int write_mode(char **modes) { + return log_debug_errno(r, "Failed to write swap file offset to /sys/power/resume_offset for '%s': '%s': %m", + hibernate_location->swap->device, offset_str); +@@ -90,7 +90,7 @@ static int write_mode(char **modes) { STRV_FOREACH(mode, modes) { int k; @@ -359,7 +329,7 @@ index 11aabaf..6aa5d37 100644 if (k >= 0) return 0; -@@ -122,7 +122,7 @@ static int write_state(FILE **f, char **states) { +@@ -112,7 +112,7 @@ static int write_state(FILE **f, char ** STRV_FOREACH(state, states) { int k; @@ -368,64 +338,9 @@ index 11aabaf..6aa5d37 100644 if (k >= 0) return 0; log_debug_errno(k, "Failed to write '%s' to /sys/power/state: %m", *state); -@@ -217,7 +217,7 @@ static int rtc_write_wake_alarm(uint64_t sec) { - - xsprintf(buf, "%" PRIu64, sec); - -- r = write_string_file("/sys/class/rtc/rtc0/wakealarm", buf, WRITE_STRING_FILE_DISABLE_BUFFER); -+ r = write_string_file("/sys/class/rtc/rtc0/wakealarm", buf, 0); - if (r < 0) - return log_error_errno(r, "Failed to write '%s' to /sys/class/rtc/rtc0/wakealarm: %m", buf); - -diff --git a/src/udev/udevadm-trigger.c b/src/udev/udevadm-trigger.c -index b7dafb7..bab4907 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_debug_errno(r, "Failed to write '%s' to '%s', ignoring: %m", action, filename); - continue; -diff --git a/src/udev/udevd.c b/src/udev/udevd.c -index 140ec35..33063a9 100644 ---- a/src/udev/udevd.c -+++ b/src/udev/udevd.c -@@ -1185,7 +1185,7 @@ static int synthesize_change(sd_device *dev) { - */ - log_debug("Device '%s' is closed, synthesising 'change'", devname); - strscpyl(filename, sizeof(filename), syspath, "/uevent", NULL); -- write_string_file(filename, "change", WRITE_STRING_FILE_DISABLE_BUFFER); -+ write_string_file(filename, "change", 0); - - FOREACH_DEVICE(e, d) { - const char *t, *n, *s; -@@ -1200,7 +1200,7 @@ static int synthesize_change(sd_device *dev) { - - log_debug("Device '%s' is closed, synthesising partition '%s' 'change'", devname, n); - strscpyl(filename, sizeof(filename), s, "/uevent", NULL); -- write_string_file(filename, "change", WRITE_STRING_FILE_DISABLE_BUFFER); -+ write_string_file(filename, "change", 0); - } - - return 0; -@@ -1208,7 +1208,7 @@ static int synthesize_change(sd_device *dev) { - - log_debug("Device %s is closed, synthesising 'change'", devname); - strscpyl(filename, sizeof(filename), syspath, "/uevent", NULL); -- write_string_file(filename, "change", WRITE_STRING_FILE_DISABLE_BUFFER); -+ write_string_file(filename, "change", 0); - - return 0; - } -diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c -index 67dc2e4..01b83d0 100644 --- a/src/vconsole/vconsole-setup.c +++ b/src/vconsole/vconsole-setup.c -@@ -116,7 +116,7 @@ static int toggle_utf8(const char *name, int fd, bool utf8) { +@@ -108,7 +108,7 @@ static int toggle_utf8_vc(const char *na static int toggle_utf8_sysfs(bool utf8) { int r; @@ -434,6 +349,72 @@ index 67dc2e4..01b83d0 100644 if (r < 0) return log_warning_errno(r, "Failed to %s sysfs UTF-8 flag: %m", enable_disable(utf8)); --- -2.11.0 - +--- a/src/basic/namespace-util.c ++++ b/src/basic/namespace-util.c +@@ -202,12 +202,12 @@ int userns_acquire(const char *uid_map, + freeze(); + + xsprintf(path, "/proc/" PID_FMT "/uid_map", pid); +- r = write_string_file(path, uid_map, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(path, uid_map, 0); + if (r < 0) + return log_error_errno(r, "Failed to write UID map: %m"); + + xsprintf(path, "/proc/" PID_FMT "/gid_map", pid); +- r = write_string_file(path, gid_map, WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(path, gid_map, 0); + if (r < 0) + return log_error_errno(r, "Failed to write GID map: %m"); + +--- a/src/core/cgroup.c ++++ b/src/core/cgroup.c +@@ -4140,7 +4140,7 @@ int unit_cgroup_freezer_action(Unit *u, + else + u->freezer_state = FREEZER_THAWING; + +- r = write_string_file(path, one_zero(action == FREEZER_FREEZE), WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file(path, one_zero(action == FREEZER_FREEZE), 0); + if (r < 0) + return r; + +--- a/src/home/homework.c ++++ b/src/home/homework.c +@@ -284,7 +284,7 @@ static void drop_caches_now(void) { + * details. We write "2" into /proc/sys/vm/drop_caches to ensure dentries/inodes are flushed, but not + * more. */ + +- r = write_string_file("/proc/sys/vm/drop_caches", "2\n", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/sys/vm/drop_caches", "2\n", 0); + if (r < 0) + log_warning_errno(r, "Failed to drop caches, ignoring: %m"); + else +--- a/src/shared/binfmt-util.c ++++ b/src/shared/binfmt-util.c +@@ -26,7 +26,7 @@ int disable_binfmt(void) { + if (r < 0) + return log_warning_errno(r, "Failed to determine whether binfmt_misc is mounted: %m"); + +- r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER); ++ r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0); + if (r < 0) + return log_warning_errno(r, "Failed to unregister binfmt_misc entries: %m"); + +--- a/src/shared/coredump-util.c ++++ b/src/shared/coredump-util.c +@@ -70,5 +70,5 @@ int set_coredump_filter(uint64_t value) + sprintf(t, "0x%"PRIx64, value); + + return write_string_file("/proc/self/coredump_filter", t, +- WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_DISABLE_BUFFER); ++ WRITE_STRING_FILE_VERIFY_ON_FAILURE); + } +--- a/src/udev/udev-rules.c ++++ b/src/udev/udev-rules.c +@@ -2181,7 +2181,6 @@ static int udev_rule_apply_token_to_even + log_rule_debug(dev, rules, "ATTR '%s' writing '%s'", buf, value); + r = write_string_file(buf, value, + WRITE_STRING_FILE_VERIFY_ON_FAILURE | +- WRITE_STRING_FILE_DISABLE_BUFFER | + WRITE_STRING_FILE_AVOID_NEWLINE | + WRITE_STRING_FILE_VERIFY_IGNORE_NEWLINE); + if (r < 0) diff --git a/meta/recipes-core/systemd/systemd/0023-socket-util.h-include-string.h.patch b/meta/recipes-core/systemd/systemd/0023-socket-util.h-include-string.h.patch deleted file mode 100644 index 37987b57f6..0000000000 --- a/meta/recipes-core/systemd/systemd/0023-socket-util.h-include-string.h.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 56fb30d93e96d7f983af0cb4dff9155da91dd671 Mon Sep 17 00:00:00 2001 -From: Chen Qi <Qi.Chen@windriver.com> -Date: Mon, 25 Feb 2019 16:37:19 +0800 -Subject: socket-util.h: include string.h - -Fix the following compile error: -src/basic/socket-util.h:187:30: error: implicit declaration of function 'strnlen'; did you mean 'strlen'? [-Werror=implicit-function-declaration] - -Upstream-Status: Accepted - -Signed-off-by: Chen Qi <Qi.Chen@windriver.com> ---- - src/basic/socket-util.h | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/basic/socket-util.h b/src/basic/socket-util.h -index 6920fd99ba..36ec422f2c 100644 ---- a/src/basic/socket-util.h -+++ b/src/basic/socket-util.h -@@ -9,6 +9,7 @@ - #include <netinet/in.h> - #include <stdbool.h> - #include <stddef.h> -+#include <string.h> - #include <sys/socket.h> - #include <sys/types.h> - #include <sys/un.h> --- -2.20.1 - diff --git a/meta/recipes-core/systemd/systemd/0025-Handle-__cpu_mask-usage.patch b/meta/recipes-core/systemd/systemd/0025-Handle-__cpu_mask-usage.patch new file mode 100644 index 0000000000..e001ed59e8 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0025-Handle-__cpu_mask-usage.patch @@ -0,0 +1,58 @@ +From e4f9ef547fa342102db15188544daa18e71e9c66 Mon Sep 17 00:00:00 2001 +From: Scott Murray <scott.murray@konsulko.com> +Date: Fri, 13 Sep 2019 19:26:27 -0400 +Subject: [PATCH] Handle __cpu_mask usage + +Fixes errors: + +src/test/test-cpu-set-util.c:18:54: error: '__cpu_mask' undeclared (first use in this function) +src/test/test-sizeof.c:73:14: error: '__cpu_mask' undeclared (first use in this function) + +__cpu_mask is an internal type of glibc's cpu_set implementation, not +part of the POSIX definition, which is problematic when building with +musl, which does not define a matching type. From inspection of musl's +sched.h, however, it is clear that the corresponding type would be +unsigned long, which does match glibc's actual __CPU_MASK_TYPE. So, +add a typedef to cpu-set-util.h defining __cpu_mask appropriately. + +Upstream-Status: Inappropriate [musl specific] + +Signed-off-by: Scott Murray <scott.murray@konsulko.com> + +--- + src/shared/cpu-set-util.h | 2 ++ + src/test/test-sizeof.c | 2 +- + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/shared/cpu-set-util.h b/src/shared/cpu-set-util.h +index 3c63a58826..4c2d4347fc 100644 +--- a/src/shared/cpu-set-util.h ++++ b/src/shared/cpu-set-util.h +@@ -6,6 +6,8 @@ + #include "macro.h" + #include "missing_syscall.h" + ++typedef unsigned long __cpu_mask; ++ + /* This wraps the libc interface with a variable to keep the allocated size. */ + typedef struct CPUSet { + cpu_set_t *set; +diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c +index 4403c0aa52..e7e4ae112d 100644 +--- a/src/test/test-sizeof.c ++++ b/src/test/test-sizeof.c +@@ -1,6 +1,5 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + +-#include <sched.h> + #include <stdio.h> + #include <string.h> + #include <sys/types.h> +@@ -10,6 +9,7 @@ + #include <float.h> + + #include "time-util.h" ++#include "cpu-set-util.h" + + /* Print information about various types. Useful when diagnosing + * gcc diagnostics on an unfamiliar architecture. */ diff --git a/meta/recipes-core/systemd/systemd/0025-fs-utilh-add-missing-sys-stat-include.patch b/meta/recipes-core/systemd/systemd/0025-fs-utilh-add-missing-sys-stat-include.patch deleted file mode 100644 index ada404b053..0000000000 --- a/meta/recipes-core/systemd/systemd/0025-fs-utilh-add-missing-sys-stat-include.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 56e3c9581e2c9b7435d5fcbd74b47c7ccf6b3891 Mon Sep 17 00:00:00 2001 -From: Andrej Valek <andrej.valek@siemens.com> -Date: Thu, 18 Apr 2019 10:47:11 +0200 -Subject: fs-util.h: add missing sys/stat include - -fix error: -| error: passing argument 5 of 'chase_symlinks_and_stat' from incompatible pointer type [-Werror=incompatible-pointer-types] - -Signed-off-by: Andrej Valek <andrej.valek@siemens.com> - -Upstream-Status: Accepted ---- - src/basic/fs-util.h | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/basic/fs-util.h b/src/basic/fs-util.h -index b9651205e6..c153bc4448 100644 ---- a/src/basic/fs-util.h -+++ b/src/basic/fs-util.h -@@ -7,6 +7,7 @@ - #include <stdbool.h> - #include <stdint.h> - #include <sys/inotify.h> -+#include <sys/stat.h> - #include <sys/types.h> - #include <unistd.h> - --- -2.20.1 - diff --git a/meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch b/meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch new file mode 100644 index 0000000000..2d06ab84a2 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0026-Handle-missing-gshadow.patch @@ -0,0 +1,165 @@ +From 66a926cf906260c2fb5ea851e55efe03edd444dc Mon Sep 17 00:00:00 2001 +From: Alex Kiernan <alex.kiernan@gmail.com> +Date: Tue, 10 Mar 2020 11:05:20 +0000 +Subject: [PATCH] Handle missing gshadow + +gshadow usage is now present in the userdb code. Mask all uses of it to +allow compilation on musl + +Upstream-Status: Inappropriate [musl specific] +Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> +[Rebased for v247] +Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com> + +--- + src/shared/user-record-nss.c | 20 ++++++++++++++++++++ + src/shared/user-record-nss.h | 4 ++++ + src/shared/userdb.c | 7 ++++++- + 3 files changed, 30 insertions(+), 1 deletion(-) + +--- a/src/shared/user-record-nss.c ++++ b/src/shared/user-record-nss.c +@@ -331,8 +331,10 @@ int nss_group_to_group_record( + if (isempty(grp->gr_name)) + return -EINVAL; + ++#if ENABLE_GSHADOW + if (sgrp && !streq_ptr(sgrp->sg_namp, grp->gr_name)) + return -EINVAL; ++#endif + + g = group_record_new(); + if (!g) +@@ -348,6 +350,7 @@ int nss_group_to_group_record( + + g->gid = grp->gr_gid; + ++#if ENABLE_GSHADOW + if (sgrp) { + if (looks_like_hashed_password(utf8_only(sgrp->sg_passwd))) { + g->hashed_password = strv_new(sgrp->sg_passwd); +@@ -363,6 +366,7 @@ int nss_group_to_group_record( + if (r < 0) + return r; + } ++#endif + + r = json_build(&g->json, JSON_BUILD_OBJECT( + JSON_BUILD_PAIR("groupName", JSON_BUILD_STRING(g->group_name)), +@@ -388,6 +392,7 @@ int nss_sgrp_for_group(const struct grou + assert(ret_sgrp); + assert(ret_buffer); + ++#if ENABLE_GSHADOW + for (;;) { + _cleanup_free_ char *buf = NULL; + struct sgrp sgrp, *result; +@@ -416,6 +421,9 @@ int nss_sgrp_for_group(const struct grou + buflen *= 2; + buf = mfree(buf); + } ++#else ++ return -ESRCH; ++#endif + } + + int nss_group_record_by_name( +@@ -427,7 +435,9 @@ int nss_group_record_by_name( + struct group grp, *result; + bool incomplete = false; + size_t buflen = 4096; ++#if ENABLE_GSHADOW + struct sgrp sgrp, *sresult = NULL; ++#endif + int r; + + assert(name); +@@ -457,6 +467,7 @@ int nss_group_record_by_name( + buf = mfree(buf); + } + ++#if ENABLE_GSHADOW + if (with_shadow) { + r = nss_sgrp_for_group(result, &sgrp, &sbuf); + if (r < 0) { +@@ -468,6 +479,9 @@ int nss_group_record_by_name( + incomplete = true; + + r = nss_group_to_group_record(result, sresult, ret); ++#else ++ r = nss_group_to_group_record(result, NULL, ret); ++#endif + if (r < 0) + return r; + +@@ -484,7 +498,9 @@ int nss_group_record_by_gid( + struct group grp, *result; + bool incomplete = false; + size_t buflen = 4096; ++#if ENABLE_GSHADOW + struct sgrp sgrp, *sresult = NULL; ++#endif + int r; + + assert(ret); +@@ -512,6 +528,7 @@ int nss_group_record_by_gid( + buf = mfree(buf); + } + ++#if ENABLE_GSHADOW + if (with_shadow) { + r = nss_sgrp_for_group(result, &sgrp, &sbuf); + if (r < 0) { +@@ -523,6 +540,9 @@ int nss_group_record_by_gid( + incomplete = true; + + r = nss_group_to_group_record(result, sresult, ret); ++#else ++ r = nss_group_to_group_record(result, NULL, ret); ++#endif + if (r < 0) + return r; + +--- a/src/shared/user-record-nss.h ++++ b/src/shared/user-record-nss.h +@@ -2,7 +2,11 @@ + #pragma once + + #include <grp.h> ++#if ENABLE_GSHADOW + #include <gshadow.h> ++#else ++struct sgrp; ++#endif + #include <pwd.h> + #include <shadow.h> + +--- a/src/shared/userdb.c ++++ b/src/shared/userdb.c +@@ -1046,13 +1046,15 @@ int groupdb_iterator_get(UserDBIterator + if (gr) { + _cleanup_free_ char *buffer = NULL; + bool incomplete = false; ++#if ENABLE_GSHADOW + struct sgrp sgrp; +- ++#endif + if (streq_ptr(gr->gr_name, "root")) + iterator->synthesize_root = false; + if (gr->gr_gid == GID_NOBODY) + iterator->synthesize_nobody = false; + ++#if ENABLE_GSHADOW + if (!FLAGS_SET(iterator->flags, USERDB_SUPPRESS_SHADOW)) { + r = nss_sgrp_for_group(gr, &sgrp, &buffer); + if (r < 0) { +@@ -1065,6 +1067,9 @@ int groupdb_iterator_get(UserDBIterator + } + + r = nss_group_to_group_record(gr, r >= 0 ? &sgrp : NULL, ret); ++#else ++ r = nss_group_to_group_record(gr, NULL, ret); ++#endif + if (r < 0) + return r; + diff --git a/meta/recipes-core/systemd/systemd/0028-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch b/meta/recipes-core/systemd/systemd/0028-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch new file mode 100644 index 0000000000..f4a71be7cc --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0028-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch @@ -0,0 +1,42 @@ +From 6f0dd2ba75b68036d7b4ebfe47ac5eaf44d26f06 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Mon, 12 Apr 2021 23:44:53 -0700 +Subject: [PATCH] missing_syscall.h: Define MIPS ABI defines for musl + +musl does not define _MIPS_SIM_ABI32, _MIPS_SIM_NABI32, _MIPS_SIM_ABI64 +unlike glibc where these are provided by libc headers, therefore define +them here in case they are undefined + +Upstream-Status: Pending + +Signed-off-by: Khem Raj <raj.khem@gmail.com> + +--- + src/basic/missing_syscall.h | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/src/basic/missing_syscall.h ++++ b/src/basic/missing_syscall.h +@@ -20,6 +20,12 @@ + #include <asm/sgidefs.h> + #endif + ++#ifndef _MIPS_SIM_ABI32 ++#define _MIPS_SIM_ABI32 1 ++#define _MIPS_SIM_NABI32 2 ++#define _MIPS_SIM_ABI64 3 ++#endif ++ + #include "macro.h" + #include "missing_keyctl.h" + #include "missing_stat.h" +--- a/src/shared/base-filesystem.c ++++ b/src/shared/base-filesystem.c +@@ -19,6 +19,7 @@ + #include "string-util.h" + #include "umask-util.h" + #include "user-util.h" ++#include "missing_syscall.h" + + typedef struct BaseFilesystem { + const char *dir; /* directory or symlink to create */ diff --git a/meta/recipes-core/systemd/systemd/0029-network-enable-KeepConfiguration-when-running-on-net.patch b/meta/recipes-core/systemd/systemd/0029-network-enable-KeepConfiguration-when-running-on-net.patch new file mode 100644 index 0000000000..782b9645cb --- /dev/null +++ b/meta/recipes-core/systemd/systemd/0029-network-enable-KeepConfiguration-when-running-on-net.patch @@ -0,0 +1,253 @@ +From 6f4e84126aaa4e26cb6865b054ea5ddebd3906e5 Mon Sep 17 00:00:00 2001 +From: Yu Watanabe <watanabe.yu+github@gmail.com> +Date: Thu, 3 Feb 2022 12:14:19 +0900 +Subject: [PATCH] network: enable KeepConfiguration= when running on network + filesystem +Cc: pavel@zhukoff.net + +Upstream-Status: Submitted [https://github.com/systemd/systemd/pull/22383] +[YOCTO #14708] + +network-generator: rename DHCP_TYPE_DHCP -> DHCP_TYPE_DHCP4 + +To emphasize this is DHCPv4. No behavior is changed. + +stat-util: introduce path_is_network_fs() + +network: enable KeepConfiguration= when running on network filesystem + +Also, set KeepConfiguration=dhcp-on-stop by default when running in +initrd. + +Fixes #21967. +--- + man/systemd.network.xml | 6 +++-- + src/basic/stat-util.c | 9 +++++++ + src/basic/stat-util.h | 1 + + src/network/generator/network-generator.c | 4 ++-- + src/network/generator/network-generator.h | 2 +- + src/network/networkd-manager.c | 29 +++++++++++++++++++++++ + src/network/networkd-manager.h | 2 ++ + src/network/networkd-network.c | 12 ++++++---- + src/network/test-networkd-conf.c | 5 ++++ + 9 files changed, 60 insertions(+), 10 deletions(-) + +diff --git a/man/systemd.network.xml b/man/systemd.network.xml +index af431e4f2c..f90cff4cd6 100644 +--- a/man/systemd.network.xml ++++ b/man/systemd.network.xml +@@ -944,8 +944,10 @@ Table=1234</programlisting></para> + lease expires. This is contrary to the DHCP specification, but may be the best choice if, + e.g., the root filesystem relies on this connection. The setting <literal>dhcp</literal> + implies <literal>dhcp-on-stop</literal>, and <literal>yes</literal> implies +- <literal>dhcp</literal> and <literal>static</literal>. Defaults to <literal>no</literal>. +- </para> ++ <literal>dhcp</literal> and <literal>static</literal>. Defaults to ++ <literal>dhcp-on-stop</literal> when <command>systemd-networkd</command> is running in ++ initrd, <literal>yes</literal> when the root filesystem is a network filesystem, and ++ <literal>no</literal> otherwise.</para> + </listitem> + </varlistentry> + </variablelist> +diff --git a/src/basic/stat-util.c b/src/basic/stat-util.c +index efac7b002e..c2269844f8 100644 +--- a/src/basic/stat-util.c ++++ b/src/basic/stat-util.c +@@ -249,6 +249,15 @@ int path_is_temporary_fs(const char *path) { + return is_temporary_fs(&s); + } + ++int path_is_network_fs(const char *path) { ++ struct statfs s; ++ ++ if (statfs(path, &s) < 0) ++ return -errno; ++ ++ return is_network_fs(&s); ++} ++ + int stat_verify_regular(const struct stat *st) { + assert(st); + +diff --git a/src/basic/stat-util.h b/src/basic/stat-util.h +index a566114f7c..f7d2f12aa9 100644 +--- a/src/basic/stat-util.h ++++ b/src/basic/stat-util.h +@@ -53,6 +53,7 @@ int fd_is_temporary_fs(int fd); + int fd_is_network_fs(int fd); + + int path_is_temporary_fs(const char *path); ++int path_is_network_fs(const char *path); + + /* Because statfs.t_type can be int on some architectures, we have to cast + * the const magic to the type, otherwise the compiler warns about +diff --git a/src/network/generator/network-generator.c b/src/network/generator/network-generator.c +index c081ec673c..063ad08d80 100644 +--- a/src/network/generator/network-generator.c ++++ b/src/network/generator/network-generator.c +@@ -47,7 +47,7 @@ static const char * const dracut_dhcp_type_table[_DHCP_TYPE_MAX] = { + [DHCP_TYPE_OFF] = "off", + [DHCP_TYPE_ON] = "on", + [DHCP_TYPE_ANY] = "any", +- [DHCP_TYPE_DHCP] = "dhcp", ++ [DHCP_TYPE_DHCP4] = "dhcp", + [DHCP_TYPE_DHCP6] = "dhcp6", + [DHCP_TYPE_AUTO6] = "auto6", + [DHCP_TYPE_EITHER6] = "either6", +@@ -62,7 +62,7 @@ static const char * const networkd_dhcp_type_table[_DHCP_TYPE_MAX] = { + [DHCP_TYPE_OFF] = "no", + [DHCP_TYPE_ON] = "yes", + [DHCP_TYPE_ANY] = "yes", +- [DHCP_TYPE_DHCP] = "ipv4", ++ [DHCP_TYPE_DHCP4] = "ipv4", + [DHCP_TYPE_DHCP6] = "ipv6", + [DHCP_TYPE_AUTO6] = "no", /* TODO: enable other setting? */ + [DHCP_TYPE_EITHER6] = "ipv6", /* TODO: enable other setting? */ +diff --git a/src/network/generator/network-generator.h b/src/network/generator/network-generator.h +index dd0a58738b..0e0da2a57a 100644 +--- a/src/network/generator/network-generator.h ++++ b/src/network/generator/network-generator.h +@@ -13,7 +13,7 @@ typedef enum DHCPType { + DHCP_TYPE_OFF, + DHCP_TYPE_ON, + DHCP_TYPE_ANY, +- DHCP_TYPE_DHCP, ++ DHCP_TYPE_DHCP4, + DHCP_TYPE_DHCP6, + DHCP_TYPE_AUTO6, + DHCP_TYPE_EITHER6, +diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c +index 7e89366ae8..3261f289e9 100644 +--- a/src/network/networkd-manager.c ++++ b/src/network/networkd-manager.c +@@ -398,6 +398,30 @@ static int signal_restart_callback(sd_event_source *s, const struct signalfd_sig + return sd_event_exit(sd_event_source_get_event(s), 0); + } + ++static int manager_set_keep_configuration(Manager *m) { ++ int r; ++ ++ assert(m); ++ ++ if (in_initrd()) { ++ log_debug("Running in initrd, keep DHCPv4 addresses on stopping networkd by default."); ++ m->keep_configuration = KEEP_CONFIGURATION_DHCP_ON_STOP; ++ return 0; ++ } ++ ++ r = path_is_network_fs("/"); ++ if (r < 0) ++ return log_error_errno(r, "Failed to detect if root is network filesystem: %m"); ++ if (r == 0) { ++ m->keep_configuration = _KEEP_CONFIGURATION_INVALID; ++ return 0; ++ } ++ ++ log_debug("Running on network filesystem, enabling KeepConfiguration= by default."); ++ m->keep_configuration = KEEP_CONFIGURATION_YES; ++ return 0; ++} ++ + int manager_setup(Manager *m) { + int r; + +@@ -453,6 +477,10 @@ int manager_setup(Manager *m) { + if (r < 0) + return r; + ++ r = manager_set_keep_configuration(m); ++ if (r < 0) ++ return r; ++ + m->state_file = strdup("/run/systemd/netif/state"); + if (!m->state_file) + return -ENOMEM; +@@ -468,6 +496,7 @@ int manager_new(Manager **ret, bool test_mode) { + return -ENOMEM; + + *m = (Manager) { ++ .keep_configuration = _KEEP_CONFIGURATION_INVALID, + .test_mode = test_mode, + .speed_meter_interval_usec = SPEED_METER_DEFAULT_TIME_INTERVAL, + .online_state = _LINK_ONLINE_STATE_INVALID, +diff --git a/src/network/networkd-manager.h b/src/network/networkd-manager.h +index 36313589a3..86de529124 100644 +--- a/src/network/networkd-manager.h ++++ b/src/network/networkd-manager.h +@@ -28,6 +28,8 @@ struct Manager { + Hashmap *polkit_registry; + int ethtool_fd; + ++ KeepConfiguration keep_configuration; ++ + bool test_mode; + bool enumerating; + bool dirty; +diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c +index 3142be471f..edcd68d616 100644 +--- a/src/network/networkd-network.c ++++ b/src/network/networkd-network.c +@@ -124,6 +124,7 @@ int network_verify(Network *network) { + int r; + + assert(network); ++ assert(network->manager); + assert(network->filename); + + if (net_match_is_empty(&network->match) && !network->conditions) +@@ -248,10 +249,11 @@ int network_verify(Network *network) { + } + + if (network->dhcp_critical >= 0) { +- if (network->keep_configuration >= 0) +- log_warning("%s: Both KeepConfiguration= and deprecated CriticalConnection= are set. " +- "Ignoring CriticalConnection=.", network->filename); +- else if (network->dhcp_critical) ++ if (network->keep_configuration >= 0) { ++ if (network->manager->keep_configuration < 0) ++ log_warning("%s: Both KeepConfiguration= and deprecated CriticalConnection= are set. " ++ "Ignoring CriticalConnection=.", network->filename); ++ } else if (network->dhcp_critical) + /* CriticalConnection=yes also preserve foreign static configurations. */ + network->keep_configuration = KEEP_CONFIGURATION_YES; + else +@@ -386,7 +388,7 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi + .allmulticast = -1, + .promiscuous = -1, + +- .keep_configuration = _KEEP_CONFIGURATION_INVALID, ++ .keep_configuration = manager->keep_configuration, + + .dhcp_duid.type = _DUID_TYPE_INVALID, + .dhcp_critical = -1, +diff --git a/src/network/test-networkd-conf.c b/src/network/test-networkd-conf.c +index 4b00a98086..5f1328e39c 100644 +--- a/src/network/test-networkd-conf.c ++++ b/src/network/test-networkd-conf.c +@@ -6,6 +6,7 @@ + #include "net-condition.h" + #include "networkd-address.h" + #include "networkd-conf.h" ++#include "networkd-manager.h" + #include "networkd-network.h" + #include "strv.h" + +@@ -166,11 +167,15 @@ static void test_config_parse_ether_addr(void) { + } + + static void test_config_parse_address_one(const char *rvalue, int family, unsigned n_addresses, const union in_addr_union *u, unsigned char prefixlen) { ++ _cleanup_(manager_freep) Manager *manager = NULL; + _cleanup_(network_unrefp) Network *network = NULL; + ++ assert_se(manager_new(&manager, /* test_mode = */ true) >= 0); + assert_se(network = new0(Network, 1)); + network->n_ref = 1; ++ network->manager = manager; + assert_se(network->filename = strdup("hogehoge.network")); ++ + assert_se(config_parse_match_ifnames("network", "filename", 1, "section", 1, "Name", 0, "*", &network->match.ifname, network) == 0); + assert_se(config_parse_address("network", "filename", 1, "section", 1, "Address", 0, rvalue, network, network) == 0); + assert_se(ordered_hashmap_size(network->addresses_by_section) == 1); +-- +2.34.1 + diff --git a/meta/recipes-core/systemd/systemd/org.freedesktop.hostname1_no_polkit.conf b/meta/recipes-core/systemd/systemd/org.freedesktop.hostname1_no_polkit.conf new file mode 100644 index 0000000000..f4d0271cdb --- /dev/null +++ b/meta/recipes-core/systemd/systemd/org.freedesktop.hostname1_no_polkit.conf @@ -0,0 +1,11 @@ +<?xml version="1.0"?> <!--*-nxml-*--> +<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" + "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> + +<busconfig> + <policy group="systemd-hostname"> + <allow own="org.freedesktop.hostname1"/> + <allow send_destination="org.freedesktop.hostname1"/> + <allow receive_sender="org.freedesktop.hostname1"/> + </policy> +</busconfig> diff --git a/meta/recipes-core/systemd/systemd/systemd-pager.sh b/meta/recipes-core/systemd/systemd/systemd-pager.sh new file mode 100644 index 0000000000..86e3e0ab78 --- /dev/null +++ b/meta/recipes-core/systemd/systemd/systemd-pager.sh @@ -0,0 +1,7 @@ +# Systemd expect a color capable pager, however the less provided +# by busybox is not. This make many interaction with systemd pretty +# annoying. As a workaround we disable the systemd pager if less +# is not the GNU version. +if ! less -V > /dev/null 2>&1 ; then + export SYSTEMD_PAGER= +fi |