lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-ID: <20160523212455.GM8897@kernel.org> Date: Mon, 23 May 2016 18:24:55 -0300 From: Arnaldo Carvalho de Melo <acme@...nel.org> To: Wang Nan <wangnan0@...wei.com> Cc: pi3orama@....com, linux-kernel@...r.kernel.org, He Kuang <hekuang@...wei.com>, Arnaldo Carvalho de Melo <acme@...hat.com>, Jiri Olsa <jolsa@...nel.org>, Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>, Namhyung Kim <namhyung@...nel.org>, Zefan Li <lizefan@...wei.com> Subject: Re: [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;
Powered by blists - more mailing lists