Files
Jens Axboe a61036ac8f test: get rid of x86_64'isms in the test code
Most/all of these are from syzbot. Turn them into regular system calls,
and just let liburing sort out the non-x86 ones.

Fixes: https://github.com/axboe/liburing/issues/322
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2021-03-31 13:23:56 -06:00

59 lines
833 B
C

/* SPDX-License-Identifier: MIT */
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <errno.h>
#include "liburing.h"
static void loop(void)
{
int i, ret = 0;
for (i = 0; i < 100; i++) {
struct io_uring ring;
int fd;
memset(&ring, 0, sizeof(ring));
fd = io_uring_queue_init(0xa4, &ring, 0);
if (fd >= 0) {
close(fd);
continue;
}
if (fd != -ENOMEM)
ret++;
}
exit(ret);
}
int main(int argc, char *argv[])
{
int i, ret, status;
if (argc > 1)
return 0;
for (i = 0; i < 12; i++) {
if (!fork()) {
loop();
break;
}
}
ret = 0;
for (i = 0; i < 12; i++) {
if (waitpid(-1, &status, 0) < 0) {
perror("waitpid");
return 1;
}
if (WEXITSTATUS(status))
ret++;
}
return ret;
}