aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/liburing/test/ring-leak.c
diff options
context:
space:
mode:
authorthegeorg <thegeorg@yandex-team.com>2024-06-09 11:55:21 +0300
committerthegeorg <thegeorg@yandex-team.com>2024-06-09 12:07:55 +0300
commitafd4899380eea1c70e2a68714b5da1c9919ccdbd (patch)
treecd5120708784139bc6a0f8881da1ed8389a065b3 /contrib/libs/liburing/test/ring-leak.c
parenta83bd2dd3c21e38c6c0807ec5e679497ab567f24 (diff)
downloadydb-afd4899380eea1c70e2a68714b5da1c9919ccdbd.tar.gz
Update contrib/libs/liburing to 2.6
3b51a9fb14de805208d11f1c077c78bb5d487e0f
Diffstat (limited to 'contrib/libs/liburing/test/ring-leak.c')
-rw-r--r--contrib/libs/liburing/test/ring-leak.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/contrib/libs/liburing/test/ring-leak.c b/contrib/libs/liburing/test/ring-leak.c
index e052802314..6b8237fdc4 100644
--- a/contrib/libs/liburing/test/ring-leak.c
+++ b/contrib/libs/liburing/test/ring-leak.c
@@ -24,6 +24,7 @@
#include <linux/fs.h>
#include "liburing.h"
+#include "helpers.h"
#include "../src/syscall.h"
static int __io_uring_register_files(int ring_fd, int fd1, int fd2)
@@ -49,7 +50,7 @@ static int get_ring_fd(void)
return fd;
}
-static void send_fd(int socket, int fd)
+static int send_fd(int socket, int fd)
{
char buf[CMSG_SPACE(sizeof(fd))];
struct cmsghdr *cmsg;
@@ -70,8 +71,14 @@ static void send_fd(int socket, int fd)
msg.msg_controllen = CMSG_SPACE(sizeof(fd));
- if (sendmsg(socket, &msg, 0) < 0)
+ if (sendmsg(socket, &msg, 0) < 0) {
+ if (errno == EINVAL)
+ return T_EXIT_SKIP;
perror("sendmsg");
+ return T_EXIT_FAIL;
+ }
+
+ return T_EXIT_PASS;
}
static int test_iowq_request_cancel(void)
@@ -167,7 +174,9 @@ static int test_scm_cycles(bool update)
perror("pipe");
return -1;
}
- send_fd(sp[0], ring.ring_fd);
+ ret = send_fd(sp[0], ring.ring_fd);
+ if (ret != T_EXIT_PASS)
+ return ret;
/* register an empty set for updates */
if (update) {
@@ -237,6 +246,8 @@ int main(int argc, char *argv[])
bool update = !!(i & 1);
ret = test_scm_cycles(update);
+ if (ret == T_EXIT_SKIP)
+ return T_EXIT_SKIP;
if (ret) {
fprintf(stderr, "test_scm_cycles() failed %i\n",
update);
@@ -260,8 +271,11 @@ int main(int argc, char *argv[])
}
pid = fork();
- if (pid)
- send_fd(sp[0], ring_fd);
+ if (pid) {
+ ret = send_fd(sp[0], ring_fd);
+ if (ret != T_EXIT_PASS)
+ return ret;
+ }
close(ring_fd);
close(sp[0]);