aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2013-01-11 04:17:10 -0500
committerBjoern Brandenburg <bbb@mpi-sws.org>2013-01-11 04:24:18 -0500
commit642049ba7d30b24fb9927a22d44d6b84139668dc (patch)
treeeaa73b8f77c949b1a56ab0271bda5be7b3746725 /bin
parentd427bf8561f488bfec36b14b02af5b8ca0b2782f (diff)
Make release_ts a bit more userfriendly
The -f option required manually *also* setting the -w option. This is no longer required. While at it, simplify the code by using the /proc interface.
Diffstat (limited to 'bin')
-rw-r--r--bin/release_ts.c28
1 files changed, 4 insertions, 24 deletions
diff --git a/bin/release_ts.c b/bin/release_ts.c
index 7752097..c2f6d4c 100644
--- a/bin/release_ts.c
+++ b/bin/release_ts.c
@@ -31,35 +31,14 @@ void usage(char *error) {
31void wait_until_ready(int expected) 31void wait_until_ready(int expected)
32{ 32{
33 int ready = 0, all = 0; 33 int ready = 0, all = 0;
34 char buf[100];
35 int loops = 0; 34 int loops = 0;
36 ssize_t len;
37
38 35
39 do { 36 do {
40 if (loops++ > 0) 37 if (loops++ > 0)
41 sleep(1); 38 sleep(1);
42 len = read_file(LITMUS_STATS_FILE, buf, sizeof(buf) - 1); 39 if (!read_litmus_stats(&ready, &all))
43 if (len < 0) { 40 perror("read_litmus_stats");
44 fprintf(stderr, 41 } while (expected > ready || (!expected && ready < all));
45 "(EE) Error while reading '%s': %m.\n"
46 "(EE) Ignoring -w option.\n",
47 LITMUS_STATS_FILE);
48 break;
49 } else {
50 len = sscanf(buf,
51 "real-time tasks = %d\n"
52 "ready for release = %d\n",
53 &all, &ready);
54 if (len != 2) {
55 fprintf(stderr,
56 "(EE) Could not parse '%s'.\n"
57 "(EE) Ignoring -w option.\n",
58 LITMUS_STATS_FILE);
59 break;
60 }
61 }
62 } while (expected > ready || ready < all);
63} 42}
64 43
65int main(int argc, char** argv) 44int main(int argc, char** argv)
@@ -79,6 +58,7 @@ int main(int argc, char** argv)
79 wait = 1; 58 wait = 1;
80 break; 59 break;
81 case 'f': 60 case 'f':
61 wait = 1;
82 expected = atoi(optarg); 62 expected = atoi(optarg);
83 break; 63 break;
84 case ':': 64 case ':':