Messages in this thread |  | | Date | Thu, 28 Nov 2013 08:19:51 -0700 | From | David Ahern <> | 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
|  |