lkml.org 
[lkml]   [2016]   [May]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH v3 01/11] perf tools: Add API to pause/resume a evlist
Em Mon, May 23, 2016 at 07:13:38AM +0000, Wang Nan escreveu:
> +++ b/tools/perf/util/evlist.c
> @@ -679,6 +679,38 @@ static struct perf_evsel *perf_evlist__event2evsel(struct perf_evlist *evlist,
> return NULL;
> }
>
> +static int perf_evlist__set_paused(struct perf_evlist *evlist, bool pause)
> +{
> + int i;
> +
> + for (i = 0; i < evlist->nr_mmaps; i++) {
> + int fd = evlist->mmap[i].fd;
> + int err;
> +
> + if (fd < 0)
> + continue;
> + err = ioctl(fd, PERF_EVENT_IOC_PAUSE_OUTPUT,
> + pause ? 1 : 0);
> + if (err) {
> + err = (errno == 0 ? -EINVAL : -errno);
> + pr_err("Unable to pause output on %d: %s\n",
> + fd, strerror(-err));

I changed this to:
if (err)
return err;

Like all other ioctl wrappers in evlist.c, i.e. usage model is the same
as with 'ioctl()': -1 indicates that it failed, if code using this
function wants to know more about the reason for the error, check errno.

Ah, we can't use 'pause' as a parameter name, that breaks the build on
Ubuntu 12.04 and other old glibc headers, I fixed that as well.

- Arnaldo

> + return err;
> + }
> + }
> + return 0;
\
 
 \ /
  Last update: 2016-05-23 23:41    [W:0.364 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site