linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, Namhyung Kim <namhyung@kernel.org>,
	Jiri Olsa <jolsa@kernel.org>
Subject: [PATCH 1/6] perf tools: Handle EINTR error for readn/writen
Date: Tue, 29 Apr 2014 15:47:45 +0200	[thread overview]
Message-ID: <1398779270-10271-2-git-send-email-jolsa@kernel.org> (raw)
In-Reply-To: <1398779270-10271-1-git-send-email-jolsa@kernel.org>

From: Namhyung Kim <namhyung@kernel.org>

Those readn/writen functions are to ensure read/write does I/O for
a given size exactly.  But ion() - its implementation - does not
handle in case it returns prematurely due to a signal.  As it's not
an error itself so just retry the operation.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1398346054-3322-1-git-send-email-namhyung@kernel.org
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/util/util.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index 9f66549..7fff6be 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -166,6 +166,8 @@ static ssize_t ion(bool is_read, int fd, void *buf, size_t n)
 		ssize_t ret = is_read ? read(fd, buf, left) :
 					write(fd, buf, left);
 
+		if (ret < 0 && errno == EINTR)
+			continue;
 		if (ret <= 0)
 			return ret;
 
-- 
1.8.3.1


  reply	other threads:[~2014-04-29 13:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-30 10:11 [GIT PULL 0/6] perf/core improvements and fixes Jiri Olsa
2014-04-29 13:47 ` Jiri Olsa [this message]
2014-04-29 13:47 ` [PATCH 2/6] perf tools: Parse tracepoints with '-' in system name Jiri Olsa
2014-04-29 13:47 ` [PATCH 3/6] perf tests: Add numeric identifier to evlist_test Jiri Olsa
2014-04-29 13:47 ` [PATCH 4/6] perf tests: Add a test of kvm-390: trace event Jiri Olsa
2014-04-29 13:47 ` [PATCH 5/6] perf tools: Move u64_swap union Jiri Olsa
2014-04-29 13:47 ` [PATCH 6/6] perf tools ARM64: Wire up perf_regs and unwind support Jiri Olsa
2014-05-01  6:26 ` [GIT PULL 0/6] perf/core improvements and fixes Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1398779270-10271-2-git-send-email-jolsa@kernel.org \
    --to=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).