summaryrefslogtreecommitdiff
path: root/tools/perf/util/evlist.c
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2020-09-03 15:29:37 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2020-09-04 22:11:16 +0300
commitee7fe31e6e264d748bec5378c4d5417e14019666 (patch)
treec0ae27125c8daa0e07eaf690100af1c9ce5d7cf6 /tools/perf/util/evlist.c
parent9818923634206b751192e8f1554ecb93874d7d9f (diff)
downloadlinux-ee7fe31e6e264d748bec5378c4d5417e14019666.tar.xz
perf tools: Consolidate close_control_option()'s into one function
Consolidate control option fifo closing into one function. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Suggested-by: Alexey Budankov <alexey.budankov@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Link: http://lore.kernel.org/lkml/20200903122937.25691-1-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/evlist.c')
-rw-r--r--tools/perf/util/evlist.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index e72ff7e78dec..ee7b576d3b12 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -1802,6 +1802,16 @@ int evlist__parse_control(const char *str, int *ctl_fd, int *ctl_fd_ack, bool *c
return 0;
}
+void evlist__close_control(int ctl_fd, int ctl_fd_ack, bool *ctl_fd_close)
+{
+ if (*ctl_fd_close) {
+ *ctl_fd_close = false;
+ close(ctl_fd);
+ if (ctl_fd_ack >= 0)
+ close(ctl_fd_ack);
+ }
+}
+
int evlist__initialize_ctlfd(struct evlist *evlist, int fd, int ack)
{
if (fd == -1) {