Fix: don't call __builtin_return_address(0) on 32-bit powerpc
[lttng-ust.git] / liblttng-ust / lttng-context-perf-counters.c
index d6bd41cc9e20a170dc73f5d76d473781cdd1e737..97ddf977d1ba17706ae337bb66d3c1241da13038 100644 (file)
@@ -69,7 +69,7 @@ struct lttng_perf_counter_field {
 static pthread_key_t perf_counter_key;
 
 static
-size_t perf_counter_get_size(size_t offset)
+size_t perf_counter_get_size(struct lttng_ctx_field *field, size_t offset)
 {
        size_t size = 0;
 
@@ -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;
 }
 
@@ -277,12 +280,12 @@ void perf_counter_record(struct lttng_ctx_field *field,
 
 static
 void perf_counter_get_value(struct lttng_ctx_field *field,
-               union lttng_ctx_value *value)
+               struct lttng_ctx_value *value)
 {
        uint64_t v;
 
        v = wrapper_perf_counter_read(field);
-       value->s64 = v;
+       value->u.s64 = v;
 }
 
 /* Called with UST lock held */
@@ -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:
This page took 0.025891 seconds and 4 git commands to generate.