[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <52975F17.2050402@gmail.com>
Date: Thu, 28 Nov 2013 08:19:51 -0700
From: David Ahern <dsahern@...il.com>
To: Jiri Olsa <jolsa@...hat.com>, linux-kernel@...r.kernel.org
CC: Ingo Molnar <mingo@...nel.org>,
Frederic Weisbecker <fweisbec@...il.com>,
Peter Zijlstra <peterz@...radead.org>,
Namhyung Kim <namhyung@...nel.org>,
Mike Galbraith <efault@....de>,
Adrian Hunter <adrian.hunter@...el.com>,
Arnaldo Carvalho de Melo <acme@...hat.com>
Subject: Re: [PATCH 3/7] perf tools: Fine tune readn function
On 11/28/13, 3:30 AM, Jiri Olsa wrote:
> @@ -151,21 +152,26 @@ unsigned long convert_unit(unsigned long value, char *unit)
> return value;
> }
>
> +/*
> + * Read exactly 'n' bytes or return an error.
> + */
> ssize_t readn(int fd, void *buf, size_t n)
> {
> void *buf_start = buf;
> + size_t left = n;
>
> - while (n) {
> - ssize_t ret = read(fd, buf, n);
> + while (left) {
> + ssize_t ret = read(fd, buf, left);
>
> if (ret <= 0)
> return ret;
handle EINTR errors? no need to fail readn if the system call is
interrupted.
David
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists