Sha256: 49b21230ca60ab79701b8ad7f0bcd93643ad0349fa97c89841188a8d5ddf7a78

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

/* SPDX-License-Identifier: MIT */
/*
 * Test that we exit properly with SQPOLL and having a request that
 * adds a circular reference to the ring itself.
 */
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/time.h>
#include <poll.h>
#include "liburing.h"
#include "helpers.h"

int main(int argc, char *argv[])
{
	struct io_uring_params p = {};
	struct timeval tv;
	struct io_uring ring;
	struct io_uring_sqe *sqe;
	int ret;

	if (argc > 1)
		return 0;

	p.flags = IORING_SETUP_SQPOLL;
	p.sq_thread_idle = 100;

	ret = io_uring_queue_init_params(1, &ring, &p);
	if (ret) {
		if (geteuid()) {
			printf("%s: skipped, not root\n", argv[0]);
			return 0;
		}
		fprintf(stderr, "queue_init=%d\n", ret);
		return 1;
	}

	if (!(p.features & IORING_FEAT_SQPOLL_NONFIXED)) {
		fprintf(stdout, "Skipping\n");
		return 0;
	}

	sqe = io_uring_get_sqe(&ring);
	io_uring_prep_poll_add(sqe, ring.ring_fd, POLLIN);
	io_uring_submit(&ring);

	gettimeofday(&tv, NULL);
	do {
		usleep(1000);
	} while (mtime_since_now(&tv) < 1000);

	return 0;
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
uringmachine-0.5.1 vendor/liburing/test/sqpoll-exit-hang.c
uringmachine-0.5 vendor/liburing/test/sqpoll-exit-hang.c
uringmachine-0.4 vendor/liburing/test/sqpoll-exit-hang.c