diff mbox series

[3/4] package/fluent-bit: fix wasm uClibc support

Message ID 20230327141058.3669326-3-thomas.devoogdt@barco.com
State Superseded, archived
Headers show
Series [1/4] package/fluent-bit: bump to version 2.0.10 | expand

Commit Message

Thomas Devoogdt March 27, 2023, 2:10 p.m. UTC
Upstream:

https://github.com/bytecodealliance/wasm-micro-runtime/pull/2069

Signed-off-by: Thomas Devoogdt <thomas.devoogdt@barco.com>
---
 ...b-wasm-fix-POLL-RD-WR-NORM-in-uClibc.patch | 47 +++++++++++++++++++
 1 file changed, 47 insertions(+)
 create mode 100644 package/fluent-bit/0004-lib-wasm-fix-POLL-RD-WR-NORM-in-uClibc.patch
diff mbox series

Patch

diff --git a/package/fluent-bit/0004-lib-wasm-fix-POLL-RD-WR-NORM-in-uClibc.patch b/package/fluent-bit/0004-lib-wasm-fix-POLL-RD-WR-NORM-in-uClibc.patch
new file mode 100644
index 0000000000..91a6b8adc2
--- /dev/null
+++ b/package/fluent-bit/0004-lib-wasm-fix-POLL-RD-WR-NORM-in-uClibc.patch
@@ -0,0 +1,47 @@ 
+From 286a59000d05969d00d908f187bc311a4f5b2a52 Mon Sep 17 00:00:00 2001
+From: Thomas Devoogdt <thomas.devoogdt@barco.com>
+Date: Mon, 27 Mar 2023 15:01:49 +0200
+Subject: [PATCH] lib: wasm: fix POLL{RD,WR}NORM in uClibc
+
+Not defined in uClibc, so replace them with the equivalent POLL{OUT,IN}.
+
+https://www.man7.org/linux/man-pages/man2/poll.2.html
+
+       POLLWRNORM
+              Equivalent to POLLOUT.
+
+       POLLRDNORM
+              Equivalent to POLLIN.
+
+Signed-off-by: Thomas Devoogdt <thomas.devoogdt@barco.com>
+---
+ .../libc-wasi/sandboxed-system-primitives/src/posix.c       | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/lib/wasm-micro-runtime-WAMR-1.1.1/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c b/lib/wasm-micro-runtime-WAMR-1.1.1/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c
+index e43ba8ce0..b0e92c3a8 100644
+--- a/lib/wasm-micro-runtime-WAMR-1.1.1/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c
++++ b/lib/wasm-micro-runtime-WAMR-1.1.1/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c
+@@ -2644,8 +2644,8 @@ wasmtime_ssp_poll_oneoff(
+                     pfds[i] = (struct pollfd){
+                         .fd = fd_number(fos[i]),
+                         .events = s->u.type == __WASI_EVENTTYPE_FD_READ
+-                                      ? POLLRDNORM
+-                                      : POLLWRNORM,
++                                      ? POLLIN
++                                      : POLLOUT,
+                     };
+                 }
+                 else {
+@@ -2756,7 +2756,7 @@ wasmtime_ssp_poll_oneoff(
+                             __WASI_EVENT_FD_READWRITE_HANGUP,
+                     };
+                 }
+-                else if ((pfds[i].revents & (POLLRDNORM | POLLWRNORM)) != 0) {
++                else if ((pfds[i].revents & (POLLIN | POLLOUT)) != 0) {
+                     // Read or write possible.
+                     out[(*nevents)++] = (__wasi_event_t){
+                         .userdata = in[i].userdata,
+-- 
+2.34.1
+