1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * Copyright (c) 2014 Fujitsu Ltd. 4 * Zeng Linggang <zenglg.jy@cn.fujitsu.com> 5 * Copyright (C) 2023 SUSE LLC Andrea Cervesato <andrea.cervesato@suse.com> 6 */ 7/*\ 8 * [Description] 9 * 10 * This test verifies that: 11 * - clockid argument is neither CLOCK_MONOTONIC nor CLOCK_REALTIME, 12 * EINVAL would return. 13 * - flags is invalid, EINVAL would return. 14 */ 15 16#include <errno.h> 17 18#include "tst_test.h" 19#include "tst_safe_timerfd.h" 20 21static struct test_case_t { 22 int clockid; 23 int flags; 24 int exp_errno; 25} tcases[] = { 26 { -1, 0, EINVAL }, 27 { 0, -1, EINVAL }, 28}; 29 30static void run(unsigned int i) 31{ 32 struct test_case_t *test = &tcases[i]; 33 34 TST_EXP_FAIL(timerfd_create(test->clockid, test->flags), test->exp_errno); 35} 36 37static struct tst_test test = { 38 .test = run, 39 .tcnt = ARRAY_SIZE(tcases), 40}; 41