1f08c3bdfSopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later 2f08c3bdfSopenharmony_ci/* 3f08c3bdfSopenharmony_ci * Copyright (c) Linux Test Project, 2021 4f08c3bdfSopenharmony_ci * Author: Xie Ziyao <ziyaoxie@outlook.com> 5f08c3bdfSopenharmony_ci */ 6f08c3bdfSopenharmony_ci 7f08c3bdfSopenharmony_ci/*\ 8f08c3bdfSopenharmony_ci * [Description] 9f08c3bdfSopenharmony_ci * 10f08c3bdfSopenharmony_ci * Verify that epoll_create return a nonnegative file descriptor on success. 11f08c3bdfSopenharmony_ci * 12f08c3bdfSopenharmony_ci * The size argument informed the kernel of the number of file descriptors 13f08c3bdfSopenharmony_ci * that the caller expected to add to the epoll instance, but it is no longer 14f08c3bdfSopenharmony_ci * required. 15f08c3bdfSopenharmony_ci */ 16f08c3bdfSopenharmony_ci 17f08c3bdfSopenharmony_ci#include <sys/epoll.h> 18f08c3bdfSopenharmony_ci#include "tst_test.h" 19f08c3bdfSopenharmony_ci#include "lapi/epoll.h" 20f08c3bdfSopenharmony_ci#include "lapi/syscalls.h" 21f08c3bdfSopenharmony_ci#include "epoll_create.h" 22f08c3bdfSopenharmony_ci 23f08c3bdfSopenharmony_cistatic int tc[] = {1, INT_MAX}; 24f08c3bdfSopenharmony_ci 25f08c3bdfSopenharmony_cistatic void run(unsigned int n) 26f08c3bdfSopenharmony_ci{ 27f08c3bdfSopenharmony_ci TST_EXP_FD(do_epoll_create(tc[n]), "epoll_create(%d)", tc[n]); 28f08c3bdfSopenharmony_ci 29f08c3bdfSopenharmony_ci if (!TST_PASS) 30f08c3bdfSopenharmony_ci return; 31f08c3bdfSopenharmony_ci SAFE_CLOSE(TST_RET); 32f08c3bdfSopenharmony_ci} 33f08c3bdfSopenharmony_ci 34f08c3bdfSopenharmony_cistatic struct tst_test test = { 35f08c3bdfSopenharmony_ci .test_variants = EPOLL_CREATE_VARIANTS, 36f08c3bdfSopenharmony_ci .tcnt = ARRAY_SIZE(tc), 37f08c3bdfSopenharmony_ci .setup = variant_info, 38f08c3bdfSopenharmony_ci .test = run, 39f08c3bdfSopenharmony_ci}; 40