From 5224b5c8815b8afb888359719e1d05c1e2514c48 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 20 Oct 2011 14:45:59 -0400 Subject: [PATCH] Implement ustctl_unmap_channel() Signed-off-by: Mathieu Desnoyers --- include/ust/lttng-ust-ctl.h | 6 +++++- libustctl/ustctl.c | 8 ++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/ust/lttng-ust-ctl.h b/include/ust/lttng-ust-ctl.h index 96d627c3..58906a57 100644 --- a/include/ust/lttng-ust-ctl.h +++ b/include/ust/lttng-ust-ctl.h @@ -71,7 +71,6 @@ struct lttng_ust_calibrate; int ustctl_calibrate(int sock, struct lttng_ust_calibrate *calibrate); /* TODO: object_data send/recv between sessiond and consumer */ -/* TODO: release shm_handle */ /* * Map channel shm_handle and add streams. Typically performed by the @@ -80,6 +79,11 @@ int ustctl_calibrate(int sock, struct lttng_ust_calibrate *calibrate); struct shm_handle *ustctl_map_channel(struct object_data *chan_data); int ustctl_add_stream(struct shm_handle *shm_handle, struct object_data *stream_data); +/* + * Note: the object_data from which the shm_handle is derived can only + * be released after unmapping the handle. + */ +void ustctl_unmap_channel(struct shm_handle *shm_handle); /* Buffer operations */ diff --git a/libustctl/ustctl.c b/libustctl/ustctl.c index 3d886d33..581de965 100644 --- a/libustctl/ustctl.c +++ b/libustctl/ustctl.c @@ -444,6 +444,14 @@ int ustctl_add_stream(struct shm_handle *handle, return 0; } +void ustctl_unmap_channel(struct shm_handle *handle) +{ + struct channel *chan; + + chan = shmp(handle, handle->chan); + channel_destroy(chan, handle, 1); +} + /* For mmap mode, readable without "get" operation */ /* returns the length to mmap. */ -- 2.34.1