Skip to content

Commit

Permalink
perf tools: Handle EINTR error for readn/writen
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Namhyung Kim authored and Jiri Olsa committed Apr 29, 2014
1 parent 2011319 commit e148c76
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tools/perf/util/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit e148c76

Please sign in to comment.