aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2012-08-14 14:29:17 -0400
committerBjoern Brandenburg <bbb@mpi-sws.org>2012-08-14 14:46:16 -0400
commitf215a05c0ea23c7779b1a3a4361b4d88ddc73dc1 (patch)
tree8d105f8894c1a3f52ae88561faa6e866218fcf10 /bin
parenta72371ea7d7b13bf0126b4636a7cba9e03ea12b8 (diff)
Implement get_nr_ts_release_waiters() /proc wrapper
Add a wrapper for /proc/litmus/stats to make it easy to query the number of tasks already waiting for a task set release.
Diffstat (limited to 'bin')
-rw-r--r--bin/release_ts.c20
1 files changed, 1 insertions, 19 deletions
diff --git a/bin/release_ts.c b/bin/release_ts.c
index 9740df2..7752097 100644
--- a/bin/release_ts.c
+++ b/bin/release_ts.c
@@ -7,6 +7,7 @@
7#include <fcntl.h> 7#include <fcntl.h>
8 8
9#include "litmus.h" 9#include "litmus.h"
10#include "internal.h"
10 11
11#define OPTSTR "d:wf:" 12#define OPTSTR "d:wf:"
12#define NS_PER_MS 1000000 13#define NS_PER_MS 1000000
@@ -27,25 +28,6 @@ void usage(char *error) {
27 exit(1); 28 exit(1);
28} 29}
29 30
30ssize_t read_file(const char* fname, void* buf, size_t maxlen)
31{
32 int fd;
33 ssize_t n = 0;
34 size_t got = 0;
35
36 fd = open(fname, O_RDONLY);
37 if (fd == -1)
38 return -1;
39
40 while (got < maxlen && (n = read(fd, buf + got, maxlen - got)) > 0)
41 got += n;
42 close(fd);
43 if (n < 0)
44 return -1;
45 else
46 return got;
47}
48
49void wait_until_ready(int expected) 31void wait_until_ready(int expected)
50{ 32{
51 int ready = 0, all = 0; 33 int ready = 0, all = 0;