#include <stdio.h>
#include <linux/prctl.h>
#include <sched.h>
#include <errno.h>
#include <unistd.h>

int main(int argc, char **argv)
{
   int error;
   struct sched_param p;
   
   printf("Attempting to set CPU affinity for process %d to processor %d\n",atoi(argv[1]),atoi(argv[2]));
   error = prctl(9,atoi(argv[1]),atoi(argv[2]));
   printf("Error = %d\n",error);
   printf("sleeping\n");
   sleep(2);
   printf("Attempting to set schedular to sched_FIFO\n");
   p.sched_priority = 99;
   error = sched_setscheduler(atoi(argv[1]),SCHED_FIFO,&p);
   printf("Error = %d\n",error);
   printf("Done\n");
   return 0;
}
