/* RT user. Copyright (c) 2002 Roger Larsson This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. 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. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Thanks to autor of KSysGuard Chris Schlaeger for borrowed code... */ #include #include #include #include #include struct request { pid_t pid; char _filler[32]; }; int main(int argc, char *argv[]) { struct request request; FILE *reqf; reqf = fopen("/var/named/rt-request", "w"); if (reqf == NULL) { perror("fopen"); return errno; } printf("policy %d\n", sched_getscheduler(0)); request.pid = getpid(); fwrite(&request, 32, 1, reqf); fclose(reqf); // important! printf("policy %d\n", sched_getscheduler(0)); while (sched_getscheduler(0) == 0) { putchar('.'); sleep(1); } printf("\npolicy %d\n", sched_getscheduler(0)); // well behaved sleep(5); while (sched_getscheduler(0) != 0) { // someone did listen to my request... // assume monitor is running } return 0; }