aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/session.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/session.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/session.c')
-rw-r--r--tools/perf/util/session.c22
1 files changed, 2 insertions, 20 deletions
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 0f7e544544f5..b163dfd6cbc5 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -838,23 +838,6 @@ static struct thread *perf_session__register_idle_thread(struct perf_session *se
838 return thread; 838 return thread;
839} 839}
840 840
841int do_read(int fd, void *buf, size_t size)
842{
843 void *buf_start = buf;
844
845 while (size) {
846 int ret = read(fd, buf, size);
847
848 if (ret <= 0)
849 return ret;
850
851 size -= ret;
852 buf += ret;
853 }
854
855 return buf - buf_start;
856}
857
858#define session_done() (*(volatile int *)(&session_done)) 841#define session_done() (*(volatile int *)(&session_done))
859volatile int session_done; 842volatile int session_done;
860 843
@@ -872,7 +855,7 @@ static int __perf_session__process_pipe_events(struct perf_session *self,
872 855
873 head = 0; 856 head = 0;
874more: 857more:
875 err = do_read(self->fd, &event, sizeof(struct perf_event_header)); 858 err = readn(self->fd, &event, sizeof(struct perf_event_header));
876 if (err <= 0) { 859 if (err <= 0) {
877 if (err == 0) 860 if (err == 0)
878 goto done; 861 goto done;
@@ -892,8 +875,7 @@ more:
892 p += sizeof(struct perf_event_header); 875 p += sizeof(struct perf_event_header);
893 876
894 if (size - sizeof(struct perf_event_header)) { 877 if (size - sizeof(struct perf_event_header)) {
895 err = do_read(self->fd, p, 878 err = readn(self->fd, p, size - sizeof(struct perf_event_header));
896 size - sizeof(struct perf_event_header));
897 if (err <= 0) { 879 if (err <= 0) {
898 if (err == 0) { 880 if (err == 0) {
899 pr_err("unexpected end of event stream\n"); 881 pr_err("unexpected end of event stream\n");