Skip to contentSkip to conversation

opensaf: Fix build on 32bit arches with 64bit time_t e.g. RISCV-32

PATCH In review Khem Raj 2 participants 2 messages Nov 15, 2020 – Nov 16, 2020

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 opensaf: Fix build on 32bit arches with 64bit time_t e.g. RISCV-32

---
 ...rrect-printf-format-for-__fsblkcnt_t.patch | 36 +++++++++++++++++++
 .../opensaf/opensaf_5.20.08.bb                |  1 +
 2 files changed, 37 insertions(+)
 create mode 100644 meta-networking/recipes-daemons/opensaf/opensaf/0001-Use-correct-printf-format-for-__fsblkcnt_t.patch
meta-networking/recipes-daemons/opensaf/opensaf/0001-Use-correct-printf-format-for-__fsblkcnt_t.patch new file +36 -0
new file mode 100644
index 0000000000..0e113f533f
@@ -0,0 +1,36 @@
+From 90f81c1fb3e560cfc99ee7ab9a48a1736e3929cd Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Sun, 15 Nov 2020 13:22:31 -0800
+Subject: [PATCH] Use correct printf format for __fsblkcnt_t
+
+This depends on time_t size and on some 32bit architectures e.g. riscv32
+this would be a 64bit value
+
+Fixes
+os_defs.c:920:40: error: format '%ld' expects argument of type 'long int', but argument 3 has type '__fsblkcnt_t' {aka 'long long unsigned int'} [-Werror=format=]
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/base/os_defs.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/base/os_defs.c b/src/base/os_defs.c
+index 83458c2..655c190 100644
+--- a/src/base/os_defs.c
++++ b/src/base/os_defs.c
+@@ -917,7 +917,11 @@ uint32_t ncs_os_posix_shm(NCS_OS_POSIX_SHM_REQ_INFO *req)
+ 			    ((statsvfs.f_bfree - 1) * statsvfs.f_frsize)) {
+ 				syslog(
+ 				    LOG_ERR,
++#if __TIMESIZE == 64 && __WORDSIZE == 32
++				    "Insufficient shared memory (%lld) to write the data of size: %" PRId64
++#else
+ 				    "Insufficient shared memory (%ld) to write the data of size: %" PRId64
++#endif
+ 				    "\n",
+ 				    (statsvfs.f_bfree * statsvfs.f_frsize),
+ 				    req->info.write.i_write_size);
+-- 
+2.29.2
+
meta-networking/recipes-daemons/opensaf/opensaf_5.20.08.bb +1 -0
index 7c7051eff3..5516fc43ae 100644
@@ -27,6 +27,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/releases/${BPN}-${PV}.tar.gz \
            file://0001-create_empty_library-Use-CC-variable-intead-of-hardc.patch \
            file://0001-immom_python-convert-to-python3.patch \
            file://0001-Fix-build-with-fno-common.patch \
+           file://0001-Use-correct-printf-format-for-__fsblkcnt_t.patch \
            "
 SRC_URI[md5sum] = "02cfe732d194339237da6adce8e54384"
 SRC_URI[sha256sum] = "84268b90dc48a6675e5a77e2b20390a04bb59deb48a829102a9dbc4b9ac27483"
Signature · 1 line
2.29.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 2 lines · Khem Raj
Quoted 15 lines
---
 ...rrect-printf-format-for-__fsblkcnt_t.patch | 36 +++++++++++++++++++
 .../opensaf/opensaf_5.20.08.bb                |  1 +
 2 files changed, 37 insertions(+)
 create mode 100644 meta-networking/recipes-daemons/opensaf/opensaf/0001-Use-correct-printf-format-for-__fsblkcnt_t.patch
meta-networking/recipes-daemons/opensaf/opensaf/0001-Use-correct-printf-format-for-__fsblkcnt_t.patch new file +3 -0
new file mode 100644
index 0000000000..0e113f533f
@@ -0,0 +1,36 @@
+From 90f81c1fb3e560cfc99ee7ab9a48a1736e3929cd Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Sun, 15 Nov 2020 13:22:31 -0800

meta-networking/recipes-daemons/opensaf/opensaf/0001-Use-correct-printf-format-for-__fsblkcnt_t.patch line 13

Quoted 10 lines
meta-networking/recipes-daemons/opensaf/opensaf/0001-Use-correct-printf-format-for-__fsblkcnt_t.patch new file +10 -0
+Subject: [PATCH] Use correct printf format for __fsblkcnt_t
+
+This depends on time_t size and on some 32bit architectures e.g. riscv32
+this would be a 64bit value
+
+Fixes
+os_defs.c:920:40: error: format '%ld' expects argument of type 'long int', but argument 3 has type '__fsblkcnt_t' {aka 'long long unsigned int'} [-Werror=format=]
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>

Can you make sure this is sent upstream?

Alistair

Quoted 41 lines
meta-networking/recipes-daemons/opensaf/opensaf/0001-Use-correct-printf-format-for-__fsblkcnt_t.patch new file +23 -0
+---
+ src/base/os_defs.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/base/os_defs.c b/src/base/os_defs.c
+index 83458c2..655c190 100644
+--- a/src/base/os_defs.c
++++ b/src/base/os_defs.c
+@@ -917,7 +917,11 @@ uint32_t ncs_os_posix_shm(NCS_OS_POSIX_SHM_REQ_INFO *req)
+                           ((statsvfs.f_bfree - 1) * statsvfs.f_frsize)) {
+                               syslog(
+                                   LOG_ERR,
++#if __TIMESIZE == 64 && __WORDSIZE == 32
++                                  "Insufficient shared memory (%lld) to write the data of size: %" PRId64
++#else
+                                   "Insufficient shared memory (%ld) to write the data of size: %" PRId64
++#endif
+                                   "\n",
+                                   (statsvfs.f_bfree * statsvfs.f_frsize),
+                                   req->info.write.i_write_size);
+--
+2.29.2
+
meta-networking/recipes-daemons/opensaf/opensaf_5.20.08.bb +1 -1
index 7c7051eff3..5516fc43ae 100644
@@ -27,6 +27,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/releases/${BPN}-${PV}.tar.gz \
            file://0001-create_empty_library-Use-CC-variable-intead-of-hardc.patch \
            file://0001-immom_python-convert-to-python3.patch \
            file://0001-Fix-build-with-fno-common.patch \
+           file://0001-Use-correct-printf-format-for-__fsblkcnt_t.patch \
            "
 SRC_URI[md5sum] = "02cfe732d194339237da6adce8e54384"
 SRC_URI[sha256sum] = "84268b90dc48a6675e5a77e2b20390a04bb59deb48a829102a9dbc4b9ac27483"
--

2.29.2