1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* Test that the scheduling parameters are returned for the calling process
* when pid = 0.
*/
#include <stdio.h>
#include <sched.h>
#include <errno.h>
#include <unistd.h>
#include "posixtest.h"
int main(int argc, char **argv)
{
struct sched_param param0;
struct sched_param param1;
int result0;
int result1;
param0.sched_priority = -1;
param1.sched_priority = -1;
result0 = sched_getparam(0, ¶m0);
result1 = sched_getparam(getpid(), ¶m1);
if(result0 == result1 &&
param0.sched_priority == param1.sched_priority &&
errno == 0) {
printf("Test PASSED\n");
return PTS_PASS;
} else {
printf("Different results between pid == 0 and pid == getpid().\n");
return PTS_FAIL;
}
printf("This code should not be executed.\n");
return PTS_UNRESOLVED;
}
|