consumerd: Implement clear stream/session commands
[lttng-tools.git] / src / common / relayd / relayd.c
index b936a4d3e7798e35e90983b6e20692d2b291bfc8..9f0cf1e3e56e74038ecc4c61f99e1e9cdbed7431 100644 (file)
@@ -941,3 +941,45 @@ int relayd_reset_metadata(struct lttcomm_relayd_sock *rsock,
 error:
        return ret;
 }
+
+/*
+ * Ask the relay to clear files associated with the socket session.
+ */
+int relayd_clear_session(struct lttcomm_relayd_sock *rsock)
+{
+       int ret;
+       struct lttcomm_relayd_generic_reply reply;
+
+       /* Code flow error. Safety net. */
+       assert(rsock);
+
+       DBG("Relayd clear session");
+
+       /* Send command */
+       ret = send_command(rsock, RELAYD_CLEAR_SESSION_CUSTOM_EFFICIOS, NULL, 0, 0);
+       if (ret < 0) {
+               goto error;
+       }
+
+       /* Receive response */
+       ret = recv_reply(rsock, (void *) &reply, sizeof(reply));
+       if (ret < 0) {
+               goto error;
+       }
+
+       reply.ret_code = be32toh(reply.ret_code);
+
+       /* Return session id or negative ret code. */
+       if (reply.ret_code != LTTNG_OK) {
+               ret = -1;
+               ERR("Relayd clear session replied error %d", reply.ret_code);
+       } else {
+               /* Success */
+               ret = 0;
+       }
+
+       DBG("Relayd clear session successful");
+
+error:
+       return ret;
+}
This page took 0.025713 seconds and 5 git commands to generate.