aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/util.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2011-01-04 02:10:28 -0500
committerIngo Molnar <mingo@elte.hu>2011-01-04 02:10:28 -0500
commit928585536ff5a8f320e60efc60e2b7ef2a5f548d (patch)
tree5b12281a00ec049e8c35f1fb2810e111b22c90c0 /tools/perf/util/util.c
parentcc2221969906a166a638aecdbae84a3d0462719e (diff)
parentd854861c4292a4e675a5d3bfd862c5f7421c81e8 (diff)
Merge branch 'perf/test' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux-2.6 into perf/core
Diffstat (limited to 'tools/perf/util/util.c')
-rw-r--r--tools/perf/util/util.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index 214265674ddd..5b3ea49aa63e 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -114,3 +114,20 @@ unsigned long convert_unit(unsigned long value, char *unit)
114 114
115 return value; 115 return value;
116} 116}
117
118int readn(int fd, void *buf, size_t n)
119{
120 void *buf_start = buf;
121
122 while (n) {
123 int ret = read(fd, buf, n);
124
125 if (ret <= 0)
126 return ret;
127
128 n -= ret;
129 buf += ret;
130 }
131
132 return buf - buf_start;
133}