lkml.org 
[lkml]   [2014]   [Apr]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v3 1/3] perf tools: Handle EINTR error for readn/writen
Date
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>
---
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 9f66549562bd..7fff6be07f07 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.7.9.2


\
 
 \ /
  Last update: 2014-04-24 16:21    [W:0.458 / U:0.384 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site