/* $Id: aplay-rt.c 1103 2006-11-18 22:02:03Z flaterco $ */ /* Run aplay with realtime priority. */ /* This has to be suid root to work. */ /* gcc -O2 -Wall -Wextra -pedantic -s -o aplay-rt aplay-rt.c */ /* chown root. aplay-rt */ /* chmod 4755 aplay-rt */ #include #include #include #include #include int main (int argc, char **argv) { struct sched_param sp; sp.sched_priority = sched_get_priority_max(SCHED_FIFO); if (sched_setscheduler (0, SCHED_FIFO, &sp)) fprintf (stderr, "Can't set realtime priority; must be suid root.\n"); else { setuid (getuid()); /* Drop root */ execv ("/usr/bin/aplay", argv); perror ("/usr/bin/aplay"); } exit (-1); }