1 /*
2  *  This program is free software; you can redistribute it and/or modify
3  *  it under the terms of the GNU General Public License version 2.
4  *
5  *  This program is distributed in the hope that it will be useful,
6  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
7  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
8  *  GNU General Public License for more details.
9  *
10  *
11  * Test if sched_getparam() sets errno == EFAULT or EINVAL if param points to
12  * NULL.
13  *
14  * This behavior is not specified in the specs, so this test is speculative.
15  */
16 
17 #include <stdio.h>
18 #include <sched.h>
19 #include <errno.h>
20 #include "posixtest.h"
21 
main(void)22 int main(void)
23 {
24 	int result = -1;
25 
26 	result = sched_getparam(0, NULL);
27 
28 	if (result == -1 && errno == EFAULT) {
29 		printf("sched_getparam() sets errno == EFAULT "
30 		       "when param argument points to NULL\n");
31 		return PTS_PASS;
32 	}
33 	if (result == -1 && errno == EINVAL) {
34 		printf("sched_getparam() sets errno == EINVAL "
35 		       "when param argument points to NULL\n");
36 		return PTS_PASS;
37 	}
38 
39 	printf("sched_getparam() return %i and sets errno == %i.\n",
40 	       result, errno);
41 	return PTS_UNRESOLVED;
42 }
43