X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=liblttng-ust%2Flttng-context-perf-counters.c;h=83b371c5ba91431f47f44ce6880a4087d2e0244c;hb=faccc28ac2aa16092117eae5181fce79fff98396;hp=d6bd41cc9e20a170dc73f5d76d473781cdd1e737;hpb=d58d145447ffcc9497801769e1fe754b30dca5b8;p=lttng-ust.git diff --git a/liblttng-ust/lttng-context-perf-counters.c b/liblttng-ust/lttng-context-perf-counters.c index d6bd41cc..83b371c5 100644 --- a/liblttng-ust/lttng-context-perf-counters.c +++ b/liblttng-ust/lttng-context-perf-counters.c @@ -134,7 +134,7 @@ static struct perf_event_mmap_page *setup_perf(struct perf_event_attr *attr) { void *perf_addr; - int fd; + int fd, ret; fd = sys_perf_event_open(attr, 0, -1, -1, 0); if (fd < 0) @@ -144,7 +144,10 @@ struct perf_event_mmap_page *setup_perf(struct perf_event_attr *attr) PROT_READ, MAP_SHARED, fd, 0); if (perf_addr == MAP_FAILED) return NULL; - close(fd); + ret = close(fd); + if (ret) { + perror("Error closing LTTng-UST perf memory mapping FD"); + } return perf_addr; } @@ -399,6 +402,7 @@ int lttng_add_perf_counter_to_ctx(uint32_t type, * the field here. */ + lttng_context_update(*ctx); return 0; setup_error: