1f08c3bdfSopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later
2f08c3bdfSopenharmony_ci/*
3f08c3bdfSopenharmony_ci * Copyright (c) Crackerjack Project., 2007
4f08c3bdfSopenharmony_ci * Ported from Crackerjack to LTP by Masatake YAMATO <yamato@redhat.com>
5f08c3bdfSopenharmony_ci * Copyright (c) 2011 Cyril Hrubis <chrubis@suse.cz>
6f08c3bdfSopenharmony_ci */
7f08c3bdfSopenharmony_ci
8f08c3bdfSopenharmony_ci/*\
9f08c3bdfSopenharmony_ci * [Description]
10f08c3bdfSopenharmony_ci *
11f08c3bdfSopenharmony_ci * Test io_getevents invoked via syscall(2) with invalid ctx and expects it to
12f08c3bdfSopenharmony_ci * return EINVAL.
13f08c3bdfSopenharmony_ci */
14f08c3bdfSopenharmony_ci
15f08c3bdfSopenharmony_ci#include <linux/aio_abi.h>
16f08c3bdfSopenharmony_ci
17f08c3bdfSopenharmony_ci#include "config.h"
18f08c3bdfSopenharmony_ci#include "tst_test.h"
19f08c3bdfSopenharmony_ci#include "lapi/syscalls.h"
20f08c3bdfSopenharmony_ci
21f08c3bdfSopenharmony_cistatic void run(void)
22f08c3bdfSopenharmony_ci{
23f08c3bdfSopenharmony_ci	aio_context_t ctx;
24f08c3bdfSopenharmony_ci
25f08c3bdfSopenharmony_ci	memset(&ctx, 0, sizeof(ctx));
26f08c3bdfSopenharmony_ci	TST_EXP_FAIL2(tst_syscall(__NR_io_getevents, ctx, 0, 0, NULL, NULL), EINVAL,
27f08c3bdfSopenharmony_ci		"io_getevents syscall with invalid ctx");
28f08c3bdfSopenharmony_ci}
29f08c3bdfSopenharmony_ci
30f08c3bdfSopenharmony_cistatic struct tst_test test = {
31f08c3bdfSopenharmony_ci	.needs_kconfigs = (const char *[]) {
32f08c3bdfSopenharmony_ci		"CONFIG_AIO=y",
33f08c3bdfSopenharmony_ci		NULL
34f08c3bdfSopenharmony_ci	},
35f08c3bdfSopenharmony_ci	.test_all = run,
36f08c3bdfSopenharmony_ci};
37