#include #include #include #include int main(int argc, char *argv[]) { int uid = getuid(); int pid = atoi(argv[1]); int sched_fifo_min, sched_fifo_max; static struct sched_param sched_parms; if (!pid) pid = getpid(); sched_fifo_min = sched_get_priority_min(SCHED_FIFO); sched_fifo_max = sched_get_priority_max(SCHED_FIFO); sched_parms.sched_priority = sched_fifo_min + 1; if (sched_setscheduler(pid, SCHED_FIFO, &sched_parms) == -1) perror("cannot set realtime scheduling policy"); if (uid) setuid(uid); if (pid == getpid()) execvp(argv[1],&argv[1]); return 0; }