• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Copyright (c) 2014 Fujitsu Ltd.
4  *   Author: Zeng Linggang <zenglg.jy@cn.fujitsu.com>
5  * Copyright (C) 2023 SUSE LLC Andrea Cervesato <andrea.cervesato@suse.com>
6  */
7 
8 /*\
9  * [Description]
10  *
11  * This test verifies that mq_notify() fails with EINVAL when invalid input
12  * arguments are given.
13  */
14 
15 #include <mqueue.h>
16 #include "tst_test.h"
17 
18 static struct test_case_t {
19 	struct sigevent sevp;
20 	int exp_errno;
21 } tcase[] = {
22 	{{.sigev_notify = -1}, EINVAL},
23 	{{.sigev_notify = SIGEV_SIGNAL, .sigev_signo = _NSIG + 1}, EINVAL},
24 };
25 
run(unsigned int i)26 static void run(unsigned int i)
27 {
28 	struct test_case_t *test = &tcase[i];
29 
30 	TST_EXP_FAIL(mq_notify(0, &(test->sevp)), test->exp_errno);
31 }
32 
33 static struct tst_test test = {
34 	.tcnt = ARRAY_SIZE(tcase),
35 	.test = run,
36 };
37