From 2be0e72cf5e765e859c639daf37886ebd9640818 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Sun, 11 Dec 2011 11:32:20 -0500 Subject: [PATCH] add ustctl_release_handle Signed-off-by: Mathieu Desnoyers --- include/lttng/ust-ctl.h | 4 +++- liblttng-ust-ctl/ustctl.c | 28 ++++++++++++++++++---------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/include/lttng/ust-ctl.h b/include/lttng/ust-ctl.h index 0f8aa835..47c78b74 100644 --- a/include/lttng/ust-ctl.h +++ b/include/lttng/ust-ctl.h @@ -131,7 +131,9 @@ void ustctl_flush_buffer(struct lttng_ust_shm_handle *handle, struct lttng_ust_lib_ring_buffer *buf, int producer_active); -/* Release object created by members of this API */ +/* Release object created by members of this API. */ int ustctl_release_object(int sock, struct lttng_ust_object_data *data); +/* Release handle returned by create session. */ +int ustctl_release_handle(int sock, int handle); #endif /* _LTTNG_UST_CTL_H */ diff --git a/liblttng-ust-ctl/ustctl.c b/liblttng-ust-ctl/ustctl.c index 13100aeb..5405418c 100644 --- a/liblttng-ust-ctl/ustctl.c +++ b/liblttng-ust-ctl/ustctl.c @@ -40,6 +40,23 @@ void init_object(struct lttng_ust_object_data *data) data->memory_map_size = 0; } +int ustctl_release_handle(int sock, int handle) +{ + struct ustcomm_ust_msg lum; + struct ustcomm_ust_reply lur; + int ret; + + if (sock >= 0) { + memset(&lum, 0, sizeof(lum)); + lum.handle = handle; + lum.cmd = LTTNG_UST_RELEASE; + ret = ustcomm_send_app_cmd(sock, &lum, &lur); + if (ret < 0) { + return ret; + } + } + return 0; +} /* * If sock is negative, it means we don't have to notify the other side * (e.g. application has already vanished). @@ -62,16 +79,7 @@ int ustctl_release_object(int sock, struct lttng_ust_object_data *data) return ret; } } - if (sock >= 0) { - memset(&lum, 0, sizeof(lum)); - lum.handle = data->handle; - lum.cmd = LTTNG_UST_RELEASE; - ret = ustcomm_send_app_cmd(sock, &lum, &lur); - if (ret < 0) { - return ret; - } - } - return 0; + return ustctl_release_handle(sock, data->handle); } /* -- 2.34.1