From: Mathieu Desnoyers Date: Sun, 11 Dec 2011 16:32:20 +0000 (-0500) Subject: add ustctl_release_handle X-Git-Tag: v1.9.1~9 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=2be0e72cf5e765e859c639daf37886ebd9640818;p=lttng-ust.git add ustctl_release_handle Signed-off-by: Mathieu Desnoyers --- 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); } /*