Initial commit
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
|
||||
|
||||
${SCRIPTPATH}/../tests/sdbus-c++-unit-tests 2>&1 | \
|
||||
sed -r 's/^\[\s+OK\s+\] (.*) \([0-9]+\sms\)$/OK: \1 /' | \
|
||||
sed -r 's/^\[\s+FAILED\s+\] (.*) \([0-9]+\sms\)$/FAILED: \1 /' | \
|
||||
awk '{if ($1 == "OK:" || $1 == "FAILED:") {print $0}}'
|
||||
|
||||
${SCRIPTPATH}/../tests/sdbus-c++-integration-tests 2>&1 | \
|
||||
sed -r 's/^\[\s+OK\s+\] (.*) \([0-9]+\sms\)$/OK: \1 /' | \
|
||||
sed -r 's/^\[\s+FAILED\s+\] (.*) \([0-9]+\sms\)$/FAILED: \1 /' | \
|
||||
awk '{if ($1 == "OK:" || $1 == "FAILED:") {print $0}}'
|
||||
+453
@@ -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"
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
From 19cc68d4a89b59889be442d2997ff030cdc3de73 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Tue, 20 Dec 2022 20:11:17 -0800
|
||||
Subject: [PATCH] dirent-util: Remove asserts on dirent64 == dirent
|
||||
|
||||
We already have assert_cc(_FILE_OFFSET_BITS == 64) which ensures that 64bit LFS functions are same as their original counterparts
|
||||
|
||||
Upstream-Status: Submitted [https://github.com/systemd/systemd/pull/25809]
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
src/basic/dirent-util.h | 11 -----------
|
||||
1 file changed, 11 deletions(-)
|
||||
|
||||
diff --git a/src/basic/dirent-util.h b/src/basic/dirent-util.h
|
||||
index 04bc53003f..4cb317184d 100644
|
||||
--- a/src/basic/dirent-util.h
|
||||
+++ b/src/basic/dirent-util.h
|
||||
@@ -35,17 +35,6 @@ struct dirent *readdir_no_dot(DIR *dirp);
|
||||
/* Only if 64bit off_t is enabled struct dirent + struct dirent64 are actually the same. We require this, and
|
||||
* we want them to be interchangeable to make getdents64() work, hence verify that. */
|
||||
assert_cc(_FILE_OFFSET_BITS == 64);
|
||||
-assert_cc(sizeof(struct dirent) == sizeof(struct dirent64));
|
||||
-assert_cc(offsetof(struct dirent, d_ino) == offsetof(struct dirent64, d_ino));
|
||||
-assert_cc(sizeof_field(struct dirent, d_ino) == sizeof_field(struct dirent64, d_ino));
|
||||
-assert_cc(offsetof(struct dirent, d_off) == offsetof(struct dirent64, d_off));
|
||||
-assert_cc(sizeof_field(struct dirent, d_off) == sizeof_field(struct dirent64, d_off));
|
||||
-assert_cc(offsetof(struct dirent, d_reclen) == offsetof(struct dirent64, d_reclen));
|
||||
-assert_cc(sizeof_field(struct dirent, d_reclen) == sizeof_field(struct dirent64, d_reclen));
|
||||
-assert_cc(offsetof(struct dirent, d_type) == offsetof(struct dirent64, d_type));
|
||||
-assert_cc(sizeof_field(struct dirent, d_type) == sizeof_field(struct dirent64, d_type));
|
||||
-assert_cc(offsetof(struct dirent, d_name) == offsetof(struct dirent64, d_name));
|
||||
-assert_cc(sizeof_field(struct dirent, d_name) == sizeof_field(struct dirent64, d_name));
|
||||
|
||||
#define FOREACH_DIRENT_IN_BUFFER(de, buf, sz) \
|
||||
for (void *_end = (uint8_t*) ({ (de) = (buf); }) + (sz); \
|
||||
--
|
||||
2.39.0
|
||||
|
||||
+29
@@ -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
|
||||
|
||||
+157
@@ -0,0 +1,157 @@
|
||||
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] don't use glibc-specific qsort_r
|
||||
|
||||
Upstream-Status: Inappropriate [musl specific]
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
[Rebased for v241]
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
[Rebased for v242]
|
||||
Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
|
||||
[Rebased for v247]
|
||||
Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
|
||||
|
||||
---
|
||||
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(-)
|
||||
|
||||
--- a/src/basic/sort-util.h
|
||||
+++ b/src/basic/sort-util.h
|
||||
@@ -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, comparison_userdata_fn_t compar, void *userdata) {
|
||||
- if (nmemb <= 1)
|
||||
- return;
|
||||
-
|
||||
- assert(base);
|
||||
- qsort_r(base, nmemb, size, compar, userdata);
|
||||
-}
|
||||
-
|
||||
-#define typesafe_qsort_r(p, n, func, userdata) \
|
||||
- ({ \
|
||||
- int (*_func_)(const typeof(p[0])*, const typeof(p[0])*, typeof(userdata)) = func; \
|
||||
- qsort_r_safe((p), (n), sizeof((p)[0]), (comparison_userdata_fn_t) _func_, userdata); \
|
||||
- })
|
||||
-
|
||||
int cmp_int(const int *a, const int *b);
|
||||
--- a/src/shared/format-table.c
|
||||
+++ b/src/shared/format-table.c
|
||||
@@ -1324,30 +1324,32 @@ static int cell_data_compare(TableData *
|
||||
return CMP(index_a, index_b);
|
||||
}
|
||||
|
||||
-static int table_data_compare(const size_t *a, const size_t *b, Table *t) {
|
||||
+static Table *user_table;
|
||||
+static int table_data_compare(const void *x, const void *y) {
|
||||
+ const size_t *a = x, *b=y;
|
||||
int r;
|
||||
|
||||
- assert(t);
|
||||
- assert(t->sort_map);
|
||||
+ assert(user_table);
|
||||
+ assert(user_table->sort_map);
|
||||
|
||||
/* Make sure the header stays at the beginning */
|
||||
- if (*a < t->n_columns && *b < t->n_columns)
|
||||
+ if (*a < user_table->n_columns && *b < user_table->n_columns)
|
||||
return 0;
|
||||
- if (*a < t->n_columns)
|
||||
+ if (*a < user_table->n_columns)
|
||||
return -1;
|
||||
- if (*b < t->n_columns)
|
||||
+ if (*b < user_table->n_columns)
|
||||
return 1;
|
||||
|
||||
/* Order other lines by the sorting map */
|
||||
- for (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]];
|
||||
- dd = t->data[*b + t->sort_map[i]];
|
||||
+ d = user_table->data[*a + user_table->sort_map[i]];
|
||||
+ dd = user_table->data[*b + user_table->sort_map[i]];
|
||||
|
||||
r = cell_data_compare(d, *a, dd, *b);
|
||||
if (r != 0)
|
||||
- return t->reverse_map && t->reverse_map[t->sort_map[i]] ? -r : r;
|
||||
+ return user_table->reverse_map && user_table->reverse_map[user_table->sort_map[i]] ? -r : r;
|
||||
}
|
||||
|
||||
/* Order identical lines by the order there were originally added in */
|
||||
@@ -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);
|
||||
+ if (n_rows <= 1)
|
||||
+ return 0;
|
||||
+ assert(sorted);
|
||||
+ user_table = t;
|
||||
+ qsort(sorted, n_rows, sizeof(size_t), table_data_compare);
|
||||
+ user_table = NULL;
|
||||
}
|
||||
|
||||
if (t->display_map)
|
||||
@@ -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);
|
||||
+ if (n_rows <= 1)
|
||||
+ return 0;
|
||||
+ assert(sorted);
|
||||
+ user_table = t;
|
||||
+ qsort(sorted, n_rows, sizeof(size_t), table_data_compare);
|
||||
+ user_table = NULL;
|
||||
}
|
||||
|
||||
if (t->display_map)
|
||||
--- 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;
|
||||
}
|
||||
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
From 3b42a888685aee1776a12cff84a5fe0063378483 Mon Sep 17 00:00:00 2001
|
||||
From: Chen Qi <Qi.Chen@windriver.com>
|
||||
Date: Mon, 25 Feb 2019 13:55:12 +0800
|
||||
Subject: [PATCH] missing_type.h: add __compare_fn_t and comparison_fn_t
|
||||
|
||||
Make it work with musl where comparison_fn_t and __compare_fn_t
|
||||
is not provided.
|
||||
|
||||
Upstream-Status: Inappropriate [musl specific]
|
||||
|
||||
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
|
||||
[Rebased for v244]
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
[Rebased for v242]
|
||||
Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
|
||||
|
||||
---
|
||||
src/basic/missing_type.h | 9 +++++++++
|
||||
src/basic/sort-util.h | 1 +
|
||||
src/core/kmod-setup.c | 1 +
|
||||
src/libsystemd/sd-journal/catalog.c | 1 +
|
||||
4 files changed, 12 insertions(+)
|
||||
|
||||
--- a/src/basic/missing_type.h
|
||||
+++ b/src/basic/missing_type.h
|
||||
@@ -10,3 +10,12 @@
|
||||
#if !HAVE_CHAR16_T
|
||||
#define char16_t uint16_t
|
||||
#endif
|
||||
+
|
||||
+#ifndef __GLIBC__
|
||||
+typedef int (*comparison_fn_t)(const void *, const void *);
|
||||
+#endif
|
||||
+
|
||||
+#ifndef __COMPAR_FN_T
|
||||
+#define __COMPAR_FN_T
|
||||
+typedef int (*__compar_fn_t)(const void *, const void *);
|
||||
+#endif
|
||||
--- a/src/basic/sort-util.h
|
||||
+++ b/src/basic/sort-util.h
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "macro.h"
|
||||
+#include "missing_type.h"
|
||||
|
||||
/* This is the same as glibc's internal __compar_d_fn_t type. glibc exports a public comparison_fn_t, for the
|
||||
* external type __compar_fn_t, but doesn't do anything similar for __compar_d_fn_t. Let's hence do that
|
||||
--- a/src/core/kmod-setup.c
|
||||
+++ b/src/core/kmod-setup.c
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "macro.h"
|
||||
#include "recurse-dir.h"
|
||||
#include "string-util.h"
|
||||
+#include "missing_type.h"
|
||||
|
||||
#if HAVE_KMOD
|
||||
#include "module-util.h"
|
||||
--- a/src/libsystemd/sd-journal/catalog.c
|
||||
+++ b/src/libsystemd/sd-journal/catalog.c
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
#include "tmpfile-util.h"
|
||||
+#include "missing_type.h"
|
||||
|
||||
const char * const catalog_file_dirs[] = {
|
||||
"/usr/local/lib/systemd/catalog/",
|
||||
+419
@@ -0,0 +1,419 @@
|
||||
From 3e0df2c22bfd37bc62bf09a01ec498e40d3599de Mon Sep 17 00:00:00 2001
|
||||
From: Alexander Kanavin <alex.kanavin@gmail.com>
|
||||
Date: Sat, 22 May 2021 20:26:24 +0200
|
||||
Subject: [PATCH] add fallback parse_printf_format implementation
|
||||
|
||||
Upstream-Status: Inappropriate [musl specific]
|
||||
|
||||
Signed-off-by: Emil Renner Berthing <systemd@esmil.dk>
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
[rebased for systemd 243]
|
||||
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
|
||||
|
||||
---
|
||||
meson.build | 1 +
|
||||
src/basic/meson.build | 5 +
|
||||
src/basic/parse-printf-format.c | 273 +++++++++++++++++++++++
|
||||
src/basic/parse-printf-format.h | 57 +++++
|
||||
src/basic/stdio-util.h | 2 +-
|
||||
src/libsystemd/sd-journal/journal-send.c | 2 +-
|
||||
6 files changed, 338 insertions(+), 2 deletions(-)
|
||||
create mode 100644 src/basic/parse-printf-format.c
|
||||
create mode 100644 src/basic/parse-printf-format.h
|
||||
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -686,6 +686,7 @@ endif
|
||||
foreach header : ['crypt.h',
|
||||
'linux/memfd.h',
|
||||
'linux/vm_sockets.h',
|
||||
+ 'printf.h',
|
||||
'sys/auxv.h',
|
||||
'valgrind/memcheck.h',
|
||||
'valgrind/valgrind.h',
|
||||
--- a/src/basic/meson.build
|
||||
+++ b/src/basic/meson.build
|
||||
@@ -335,6 +335,11 @@ endforeach
|
||||
|
||||
basic_sources += generated_gperf_headers
|
||||
|
||||
+if conf.get('HAVE_PRINTF_H') != 1
|
||||
+ basic_sources += [files('parse-printf-format.c')]
|
||||
+endif
|
||||
+
|
||||
+
|
||||
############################################################
|
||||
|
||||
arch_list = [
|
||||
--- /dev/null
|
||||
+++ b/src/basic/parse-printf-format.c
|
||||
@@ -0,0 +1,273 @@
|
||||
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
|
||||
+
|
||||
+/***
|
||||
+ This file is part of systemd.
|
||||
+
|
||||
+ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
|
||||
+
|
||||
+ With parts from the musl C library
|
||||
+ Copyright 2005-2014 Rich Felker, et al.
|
||||
+
|
||||
+ systemd is free software; you can redistribute it and/or modify it
|
||||
+ under the terms of the GNU Lesser General Public License as published by
|
||||
+ the Free Software Foundation; either version 2.1 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ systemd is distributed in the hope that it will be useful, but
|
||||
+ WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ Lesser General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU Lesser General Public License
|
||||
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
+***/
|
||||
+
|
||||
+#include <stddef.h>
|
||||
+#include <string.h>
|
||||
+
|
||||
+#include "parse-printf-format.h"
|
||||
+
|
||||
+static const char *consume_nonarg(const char *fmt)
|
||||
+{
|
||||
+ do {
|
||||
+ if (*fmt == '\0')
|
||||
+ return fmt;
|
||||
+ } while (*fmt++ != '%');
|
||||
+ return fmt;
|
||||
+}
|
||||
+
|
||||
+static const char *consume_num(const char *fmt)
|
||||
+{
|
||||
+ for (;*fmt >= '0' && *fmt <= '9'; fmt++)
|
||||
+ /* do nothing */;
|
||||
+ return fmt;
|
||||
+}
|
||||
+
|
||||
+static const char *consume_argn(const char *fmt, size_t *arg)
|
||||
+{
|
||||
+ const char *p = fmt;
|
||||
+ size_t val = 0;
|
||||
+
|
||||
+ if (*p < '1' || *p > '9')
|
||||
+ return fmt;
|
||||
+ do {
|
||||
+ val = 10*val + (*p++ - '0');
|
||||
+ } while (*p >= '0' && *p <= '9');
|
||||
+
|
||||
+ if (*p != '$')
|
||||
+ return fmt;
|
||||
+ *arg = val;
|
||||
+ return p+1;
|
||||
+}
|
||||
+
|
||||
+static const char *consume_flags(const char *fmt)
|
||||
+{
|
||||
+ while (1) {
|
||||
+ switch (*fmt) {
|
||||
+ case '#':
|
||||
+ case '0':
|
||||
+ case '-':
|
||||
+ case ' ':
|
||||
+ case '+':
|
||||
+ case '\'':
|
||||
+ case 'I':
|
||||
+ fmt++;
|
||||
+ continue;
|
||||
+ }
|
||||
+ return fmt;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+enum state {
|
||||
+ BARE,
|
||||
+ LPRE,
|
||||
+ LLPRE,
|
||||
+ HPRE,
|
||||
+ HHPRE,
|
||||
+ BIGLPRE,
|
||||
+ ZTPRE,
|
||||
+ JPRE,
|
||||
+ STOP
|
||||
+};
|
||||
+
|
||||
+enum type {
|
||||
+ NONE,
|
||||
+ PTR,
|
||||
+ INT,
|
||||
+ UINT,
|
||||
+ ULLONG,
|
||||
+ LONG,
|
||||
+ ULONG,
|
||||
+ SHORT,
|
||||
+ USHORT,
|
||||
+ CHAR,
|
||||
+ UCHAR,
|
||||
+ LLONG,
|
||||
+ SIZET,
|
||||
+ IMAX,
|
||||
+ UMAX,
|
||||
+ PDIFF,
|
||||
+ UIPTR,
|
||||
+ DBL,
|
||||
+ LDBL,
|
||||
+ MAXTYPE
|
||||
+};
|
||||
+
|
||||
+static const short pa_types[MAXTYPE] = {
|
||||
+ [NONE] = PA_INT,
|
||||
+ [PTR] = PA_POINTER,
|
||||
+ [INT] = PA_INT,
|
||||
+ [UINT] = PA_INT,
|
||||
+ [ULLONG] = PA_INT | PA_FLAG_LONG_LONG,
|
||||
+ [LONG] = PA_INT | PA_FLAG_LONG,
|
||||
+ [ULONG] = PA_INT | PA_FLAG_LONG,
|
||||
+ [SHORT] = PA_INT | PA_FLAG_SHORT,
|
||||
+ [USHORT] = PA_INT | PA_FLAG_SHORT,
|
||||
+ [CHAR] = PA_CHAR,
|
||||
+ [UCHAR] = PA_CHAR,
|
||||
+ [LLONG] = PA_INT | PA_FLAG_LONG_LONG,
|
||||
+ [SIZET] = PA_INT | PA_FLAG_LONG,
|
||||
+ [IMAX] = PA_INT | PA_FLAG_LONG_LONG,
|
||||
+ [UMAX] = PA_INT | PA_FLAG_LONG_LONG,
|
||||
+ [PDIFF] = PA_INT | PA_FLAG_LONG_LONG,
|
||||
+ [UIPTR] = PA_INT | PA_FLAG_LONG,
|
||||
+ [DBL] = PA_DOUBLE,
|
||||
+ [LDBL] = PA_DOUBLE | PA_FLAG_LONG_DOUBLE
|
||||
+};
|
||||
+
|
||||
+#define S(x) [(x)-'A']
|
||||
+#define E(x) (STOP + (x))
|
||||
+
|
||||
+static const unsigned char states[]['z'-'A'+1] = {
|
||||
+ { /* 0: bare types */
|
||||
+ S('d') = E(INT), S('i') = E(INT),
|
||||
+ S('o') = E(UINT),S('u') = E(UINT),S('x') = E(UINT), S('X') = E(UINT),
|
||||
+ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
|
||||
+ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
|
||||
+ S('c') = E(CHAR),S('C') = E(INT),
|
||||
+ S('s') = E(PTR), S('S') = E(PTR), S('p') = E(UIPTR),S('n') = E(PTR),
|
||||
+ S('m') = E(NONE),
|
||||
+ S('l') = LPRE, S('h') = HPRE, S('L') = BIGLPRE,
|
||||
+ S('z') = ZTPRE, S('j') = JPRE, S('t') = ZTPRE
|
||||
+ }, { /* 1: l-prefixed */
|
||||
+ S('d') = E(LONG), S('i') = E(LONG),
|
||||
+ S('o') = E(ULONG),S('u') = E(ULONG),S('x') = E(ULONG),S('X') = E(ULONG),
|
||||
+ S('e') = E(DBL), S('f') = E(DBL), S('g') = E(DBL), S('a') = E(DBL),
|
||||
+ S('E') = E(DBL), S('F') = E(DBL), S('G') = E(DBL), S('A') = E(DBL),
|
||||
+ S('c') = E(INT), S('s') = E(PTR), S('n') = E(PTR),
|
||||
+ S('l') = LLPRE
|
||||
+ }, { /* 2: ll-prefixed */
|
||||
+ S('d') = E(LLONG), S('i') = E(LLONG),
|
||||
+ S('o') = E(ULLONG),S('u') = E(ULLONG),
|
||||
+ S('x') = E(ULLONG),S('X') = E(ULLONG),
|
||||
+ S('n') = E(PTR)
|
||||
+ }, { /* 3: h-prefixed */
|
||||
+ S('d') = E(SHORT), S('i') = E(SHORT),
|
||||
+ S('o') = E(USHORT),S('u') = E(USHORT),
|
||||
+ S('x') = E(USHORT),S('X') = E(USHORT),
|
||||
+ S('n') = E(PTR),
|
||||
+ S('h') = HHPRE
|
||||
+ }, { /* 4: hh-prefixed */
|
||||
+ S('d') = E(CHAR), S('i') = E(CHAR),
|
||||
+ S('o') = E(UCHAR),S('u') = E(UCHAR),
|
||||
+ S('x') = E(UCHAR),S('X') = E(UCHAR),
|
||||
+ S('n') = E(PTR)
|
||||
+ }, { /* 5: L-prefixed */
|
||||
+ S('e') = E(LDBL),S('f') = E(LDBL),S('g') = E(LDBL), S('a') = E(LDBL),
|
||||
+ S('E') = E(LDBL),S('F') = E(LDBL),S('G') = E(LDBL), S('A') = E(LDBL),
|
||||
+ S('n') = E(PTR)
|
||||
+ }, { /* 6: z- or t-prefixed (assumed to be same size) */
|
||||
+ S('d') = E(PDIFF),S('i') = E(PDIFF),
|
||||
+ S('o') = E(SIZET),S('u') = E(SIZET),
|
||||
+ S('x') = E(SIZET),S('X') = E(SIZET),
|
||||
+ S('n') = E(PTR)
|
||||
+ }, { /* 7: j-prefixed */
|
||||
+ S('d') = E(IMAX), S('i') = E(IMAX),
|
||||
+ S('o') = E(UMAX), S('u') = E(UMAX),
|
||||
+ S('x') = E(UMAX), S('X') = E(UMAX),
|
||||
+ S('n') = E(PTR)
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+size_t parse_printf_format(const char *fmt, size_t n, int *types)
|
||||
+{
|
||||
+ size_t i = 0;
|
||||
+ size_t last = 0;
|
||||
+
|
||||
+ memset(types, 0, n);
|
||||
+
|
||||
+ while (1) {
|
||||
+ size_t arg;
|
||||
+ unsigned int state;
|
||||
+
|
||||
+ fmt = consume_nonarg(fmt);
|
||||
+ if (*fmt == '\0')
|
||||
+ break;
|
||||
+ if (*fmt == '%') {
|
||||
+ fmt++;
|
||||
+ continue;
|
||||
+ }
|
||||
+ arg = 0;
|
||||
+ fmt = consume_argn(fmt, &arg);
|
||||
+ /* flags */
|
||||
+ fmt = consume_flags(fmt);
|
||||
+ /* width */
|
||||
+ if (*fmt == '*') {
|
||||
+ size_t warg = 0;
|
||||
+ fmt = consume_argn(fmt+1, &warg);
|
||||
+ if (warg == 0)
|
||||
+ warg = ++i;
|
||||
+ if (warg > last)
|
||||
+ last = warg;
|
||||
+ if (warg <= n && types[warg-1] == NONE)
|
||||
+ types[warg-1] = INT;
|
||||
+ } else
|
||||
+ fmt = consume_num(fmt);
|
||||
+ /* precision */
|
||||
+ if (*fmt == '.') {
|
||||
+ fmt++;
|
||||
+ if (*fmt == '*') {
|
||||
+ size_t parg = 0;
|
||||
+ fmt = consume_argn(fmt+1, &parg);
|
||||
+ if (parg == 0)
|
||||
+ parg = ++i;
|
||||
+ if (parg > last)
|
||||
+ last = parg;
|
||||
+ if (parg <= n && types[parg-1] == NONE)
|
||||
+ types[parg-1] = INT;
|
||||
+ } else {
|
||||
+ if (*fmt == '-')
|
||||
+ fmt++;
|
||||
+ fmt = consume_num(fmt);
|
||||
+ }
|
||||
+ }
|
||||
+ /* length modifier and conversion specifier */
|
||||
+ state = BARE;
|
||||
+ do {
|
||||
+ unsigned char c = *fmt++;
|
||||
+
|
||||
+ if (c < 'A' || c > 'z')
|
||||
+ continue;
|
||||
+ state = states[state]S(c);
|
||||
+ if (state == 0)
|
||||
+ continue;
|
||||
+ } while (state < STOP);
|
||||
+
|
||||
+ if (state == E(NONE))
|
||||
+ continue;
|
||||
+
|
||||
+ if (arg == 0)
|
||||
+ arg = ++i;
|
||||
+ if (arg > last)
|
||||
+ last = arg;
|
||||
+ if (arg <= n)
|
||||
+ types[arg-1] = state - STOP;
|
||||
+ }
|
||||
+
|
||||
+ if (last > n)
|
||||
+ last = n;
|
||||
+ for (i = 0; i < last; i++)
|
||||
+ types[i] = pa_types[types[i]];
|
||||
+
|
||||
+ return last;
|
||||
+}
|
||||
--- /dev/null
|
||||
+++ b/src/basic/parse-printf-format.h
|
||||
@@ -0,0 +1,57 @@
|
||||
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
|
||||
+
|
||||
+/***
|
||||
+ This file is part of systemd.
|
||||
+
|
||||
+ Copyright 2014 Emil Renner Berthing <systemd@esmil.dk>
|
||||
+
|
||||
+ With parts from the GNU C Library
|
||||
+ Copyright 1991-2014 Free Software Foundation, Inc.
|
||||
+
|
||||
+ systemd is free software; you can redistribute it and/or modify it
|
||||
+ under the terms of the GNU Lesser General Public License as published by
|
||||
+ the Free Software Foundation; either version 2.1 of the License, or
|
||||
+ (at your option) any later version.
|
||||
+
|
||||
+ systemd is distributed in the hope that it will be useful, but
|
||||
+ WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ Lesser General Public License for more details.
|
||||
+
|
||||
+ You should have received a copy of the GNU Lesser General Public License
|
||||
+ along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||
+***/
|
||||
+
|
||||
+#pragma once
|
||||
+
|
||||
+#include "config.h"
|
||||
+
|
||||
+#if HAVE_PRINTF_H
|
||||
+#include <printf.h>
|
||||
+#else
|
||||
+
|
||||
+#include <stddef.h>
|
||||
+
|
||||
+enum { /* C type: */
|
||||
+ PA_INT, /* int */
|
||||
+ PA_CHAR, /* int, cast to char */
|
||||
+ PA_WCHAR, /* wide char */
|
||||
+ PA_STRING, /* const char *, a '\0'-terminated string */
|
||||
+ PA_WSTRING, /* const wchar_t *, wide character string */
|
||||
+ PA_POINTER, /* void * */
|
||||
+ PA_FLOAT, /* float */
|
||||
+ PA_DOUBLE, /* double */
|
||||
+ PA_LAST
|
||||
+};
|
||||
+
|
||||
+/* Flag bits that can be set in a type returned by `parse_printf_format'. */
|
||||
+#define PA_FLAG_MASK 0xff00
|
||||
+#define PA_FLAG_LONG_LONG (1 << 8)
|
||||
+#define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG
|
||||
+#define PA_FLAG_LONG (1 << 9)
|
||||
+#define PA_FLAG_SHORT (1 << 10)
|
||||
+#define PA_FLAG_PTR (1 << 11)
|
||||
+
|
||||
+size_t parse_printf_format(const char *fmt, size_t n, int *types);
|
||||
+
|
||||
+#endif /* HAVE_PRINTF_H */
|
||||
--- a/src/basic/stdio-util.h
|
||||
+++ b/src/basic/stdio-util.h
|
||||
@@ -1,13 +1,13 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
-#include <printf.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "macro.h"
|
||||
#include "memory-util.h"
|
||||
+#include "parse-printf-format.h"
|
||||
|
||||
#define snprintf_ok(buf, len, fmt, ...) \
|
||||
({ \
|
||||
--- a/src/libsystemd/sd-journal/journal-send.c
|
||||
+++ b/src/libsystemd/sd-journal/journal-send.c
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
-#include <printf.h>
|
||||
#include <stddef.h>
|
||||
#include <sys/un.h>
|
||||
#include <unistd.h>
|
||||
@@ -21,6 +20,7 @@
|
||||
#include "stdio-util.h"
|
||||
#include "string-util.h"
|
||||
#include "tmpfile-util.h"
|
||||
+#include "parse-printf-format.h"
|
||||
|
||||
#define SNDBUF_SIZE (8*1024*1024)
|
||||
|
||||
+602
@@ -0,0 +1,602 @@
|
||||
From cef23a651ea200e30e1e6ed2a2564505e3a42d46 Mon Sep 17 00:00:00 2001
|
||||
From: Chen Qi <Qi.Chen@windriver.com>
|
||||
Date: Mon, 25 Feb 2019 14:18:21 +0800
|
||||
Subject: [PATCH] src/basic/missing.h: check for missing strndupa
|
||||
|
||||
include missing.h for definition of strndupa
|
||||
|
||||
Upstream-Status: Inappropriate [musl specific]
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
[Rebased for v242]
|
||||
Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
|
||||
[rebased for systemd 243]
|
||||
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
|
||||
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
|
||||
[rebased for systemd 244]
|
||||
[Rebased for v247]
|
||||
Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
|
||||
|
||||
---
|
||||
meson.build | 1 +
|
||||
src/backlight/backlight.c | 1 +
|
||||
src/basic/cgroup-util.c | 1 +
|
||||
src/basic/env-util.c | 1 +
|
||||
src/basic/log.c | 1 +
|
||||
src/basic/missing_stdlib.h | 12 ++++++++++++
|
||||
src/basic/mkdir.c | 1 +
|
||||
src/basic/mountpoint-util.c | 1 +
|
||||
src/basic/parse-util.c | 1 +
|
||||
src/basic/path-lookup.c | 1 +
|
||||
src/basic/percent-util.c | 1 +
|
||||
src/basic/proc-cmdline.c | 1 +
|
||||
src/basic/procfs-util.c | 1 +
|
||||
src/basic/time-util.c | 1 +
|
||||
src/boot/bless-boot.c | 1 +
|
||||
src/core/dbus-cgroup.c | 1 +
|
||||
src/core/dbus-execute.c | 1 +
|
||||
src/core/dbus-util.c | 1 +
|
||||
src/core/execute.c | 1 +
|
||||
src/core/kmod-setup.c | 1 +
|
||||
src/core/service.c | 1 +
|
||||
src/coredump/coredump-vacuum.c | 1 +
|
||||
src/journal-remote/journal-remote-main.c | 1 +
|
||||
src/journal/journalctl.c | 1 +
|
||||
src/libsystemd/sd-bus/bus-message.c | 1 +
|
||||
src/libsystemd/sd-bus/bus-objects.c | 1 +
|
||||
src/libsystemd/sd-bus/bus-socket.c | 1 +
|
||||
src/libsystemd/sd-bus/sd-bus.c | 1 +
|
||||
src/libsystemd/sd-bus/test-bus-benchmark.c | 1 +
|
||||
src/libsystemd/sd-journal/sd-journal.c | 1 +
|
||||
src/locale/keymap-util.c | 1 +
|
||||
src/login/pam_systemd.c | 1 +
|
||||
src/network/generator/network-generator.c | 1 +
|
||||
src/nspawn/nspawn-settings.c | 1 +
|
||||
src/nss-mymachines/nss-mymachines.c | 1 +
|
||||
src/portable/portable.c | 1 +
|
||||
src/resolve/resolvectl.c | 1 +
|
||||
src/shared/bus-get-properties.c | 1 +
|
||||
src/shared/bus-unit-procs.c | 1 +
|
||||
src/shared/bus-unit-util.c | 1 +
|
||||
src/shared/bus-util.c | 1 +
|
||||
src/shared/dns-domain.c | 1 +
|
||||
src/shared/journal-importer.c | 1 +
|
||||
src/shared/logs-show.c | 1 +
|
||||
src/shared/pager.c | 1 +
|
||||
src/shared/uid-range.c | 1 +
|
||||
src/socket-proxy/socket-proxyd.c | 1 +
|
||||
src/test/test-hexdecoct.c | 1 +
|
||||
src/udev/udev-builtin-path_id.c | 1 +
|
||||
src/udev/udev-event.c | 1 +
|
||||
src/udev/udev-rules.c | 1 +
|
||||
51 files changed, 62 insertions(+)
|
||||
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -507,6 +507,7 @@ foreach ident : ['secure_getenv', '__sec
|
||||
endforeach
|
||||
|
||||
foreach ident : [
|
||||
+ ['strndupa' , '''#include <string.h>'''],
|
||||
['memfd_create', '''#include <sys/mman.h>'''],
|
||||
['gettid', '''#include <sys/types.h>
|
||||
#include <unistd.h>'''],
|
||||
--- a/src/backlight/backlight.c
|
||||
+++ b/src/backlight/backlight.c
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
#include "util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
static int help(void) {
|
||||
_cleanup_free_ char *link = NULL;
|
||||
--- a/src/basic/cgroup-util.c
|
||||
+++ b/src/basic/cgroup-util.c
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "unit-name.h"
|
||||
#include "user-util.h"
|
||||
#include "xattr-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
static int cg_enumerate_items(const char *controller, const char *path, FILE **_f, const char *item) {
|
||||
_cleanup_free_ char *fs = NULL;
|
||||
--- a/src/basic/env-util.c
|
||||
+++ b/src/basic/env-util.c
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
#include "utf8.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
/* We follow bash for the character set. Different shells have different rules. */
|
||||
#define VALID_BASH_ENV_NAME_CHARS \
|
||||
--- a/src/basic/log.c
|
||||
+++ b/src/basic/log.c
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "terminal-util.h"
|
||||
#include "time-util.h"
|
||||
#include "utf8.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
#define SNDBUF_SIZE (8*1024*1024)
|
||||
|
||||
--- a/src/basic/missing_stdlib.h
|
||||
+++ b/src/basic/missing_stdlib.h
|
||||
@@ -11,3 +11,15 @@
|
||||
# error "neither secure_getenv nor __secure_getenv are available"
|
||||
# endif
|
||||
#endif
|
||||
+
|
||||
+/* string.h */
|
||||
+#if ! HAVE_STRNDUPA
|
||||
+#define strndupa(s, n) \
|
||||
+ ({ \
|
||||
+ const char *__old = (s); \
|
||||
+ size_t __len = strnlen(__old, (n)); \
|
||||
+ char *__new = (char *)alloca(__len + 1); \
|
||||
+ __new[__len] = '\0'; \
|
||||
+ (char *)memcpy(__new, __old, __len); \
|
||||
+ })
|
||||
+#endif
|
||||
--- a/src/basic/mkdir.c
|
||||
+++ b/src/basic/mkdir.c
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "stat-util.h"
|
||||
#include "stdio-util.h"
|
||||
#include "user-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
int mkdir_safe_internal(
|
||||
const char *path,
|
||||
--- a/src/basic/mountpoint-util.c
|
||||
+++ b/src/basic/mountpoint-util.c
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "missing_stat.h"
|
||||
#include "missing_syscall.h"
|
||||
#include "mkdir.h"
|
||||
+#include "missing_stdlib.h"
|
||||
#include "mountpoint-util.h"
|
||||
#include "nulstr-util.h"
|
||||
#include "parse-util.h"
|
||||
--- a/src/basic/parse-util.c
|
||||
+++ b/src/basic/parse-util.c
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "stat-util.h"
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
int parse_boolean(const char *v) {
|
||||
if (!v)
|
||||
--- a/src/basic/path-lookup.c
|
||||
+++ b/src/basic/path-lookup.c
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "strv.h"
|
||||
#include "tmpfile-util.h"
|
||||
#include "user-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
int xdg_user_runtime_dir(char **ret, const char *suffix) {
|
||||
const char *e;
|
||||
--- a/src/basic/percent-util.c
|
||||
+++ b/src/basic/percent-util.c
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "percent-util.h"
|
||||
#include "string-util.h"
|
||||
#include "parse-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
static int parse_parts_value_whole(const char *p, const char *symbol) {
|
||||
const char *pc, *n;
|
||||
--- a/src/basic/proc-cmdline.c
|
||||
+++ b/src/basic/proc-cmdline.c
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "string-util.h"
|
||||
#include "util.h"
|
||||
#include "virt.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
int proc_cmdline(char **ret) {
|
||||
const char *e;
|
||||
--- a/src/basic/procfs-util.c
|
||||
+++ b/src/basic/procfs-util.c
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "procfs-util.h"
|
||||
#include "stdio-util.h"
|
||||
#include "string-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
int procfs_get_pid_max(uint64_t *ret) {
|
||||
_cleanup_free_ char *value = NULL;
|
||||
--- a/src/basic/time-util.c
|
||||
+++ b/src/basic/time-util.c
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
#include "time-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
static clockid_t map_clock_id(clockid_t c) {
|
||||
|
||||
--- a/src/boot/bless-boot.c
|
||||
+++ b/src/boot/bless-boot.c
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "util.h"
|
||||
#include "verbs.h"
|
||||
#include "virt.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
static char **arg_path = NULL;
|
||||
|
||||
--- a/src/core/dbus-execute.c
|
||||
+++ b/src/core/dbus-execute.c
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "unit-printf.h"
|
||||
#include "user-util.h"
|
||||
#include "utf8.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
BUS_DEFINE_PROPERTY_GET_ENUM(bus_property_get_exec_output, exec_output, ExecOutput);
|
||||
static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_exec_input, exec_input, ExecInput);
|
||||
--- a/src/core/dbus-util.c
|
||||
+++ b/src/core/dbus-util.c
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "unit-printf.h"
|
||||
#include "user-util.h"
|
||||
#include "unit.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
int bus_property_get_triggered_unit(
|
||||
sd_bus *bus,
|
||||
--- a/src/core/execute.c
|
||||
+++ b/src/core/execute.c
|
||||
@@ -102,6 +102,7 @@
|
||||
#include "unit-serialize.h"
|
||||
#include "user-util.h"
|
||||
#include "utmp-wtmp.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
#define IDLE_TIMEOUT_USEC (5*USEC_PER_SEC)
|
||||
#define IDLE_TIMEOUT2_USEC (1*USEC_PER_SEC)
|
||||
--- a/src/core/kmod-setup.c
|
||||
+++ b/src/core/kmod-setup.c
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "recurse-dir.h"
|
||||
#include "string-util.h"
|
||||
#include "missing_type.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
#if HAVE_KMOD
|
||||
#include "module-util.h"
|
||||
--- a/src/core/service.c
|
||||
+++ b/src/core/service.c
|
||||
@@ -42,6 +42,7 @@
|
||||
#include "unit.h"
|
||||
#include "utf8.h"
|
||||
#include "util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
static const UnitActiveState state_translation_table[_SERVICE_STATE_MAX] = {
|
||||
[SERVICE_DEAD] = UNIT_INACTIVE,
|
||||
--- a/src/coredump/coredump-vacuum.c
|
||||
+++ b/src/coredump/coredump-vacuum.c
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "string-util.h"
|
||||
#include "time-util.h"
|
||||
#include "user-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
#define DEFAULT_MAX_USE_LOWER (uint64_t) (1ULL*1024ULL*1024ULL) /* 1 MiB */
|
||||
#define DEFAULT_MAX_USE_UPPER (uint64_t) (4ULL*1024ULL*1024ULL*1024ULL) /* 4 GiB */
|
||||
--- a/src/journal-remote/journal-remote-main.c
|
||||
+++ b/src/journal-remote/journal-remote-main.c
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "stat-util.h"
|
||||
#include "string-table.h"
|
||||
#include "strv.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
#define PRIV_KEY_FILE CERTIFICATE_ROOT "/private/journal-remote.pem"
|
||||
#define CERT_FILE CERTIFICATE_ROOT "/certs/journal-remote.pem"
|
||||
--- a/src/journal/journalctl.c
|
||||
+++ b/src/journal/journalctl.c
|
||||
@@ -73,6 +73,7 @@
|
||||
#include "unit-name.h"
|
||||
#include "user-util.h"
|
||||
#include "varlink.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
#define DEFAULT_FSS_INTERVAL_USEC (15*USEC_PER_MINUTE)
|
||||
#define PROCESS_INOTIFY_INTERVAL 1024 /* Every 1,024 messages processed */
|
||||
--- a/src/libsystemd/sd-bus/bus-message.c
|
||||
+++ b/src/libsystemd/sd-bus/bus-message.c
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "strv.h"
|
||||
#include "time-util.h"
|
||||
#include "utf8.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
static int message_append_basic(sd_bus_message *m, char type, const void *p, const void **stored);
|
||||
|
||||
--- a/src/libsystemd/sd-bus/bus-objects.c
|
||||
+++ b/src/libsystemd/sd-bus/bus-objects.c
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "missing_capability.h"
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
static int node_vtable_get_userdata(
|
||||
sd_bus *bus,
|
||||
--- a/src/libsystemd/sd-bus/bus-socket.c
|
||||
+++ b/src/libsystemd/sd-bus/bus-socket.c
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "string-util.h"
|
||||
#include "user-util.h"
|
||||
#include "utf8.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
#define SNDBUF_SIZE (8*1024*1024)
|
||||
|
||||
--- a/src/libsystemd/sd-bus/sd-bus.c
|
||||
+++ b/src/libsystemd/sd-bus/sd-bus.c
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
#include "user-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
#define log_debug_bus_message(m) \
|
||||
do { \
|
||||
--- a/src/libsystemd/sd-bus/test-bus-benchmark.c
|
||||
+++ b/src/libsystemd/sd-bus/test-bus-benchmark.c
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "string-util.h"
|
||||
#include "time-util.h"
|
||||
#include "util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
#define MAX_SIZE (2*1024*1024)
|
||||
|
||||
--- a/src/libsystemd/sd-journal/sd-journal.c
|
||||
+++ b/src/libsystemd/sd-journal/sd-journal.c
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
#include "syslog-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
#define JOURNAL_FILES_MAX 7168
|
||||
|
||||
--- a/src/locale/keymap-util.c
|
||||
+++ b/src/locale/keymap-util.c
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
#include "tmpfile-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
static bool startswith_comma(const char *s, const char *prefix) {
|
||||
s = startswith(s, prefix);
|
||||
--- a/src/login/pam_systemd.c
|
||||
+++ b/src/login/pam_systemd.c
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "locale-util.h"
|
||||
#include "login-util.h"
|
||||
#include "macro.h"
|
||||
+#include "missing_stdlib.h"
|
||||
#include "pam-util.h"
|
||||
#include "parse-util.h"
|
||||
#include "path-util.h"
|
||||
--- a/src/network/generator/network-generator.c
|
||||
+++ b/src/network/generator/network-generator.c
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "string-table.h"
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
/*
|
||||
# .network
|
||||
--- a/src/nspawn/nspawn-settings.c
|
||||
+++ b/src/nspawn/nspawn-settings.c
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "strv.h"
|
||||
#include "user-util.h"
|
||||
#include "util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
Settings *settings_new(void) {
|
||||
Settings *s;
|
||||
--- a/src/nss-mymachines/nss-mymachines.c
|
||||
+++ b/src/nss-mymachines/nss-mymachines.c
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "nss-util.h"
|
||||
#include "signal-util.h"
|
||||
#include "string-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
static void setup_logging_once(void) {
|
||||
static pthread_once_t once = PTHREAD_ONCE_INIT;
|
||||
--- a/src/portable/portable.c
|
||||
+++ b/src/portable/portable.c
|
||||
@@ -39,6 +39,7 @@
|
||||
#include "strv.h"
|
||||
#include "tmpfile-util.h"
|
||||
#include "user-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
/* Markers used in the first line of our 20-portable.conf unit file drop-in to determine, that a) the unit file was
|
||||
* dropped there by the portable service logic and b) for which image it was dropped there. */
|
||||
--- a/src/resolve/resolvectl.c
|
||||
+++ b/src/resolve/resolvectl.c
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "utf8.h"
|
||||
#include "verb-log-control.h"
|
||||
#include "verbs.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
static int arg_family = AF_UNSPEC;
|
||||
static int arg_ifindex = 0;
|
||||
--- a/src/shared/bus-get-properties.c
|
||||
+++ b/src/shared/bus-get-properties.c
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "rlimit-util.h"
|
||||
#include "stdio-util.h"
|
||||
#include "string-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
int bus_property_get_bool(
|
||||
sd_bus *bus,
|
||||
--- a/src/shared/bus-unit-procs.c
|
||||
+++ b/src/shared/bus-unit-procs.c
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "sort-util.h"
|
||||
#include "string-util.h"
|
||||
#include "terminal-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
struct CGroupInfo {
|
||||
char *cgroup_path;
|
||||
--- a/src/shared/bus-unit-util.c
|
||||
+++ b/src/shared/bus-unit-util.c
|
||||
@@ -49,6 +49,7 @@
|
||||
#include "unit-def.h"
|
||||
#include "user-util.h"
|
||||
#include "utf8.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u) {
|
||||
assert(message);
|
||||
--- a/src/shared/bus-util.c
|
||||
+++ b/src/shared/bus-util.c
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "path-util.h"
|
||||
#include "socket-util.h"
|
||||
#include "stdio-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
static int name_owner_change_callback(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) {
|
||||
sd_event *e = userdata;
|
||||
--- a/src/shared/dns-domain.c
|
||||
+++ b/src/shared/dns-domain.c
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
#include "utf8.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
int dns_label_unescape(const char **name, char *dest, size_t sz, DNSLabelFlags flags) {
|
||||
const char *n;
|
||||
--- a/src/shared/journal-importer.c
|
||||
+++ b/src/shared/journal-importer.c
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "parse-util.h"
|
||||
#include "string-util.h"
|
||||
#include "unaligned.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
enum {
|
||||
IMPORTER_STATE_LINE = 0, /* waiting to read, or reading line */
|
||||
--- a/src/shared/logs-show.c
|
||||
+++ b/src/shared/logs-show.c
|
||||
@@ -42,6 +42,7 @@
|
||||
#include "utf8.h"
|
||||
#include "util.h"
|
||||
#include "web-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
/* up to three lines (each up to 100 characters) or 300 characters, whichever is less */
|
||||
#define PRINT_LINE_THRESHOLD 3
|
||||
--- a/src/shared/pager.c
|
||||
+++ b/src/shared/pager.c
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "strv.h"
|
||||
#include "terminal-util.h"
|
||||
#include "util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
static pid_t pager_pid = 0;
|
||||
|
||||
--- a/src/shared/uid-range.c
|
||||
+++ b/src/shared/uid-range.c
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "sort-util.h"
|
||||
#include "uid-range.h"
|
||||
#include "user-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
static bool uid_range_intersect(UidRange *range, uid_t start, uid_t nr) {
|
||||
assert(range);
|
||||
--- a/src/socket-proxy/socket-proxyd.c
|
||||
+++ b/src/socket-proxy/socket-proxyd.c
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "socket-util.h"
|
||||
#include "string-util.h"
|
||||
#include "util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
#define BUFFER_SIZE (256 * 1024)
|
||||
|
||||
--- a/src/test/test-hexdecoct.c
|
||||
+++ b/src/test/test-hexdecoct.c
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "macro.h"
|
||||
#include "random-util.h"
|
||||
#include "string-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
#include "tests.h"
|
||||
|
||||
TEST(hexchar) {
|
||||
--- a/src/udev/udev-builtin-path_id.c
|
||||
+++ b/src/udev/udev-builtin-path_id.c
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "sysexits.h"
|
||||
#include "udev-builtin.h"
|
||||
#include "udev-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
_printf_(2,3)
|
||||
static void path_prepend(char **path, const char *fmt, ...) {
|
||||
--- a/src/udev/udev-event.c
|
||||
+++ b/src/udev/udev-event.c
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "udev-util.h"
|
||||
#include "udev-watch.h"
|
||||
#include "user-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
typedef struct Spawn {
|
||||
sd_device *device;
|
||||
--- a/src/udev/udev-rules.c
|
||||
+++ b/src/udev/udev-rules.c
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "udev-util.h"
|
||||
#include "user-util.h"
|
||||
#include "virt.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
#define RULES_DIRS (const char* const*) CONF_PATHS_STRV("udev/rules.d")
|
||||
|
||||
--- a/src/core/dbus-cgroup.c
|
||||
+++ b/src/core/dbus-cgroup.c
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "parse-util.h"
|
||||
#include "path-util.h"
|
||||
#include "percent-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
#include "socket-util.h"
|
||||
|
||||
BUS_DEFINE_PROPERTY_GET(bus_property_get_tasks_max, "t", TasksMax, tasks_max_resolve);
|
||||
--- a/src/fstab-generator/fstab-generator.c
|
||||
+++ b/src/fstab-generator/fstab-generator.c
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "util.h"
|
||||
#include "virt.h"
|
||||
#include "volatile-util.h"
|
||||
+#include "missing_stdlib.h"
|
||||
|
||||
typedef enum MountPointFlags {
|
||||
MOUNT_NOAUTO = 1 << 0,
|
||||
+147
@@ -0,0 +1,147 @@
|
||||
From fb068403b25002156435350165ea418a6338a313 Mon Sep 17 00:00:00 2001
|
||||
From: Chen Qi <Qi.Chen@windriver.com>
|
||||
Date: Mon, 25 Feb 2019 14:56:21 +0800
|
||||
Subject: [PATCH] don't fail if GLOB_BRACE and GLOB_ALTDIRFUNC is not defined
|
||||
|
||||
If the standard library doesn't provide brace
|
||||
expansion users just won't get it.
|
||||
|
||||
Dont use GNU GLOB extentions on non-glibc systems
|
||||
|
||||
Conditionalize use of GLOB_ALTDIRFUNC
|
||||
|
||||
Upstream-Status: Inappropriate [musl specific]
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
[rebased for systemd 243]
|
||||
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
|
||||
|
||||
---
|
||||
src/basic/glob-util.c | 12 ++++++++++++
|
||||
src/test/test-glob-util.c | 16 ++++++++++++++++
|
||||
src/tmpfiles/tmpfiles.c | 10 ++++++++++
|
||||
3 files changed, 38 insertions(+)
|
||||
|
||||
--- a/src/basic/glob-util.c
|
||||
+++ b/src/basic/glob-util.c
|
||||
@@ -12,6 +12,12 @@
|
||||
#include "path-util.h"
|
||||
#include "strv.h"
|
||||
|
||||
+/* Don't fail if the standard library
|
||||
+ * doesn't provide brace expansion */
|
||||
+#ifndef GLOB_BRACE
|
||||
+#define GLOB_BRACE 0
|
||||
+#endif
|
||||
+
|
||||
static void closedir_wrapper(void* v) {
|
||||
(void) closedir(v);
|
||||
}
|
||||
@@ -19,6 +25,7 @@ static void closedir_wrapper(void* v) {
|
||||
int safe_glob(const char *path, int flags, glob_t *pglob) {
|
||||
int k;
|
||||
|
||||
+#ifdef GLOB_ALTDIRFUNC
|
||||
/* We want to set GLOB_ALTDIRFUNC ourselves, don't allow it to be set. */
|
||||
assert(!(flags & GLOB_ALTDIRFUNC));
|
||||
|
||||
@@ -32,9 +39,14 @@ int safe_glob(const char *path, int flag
|
||||
pglob->gl_lstat = lstat;
|
||||
if (!pglob->gl_stat)
|
||||
pglob->gl_stat = stat;
|
||||
+#endif
|
||||
|
||||
errno = 0;
|
||||
+#ifdef GLOB_ALTDIRFUNC
|
||||
k = glob(path, flags | GLOB_ALTDIRFUNC, NULL, pglob);
|
||||
+#else
|
||||
+ k = glob(path, flags, NULL, pglob);
|
||||
+#endif
|
||||
if (k == GLOB_NOMATCH)
|
||||
return -ENOENT;
|
||||
if (k == GLOB_NOSPACE)
|
||||
--- a/src/test/test-glob-util.c
|
||||
+++ b/src/test/test-glob-util.c
|
||||
@@ -13,6 +13,12 @@
|
||||
#include "tests.h"
|
||||
#include "tmpfile-util.h"
|
||||
|
||||
+/* Don't fail if the standard library
|
||||
+ * doesn't provide brace expansion */
|
||||
+#ifndef GLOB_BRACE
|
||||
+#define GLOB_BRACE 0
|
||||
+#endif
|
||||
+
|
||||
TEST(glob_exists) {
|
||||
char name[] = "/tmp/test-glob_exists.XXXXXX";
|
||||
int fd = -1;
|
||||
@@ -40,11 +46,13 @@ TEST(glob_no_dot) {
|
||||
const char *fn;
|
||||
|
||||
_cleanup_globfree_ glob_t g = {
|
||||
+#ifdef GLOB_ALTDIRFUNC
|
||||
.gl_closedir = closedir_wrapper,
|
||||
.gl_readdir = (struct dirent *(*)(void *)) readdir_no_dot,
|
||||
.gl_opendir = (void *(*)(const char *)) opendir,
|
||||
.gl_lstat = lstat,
|
||||
.gl_stat = stat,
|
||||
+#endif
|
||||
};
|
||||
|
||||
int r;
|
||||
@@ -52,11 +60,19 @@ TEST(glob_no_dot) {
|
||||
assert_se(mkdtemp(template));
|
||||
|
||||
fn = strjoina(template, "/*");
|
||||
+#ifdef GLOB_ALTDIRFUNC
|
||||
r = glob(fn, GLOB_NOSORT|GLOB_BRACE|GLOB_ALTDIRFUNC, NULL, &g);
|
||||
+#else
|
||||
+ r = glob(fn, GLOB_NOSORT|GLOB_BRACE, NULL, &g);
|
||||
+#endif
|
||||
assert_se(r == GLOB_NOMATCH);
|
||||
|
||||
fn = strjoina(template, "/.*");
|
||||
+#ifdef GLOB_ALTDIRFUNC
|
||||
r = glob(fn, GLOB_NOSORT|GLOB_BRACE|GLOB_ALTDIRFUNC, NULL, &g);
|
||||
+#else
|
||||
+ r = glob(fn, GLOB_NOSORT|GLOB_BRACE, NULL, &g);
|
||||
+#endif
|
||||
assert_se(r == GLOB_NOMATCH);
|
||||
|
||||
(void) rm_rf(template, REMOVE_ROOT|REMOVE_PHYSICAL);
|
||||
--- a/src/tmpfiles/tmpfiles.c
|
||||
+++ b/src/tmpfiles/tmpfiles.c
|
||||
@@ -67,6 +67,12 @@
|
||||
#include "umask-util.h"
|
||||
#include "user-util.h"
|
||||
|
||||
+/* Don't fail if the standard library
|
||||
+ * doesn't provide brace expansion */
|
||||
+#ifndef GLOB_BRACE
|
||||
+#define GLOB_BRACE 0
|
||||
+#endif
|
||||
+
|
||||
/* This reads all files listed in /etc/tmpfiles.d/?*.conf and creates
|
||||
* them in the file system. This is intended to be used to create
|
||||
* properly owned directories beneath /tmp, /var/tmp, /run, which are
|
||||
@@ -1961,7 +1967,9 @@ finish:
|
||||
|
||||
static int glob_item(Item *i, action_t action) {
|
||||
_cleanup_globfree_ glob_t g = {
|
||||
+#ifdef GLOB_ALTDIRFUNC
|
||||
.gl_opendir = (void *(*)(const char *)) opendir_nomod,
|
||||
+#endif
|
||||
};
|
||||
int r = 0, k;
|
||||
char **fn;
|
||||
@@ -1981,7 +1989,9 @@ static int glob_item(Item *i, action_t a
|
||||
|
||||
static int glob_item_recursively(Item *i, fdaction_t action) {
|
||||
_cleanup_globfree_ glob_t g = {
|
||||
+#ifdef GLOB_ALTDIRFUNC
|
||||
.gl_opendir = (void *(*)(const char *)) opendir_nomod,
|
||||
+#endif
|
||||
};
|
||||
int r = 0, k;
|
||||
char **fn;
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
From 7ca9887f84adba065dc2e59b3de55ace2fc72ec0 Mon Sep 17 00:00:00 2001
|
||||
From: Chen Qi <Qi.Chen@windriver.com>
|
||||
Date: Mon, 25 Feb 2019 15:00:06 +0800
|
||||
Subject: [PATCH] add missing FTW_ macros for musl
|
||||
|
||||
This is to avoid build failures like below for musl.
|
||||
|
||||
locale-util.c:296:24: error: 'FTW_STOP' undeclared
|
||||
|
||||
Upstream-Status: Inappropriate [musl specific]
|
||||
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
|
||||
---
|
||||
src/basic/missing_type.h | 20 ++++++++++++++++++++
|
||||
src/shared/mount-setup.c | 1 +
|
||||
2 files changed, 21 insertions(+)
|
||||
|
||||
--- a/src/basic/missing_type.h
|
||||
+++ b/src/basic/missing_type.h
|
||||
@@ -19,3 +19,23 @@ typedef int (*comparison_fn_t)(const voi
|
||||
#define __COMPAR_FN_T
|
||||
typedef int (*__compar_fn_t)(const void *, const void *);
|
||||
#endif
|
||||
+
|
||||
+#ifndef FTW_ACTIONRETVAL
|
||||
+#define FTW_ACTIONRETVAL 16
|
||||
+#endif
|
||||
+
|
||||
+#ifndef FTW_CONTINUE
|
||||
+#define FTW_CONTINUE 0
|
||||
+#endif
|
||||
+
|
||||
+#ifndef FTW_STOP
|
||||
+#define FTW_STOP 1
|
||||
+#endif
|
||||
+
|
||||
+#ifndef FTW_SKIP_SUBTREE
|
||||
+#define FTW_SKIP_SUBTREE 2
|
||||
+#endif
|
||||
+
|
||||
+#ifndef FTW_SKIP_SIBLINGS
|
||||
+#define FTW_SKIP_SIBLINGS 3
|
||||
+#endif
|
||||
--- a/src/shared/mount-setup.c
|
||||
+++ b/src/shared/mount-setup.c
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "strv.h"
|
||||
#include "user-util.h"
|
||||
#include "virt.h"
|
||||
+#include "missing_type.h"
|
||||
|
||||
typedef enum MountMode {
|
||||
MNT_NONE = 0,
|
||||
--- a/src/test/test-recurse-dir.c
|
||||
+++ b/src/test/test-recurse-dir.c
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "recurse-dir.h"
|
||||
#include "strv.h"
|
||||
#include "tests.h"
|
||||
+#include "missing_type.h"
|
||||
|
||||
static char **list_nftw = NULL;
|
||||
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
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] 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 461bbfe9a5..2d06f9f60a 100644
|
||||
--- a/src/basic/process-util.c
|
||||
+++ b/src/basic/process-util.c
|
||||
@@ -18,6 +18,9 @@
|
||||
#if HAVE_VALGRIND_VALGRIND_H
|
||||
#include <valgrind/valgrind.h>
|
||||
#endif
|
||||
+#ifndef __GLIBC__
|
||||
+#include <pthread.h>
|
||||
+#endif
|
||||
|
||||
#include "alloc-util.h"
|
||||
#include "architecture.h"
|
||||
@@ -1202,11 +1205,15 @@ void reset_cached_pid(void) {
|
||||
cached_pid = CACHED_PID_UNSET;
|
||||
}
|
||||
|
||||
+#ifdef __GLIBC__
|
||||
/* We use glibc __register_atfork() + __dso_handle directly here, as they are not included in the glibc
|
||||
* headers. __register_atfork() is mostly equivalent to pthread_atfork(), but doesn't require us to link against
|
||||
* libpthread, as it is part of glibc anyway. */
|
||||
extern int __register_atfork(void (*prepare) (void), void (*parent) (void), void (*child) (void), void *dso_handle);
|
||||
extern void* __dso_handle _weak_;
|
||||
+#else
|
||||
+#define __register_atfork(prepare,parent,child,dso) pthread_atfork(prepare,parent,child)
|
||||
+#endif
|
||||
|
||||
pid_t getpid_cached(void) {
|
||||
static bool installed = false;
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
From 856010e268a6aca8e5f02502457afe289bd877f1 Mon Sep 17 00:00:00 2001
|
||||
From: Chen Qi <Qi.Chen@windriver.com>
|
||||
Date: Mon, 25 Feb 2019 15:12:41 +0800
|
||||
Subject: [PATCH] Use uintmax_t for handling rlim_t
|
||||
|
||||
PRIu{32,64} is not right format to represent rlim_t type
|
||||
therefore use %ju and typecast the rlim_t variables to
|
||||
uintmax_t.
|
||||
|
||||
Fixes portablility errors like
|
||||
|
||||
execute.c:3446:36: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'rlim_t {aka long long unsigned int}' [-Werror=format=]
|
||||
| fprintf(f, "%s%s: " RLIM_FMT "\n",
|
||||
| ^~~~~~~~
|
||||
| prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Upstream-Status: Denied [https://github.com/systemd/systemd/pull/7199]
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
[Rebased for v241]
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
|
||||
---
|
||||
src/basic/format-util.h | 8 +-------
|
||||
src/basic/rlimit-util.c | 12 ++++++------
|
||||
src/core/execute.c | 4 ++--
|
||||
3 files changed, 9 insertions(+), 15 deletions(-)
|
||||
|
||||
--- a/src/basic/format-util.h
|
||||
+++ b/src/basic/format-util.h
|
||||
@@ -34,13 +34,7 @@ assert_cc(sizeof(gid_t) == sizeof(uint32
|
||||
# error Unknown timex member size
|
||||
#endif
|
||||
|
||||
-#if SIZEOF_RLIM_T == 8
|
||||
-# define RLIM_FMT "%" PRIu64
|
||||
-#elif SIZEOF_RLIM_T == 4
|
||||
-# define RLIM_FMT "%" PRIu32
|
||||
-#else
|
||||
-# error Unknown rlim_t size
|
||||
-#endif
|
||||
+#define RLIM_FMT "%ju"
|
||||
|
||||
#if SIZEOF_DEV_T == 8
|
||||
# define DEV_FMT "%" PRIu64
|
||||
--- a/src/basic/rlimit-util.c
|
||||
+++ b/src/basic/rlimit-util.c
|
||||
@@ -44,7 +44,7 @@ int setrlimit_closest(int resource, cons
|
||||
fixed.rlim_max == highest.rlim_max)
|
||||
return 0;
|
||||
|
||||
- log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", rlim->rlim_max, rlimit_to_string(resource), fixed.rlim_max);
|
||||
+ log_debug("Failed at setting rlimit " RLIM_FMT " for resource RLIMIT_%s. Will attempt setting value " RLIM_FMT " instead.", (uintmax_t)rlim->rlim_max, rlimit_to_string(resource), (uintmax_t)fixed.rlim_max);
|
||||
|
||||
return RET_NERRNO(setrlimit(resource, &fixed));
|
||||
}
|
||||
@@ -307,13 +307,13 @@ int rlimit_format(const struct rlimit *r
|
||||
if (rl->rlim_cur >= RLIM_INFINITY && rl->rlim_max >= RLIM_INFINITY)
|
||||
r = free_and_strdup(&s, "infinity");
|
||||
else if (rl->rlim_cur >= RLIM_INFINITY)
|
||||
- r = asprintf(&s, "infinity:" RLIM_FMT, rl->rlim_max);
|
||||
+ r = asprintf(&s, "infinity:" RLIM_FMT, (uintmax_t)rl->rlim_max);
|
||||
else if (rl->rlim_max >= RLIM_INFINITY)
|
||||
- r = asprintf(&s, RLIM_FMT ":infinity", rl->rlim_cur);
|
||||
+ r = asprintf(&s, RLIM_FMT ":infinity", (uintmax_t)rl->rlim_cur);
|
||||
else if (rl->rlim_cur == rl->rlim_max)
|
||||
- r = asprintf(&s, RLIM_FMT, rl->rlim_cur);
|
||||
+ r = asprintf(&s, RLIM_FMT, (uintmax_t)rl->rlim_cur);
|
||||
else
|
||||
- r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, rl->rlim_cur, rl->rlim_max);
|
||||
+ r = asprintf(&s, RLIM_FMT ":" RLIM_FMT, (uintmax_t)rl->rlim_cur, (uintmax_t)rl->rlim_max);
|
||||
if (r < 0)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -403,7 +403,7 @@ int rlimit_nofile_safe(void) {
|
||||
|
||||
rl.rlim_cur = FD_SETSIZE;
|
||||
if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
|
||||
- return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", rl.rlim_cur);
|
||||
+ return log_debug_errno(errno, "Failed to lower RLIMIT_NOFILE's soft limit to " RLIM_FMT ": %m", (uintmax_t)rl.rlim_cur);
|
||||
|
||||
return 1;
|
||||
}
|
||||
--- a/src/core/execute.c
|
||||
+++ b/src/core/execute.c
|
||||
@@ -5639,9 +5639,9 @@ void exec_context_dump(const ExecContext
|
||||
for (unsigned i = 0; i < RLIM_NLIMITS; i++)
|
||||
if (c->rlimit[i]) {
|
||||
fprintf(f, "%sLimit%s: " RLIM_FMT "\n",
|
||||
- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_max);
|
||||
+ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_max);
|
||||
fprintf(f, "%sLimit%sSoft: " RLIM_FMT "\n",
|
||||
- prefix, rlimit_to_string(i), c->rlimit[i]->rlim_cur);
|
||||
+ prefix, rlimit_to_string(i), (uintmax_t)c->rlimit[i]->rlim_cur);
|
||||
}
|
||||
|
||||
if (c->ioprio_set) {
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
From ad395dda5db9b1ae156be121cfc8a38960de6c55 Mon Sep 17 00:00:00 2001
|
||||
From: Chen Qi <Qi.Chen@windriver.com>
|
||||
Date: Wed, 28 Feb 2018 21:25:22 -0800
|
||||
Subject: [PATCH] test-sizeof.c: Disable tests for missing typedefs in musl
|
||||
|
||||
Upstream-Status: Inappropriate [musl specific]
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
|
||||
---
|
||||
src/test/test-sizeof.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
--- a/src/test/test-sizeof.c
|
||||
+++ b/src/test/test-sizeof.c
|
||||
@@ -55,8 +55,10 @@ int main(void) {
|
||||
info(unsigned);
|
||||
info(long unsigned);
|
||||
info(long long unsigned);
|
||||
+#ifdef __GLIBC__
|
||||
info(__syscall_ulong_t);
|
||||
info(__syscall_slong_t);
|
||||
+#endif
|
||||
info(intmax_t);
|
||||
info(uintmax_t);
|
||||
|
||||
@@ -76,7 +78,9 @@ int main(void) {
|
||||
info(ssize_t);
|
||||
info(time_t);
|
||||
info(usec_t);
|
||||
+#ifdef __GLIBC__
|
||||
info(__time_t);
|
||||
+#endif
|
||||
info(pid_t);
|
||||
info(uid_t);
|
||||
info(gid_t);
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
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] don't pass AT_SYMLINK_NOFOLLOW flag to faccessat()
|
||||
|
||||
Avoid using AT_SYMLINK_NOFOLLOW flag. It doesn't seem like the right
|
||||
thing to do and it's not portable (not supported by musl). See:
|
||||
|
||||
http://lists.landley.net/pipermail/toybox-landley.net/2014-September/003610.html
|
||||
http://www.openwall.com/lists/musl/2015/02/05/2
|
||||
|
||||
Note that laccess() is never passing AT_EACCESS so a lot of the
|
||||
discussion in the links above doesn't apply. Note also that
|
||||
(currently) all systemd callers of laccess() pass mode as F_OK, so
|
||||
only check for existence of a file, not access permissions.
|
||||
Therefore, in this case, the only distiction between faccessat()
|
||||
with (flag == 0) and (flag == AT_SYMLINK_NOFOLLOW) is the behaviour
|
||||
for broken symlinks; laccess() on a broken symlink will succeed with
|
||||
(flag == AT_SYMLINK_NOFOLLOW) and fail (flag == 0).
|
||||
|
||||
The laccess() macros was added to systemd some time ago and it's not
|
||||
clear if or why it needs to return success for broken symlinks. Maybe
|
||||
just historical and not actually necessary or desired behaviour?
|
||||
|
||||
Upstream-Status: Inappropriate [musl specific]
|
||||
|
||||
Signed-off-by: Andre McCurdy <armccurdy@gmail.com>
|
||||
|
||||
---
|
||||
src/basic/fs-util.h | 23 +++++++++++++++++++++--
|
||||
src/shared/base-filesystem.c | 6 +++---
|
||||
2 files changed, 24 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/src/basic/fs-util.h
|
||||
+++ b/src/basic/fs-util.h
|
||||
@@ -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);
|
||||
|
||||
+/*
|
||||
+ Avoid using AT_SYMLINK_NOFOLLOW flag. It doesn't seem like the right thing to
|
||||
+ do and it's not portable (not supported by musl). See:
|
||||
+
|
||||
+ http://lists.landley.net/pipermail/toybox-landley.net/2014-September/003610.html
|
||||
+ http://www.openwall.com/lists/musl/2015/02/05/2
|
||||
+
|
||||
+ Note that laccess() is never passing AT_EACCESS so a lot of the discussion in
|
||||
+ the links above doesn't apply. Note also that (currently) all systemd callers
|
||||
+ of laccess() pass mode as F_OK, so only check for existence of a file, not
|
||||
+ access permissions. Therefore, in this case, the only distiction between
|
||||
+ faccessat() with (flag == 0) and (flag == AT_SYMLINK_NOFOLLOW) is the
|
||||
+ behaviour for broken symlinks; laccess() on a broken symlink will succeed
|
||||
+ with (flag == AT_SYMLINK_NOFOLLOW) and fail (flag == 0).
|
||||
+
|
||||
+ The laccess() macros was added to systemd some time ago and it's not clear if
|
||||
+ or why it needs to return success for broken symlinks. Maybe just historical
|
||||
+ and not actually necessary or desired behaviour?
|
||||
+*/
|
||||
#define laccess(path, mode) \
|
||||
- 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);
|
||||
--- a/src/shared/base-filesystem.c
|
||||
+++ b/src/shared/base-filesystem.c
|
||||
@@ -117,7 +117,7 @@ int base_filesystem_create(const char *r
|
||||
return log_error_errno(errno, "Failed to open root file system: %m");
|
||||
|
||||
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) {
|
||||
@@ -125,7 +125,7 @@ int base_filesystem_create(const char *r
|
||||
|
||||
/* check if one of the targets exists */
|
||||
NULSTR_FOREACH(s, table[i].target) {
|
||||
- if (faccessat(fd, s, F_OK, AT_SYMLINK_NOFOLLOW) < 0)
|
||||
+ if (faccessat(fd, s, F_OK, 0) < 0)
|
||||
continue;
|
||||
|
||||
/* check if a specific file exists at the target path */
|
||||
@@ -136,7 +136,7 @@ int base_filesystem_create(const char *r
|
||||
if (!p)
|
||||
return log_oom();
|
||||
|
||||
- if (faccessat(fd, p, F_OK, AT_SYMLINK_NOFOLLOW) < 0)
|
||||
+ if (faccessat(fd, p, F_OK, 0) < 0)
|
||||
continue;
|
||||
}
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
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] Define glibc compatible basename() for non-glibc systems
|
||||
|
||||
Fixes builds with musl, even though systemd is adamant about
|
||||
using non-posix basename implementation, we have a way out
|
||||
|
||||
Upstream-Status: Inappropriate [musl specific]
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
|
||||
---
|
||||
src/machine/machine-dbus.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
--- a/src/machine/machine-dbus.c
|
||||
+++ b/src/machine/machine-dbus.c
|
||||
@@ -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-get-properties.h"
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
From 30b08f76ea7f5c324afedf97f0867b76dac9f128 Mon Sep 17 00:00:00 2001
|
||||
From: Chen Qi <Qi.Chen@windriver.com>
|
||||
Date: Wed, 4 Jul 2018 15:00:44 +0800
|
||||
Subject: [PATCH] Do not disable buffering when writing to oom_score_adj
|
||||
|
||||
On musl, disabling buffering when writing to oom_score_adj will
|
||||
cause the following error.
|
||||
|
||||
Failed to adjust OOM setting: Invalid argument
|
||||
|
||||
This error appears for systemd-udevd.service and dbus.service.
|
||||
This is because kernel receives '-' instead of the whole '-900'
|
||||
if buffering is disabled.
|
||||
|
||||
This is libc implementation specific, as glibc does not have this issue.
|
||||
|
||||
Upstream-Status: Inappropriate [musl specific]
|
||||
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
[rebased for systemd 243]
|
||||
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
|
||||
|
||||
---
|
||||
src/basic/process-util.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/src/basic/process-util.c
|
||||
+++ b/src/basic/process-util.c
|
||||
@@ -1489,7 +1489,7 @@ int set_oom_score_adjust(int value) {
|
||||
xsprintf(t, "%i", value);
|
||||
|
||||
return write_string_file("/proc/self/oom_score_adj", t,
|
||||
- WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ WRITE_STRING_FILE_VERIFY_ON_FAILURE);
|
||||
}
|
||||
|
||||
int get_oom_score_adjust(int *ret) {
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
From 873202f63f9f117c6e5a98e444cc709057042979 Mon Sep 17 00:00:00 2001
|
||||
From: Chen Qi <Qi.Chen@windriver.com>
|
||||
Date: Tue, 10 Jul 2018 15:40:17 +0800
|
||||
Subject: [PATCH] distinguish XSI-compliant strerror_r from GNU-specifi
|
||||
strerror_r
|
||||
|
||||
XSI-compliant strerror_r and GNU-specifi strerror_r are different.
|
||||
|
||||
int strerror_r(int errnum, char *buf, size_t buflen);
|
||||
/* XSI-compliant */
|
||||
|
||||
char *strerror_r(int errnum, char *buf, size_t buflen);
|
||||
/* GNU-specific */
|
||||
|
||||
We need to distinguish between them. Otherwise, we'll get an int value
|
||||
assigned to (char *) variable, resulting in segment fault.
|
||||
|
||||
Upstream-Status: Inappropriate [musl specific]
|
||||
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
|
||||
---
|
||||
src/libsystemd/sd-bus/bus-error.c | 5 +++++
|
||||
src/libsystemd/sd-journal/journal-send.c | 5 +++++
|
||||
2 files changed, 10 insertions(+)
|
||||
|
||||
--- a/src/libsystemd/sd-bus/bus-error.c
|
||||
+++ b/src/libsystemd/sd-bus/bus-error.c
|
||||
@@ -409,7 +409,12 @@ static void bus_error_strerror(sd_bus_er
|
||||
return;
|
||||
|
||||
errno = 0;
|
||||
+#ifndef __GLIBC__
|
||||
+ strerror_r(error, m, k);
|
||||
+ x = m;
|
||||
+#else
|
||||
x = strerror_r(error, m, k);
|
||||
+#endif
|
||||
if (errno == ERANGE || strlen(x) >= k - 1) {
|
||||
free(m);
|
||||
k *= 2;
|
||||
--- a/src/libsystemd/sd-journal/journal-send.c
|
||||
+++ b/src/libsystemd/sd-journal/journal-send.c
|
||||
@@ -348,7 +348,12 @@ static int fill_iovec_perror_and_send(co
|
||||
char* j;
|
||||
|
||||
errno = 0;
|
||||
+#ifndef __GLIBC__
|
||||
+ strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
|
||||
+ j = buffer + 8 + k;
|
||||
+#else
|
||||
j = strerror_r(_saved_errno_, buffer + 8 + k, n - 8 - k);
|
||||
+#endif
|
||||
if (errno == 0) {
|
||||
char error[STRLEN("ERRNO=") + DECIMAL_STR_MAX(int) + 1];
|
||||
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
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] Hide __start_BUS_ERROR_MAP and __stop_BUS_ERROR_MAP
|
||||
|
||||
for currently unknown reasons they get exported to the shared libries
|
||||
even without being listed in the sym file
|
||||
|
||||
Upstream-Status: Pending
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
[Rebased for v241]
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
|
||||
---
|
||||
src/libsystemd/sd-bus/bus-error.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/libsystemd/sd-bus/bus-error.c b/src/libsystemd/sd-bus/bus-error.c
|
||||
index c49be29e46..90731bd7e7 100644
|
||||
--- a/src/libsystemd/sd-bus/bus-error.c
|
||||
+++ b/src/libsystemd/sd-bus/bus-error.c
|
||||
@@ -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 */
|
||||
-extern const sd_bus_error_map __start_SYSTEMD_BUS_ERROR_MAP[];
|
||||
-extern const sd_bus_error_map __stop_SYSTEMD_BUS_ERROR_MAP[];
|
||||
+extern const sd_bus_error_map __start_SYSTEMD_BUS_ERROR_MAP[] _hidden_;
|
||||
+extern const sd_bus_error_map __stop_SYSTEMD_BUS_ERROR_MAP[] _hidden_;
|
||||
|
||||
/* Additional maps registered with sd_bus_error_add_map() are in this
|
||||
* NULL terminated array */
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
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] missing_type.h: add __compar_d_fn_t definition
|
||||
|
||||
Fix the following compile failure:
|
||||
src/basic/util.h:71:18: error: unknown type name '__compar_d_fn_t'; did you mean '__compar_fn_t'?
|
||||
|
||||
Upstream-Status: Inappropriate [musl specific]
|
||||
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
|
||||
---
|
||||
src/basic/missing_type.h | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
|
||||
index 3df1084ef2..697aa7f58a 100644
|
||||
--- a/src/basic/missing_type.h
|
||||
+++ b/src/basic/missing_type.h
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
#ifndef __GLIBC__
|
||||
typedef int (*comparison_fn_t)(const void *, const void *);
|
||||
+typedef int (*__compar_d_fn_t) (const void *, const void *, void *);
|
||||
#endif
|
||||
|
||||
#ifndef __COMPAR_FN_T
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
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] avoid redefinition of prctl_mm_map structure
|
||||
|
||||
Fix the following compile failure:
|
||||
error: redefinition of 'struct prctl_mm_map'
|
||||
|
||||
Upstream-Status: Inappropriate [musl specific]
|
||||
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
|
||||
---
|
||||
src/basic/missing_prctl.h | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/src/basic/missing_prctl.h b/src/basic/missing_prctl.h
|
||||
index ab851306ba..5547cad875 100644
|
||||
--- a/src/basic/missing_prctl.h
|
||||
+++ b/src/basic/missing_prctl.h
|
||||
@@ -1,7 +1,9 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
+#ifdef __GLIBC__
|
||||
#include <linux/prctl.h>
|
||||
+#endif
|
||||
|
||||
/* 58319057b7847667f0c9585b9de0e8932b0fdb08 (4.3) */
|
||||
#ifndef PR_CAP_AMBIENT
|
||||
+24
@@ -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"
|
||||
+36
@@ -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),
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
From 47472da6e8900773c26da8fd26699367447d97a6 Mon Sep 17 00:00:00 2001
|
||||
From: Chen Qi <Qi.Chen@windriver.com>
|
||||
Date: Mon, 25 Feb 2019 16:53:06 +0800
|
||||
Subject: [PATCH] test-json.c: define M_PIl
|
||||
|
||||
Fix the following compile failure:
|
||||
src/test/test-json.c:305:50: error: 'M_PIl' undeclared (first use in this function); did you mean 'M_PI'?
|
||||
|
||||
Upstream-Status: Inappropriate [musl specific]
|
||||
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
|
||||
---
|
||||
src/test/test-json.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
--- a/src/test/test-json.c
|
||||
+++ b/src/test/test-json.c
|
||||
@@ -14,6 +14,10 @@
|
||||
#include "tests.h"
|
||||
#include "util.h"
|
||||
|
||||
+#ifndef M_PIl
|
||||
+#define M_PIl 3.141592653589793238462643383279502884L
|
||||
+#endif
|
||||
+
|
||||
static void test_tokenizer_one(const char *data, ...) {
|
||||
unsigned line = 0, column = 0;
|
||||
void *state = NULL;
|
||||
+420
@@ -0,0 +1,420 @@
|
||||
From 0f9422780a569c79a4b28e44c79c70b4a354bd92 Mon Sep 17 00:00:00 2001
|
||||
From: Chen Qi <Qi.Chen@windriver.com>
|
||||
Date: Fri, 1 Mar 2019 15:22:15 +0800
|
||||
Subject: [PATCH] do not disable buffer in writing files
|
||||
|
||||
Do not disable buffer in writing files, otherwise we get
|
||||
failure at boot for musl like below.
|
||||
|
||||
[!!!!!!] Failed to allocate manager object.
|
||||
|
||||
And there will be other failures, critical or not critical.
|
||||
This is specific to musl.
|
||||
|
||||
Upstream-Status: Inappropriate [musl]
|
||||
|
||||
Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
|
||||
[Rebased for v242]
|
||||
Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
|
||||
[rebased for systemd 243]
|
||||
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
|
||||
|
||||
---
|
||||
src/basic/cgroup-util.c | 10 +++++-----
|
||||
src/basic/procfs-util.c | 4 ++--
|
||||
src/basic/sysctl-util.c | 2 +-
|
||||
src/basic/util.c | 2 +-
|
||||
src/binfmt/binfmt.c | 6 +++---
|
||||
src/core/main.c | 4 ++--
|
||||
src/core/smack-setup.c | 8 ++++----
|
||||
src/hibernate-resume/hibernate-resume.c | 2 +-
|
||||
src/libsystemd/sd-device/sd-device.c | 2 +-
|
||||
src/nspawn/nspawn-cgroup.c | 2 +-
|
||||
src/nspawn/nspawn.c | 6 +++---
|
||||
src/shared/cgroup-setup.c | 4 ++--
|
||||
src/shared/mount-util.c | 4 ++--
|
||||
src/shared/smack-util.c | 2 +-
|
||||
src/sleep/sleep.c | 8 ++++----
|
||||
src/vconsole/vconsole-setup.c | 2 +-
|
||||
16 files changed, 34 insertions(+), 34 deletions(-)
|
||||
|
||||
--- a/src/basic/cgroup-util.c
|
||||
+++ b/src/basic/cgroup-util.c
|
||||
@@ -390,7 +390,7 @@ int cg_kill_kernel_sigkill(const char *c
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
- r = write_string_file(killfile, "1", WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file(killfile, "1", 0);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -803,7 +803,7 @@ int cg_install_release_agent(const char
|
||||
|
||||
sc = strstrip(contents);
|
||||
if (isempty(sc)) {
|
||||
- r = write_string_file(fs, agent, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file(fs, agent, 0);
|
||||
if (r < 0)
|
||||
return r;
|
||||
} else if (!path_equal(sc, agent))
|
||||
@@ -821,7 +821,7 @@ int cg_install_release_agent(const char
|
||||
|
||||
sc = strstrip(contents);
|
||||
if (streq(sc, "0")) {
|
||||
- r = write_string_file(fs, "1", WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file(fs, "1", 0);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -848,7 +848,7 @@ int cg_uninstall_release_agent(const cha
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
- r = write_string_file(fs, "0", WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file(fs, "0", 0);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -858,7 +858,7 @@ int cg_uninstall_release_agent(const cha
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
- r = write_string_file(fs, "", WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file(fs, "", 0);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -1704,7 +1704,7 @@ int cg_set_attribute(const char *control
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
- return write_string_file(p, value, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ return write_string_file(p, value, 0);
|
||||
}
|
||||
|
||||
int cg_get_attribute(const char *controller, const char *path, const char *attribute, char **ret) {
|
||||
--- a/src/basic/procfs-util.c
|
||||
+++ b/src/basic/procfs-util.c
|
||||
@@ -64,13 +64,13 @@ int procfs_tasks_set_limit(uint64_t limi
|
||||
* decrease it, as threads-max is the much more relevant sysctl. */
|
||||
if (limit > pid_max-1) {
|
||||
sprintf(buffer, "%" PRIu64, limit+1); /* Add one, since PID 0 is not a valid PID */
|
||||
- r = write_string_file("/proc/sys/kernel/pid_max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file("/proc/sys/kernel/pid_max", buffer, 0);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
sprintf(buffer, "%" PRIu64, limit);
|
||||
- r = write_string_file("/proc/sys/kernel/threads-max", buffer, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file("/proc/sys/kernel/threads-max", buffer, 0);
|
||||
if (r < 0) {
|
||||
uint64_t threads_max;
|
||||
|
||||
--- a/src/basic/sysctl-util.c
|
||||
+++ b/src/basic/sysctl-util.c
|
||||
@@ -58,7 +58,7 @@ int sysctl_write(const char *property, c
|
||||
|
||||
log_debug("Setting '%s' to '%s'", p, value);
|
||||
|
||||
- return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_SUPPRESS_REDUNDANT_VIRTUAL);
|
||||
+ return write_string_file(p, value, WRITE_STRING_FILE_VERIFY_ON_FAILURE | WRITE_STRING_FILE_SUPPRESS_REDUNDANT_VIRTUAL);
|
||||
}
|
||||
|
||||
int sysctl_writef(const char *property, const char *format, ...) {
|
||||
--- a/src/basic/util.c
|
||||
+++ b/src/basic/util.c
|
||||
@@ -168,7 +168,7 @@ void disable_coredumps(void) {
|
||||
if (detect_container() > 0)
|
||||
return;
|
||||
|
||||
- r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file("/proc/sys/kernel/core_pattern", "|/bin/false", 0);
|
||||
if (r < 0)
|
||||
log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m");
|
||||
}
|
||||
--- a/src/binfmt/binfmt.c
|
||||
+++ b/src/binfmt/binfmt.c
|
||||
@@ -29,7 +29,7 @@ static bool arg_unregister = false;
|
||||
|
||||
static int delete_rule(const char *rulename) {
|
||||
const char *fn = strjoina("/proc/sys/fs/binfmt_misc/", rulename);
|
||||
- return write_string_file(fn, "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ return write_string_file(fn, "-1", 0);
|
||||
}
|
||||
|
||||
static int apply_rule(const char *filename, unsigned line, const char *rule) {
|
||||
@@ -59,7 +59,7 @@ static int apply_rule(const char *filena
|
||||
if (r >= 0)
|
||||
log_debug("%s:%u: Rule '%s' deleted.", filename, line, rulename);
|
||||
|
||||
- r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file("/proc/sys/fs/binfmt_misc/register", rule, 0);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "%s:%u: Failed to add binary format '%s': %m",
|
||||
filename, line, rulename);
|
||||
@@ -226,7 +226,7 @@ static int run(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
/* Flush out all rules */
|
||||
- r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0);
|
||||
if (r < 0)
|
||||
log_warning_errno(r, "Failed to flush binfmt_misc rules, ignoring: %m");
|
||||
else
|
||||
--- a/src/core/main.c
|
||||
+++ b/src/core/main.c
|
||||
@@ -1466,7 +1466,7 @@ static int bump_unix_max_dgram_qlen(void
|
||||
if (v >= DEFAULT_UNIX_MAX_DGRAM_QLEN)
|
||||
return 0;
|
||||
|
||||
- r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", WRITE_STRING_FILE_DISABLE_BUFFER,
|
||||
+ r = write_string_filef("/proc/sys/net/unix/max_dgram_qlen", 0,
|
||||
"%lu", DEFAULT_UNIX_MAX_DGRAM_QLEN);
|
||||
if (r < 0)
|
||||
return log_full_errno(IN_SET(r, -EROFS, -EPERM, -EACCES) ? LOG_DEBUG : LOG_WARNING, r,
|
||||
@@ -1737,7 +1737,7 @@ static void initialize_core_pattern(bool
|
||||
if (getpid_cached() != 1)
|
||||
return;
|
||||
|
||||
- r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file("/proc/sys/kernel/core_pattern", arg_early_core_pattern, 0);
|
||||
if (r < 0)
|
||||
log_warning_errno(r, "Failed to write '%s' to /proc/sys/kernel/core_pattern, ignoring: %m",
|
||||
arg_early_core_pattern);
|
||||
--- a/src/core/smack-setup.c
|
||||
+++ b/src/core/smack-setup.c
|
||||
@@ -320,17 +320,17 @@ int mac_smack_setup(bool *loaded_policy)
|
||||
}
|
||||
|
||||
#if HAVE_SMACK_RUN_LABEL
|
||||
- r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file("/proc/self/attr/current", SMACK_RUN_LABEL, 0);
|
||||
if (r < 0)
|
||||
log_warning_errno(r, "Failed to set SMACK label \"" SMACK_RUN_LABEL "\" on self: %m");
|
||||
- r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file("/sys/fs/smackfs/ambient", SMACK_RUN_LABEL, 0);
|
||||
if (r < 0)
|
||||
log_warning_errno(r, "Failed to set SMACK ambient label \"" SMACK_RUN_LABEL "\": %m");
|
||||
r = write_string_file("/sys/fs/smackfs/netlabel",
|
||||
- "0.0.0.0/0 " SMACK_RUN_LABEL, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ "0.0.0.0/0 " SMACK_RUN_LABEL, 0);
|
||||
if (r < 0)
|
||||
log_warning_errno(r, "Failed to set SMACK netlabel rule \"0.0.0.0/0 " SMACK_RUN_LABEL "\": %m");
|
||||
- r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file("/sys/fs/smackfs/netlabel", "127.0.0.1 -CIPSO", 0);
|
||||
if (r < 0)
|
||||
log_warning_errno(r, "Failed to set SMACK netlabel rule \"127.0.0.1 -CIPSO\": %m");
|
||||
#endif
|
||||
--- a/src/hibernate-resume/hibernate-resume.c
|
||||
+++ b/src/hibernate-resume/hibernate-resume.c
|
||||
@@ -45,7 +45,7 @@ int main(int argc, char *argv[]) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
- r = write_string_file("/sys/power/resume", major_minor, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file("/sys/power/resume", major_minor, 0);
|
||||
if (r < 0) {
|
||||
log_error_errno(r, "Failed to write '%s' to /sys/power/resume: %m", major_minor);
|
||||
return EXIT_FAILURE;
|
||||
--- a/src/libsystemd/sd-device/sd-device.c
|
||||
+++ b/src/libsystemd/sd-device/sd-device.c
|
||||
@@ -2108,7 +2108,7 @@ _public_ int sd_device_set_sysattr_value
|
||||
if (!value)
|
||||
return -ENOMEM;
|
||||
|
||||
- r = write_string_file(path, value, WRITE_STRING_FILE_DISABLE_BUFFER | WRITE_STRING_FILE_NOFOLLOW);
|
||||
+ r = write_string_file(path, value, 0 | WRITE_STRING_FILE_NOFOLLOW);
|
||||
if (r < 0) {
|
||||
/* On failure, clear cache entry, as we do not know how it fails. */
|
||||
device_remove_cached_sysattr_value(device, sysattr);
|
||||
--- a/src/nspawn/nspawn-cgroup.c
|
||||
+++ b/src/nspawn/nspawn-cgroup.c
|
||||
@@ -124,7 +124,7 @@ int sync_cgroup(pid_t pid, CGroupUnified
|
||||
fn = strjoina(tree, cgroup, "/cgroup.procs");
|
||||
|
||||
sprintf(pid_string, PID_FMT, pid);
|
||||
- r = write_string_file(fn, pid_string, WRITE_STRING_FILE_DISABLE_BUFFER|WRITE_STRING_FILE_MKDIR_0755);
|
||||
+ r = write_string_file(fn, pid_string, WRITE_STRING_FILE_MKDIR_0755);
|
||||
if (r < 0) {
|
||||
log_error_errno(r, "Failed to move process: %m");
|
||||
goto finish;
|
||||
--- a/src/nspawn/nspawn.c
|
||||
+++ b/src/nspawn/nspawn.c
|
||||
@@ -2757,7 +2757,7 @@ static int reset_audit_loginuid(void) {
|
||||
if (streq(p, "4294967295"))
|
||||
return 0;
|
||||
|
||||
- r = write_string_file("/proc/self/loginuid", "4294967295", WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file("/proc/self/loginuid", "4294967295", 0);
|
||||
if (r < 0) {
|
||||
log_error_errno(r,
|
||||
"Failed to reset audit login UID. This probably means that your kernel is too\n"
|
||||
@@ -4163,7 +4163,7 @@ static int setup_uid_map(
|
||||
return log_oom();
|
||||
|
||||
xsprintf(uid_map, "/proc/" PID_FMT "/uid_map", pid);
|
||||
- r = write_string_file(uid_map, s, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file(uid_map, s, 0);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to write UID map: %m");
|
||||
|
||||
@@ -4173,7 +4173,7 @@ static int setup_uid_map(
|
||||
return log_oom();
|
||||
|
||||
xsprintf(uid_map, "/proc/" PID_FMT "/gid_map", pid);
|
||||
- r = write_string_file(uid_map, s, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file(uid_map, s, 0);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to write GID map: %m");
|
||||
|
||||
--- a/src/shared/cgroup-setup.c
|
||||
+++ b/src/shared/cgroup-setup.c
|
||||
@@ -345,7 +345,7 @@ int cg_attach(const char *controller, co
|
||||
|
||||
xsprintf(c, PID_FMT "\n", pid);
|
||||
|
||||
- r = write_string_file(fs, c, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file(fs, c, 0);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -877,7 +877,7 @@ int cg_enable_everywhere(
|
||||
return log_debug_errno(errno, "Failed to open cgroup.subtree_control file of %s: %m", p);
|
||||
}
|
||||
|
||||
- r = write_string_stream(f, s, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_stream(f, s, 0);
|
||||
if (r < 0) {
|
||||
log_debug_errno(r, "Failed to %s controller %s for %s (%s): %m",
|
||||
FLAGS_SET(mask, bit) ? "enable" : "disable", n, p, fs);
|
||||
--- a/src/shared/smack-util.c
|
||||
+++ b/src/shared/smack-util.c
|
||||
@@ -114,7 +114,7 @@ int mac_smack_apply_pid(pid_t pid, const
|
||||
return 0;
|
||||
|
||||
p = procfs_file_alloca(pid, "attr/current");
|
||||
- r = write_string_file(p, label, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file(p, label, 0);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
--- a/src/sleep/sleep.c
|
||||
+++ b/src/sleep/sleep.c
|
||||
@@ -46,7 +46,7 @@ static int write_hibernate_location_info
|
||||
assert(hibernate_location->swap);
|
||||
|
||||
xsprintf(resume_str, "%u:%u", major(hibernate_location->devno), minor(hibernate_location->devno));
|
||||
- r = write_string_file("/sys/power/resume", resume_str, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file("/sys/power/resume", resume_str, 0);
|
||||
if (r < 0)
|
||||
return log_debug_errno(r, "Failed to write partition device to /sys/power/resume for '%s': '%s': %m",
|
||||
hibernate_location->swap->device, resume_str);
|
||||
@@ -73,7 +73,7 @@ static int write_hibernate_location_info
|
||||
}
|
||||
|
||||
xsprintf(offset_str, "%" PRIu64, hibernate_location->offset);
|
||||
- r = write_string_file("/sys/power/resume_offset", offset_str, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file("/sys/power/resume_offset", offset_str, 0);
|
||||
if (r < 0)
|
||||
return log_debug_errno(r, "Failed to write swap file offset to /sys/power/resume_offset for '%s': '%s': %m",
|
||||
hibernate_location->swap->device, offset_str);
|
||||
@@ -90,7 +90,7 @@ static int write_mode(char **modes) {
|
||||
STRV_FOREACH(mode, modes) {
|
||||
int k;
|
||||
|
||||
- k = write_string_file("/sys/power/disk", *mode, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ k = write_string_file("/sys/power/disk", *mode, 0);
|
||||
if (k >= 0)
|
||||
return 0;
|
||||
|
||||
@@ -112,7 +112,7 @@ static int write_state(FILE **f, char **
|
||||
STRV_FOREACH(state, states) {
|
||||
int k;
|
||||
|
||||
- k = write_string_stream(*f, *state, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ k = write_string_stream(*f, *state, 0);
|
||||
if (k >= 0)
|
||||
return 0;
|
||||
log_debug_errno(k, "Failed to write '%s' to /sys/power/state: %m", *state);
|
||||
--- a/src/vconsole/vconsole-setup.c
|
||||
+++ b/src/vconsole/vconsole-setup.c
|
||||
@@ -108,7 +108,7 @@ static int toggle_utf8_vc(const char *na
|
||||
static int toggle_utf8_sysfs(bool utf8) {
|
||||
int r;
|
||||
|
||||
- r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), 0);
|
||||
if (r < 0)
|
||||
return log_warning_errno(r, "Failed to %s sysfs UTF-8 flag: %m", enable_disable(utf8));
|
||||
|
||||
--- a/src/basic/namespace-util.c
|
||||
+++ b/src/basic/namespace-util.c
|
||||
@@ -202,12 +202,12 @@ int userns_acquire(const char *uid_map,
|
||||
freeze();
|
||||
|
||||
xsprintf(path, "/proc/" PID_FMT "/uid_map", pid);
|
||||
- r = write_string_file(path, uid_map, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file(path, uid_map, 0);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to write UID map: %m");
|
||||
|
||||
xsprintf(path, "/proc/" PID_FMT "/gid_map", pid);
|
||||
- r = write_string_file(path, gid_map, WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file(path, gid_map, 0);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to write GID map: %m");
|
||||
|
||||
--- a/src/core/cgroup.c
|
||||
+++ b/src/core/cgroup.c
|
||||
@@ -4140,7 +4140,7 @@ int unit_cgroup_freezer_action(Unit *u,
|
||||
else
|
||||
u->freezer_state = FREEZER_THAWING;
|
||||
|
||||
- r = write_string_file(path, one_zero(action == FREEZER_FREEZE), WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file(path, one_zero(action == FREEZER_FREEZE), 0);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
--- a/src/home/homework.c
|
||||
+++ b/src/home/homework.c
|
||||
@@ -284,7 +284,7 @@ static void drop_caches_now(void) {
|
||||
* details. We write "2" into /proc/sys/vm/drop_caches to ensure dentries/inodes are flushed, but not
|
||||
* more. */
|
||||
|
||||
- r = write_string_file("/proc/sys/vm/drop_caches", "2\n", WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file("/proc/sys/vm/drop_caches", "2\n", 0);
|
||||
if (r < 0)
|
||||
log_warning_errno(r, "Failed to drop caches, ignoring: %m");
|
||||
else
|
||||
--- a/src/shared/binfmt-util.c
|
||||
+++ b/src/shared/binfmt-util.c
|
||||
@@ -26,7 +26,7 @@ int disable_binfmt(void) {
|
||||
if (r < 0)
|
||||
return log_warning_errno(r, "Failed to determine whether binfmt_misc is mounted: %m");
|
||||
|
||||
- r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", 0);
|
||||
if (r < 0)
|
||||
return log_warning_errno(r, "Failed to unregister binfmt_misc entries: %m");
|
||||
|
||||
--- a/src/shared/coredump-util.c
|
||||
+++ b/src/shared/coredump-util.c
|
||||
@@ -70,5 +70,5 @@ int set_coredump_filter(uint64_t value)
|
||||
sprintf(t, "0x%"PRIx64, value);
|
||||
|
||||
return write_string_file("/proc/self/coredump_filter", t,
|
||||
- WRITE_STRING_FILE_VERIFY_ON_FAILURE|WRITE_STRING_FILE_DISABLE_BUFFER);
|
||||
+ WRITE_STRING_FILE_VERIFY_ON_FAILURE);
|
||||
}
|
||||
--- a/src/udev/udev-rules.c
|
||||
+++ b/src/udev/udev-rules.c
|
||||
@@ -2181,7 +2181,6 @@ static int udev_rule_apply_token_to_even
|
||||
log_rule_debug(dev, rules, "ATTR '%s' writing '%s'", buf, value);
|
||||
r = write_string_file(buf, value,
|
||||
WRITE_STRING_FILE_VERIFY_ON_FAILURE |
|
||||
- WRITE_STRING_FILE_DISABLE_BUFFER |
|
||||
WRITE_STRING_FILE_AVOID_NEWLINE |
|
||||
WRITE_STRING_FILE_VERIFY_IGNORE_NEWLINE);
|
||||
if (r < 0)
|
||||
+58
@@ -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. */
|
||||
+165
@@ -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;
|
||||
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
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"
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
Upstream-Status: Pending
|
||||
|
||||
--- a/src/libsystemd/libsystemd.pc.in
|
||||
+++ b/src/libsystemd/libsystemd.pc.in
|
||||
@@ -16,5 +16,5 @@ Name: systemd
|
||||
Description: systemd Library
|
||||
URL: {{PROJECT_URL}}
|
||||
Version: {{PROJECT_VERSION}}
|
||||
-Libs: -L${libdir} -lsystemd
|
||||
+Libs: -L${libdir} -lsystemd -lrt -lmount -lcap
|
||||
Cflags: -I${includedir}
|
||||
@@ -0,0 +1,79 @@
|
||||
SUMMARY = "libsystemd static library"
|
||||
DESCRIPTION = "libsystemd static library built specifically as an integral component of sdbus-c++"
|
||||
|
||||
SECTION = "libs"
|
||||
|
||||
LICENSE = "LGPL-2.1-or-later"
|
||||
LIC_FILES_CHKSUM = "file://LICENSE.LGPL2.1;md5=4fbd65380cdd255951079008b364516c"
|
||||
|
||||
inherit meson pkgconfig
|
||||
|
||||
DEPENDS += "gperf-native gettext-native util-linux libcap util-linux python3-jinja2-native"
|
||||
|
||||
SRCREV = "1d5e0e9910500f3c3584485f77bfc35e601036e3"
|
||||
SRCBRANCH = "v250-stable"
|
||||
SRC_URI = "git://github.com/systemd/systemd-stable.git;protocol=https;branch=${SRCBRANCH} \
|
||||
file://static-libsystemd-pkgconfig.patch \
|
||||
file://0001-dirent-util-Remove-asserts-on-dirent64-dirent.patch \
|
||||
"
|
||||
|
||||
# patches needed by musl
|
||||
SRC_URI:append:libc-musl = " ${SRC_URI_MUSL}"
|
||||
|
||||
SRC_URI_MUSL = "\
|
||||
file://0002-don-t-use-glibc-specific-qsort_r.patch \
|
||||
file://0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch \
|
||||
file://0004-add-fallback-parse_printf_format-implementation.patch \
|
||||
file://0005-src-basic-missing.h-check-for-missing-strndupa.patch \
|
||||
file://0007-don-t-fail-if-GLOB_BRACE-and-GLOB_ALTDIRFUNC-is-not-.patch \
|
||||
file://0008-add-missing-FTW_-macros-for-musl.patch \
|
||||
file://0009-fix-missing-of-__register_atfork-for-non-glibc-build.patch \
|
||||
file://0010-Use-uintmax_t-for-handling-rlim_t.patch \
|
||||
file://0011-test-sizeof.c-Disable-tests-for-missing-typedefs-in-.patch \
|
||||
file://0012-don-t-pass-AT_SYMLINK_NOFOLLOW-flag-to-faccessat.patch \
|
||||
file://0013-Define-glibc-compatible-basename-for-non-glibc-syste.patch \
|
||||
file://0014-Do-not-disable-buffering-when-writing-to-oom_score_a.patch \
|
||||
file://0015-distinguish-XSI-compliant-strerror_r-from-GNU-specif.patch \
|
||||
file://0016-Hide-__start_BUS_ERROR_MAP-and-__stop_BUS_ERROR_MAP.patch \
|
||||
file://0017-missing_type.h-add-__compar_d_fn_t-definition.patch \
|
||||
file://0018-avoid-redefinition-of-prctl_mm_map-structure.patch \
|
||||
file://0019-Handle-missing-LOCK_EX.patch \
|
||||
file://0020-Fix-incompatible-pointer-type-struct-sockaddr_un.patch \
|
||||
file://0021-test-json.c-define-M_PIl.patch \
|
||||
file://0022-do-not-disable-buffer-in-writing-files.patch \
|
||||
file://0025-Handle-__cpu_mask-usage.patch \
|
||||
file://0026-Handle-missing-gshadow.patch \
|
||||
file://0028-missing_syscall.h-Define-MIPS-ABI-defines-for-musl.patch \
|
||||
file://0002-Add-sys-stat.h-for-S_IFDIR.patch \
|
||||
file://0001-Adjust-for-musl-headers.patch \
|
||||
"
|
||||
|
||||
PACKAGECONFIG ??= "gshadow idn"
|
||||
PACKAGECONFIG:remove:libc-musl = " gshadow idn"
|
||||
PACKAGECONFIG[gshadow] = "-Dgshadow=true,-Dgshadow=false"
|
||||
PACKAGECONFIG[idn] = "-Didn=true,-Didn=false"
|
||||
|
||||
CFLAGS:append:libc-musl = " -D__UAPI_DEF_ETHHDR=0 "
|
||||
|
||||
EXTRA_OEMESON += "-Dstatic-libsystemd=pic"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
RDEPENDS:${PN}-dev = ""
|
||||
|
||||
do_compile() {
|
||||
ninja -v ${PARALLEL_MAKE} version.h
|
||||
ninja -v ${PARALLEL_MAKE} libsystemd.a
|
||||
ninja -v ${PARALLEL_MAKE} src/libsystemd/libsystemd.pc
|
||||
}
|
||||
|
||||
do_install () {
|
||||
install -d ${D}${libdir}
|
||||
install ${B}/libsystemd.a ${D}${libdir}
|
||||
|
||||
install -d ${D}${includedir}/systemd
|
||||
install ${S}/src/systemd/*.h ${D}${includedir}/systemd
|
||||
|
||||
install -d ${D}${libdir}/pkgconfig
|
||||
install ${B}/src/libsystemd/libsystemd.pc ${D}${libdir}/pkgconfig
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
SUMMARY = "sdbus-c++ native tools"
|
||||
DESCRIPTION = "Native interface code generator for development with sdbus-c++"
|
||||
|
||||
LICENSE = "LGPL-2.1-only"
|
||||
LIC_FILES_CHKSUM = "file://${S}/COPYING;md5=1803fa9c2c3ce8cb06b4861d75310742"
|
||||
|
||||
inherit cmake
|
||||
|
||||
DEPENDS += "expat"
|
||||
|
||||
SRCREV = "751c1addc4fd2f949a466f488c1b7de2ca3b76dc"
|
||||
SRC_URI = "git://github.com/Kistler-Group/sdbus-cpp.git;protocol=https;branch=master;subpath=tools"
|
||||
|
||||
S = "${WORKDIR}/tools"
|
||||
|
||||
BBCLASSEXTEND = "native nativesdk"
|
||||
@@ -0,0 +1,47 @@
|
||||
SUMMARY = "sdbus-c++"
|
||||
DESCRIPTION = "High-level C++ D-Bus library designed to provide easy-to-use yet powerful API in modern C++"
|
||||
|
||||
SECTION = "libs"
|
||||
|
||||
LICENSE = "LGPL-2.1-only"
|
||||
LIC_FILES_CHKSUM = "file://COPYING;md5=1803fa9c2c3ce8cb06b4861d75310742"
|
||||
|
||||
inherit cmake pkgconfig systemd ptest
|
||||
|
||||
PACKAGECONFIG ??= "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'with-external-libsystemd', 'with-builtin-libsystemd', d)} \
|
||||
${@bb.utils.contains('PTEST_ENABLED', '1', 'with-tests', '', d)}"
|
||||
PACKAGECONFIG[with-builtin-libsystemd] = ",,sdbus-c++-libsystemd,libcap"
|
||||
PACKAGECONFIG[with-external-libsystemd] = ",,systemd,libsystemd"
|
||||
PACKAGECONFIG[with-tests] = "-DBUILD_TESTS=ON -DTESTS_INSTALL_PATH=${libdir}/${BPN}/tests,-DBUILD_TESTS=OFF,googletest gmock"
|
||||
|
||||
DEPENDS += "expat"
|
||||
|
||||
SRCREV = "751c1addc4fd2f949a466f488c1b7de2ca3b76dc"
|
||||
|
||||
SRC_URI = "git://github.com/Kistler-Group/sdbus-cpp.git;protocol=https;branch=master"
|
||||
SRC_URI += "file://run-ptest"
|
||||
|
||||
EXTRA_OECMAKE = "-DBUILD_CODE_GEN=OFF \
|
||||
-DBUILD_DOC=ON \
|
||||
-DBUILD_DOXYGEN_DOC=OFF"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
# Link libatomic on architectures without 64bit atomics fixes
|
||||
# libsdbus-c++.so.1.1.0: undefined reference to `__atomic_load_8'
|
||||
LDFLAGS:append:mips = " -Wl,--no-as-needed -latomic -Wl,--as-needed"
|
||||
LDFLAGS:append:powerpc = " -Wl,--no-as-needed -latomic -Wl,--as-needed"
|
||||
LDFLAGS:append:riscv32 = " -Wl,--no-as-needed -latomic -Wl,--as-needed"
|
||||
|
||||
do_install:append() {
|
||||
if ! ${@bb.utils.contains('PTEST_ENABLED', '1', 'true', 'false', d)}; then
|
||||
rm -rf ${D}${sysconfdir}/dbus-1
|
||||
fi
|
||||
}
|
||||
|
||||
PTEST_PATH = "${libdir}/${BPN}/tests"
|
||||
FILES:${PN}-ptest =+ "${sysconfdir}/dbus-1/system.d/"
|
||||
FILES:${PN}-dev += "${bindir}/sdbus-c++-xml2cpp"
|
||||
|
||||
# It adds -isystem which is spurious, no idea where it gets it from
|
||||
CCACHE_DISABLE = "1"
|
||||
Reference in New Issue
Block a user