aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/liburing/test/empty-eownerdead.c
diff options
context:
space:
mode:
authorilnaz <ilnaz@ydb.tech>2022-12-13 16:01:38 +0300
committerilnaz <ilnaz@ydb.tech>2022-12-13 16:01:38 +0300
commitf2bea70bea01921ec43846224d100f2c70dd5719 (patch)
treeeead917572063b63adc1c9a76284c8fbd10f25a3 /contrib/libs/liburing/test/empty-eownerdead.c
parent1ab9ee3dfe0ab4023a3a57bf55de31dff3eac908 (diff)
downloadydb-f2bea70bea01921ec43846224d100f2c70dd5719.tar.gz
Add cross-link
Diffstat (limited to 'contrib/libs/liburing/test/empty-eownerdead.c')
-rw-r--r--contrib/libs/liburing/test/empty-eownerdead.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/contrib/libs/liburing/test/empty-eownerdead.c b/contrib/libs/liburing/test/empty-eownerdead.c
new file mode 100644
index 0000000000..b7722ab152
--- /dev/null
+++ b/contrib/libs/liburing/test/empty-eownerdead.c
@@ -0,0 +1,46 @@
+#include "../config-host.h"
+/* SPDX-License-Identifier: MIT */
+/*
+ * Test if entering with nothing to submit/wait for SQPOLL returns an error.
+ */
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+
+#include "liburing.h"
+#include "helpers.h"
+#include "../src/syscall.h"
+
+int main(int argc, char *argv[])
+{
+ struct io_uring_params p = {};
+ struct io_uring ring;
+ int ret;
+
+ if (argc > 1)
+ return T_EXIT_SKIP;
+
+ p.flags = IORING_SETUP_SQPOLL;
+ p.sq_thread_idle = 100;
+
+ ret = t_create_ring_params(1, &ring, &p);
+ if (ret == T_SETUP_SKIP)
+ return T_EXIT_SKIP;
+ else if (ret < 0)
+ goto err;
+
+ ret = __sys_io_uring_enter(ring.ring_fd, 0, 0, 0, NULL);
+ if (ret < 0) {
+ int __e = errno;
+
+ if (__e == EOWNERDEAD)
+ fprintf(stderr, "sqe submit unexpected failure due old kernel bug: %s\n", strerror(__e));
+ else
+ fprintf(stderr, "sqe submit unexpected failure: %s\n", strerror(__e));
+ goto err;
+ }
+
+ return T_EXIT_PASS;
+err:
+ return T_EXIT_FAIL;
+}