1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved.
4 * Author: Xie Ziyao <[email protected]>
5 */
6
7 /*\
8 * [Description]
9 *
10 * Verify that epoll_create1 returns -1 and set errno to EINVAL with an invalid
11 * value specified in flags.
12 */
13
14 #include <sys/epoll.h>
15
16 #include "tst_test.h"
17 #include "lapi/epoll.h"
18 #include "lapi/syscalls.h"
19
20 static struct test_case_t {
21 int flags;
22 int exp_err;
23 const char *desc;
24 } tc[] = {
25 {-1, EINVAL, "-1"},
26 {EPOLL_CLOEXEC + 1, EINVAL, "EPOLL_CLOEXEC+1"}
27 };
28
run(unsigned int n)29 static void run(unsigned int n)
30 {
31 TST_EXP_FAIL(tst_syscall(__NR_epoll_create1, tc[n].flags),
32 tc[n].exp_err, "epoll_create1(%s)", tc[n].desc);
33 }
34
35 static struct tst_test test = {
36 .tcnt = ARRAY_SIZE(tc),
37 .test = run,
38 };
39