Sha256: 1f55559c618bb409b264cb372f899418226956fdcec32a27fb7d6c718ac94d15

Contents?: true

Size: 1.14 KB

Versions: 30

Compression:

Stored size: 1.14 KB

Contents

/* SPDX-License-Identifier: MIT */
/*
 * Test double poll tty write. A test case for the regression fixed by:
 *
 * commit 6e295a664efd083ac9a5c1a8130c45be1db0cde7
 * Author: Jens Axboe <axboe@kernel.dk>
 * Date:   Tue Mar 22 13:11:28 2022 -0600
 *
 *   io_uring: fix assuming triggered poll waitqueue is the single poll
 *
 */
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>

#include "liburing.h"
#include "helpers.h"

#define	SQES	128
#define BUFSIZE	512

int main(int argc, char *argv[])
{
	static char buf[BUFSIZE];
	struct iovec vecs[SQES];
	struct io_uring ring;
	int ret, i, fd;

	if (argc > 1)
		return 0;

	fd = open("/dev/ttyS0", O_RDWR | O_NONBLOCK);
	if (fd < 0)
		return 0;

	ret = t_create_ring(SQES, &ring, 0);
	if (ret == T_SETUP_SKIP)
		return 0;
	else if (ret < 0)
		return 1;

	for (i = 0; i < SQES; i++) {
		struct io_uring_sqe *sqe;

		sqe = io_uring_get_sqe(&ring);
		vecs[i].iov_base = buf;
		vecs[i].iov_len = sizeof(buf);
		io_uring_prep_writev(sqe, fd, &vecs[i], 1, 0);
	}

	ret = io_uring_submit(&ring);
	if (ret != SQES) {
		fprintf(stderr, "submit: %d\n", ret);
		return 1;
	}

	return 0;
}

Version data entries

30 entries across 30 versions & 3 rubygems

Version Path
uringmachine-0.5.1 vendor/liburing/test/tty-write-dpoll.c
uringmachine-0.5 vendor/liburing/test/tty-write-dpoll.c
uringmachine-0.4 vendor/liburing/test/tty-write-dpoll.c
uringmachine-0.3 vendor/liburing/test/tty-write-dpoll.c
uringmachine-0.2 vendor/liburing/test/tty-write-dpoll.c
uringmachine-0.1 vendor/liburing/test/tty-write-dpoll.c
iou-0.2 vendor/liburing/test/tty-write-dpoll.c
iou-0.1 vendor/liburing/test/tty-write-dpoll.c
polyphony-1.6 vendor/liburing/test/tty-write-dpoll.c
polyphony-1.5 vendor/liburing/test/tty-write-dpoll.c
polyphony-1.4 vendor/liburing/test/tty-write-dpoll.c
polyphony-1.3 vendor/liburing/test/tty-write-dpoll.c
polyphony-1.2.1 vendor/liburing/test/tty-write-dpoll.c
polyphony-1.2 vendor/liburing/test/tty-write-dpoll.c
polyphony-1.1.1 vendor/liburing/test/tty-write-dpoll.c
polyphony-1.1 vendor/liburing/test/tty-write-dpoll.c
polyphony-1.0.2 vendor/liburing/test/tty-write-dpoll.c
polyphony-1.0.1 vendor/liburing/test/tty-write-dpoll.c
polyphony-1.0 vendor/liburing/test/tty-write-dpoll.c
polyphony-0.99.6 vendor/liburing/test/tty-write-dpoll.c