Zero out callback pointers in consumer process
[lttng-ust.git] / liblttng-ust-ctl / ustctl.c
index 886e8485bc8cf683736b52b788d04e9cfdc0f1cf..cd80faec38270b94c662f4ea24fff5fd8d6b5e20 100644 (file)
@@ -449,6 +449,12 @@ struct lttng_ust_shm_handle *ustctl_map_channel(struct lttng_ust_object_data *ch
                return NULL;
        }
        memcpy(handle->shadow_chan, chan, chan_size);
+       /*
+        * The callback pointers in the producer are invalid in the
+        * consumer. Zero them out.
+        */
+       memset(&handle->shadow_chan->backend.config.cb, 0,
+               sizeof(handle->shadow_chan->backend.config.cb));
        return handle;
 }
 
@@ -650,8 +656,11 @@ int ustctl_put_subbuf(struct lttng_ust_shm_handle *handle,
 }
 
 int ustctl_flush_buffer(struct lttng_ust_shm_handle *handle,
-               struct lttng_ust_lib_ring_buffer *buf)
+               struct lttng_ust_lib_ring_buffer *buf,
+               int producer_active)
 {
-       lib_ring_buffer_switch_slow(buf, SWITCH_ACTIVE, handle);
+       lib_ring_buffer_switch_slow(buf,
+               producer_active ? SWITCH_ACTIVE : SWITCH_FLUSH,
+               handle);
        return 0;
 }
This page took 0.023412 seconds and 4 git commands to generate.