blob: 510da70ef41e5cdbf5ae2cef995fbf78543982be (
plain) (
blame)
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
|
#include <stdio.h>
#include <strings.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "litmus.h"
void die(const char* str)
{
fprintf(stderr, "%s\n%s\n", str,
"Usage: set_rt_mode [-v] {on|off}");
exit(127);
}
int main(int argc, char** argv)
{
int ret;
int verbose = 0;
char* cmd = argv[1];
if (argc == 3 && !strcmp(argv[1], "-v")) {
verbose = 1;
cmd = argv[2];
}
if (argc == 2 || verbose) {
if (!strcmp(cmd, "on")) {
if (verbose)
printf("Enabling real-time mode.\n");
ret = set_rt_mode(MODE_RT_RUN);
if (ret && verbose)
perror("set_rt_mode failed");
exit(ret ? errno : 0);
} else if (!strcmp(cmd, "off")) {
if (verbose)
printf("Disabling real-time mode.\n");
ret = set_rt_mode(MODE_NON_RT);
if (ret && verbose)
perror("set_rt_mode failed");
exit(ret ? errno : 0);
}
}
die("Bad arguments.");
return 0;
}
|