Home | History | Annotate | Download | only in sched_getparam
      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 that the scheduling parameters are returned for the calling process
     12  * when pid = 0.
     13  */
     14 #include <stdio.h>
     15 #include <sched.h>
     16 #include <errno.h>
     17 #include <unistd.h>
     18 #include "posixtest.h"
     19 
     20 int main(void)
     21 {
     22 
     23 	struct sched_param param0;
     24 	struct sched_param param1;
     25 	int result0;
     26 	int result1;
     27 
     28 	param0.sched_priority = -1;
     29 	param1.sched_priority = -1;
     30 
     31 	result0 = sched_getparam(0, &param0);
     32 	result1 = sched_getparam(getpid(), &param1);
     33 
     34 	if (result0 == result1 &&
     35 	    param0.sched_priority == param1.sched_priority && errno == 0) {
     36 		printf("Test PASSED\n");
     37 		return PTS_PASS;
     38 	}
     39 
     40 	printf("Different results between pid == 0 "
     41 	       "and pid == getpid().\n");
     42 	return PTS_FAIL;
     43 }
     44