Merge branch 'fix-type-manpage' of https://github.com/goldsteinn/liburing
* 'fix-type-manpage' of https://github.com/goldsteinn/liburing:
man/io_uring.7: Fix typo
diff --git a/man/io_uring.7 b/man/io_uring.7
index d371afb..a63b3e9 100644
--- a/man/io_uring.7
+++ b/man/io_uring.7
@@ -637,7 +637,7 @@
/* Get the entry */
cqe = &cqes[head & (*cring_mask)];
if (cqe->res < 0)
- fprintf(stderr, "Error: %s\n", strerror(abs(cqe->res)));
+ fprintf(stderr, "Error: %s\\n", strerror(abs(cqe->res)));
head++;
@@ -698,7 +698,7 @@
/* Setup io_uring for use */
if(app_setup_uring()) {
- fprintf(stderr, "Unable to setup uring!\n");
+ fprintf(stderr, "Unable to setup uring!\\n");
return 1;
}
@@ -721,7 +721,7 @@
}
else if (res < 0) {
/* Error reading file */
- fprintf(stderr, "Error: %s\n", strerror(abs(res)));
+ fprintf(stderr, "Error: %s\\n", strerror(abs(res)));
break;
}
offset += res;
diff --git a/src/include/liburing.h b/src/include/liburing.h
index ebfc424..520cd55 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -15,6 +15,14 @@
#include "liburing/io_uring.h"
#include "liburing/barrier.h"
+#ifndef uring_unlikely
+# define uring_unlikely(cond) __builtin_expect(!!(cond), 0)
+#endif
+
+#ifndef uring_likely
+# define uring_likely(cond) __builtin_expect(!!(cond), 1)
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/src/queue.c b/src/queue.c
index df388f6..8c4f373 100644
--- a/src/queue.c
+++ b/src/queue.c
@@ -25,10 +25,11 @@
{
if (!(ring->flags & IORING_SETUP_SQPOLL))
return true;
- if (IO_URING_READ_ONCE(*ring->sq.kflags) & IORING_SQ_NEED_WAKEUP) {
- *flags |= IORING_ENTER_SQ_WAKEUP;
- return true;
- }
+ if (uring_unlikely(IO_URING_READ_ONCE(*ring->sq.kflags) &
+ IORING_SQ_NEED_WAKEUP)) {
+ *flags |= IORING_ENTER_SQ_WAKEUP;
+ return true;
+ }
return false;
}