Home | History | Annotate | Download | only in speculative
      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_rr_get_interval() sets errno == EFAULT or EINVAL if *interval
     12  * points to 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 <time.h>
     21 #include "posixtest.h"
     22 
     23 int main(void)
     24 {
     25 	int result = -2;
     26 
     27 	result = sched_rr_get_interval(0, NULL);
     28 
     29 	if (result == -1 && errno == EFAULT) {
     30 		printf
     31 		    ("sched_rr_get_interval() sets errno == EFAULT when interval argument points to NULL\n");
     32 		return PTS_PASS;
     33 	}
     34 	if (result == -1 && errno == EINVAL) {
     35 		printf
     36 		    ("sched_rr_get_interval() sets errno == EINVAL when interval argument points to NULL\n");
     37 		return PTS_PASS;
     38 	}
     39 
     40 	printf("sched_rr_get_interval() return %i and sets errno == %i.\n",
     41 	       result, errno);
     42 	return PTS_UNRESOLVED;
     43 }
     44