• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Copyright (c) Linux Test Project, 2021
4  * Author: Xie Ziyao <ziyaoxie@outlook.com>
5  */
6 
7 /*\
8  * [Description]
9  *
10  * Verify that epoll_create returns -1 and set errno to EINVAL if size is not
11  * greater than zero.
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 #include "epoll_create.h"
21 
22 static struct test_case_t {
23 	int size;
24 	int exp_err;
25 } tc[] = {
26 	{0, EINVAL},
27 	{-1, EINVAL}
28 };
29 
run(unsigned int n)30 static void run(unsigned int n)
31 {
32 	TST_EXP_FAIL(do_epoll_create(tc[n].size),
33 		     tc[n].exp_err, "epoll_create(%d)", tc[n].size);
34 }
35 
36 static struct tst_test test = {
37 	.test_variants = 2,
38 	.tcnt = ARRAY_SIZE(tc),
39 	.setup = variant_info,
40 	.test = run,
41 };
42