summaryrefslogtreecommitdiffstats
path: root/tools/io_uring
diff options
context:
space:
mode:
authorJiufei Xue <jiufei.xue@linux.alibaba.com>2020-06-17 17:53:55 +0800
committerJens Axboe <axboe@kernel.dk>2020-06-21 20:44:00 -0600
commit5769a351b89cd4d82016f18fa5f6c4077403564d (patch)
tree2f700e8e397716e725661515f65ef9f146e4db5c /tools/io_uring
parent48778464bb7d346b47157d21ffde2af6b2d39110 (diff)
downloadlinux-stable-5769a351b89cd4d82016f18fa5f6c4077403564d.tar.gz
linux-stable-5769a351b89cd4d82016f18fa5f6c4077403564d.tar.bz2
linux-stable-5769a351b89cd4d82016f18fa5f6c4077403564d.zip
io_uring: change the poll type to be 32-bits
poll events should be 32-bits to cover EPOLLEXCLUSIVE. Explicit word-swap the poll32_events for big endian to make sure the ABI is not changed. We call this feature IORING_FEAT_POLL_32BITS, applications who want to use EPOLLEXCLUSIVE should check the feature bit first. Signed-off-by: Jiufei Xue <jiufei.xue@linux.alibaba.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'tools/io_uring')
-rw-r--r--tools/io_uring/liburing.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/io_uring/liburing.h b/tools/io_uring/liburing.h
index 5f305c86b892..28a837b6069d 100644
--- a/tools/io_uring/liburing.h
+++ b/tools/io_uring/liburing.h
@@ -10,6 +10,7 @@ extern "C" {
#include <string.h>
#include "../../include/uapi/linux/io_uring.h"
#include <inttypes.h>
+#include <linux/swab.h>
#include "barrier.h"
/*
@@ -145,11 +146,14 @@ static inline void io_uring_prep_write_fixed(struct io_uring_sqe *sqe, int fd,
}
static inline void io_uring_prep_poll_add(struct io_uring_sqe *sqe, int fd,
- short poll_mask)
+ unsigned poll_mask)
{
memset(sqe, 0, sizeof(*sqe));
sqe->opcode = IORING_OP_POLL_ADD;
sqe->fd = fd;
+#if __BYTE_ORDER == __BIG_ENDIAN
+ poll_mask = __swahw32(poll_mask);
+#endif
sqe->poll_events = poll_mask;
}