Whamcloud - gitweb
LU-15399 llite: dont restart directIO with IOCB_NOWAIT
[fs/lustre-release.git] / lustre / tests / io_uring_probe.c
1 /*
2  * LGPL HEADER START
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * All rights reserved. This program and the accompanying materials
7  * are made available under the terms of the GNU Lesser General Public License
8  * (LGPL) version 2.1 or (at your discretion) any later version.
9  * (LGPL) version 2.1 accompanies this distribution, and is available at
10  * http://www.gnu.org/licenses/lgpl-2.1.html
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * LGPL HEADER END
18  */
19 /*
20  * Copyright (c) 2022, DDN/Whamcloud Storage Corporation.
21  */
22 /*
23  * This file is part of Lustre, http://www.lustre.org/
24  */
25 /*
26  * Probe whether OS supports io_uring.
27  *
28  * Author: Qian Yingjin <qian@ddn.com>
29  */
30
31 #include <errno.h>
32 #include <stddef.h>
33 #include <unistd.h>
34 #include <stdio.h>
35 #include <string.h>
36 #include <sys/syscall.h>
37
38 #ifdef __NR_io_uring_register
39 #include <linux/io_uring.h>
40
41 int main(int argc, char **argv)
42 {
43         int rc;
44
45         rc = syscall(__NR_io_uring_register, 0, IORING_UNREGISTER_BUFFERS,
46                      NULL, 0);
47         if (rc < 0 && errno == ENOSYS) {
48                 printf("Your kernel does not support io_uring");
49                 return -ENOSYS;
50         }
51         return 0;
52 }
53 #else
54 int main(int argc, char **argv)
55 {
56         return -ENOSYS;
57 }
58 #endif